this.Blog.Find(entry => entry.IsHelpful);
 Monday, May 12, 2008
Visual Studio 2008 and .Net 3.5 SP1 Beta Released

Microsoft announced today the release of the first public beta of Service Pack 1 for Visual Studio 2008 and the 3.5 version of the .Net framework.  Rather than an extended re-hash of what's included in the release, I'll defer to the experts:

Some of the highlights for me are:

  • Rails-like "Scaffolding" support via ASP.Net Dynamic Data (I need to play around with this and see if there's a need to get Miado to work with this)
  • ASP.Net AJAX script combining to reduce the number of requests to the server
  • ASP.Net AJAX back button support!
  • Improved Javascript intellisense and formatting
  • Support for ADO.Net Data Services (the project formerly known as Astoria), which aids in the creation of a data access layer using REST-ful web services

Since this is a *beta* version of a service pack, at this point I personally wouldn't install this in anything but a VM.


Kick it on DotNetKicks.com
Monday, May 12, 2008 4:45:45 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]  .Net | Visual Studio

 Friday, May 09, 2008
Best line on TV last night

From The Office (of course):

"Andy Bernard, Cornell '95"

I need to look for him at the next reunion...


Kick it on DotNetKicks.com
Thursday, May 08, 2008 11:21:04 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]  Cornell | Humor | TV

 Thursday, May 08, 2008
JavaFX announced (yet again) at this year's JavaOne

In a stunning move at this year's JavaOne conference, Sun announced the upcoming release of JavaFX, its framework for building Rich Internet Applications (RIAs).  Stunning, you see, because they announced the same thing at *last year's* JavaOne conference.

I read the headline and thought to myself, "Hmm ... this must be some mistake."  But, no, it was not.  Apparently, 2007 was *not* the year of Java on the desktop, and we are forced to endure Sun's desperation pleas of, "All is well!!!" for one more year.  Now, they enter an increasingly crowded field of RIA frameworks, with Flash firmly entrenched and Silverlight gaining momentum.

Java has never had a strong success story when it comes to building GUI applications, despite the ironic fact that the initial vision of Java was that its strength would be on the client-side due to its "write once, run anywhere" cross-platform JVM.  The thought being you could write one client application and distribute that application across Windows, Mac, Linux, etc...  Well, that vision has never materialized.  Swing applications were cumbersome, buggy, resource intensive, slow (with horrendous start-up times), and let's face it, just down right ugly.  Users wanted native-looking apps, and Swing was like a herd of pink flamingos poised conspicuously in the desktop front yard.

Swing has come a long way since its initial inception, but unfortunately for Sun, they haven't been able to shake users' initial perceptions.  In another ironic fact, perhaps the weaknesses of building rich UIs in Java led to its unbelievable success in the late 1990s/early 2000s as a server-side language and for developing web-based applications.  The browser turned out to be a better cross-platform GUI than Swing, plus it required no installation or deployment concerns.

Now, here we are in 2008, and Java is looking a little long in the tooth, even for building web-based applications.  Steve Jobs famously declared Java as being dead (i.e. your act is about as fresh as a Foghat concert) as his reasoning for not including it in the iPhone.  I wouldn't go that far.  Java is so entrenched (especially in Fortune 500 companies) that I'd venture to say that it's going to outlive me.  Ha!  Take that, Steve Jobs!  But as far as building next-generation UIs, as a developer I am left scratching my head as to why the world needs a Java-based RIA so late in the game when Java has never had success in that space in the first place.

Let's hope in 2009, the JavaOne crowd is not left asking, "Thank you, sir, may I have another?" as Sun announces, "JavaFX - this time we *really* mean it!".


Kick it on DotNetKicks.com
Thursday, May 08, 2008 9:36:44 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]  Conferences | Java | Silverlight

 Monday, May 05, 2008
Reason #134 as to why you need to be reading Wil Wheaton's blog

Wil Wheaton is fantastic.  This quote is from one of his recent posts questioning his own thoughts on JJ Abrams' promise to "re-invent" the Star Trek series with the new movie:

"Speaking as a lifelong geek, my knee-jerk reaction when I hear someone talking about 'reinventing' something like Trek is that it will be a tower of suck, built out of an endless supply of Jar-Jars and midichlorians."


Kick it on DotNetKicks.com
Monday, May 05, 2008 9:45:29 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]  Humor

 Saturday, May 03, 2008
Sort and Remove Unused Usings in Visual Studio 2008

When I first starting developing in .Net, I had been a Java programmer for many years.  I remember when I first started the transition, a long-time VB developer told me how much I was going to *love* Visual Studio.  It was as if programming Java in Eclipse was akin to living in the stone age and he had suddenly granted me the programming gift equivalent to fire.  "Here you go ... but use this power wisely.  With great power, comes great responsibility."  Hey, it's not like I was using vi on an terminal emulator!  (by the way, have you seen any old school guys program in vi (and still choose to do it)?  It's *scary* how fast they are.)

Anyway, it's 2004 and I start my era as a .Net developer using Visual Studio.  Dare I say, I actually begin to *miss* some things that were in Eclipse.

Example - In Java, you have "import" statements at the top of every class you write.  They are very similar to "using" declarations at the top of a C# class.  They basically tell the compiler what packages (i.e. namespaces in .Net) you need to compile the class.  Whereas in .Net you only can include an entire namespace, in Java you have the ability to import an entire package:

import java.util.*;

or individual classes within a package without having to import the entire package:

import java.util.Calendar;
import java.util.Date;
import java.util.List;

Flash back to circa 2002 or so.  I was working on a J2EE project with a team of developers.  Another developer and I were working on a couple of the same files.  After he checked a file in and I was going to work on it, I would do a diff on the file to see what he had changed.  I noticed every time he checked a file in, along with the changes he had made, he would rearrange the import statements.  Now, the usual ordering of imports in a java class are that all the java.* classes go first, then the javax.*, followed by any org.*, and finally your application classes last.  The project we were working on was for the state of Georgia, so some of our application packages started with gov.*.  Well, he would always move those imports above the java.* packages.  I would move them back to the bottom (where they actually belonged).  When he checked it back in, they would be right back at the top.  I thought to myself, "Man, this guy must be really anal to go through the effort of expanding out and ordering all the imports statements that way.  I wonder why."

One day I finally asked him about it.  "Why do you re-order the imports statements every time you check a file in and put the gov ones first?"  He looked at me with a puzzled look.  "Huh?"  Then he realized what was happening.  "Oh, I just hit Ctrl-Shift-O every time before I save a file to organize the imports."  And he showed it to me.  In Eclipse, you could use that keyboard shortcut (or access it through the menu) to automatically figure out your individual class imports and arrange them via a configuration of your choice (since he hadn't set up the gov ones in any order, it defaulted them to be first alphabetically).

Wow!  Pretty cool!  This was 6 years ago mind you.  So I got in the habit every time I saved a file: Ctrl-Shift-O, Ctrl-S ... Ctrl-Shift-O, Ctrl-S ... Ctrl-Shift-O, Ctrl-S.  I quickly became a "creature of habit".

Back to starting out in Visual Studio in 2004 ...  Let's see, I'd like to organize my using declarations.  Ok, Ctrl-Shift-O doesn't do that.  Hmm ... I wonder where that setting *is* in Visual Studio ...  Looks of looking, lots of googling ... Nothing.  Well, damn.  That kinda sucks.  You mean I actually have to manage this myself?!?!?  I think to myself, "Am I the only one out there who is wanting this sort of thing???"

Time passes, I am surviving by organizing my usings by hand (barely).  The more and more .Net blogs I read, I start hearing about people using and loving ReSharper.  Last year, after going solo and starting my own company, I finally decided to pull the trigger and buy myself a copy.  And boy, was I glad I did!  Along with a bunch of other great things, I notice that it let's you sort and remove unused usings.  "There it is, there it is!!!"  Ctrl-Alt-O!  Organize and remove usings!

Last year, Visual Studio 2008 comes out, but damn - ReSharper is not quite ready for it.  Well, work still needs to get done so I need to carry on, albeit without ReSharper for the time being.  I am playing around with Visual Studio 2008, and I notice a new menu option under Edit->Intellisense.  Whoa, what's this?  "Organize Usings".  I click on it, and lo and behold, there it is - three options: 1) Remove Unused Usings; 2) Sort Usings; 3) Remove and Sort.  Finally!!!

There is no native keyboard shortcut mapped to the "Remove and Sort".  Well, we can change that easily enough:

 

There, I've mapped Ctrl-Alt-O to Remove and Sort.  I'm back baby!  Ctrl-Alt-O, Ctrl-S!  Let's see it in action ...

Before:

And after:

The bottom line is - yes, Visual Studio is a great IDE.  But don't fool yourselves .Net developers.  Eclipse, IntelliJ, and even NetBeans (my preferred IDE for working in Ruby) are all very strong IDEs that in reality actually do some things (gasp!) *better* than Visual Studio.


Kick it on DotNetKicks.com
Saturday, May 03, 2008 2:52:09 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]  .Net | Eclipse | Java | ReSharper | Visual Studio

 Wednesday, April 30, 2008
Using Miado with Powershell

One of the nice things about Miado is that it wraps a lot of tedious, repetitive ADO.Net code and therefore greatly reduces the amount of code you actually do need to write. 

Here's a quick example.  One of the tasks I had to do at my last last gig was upload a set of prices from a CSV file every month.  I wrote a PowerShell script to use Miado to do the DB inserts:

  1. function BuildSql()   
  2. {   
  3.   # build the SQL   
  4.   $sb = New-Object System.Text.StringBuilder   
  5.   $sb.Append("insert into VendorPrice(VendorID, FixedPrice, VariablePrice, ");   
  6.   $sb.Append("CreationDate, LastUpdatedDate) ");   
  7.   $sb.Append("values(@VendorID, @FixedPrice, @VariablePrice, ");   
  8.   $sb.Append("current_timestamp, current_timestamp)");   
  9.     
  10.   return $sb.ToString();   
  11. }   
  12.   
  13. [Reflection.Assembly]::LoadFile("C:\dev\VS2008\Miado\src\Miado\bin\Release\Miado.dll")   
  14.   
  15. # setup the configuration   
  16. $connString = "Data Source=.\SQLEXPRESS;Initial Catalog=MyDatabase;User Id=user;Password=passw0rd"  
  17. $dbProvider = System.Data.SqlClient.SqlClientFactory::Instance;
  18. $repository = Miado.MiadoRepositoryFactory::CreateMiadoRepository($dbProvider, $connString);
  19.   
  20. $sql = BuildSql;   
  21.   
  22. foreach ( $row in Import-Csv prices.csv | Select VendorID, FixedPrice, VariablePrice )    
  23. {  
  24.   $repository.ExecuteNonQuery($sql.ToString(), $row.VendorID, $row.FixedPrice, $row.VariablePrice);     
  25. }  

As you can see, the script iterates over each row in the CSV file and inserts a record for each row.  There's no need to write all the code necessary to create the DbConnection and DbCommand objects, nor do you have to dynamically create DbParameter objects for each row.  Just pass the SQL and the variables (in order of replacement) into the IMiadoRepository.ExecuteNonQuery() call and Miado takes care of all the ugly details.  One line for each insert - that's it!

Edit: This post was updated to reflect the changes in the 0.7.10530.1


Kick it on DotNetKicks.com
Wednesday, April 30, 2008 11:38:38 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]  .Net | Miado | Powershell