Saturday, January 23, 2010

.Net Reflector

.Net Reflector is a must-have tool for .Net developers. Last year I updated my Visual Studio at work to 2008. However, I forgot to add this tool. When I started to work on a project based on MEF(Managed Extensibility Framework) as DI (dependency injection), this reminded me about the tool. I need this tool to browse the class structure of Microsoft.ComponentModel.Composition.dll.

The tool was developed by Lutz Roeder. In his blog, he said that now it is transfered to Red Gate Software. I think I used the SQL Compare application from this company. Anyway, .Net Reflector is a Windows based application, and it is very easy to install as a tool in VS 2008. From the menu Tools->External Tools..., it can be added there. Here is a snapshot of the installation:

There are also many Add-Ins for this tool.


Sunday, January 17, 2010


Based on Wikipedia explanation, the team "cheatsheet" is a concise set of notes used for quick reference. "Cheat sheet" may also be rendered "cheatsheet". Here are some cheatsheets I found from Google search:

  1. contains all popular cheatsheets in one web site.
  2. HTML cheatsheet is good, but I prefer w3school tutorials, including HTML references.
  3. CSS Cheat Sheet contains concise information about CSS styles.
  4. Google search cheat sheet contains some important tools and tips to enhance search.
  5. Here is one simple VIM cheatsheet, Graphical Vi-vim Cheat Sheet for keyboard mappings, vim command cheatsheet, vim basic and advanced cheatsheets.
  6. .Net RegExp cheatsheet.


Saturday, January 09, 2010

VIM Tips: Edit HTML Table from Web

I like to explore and learn new things. It is a life time learning experience. For example, I like to use VIM to edit my text files. There are so many great and powerful features in VIM. What I know is just very tiny tip of the iceberg. There are so much to learn, and I really enjoy learning VIM.

Here is my blog story. I occasionally need to copy and paste some HTML table data from web to my blog. One case was the technical specifications of an Epson printer I purchased from Futureshop. Futureshop's on-line web page lists its tech-features on its page. This printer is the current model today, but it will be out very soon. The web information will be gone. As a record or reminder for myself, I wrote a blog with all those features there. What I did first was to copy the HTML table from Futureshop's web site. The problem is that there are some other un-wanted tags in the block such as javascript functions as links and too many spaces and enter keys. The Blogger's web based editor is not a truly HTML editor. It convers, for example, enter keys (white spaces) to line break tags. I would like to remove them.

Hence, I need VIM to help me. Here is the summary of VIM search and replace commands I used:

:%s/\s\{2,}/ /g   # white space > 2 replaced by one space
:%s/\t\+//g # tab > 0 replaced by nothing
:%s/\s\n/\r/g # white space + newline replaced by new line
:%s/\n\s/\r/g # new line + white space replaced by new line
:%s/\n\{2,}/\r/g # new line > 2 replaced by new line
:%s/a_\{-}\/a>//g # replace <a...>..</a> with nothing
:%s/\n//g # replace all the new lines with nothing

Notice that the line breaks in search is \n, where the line break in replacement is \r. {n,m} is used for a count range from n to m, and m is optional. Another very useful key in search is _\{-}xxx, _\{-} is a special keys to none-greedy search. Normally . matches to any char, but with _\{-} will search for any char including new line but not the chars afterwords. Here I search for "<a" with any chars until ">". By the way, .\ is for any char but not including new line.

Before I remove all the new lines (combine lines to one line), for the case of Table, I'll add the following column groups to set up width of columns. Here is an example of two columns:

<colgroup width="10%"></colgroup>
<colgroup width="90%"></colgroup>

In order to display rows in alternative colours, I have added three css classes in my Bloger HTML settings: header, odd and even. I have to manually add those classes to each row like <th class="header"> and <tr class="odd"> or <tr class="even">.

Finally I remove all the new lines in the table so that this block of table in HTML is ready for my blog.

With VIM those powerful features, it makes my blog writing much easier, especially in the case I need to copy and paste some HTML from other web pages.


Saturday, January 02, 2010

Notification Application: Growl

toolsI have used Growl, notification application, on my Mac for quite long time. It was recommended as one of must-have applications. Growl is a Growl Notification Protocol (GNTP) based messaging application, which displays any messages from other applications. Growl is an open source based project and it is free.

Recently, I have been working on a project to backup SQL server databases, history data files based on SCADA field sites, and other important files from various Windows based PC to a central place. The file transfers are running daily. When the project was close to final stage, I had to check backups and files every day to the central PC. It was very tedious. Growl comes to my mind. If there is any way I can use Growl in Windows. Quickly I found Growl for Windows.

I immediately downloaded the application and give it a try. I was worried about network firewalls and our internal security policies. To my surprise, Growl works like a charm without any issues. I used to send out notifications from a remote PC, another client PC with Growl installed receives the messages.

There are some settings to do, but it is very straightforward. First, the network notification has to be enabled. Then I set up password for a receiver as security gate to verify any notification request. I think the password is optional but I like it. This will prevent any other network GNTP based services to send notifications unless password is verified.

It looks like that Growl for Mac and Growl for Windows are two different teams. The application appearances of both are almost the same, but there are some differences in features. For example, Growl for Windows has History setting, but for Mac. I like this feature. Since notification is displayed once with a quick time span, users may miss some important ones. With History, at least users can review all the past messages. For example, I set up the notification service on the central PC right after the jobs are finished, when is about 2:00AM. Nobody will be able to see them. Off couse, I could use Sticky feature to make the notification displayed until they are clicked. However, Growl for Windows seems have problem to display the message. One user told me that his notification window was black when he logged in a morning.

Mac Growl has more style than Windows Growl. I could not find some styles I use in Mac in Windows. I don't know why the styles cannot be ported to Windows. That's not a big deal.

In general Growl is a really good tool to send notifications between applications. My team likes this tool to make health monitor check much easy. The only concern is the stability of OS. Mac OS is much beter in this respect than Windows. I told my colloquies that I normally reboot my work Windows on daily base.