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.

January 28, 2008

GrapeVine Voice: Chinese New Year Present

I was planning to release 6.0 Final as a X'mas present. And then I delayed it as a new year present. However, even now I am not sure whether I can be on time to deliver it as a Chinese new year present because I am still not confident of the quality.

After listening to the podcast "The Register: Open Season", I suddenly found that if I released a poor quality 6.0 again, I would have done something wrong and hurt the open source movement. I don't care that much about my personal reputation because I am so young that I have a long path to pursue so as to build it up.

Stay tuned. I will try my best even though this time my time is so limited.

January 27, 2008

Building HTML Help on Windows

Microsoft released two versions of HTML help in order to replace its popular WinHelp format. And it seems Microsoft is so confident with these two new formats that it removes WinHelp support from Windows Vista (and possibly Windows Server 2008). Therefore right now if your application needs a help file, you should use either CHM or HTML Help 2 formats.

For .NET developers, compilers make documenting of assemblies (DLLs and EXEs) much easier. But how to get things done? I believe you want to know. I am now demonstrating how to set up the environment for generating CHM format help files.

1. Download the CHM compiler from here and install it.

2. Download Sandcastle from here and install it.

3. Download Sandcastle Help Builder from here and install it.

Now you have all the toolset ready. Begin to configure your project in Visual Studio.

xml

Open your project's Properties dialogue and switch to Build tab. Then you must check the XML documentation file box.

After building the project, you can see in the output folder a new XML file which contains XML comment extracted from your source code.

At last, launch Sandcastle Help File Builder GUI. You must learn how to create a new project in it because it is rather easy and I do not want to say more.

h

Press the compile button when you are done. Sandcastle compiler will start to finish those dirty tasks for you. If you meet no compile errors, congratulation! Your help file is ready.

You know I always hate to mention too many details because it is rather boring for me.

January 26, 2008

Dynamic C# Extensions Are Coming

DLR enables Python and Ruby on .NET platform. But the Java/Groovy issue comes again. Although IronPython and IronRuby can call C# code, the reverse is not possible now.

According to this post,  in the next version of Visual Studio (as well as .NET Framework) extensions of C# will enable better communication between C# and DLR.

I never used dynamic languages before, but I wish a dynamic C# can bring me joy because the current reflection is so complicated.

January 25, 2008

Product Review: MyColors Trial

Stardock Object Desktop is a collection of applications that beautifies your Windows experience. But not every bit of OD is a must. For example, a free set consisting of ObjectDock, CursorFX makes me happy enough.

Last week I decided to have a test on MyColors, a smaller feature set of OD which consists of basic functions from WindowBlinds, IconPackage, and DesktopX.

I have to say the effort is quite satisfactory, but it eats up nearly all the available memory (Update: this is simply because I am using Windows Vista Home Basic with 1G memory and normally Windows consumes over 800M of it). Therefore, finally I have to give up because I must do other things on my machine.

The only problem is that the designers of MyColors do not have chance to test on Simplified Chinese Windows so the fonts look not perfectly. Wish they could solve such kind of issues in the future.

January 20, 2008

GrapeVine Voice: Further Delay

Even though there are still ten days left in this month, I am not sure whether the CJF issue I posted can be fixed. So further delay of 6.0 Final release is quite likely to happen.

Stay tuned.

GPL 3 Adoption

Even though Linus denies to put Linux kernel under GPL 3, we continue to see other projects moving to GPL 3, a special upgrade of GPL 2 after Novell and Microsoft agreement. Two latest examples of such adoptions are EA's SimCity and Trolltech's Qt.

At last I remind you that Code Beautifier Collection is licensed under GPL 3 too.

January 19, 2008

GrapeVine Voice: Undocumented JCF Change

According to Anthony's notes, 2.34 of JCF introduces the following changes,

  • Compiled in Delphi 2007 using the latest version of JCL and JVCL
  • Generics are now supported: imported and passed all of TridenT's test cases for new syntax for generics.
  • The settings tree is now built in code rather than in the .dfm. this was apparently causing problems building the programs in Delphi 6 and 7.

I am so familiar with JCF that I can add one more change here,

  • -config switch cannot override registry key for the setting file.

How I found this? CBC relies on this switch to format Delphi source files by calling jcf.exe like this,

command

So when I got this error,

error

I knew my overridden trick failed.

Notice that the registry value for JCF setting file is out of date so should not be used by jcf.exe if I override by -config.

-config is not a documented command line parameter in the JCF Help file so I know one day Anthony might change the trick but I don't know it comes this soon.

I do send a message to Anthony. I will update GrapeVine when I get his reply.

Stay tuned.

(Update on Feb. 7th.:

this issue is resolved in SVN source code right now and the next release of JCF should contain this patch.)

January 18, 2008

Fancy Delphi Applications And More

I love Marco Cantu's Fun Side of Delphi and C++Builder series during several Borland Conferences and CodeRage conferences. And now About.com launches a new contest on fancy Delphi applications.

Suddenly a virus written in Delphi which damages millions of Windows systems here in China comes into my mind too. It was written by another guy comes from my home town, the city of Wuhan. The virus is documented as Worm.Nimaya, so you can do a Google search to get more information about it. Yes, Delphi is powerful enough to build really horrible virus!Vampire Bat

Please believe that you are only limited by your imagination no matter what programming languages you use.Nerd

Product Review: Unit Test As Specification

I am going to continue using NUnit, but have to say NSpec is wonderful because it makes writing unit tests more fun. Why should we call the items "Test Cases or [Test]" when they can be called nicely as "[Specification]"? Even though it is just a term change, it makes unit test more feasible to my dear managers who know nothing of modern programming.

Next time when you start to write one more unit test case, breathe, and tell yourself, "now I need one more specification for my application." In this way you may enjoy a nice day. At least that's how I spend this valuable Friday.Happy

Product Review: .NET Custom Search

I am now listening to an old Podcast session of Hanselminutes which is talking about Software Architecture. In that SearchDotNet.com was introduced as a customized Google Search for .NET only. So I soon made a search on it and found that "SNMP" is such a horrible keyword that nothing really valuable was listed there.

It is not a fault of SearchDotNet.com but Google.com. Because I have been talking about .NET and SNMP in a series of posts, why not put my links on top of the list?Big Grin

BTW, if you do not know Podcast, learn to use iTunes.

January 17, 2008

.NET Framework Source Code

Visual Studio 2008 Team finally offers you some .NET Framework source code under a special license term to enhance your debugging experience. So, try it if you are not going to contribute to Mono and if you have Visual Studio 2008 non-Express editions installed. Because the procedure is very complex, I can ensure I will never touch the source code. I don't want to bind myself to Microsoft's implementation of CLR at all until it is complete free (like Java VM).

Remember to check the license term before you touch the code.

January 14, 2008

Logon Studio Vista with SP1 RC

I have installed Vista SP1 RC. Even though no significant improvements I see, I think I should not remove it until SP1 RTM is released.

The only issue right now is that my Logon Studio Vista installation was broken by SP1 RC installer. Luckily to fix it, a reinstall is enough.

And now I switch to this NFS logon screen. Cool!

January 12, 2008

Boyzone Reunion Tour 2008

According to this message from Ronan Keating's website, one of my favourite boy band, Boyzone, is going to perform several concerts this year.

Hard to believe that seven years have passed and I still love their music. So I am no longer young, ain't I?

January 11, 2008

GrapeVine Voice: Broken RC 1011 Build

The installer of RC 1011 build is broken. A critical library called PSTaskDialog.dll is missing simply because I forgot to update Inno Setup script again. It is sad that I cannot find out how to ensure all required .NET libraries are there in the installer until the users get a runtime exception. This is a .NET limitation blamed by nearly every .NET developers (not a bug of Inno Setup).

I am going to release another RC this weekend - build 1012. The default start menu group name for GrapeVine would be changed to "Code Beautifier Collection 6" so as to work side by side with HardQuery installed on your machine. Stay tuned.

Restart Singleton Applications

When I talked about .NET internationalisation here I mentioned that the application should be restarted in order to change UI languages. But that code only works when your application allows multiple instances. If you use any technique to make it singleton (only one application instance in the memory), you find the code I provided failed to restart.

Why? Take a look at the original code I published in August,

private static void Restart()
{
    Process.Start(Application.ExecutablePath);
    Application.Exit();
}

Before the old instance exits, the new instance is already launched. So in the singleton case, no new instance is created and the old instance exits. Aha! You get nothing running.



A side note. You should avoid calling Application.Exit sometimes (especially in multi-threading cases). You may modify Restart to accept a main form reference. Closing the main form by calling Close usually meets your requirement.


Then, how to restart a singleton application? My solution is to bring in a restarter.exe helper executable which is a small and clean console program.



class Program
{
    public static void Main(string[] args)
    {
        if (args.Length != 1)
        {
            return;
        }
        string fileName = args[0];
        do 
        {
            Thread.Sleep(5000);
        } while (Process.GetProcessesByName(Path.GetFileNameWithoutExtension(fileName)).Length > 0);
        Process.Start(fileName);
    }
}
Restart function should be modified as

static void Restart()
{
    using (Process p = new Process())
    {
        p.StartInfo.FileName = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath),
                                        "restarter.exe");
        p.StartInfo.Arguments = "\"" + Application.ExecutablePath + "\"";
        p.StartInfo.CreateNoWindow = true;
        p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
        p.Start();
    }
    Application.Exit();
}
Simply place the restarter.exe in the same folder containing your application, and everything should be OK.

Funny Picture from Sara Ford

Sara's blog is quite fabulous, and the latest post contains a photo taken at CodeMash. While she sat behind the Microsoft table, you can see there was a CodeGear banner in the neighbour. Both of CodeGear and Microsoft are providing the best IDE products in the market and why cannot they be together?

January 09, 2008

Two Network Adapters Issues Resolution

If you have two network adapters (NICs) installed, there should be a few issues. At this moment, I have two installed. One of them connects me to the corporate intranet and the other connects to an internal router connected to a few SNMP enabled devices.

Because both adapters requires DHCP enabled, I can only access to intranet or the internal router one at a time. This limitation cannot be removed, because there should be only one default gateway.

My virtual machine based development environment makes it even worse.

  • I have my virtual disk on the storage server in the corporate intranet, so my host machine must be able to access the intranet (otherwise Virtual PC fails to load the virtual disk).
  • When I debug my applications inside the Virtual PC, the applications must be able to access the devices behind the internal router.

The only possible approach is to configure the host to use intranet gateway IP by default, and the guest to use the router IP as gateway.

How to achieve this? Modify your Windows routing table manually!

route -f
route -p ADD 0.0.0.0 MASK 0.0.0.0 <Gateway IP>

I wrote two batch files on the guest with different gateway IPs, so I can switch between them. the effect is that sometimes I only access the intranet from the guest while sometimes the internal network. On the host you can do similar batch files if necessary.


One more thing you should notice is that you might need to manually set the DNS server IP somewhere if errors occur. Good luck.

GrapeVine Voice: RC Download

The 6.0 RC (6.0.0.1011) is already here. There is not feature changes from M10.

January 08, 2008

GrapeVine Voice: Release Candidate (6.0.0.1011) Plan

I was about to release the 1011 build as Final, but due to the fact that it is still in bad need of further tests I decide to release it as a Release Candidate this evening. The code base was frozen last Sunday, and will only accept bug fixes in these two or three weeks.

I have to update the documents for the 6.0 Final so there are a lot of tasks ahead of me now. Nearly all pictures need to be updated while a few new sections should be added into Readme and Manual. So wish again that I could finish by the end of this month.

Stay tuned.

Firefox in Mozilla Labs

Today I finally remember to subscribe to RSS of Mozilla Lab. Have to say the posts are fancy. I love the Prism idea, but at this moment it does not run on Simplified Chinese Windows. I love the current Weave, but I cannot afford running Firefox 3.0 Beta (because I use so many add-ons). I wish I could see more wonderful posts from this source in 2008.

One more thing is that it seems that Firefox can be a RCP too just like Eclipse. So I start to wonder how a future Firefox browser looks like?

January 06, 2008

Product Review: First Look At PowerShell

Last Friday I needed to write a batch file that executes a command several times. I failed because I never fell in love with the syntax. As a guy who started to use PC in Windows 95 and to program in Delphi 7, I always find command lines hard to use and memorize.

But today, after trying PowerShell, I found it much easier to learn than cmd.exe. And writing a for loop is similar to C# language.

for ($i = 0; $ -lt 5; $i++)


{


  ping 127.0.0.1


}




But I still wonder why not create something like C# script?



(Updated: It is wonderful that I can do the old Command Prompt stuffs inside PowerShell 1.0. Thus I give up Command Prompt from now on.


Because there is a Command Prompt feature in CBC, I think I can enhance it on systems with PowerShell installed.)

Separate .NET 2.0/3.0 SP1 Installers

In the past few months, if you want .NET 2.0/3.0 SP1, the only installer is .NET 3.5 Framework installer. I believe that this is not feasible for everyone. And now at last Microsoft releases separate installers for them.

BTW, I found a Visual Studio 2005 Simplified Chinese installer issue. At first I only installed Visual C#. Then I installed .NET 3.5 which updated .NET 2.0 to SP1. Some day when I needed to install Visual C++ and J#, the installer cannot recognize .NET 2.0 SP1. Luckily it continued to install what I wanted for me without any big errors. So did Microsoft believe .NET 2.0 should never be patched after its release?Love Struck

January 03, 2008

Product Review: Free LINQ Book From MS Press

Introducing Microsoft LINQ is now a free e-Book available from MS Press. You can download it from here. Microsoft is promoting LINQ hard so as to make it even more popular.

If you have taken a look at CodeGear/Capable Enterprise Core Objects (ECO), you know that UML models + OCL is more abstract and flexible for larger projects, but LINQ is powerful enough for small projects.

I really like the book and LINQ, but the most critical issue that prevents me from using it in real projects is that LINQ requires .NET 3.5 Framework. This redistributable is huge (several hundreds of MB) so I doubt my clients were happy to install it. If Microsoft considers adding those bits to Windows Vista SP1 and Windows XP SP3, OK I will get addicted to LINQ Big Grinsoon.

GrapeVine Voice: NDepend Changes

"CQL constraints violations highlighted in report" was once a feature available in Trial/Academic/Open Source Edition of NDepend and now is no longer there. Thus, I have to manually check the CQL results in VisualNDepend. In this way I guess I could not finish GrapeVine Final by the end of January. Therefore, I freeze the code base today. I will continue to test all features by capturing pictures everywhere. In the last iteration I found this method more efficient than expected because I can both test the code and prepare the documents. I am not a skilled tester, so as usual I could only guarantee the common issues be caught in the act. 

Stay tuned.

January 01, 2008

GrapeVine Voice: Pass FxCop And NDepend

Why I did not release GrapeVine 6.0 yet? I thought I'd better review the source code carefully so FxCop and NDepend were used to analyse the code base.

As expected there were a lot of critical issues in the reports. So I planed to spend the last few weeks fixing most of them.

If you know FxCop, you must notice FxCop 1.36 Beta 2 is a significant improved version. Not only does it make use of multi-threading carefully, but it has more rules included as well. What's more? Every rules has a detailed description available online. Wish the team can further improve the descriptions and samples because I found items like this (I cannot find the corrected code so have to navigate elsewhere) are not fully/well  documented.

Today I have fixed most FxCop reported issues. From tomorrow on, I shall start to fix NDepend issues. So if everything goes fine, the Final will be released in January.

Stay tuned.

BTW, if you are developing a .NET application, FxCop and NDepend verifications should be done periodically so as to keep common coding issues away.

UAC Off On Applications

I love UAC. If you find it boring, I guess you never use Ubuntu, a popular Linux distribution before. At last Windows Vista learns something from other more secure operating systems.

But it is rather boring if some applications need elevations all the times. And this morning when I read a post on Wintellog I saw a workaround.

Yes, now I can add eMule and Workrave to the list. Nerd

(Update: Workrave nightly builds are already supporting Vista better so this workaround is no longer necessary. Thanks, Otto.)