2012/12/26
SQL Server Table Schema 查詢與欄位定序
/*資料表*/
Select * From SysObjects Where xType='U' Order By Name
/*欄位*/
Select * From SysObjects A Inner Join SysColumns B On A.ID=B.ID Where A.xType='U' Order By A.Name,ColID
/*讀取SQL 資料表欄位結構的SQL 語法*/
Select A.Name As TableName,B.ColOrder As ColOrder,B.Name As ColName,C.Name As ColType,B.Length As ColLen,B.XPrec As ColPrecision,B.XScale As ColScale
From (SysObjects A Inner Join SysColumns B On A.ID=B.ID) Inner Join SysTypes C On B.XType=C.XType
Where A.XType='u'
Order By A.Name,B.ColOrder
/*修改欄位定序*/
ALTER TABLE MyTable ALTER COLUMN CharCol
varchar(10) COLLATE Chinese_Taiwan_Stroke
2012/11/13
reverse proxy without apache http server
在 $tomcat_home\conf\server.xml 中修改以下內容
<host appbase="" name="localhost" p="">unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<valve classname="org.apache.catalina.valves.AccessLogValve" directory="logs" p="">prefix="appName_access_log." suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" resolveHosts="false"/>
<context docbase="webapps/appName" path="" reloadable="false"></context>
</valve>
</host>
2012/11/12
Amazon EC2 Running Tomcat on port 80
SSH command:
#sudo /sbin/iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
#sudo /sbin/service iptables save
server.xml:
#service tomcat7 restart
#sudo /sbin/iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
#sudo /sbin/service iptables save
server.xml:
#service tomcat7 restart
2012/10/18
SSH in CentOS 6.3
SSH 安裝
#sudo yum install openssh-server openssh-clients
SSH 開機時啟動
#sudo /sbin/chkconfig sshd on
SSH 啟動
#sudo /sbin/service sshd start
防火牆設定
#sudo vi /etc/sysconfig/iptables
添加下面一行(範例 port = 22)
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
重新啟動防火牆
#sudo /sbin/service iptables stop
#sudo /sbin/service iptables start
調整 SSH 設定
#vi /etc/ssh/sshd_config
禁止 root 通過 SSH 登入
PermitRootLogin no
重新啟動
vsftpd 2.2 in CentOS 6.3
安裝 vsftpd
#yum install vsftpd
設定開機啟動 vsftpd ftp
#chkconfig vsftpd on
啟動服務
#service vsftpd start|restart|stop
修改 server port(注意防火牆設定是否完成)
#vi /etc/vsftpd/vsftpd.conf
在最後一行的地方加上: listen_port=21
新增 ftp 使用者
#vi /etc/vsftpd/vsftpd.conf
拿掉以下兩個註解:
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list
增加使用者 ftpuser,指向路徑 /home/wwwroot/ftpuser, 禁止使用 SSH 權限
#useradd -d /home/wwwroot/ftpuser -g ftp -s /sbin/nologin ftpuser
(wwwroot需要先用 mkdir 的方式建立)
修改密碼
#passwd ftpuser
編輯文件chroot_list:
#vi /etc/vsftpd/chroot_list
內容為 ftp 帳號,每個帳號都佔一行:
jeff
nina
登入 ftp 後可轉換至個人目錄
#setsebool -P ftp_home_dir on
配置防火牆
編輯設置文件
#vi /etc/sysconfig/iptables
在REJECT行之前加上以下指令(範例是將 21 port 在防火牆開啟)
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT
重新啟動防火牆
#service iptables start
2012/10/11
Bluetooth Support Service Setting
Bluetooth Support Service Setting
Part 1 of the solution is buried in this Microsoft Knowledgebase article:
And I quote:
How to make sure that the Bluetooth service is started
- Open the Microsoft Management Console (MMC) snap-in for Services. To do this, follow these steps.
Windows Vista or Windows 7
- Click Start, copy and then paste (or type) the following command in the Start Search box, and then press ENTER: services.msc
- In the Programs list, click Services.
If you are prompted for an administrator password or for confirmation, type the password, or click Continue.Windows XP
- Click Start, and then click Run.
- Copy and then paste (or type) the following command in the Open box, and then press ENTER: services.msc
- Double-click the Bluetooth Support service.
- If the Bluetooth Support service is stopped, click Start.
- On the Startup type list, click Automatic.
- Click the Log On tab.
- Click Local System account.
- Click OK.
- If you prompted to restart the computer, click Yes.
My log on settings were okay, but my Startup Type was set to “Manual” rather than “Automatic”. I changed it, like so:
Bluetooth Power Management Setting
But sadly, my problem wasn’t solved. So then I tried something else. I opened up Device Manager, expanded “Bluetooth Radios”, and double-clicked on the device to open its Properties page – not the enumerator, the device.
Go to the Power Management page and clear the checkbox “Allow the computer to turn off this device to save power”. And finally, relief! No more disconnects. Apparently there is a bug in the power management of the Bluetooth driver under Windows 7.
I can’t say for sure that the first step of making the Bluetooth Support Service automatic is necessary, or just turning off power management would fix it. It doesn’t hurt to change it to automatic so I didn’t test this. If you test it, post your results. Are both changes needed, or do you just need to turn off power management to stop losing connection?
文章來自這裡
2012/08/29
2012/08/22
XMLBeans command
install
scomp -compiler c:\java_tools\java\jdk1.7\bin\javac.exe -out 1sync_xml_datasource.jar schema/common/1.0/AttrTypes.xsd schema/common/1.0/Header.xsd schema/common/1.0/Types.xsd schema/item/1.0/CatalogueRequestProxy.xsd schema/item/1.0/ResponseProxy.xsd schema/item/1.0/Types.xsd
2012/07/23
Install PostgreSQL 8.2.23 in CentOS 5.8
- Download source files from here
- Upload files to the CentOS server
- Prepare the necessary files
- #yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
- #tar -zxf postgresql-8.2.23.tar.gz
- #cd postgresql*
- #./configure --prefix=/usr/local/pgsql --without-readline
- #make && make install
- Setting PostgreSQL config process
- create user: #adduser postgres
- create password: #passwd postgres
- Authorized folder/files:
- #mkdir /usr/local/pgsql/data
- #chown -R postgres /usr/local/pgsql
- login as postgres: su postgres
- initial dataset: /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
- edit config
- #vi /usr/local/pgsql/data/postgresql.conf
- find listen_addresses = ‘localhost’ to listen_addresses = '*'
- #vi /usr/local/pgsql/data/pg_hba.conf
- IPv4 local connections: host all all 127.0.0.1/32 trust
- Update user env. parameters
- #vim /var/lib/pgsql/.bash_profile
- [ -f /etc/profile ] && source /etc/profile
- PGDATA=/usr/local/pgsql/dataexport PATH=/usr/local/pgsql/bin:$PATHexport PGDATA
- Start the service
- start SQL service:
- #su - postgres
- #/usr/local/pgsql/bin/pg_ctl start -i -D /usr/local/pgsql/data
- check SQL status: ps aux | grep postgres
- update postgres user
- #su - postgres
- #psql postgres
- #alter user postgres ENCRYPTED PASSWORD 'postgres';
- host all all 192.168.1.0/24 password
Note that: you have a short cut to figure out:
command line: yum -y install postgresql postgresql-libs postgresql-server
2012/07/20
Install Tomcat 6 in CentOS 5.8
- Install Tomcat 6 Process
- cd /etc/yum.repos.d
- wget 'http://www.jpackage.org/jpackage50.repo'
- yum update
- yum install tomcat6 tomcat6-webapps tomcat6-admin-webapps
- service tomcat6 start
- If you have problems accessing the server from another machine you may need to do the following:
- setup
- "Firewall configuration"
- "Customize"
- "Other ports" 8080:tcp
- "Ok"
- service tomcat6 restart
- If you get a dependency error:
- rpm -Uvh 'http://plone.lucidsolutions.co.nz/linux/centos/images/jpackage-utils-compat-el5-0.0.1-1.noarch.rpm'
- tomcat_home: /usr/share/tomcat6
- "tomcat" is a default execute tomcat server user.
Install JDK 1.6 in CentOS 5.8
- Download jdk(jdk-6u33-linux-i586-rpm.bin) from Java Sun
- cd /root
- cp jdk-6u33-linux-i586-rpm.bin /usr/local
- cd /usr/local
- chmod +x jdk-6u33-linux-i586-rpm.bin
- ./ jdk-6u33-linux-i586-rpm.bin
- Test JDK
- By default Java will be installed to /usr/java/jdk1.6.0_33/
- /usr/java/jdk1.6.0_33/bin/java -version
- Choosing JDK
- alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_33/bin/java 2
- alternatives --config java
There are 3 programs which provide 'java'.
Selection Command
-----------------------------------------------
*+ 1 /usr/lib/jvm/jre-1.6.0-openjdk/bin/java
2 /usr/lib/jvm/jre-1.4.2-gcj/bin/java
3 /usr/java/jdk1.6.0_33/bin/java
Enter to keep the current selection[+], or type selection number: 3
Done!
2012/04/12
Uninstall PostgreSQL 8.2 for MAC 10.6.8
Steps to uninstall PostgreSQL 8.4 (Assuming default locations)
1) Stop the server and remove the service.
sudo launchctl unload /Library/LaunchDaemons/com.edb.launchd.postgresql-8.4.plist
2) Remove the plist file.
sudo rm -f /Library/LaunchDaemons/com.edb.launchd.postgresql-8.4.plist
3) Remove the Menu Icons
sudo rm -rf /Applications/PostgreSQL/8.4
4) Remove the Installation Files.
sudo rm -rf /Library/PostgreSQL/8.4
5) Remove the postgres user.
sudo dscl . delete /Users/postgres
6) Remove the ini file
sudo rm -f /etc/postgres-reg.ini
This will uninstall PostgreSQL 8.4 cleanly from your mac.
1) Stop the server and remove the service.
sudo launchctl unload /Library/LaunchDaemons/com.edb.launchd.postgresql-8.4.plist
2) Remove the plist file.
sudo rm -f /Library/LaunchDaemons/com.edb.launchd.postgresql-8.4.plist
3) Remove the Menu Icons
sudo rm -rf /Applications/PostgreSQL/8.4
4) Remove the Installation Files.
sudo rm -rf /Library/PostgreSQL/8.4
5) Remove the postgres user.
sudo dscl . delete /Users/postgres
6) Remove the ini file
sudo rm -f /etc/postgres-reg.ini
This will uninstall PostgreSQL 8.4 cleanly from your mac.
訂閱:
文章 (Atom)
NGINX SSL/設定檔案
#user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #...
-
Source: Automatically Retry Failed Jobs in Quartz Retrying continuously until success: If you want to keep trying over and over again un...
-
*主餐類 漢堡王炸雞腿-227大卡 華嫩雞條(6PCS)-259大卡 火烤漢堡-311大卡 火烤吉士漢堡-353大卡 小華堡-397大卡 華雪魚-471大卡 雙層吉士漢堡-534大卡 雙層燒烤培根堡-580大卡 華辣雞腿堡-597大卡 華香雞排堡-685大卡...
-
Download source files from here Upload files to the CentOS server Prepare the necessary files #yum -y install gcc gcc-c++ autoconf lib...