Friday, December 23, 2005

Things to be changed in SC

1. to use subversion to replace CVS
2. deploy CAS
3. use Maven

Wednesday, December 21, 2005

Antivirus solutions on the mail server side...

Just blog the stuff I got about antivirus solutions on the mail server side:
1. clamav + clamav-milter (sendmail)
2. AMaViS - A Mail Virus Scanner (AMaViS - A Mail Virus Scanner)
3. MailScanner (http://www.mailscanner.info/) should be the easiest way to install

Saturday, December 03, 2005

ajax framework

http://rialto.application-servers.com/demoRialto.jsp

well, using Apache license and probably, can be employed to be used in our application.

Tuesday, November 15, 2005

MD5 cracker source released

http://www.stachliu.com.nyud.net:8090/collisions.html

Think if you are going to use MD5.

Friday, October 28, 2005

A day of bug fixing...

It might be good to tell more about my job...

Now I received a list of bugs:
[hmm site]/forum/main/list/cn.page

PRC forum
• Bug: IE browser title text should be in S.Chinese. [Yes it is, I tried to fix it but time is not allowed.]
• Bug: Click 免費入會 will go to HK site.
• Bug: Click 忘記密碼 will go to HK site.
• Bug: Click 登出 will go to HK site.
• Bug: Click 更改個人資料 will go to HK site.
• Bug: Click HMM logo will go to HK site.
• Bug: Add ALT for images on left panel
• Bug: The “編輯” image is broken.

Both HK and PRC
• Bug: Search, if key in 2 words (1 word is ok) with result of several, return error

After receiving it from Sam, I starts checking the issue. Well, some is known to me.

DCCP protocol...

Congestion Control Protocol

http://www.icir.org/kohler/dcp/

Wednesday, October 26, 2005

Allan mail server is down...

Ar. have no idea why it is down... It is the client from Corpmart... We are providing support to them...

Need to explain why it is hang.

Monday, July 04, 2005

Using Spamassassin and procmail to filter spam

Using Spamassassin and procmail to filter spam



See also: Mail Server FAQ
Table of contents
1 Procmail and Spamassassin

1.1 SpamAssassin: Automagic teaching

1.1.1 One spamassassin autolearning setup
1.1.2 An Alternative Autolearning Setup
1.1.3 Performance issues with training the bayesian filter
[edit]
Procmail and Spamassassin

We'll use the combination of procmail (http://www.procmail.org) and Spamassassin (http://www.spamassassin.org) to filter spam from our incoming mail. Procmail allows us to feed our incoming mail through different programs, then place them in different mailboxes based on the outout of those programs.

You can setup procmail and Spamassassin to be systemwide, but I prefer to do it by user - for the sake of flexibility. If you do set it up system wide (http://www.spamassassin.org/sitewide.html), the users can always customize their own rules. Refer to this IBM Developerworks article (http://www-106.ibm.com/developerworks/linux/library/l-spam/?t=gr,lnxw03=StampSpam) to get more detail on Spamassassin. Once you have installed Spamassassin and procmail, we want to setup a .procmailrc in our home directory. This will actually take the mail from Postfix, filter it through spamassassin, then deliver it to the Maildirs. For the sake of definition, procmail becomes our MDA (Mail Delivery Agent). Since procmail will be delivering to the Maildirs instead of Postfix, you need to double check this setup again.

[user@mail ~]$ cat .procmailrc
#.procmailrc - by jorge - Updated by glenn 6/8/05

# Set our default shell, which may not be necessary, as it
# uses the user's default
SHELL=/usr/bin/bash

# Set our default Maildir. You can also set the HOME variable, which
# may be set automatically by procmail
MAILDIR=/home/jorge/Maildir

# Set our default mailbox, which is where mail that doesn't have
# a sort rule applied goes. The trailing / is important.
DEFAULT=/home/jorge/Maildir/

# Set up logging. It's a good idea to let procmail log all its
# actions until you're sure it's working right.
LOGFILE=${MAILDIR}/procmail.log
LOG="--- Logging ${LOGFILE} for ${LOGNAME}, "

# Whatever recipes you'll use
# The order of the recipes is significant

# First, run everything through spamassassin. The "-P -a" tags are
# not needed with 3.0+, as they are now the defaults.
:0fw
| spamassassin

# Now that we've tagged spam, put it in its own folder

:0:

* ^X-Spam-Status: Yes
/home/jorge/Maildir/.spam/

Notice the DEFAULT directory ... that's where my mail will go, the new directory under my Maildir. That's how it shows up as new mail. If I put it in the cur directory in my Maildir, the mail would never show up as new, it would show up as already read (but we don't want that). Once you read a mail in the new directory, it moves it over to the cur directory. That's how the system keeps track of which mails are new and which ones are the 'cur'rent ones in your inbox. That's also why each subfolder has its own new,cur, and tmp directories.

Procmail is smart enough to put new mail into the "new" subdirectory for whatever Maildir folder you want it to put mail in. If you are using an IMAP server like dovecot that builds indexes, you have to omit "new/" and just leave the trailing slash (as in the script), as otherwise procmail doesn't use standard Maildir filenames, and dovecot will constantly be rebuilding a corrupted index file.

The big spamkiller is the 0fw | spamassassin line. Users of versions of spamassassin prior to 3.0 may want to add the e -a switch, which enables autowhitelisting (enabled by default in 3.0+). When you reply to people, after a while, they get put in the whitelist, and then they won't be judged so harshly the next time Spamassassin checks mail from them. If you're like me, you have some friends, that even with an autowhitelist, will score 20 or higher on the spamassassin score.

The next line puts it in the new subdirectory of my spam directory. It will then show up as new spam in our mail reader, already filed for inspection. As you guessed it, once you read the spam, it will get moved to the cur folder. I could send it directly to the .Trash folder, but I prefer to keep it seperate, and this way you can scan it everyonce in a while and catch the nifty HTML email your friends from hotmail send you. Confused? Just use the example (http://www.spamassassin.org/dist/procmailrc.example) from the Spamassassin website. You can direct the possible spam to dev/null, but this is not recommended, if you get a false positive then you'll lose that mail, that is why we created the .spam folder.

Next, we need to create a .forward file to get the email to go to procmail.

[user@mail ~]$ cat .forward
|/usr/bin/procmail

Notice that all the file does is send your incoming email to procmail. Procmail then accesses your .procmailrc file, and through it, delivers your email to the Maildir/ after running spamassasin. Without the .forward file your email will be directly delivered to your /Maildir and will avoid spamassassin entirely.

Spamassassin does a great job by default, but let's say you want to tailor it more. Create a .spamassassin directory in your home directory (mkdir .spamassassin). In there, create a user_prefs file using your favorite text editor. In time, the autowhitelister will put your whitelist in this directory too.

[user@mail ~/.spamassassin]$ cat user_prefs
# custom rules for spamassassin
score RAZOR_CHECK 4.0
score REMOVE_SUBJ 4.0
score SUBJ_REMOVE 4.0

score REPLY_REMOVE_SUBJECT 4.0
score REMOVE_IN_QUOTES 4.0
score HTML_WITH_BGCOLOR 4.0
score REALLY_UNSAFE_JAVASCRIPT 4.0
score CHARSET_FARAWAY_BODY 4.0
score NO_MX_FOR_FROM 4.0

score CTYPE_JUST_HTML 4.0
score WEB_BUGS 4.0
score SUBJ_ALL_CAPS 4.0
score LINES_OF_YELLING 4.0
score FOR_FREE 4.0

From this file, we are overriding the default rules in Spamassassin with our own custom scores. We did this because I thought the default values for these rules were too low, because who gets valid email with web bugs? So we raised the scores of these rules up. Spamassassin still keeps the default score of 5 as the definition of a spam, so these rules won't declare a mail a spam by themselves, but if they're using one of these techniques, then they're probably using other ones as well they will score higher and be tagged as spam. Refer to the Spamassassin rules list (http://www.spamassassin.org/tests.html) to find the complete list of rules.

Remember that these custom rules are in the user accounts, so if you don't want a certain account to use them, don't create a user_prefs for them. If they don't want any spam filtering whatsoever, then don't create a .procmailrc for them, Postfix will work just fine, because it was working before you even got to this step, right?
[edit]
SpamAssassin: Automagic teaching

SpamAssassin works well as a spam filter, but it works much better when it uses Bayesian filtering as opposed to depending on its ruleset, simply because of the adaptable nature of Bayesian filtering. You may be familiar with mail clients such as Thunderbird that use Bayesian filtering that you have to 'teach' your email habits too. This requires marking lots of spam as such, and unmarking lots of email labeled as spam to ham. The same thing is required with SpamAssassin, to get it to have enough data to be able to use its Bayesian component. Of course, who wants to sit at the command line, telling SpamAssassin when it was right, and when it was wrong? So, we use a simple script and crontab and some client side manipulation to automate the process.
[edit]
One spamassassin autolearning setup

In my (glenn) setup, I have spamassassin learn from my Inbox and Junk mailboxes, as I keep them nicely cleaned up and properly sorted. I don't want to deal with an overflowing Junk mailbox, but I also don't want spam cleared so quickly that I miss false positives. So, I run sa-learn every Thursday and Sunday night, and clean out spam older than 31 days at that point. I use the following learning script:

glenn@vasp:~$ cat learn.sh
#!/bin/bash
/usr/bin/sa-learn --spam ~/Maildir/.Junk/cur
/usr/bin/sa-learn --ham ~/Maildir/cur

I omit /new as that's email I haven't had a chance to properly file in case of false positives/negatives. Then, I use the following script to clean up old spam:

glenn@vasp:~$ cat cleanup-junk.sh
#!/bin/bash

# Removes all files from ~/Maildir/.Junk/cur that are older than
# 31 days ago

find ~/Maildir/.Junk/cur -mtime +30 -exec rm -f {} \;

I simply placed these in my crontab:

glenn@vasp:~$ crontab -l
# min hr dom month dow cmd
# Teach spamassassin about spam
* 4 * * 4,7 /home/glenn/learn.sh

# Clean up spam directory
* 5 * * 4,7 /home/glenn/cleanup-junk.sh

This works nicely for me, keeping spamassassin smart and preventing me from missing important emails.
[edit]
An Alternative Autolearning Setup

In my .procmailrc, I tell procmail to move mail marked as spam by Spamassassin to my $Maildir/.Trash/. This is important, because the way I am setting this up, anything that is sent to the Junk folder is deleted every 4 hours. For this reason, you should probably disable automatic moving of spam around by your email client. Or, setup two junk folders, junk_manual, which is stuff you've personally approved as spam, and junk_auto, which is mail moved by your mail client's junk mail filter and that you should probably check over before moving over to junk_manual for reading by SpamAssassin and removal from your system.

It is important to tell SpamAssassin not only what is spam, but what is ham, or legitimate email. I am running this script in my root's crontab, so I specify which home directory to go to. I don't really see why you couldn't run this as your normal user, but since SpamAssassin is run as root when called by procmail (at least, I think it is), I figure it is best to do the same here. My learning script first tells spamassassin that any read or unread junk mail is spam. I then have it hit my inbox and a number of other oft used folders on my system to tell it what is ham. It may be wise to leave out your inbox, as you may not have a chance to move spam that gets through, leading SA to believe that spam is ham, which is, of course, a no-no. This is the same reason I do not have SA read my Trash folder, which sometimes has legit email in it (though I do keep 99% of my email, so it's not a huge concern.)

[user@mail ~]$ cat ~/learn.sh
#!/bin/bash
/usr/bin/sa-learn --spam /home/user/Maildir/.Junk/new
/usr/bin/sa-learn --spam /home/user/Maildir/.Junk/cur
/usr/bin/sa-learn --ham /home/user/Maildir/new
/usr/bin/sa-learn --ham /home/user/Maildir/cur
rm /home/user/Maildir/.Junk/new/*
rm /home/user/Maildir/.Junk/cur/*

We then want to run that script every 4 hours, or however often you wish to have it run.

[user@mail ~]$ crontab -l
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=""
# m h dom mon dow command
0 */4 * * * /home/user/bin/learn.sh

And now, SpamAssassin can learn from its mistakes as you simply 'delete' (move to the Junk folder) your spam clientside.
[edit]
Performance issues with training the bayesian filter

I (tm) used to use a script like those above on my linode (http://www.linode.com), but for whatever reason, the sa-learn process would suck up a lot of memory and essentially bring the linode to its knees. Without having completed the learning process. So, instead of throwing whole directories at sa-learn, I give it each mail, one at a time.

So now, my learnspam script looks like:

#!/bin/sh
## Process high scoring spam in the .Spam folder and anything leftover in .Junk
#set -x
# feed to the bayesian learner
echo "Processing Junk maildir..."
spams=`find ~/Maildir/.Junk/cur ~/Maildir/.Junk/new/ -type f -mtime +7`
for spam in $spams
do sa-learn --spam --showdots --no-sync $spam
done
rm -f $spams
echo "Processing Spam maildir..."
spams=`find ~/Maildir/.Spam/cur ~/Maildir/.Spam/new/ -type f -mtime +3`
for spam in $spams
do sa-learn --spam --showdots --no-sync $spam
done
sleep 1
rm -f $spams

And my learnham script is:

#!/bin/sh
## Process ham
if [ $# -lt 1 ]; then
echo "Usage: $0 "
exit 3
fi
#set -x
# feed to the bayesian learner
for allmail in `find ~/Maildir -name cur -type d -ctime -$1 | egrep -v '(Trash|Junk|Spam)' | xargs -n 50 -idir find dir -type f -ctime -$1`
do for mail in $allmail
do echo $mail; sa-learn --ham --showdots --no-sync $mail
done
done
sleep 1
for allmail in `find ~/Maildir -name new -type d -ctime -$1 | egrep -v '(Trash|Junk|Spam)' | xargs -n 50 -idir find dir -type f -ctime -$1`
do for mail in $allmail
do echo $mail; sa-learn --ham --showdots --no-sync $mail
done
done

This may be helpful to anyone else who wants to run SA with bayesian learning on something with little memory like a linode.

Sunday, June 19, 2005

Start installing other firmware on my Linksys router...

I am starting to use "Firmware Version: v3.03.6 - HyperWRT 2.1b1" for my wireless router.

now, I have telnet to it.

========== dmesg output===============
CPU revision is: 00029007
Primary instruction cache 8kb, linesize 16 bytes (2 ways)
Primary data cache 4kb, linesize 16 bytes (2 ways)
Linux version 2.4.20 (root@localhost) (gcc version 3.2.3 with Broadcom modifications) #1 Fri Feb 18 18:25:54 CET 2005
Determined physical RAM map:
memory: 01000000 @ 00000000 (usable)
On node 0 totalpages: 4096
zone(0): 4096 pages.
zone(1): 0 pages.
zone(2): 0 pages.
Kernel command line: root=/dev/mtdblock2 noinitrd console=ttyS0,115200
CPU: BCM4712 rev 1 at 200 MHz
Calibrating delay loop... 199.47 BogoMIPS
Memory: 14444k/16384k available (1333k kernel code, 1940k reserved, 108k data, 64k init, 0k highmem)
Dentry cache hash table entries: 2048 (order: 2, 16384 bytes)
Inode cache hash table entries: 1024 (order: 1, 8192 bytes)
Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
Buffer-cache hash table entries: 1024 (order: 0, 4096 bytes)
Page-cache hash table entries: 4096 (order: 2, 16384 bytes)
Checking for 'wait' instruction... unavailable.
POSIX conformance testing by UNIFIX
PCI: Disabled
PCI: Fixing up bus 0
Linux NET4.0 for Linux 2.4
Based upon Swansea University Computer Society NET3.039
Initializing RT netlink socket
Starting kswapd
devfs: v1.12c (20020818) Richard Gooch (rgooch@atnf.csiro.au)
devfs: boot_options: 0x1
pty: 256 Unix98 ptys configured
Serial driver version 5.05c (2001-07-08) with MANY_PORTS SHARE_IRQ SERIAL_PCI enabled
ttyS00 at 0xb8000300 (irq = 3) is a 16550A
ttyS01 at 0xb8000400 (irq = 0) is a 16550A
HDLC line discipline: version $Revision: 1.1.1.4 $, maxframe=4096
N_HDLC line discipline registered.
PPP generic driver version 2.4.2
Physically mapped flash: Found an alias at 0x400000 for the chip at 0x0
Physically mapped flash: Found an alias at 0x800000 for the chip at 0x0
Physically mapped flash: Found an alias at 0xc00000 for the chip at 0x0
Physically mapped flash: Found an alias at 0x1000000 for the chip at 0x0
Physically mapped flash: Found an alias at 0x1400000 for the chip at 0x0
Physically mapped flash: Found an alias at 0x1800000 for the chip at 0x0
Physically mapped flash: Found an alias at 0x1c00000 for the chip at 0x0
number of CFI chips: 1
0: offset=0x0,size=0x2000,blocks=8
1: offset=0x10000,size=0x10000,blocks=63
Flash device: 0x400000 at 0x1c000000
Physically mapped flash: cramfs filesystem found at block 910
Creating 4 MTD partitions on "Physically mapped flash":
0x00000000-0x00040000 : "pmon"
0x00040000-0x003f0000 : "linux"
0x000e3918-0x003f0000 : "rootfs"
mtd: partition "rootfs" doesn't start on an erase block boundary -- force read-only
0x003f0000-0x00400000 : "nvram"
sflash: found no supported devices
NET4: Linux TCP/IP 1.0 for NET4.0
IP Protocols: ICMP, UDP, TCP, IGMP
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP: Hash tables configured (established 1024 bind 2048)
Linux IP multicast router 0.06 plus PIM-SM
ip_conntrack version 2.1 (128 buckets, 1024 max) - 344 bytes per conntrack
ip_conntrack_pptp version 1.9 loaded
ip_nat_pptp version 1.5 loaded
ip_tables: (C) 2000-2002 Netfilter core team
ipt_time loading
NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
NET4: Ethernet Bridge 008 for NET4.0
802.1Q VLAN Support v1.7 Ben Greear
All bugs added by David S. Miller
VFS: Mounted root (cramfs filesystem) readonly.
Mounted devfs on /dev
Freeing unused kernel memory: 64k freed
5325E phy=0
5325E VLAN programming for BCM5325E-MDIO I/F switch
1:(0x00) value=0x8000
2:(0x00) value=0x8000
1:(0x13) value=0x0000
2:(0x13) value=0x0002
1:(0x00) value=0x8000
2:(0x00) value=0x8000
1:(0x13) value=0x0002
2:(0x13) value=0x0006
1:(0x00) value=0x8000
2:(0x00) value=0x8000
1:(0x13) value=0x0006
2:(0x13) value=0x000e
1:(0x00) value=0x8000
2:(0x00) value=0x8000
1:(0x13) value=0x000e
2:(0x13) value=0x001e
1:(0x00) value=0x8000
2:(0x00) value=0x0000
eth0: Broadcom BCM47xx 10/100 Mbps Ethernet Controller 3.60.13.0
eth1: Broadcom BCM4320 802.11 Wireless Controller 3.60.13.0
flag=[get_flash] offset=[0] string=[]
Intel 28F320C3 2Mx16 BotB
Set flash_type=Intel 28F320C3 2Mx16 BotB
exit
Algorithmics/MIPS FPU Emulator v1.5
vlan0: add 01:00:5e:00:00:01 mcast address to master interface
vlan0: dev_set_promiscuity(master, 1)
device eth0 entered promiscuous mode
device vlan0 entered promiscuous mode
device eth1 entered promiscuous mode
br0: port 2(eth1) entering learning state
br0: port 1(vlan0) entering learning state
br0: port 2(eth1) entering forwarding state
br0: topology change detected, propagating
br0: port 1(vlan0) entering forwarding state
br0: topology change detected, propagating
flag=[get_eou_key_index] offset=[0] string=[]
eou_key_init()
location = [1]
Available eou key index is 1
exit
vlan1: Setting MAC address to xxxxxxxxxxxxxxx.
nvram_commit(): init
nvram_commit(): end
nvram_commit(): init
nvram_commit(): end
br0: port 2(eth1) entering disabled state
br0: port 1(vlan0) entering disabled state
vlan0: del 01:00:5e:00:00:01 mcast address from master interface
vlan0: del 01:00:5e:00:00:01 mcast address from vlan interface
br0: port 1(vlan0) entering disabled state
device vlan0 left promiscuous mode
br0: port 2(eth1) entering disabled state
device eth1 left promiscuous mode
vlan0: dev_set_promiscuity(master, -1)
device eth0 left promiscuous mode
vlan0: add 01:00:5e:00:00:01 mcast address to master interface
vlan0: dev_set_promiscuity(master, 1)
device eth0 entered promiscuous mode
device vlan0 entered promiscuous mode
device eth1 entered promiscuous mode
br0: port 2(eth1) entering learning state
br0: port 1(vlan0) entering learning state
br0: port 2(eth1) entering forwarding state
br0: topology change detected, propagating
br0: port 1(vlan0) entering forwarding state
br0: topology change detected, propagating
flag=[get_eou_key_index] offset=[0] string=[]
eou_key_init()
location = [1]
Available eou key index is 1
exit

Sunday, June 12, 2005

Flavio’s TechnoTalk � Blog Archive � Performance analysis on Linux

Flavio’s Performance analysis on Linux: "Performance analysis on Linux"

This article gives an overview of performance analysis on Linux.

Wireless USB adapter...

After doing some research, the following USB adapter seems to be working in Linux:

Buffalo WLI-U2-KG54-AI HK$ 270
Surecom EP-9001-G HK$ 210 [RT2500 chipset]
Dlink DWL-G122 HK$ 220 [RT2500 chipset]
Zyxel G220 HK$ 239

EP-9001-GP $328
DWL-G132 $349

I have forgotten the formula for converting mW to dBm, learnt from wireless communication course.
I found a website which provides quite good tools to do the calculation:
Wireless Javascript Toolkit

Need to compare the output power and antenna gain...

Tuesday, June 07, 2005

slower

常用的数据库连接写法和下载地址(转载)

在调试Spring+hibernate中,后来发现好像Sqlserver的驱动有问题,又听说jtds是非常好的替代品,就在网上照jtds的下载,发现了这篇文章,转载如下(http://dev2dev.bea.com.cn/bbs/thread.jspa?forumID=123&threadID=20222&messageID=116981):

1. MySQL(http://www.mysql.com)mm.mysql-2.0.2-bin.jar
Class.forName( "org.gjt.mm.mysql.Driver" );
cn = DriverManager.getConnection( "jdbc:mysql://MyDbComputerNameOrIP:3306/myDatabaseName", sUsr, sPwd );

2. PostgreSQL(http://www.de.postgresql.org)pgjdbc2.jar
Class.forName( "org.postgresql.Driver" );
cn = DriverManager.getConnection( "jdbc:postgresql://MyDbComputerNameOrIP/myDatabaseName", sUsr, sPwd );

3. Oracle(http://www.oracle.com/ip/deploy/database/oracle9i/)classes12.zip
Class.forName( "oracle.jdbc.driver.OracleDriver" );
cn = DriverManager.getConnection( "jdbc:oracle:thin:@MyDbComputerNameOrIP:1521:ORCL", sUsr, sPwd );

4. Sybase(http://jtds.sourceforge.net)jconn2.jar
Class.forName( "com.sybase.jdbc2.jdbc.SybDriver" );
cn = DriverManager.getConnection( "jdbc:sybase:Tds:MyDbComputerNameOrIP:2638", sUsr, sPwd );
//(Default-Username/Password: "dba"/"sql")

5. Microsoft SQLServer(http://jtds.sourceforge.net)
Class.forName( "net.sourceforge.jtds.jdbc.Driver" );
cn = DriverManager.getConnection( "jdbc:jtds:sqlserver://MyDbComputerNameOrIP:1433/master", sUsr, sPwd );

6. Microsoft SQLServer(http://www.microsoft.com)
Class.forName( "com.microsoft.jdbc.sqlserver.SQLServerDriver" );
cn = DriverManager.getConnection( "jdbc:microsoft:sqlserver://MyDbComputerNameOrIP:1433;databaseName=master", sUsr, sPwd );

7. ODBC
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
Connection cn = DriverManager.getConnection( "jdbc:odbc:" + sDsn, sUsr, sPwd );

8.DB2(新添加)
Class.forName("com.ibm.db2.jdbc.net.DB2Driver");
String url="jdbc:db2://192.9.200.108:6789/SAMPLE"
cn = DriverManager.getConnection( url, sUsr, sPwd );

9.Microsoft SQL Server series (6.5, 7.x and 2000) and Sybase 10

JDBC Name: jTDS
URL: http://jtds.sourceforge.net/
Version: 0.5.1
Download URL: http://sourceforge.net/project/showfiles.php?group_id=33291

语法:
Class.forName("net.sourceforge.jtds.jdbc.Driver ");
Connection con = DriverManager.getConnection("jdbc:jtds:sqlserver://host:port/database","user","password");
or
Connection con = DriverManager.getConnection("jdbc:jtds:sybase://host:port/database","user","password");

10.Postgresql
JDBC Name: PostgreSQL JDBC
URL: http://jdbc.postgresql.org/
Version: 7.3.3 build 110
Download URL: http://jdbc.postgresql.org/download.html
语法:
Class.forName("org.postgresql.Driver");
Connection con=DriverManager.getConnection("jdbc:postgresql://host:port/database","user","password");

11.IBM AS400主机在用的JDBC语法
有装V4R4以上版本的Client Access Express
可以在C:\Program Files\IBM\Client Access\jt400\lib
找到 driver 档案 jt400.zip,并更改扩展名成为 jt400.jar
语法:
java.sql.DriverManager.registerDriver (new com.ibm.as400.access.AS400JDBCDriver ());
Class.forName("com.ibm.as400.access.AS400JDBCConnection");
con = DriverManager.getConnection("jdbc:as400://IP","user","password");

12.informix
Class.forName("com.informix.jdbc.IfxDriver").newInstance();
String url =
"jdbc:informix-sqli://123.45.67.89:1533/testDB:INFORMIXSERVER=myserver;
user=testuser;password=testpassword";
Lib:jdbcdrv.zip

Class.forName( "com.sybase.jdbc.SybDriver" )
url="jdbc:sybase:Tds:127.0.0.1:2638/asademo";
SybConnection connection= (SybConnection)DriverManager.getConnection(url,"dba","sql");

13.SAP DB
Class.forName ("com.sap.dbtech.jdbc.DriverSapDB");
java.sql.Connection connection = java.sql.DriverManager.getConnection ( "jdbc:sapdb://" + host + "/" + database_name,user_name, password)

14.InterBase
String url = "jdbc:interbase://localhost/e:/testbed/database/employee.gdb";
Class.forName("interbase.interclient.Driver");
//Driver d = new interbase.interclient.Driver (); /* this will also work if you do not want the line above */
Connection conn = DriverManager.getConnection( url, "sysdba", "masterkey" );

15.HSqlDB
url: http://hsqldb.sourceforge.net/
driver: org.hsqldb.jdbcDriver
连接方式有4种,分别为:
con-str(内存): jdbc:hsqldb.
con-str(本地): jdbc:hsqldb:/path/to/the/db/dir
con-str(http): jdbc:hsqldb:http://dbsrv
con-str(hsql): jdbc:hsqldb:hsql://dbsrv

Wednesday, May 04, 2005

Quality Open Source for Windows

For reasons you cannot live without Windows, you can try out some excellent open source tools.

Get a look at TheOpenCD.org

Monday, April 25, 2005

uClinux for Linux Programmers

uClinux for Linux Programmers

Java memory leak reason...

Memory leak in Java:
The Object is reachable but it is not live. Meaning the object has reached the end of its lifecycle and now GC should be able to reclaim this object but some erroneous references prevents it to get garbage collected. Most of the time, a single lingering reference can have massive memory impact.

Leak

Wednesday, April 06, 2005

"Should I buy ECC or non-ECC RAM?"

Q: Should I buy ECC or non-ECC RAM?
A:
ubiquityman wrote:
TO ECC OR NOT TO ECC, THAT IS THE QUESTION

It was published in 1998 (EE Times) that a approximately 1 bit error occurs in 256MB of ram every month. http://www.corsairdirect.com/ecc.html

RAM has increased in speed significantly since then, but manufacturing processes have also improved. It's hard to say what the current error rate is but let's assume that it's about the same.

So for those with 1G of memory, that's approximately 1 bit error every week.

It doesn't matter if you reboot every hour, as long as you run your computer 24h/day, the rate at which a bit error will occur is approximately once a week (if you have 1G of RAM). (If you run your computer less frequently, then obviously, the rate at which bit errors occurs will also be less.)

Also, the nature of memory is that although bit errors occur randomly to some extent, there is a higher probabilty that errors will reoccur at the same location, in weaker bits. We consider a memory bit as digital, but the actual silicon landscape is such that not all bits are created identical or equal. Some are "more susceptible" to soft errors.

So, if you have a "weak bit" in a frequently used place, you just have bad luck. Your machine might crash unexpectidly more often than others. Any programmer can tell you that an incorrect bit is unpredictable. It could be benign, but it cause also be catastrophic in terms of data.

Now, if you do reboot frequently, that reduces the probability that the bit error will cause a negative effect because the bit error lives in your system for less time. It also reduces the compounding of errors which again would have increasing potential to cause data loss.

Like I've said before. If you play games and that's all you do. I probably would not pay the 12%-25% premium for ECC.

However, if you leave your machine on most of the time, overclock, stress your machine in other ways, or use it for something "serious" other than gaming, I would recommend ECC memory. For approximately the cost of eating out one night, I can have the peace of mind of ECC.

I put ECC in all my home machines except for my laptop and PDA. At today's prices, ECC is a bargain.

The luckier you feel, the less you need ECC. In the words of Dirty Harry "Do you feel, Lucky!?"

ECC PERFORMANCE

I checked the Intel website and they do say that there is some performance loss with ECC enabled.

I've also read elsewhere that unless a memory error is detected, there is no performance loss with modern chipsets. (I would suggest that the intel information is the correct one.)

However, I personally have ran benchmarks on my PII-450 w/ i440BX chipset to test the performance of ECC memory.

My benchmarks show that my machine benchmarks faster in memory with ECC enabled.

This person here had similar results:

http://www.personal.psu.edu/faculty/l/a/lae2/fx83dinteg/fx83dinteg.htm

Ajax using XMLHttpRequest and Struts

Ajax using XMLHttpRequest and Struts: "Ajax using XMLHttpRequest and Struts"

Sunday, March 20, 2005

Windows NT 2000 ME 9x and XP Registry Tweaks

Hide computer in network neighbourhood

(Windows 98/Me/2000/XP)

This tweak will hide your computer from network neighbourhood.

Open your registry and find the key:HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\LanmanServer\Parameters


Create a new DWORD value, name it to Hidden and set the value to 1.