RSS 2.0 Feed
2004-04 Entries
摘要: WinHEC 2004 is just around the corner (May 4-7, Seattle). There will be lots of exciting sessions about what PC hardware should be like when Longhorn ships. Among them, quite a few deals with Avalon.   Avalon Document Services and the Longhorn Print Architecture Longhorn offers new opportunities to address the increasing print demands of our customers. Windows customers want a means to print advanced graphics with high fidelity and performance. To meet these needs, the print subsystem is undergoing a fundamental change that involves a new print pipeline. This change provides abundant opportunities for vendor extensibility and enhanced color support. This......[阅读全文]

posted @ | Feedback (7) |

摘要:April 15 is the day for reporting your income tax. This is true for at least for people living in US and Singapore. Singapore has quite low income tax and tax will not be withheld first when you get your pay check. Tax is much higher in US. Federal tax, state tax, property tax, social security tax, medicare tax should add up to more than 30 percent of salary. This year, April 11 is the official US tax freedom, which is the day Americans have finally earned enough money to pay off their total tax bill for the year. But......[阅读全文]

posted @ | Feedback (13) |

摘要:Several years ago, I wrote an article on how to capture a window into a bitmap using WM_PRINT message, even when the window does not handle WM_PRINT message or it's hidden from desktop. To me, the interesting part is hook BeginPaint and EndPaint to use the HDC passed to WM_PRINT using a few lines of assembly code. You can call it 偷梁换柱. It seems that the article is quite popular. You can find several links on the web. I received two more emails last week asking me how to use the code to capture window created by another process. One guy......[阅读全文]

posted @ | Feedback (13) |

摘要:程序义诊开张几天, 无人问津. 终于邻国 Koye Li 送来了第一笔生意. 感激不尽. Koye Li's email and program fit perfectly to my submission requirement. The code is quite well written, but I still need to find problems as I promised to. So you can say it's 鸡蛋里挑骨头. Email from Koye Li Attached is a simple CSV parser class that I wrote for work a few days ago.  The problem that I had to deal with was to read in a simple CVS formatted file and then using those data and convert it to a special file format. Here's a simple explanation of my work, a line of input for the......[阅读全文]

posted @ | Feedback (24) | Filed Under [ 程序义诊 ]

摘要:清明不知不觉的到了, 万物更新. 园子里的花开了不少, 特别是几棵樱桃和去年买的乔玉兰 (Magnolia Soulangeana 木兰属). 又到了种菜的时侯了. 今年种了青菜, 四季豆, 番茄, 黄瓜, 草梅, 甜玉米, 芦笋. 两个月后才知道结果如何. 天气暖和了, 又可以骑自行车上班了. 另一个重要的改变是我换到二号楼, 办公室可以看到 Lake Bill. 想看看 Lake Bill 和我的菜地? http://blog.joycode.com/fyuan/gallery/742.aspx?...[阅读全文]

posted @ | Feedback (15) | Filed Under [ 不务正业 ]

摘要:Write programs is easy, write good, production quality code is hard. Two years ago, I gave my son, then 12, a C++ programming text book. He started to type in "#include ... main() ..." after a while. He can certain programs, but you would not expect him to write good code. It's like playing Weiqi(Go). It's so easy to put stones on the grids. Total amature and professional may put stones are the same place from time to time. But the amount of thinking and the degree of certainty is totally different between the two. At Microsoft, every line of production code......[阅读全文]

posted @ | Feedback (45) | Filed Under [ 程序义诊 ]

摘要:In an internal email, someone wrote malloc(width * height * sizeof(int)) to allocate an integer matrix of width x height. If you think carefully about this simple line of code, it's potentially dangerous. Suppose you're providing a webpage which allows user to enter a matrix and then perform some compliated calculation. The matrix is entered as: width height a00 a01 a02 ... a10 a11 a12 .... If someone enters width = 32769 and height 32768, malloc(width * height * sizeof(int)) will allocate 32769 x 32768 * 4 bytes of memory. This value is is 32768 * 4 = 128 kb in 32-bit......[阅读全文]

posted @ | Feedback (5) | Filed Under [ 小题大做 ]