mysql> alter table text_products add plimit int ;
alter table text_products alter plimit set default '500' ;
Thursday, August 12, 2010
Friday, August 6, 2010
enable tomcat https
#! /bin/sh
KEYTOOL=/usr/java/jdk1.6.0_11/bin/keytool
echo "check keytool"
if [ -e $KEYTOOL ]
then
echo "JDK keytool found."
else
echo "/usr/java/jdk1.6.0_11/bin/keytool not found"
exit
fi
echo "install tomat ssl self-signed certificate"
sudo $KEYTOOL -genkey -alias tomcat -keyalg RSA -keystore ntr_new.jks -storepass changeit -keypass changeit -dname "CN=Greg Smith, OU=GF, O=AMP, L=Mountain, ST=VA, C=US" -validity 360
sudo rm /opt/tomcat/ntr.jks
sudo cp ntr_new.jks /opt/tomcat/ntr.jks
sudo rm -f ntr_new.jks
KEYTOOL=/usr/java/jdk1.6.0_11/bin/keytool
echo "check keytool"
if [ -e $KEYTOOL ]
then
echo "JDK keytool found."
else
echo "/usr/java/jdk1.6.0_11/bin/keytool not found"
exit
fi
echo "install tomat ssl self-signed certificate"
sudo $KEYTOOL -genkey -alias tomcat -keyalg RSA -keystore ntr_new.jks -storepass changeit -keypass changeit -dname "CN=Greg Smith, OU=GF, O=AMP, L=Mountain, ST=VA, C=US" -validity 360
sudo rm /opt/tomcat/ntr.jks
sudo cp ntr_new.jks /opt/tomcat/ntr.jks
sudo rm -f ntr_new.jks
Sunday, August 1, 2010
mysql remove hex a0, 0d etc
SELECT TRIM(BOTH 'A0' FROM HEX(CAS)), UNHEX(TRIM(BOTH 'A0' FROM HEX(CAS))), HEX(CAS), CAS
FROM compounds
WHERE CAS REGEXP '[0-9]-[0-9]{2}-[0-9]{1}' AND CAS LIKE '1%' AND mol_id=2100088;
161735-79-1 161735-79-1 161735-79-1 ;
SELECT * FROM compounds WHERE CAS LIKE '%157283-68-6%' ;
31 35 37 32 38 33 2D 36 38 2D 36 A00D
SELECT * FROM compounds WHERE TRIM(CAS) = '161735-79-1' ;
SELECT CAS FROM compounds WHERE TRIM(CAS) LIKE "1%" ;
UPDATE compounds
SET CAS = UNHEX(TRIM(BOTH 'A0' FROM HEX(CAS)))
WHERE uid=21 ;
FROM compounds
WHERE CAS REGEXP '[0-9]-[0-9]{2}-[0-9]{1}' AND CAS LIKE '1%' AND mol_id=2100088;
161735-79-1 161735-79-1 161735-79-1 ;
SELECT * FROM compounds WHERE CAS LIKE '%157283-68-6%' ;
31 35 37 32 38 33 2D 36 38 2D 36 A00D
SELECT * FROM compounds WHERE TRIM(CAS) = '161735-79-1' ;
SELECT CAS FROM compounds WHERE TRIM(CAS) LIKE "1%" ;
UPDATE compounds
SET CAS = UNHEX(TRIM(BOTH 'A0' FROM HEX(CAS)))
WHERE uid=21 ;
Friday, July 30, 2010
redhat network config - ip address mask etc
[root@reloadedOld ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
BROADCAST=x.x.x.191
IPADDR=x.x.x..169
NETMASK=255.255.255.224
NETWORK=x.x.x.160
ONBOOT=yes
TYPE=Ethernet
GATEWAY=x.x.x.161
HWADDR=00:11:25:c4:6a:aa
DEVICE=eth0
BOOTPROTO=none
BROADCAST=x.x.x.191
IPADDR=x.x.x..169
NETMASK=255.255.255.224
NETWORK=x.x.x.160
ONBOOT=yes
TYPE=Ethernet
GATEWAY=x.x.x.161
HWADDR=00:11:25:c4:6a:aa
Thursday, July 29, 2010
Monday, July 12, 2010
show detail table info and drop unique key
mysql> alter table commenting drop key user_ip;
Query OK, 4 rows affected (0.03 sec)
Records: 4 Duplicates: 0 Warnings: 0
mysql> show create table commenting;
+------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| commenting | CREATE TABLE `commenting` (
`id` int(10) NOT NULL auto_increment,
`product_id` int(10) default NULL,
`user_ip` varchar(15) default NULL,
`uname` varchar(255) default NULL,
`uemail` varchar(160) default NULL,
`comments` text NOT NULL,
`ctime` timestamp NOT NULL default CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=latin1 |
+------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
Query OK, 4 rows affected (0.03 sec)
Records: 4 Duplicates: 0 Warnings: 0
mysql> show create table commenting;
+------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| commenting | CREATE TABLE `commenting` (
`id` int(10) NOT NULL auto_increment,
`product_id` int(10) default NULL,
`user_ip` varchar(15) default NULL,
`uname` varchar(255) default NULL,
`uemail` varchar(160) default NULL,
`comments` text NOT NULL,
`ctime` timestamp NOT NULL default CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=latin1 |
+------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
Friday, July 2, 2010
add unique key and show full table
mysql> show create table rating;
+--------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+--------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| rating | CREATE TABLE `rating` (
`id` int(10) NOT NULL auto_increment,
`domain_name` varchar(255) default NULL,
`product_id` int(10) default NULL,
`user_ip` varchar(15) default NULL,
`rate` int(1) default '5',
`comments` text,
PRIMARY KEY (`id`),
UNIQUE KEY `domain_name` (`domain_name`,`product_id`)
) ENGINE=MyISAM AUTO_INCREMENT=369 DEFAULT CHARSET=latin1 |
+--------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> alter table rating add UNIQUE (domain_name, product_id);
+--------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+--------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| rating | CREATE TABLE `rating` (
`id` int(10) NOT NULL auto_increment,
`domain_name` varchar(255) default NULL,
`product_id` int(10) default NULL,
`user_ip` varchar(15) default NULL,
`rate` int(1) default '5',
`comments` text,
PRIMARY KEY (`id`),
UNIQUE KEY `domain_name` (`domain_name`,`product_id`)
) ENGINE=MyISAM AUTO_INCREMENT=369 DEFAULT CHARSET=latin1 |
+--------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> alter table rating add UNIQUE (domain_name, product_id);
Subscribe to:
Posts (Atom)
-
Step 1, New a project rails new demo Step 2, Update Gemfile add paperclip, mysql2 gem, enable JavaScript runtime gem 'mysql2' ...
-
When trying to access transmission from web-browswer i got the message : 403: Forbidden Unauthorized IP Address. Either disable the IP ad...