
2011年3月25日
var fixgeometry = function() {
/* Some orientation changes leave the scroll position at something
* that isn't 0,0. This is annoying for user experience. */
scroll(0, 0);
/* Calculate the geometry that our content area should take */
var header = $(".header:visible");
var footer = $(".footer:visible");
var content = $(".content:visible");
var viewport_height = $(window).height();
var content_height = viewport_height - header.outerHeight() - footer.outerHeight();
/* Trim margin/border/padding height */
content_height -= (content.outerHeight() - content.height());
content.height(content_height);
}; /* fixgeometry */
$(document).ready(function() {
$(window).bind("orientationchange resize pageshow", fixgeometry);
});
posted @
2013-01-28 10:59 The Matrix 閱讀(5194) |
評論 (1) |
編輯 收藏
http://java.dzone.com/articles/hibernate-tuning-queries-using?page=0,0
posted @
2012-05-14 14:28 The Matrix 閱讀(1215) |
評論 (0) |
編輯 收藏
環境:
Centos6.2(安裝在Vmware7.0中)
Magento1.6.2
Apache Httpd Server 2.2.15
MySql 5.1.61
PHP5.3.3
安裝過程:
apache http、mysql、php及相關擴展安裝:
其中apache http、Mysql、php都是利用centos的添加/刪除軟件功能進行安裝。同時使用該功能安裝"php-xml"、"php-gd"、"php-pdo"、"php-mbstring"、"php-mysql"擴展。
使用chkconfig配置httpd和mysql為系統服務。命令如下:
chkconfig httpd on
chkconfig -add mysqld
chkconfig mysqld on
使用chkconfig --list 可以查看所有的服務配置狀態
使用service httpd start、service mysqld start啟動httpd和mysqld服務。可以通過service httpd restart重啟相關服務。
此時訪問本機的http://localhost可以看到apache的歡迎界面,同時編輯index.php文件,其內容如下:
<?php
phpinfo();
?>
并將該文件置于/var/www/html目錄下,訪問http://localhost/index.php,此時應該不能看到php版本信息,僅能看到index.php的靜態文本內容。
修改/etc/httpd/conf/httpd.conf文件,修改如下:
DirectoryIndex index.html index.html.var -> DirectoryIndex index.html index.htm index.php
增加:
AddType application/x-httpd-php .php
AddDefaultCharset -> AddDefaultCharset off (解決中文亂碼問題)
增加一段VirtualHost描述,如下(在配置文件的最后):
<VirtualHost *:80>
DocumentRoot /var/www/smallfive
ServerName smallfive
ServerAlias smallfive.com *.smallfive.com
</VirtualHost>
此時訪問http://localhost/index.php,應該一切正常
設置數據庫:
使用mysqladmin -u root password 'newpassword'設置mysql數據庫的默認密碼
讓數據庫更安全:
mysql -u root -p 進入mysql
mysql> DROP DATABASE test; 刪除test數據庫
mysql> DELETE FROM mysql.user WHERE user = ''; 刪除匿名帳戶
mysql> FLUSH PRIVILEGES; 重載權限
創建magento數據庫
mysql> CR 訪問magento數據庫,確保一切正常
配置Magento:
解壓縮magento1.6.2版本至/var/www/smallfive/magento目錄
解壓命令:
EATE DATABASE magento;
mysql> GRANT ALL PRIVILEGES ON magento.* TO 'root'@'localhost' IDENTIFIED BY 'newpassword';
tar zxvf magento1.6.2.tar.gz
此時訪問http://localhost/magento,可根據magento的設置進行配置
注意如下問題:
1、確保當前用戶擁有對/var/www/smallfive/magento可讀可寫權限
2、還需安裝mcrypt庫,安裝這個庫比較繁瑣,mcrypt依賴于Libmcrypt庫和mhash庫,我們需要下載Libmcrypt庫和mhash庫安裝它們,然后再編譯Mcrypt。
在編譯之前,先做好如下準備工作:
a、安裝phpize:yum -y install php-devel
b、安裝C++腳本編譯模塊:
yum -y install gcc gcc-g++
yum -y install gcc gcc-c++
安裝mcrypt庫過程,如下:
a、下載libmcrypt和mhash庫
Libmcrypt:http://sourceforge.net/project/showfiles.php?group_id=87941&package_id=91774&release_id=487459
mhash:http://sourceforge.net/project/showfiles.php?group_id=4286&package_id=4300&release_id=645636
b、將上述兩個下載后,分別解壓,并執行如下命令編譯:
./configure
make && make install
c、下載php對應的源代碼,解壓,
進入php源代碼的 /ext/mcrypt目錄
執行phpize命令
./configure –with-php-config=/usr/bin/php-config
make && make install
d、在php.ini文件中增加如下內容:
extension=/usr/lib/php/modules/mcrypt.so
mcrypt.so文件路徑在php-config文件中可以找到
e、service httpd restart
end!
參考文章:
http://www.eexu.com/article.asp?id=1730
http://www.ruiwant.com/centos-6-0%E4%B8%8Bmagento%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE%E6%80%BB%E7%BB%93.html
http://zixun.www.net.cn/qita/2344.html
http://os.qudong.com/Linux/2010/0210/64441.html
posted @
2012-04-04 17:09 The Matrix 閱讀(3132) |
評論 (1) |
編輯 收藏
有時在vmware里面安裝的系統或應用有License時間的限制,可以通過修改虛擬機時間的方法來防止過期,此時需在.vmx文件中加入下面的內容:
tools.syncTime = "FALSE"time.synchronize.continue = "FALSE"time.synchronize.restore = "FALSE"time.synchronize.resume.disk = "FALSE"time.synchronize.shrink = "FALSE"rtc.startTime = 1183431600 #這是用來指定虛擬機啟動后的時間。數字是自1970年1月1日零時零分零秒以來的秒數,可以通過如下網址將某個時間轉換為該數字(Unix時間戳):http://www.onlineconversion.com/unix_time.htm
注意:同時還需在虛擬機操作系統的服務中,停用“VMware Tools Service”的服務。
在Windows Server 2003中操作系統自身也有時間同步功能,需在時間設定中停用,同時停用“Windows Timer”服務。
posted @
2012-03-02 10:51 The Matrix 閱讀(8685) |
評論 (0) |
編輯 收藏
主要參見:
http://blog.chenlb.com/2011/03/install-apache-php-wordpress-windows.html
在安裝好apache http server后,如果端口不正確,則修改"apache安裝目錄/conf/httpd.conf"文件中的如下信息:
#ServerName localhost:80 -> ServerName localhost:8060
Apache HTTP Server版本:2.2
PHP版本:5.3.8
WordPress版本:3.2.1
posted @
2011-11-27 21:28 The Matrix 閱讀(658) |
評論 (0) |
編輯 收藏
1. 打開工具Oracle SQL Plus 以dba身份登錄sys用戶
sqlplus /nolog
conn sys@url as sysdba
2. 創建用戶并指定表空間
使用客戶端工具或者Web管理控制臺創建表空間以及用戶
給用戶賦予connect、resource、dba權限
grant connect,resource,dba to username;
注意:給oracle用戶分配connect、resource角色時,此時connect 角色中有一個 UNLIMITED TABLESPACE 權限,也就是username這個用戶可以在其他表空間里隨意建表。
revoke unlimited tablespce from username; --撤銷username用戶在任意表空間建表的權限
alter user username quota 0 on users; --alter username quota 0 on Users; // 還不是很清楚具體含義???
alter user username quota unlimited on tablespacename; --賦予username用戶在tablespacename表空間任意建表的權限;
3. 使用imp工具導入dmp數據文件
imp username/password@url file=c:\db.dmp fromuser=username1 touser=username log=c:\log.txt
-------------------------------------------------------------------------------------------------------------
其它命令:
select * from dba_users; --查詢用戶
select * from dba_tables; --查詢表
select * from dba_views; --查詢視圖
select * from dba_tablespaces; --查詢表空間
oracle 10g,查詢表空間使用率
Select * from sys.DBA_TABLESPACE_USAGE_METRICS;
-------------------------------------------------------------------------------------------------------------
drop user username cascade;
ORA-01940:無法刪除當前已連接的用戶
select username, sid, serial# from v$session where username='username';
alter system kill session'sid,serial#'
posted @
2011-05-31 16:43 The Matrix 閱讀(3897) |
評論 (0) |
編輯 收藏
環境:Windows7 professional
1、下載redmine1.1.3.zip、ruby1.8.7、rubygems-1.3.7.zip、mysql 5.0
2、安裝MySQL5.0,cmd窗口下使用mysql -u root -p 登錄MySQL數據庫,執行如下語句創建redmine數據庫及用戶:
create database redmine character set utf8;
create user 'redmine'@'localhost' identified by 'my_password';
grant all privileges on redmine.* to 'redmine'@'localhost';
注:
使用MySQL5.5在后面進行初始數據時Ruby會提示連接有問題
在安裝完MySQL后,先不要進行配置,至“MySQL安裝路徑\bin”目錄下,修改MySQLInstanceConfig.exe為“以管理員成分執行此程序”,“以兼容模式運行該程序”
進行數據庫配置時,選擇字符集為utf8
3、運行ruby1.8.7安裝包,解壓至d:/ruby187,將d:/ruby187/bin添加至path環境變量中
安裝后可執行 ruby -v查看ruby版本以檢驗安裝是否正確
4、解壓rubygems-1.3.7.zip至d:/rubygems-1.3.7
進入d:/rubygems-1.3.7目錄,執行ruby setup.rb
注:Redmine需要rubygems 1.3.1 - 1.5.x,肯定不能用1.8.2版本
5、執行gem install rails -v=2.3.5 遠程安裝rails2.3.5版本
gem install mysql
gem install -v=0.4.2 i18n
6、解壓縮redmine1.1.3至d:/redmine1.1.3目錄
進入d:/redmine-1.1.3/config目錄,修改database.yml.example文件為database.yml,并修改該文件中的production數據庫連接配置為如下:
production:
adapter: mysql
database: redmine
host: localhost
username: redmine
password: my_password
encoding: utf8
進入d:/redmine1.1.3目錄,執行
rake config/initializers/session_store.rb
rake db:migrate RAILS_ENV="production"
7、加載默認配置數據
rake redmine:load_default_data RAILS_ENV="production"
默認語言選擇"zh"
8、運行
ruby script/server webrick -e production
9、訪問:http://localhost:3000
使用admin/admin進行登入
進入設置,把默認語言設為“簡體中文”,然后設置當前用戶的默認語言設為“簡體中文”,這樣就是中文界面了
-----------------------------------------
繼續,將redmine設置為windows 7的服務
1、首先需要配置mysql為windows 7的服務
2、Ruby提供一個安裝Ruby程序為服務的包:mongrel_service。安裝其實很簡單,運行:gem install mongrel_service
3、安裝redmine為服務,執行mongrel_rails service::install -N RedMine -c C:\redmine-1.1.3 -p 3000 –e production
注意:此處打開cmd窗口時,需要輸入cmd后,不是直接按Enter,而是按 Ctrl+Shift+Enter打開Cmd窗口,此時以管理員身份打開,否則安裝為服務時會提示拒絕訪問。
4、安裝服務后,需檢查服務-e后的參數是不是production,如果不是production而是development,則在注冊表中把參數手動改為production。修改方法是:打開“注冊表編輯器”,展開分支“HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services”,選擇redmine服務,找到ImagePath項,修改保存后在服務列表中啟動服務,并把服務設置自動啟動。
OK!
posted @
2011-05-20 10:25 The Matrix 閱讀(2791) |
評論 (0) |
編輯 收藏
參見如下鏈接:
posted @
2011-03-25 21:33 The Matrix 閱讀(1209) |
評論 (0) |
編輯 收藏