tag:blogger.com,1999:blog-103211672024-03-07T19:57:21.173-08:00Stephen's Technical BlogA blog for my technical stuff.Stephenhttp://www.blogger.com/profile/11906928435370299536noreply@blogger.comBlogger57125tag:blogger.com,1999:blog-10321167.post-25322196762851001332007-04-08T00:48:00.000-07:002007-04-08T00:55:18.392-07:00無線上網HKSARG is planning to provide free wireless Internet connection to the general public. However, the government will not allow user to be online anonymously. One can take such facilities to do illegal activities, such as launching an attack against a corporate network. So, identity is a concern. How can we manage the identity of the user who uses the network? Also, should it be opened only to Hong Kong people? Should a visitor allow to use the facilities?<br /><br />... to be continued.Stephenhttp://www.blogger.com/profile/11906928435370299536noreply@blogger.com0tag:blogger.com,1999:blog-10321167.post-26543603908272218182007-01-31T06:19:00.000-08:002007-01-31T06:20:06.783-08:00To be better manage the schedule and tasksMy target for this year is to focus on managing better schedule and target.Stephenhttp://www.blogger.com/profile/11906928435370299536noreply@blogger.com0tag:blogger.com,1999:blog-10321167.post-5680400479055992412006-09-26T19:42:00.000-07:002006-09-26T19:44:41.694-07:00Installing vmware on Ubuntuto compile the vmware kernel module, we need to get the<br /><br />apt-get install linux-headers-`uname -r`<br /><br />to continueStephenhttp://www.blogger.com/profile/11906928435370299536noreply@blogger.com0tag:blogger.com,1999:blog-10321167.post-88770070634151705652006-09-19T10:11:00.000-07:002006-09-19T10:18:15.057-07:00First theme for my mobile<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger2/7439/1259/1600/qsn_bg_screen181920.jpg"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://photos1.blogger.com/blogger2/7439/1259/200/qsn_bg_screen181920.jpg" alt="" border="0" /></a><br />Just learnt how to make a theme for my mobile N71.<br /><br />It is unique. <a href="http://standby.hk/symbian/theme/MySky.sis">MySky</a>Stephenhttp://www.blogger.com/profile/11906928435370299536noreply@blogger.com0tag:blogger.com,1999:blog-10321167.post-1150772982684412562006-06-19T20:09:00.000-07:002006-06-19T20:09:42.720-07:00"如何写一份好的工程师简历"Just to blog what I read:<br /><br />如何写一份好的工程师简历<br /><br />2006年6月14日 上午 10:15:00<br />发表者:王忻,Google 工程师<br /><br />最近三年作为 Google(谷歌)的软件工程师,我每周会帮人事部门审查简历,决定要不要给他们面试。Google 这几年的发展让很多许多优秀的工程师都前来申请。到目前为止,我已经看了上千份简历,有些简历留下的印象比别的好很多。尤其是最近亲戚朋友常常问我如何修改他们的简历,所以我积累了一些常见的错误避免的提议,在此跟大家交流一下。<br /><br />1.谈到你做过的技术时,应该提到用的程序语言、你的个人贡献和产品细节。<br /><br />有时我看到有人把过去的经验在简历上一笔带过,比如说:<br /><br />• 在三人小组里,为电子邮件软件写了些 features。<br /><br />这是远远不够的,看简历的人希望了解你做的工作的难度和对本公司有多少联系,所以你最好写的具体一些。譬如:<br /><br />• 用 C++ 语言写了网络电子邮件的自动 backups。在三人小组里,专门负责设计和写储存服务器。从设计开始, 一年后把这个功能 feature 的用户推到了三千。<br /><br />2.多讲事实, 少用形容词。<br /><br />看简历的人读你的简历时,需要做判断,所以在简历里需要事实和数目。如果你写“迅速的提高了软件的操作效率”,看简历的人很难判断你成就的难度。但如果你写“在3个星期内,把软件的操作效率提高了40%” 就好多了。<br /><br />有些谦虚的朋友们不愿意把话说满,所以你也可以用这个办法。你如果说自己“突出”或“在项目上常常被请去救火”,听起来难免会有点骄傲。但你也可以用不能否认的事实来说明你的观点,如“《纽约日报》评这个产品为‘突出’”,或“加入了三个原本已落后于计划的项目小组,但经过努力和组员一起把它们都按时完成了。”<br /><br />3.你获得的奖、商业的荣誉或表扬、受用户欢迎的产品和你做过的有难度的业余项目都该包括在简历里。<br /><br />我有位朋友在硅谷一个著名的硬件公司做了六年,她设计的 IP phone(网络电话)为公司赚了上亿的收入,被公司与商业报道多次评了奖。我有一次在旧金山的高速公路上驾车时,看到路边有她产品的广告牌;还有一次我去上海度假时,竟然发现上海公路边上也有!<br /><br />不久,这位朋友决定换工作,请我看看她的简历。我惊讶的发现,她居然轻描淡写的写了一句-- "1998 – 2004:网络电话产品的硬件工程师组长" 和她的职责。<br /><br />"产品赢的奖呢?它为公司赚的钱呢?" 我追问到。<br /><br />"那些也该写吗?" 她说。<br /><br />当然该写。<br /><br />有人问,业余时间做的项目可不可以写?我觉得只要你的项目有代表性能说明对你的能力,都该包括。<br /><br />4.分清主次,删掉相比之下不起眼的成绩,以免冲淡更加突出的成绩。<br /><br />有朋友问,写简历是不是写的越多越好?譬如:<br /><br />在甲公司做暑假实习生——<br />* 改善电子游戏的数值分类算法, 减少了内存要求 10%。<br />* 用 Java 写了 3000 行用户界面程序。<br />* 每周做两小时的人工测试。<br /><br />你在申请软件工程师的职位时,我觉得前两点比较相关,第三点其实就不必写了。有时我看到有的简历里会提到,"按时完成了任务,产品符合原计划规格"。但读简历的人通常会认为这是理所当然的,而你把这些声明出来反而减弱简历的效果。<br /><br />写一份简历不容易,但写好了也会带来成就感 (和好工作!)。 Google (谷歌)在中国广召各方面的人才,你不妨可以给我们投个简历!我们不但在信息检索方面招雇工程师,还有计算机图形、用户界面、硬件、Windows、质量保证员和系统管理员等方面。更多信息,请您访问这里。<br /><br />谢谢阅读!大家感兴趣的话,下次我可以介绍“如何预备软件工程师的面试”。Stephenhttp://www.blogger.com/profile/11906928435370299536noreply@blogger.com0tag:blogger.com,1999:blog-10321167.post-1148011354941331292006-05-18T21:00:00.000-07:002006-05-18T21:02:34.953-07:00To be technical~After next week, I will start to be more technical. As this blog is supposed to be as technical as it should be. It should be sharing the state-of-the-art stuff.Stephenhttp://www.blogger.com/profile/11906928435370299536noreply@blogger.com0tag:blogger.com,1999:blog-10321167.post-1139368291759280022006-02-07T19:08:00.000-08:002006-02-07T20:35:13.426-08:00## What application I need ##- a program to keep track of tasks [a TODO list]<br /> = allow me to add / modify the list, which might be an article, a webpage, a book etc<br /> = allow me to prioritize them<br /> = set a deadline<br /> = somehow a reminder<br /> = can sync with sunbird<br /><br />- Photo album<br /> = similar to sony's imagestation, yahoo! photo album<br /><br />Reference:<br /> http://www.imagestation.com<br /> http://photos.yahoo.comStephenhttp://www.blogger.com/profile/11906928435370299536noreply@blogger.com0tag:blogger.com,1999:blog-10321167.post-1139364805140904762006-02-07T18:12:00.000-08:002006-02-07T18:13:25.166-08:00Blog What I read: talking about designLuis Villa wrote:<br />> On 2/7/06, JP Rosevear <jpr novell com> wrote:<br />>> The changes that were implemented were not as radical as the<br />>> mockups. Basically what Nat F. showed in Paris is what was<br />>> implemented. The code will be released to the community soon.<br />> <br />> To ask the obvious question, why not now, and why not discussed <br />> publicly earlier?<br /><br />So here's my (ie, not Novell's) answer.<br /><br />Two words: "bike shed"[1]. Or actually, "stop energy"[2] works too. Your<br />pick.<br /><br />Although the changes aren't nearly as radical as the original mockups,<br />they are a big change from the current GNOME panel menu. If we had<br />proposed the changes on the mailing lists, it would have started a huge<br />discussion about what people hated about the design ("you can't make the<br />panel menu depend on beagle!!!") and how it should be different. And<br />then we could have either (a) completely ignored everyone and done it<br />ourselves anyway, or (b) had a long conversation about the merits of the<br />design and then not actually finished the code in time for NLD10.<br /><br />So we did it ourselves, and now either GNOME will like what we did, in<br />which case, yay, free code for GNOME, or GNOME won't like what we did,<br />in which case, no harm no foul for GNOME, and yay, brand differentiation<br />for Novell. (And anyone who yells "fork" deserves to get one stuck in them.)<br /><br /><br />An equivalent answer to the question is "because you can't do design by<br />committee". Everything good in GNOME is good because one person or a<br />small number of people working closely together made it good. Much of<br />what is bad in GNOME is bad because lots of people have contributed<br />without having a single vision of what the end result is supposed to be.<br />I mean, look at the stuff John Williams has been blogging about the last<br />week[3]:<br /><br /> * Evolution's UI blocking on I/O SUCKS. Due to lack of design in the<br /> early stages of development<br /><br /> * Evolution's integration with gaim and tomboy RULES. Both of these<br /> happened because specific people (ChipX86, orph) made them happen.<br /><br /> * Multimedia integration SUCKS. No one has ever sat down and tried<br /> to fix the big picture. (Although I think the gstreamer team is in<br /> the process of doing this now?)<br /><br /> * Apps not remembering their window size and position SUCKS. Again,<br /> needs someone to take this problem and make it their own. I<br /> remember xkahn was trying to fix this a few years ago, but never<br /> finished.<br /><br /> * Bug-buddy SUCKS. Jacob's original UI was simple and brilliant. But<br /> as more and more people added more and more features without<br /> looking at the big picture, it got unwieldy. (But now a small<br /> team is putting the simplicity back in again.)<br /><br /> * Deskbar applet RULES (kikidonk), dashboard RULES (Nat), and beagle<br /> RULES (trow and joe). None of these was done *exclusively* by<br /> those people, but each of them reflects one person's (or a few<br /> people's) vision, as opposed to the current state of bug buddy,<br /> which just sort of happened.<br /><br />This is just another aspect of the UI "simplicity" thing. We like UIs<br />that try to do the right thing (metacity, epiphany/firefox, evince)<br />rather than UIs that try to make every possible user happy<br />(enlightenment, mozilla, gpdf/acroread). If you try to design something<br />by committee, you either have to end up with the latter sort of messy<br />does-everything UI, or you ignore and hence piss off a large chunk of<br />the committee.<br /><br />And that's where we are with NLD. There is no way that everyone in the<br />GNOME community is going to like the changes we wanted to make. But we<br />did the user testing, and we believe in it, and we want to make the<br />changes anyway. So we're doing it. Maybe it will turn out good, and<br />maybe it will turn out bad. Either way, the GNOME community learns from<br />it. Think of it like this: wouldn't it have been cool if we could have<br />tried out spatialus on our users, found out that they hated it, and then<br />reverted back to browserlus, without ever having to actually piss off<br />our users? This is essentially what is going to happen with NLD10. If<br />Novell's customers like the NLD changes, then GNOME can adopt them. If<br />Novell's customers don't like the changes, then GNOME can stand off to<br />the side and say "yeah well, we never liked that UI anyway. Not at all<br />like how we would have done it." :-)<br /><br />But some people will still say "But couldn't you have discussed it with<br />the community before doing it?" No, we couldn't. If we had, it would<br />either not have happened, or it would have sucked. It's inevitable. It's<br />not a problem with the GNOME community, it's a problem with communities<br />in general. The wisdom of crowds[4] only works in situations where there<br />are clear right and wrong answers. If you try to apply it to a design<br />problem, where there are many entirely different right answers, then you<br />end up with a wrong answer. Always[5].<br /><br /><br />So to sum up: design by committee is bad, endless debates that result in<br />code not actually being written are bad, design by very small teams is<br />good, software with a unified vision is good, trying out cool new UI<br />ideas is good, free code at least doesn't suck, and of course, for<br />Novell, not shipping NLD10 is bad. I don't think there's anything we<br />could have done to get more of the good without also getting more of the<br />bad.<br /><br />-- DanStephenhttp://www.blogger.com/profile/11906928435370299536noreply@blogger.com0tag:blogger.com,1999:blog-10321167.post-1139127668034230122006-02-05T00:14:00.000-08:002006-02-05T00:21:08.046-08:00Chinese input as if I were in WindowsFinally, get one solution. I like the English UI as I feel it is weird if the interface in Linux is displayed as chinese.<br /><br />The following contains the text for reference only. The original page is:<br />http://www.mrbass.org/linux/ubuntu/scim/<br /><br /><br /><br />Ubuntu CJK Chinese Japanese Korean Input Guide<br /><br />Ubuntu 5.04 Hoary SCIM Chinese, Japanese, and Korean Input Guide<br />You can install CJK input via ubuntuaddon or do it via internet.<br />Ubuntu already comes with Chinese, Japanese and Korean fonts preinstalled.<br /><br />To install via internet (universe repositories must be enabled)<br />sudo apt-get install uim anthy scim-gtk2-immodule scim-uim scim-chinese scim-hangul scim-tables-zh scim-tables-ja scim-tables-ko<br /><br />Add SCIM to startup for X11<br />sudo touch /etc/X11/Xsession.d/74custom-scim_startup<br />sudo chmod 646 /etc/X11/Xsession.d/74custom-scim_startup<br />echo 'export XMODIFIERS="@im=SCIM"' >> /etc/X11/Xsession.d/74custom-scim_startup<br />echo 'export GTK_IM_MODULE="scim"' >> /etc/X11/Xsession.d/74custom-scim_startup<br />echo 'export XIM_PROGRAM="scim -d"' >> /etc/X11/Xsession.d/74custom-scim_startup<br />echo 'export QT_IM_MODULE="scim"' >> /etc/X11/Xsession.d/74custom-scim_startup<br />sudo chmod 644 /etc/X11/Xsession.d/74custom-scim_startup<br /><br /><br />Press CTRL-SPACE to bring up SCIM input methods.<br /><br />Next two steps are OPTIONAL (scim KDE startup and input KDE apps while in GNOME)<br /><br />If you installed kubuntu-desktop (KDE) and plan on logging into KDE session do this in terminal<br />sudo touch ~/.kde/Autostart/startscim<br />echo '"#!/bin/sh"' >> ~/.kde/Autostart/startscim<br />echo "scim -d" >> ~/.kde/Autostart/startscim<br />sudo chmod 745 ~/.kde/Autostart/startscim<br /><br />While using GNOME:<br />you can input into GNOME, GTK apps but NOT KDE apps.<br /><br />While using KDE you can input GNOME, GTK and KDE apps.<br />So if you want to also input in KDE apps while using GNOME do the following:<br />sudo touch ~/.gnome2/session-manual<br />echo "[Default]" >> ~/.gnome2/session-manual<br />echo "num_clients=1" >> ~/.gnome2/session-manual<br />echo "0,RestartStyleHint=3" >> ~/.gnome2/session-manual<br />echo "0,Priority=50" >> ~/.gnome2/session-manual<br />echo "0,RestartCommand=scim -d" >> ~/.gnome2/session-manual<br />echo "0,Program=scim" >> ~/.gnome2/session-manual<br /><br />This will create two SCIM keyboards under GNOME though but allows you to input in KDE apps while in GNOME.<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.mrbass.org/linux/ubuntu/scim/scim-input-japanese.png"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px;" src="http://www.mrbass.org/linux/ubuntu/scim/scim-input-japanese.png" border="0" alt="" /></a>Stephenhttp://www.blogger.com/profile/11906928435370299536noreply@blogger.com0tag:blogger.com,1999:blog-10321167.post-1138874985446106532006-02-02T02:06:00.000-08:002006-02-02T02:10:32.143-08:00Oh. yes, nearly forget this blog...These days need to prepare the documentation for hmm project. We are going to abort this project because it is really quite time consuming and the requirement always changes without control.<br /><br />The following is a brief architecture overview of hmm project:<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/7223/485/1600/arch.png"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://photos1.blogger.com/blogger/7223/485/400/arch.jpg" border="0" alt="" /></a>Stephenhttp://www.blogger.com/profile/11906928435370299536noreply@blogger.com0tag:blogger.com,1999:blog-10321167.post-1138091526447529092006-01-24T00:31:00.000-08:002006-01-24T00:32:06.460-08:00Year 2038just browse the web and found that the year 2038 problem...<br /><br />from http://www.dewtronics.com/msdn_090798a.html<br /><br />How Many GUIDs, Again?<br /><br />Henrik Vallgren and Peter Schaeffer took the time to let Dr. GUI know that he's dead wrong about there being enough GUIDs for each atom in the universe to have its very own. The number of particles (not atoms) in the universe is somewhere around 1079 or so—even Dr. GUI isn't sure of exactly how many.<br /><br />A GUID comprises 128 bits, so the number of GUIDs is 2128. That's only about 1038, or 100,000,000,000,000,000,000,000,000,000,000,000,000. And that's a factor of 1041 short of 1079. So a GUID could hold a unique number for only 1 out of every 1041 particles in the universe. Thankfully, each particle doesn't need its own interface ID and/or class ID. (IElectron? IQuark?) So there are still plenty of GUIDs for our uses.<br /><br />Henrik's line of reasoning was especially interesting:<br /><br />"Consider the sun's mass 2*10^30 kg. Assume that the sun consists of only hydrogen. One gram of hydrogen is 6*10^23 (Avogadro's number) atoms, one kilogram 6*10^26 atoms.<br /><br />"The number of atoms in the suns is thus approximately 10^54 (~2^179).<br /><br />"The hydrogen assumption is wrong so that number should be divided by the true average atomic weight, of which I have no idea. [But it's certainly less than 100—perhaps less than 10—so the assumption of a pure hydrogen sun doesn't affect these numbers much. Like a factor of 100 isn't much.—Dr. GUI]<br /><br />Then consider billions and billions of stars in the Milky Way. And quite a few galaxies on top of that. You'll get the picture ... "<br /><br />Indeed, the good doctor does get the picture. Dr. GUI begs your forgiveness 1041 times.<br /><br />Note that if the GUIDs were somewhat bigger, they WOULD be big enough to give each particle its very own GUID, or PID (for particle ID). It would take about 264 bits—33 bytes for each GUID.<br /><br />Thanks again to Henrik and Peter for taking the time to write.Stephenhttp://www.blogger.com/profile/11906928435370299536noreply@blogger.com0tag:blogger.com,1999:blog-10321167.post-1137554026954367632006-01-17T19:12:00.000-08:002006-01-17T19:13:46.970-08:00Saw a comment that quite describe what programmer feels...Source: http://www.javalobby.org/java/forums/m91982704.html<br /><br />"Re: Tools for screening new Java developers<br />Yes, but this opens up the bigger question, doesn't it? Where technology stands in the post-bubble world.<br /><br />I've seen people without degrees who could write incredible algorithms and could quote Knuth by heart. Then I've also known Computer Science degreed graduates who barely grasped programming at all. Add to this the technical schools and the "Information Technology" degree that has made it's appearance in colleges of late, and you have a horrible bloated landscape for skilled professionals.<br /><br />Continuing this problem is the fact that those who enter technology are not exposed to peer-reviewed journals and a strict respect for the scientific process and experimentation to further the science, but to press release junk and market driven but vaporous software ideas that have little benefit to computer science. Software developers are more likely to Google for ideas than to search EBSCO Host. Is there really computer science anymore? Or is it all just a hacking flaming sub-culture?<br /><br />I think this breeds the signifigant lack of creativity and innovation we've seen in technology in the last few years, as we have a glut of people who got in to technology because of the money and not because of the love of the science. I certainly believe that a big driver of open source development is the absolute failure of companies to manage technology professionals and their creativity. When talented people give away their work for free just to see it breathe, you know an industry is in trouble.<br /><br />Add to this the fact that many IT programming jobs are, let's face it, simply to wrap a database in Java and be done with it, and you have a situation where even people who love the science may quickly become bored with it and move on to something more fulfilling.<br /><br />Knowing this, seeing a sea of mediocre developers come through your door can't be that surprising. The question is: does McDonaldizing the interview process further this mediocrity or protect you against it? I suggest it furthers it.<br /><br />This is a company issue that one person can't solve, but in evaluating the hiring process you have to be careful the image you generate towards the candidates as well. Those companies that treat developers as professionals tend to create an atmosphere that automatically repels the least among the group.<br /><br />How many mediocre candidates do you think Google or Microsoft or Apple or Accenture gets? In contrast, how many do you think your general staff-augmenting quick-in/quick-out consulting firm gets? This can also manifest itself on a local city-wide scale, not just a national scale.<br /><br />In other words, you should be compiling a list of questions to submit to your CIO, not to your candidates :-)"Stephenhttp://www.blogger.com/profile/11906928435370299536noreply@blogger.com0tag:blogger.com,1999:blog-10321167.post-1136538598430964782006-01-06T01:07:00.000-08:002006-01-06T01:09:58.440-08:00Leap second in kernel message..."Clock: inserting leap second 23:59:60 UTC" was found in linux servers I managed.<br /><br />Remember we have one more second at 2006 Jan 01 00:00:00 GMT<br /><br />http://www.maths.tcd.ie/~dwmalone/time/leap2005.htmlStephenhttp://www.blogger.com/profile/11906928435370299536noreply@blogger.com0tag:blogger.com,1999:blog-10321167.post-1135399770848549742005-12-23T20:46:00.000-08:002005-12-23T20:49:30.866-08:00Things to be changed in SC1. to use subversion to replace CVS<br />2. deploy CAS<br />3. use MavenStephenhttp://www.blogger.com/profile/11906928435370299536noreply@blogger.com0tag:blogger.com,1999:blog-10321167.post-1135217848552235472005-12-21T18:14:00.000-08:002005-12-21T18:17:28.570-08:00Antivirus solutions on the mail server side...Just blog the stuff I got about antivirus solutions on the mail server side:<br />1. clamav + clamav-milter (sendmail)<br />2. AMaViS - A Mail Virus Scanner (AMaViS - A Mail Virus Scanner)<br />3. MailScanner (http://www.mailscanner.info/) should be the easiest way to installStephenhttp://www.blogger.com/profile/11906928435370299536noreply@blogger.com0tag:blogger.com,1999:blog-10321167.post-1133616814788634142005-12-03T05:31:00.000-08:002005-12-03T05:33:34.800-08:00ajax frameworkhttp://rialto.application-servers.com/demoRialto.jsp<br /><br />well, using Apache license and probably, can be employed to be used in our application.Stephenhttp://www.blogger.com/profile/11906928435370299536noreply@blogger.com0tag:blogger.com,1999:blog-10321167.post-1132106008464952652005-11-15T17:52:00.000-08:002005-11-15T17:53:28.476-08:00MD5 cracker source releasedhttp://www.stachliu.com.nyud.net:8090/collisions.html<br /><br />Think if you are going to use MD5.Stephenhttp://www.blogger.com/profile/11906928435370299536noreply@blogger.com1tag:blogger.com,1999:blog-10321167.post-1130557842433299262005-10-28T20:11:00.000-07:002005-10-28T20:50:42.443-07:00A day of bug fixing...It might be good to tell more about my job...<br /><br />Now I received a list of bugs:<br />[hmm site]/forum/main/list/cn.page<br /><br />PRC forum<br />• Bug: IE browser title text should be in S.Chinese. [Yes it is, I tried to fix it but time is not allowed.]<br />• Bug: Click 免費入會 will go to HK site.<br />• Bug: Click 忘記密碼 will go to HK site.<br />• Bug: Click 登出 will go to HK site.<br />• Bug: Click 更改個人資料 will go to HK site.<br />• Bug: Click HMM logo will go to HK site.<br />• Bug: Add ALT for images on left panel<br />• Bug: The “編輯” image is broken.<br /> <br />Both HK and PRC<br />• Bug: Search, if key in 2 words (1 word is ok) with result of several, return error<br /><br />After receiving it from Sam, I starts checking the issue. Well, some is known to me.Stephenhttp://www.blogger.com/profile/11906928435370299536noreply@blogger.com1tag:blogger.com,1999:blog-10321167.post-1130488340993147802005-10-28T01:31:00.000-07:002005-10-28T01:32:21.003-07:00DCCP protocol...Congestion Control Protocol<br /><br />http://www.icir.org/kohler/dcp/Stephenhttp://www.blogger.com/profile/11906928435370299536noreply@blogger.com0tag:blogger.com,1999:blog-10321167.post-1130339716089461122005-10-26T08:13:00.000-07:002005-10-26T08:15:16.100-07:00Allan mail server is down...Ar. have no idea why it is down... It is the client from Corpmart... We are providing support to them...<br /><br />Need to explain why it is hang.Stephenhttp://www.blogger.com/profile/11906928435370299536noreply@blogger.com0tag:blogger.com,1999:blog-10321167.post-1120474318390403262005-07-04T03:51:00.000-07:002005-07-04T03:51:58.400-07:00Using Spamassassin and procmail to filter spam<a href="http://wiki.arslinux.com/Spamassassin_and_procmail">Using Spamassassin and procmail to filter spam</a><br /><hr><br /><br />See also: Mail Server FAQ<br />Table of contents<br />1 Procmail and Spamassassin<br /><br />1.1 SpamAssassin: Automagic teaching<br /><br />1.1.1 One spamassassin autolearning setup<br />1.1.2 An Alternative Autolearning Setup<br />1.1.3 Performance issues with training the bayesian filter<br />[edit]<br />Procmail and Spamassassin<br /><br />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.<br /><br />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.<br /><br />[user@mail ~]$ cat .procmailrc<br />#.procmailrc - by jorge - Updated by glenn 6/8/05<br /><br /># Set our default shell, which may not be necessary, as it<br /># uses the user's default<br />SHELL=/usr/bin/bash<br /><br /># Set our default Maildir. You can also set the HOME variable, which<br /># may be set automatically by procmail<br />MAILDIR=/home/jorge/Maildir<br /><br /># Set our default mailbox, which is where mail that doesn't have<br /># a sort rule applied goes. The trailing / is important.<br />DEFAULT=/home/jorge/Maildir/<br /><br /># Set up logging. It's a good idea to let procmail log all its<br /># actions until you're sure it's working right.<br />LOGFILE=${MAILDIR}/procmail.log<br />LOG="--- Logging ${LOGFILE} for ${LOGNAME}, "<br /><br /># Whatever recipes you'll use<br /># The order of the recipes is significant<br /><br /># First, run everything through spamassassin. The "-P -a" tags are<br /># not needed with 3.0+, as they are now the defaults.<br />:0fw<br />| spamassassin<br /><br /># Now that we've tagged spam, put it in its own folder<br /><br />:0:<br /><br />* ^X-Spam-Status: Yes<br />/home/jorge/Maildir/.spam/<br /><br />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.<br /><br />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.<br /><br />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.<br /><br />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.<br /><br />Next, we need to create a .forward file to get the email to go to procmail.<br /><br />[user@mail ~]$ cat .forward<br />|/usr/bin/procmail<br /><br />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.<br /><br />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.<br /><br />[user@mail ~/.spamassassin]$ cat user_prefs<br /># custom rules for spamassassin<br />score RAZOR_CHECK 4.0<br />score REMOVE_SUBJ 4.0<br />score SUBJ_REMOVE 4.0<br /><br />score REPLY_REMOVE_SUBJECT 4.0<br />score REMOVE_IN_QUOTES 4.0<br />score HTML_WITH_BGCOLOR 4.0<br />score REALLY_UNSAFE_JAVASCRIPT 4.0<br />score CHARSET_FARAWAY_BODY 4.0<br />score NO_MX_FOR_FROM 4.0<br /><br />score CTYPE_JUST_HTML 4.0<br />score WEB_BUGS 4.0<br />score SUBJ_ALL_CAPS 4.0<br />score LINES_OF_YELLING 4.0<br />score FOR_FREE 4.0<br /><br />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.<br /><br />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?<br />[edit]<br />SpamAssassin: Automagic teaching<br /><br />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.<br />[edit]<br />One spamassassin autolearning setup<br /><br />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:<br /><br />glenn@vasp:~$ cat learn.sh<br />#!/bin/bash<br />/usr/bin/sa-learn --spam ~/Maildir/.Junk/cur<br />/usr/bin/sa-learn --ham ~/Maildir/cur<br /><br />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:<br /><br />glenn@vasp:~$ cat cleanup-junk.sh<br />#!/bin/bash<br /><br /># Removes all files from ~/Maildir/.Junk/cur that are older than<br /># 31 days ago<br /><br />find ~/Maildir/.Junk/cur -mtime +30 -exec rm -f {} \;<br /><br />I simply placed these in my crontab:<br /><br />glenn@vasp:~$ crontab -l<br /># min hr dom month dow cmd<br /># Teach spamassassin about spam<br />* 4 * * 4,7 /home/glenn/learn.sh<br /><br /># Clean up spam directory<br />* 5 * * 4,7 /home/glenn/cleanup-junk.sh<br /><br />This works nicely for me, keeping spamassassin smart and preventing me from missing important emails.<br />[edit]<br />An Alternative Autolearning Setup<br /><br />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.<br /><br />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.)<br /><br />[user@mail ~]$ cat ~/learn.sh<br />#!/bin/bash<br />/usr/bin/sa-learn --spam /home/user/Maildir/.Junk/new<br />/usr/bin/sa-learn --spam /home/user/Maildir/.Junk/cur<br />/usr/bin/sa-learn --ham /home/user/Maildir/new<br />/usr/bin/sa-learn --ham /home/user/Maildir/cur<br />rm /home/user/Maildir/.Junk/new/*<br />rm /home/user/Maildir/.Junk/cur/*<br /><br />We then want to run that script every 4 hours, or however often you wish to have it run.<br /><br />[user@mail ~]$ crontab -l<br />SHELL=/bin/sh<br />PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin<br />MAILTO=""<br /># m h dom mon dow command<br />0 */4 * * * /home/user/bin/learn.sh<br /><br />And now, SpamAssassin can learn from its mistakes as you simply 'delete' (move to the Junk folder) your spam clientside.<br />[edit]<br />Performance issues with training the bayesian filter<br /><br />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.<br /><br />So now, my learnspam script looks like:<br /><br />#!/bin/sh<br />## Process high scoring spam in the .Spam folder and anything leftover in .Junk<br />#set -x<br /># feed to the bayesian learner<br />echo "Processing Junk maildir..."<br />spams=`find ~/Maildir/.Junk/cur ~/Maildir/.Junk/new/ -type f -mtime +7`<br />for spam in $spams<br /> do sa-learn --spam --showdots --no-sync $spam<br />done<br />rm -f $spams<br />echo "Processing Spam maildir..."<br />spams=`find ~/Maildir/.Spam/cur ~/Maildir/.Spam/new/ -type f -mtime +3`<br />for spam in $spams<br /> do sa-learn --spam --showdots --no-sync $spam<br />done<br />sleep 1<br />rm -f $spams<br /><br />And my learnham script is:<br /><br />#!/bin/sh<br />## Process ham<br />if [ $# -lt 1 ]; then<br /> echo "Usage: $0 <age>"<br /> exit 3<br />fi<br />#set -x<br /># feed to the bayesian learner<br />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`<br /> do for mail in $allmail<br /> do echo $mail; sa-learn --ham --showdots --no-sync $mail<br /> done<br />done<br />sleep 1<br />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`<br /> do for mail in $allmail<br /> do echo $mail; sa-learn --ham --showdots --no-sync $mail<br /> done<br />done<br /><br />This may be helpful to anyone else who wants to run SA with bayesian learning on something with little memory like a linode.Stephenhttp://www.blogger.com/profile/11906928435370299536noreply@blogger.com0tag:blogger.com,1999:blog-10321167.post-1119169683537592242005-06-19T01:19:00.000-07:002005-06-19T01:28:03.556-07:00Start installing other firmware on my Linksys router...I am starting to use "Firmware Version: v3.03.6 - HyperWRT 2.1b1" for my wireless router.<br /><br />now, I have telnet to it.<br /><br />========== dmesg output===============<br />CPU revision is: 00029007<br />Primary instruction cache 8kb, linesize 16 bytes (2 ways)<br />Primary data cache 4kb, linesize 16 bytes (2 ways)<br />Linux version 2.4.20 (root@localhost) (gcc version 3.2.3 with Broadcom modifications) #1 Fri Feb 18 18:25:54 CET 2005<br />Determined physical RAM map:<br /> memory: 01000000 @ 00000000 (usable)<br />On node 0 totalpages: 4096<br />zone(0): 4096 pages.<br />zone(1): 0 pages.<br />zone(2): 0 pages.<br />Kernel command line: root=/dev/mtdblock2 noinitrd console=ttyS0,115200<br />CPU: BCM4712 rev 1 at 200 MHz<br />Calibrating delay loop... 199.47 BogoMIPS<br />Memory: 14444k/16384k available (1333k kernel code, 1940k reserved, 108k data, 64k init, 0k highmem)<br />Dentry cache hash table entries: 2048 (order: 2, 16384 bytes)<br />Inode cache hash table entries: 1024 (order: 1, 8192 bytes)<br />Mount-cache hash table entries: 512 (order: 0, 4096 bytes)<br />Buffer-cache hash table entries: 1024 (order: 0, 4096 bytes)<br />Page-cache hash table entries: 4096 (order: 2, 16384 bytes)<br />Checking for 'wait' instruction... unavailable.<br />POSIX conformance testing by UNIFIX<br />PCI: Disabled<br />PCI: Fixing up bus 0<br />Linux NET4.0 for Linux 2.4<br />Based upon Swansea University Computer Society NET3.039<br />Initializing RT netlink socket<br />Starting kswapd<br />devfs: v1.12c (20020818) Richard Gooch (rgooch@atnf.csiro.au)<br />devfs: boot_options: 0x1<br />pty: 256 Unix98 ptys configured<br />Serial driver version 5.05c (2001-07-08) with MANY_PORTS SHARE_IRQ SERIAL_PCI enabled<br />ttyS00 at 0xb8000300 (irq = 3) is a 16550A<br />ttyS01 at 0xb8000400 (irq = 0) is a 16550A<br />HDLC line discipline: version $Revision: 1.1.1.4 $, maxframe=4096<br />N_HDLC line discipline registered.<br />PPP generic driver version 2.4.2<br />Physically mapped flash: Found an alias at 0x400000 for the chip at 0x0<br />Physically mapped flash: Found an alias at 0x800000 for the chip at 0x0<br />Physically mapped flash: Found an alias at 0xc00000 for the chip at 0x0<br />Physically mapped flash: Found an alias at 0x1000000 for the chip at 0x0<br />Physically mapped flash: Found an alias at 0x1400000 for the chip at 0x0<br />Physically mapped flash: Found an alias at 0x1800000 for the chip at 0x0<br />Physically mapped flash: Found an alias at 0x1c00000 for the chip at 0x0<br />number of CFI chips: 1<br />0: offset=0x0,size=0x2000,blocks=8<br />1: offset=0x10000,size=0x10000,blocks=63<br />Flash device: 0x400000 at 0x1c000000<br />Physically mapped flash: cramfs filesystem found at block 910<br />Creating 4 MTD partitions on "Physically mapped flash":<br />0x00000000-0x00040000 : "pmon"<br />0x00040000-0x003f0000 : "linux"<br />0x000e3918-0x003f0000 : "rootfs"<br />mtd: partition "rootfs" doesn't start on an erase block boundary -- force read-only<br />0x003f0000-0x00400000 : "nvram"<br />sflash: found no supported devices<br />NET4: Linux TCP/IP 1.0 for NET4.0<br />IP Protocols: ICMP, UDP, TCP, IGMP<br />IP: routing cache hash table of 512 buckets, 4Kbytes<br />TCP: Hash tables configured (established 1024 bind 2048)<br />Linux IP multicast router 0.06 plus PIM-SM<br />ip_conntrack version 2.1 (128 buckets, 1024 max) - 344 bytes per conntrack<br />ip_conntrack_pptp version 1.9 loaded<br />ip_nat_pptp version 1.5 loaded<br />ip_tables: (C) 2000-2002 Netfilter core team<br />ipt_time loading<br />NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.<br />NET4: Ethernet Bridge 008 for NET4.0<br />802.1Q VLAN Support v1.7 Ben Greear <greearb@candelatech.com><br />All bugs added by David S. Miller <davem@redhat.com><br />VFS: Mounted root (cramfs filesystem) readonly.<br />Mounted devfs on /dev<br />Freeing unused kernel memory: 64k freed<br />5325E phy=0<br />5325E VLAN programming for BCM5325E-MDIO I/F switch<br />1:(0x00) value=0x8000<br />2:(0x00) value=0x8000<br />1:(0x13) value=0x0000<br />2:(0x13) value=0x0002<br />1:(0x00) value=0x8000<br />2:(0x00) value=0x8000<br />1:(0x13) value=0x0002<br />2:(0x13) value=0x0006<br />1:(0x00) value=0x8000<br />2:(0x00) value=0x8000<br />1:(0x13) value=0x0006<br />2:(0x13) value=0x000e<br />1:(0x00) value=0x8000<br />2:(0x00) value=0x8000<br />1:(0x13) value=0x000e<br />2:(0x13) value=0x001e<br />1:(0x00) value=0x8000<br />2:(0x00) value=0x0000<br />eth0: Broadcom BCM47xx 10/100 Mbps Ethernet Controller 3.60.13.0<br />eth1: Broadcom BCM4320 802.11 Wireless Controller 3.60.13.0<br />flag=[get_flash] offset=[0] string=[<null>]<br />Intel 28F320C3 2Mx16 BotB<br />Set flash_type=Intel 28F320C3 2Mx16 BotB<br />exit<br />Algorithmics/MIPS FPU Emulator v1.5<br />vlan0: add 01:00:5e:00:00:01 mcast address to master interface<br />vlan0: dev_set_promiscuity(master, 1)<br />device eth0 entered promiscuous mode<br />device vlan0 entered promiscuous mode<br />device eth1 entered promiscuous mode<br />br0: port 2(eth1) entering learning state<br />br0: port 1(vlan0) entering learning state<br />br0: port 2(eth1) entering forwarding state<br />br0: topology change detected, propagating<br />br0: port 1(vlan0) entering forwarding state<br />br0: topology change detected, propagating<br />flag=[get_eou_key_index] offset=[0] string=[<null>]<br />eou_key_init()<br />location = [1]<br />Available eou key index is 1<br />exit<br />vlan1: Setting MAC address to xxxxxxxxxxxxxxx.<br />nvram_commit(): init<br />nvram_commit(): end<br />nvram_commit(): init<br />nvram_commit(): end<br />br0: port 2(eth1) entering disabled state<br />br0: port 1(vlan0) entering disabled state<br />vlan0: del 01:00:5e:00:00:01 mcast address from master interface<br />vlan0: del 01:00:5e:00:00:01 mcast address from vlan interface<br />br0: port 1(vlan0) entering disabled state<br />device vlan0 left promiscuous mode<br />br0: port 2(eth1) entering disabled state<br />device eth1 left promiscuous mode<br />vlan0: dev_set_promiscuity(master, -1)<br />device eth0 left promiscuous mode<br />vlan0: add 01:00:5e:00:00:01 mcast address to master interface<br />vlan0: dev_set_promiscuity(master, 1)<br />device eth0 entered promiscuous mode<br />device vlan0 entered promiscuous mode<br />device eth1 entered promiscuous mode<br />br0: port 2(eth1) entering learning state<br />br0: port 1(vlan0) entering learning state<br />br0: port 2(eth1) entering forwarding state<br />br0: topology change detected, propagating<br />br0: port 1(vlan0) entering forwarding state<br />br0: topology change detected, propagating<br />flag=[get_eou_key_index] offset=[0] string=[<null>]<br />eou_key_init()<br />location = [1]<br />Available eou key index is 1<br />exitStephenhttp://www.blogger.com/profile/11906928435370299536noreply@blogger.com3tag:blogger.com,1999:blog-10321167.post-1118644561631813022005-06-12T23:36:00.000-07:002005-06-12T23:36:01.640-07:00Flavio’s TechnoTalk � Blog Archive � Performance analysis on Linux<a href="http://geminis.dyndns.org/wordpress/index.php/2005/06/05/performance-analysis-on-linux/">Flavio’s Performance analysis on Linux</a>: "Performance analysis on Linux"
<br />
<br />This article gives an overview of performance analysis on Linux.Stephenhttp://www.blogger.com/profile/11906928435370299536noreply@blogger.com0tag:blogger.com,1999:blog-10321167.post-1118562802465980652005-06-12T00:47:00.000-07:002005-06-12T00:53:22.470-07:00Wireless USB adapter...After doing some research, the following USB adapter seems to be working in Linux:<br /><br />Buffalo WLI-U2-KG54-AI HK$ 270<br />Surecom EP-9001-G HK$ 210 [RT2500 chipset]<br />Dlink DWL-G122 HK$ 220 [RT2500 chipset]<br />Zyxel G220 HK$ 239<br /><br />EP-9001-GP $328<br />DWL-G132 $349<br /><br />I have forgotten the formula for converting mW to dBm, learnt from wireless communication course.<br />I found a website which provides quite good tools to do the calculation:<br /><a href="http://flakey.info/wirelesstools/#freespaceloss">Wireless Javascript Toolkit</a><br /><br />Need to compare the output power and antenna gain...Stephenhttp://www.blogger.com/profile/11906928435370299536noreply@blogger.com0tag:blogger.com,1999:blog-10321167.post-1118157268571971782005-06-07T08:14:00.000-07:002005-06-07T08:14:28.576-07:00slower常用的数据库连接写法和下载地址(转载)<br /><br /> 在调试Spring+hibernate中,后来发现好像Sqlserver的驱动有问题,又听说jtds是非常好的替代品,就在网上照jtds的下载,发现了这篇文章,转载如下(http://dev2dev.bea.com.cn/bbs/thread.jspa?forumID=123&threadID=20222&messageID=116981):<br /><br />1. MySQL(http://www.mysql.com)mm.mysql-2.0.2-bin.jar<br />Class.forName( "org.gjt.mm.mysql.Driver" );<br />cn = DriverManager.getConnection( "jdbc:mysql://MyDbComputerNameOrIP:3306/myDatabaseName", sUsr, sPwd );<br /><br />2. PostgreSQL(http://www.de.postgresql.org)pgjdbc2.jar<br />Class.forName( "org.postgresql.Driver" );<br />cn = DriverManager.getConnection( "jdbc:postgresql://MyDbComputerNameOrIP/myDatabaseName", sUsr, sPwd );<br /><br />3. Oracle(http://www.oracle.com/ip/deploy/database/oracle9i/)classes12.zip<br />Class.forName( "oracle.jdbc.driver.OracleDriver" );<br />cn = DriverManager.getConnection( "jdbc:oracle:thin:@MyDbComputerNameOrIP:1521:ORCL", sUsr, sPwd );<br /><br />4. Sybase(http://jtds.sourceforge.net)jconn2.jar<br />Class.forName( "com.sybase.jdbc2.jdbc.SybDriver" );<br />cn = DriverManager.getConnection( "jdbc:sybase:Tds:MyDbComputerNameOrIP:2638", sUsr, sPwd );<br />//(Default-Username/Password: "dba"/"sql")<br /><br />5. Microsoft SQLServer(http://jtds.sourceforge.net)<br />Class.forName( "net.sourceforge.jtds.jdbc.Driver" );<br />cn = DriverManager.getConnection( "jdbc:jtds:sqlserver://MyDbComputerNameOrIP:1433/master", sUsr, sPwd );<br /><br />6. Microsoft SQLServer(http://www.microsoft.com)<br />Class.forName( "com.microsoft.jdbc.sqlserver.SQLServerDriver" );<br />cn = DriverManager.getConnection( "jdbc:microsoft:sqlserver://MyDbComputerNameOrIP:1433;databaseName=master", sUsr, sPwd );<br /><br />7. ODBC<br />Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );<br />Connection cn = DriverManager.getConnection( "jdbc:odbc:" + sDsn, sUsr, sPwd );<br /><br />8.DB2(新添加)<br />Class.forName("com.ibm.db2.jdbc.net.DB2Driver");<br />String url="jdbc:db2://192.9.200.108:6789/SAMPLE"<br />cn = DriverManager.getConnection( url, sUsr, sPwd );<br /><br />9.Microsoft SQL Server series (6.5, 7.x and 2000) and Sybase 10<br /><br />JDBC Name: jTDS<br />URL: http://jtds.sourceforge.net/<br />Version: 0.5.1<br />Download URL: http://sourceforge.net/project/showfiles.php?group_id=33291<br /><br />语法:<br />Class.forName("net.sourceforge.jtds.jdbc.Driver ");<br />Connection con = DriverManager.getConnection("jdbc:jtds:sqlserver://host:port/database","user","password");<br />or<br />Connection con = DriverManager.getConnection("jdbc:jtds:sybase://host:port/database","user","password");<br /><br />10.Postgresql<br />JDBC Name: PostgreSQL JDBC<br />URL: http://jdbc.postgresql.org/<br />Version: 7.3.3 build 110<br />Download URL: http://jdbc.postgresql.org/download.html<br />语法:<br />Class.forName("org.postgresql.Driver");<br />Connection con=DriverManager.getConnection("jdbc:postgresql://host:port/database","user","password");<br /><br />11.IBM AS400主机在用的JDBC语法<br />有装V4R4以上版本的Client Access Express<br />可以在C:\Program Files\IBM\Client Access\jt400\lib<br />找到 driver 档案 jt400.zip,并更改扩展名成为 jt400.jar<br />语法:<br />java.sql.DriverManager.registerDriver (new com.ibm.as400.access.AS400JDBCDriver ());<br />Class.forName("com.ibm.as400.access.AS400JDBCConnection");<br />con = DriverManager.getConnection("jdbc:as400://IP","user","password");<br /><br />12.informix<br />Class.forName("com.informix.jdbc.IfxDriver").newInstance();<br />String url =<br />"jdbc:informix-sqli://123.45.67.89:1533/testDB:INFORMIXSERVER=myserver;<br />user=testuser;password=testpassword";<br />Lib:jdbcdrv.zip<br><br>Class.forName( "com.sybase.jdbc.SybDriver" )<br />url="jdbc:sybase:Tds:127.0.0.1:2638/asademo";<br />SybConnection connection= (SybConnection)DriverManager.getConnection(url,"dba","sql");<br /><br />13.SAP DB<br />Class.forName ("com.sap.dbtech.jdbc.DriverSapDB");<br />java.sql.Connection connection = java.sql.DriverManager.getConnection ( "jdbc:sapdb://" + host + "/" + database_name,user_name, password)<br /><br />14.InterBase<br />String url = "jdbc:interbase://localhost/e:/testbed/database/employee.gdb";<br />Class.forName("interbase.interclient.Driver");<br />//Driver d = new interbase.interclient.Driver (); /* this will also work if you do not want the line above */<br />Connection conn = DriverManager.getConnection( url, "sysdba", "masterkey" );<br /><br />15.HSqlDB<br />url: http://hsqldb.sourceforge.net/<br />driver: org.hsqldb.jdbcDriver<br />连接方式有4种,分别为:<br />con-str(内存): jdbc:hsqldb.<br />con-str(本地): jdbc:hsqldb:/path/to/the/db/dir<br />con-str(http): jdbc:hsqldb:http://dbsrv<br />con-str(hsql): jdbc:hsqldb:hsql://dbsrvStephenhttp://www.blogger.com/profile/11906928435370299536noreply@blogger.com0