My Resume | Contact Me | RSS Feed | Follow Me on Twitter

Code Capers

The Ninja Coding Dojo
RSS Feed Twitter Email

Asus - Two Facing Linux Lovers

clock May 28, 2009 by author Michael Ceranski

If you ask me, the Asus Eee PC put netbooks on the map. For around $400 USD you can buy a fully functional laptop. One of the reasons that the Eee PC was so affordable was due to the fact that the netbooks were running Linux. Even though you could format the machine and run a Windows OS on it, the purchase price was kept low by supplying a free OS. Asus took the stance that the Xandros based distribution supplied with the Eee PC was stable, easy to use and customized to work with the hardware on the Eee PC.

Now it seems that Asus has changed their stance because they have launched a website with Microsoft called It's Better With Windows. The website describes how easy it is to use the Asus Eee PC with Windows. It states that you will not have to deal with an "unfamiliar environment" and "major compatibility issues". That is a strange comment when Asus claims that the Linux distro on the Eee PC was customized for that particular hardware.

The funniest part of the It's better with Windows campaign, is that the Eee PC really is not suited to run Windows Vista. Therefore most people are running Windows XP on their Eee PCs. Primarily, the reason people do not run Vista is because it is a memory hog and the Eee PC does not have a lot of horsepower in terms of memory and CPU. So I guess if your idea of compatibility is running a 8 year old OS then go right ahead. I suppose you could wait for Windows 7 to be released but who knows how stable that will be on the Eee PC hardware. 

Anyway, it is kind of disturbing that Asus jumped on the Microsoft bandwagon so quickly. I really hope that Asus will continue to allow people to choose which OS they want installed on their new PC. Furthermore, if you choose to use Linux then you should definitely get a lower price!



T-SQL Tip - UNION vs. UNION ALL

clock May 26, 2009 by author Michael Ceranski

The UNION and UNION ALL command look very similar but under the covers they do different things. The main difference between the two commands, is that UNION selects only distinct values, while UNION ALL selects all values (including duplicates).

Since the UNION statement eliminates all duplicate rows it does a SELECT DISTINCT on the result set. A SELECT DISTINCT is going to cause a table scan which can be a performance killer when you are dealing with large tables. If you know that all of the records returned from your queries are unique then use a UNION ALL instead. The UNION ALL should yield better results in terms of performance.

So now that you know the difference between the two statements you should be able to avoid future performance problems. Like G.I. Joe always said "KNOWING is half the battle".



Things I Bet You Didn't Know About Using The WaitCursor

clock May 21, 2009 by author Michael Ceranski

It is common for a developer to display a hour glass while their application is running a long operation. When running an application in Windows Vista the cursors typically look like this:

The Wait Cursor  The Default Cursor

In order to toggle the cursors, I typically will write a block of code that looks something like this:

   1:  this.Cursor = Cursors.WaitCursor;
   2:  try {
   3:    //Start long operation
   4:  }
   5:  finally { 
   6:     //use the finally block to guarantee that the cursor returns to normal
   7:     this.Cursor = Cursors.Default
   8:  }

To my surprise, this is not always the right technique. The problem with this approach is that it temporarily sets the WaitCursor, but does not guarantee that the WaitCursor will remain until the end of your operation. Why? Because other operations within your program can easily reset the cursor back to the Default cursor. Having the cursor flip back and forth is not only distracting but it also has the potential to make the user think that the operation has completed when in fact it is still running. So how do we avoid this? Well one way is the use the Form's UseWaitCursor property instead. Here is an example

   1:  this.UseWaitCursor = true;
   2:  try {
   3:    //Start long operation
   4:  }
   5:  finally { 
   6:     //use the finally block to guarantee that the cursor returns to normal
   7:     this.UseWaitCursor = false;
   8:  }

This method will display the WaitCursor for the specified form (referenced by the keyword this in the snippet above) or control and all its child controls until you set the UseWaitCursor back to false. If you have the situation where your operation blocks input not just to a single window but your entire application that you can use the Application.UseWaitCursor static property:

   1:  Application.UseWaitCursor = true;
   2:  try {
   3:    //Start long operation
   4:  }
   5:  finally { 
   6:     //use the finally block to guarantee that the cursor returns to normal
   7:     Application.UseWaitCursor = false;
   8:  }

By using the Application's UseWaitCursor property you will override any changes made to the cursor by a control of form. Therefore, guaranteeing that you have the right cursor displayed to the end user. Hopefully the next time you set the WaitCursor in your application you will remember these tips. After all, at the end of the day, user experience is the only thing that really matters.



Windows 7 - Introducing Windows XP Mode

clock May 19, 2009 by author Michael Ceranski

It seems like a lot of major corporations skipped the upgrade to Windows Vista. This was primarily due to the fact that a lot of their legacy apps did not play well with Vista. Microsoft has addressed this issue in Windows 7 by introducing XP Mode (XPM). XPM is a virtualization environment that will allow Windows 7 users to run legacy XP Apps with almost 100% compatibility. XPM is built on the next generation Virtual PC 7 product line, which requires processor-based virtualization on the underlying PC.

XP Mode requires a fully licensed copy of Windows XP SP3 which will be made available, for free, to users of Windows 7 Pro, Enterprise and Ultimate editions via a download from Microsoft's website. That's correct, you will not see a XP disk or license along with your Windows 7 Media, You will need to download them separately. XPM will not require you to run applications in a separate window or desktop like Virtual PC. Instead you will install applications inside the virtual XP environment. After installation you will end up with your standard start menu and desktop shortcuts to launch your applications.  When running the application the experience will be seamless and transparent, you will not even know that the application is being virtualized.

In conclusion, I think XPM will ease the pain for a lot of large corporations who want to upgrade but need to maintain compatibility with legacy applications. Of course, the only draw back is that you will have to make sure you have a processor equipped with hardware virtualization. This means big bucks for vendors like AMD and Intel. On a personal note, I will be upgrading my OS on the same day Windows 7 goes public. And this time I have some legitimate reasons to upgrade other than just wanting the latest eye candy.



Source Code and Live Demo of Frogger Clone Now Available

clock May 11, 2009 by author Michael Ceranski

I recently completed a series of articles on how to create a Frogger clone in Silverlight. Since the article was posted, I received quite a few emails from people requesting a copy of the source code. Therefore, I decided to post a modified version of the article along with source code on the codeproject.com. Also, if you have the SilverLight plug-in you can now play the game online!



About the author

MikeMy name is Michael Ceranski. I am a software developer from Buffalo NY. I have been writing code for over 10 years starting with Borland Delphi and later migrating to the .NET stack. I enjoy blogging about .NET, MVC and jQuery and I hope to spread my enthusiasm for technology by sharing my thoughts and ideas with you.

View my resume

Cumulus

This will be shown to users with no Flash or Javascript.

Sign in