Archive for February, 2007

MySQL and Daylight Savings Time change

In a previous post I mentioned about patches needed to accomadate the new DST changes for Sql Server. (I know, this is one of Dannyman’s favorite subjects ;) )

For MySQL, obviously you need to patch the host server first. Then you need to find out if MySQL needs separate work. Here is a note I gathered. Let me know if I am wrong on this or if there is a better way.

1. Get into mysql and do \s to find out the version of your MySQL.

If it is prior to 4.1.3, don’t worry about it.

Else

2. Do select @@global.time_zone;

If the result is SYSTEM, don’t worry about it.

Else

You need to load time zone info, usually at /usr/share/zoneinfo into your mysql database, by running something like:

# mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql

More information available at MySQL’s documentation site.

Comments (1)

The Times They Are a-Changin’

Below is a piece I wrote for last week’s Sql Server PASS newsletter. The editor adjusted the title to The Times, They Are Changin’. I thought that change lost the humor I try to convey :) Also, it is amazing how close Brian and I think on this one. We didn’t talk to each other, but wrote very similar posts for this subject around the same time.

In the US, Energy Policy Act of 2005 was passed and signed into law in 2005. One provision of the law expanded daylight saving time period by 4 weeks, effective in 2007. As a result, computer operating system in the US needs to be patched to reflect this change. The patch is fairly simple to apply for servers, mostly in the form of registry changes. To get help on how to adjust this setting for your Windows servers, you can visit the site here.

Fortunately for Sql Server, once the underlying Windows time setting has been adjusted, there is almost no additional work to do on Sql Server. The exception is Sql Server Notification Services. Notification Services for both Sql Server 2000 and 2005 need updates to accommodate this time change. You can follow this link here for instructions.

For non-US readers out there, this change may not affect you, so let me introduce you to MSDN’s video series for Sql Server 2005 Express Edition. These are database courses delivered in video format. It looks very promising. You can get it here.

Comments (1)

Blind men and the elephant

Wang Jian Shuo is an amazing guy. He works for eBay’s branch in Shanghai, and writes frequently in English about Shanghai, China, his travels, and observations of East and West. I wrote here before about his thoughts on his BBC interview and media.

Recently he penned another great piece. Some key points that I liked:

In the story, six blind men approached the elephant and each one of them only grasped part of the elephant. They argued with each other about what the elephant really looked like. They claim the elephant is like a wall, like spear, like a snake, like a tree, like a fan, or like a rope. Obviously they could not reach an agreement.

Several hundred years later, the story still repeat itself. People tend to understand only a tiny portion of Reality and then extrapolate all manner of dogmas from that, each claiming only his one is the correct version. This re-appeared a number of times in both Western and Oriental thought.

By knowing that every one can only see so small part of the world, and so small slice of time in history, we are more curious and conciouse about the world. Being able to see only part of the world does not prevent us from forming an opinion, but we can do a much better job than the blind man. When we express our opinion, we can show some respect to others, and always remind ourselves that we only see part of the world.

If the six blind men can learn to appreciate other’s observation, and exchange ideas, maybe one day, they can draw a much closer view of the elephant, who knows.

Comments

写春联儿

上次练完书法后,我便琢磨着要买些文房四宝来写过年的对子。店里没有春节用的红纸,所以只算文房三宝。但家里有供孩子画画涂鸦的硬红纸,就拿过来充数。

儿子在磨砚:

磨砚

我在网上搜了一些对子和横批,挑出了稍微简单的一个:春风春雨春色,新年新岁新景。横批是“万事如意”。我把繁简体都打印出来,稍微给儿子解释了一下繁简体和古文的从上到下、从左到右的习惯,他就开始写。

儿子对涂鸦感兴趣,写起字来也挺认真。他写得很整洁。不过有点倒拉笔回,握笔的方法和姿势也不规范。但在我们的中文环境下,就不好求全责备了。

小书法家 (by haidong)

这儿是成品:

春联儿 (by haidong)

记得小时候贴对子都用自己做的浆糊,我们方言叫“打浆子”,就是用白面做的粘乎乎的稠面汤。做完之后我们就用发箒把浆子抹在门框上来贴春联。现在我们住在鸟笼式的二房一厅的楼房里,没有地方贴,所以就用透明胶布贴在儿子的屋门边。

Comments (4)

2007春节前随记

前几天芝加哥下了场大雪,于是我便拉着雪橇送儿子去上学。他挺喜欢在“雪地上撒点儿野”,所以我们一路走来都是兴致盎然。以下是雪景的照片,是在我办公室附近的公园照的。夏天午饭时我常抽空来这儿打打篮球,滑滑旱冰什么的。

Snow (by haidong)

雪很厚,正所谓:

江上一笼统,
井上黑窟窿。
黑狗身上白,
白狗身上肿。

今年过年我会给儿子做饺子。我最近也买了一些袋装的成品水饺,儿子都挺喜欢吃。另外,我竟然在这儿的一家中国店里看到了馓子。馓子在小时候可是好东西,泡在汤里吃的味道很好。

水饺,馓子,和饺子皮儿 (by haidong)

上周五一个朋友组织了部分伊利诺伊州立大学毕业的中国学生聚会,感觉挺亲切。餐毕,有人开始唱卡拉OK。第一首便是罗大佑的《东方之珠》。罗大佑的歌我一直都喜欢。这首歌现在听来好像感触更深一些。

小河弯弯向南流
流到香江去看一看
东方之珠 我的爱人
你的风采是否浪漫依然

月儿弯弯的海港
夜色深深 灯火闪亮
东方之珠 整夜未眠
守着沧海桑田变幻的诺言

让海风吹拂了几千年
每一滴泪珠仿佛都说出你的尊严
让海潮伴我来保佑你
请别忘记我永远不变黄色的脸

船儿弯弯入海港
回头望望 沧海茫茫
东方之珠 拥抱着我
让我温暖你那苍凉的胸膛。

祝我的读者和全体过农历新年的人新春快乐,万事如意!

Comments

Sledding 20070210

Last Sunday was pretty cold in Chicago, around -20 Celsius. It’s a good day for sledding.

All prepared:

Sledding (by haidong)

Sliding forward:

Sledding (by haidong)

Drinking hot chocolate afterwards (O’boy chocolate from Sweden):

Sledding (by haidong)

I think I will pull the sled to school again tomorrow.

Comments

Enable File and Printer Sharing for Microsoft Networks for cluster install

I talked about one issue when setting up Sql cluster here. Recently I came across another problem while setting up a Sql Server 2000 cluster on a 2-node Windows 2003 cluster.

The error occurred at the step where you were asked to provide a login that can get into the remote node(s), server(s) where install is not originated from. Below is the error message:

The specified account cannot be validated to have administrator rights on Node2.
 An error occurred: (1203)

No network provider accepted the given network path.

This is most likely caused by the fact that File and Printer Sharing for Microsoft Networks is not enabled. You can verify that by trying to open up \\Node2\c$. You will most likely encounter the “No network provider accepted the given network path”.

To enable that feature, go to your network connection, right click on Properties, and check the corresponding box. Note that for clusters, most likely you will have 2 networks: one public and one private. You need to enable this feature on the public network in order to continue. Reboot is not required.

Comments (2)

Assign SELECT results into variables

I mentioned here that SELECT INTO in Sql Server is functionally similar to CREATE TABLE AS in Oracle. Oracle also has SELECT INTO, but it is used for assigning query results to a variable.

Here is a PL/SQL code snippet:

declare MyVariable varchar2(20);

Begin

select ColumnName into MyVariable from MyTable where MyID = SomeInteger;
dbms_output.put_line('Hello ' || MyVariable);

End

In the above example, a column value for a particular record is assigned to MyVariable and printed out.

How do you assign select results into T-Sql variables in Sql Server then? Here is a code sample that does the same thing above:

declare @MyVariable varchar(20)

select @MyVariable = ColumnName from MyTable where MyId = SomeInteger

print 'Hello ' + @MyVariable

Comments (3)

Best way to represent date value in Sql Server

I am going through Kalen Delaney and Itzik Ben-Gan’s Inside Sql Server 2005 books. I am surprised and happy to learn that you can always represents date/time value in the format of [YY]YYMMDD[ HH:MI[:SS][.MMM]] in Sql Server, with things inside the square bracket being optional. In fact, that is a recommended practice because you will always get intended results regardless of Windows locale settings, SET LANGUAGE, and SET DATEFORMAT options.

This representation is actually consistent with the convention used in China, so it feels pretty natural to me. In China, when people talk about dates, it is almost always written in the order of year, month, date, and goes more granular as needed such as hour, minutes, seconds, etc.

The same can be said about address. For example “100 Main Street, Oak Park, Illinois, USA” is the proper order of writing address in the US. The same address addressed in Chinese would be “USA, Illinois, Oak Park, 100 Main Street”

I wouldn’t be surprised if Japan, Korea, and other Asian countries use the same convention as China on this. I am not sure, though.

Comments (3)

Computer fixed

Reader Bulent’s comment gave me some ideas. I unplugged the existing power cable from the hard disk, and plugged in another available power cable, to see if that would make any difference.

It didn’t. Frustrated, I left the computer on and busied myself with other matters, probably doing dishes. When I came back, lo and behold, the computer was booting up, albeit very slowly.

Slow boot (by haidong)

Look at the above picture, it took about one hour for the bar to become all the way solid, which I believe is some kind of process that involves the hard disk. Afterwards, it booted up, and I was able to finish Windows XP SP2 install. Time for another reboot.

I kept my fingers crossed. It didn’t help. I saw the same thing shown in the above picture. It was getting late, so I powered it down, and went to bed with a strong suspicion of the existing hard drive. In addition, it was very dusty inside the computer. So I also wondered if the dust is somehow to blame.

The next night, when I was free, I gave my computer a half-hearted blowjob and sent some of the dust inside flying. It didn’t help. It was time for the next step of elimination: determine if the hard drive was the problem.

Fortunately I have another computer at home. It was a HP Pavilion 4455 that I bought about 10 years ago in 1997. Believe it or not, that was my first computer. I still use it occasionally, mainly for playing with different Linux distributions (Red Hat 7.3, Mandrake, and then Red Hat Fedora core). So I decided to put the old computer’s hard drive into the problematic computer, and see what happens next.

Piggyback on a different hard drive (by haidong)

I didn’t even swap the hard drives. As you can see from the picture above, I opened both cases, unplugged power and cable for the 4455’s hard drive, unplugged power and cable for the problem computer’s hard drive, and hooked them up with the drive from the 4455, and then gave it a go. It worked!! It booted up at normal speed. I was able to put Windows XP SP2 on it. So now I know there are definitely problems with the hard drive. Time to get a new one. I bought one from Micro Center the next day. This is a Seagate drive, 100 GB, 50 bucks.

Old and New hard disk (by haidong)

Time to install the new hard drive. Now the computer case design has improved quite a bit over the last few years. I had fun tinkering around. I took off both side panels of the HP Pavilion 513x, pushed the tabs of the front panel from the inside, and was able to pull the front panel off. After taking off a few screws, pushing down the tab on the side of the case where hard and floppy drives are housed, I then pushed the case from the now opened front panel. The hard drive case just slid off on the side. It was quite clever: there was a little curvy track at the bottom of the CD-ROM case, where the top of the hard drive case fits into.

I then connected the new hard drive as the master drive. I actually kept the troubled drive as secondary. Now I am back in business. Strangely, the old drive now works happily as a secondary drive. Anyway, I had fun fixing the problem, and am pretty happy with the results.

Comments (2)