Total Pageviews

Disclaimer

This is a personal web page. The views expressed on this blog are mine and do not necessarily reflect the views of my current employer.

I am currently employed by Morgan Stanley.

April 29, 2007

The Wallpaper for Mozilla Developer Center

I used to love the Firefox wallpapers. As a result, now I use this wallpaper.

http://developer.mozilla.org/en/docs/Promote_MDC

Yes, it is very nice. ''Please Don't Hurt The Web''.

Subversion Or CVS

In a latest blog I talked about using CVS with Visual Studio 2005. However, I soon changed my mind and turned to Subversion (SVN). Why?

In fact, I am not using Visual Studio that often. Since my project is WinForms based, SharpDevelop is a much faster and nicer IDE for coding. Although the debugger is ugly, most bugs can be detected easily actually, so Visual Studio is not touched that much. As a result, I don't want to do version control in Visual Studio, but in SD.

SD is shipped with a SVN addin, and there seems to be no CVS addin available. That is why I turn to SVN finally.

To add more comments, I'd like to say that CVS and SVN are generally similar. For my usage, they are nearly the same. I wish one day I could master either of them. From now on, I would surely spend more time on SVN.

April 28, 2007

Save CPU Utilization In An Empty Loop

Sometimes you need to kill some time by running an empty ''for'' or ''while'' loop. The only problem is that the CPU utilization will soon reach 100% for a single core CPU or 50% for a duel-core. Oh, my Goodness, it is horrible.

How to solve the problem and protect your/and your users' CPU? A simple walk around is there. Just write Thread.Sleep(??); inside the loop. In my case, I let it sleep for 500-ms. In this way, the utilization can be reduced to a quite small number.

April 27, 2007

Threading or Pause-Ready Backgroundworker

It is hard to make a Thread and control it well. However, using a Backgroundworker is much easier until you need to pause/resume it.

Can we make a Backgroundworker pause-ready? Yes. I have joined a discussion on the MSDN Forums. It seems that we approach to a solution finally. I have contributed the code samples. And in fact I have used the code in a big project. It runs just Okay.

Generally speaking, I will resort to Backgroundworker in the future.

Using CVS in Visual Studio 2005

I know SVN may take place of CVS some day, but now I guess it still works well. So this time I use CVSNT as my source control server. If you do not know how to get started, there is a short introduction on The Code Project.

I never know the plug-in mentioned in this article but it works fine. Wish you enjoy the ease of using a source control system as I do.

BTW, after all, commercial solutions such as StarTeam from Borland will reduce you much effort. If you can afford, give them a try.

(Updated: StudioTools 2 + TortoiseCVS is my solution at this moment which work out to be free and convenient.)

(Updated: Please consider distributed version control system, such as Mercurial/Git. Mercurial is more Windows friendly IMHO.)

April 24, 2007

Localization in .NET 2.0

It is easy to localize a .NET WinForms project in Visual Studio. However, something you should be careful with. An article should be your guide when you need to do some localization. That is Walkthrough: Localizing Windows Forms inside MSDN.

When you try to translate the WinFormStrings.resx, you will find .NET Language Localizator 2 for .NET 2 very helpful. After translating in it, you can rename the compiled resx to WinFormStrings.**.resx.

I have to confess it is still hard to localize a project even with the help of Visual Studio and .NET Language Localizator 2 for .NET 2. So, before any exercise, think twice.

And you see, that is why I hadn't localize CBC even though so many Chinese users asked me to.

WebBrowser Control and BMP Images

It is convenient to develop a WinForms application with a WebBrowser component because Word documents and other files can be opened in it. The only problem I found last week was that BMP files cannot be opened inside.

I guess the reason for that difference is that BMP is not a compressed format, which is not suitable for Internet usage. If it is the reason, then why Firefox supports BMP very well?

After all, when you want to Navigate() to a BMP file, stop. You should convert the image to GIF/JPEG/PNG format instead.

April 09, 2007

I Do Not Know What I Can Blog

I have to say that I do not know what I can blog and do at this moment. Yes, I do not want to break the rules. As a result, I will not continue CBC for a few months. Also I will write less blog entries. When I know what in fact I can do, I will go back to the old routine.

Stay tuned.

April 06, 2007

Life at SA

I am now blogging to say that I become a member of the Scientific Atlanda. I am working as a Software Engineer.

That's all for today. Let me say something more next week.