Friday, November 25, 2011

perl install UserAgent.pm error message "Connection timed out"

1, perl -MCPAN -e shell


2, install LWP::UserAgent
Connection timed out

Solution:
Firewall block the connection, so need to stop iptables

ubuntu static ip

vim /etc/network/interfaces

auto lo
iface lo inet loopback
auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.1.6
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.99

Tuesday, November 22, 2011

gunzip: aaa.zip: unknown suffix -- ignored

I used 7z to zip this file under Windows, try to unzip it under linux

[ang@walker temp]$ gunzip 2011.sdf.zip
gunzip: 2011.sdf.zip: unknown suffix -- ignored


Try to us unzip, instead of gunzip

[chang@walker temp]$ unzip 2011.sdf.zip
Archive: 2011.sdf.zip
inflating: 2011.sdf

Monday, November 21, 2011

LVM add harddisk

1 ifconfig
2 fdisk -l
3 aptitude update && sudo aptitude safe-upgrade
4 apt-get update
5 apt-get upgrade
6 fdisk -l
7 pvcreate /dev/sdb1
8 fdisk /dev/sdb -l
9 vgdisplay
10 df
11 vgscan
12 vgdisplay
13 vgextend PubChem /dev/sdb1
14 df
15 lvextend -L128G /dev/mapper/PubChem-root
16 lvextend -L500G /dev/mapper/PubChem-root
17 lvextend -L480G /dev/mapper/PubChem-root
18 lvextend -L400G /dev/mapper/PubChem-root
19 df
20 resize2fs /dev/mapper/PubChem-root
21 df
22 shutdown now
23 df
24 sudo -s
25 history

ubuntu add second disk

1, sudo fdisk -l

root@ubuntu:~/pubchem/process_sdf# fdisk -l

Disk /dev/sda: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders, total 488397168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000b6fa8

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 499711 248832 83 Linux
/dev/sda2 501758 488396799 243947521 5 Extended
/dev/sda5 501760 488396799 243947520 8e Linux LVM

Disk /dev/sdb: 250.0 GB, 250000000000 bytes
255 heads, 63 sectors/track, 30394 cylinders, total 488281250 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x41ab2316

Device Boot Start End Blocks Id System
/dev/sdb1 63 80324 40131 12 Compaq diagnostics
/dev/sdb2 * 80325 481949999 240934837+ fd Linux raid autodetect
/dev/sdb3 481966065 488263544 3148740 fd Linux raid autodetect
/dev/sdb4 481950061 481966064 8002 5 Extended
/dev/sdb5 481950063 481966064 8001 8e Linux LVM

Partition table entries are not in disk order

Disk /dev/sdc: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders, total 488397168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00055dc9

Device Boot Start End Blocks Id System
/dev/sdc1 * 63 488392064 244196001 8e Linux LVM

Tuesday, November 15, 2011

mysql add AUTO_INCREMENT

1, if the table no primary key, you need add primary key first

mysql> alter table blacklist add primary key (alarmID) ;

2, mysql> alter table blacklist modify alarmID int(10) unsigned AUTO_INCREMENT, AUTO_INCREMENT=50000;

mysqldump with where condition

mysqldump -u user -ppasswd yourDB yourTable --where="service_category_id in (261, 262)"> signatures_blacklist.sql

Wednesday, November 9, 2011

line terminator

The line terminator expected for each file format is:

unix LF only (each line ends with an LF character).
dos CRLF (each line ends with two characters, CR then LF).
mac CR only (each line ends with a CR character).
CR is carriage return (return cursor to left margin), which is Ctrl-M or ^M or hex 0D.
LF is linefeed (move cursor down), which is Ctrl-J or ^J or hex 0A. Sometimes, LF is written as NL (newline).

Mac OS version 9 and earlier use mac line endings, while Mac OS X and later use unix line endings.


Carriage Return (^M or \r).

LF:    Line Feed, U+000A
 VT:    Vertical Tab, U+000B
 FF:    Form Feed, U+000C
 CR:    Carriage Return, U+000D
 CR+LF: CR (U+000D) followed by LF (U+000A)
 NEL:   Next Line, U+0085
 LS:    Line Separator, U+2028
 PS:    Paragraph Separator, U+2029

Monday, November 7, 2011

mysql concat string

update compounds set link=concat("http://www.chemmol.com/chemmol/", mol_id , ".html") ;

Thursday, November 3, 2011

Remove blank lines

Type the following command:
$ sed '/^$/d' input.txt > output.txt
Task: Remove blank lines using grep

$ grep -v '^$' input.txt > output.txt