Monday, January 08, 2007

Google Calculator

www.google.com has become more then just a search engine. It is a phone book, it looks up local movies, it looks up stock quotes, it can tell you the weather, and more. One thing that I thought was interesting was that it can be used as a calculator and can perform conversions between different units.

Example
- 1 + 1 in hex
- 10 + 10 in roman numerals
- 1 metric ton in ton
- 5 cubits in feet
- 20 degrees Celsius in Fahrenheit
- 30 degrees C in F
- 6 fortnights
- 6 fortnights in weeks
- pi + 10 / 2
- 100 miles in kilometers
- 0b1100101*0b1001 (Binary math)
- 0x7f + 0x7f (Hexadecimal math)

I can't seem to find a full list of valid units, but it does seem to support quite a lot.

Also, google has patent searches (http://www.google.com/patents), source code searches (http://www.google.com/codesearch), and blog searches (http://blogsearch.google.com/).

Thursday, November 16, 2006

Zune XP Theme

Yes, a free XP theme from Microsoft (and it’s not blue).


You can download it from here. Or, you can download it from the Zune website.

Thursday, September 07, 2006

Happy Birthday Google

Google turns 8 (not seven as previously posted) today. Google's official birthday is September 7, 1998. Unfortunately, the folks at Google did not make their usual birthday doodle this year, so we had to take matters into our own hands...
You can read about Google's history here. And, if you are looking for the September 7 date, you will just have to google for it.

Monday, August 07, 2006

Maintainable Software

In looking at some code today, I was reminded of Billy Hollis’s 2005 Grok Talk. If you haven’t seen it (or want to see it again) it can be found on Google Videos here.

I think the real point is that building maintainable systems is more important then just cranking out reams of code. Software spends most of its life in the maintenance phase and not in the creation phase. This is a very important lesson for developers to learn. Although it is not easy to do, there must be a conscious effort to build maintainable software.

Some things that I have found:
- Inheritance can be very useful when you are trying to create things quickly, however inheritance can be very difficult to maintain. Form inheritance is one of those things that can make development very fast, however will ultimately make it very difficult for someone else to maintain. I am talking about the case where you have a base form that tries to do some logic and then you inherit off of it and try to extend it in a way to add or change the logic.
- Another thing to think about is how many classes you have to touch in order to add a new field. You should try to keep the number of classes as low as possible. Try to separate your objects so that they don’t rely heavily on each other. Adding a new field is one of the most common ways software is grown.
- Something else that should be obvious is that less code is better and the more straight-forward your code is, the easier it will be to maintain. Of course that is easier said then done. But none the less, it is something to strive for.

Monday, July 17, 2006

Windows PowerShell

I downloaded the (CRT) version of Windows PowerShell (formerly known as Monad). I wanted to see how easy it would be to create a command off of an assembly. The idea of writing a library that can be used in a WinForm application, web page (on the server side), and now from the command-line is very exciting. I find batch files and script files very useful. There are times you need to perform a simple task and it is just easier to write a simple script file and run it from the command-line. It would be nice if you could develop applications and expose the same functionality in your application via command-line commands. Although PowerShell does have the ability to “new” any .Net object and perform operations on it just as easily as you would a COM object in VBScript, it also has the ability to load custom Cmdlets. A Cmdlet is a command-line command that for the most part is very similar to an old DOS command. Microsoft has added this concept of verb dash noun (example get-command or get-process) as a naming convention, but other then that it still accepts arguments in pretty much the same way as a regular DOS command (example "get-command *PSSnapin*" or "get-command –verb “get”"). A Cmdlet lives as a first class citizen in the PowerShell world and Microsoft has made it fairly easy to create new ones. When you install Windows PowerShell you will get the System.Management.Automation.dll that will hold the classes that you will need to inherit from when you create your own Cmdlet. It should be noted that your Cmdlet lives in an object called a PSSnapin that descends from Installer. The Installer is used by InstallUtil.EXE to install your assembly and PSSnapin into Windows PowerShell. However, even though it is installed you must call Add-PSSnapin followed by the name of your PSSnapin (the name that is defined in the Name property not the name of the DLL) before you will be able to use your new Cmdlets in Windows PowerShell. One thing to remember when you are creating a core DLL, a command-line object is a little different then objects that you would use in a WinForm application. The command-line is a different environment. It is transaction based while WinForm applications are primarily event driven. You should expect that if you want to have a DLL that will be used by both a WinForm application and a Windows PowerShell Cmdlet that you will have to design it in a way that would make it useful for the two environments. There is a pretty good article on creating Cmdlets on CodeProject. This is a good place to start if you want to write your own Cmdlet. I do like the way that command-line flags and parameters are easily defined by just adding attributes to properties. This really simplifies development (no more reading the args parameter in the traditional static main method). Microsoft has done a really good job of handling this. After working with this for awhile you will wonder how we ever programmed command-line applications before Windows PowerShell. I also like the way that Cmdlets are executed. You override the BeginProcessing, ProcessRecord, EndProcessing and then you can use the WriteObject, WriteError, WriteWarning, WriteVerbose and WriteDebug to send different levels of information to the console that is controlled by standard flags that all Cmdlet have. It is exciting to see a more powerful command-line shell and I look forward to the official release.

By the way, if you want to create and launch a WinForm from Windows PowerShell, enter the following at the command-line:

[reflection.assembly]::LoadWithPartialName("System.Windows.Forms")
$form = new-object system.windows.forms.form
$form.text="HELLO WORLD"
$form.showDialog();

Tuesday, July 04, 2006

New Microsoft Keyboard

Yes, a Microsoft green button and and a Microsoft blue logo.