Category: Development

  • Perl Redirect Command Output

    In Perl, you can execute external commands using system() or “. However, system and “ does not redirect command output to console and this results people who runs your perl script can’t see it. This also make debug much harder. Perl does not have a build in switch that equals to batch scripts’ “@echo on”,…

  • How to Validate URL in C#

    I searched google for how to validate URL in C# and most results say using a regular expression. Eventually I found Uri.TryCreate which is a built in method in C# to check if a string is a valid URL Uri uri = null; if (!Uri.TryCreate(url, UriKind.Absolute, out uri) || null == uri) {     //Invalid…

  • SpellChecker in WPF4 TextBox

    TextBox and RichTextBox in WPF4 has the built in SpellChecker functionality. It’s currently available in following four languages #LID 1033 – English #LID 3082 – Spanish #LID 1031 – German #LID 1036 – French Enable SpellChecker functionality on TextBox or RichTextBox is as easy as just setting SpellCheck.IsEnabled to True on the controls. <TextBox SpellCheck.IsEnabled=”True”…

  • CopySourceAsHtml for Visual Studio 2010

    CopySourceAsHtml is an add-in for Microsoft Visual Studio 2008 that allows you be able to quickly get your code as HTML from Visual Studio, just like being able to save it as a HTML file from the Save As dialog. It’s very helpful if you frequently post code to blog or send code in email.…

  • Use coalescing operator to write more readable code

    Tired of code like this? public string Foo { get { return foo; } set { if (value == null) value = String.Empty; foo = value; } } public string Bar { get { return bar; } set { if (value == null) value = String.Empty; bar = value; } } Use coalescing operator to…

  • Access denied when creating a folder just deleted

    I have a batch script which remove a folder and re-create it. The command that remove a folder is rd /s/q and the command create folder is mkdir. Recently I see something weird happening, everytime when the folder is deleted and re-created, there is error message Access is denied displayed. However, if I rerun the…

  • GhostDoc Tutorial

    Earlier I have introduced this excellent comment auto generation tool – GhostDoc. Now you can follow this instructions to get GhostDoc working in just 5 minutes. Download GhostDoc and install GhostDoc is a Visual Studio plugin, so after Visual Studio is launched, you’d need to assign a hotkey for automatic comments generation, or just  click…

  • Final Visual Studio 2010 available for download

    Visual Studio 2010, the best version of Visual Studio ever, is now available for download in Microsoft download center. The build number for RTM VS2010 and CLR4 is 4.0.30319.1. Here is link for free trial Visual Studio 2010 Professional Visual Studio 2010 Ultimate Training Resources Visual Studio 2010 and .NET Framework 4 Training Kit Visual…

  • MSI and WIX How to Tutorials

    WiX tutorial http://www.tramontana.co.hu/wix/ Introducing WiX http://www.ondotnet.com/pub/a/dotnet/2004/04/19/wix.html WiX Tutorial – Steps to Create an Installer MSI with WiX http://www.dalun.com/wix/01.09.2005.htm Windows Installer Guide from Microsoft MSDN http://msdn.microsoft.com/library/en-us/msi/setup/windows_installer_guide.asp General WiX Documentation and Help Windows Installer XML (WiX) v3.0 Help http://wix.sourceforge.net/manual-wix3/main.htm WiXUI dialog library guide http://wix.sourceforge.net/manual-wix2/WixUI_dialog_library.htm

  • Find Dead Code

    Dead code means block of code that is not reachable in application. They can cause noisy in code debugging and confuse developers. Sometimes I might spend a few hours to figure out why a breakpoint never hit. Most of code defect is result of old function no longer used and referenced. Remove them will prevent…