web 2.0

Kindle 2 Now Offers Native PDF Support

On twitter when you repeat someone's tweet they call it a re-tweet. When blogging I guess you would call it a re-blog? Anyway, I was reading my favorite blog this morning, Scott Hanselman's Computer Zen and I was ecstatic to see that they are upgrading the firmware on the Kindle 2. The new firmware will allow you to manually rotate the Kindle 2 screen, (previously a DX-only feature) as well as provide users with native PDF support. The Native PDF support is a huge feature for me. I tend to read a lot of tech books but I did not want to fork out the $500 dollars for a DX. For example, I always have the ASP.NET MVC 1.0 book handy because it is a great reference guide. Initially, I went through the trouble of converting it to Kindle format and quickly discovered that is was completely unreadable on the Kindle. Here is an example...

Converted PDF on firmware 2.0.3 Same PDF viewed with the Native PDF Viewer
 

As if the native PDF support wasn't enough, they also have improved the battery life on the Kindle by intelligently toggling off the 3G radio when it is not being used. You can now read for up to 1 week on a single charge with wireless on. Turn wireless off and read for up to 2 weeks.

Additional Resources:

Tags: ,

The HP Pavilion dv6t Quad Edition Laptop

For quite some time, I pondered getting a netbook. The small form factor and the immense battery life were very tempting to me. Not to mention that they are very affordable which would give me instant approval from the wife :-). The only thing that discouraged me was the small screen. As most developers know, screen real estate makes a big difference when it comes to development. 1024 x 768 is about as small as you want to go. When I saw some screenshots of an Eee PC running Visual Studio I quickly realized that it was not for me.

After reading many reviews, I decided that I needed at least a 15" display. I also decided that a widescreen display would be preferred. I also immediately eliminated any laptop that did not have at least a 7,200 RPM hard drive. On almost any system you buy these days the disk will be the bottleneck. Lets face it, memory is cheap and processors have shifted to the multi-core architecture. The only thing that really has stayed the same is the traditional hard disks. Of course SSD is on the rise but the price for a 500GB SSD hard drive would probably cost more than my entire laptop. Anyways, I can always replace the hard drive later on when the prices become a little more reasonable.

After days of reading reviews and much contemplation, I ended up buying a HP Pavilion dv6t Quad Edition Notebook. The laptop is an absolute power house. It features an Intel Core i7-720QM quad core processor, 6MB L2 Cache and a 1333MHZ FSB. It came stock with 4GB of RAM and is expandable to 8GB. I can run SQL Server and Visual Studio without even a hiccup. The machine is absolutely perfect for development. Here are the complete specs:

  • Genuine Windows 7 Home Premium 64-bit
  • Intel(R) Core(TM) i7-720QM Processor (1.6GHz, 6MB L2 Cache, 1333MHz FSB)
  • FREE Upgrade to 4GB DDR3 System Memory (2 Dimm) from 2GB DDR3 System Memory (2 Dimm)
  • FREE Upgrade to 500GB 7200RPM SATA Hard Drive from 320GB 7200RPM SATA Hard Drive
  • 1GB Nvidia GeForce GT 230M
  • 15.6" diagonal High Definition LED HP Brightview Widescreen Display (1366x768)
  • LightScribe SuperMulti 8X DVD+/-RW with Double Layer Support
  • Webcam + Fingerprint Reader
  • Intel Wireless-N Mini-card with Bluetooth
  • 6 Cell Lithium Ion Battery

  

The laptop came with Windows 7 x64 Home Premium. However, as soon as I got the laptop I immediately formatted the machine and upgraded to Windows 7 Ultimate Edition. Luckily, I have an MSDN subscription so I was able to save some money by doing the OS upgrade myself. Besides, I am not a big fan of all the "SPAM" that HP installs on a new laptop. I prefer to start fresh with a clean install. For those of you who are still using Vista or XP...I must say, Windows 7 rocks! I haven't been this happy with an operating system ever. It has been a while since Microsoft has delivered something this good. 

When friends come over I like to show off a little by pulling up task manager. When they see the 8 processor windows they are generally in awe. The reason you see 8 windows is because each core has 2 processing threads.The machine yields a Windows Experience Index of 5.9. For a laptop this is an outstanding score. Again, the bottleneck is the 7200 RPM disk.

From a construction standpoint the laptop is very well built. If you pick the laptop up from the corner you will feel no flex at all. The only downfall to the laptop would be that it has a slightly enlarged power supply and the battery life with the 6-cell battery will only buy you about 2 hours. I would recommend buying the 12-cell battery if you travel a lot.

When using the laptop I would recommend always placing it on a flat solid surface. The Core i7 processor tends to generate a fair amount of heat. Most of the heat seems to be dissipated from the back left bottom corner of the laptop. If you like to sit on the couch and use your laptop just make sure that you prop the laptop up so that back left bottom corner gets some air.

The normal price for this laptop is $1,399 when you build it on HP's website. However, I was fortunate enough to find $400 in stackable coupon codes. Overall, I am extremely happy with my choice. The laptop is very well built and the performance is beyond my expectations. If you are looking for a new development rig then I would highly recommend picking up a HP Pavilion dvt6.

Tags:

Metallica Concert Tonight!

UPDATE: The Metallica concert was awesome. My ears will be ringing for days. How do these musicians prevent themselves from going deaf?

I tend not to blog about non-tech stuff but today is an exception. Tonight, I am going to the Metallica concert at the HSBC arena in Buffalo NY. This will be my fourth time seeing Metallica and hopefully not the last!

I started listening to Metallica in high school. During those 4 years, I had a 30 minute walk and I needed something to kill the time. In the old days we did not have iPods, we had portable cassette players. In any case, I remember listening to the Master of Puppets cassette so many times that I actually wore out the tape. Eventually I repurchased all of my Metallica music on CDs and nowadays they reside on my IPod. There aren't too many bands that made the transition from my cassette player to my IPod. Metallica is definitely an icon and I will never get tired of listening to their music. I wonder if 30 years from now if Metallica will still be touring, it would be hard to play a guitar while holding a cane. The Rolling Stones seem to manage though....

Tags:

SQL 2008 - The Power of the MERGE Command

In my humble opinion, one of the best features of SQL 2008 is the MERGE command. In a nutshell, the MERGE statement allows you to insert, update, or delete data based on certain join conditions in a single statement. Traditionally this type of work was accomplished by creating a cursor, looping over each row and running some conditional logic to determine if you needed to insert, update or delete some rows.

If you view the syntax for the MERGE command with SQL books online you may be a little overwhelmed. The 100+ line syntax sample is not easy on the eyes. Therefore I was afraid that some people may be discouraged from using it, and I felt obligated to give an example that is a little easier to understand. First we will start by creating two tables and mocking up some data to test the MERGE command with:

   1:  CREATE Table Planets (
   2:      ID int not null,
   3:      Name varchar(25) not null,
   4:      Comments varchar(50) null
   5:  )
   6:  GO
   7:  CREATE Table MorePlanets (
   8:      ID int not null,
   9:      Name varchar(25) not null,
  10:      Comments varchar(50) null
  11:  )
  12:  GO
  13:  INSERT INTO Planets
  14:  VALUES 
  15:      (1, 'Mercury', 'Smallest planet in our solar system.'), 
  16:      (2, 'Venus', 'Named after the Roman goddess of love.'), 
  17:      (3, 'Earth', ''), 
  18:      (4, 'Mars', 'The red planet.' ),
  19:      (5, 'Jupiter', '' ),
  20:      (6, 'Saturn', 'Not the car company.' )
  21:  GO    
  22:  INSERT INTO MorePlanets
  23:  VALUES     
  24:      (3, 'Earth', 'All your base belong to us.'),     
  25:      (5, 'Jupiter', 'The largest plant in our solar system.' ),
  26:      (7, 'Uranus', 'I know what your thinking!' ),
  27:      (8, 'Neptune', 'The blue giant.' ),
  28:      (9, 'Pluto', 'Not Mickey''s dog' )
  29:      
  30:  select * from Planets
  31:  select * from MorePlanets

Note: In SQL 2008 we can also insert multiple values into a table with a single insert command!

You should end up with two tables, once called Planets and another named MorePlanets. If you observe the row data you will find that two records (Earth and Jupiter) exist in both tables.

There are also 3 additional records in the MorePlanets table that do not exist in the Planets table yet. The goal of our MERGE statement will be to update the name and description fields in the Planets table where the ID's match and to insert the records that have no corresponding ID:

   1:  MERGE Planets as target
   2:  USING( SELECT ID, Name, Comments FROM MorePlanets ) AS source
   3:  ON( target.ID = source.ID )
   4:  WHEN MATCHED THEN
   5:      UPDATE set target.Name = source.Name, target.Comments = source.Comments 
   6:  WHEN NOT MATCHED THEN
   7:      INSERT 
   8:          (ID, Name, Comments ) 
   9:      VALUES 
  10:          ( source.ID, source.Name, source.Comments );
  11:          
  12:  select * from Planets

Lets break down this sample MERGE statement line by line:

  • Line 1: We pick the Planets table as the merge target. This is where the merged results will end up
  • Line 2: We use a select statement as the source. In this example our tables have the exact same column names and data types so it makes things easy.
  • Line 3: We defined the matching criteria for the merge. In this case the IDs of the tables serve as the unique identifier.
  • Line 4-5: For each record in the MorePlanets table that has an ID that exists in the Planets table we will update the name and comments field.
  • Lines 6-10: For each record in the MorePlanets table that has an ID that does not exist in the Planets table we will insert a new row.

After we run the merge statement, here are the results:

Pretty cool eh? As you can see this command is very powerful. As a developer, I can think of a lot of uses for this command. Now that you understand the basic capabilities of the MERGE command spend some time reviewing Microsoft's examples. They show the advanced uses of the MERGE statement.

Tags: ,

DBA | SQL

MVC - Spark, The Alternative View Engine

UPDATE 1/8/2009 - Hmm...someone from Microsoft was paying attention to Spark..Maybe they read my blog?

Scott Hanselman chats with new Microsoft employee Louis Dejardin and ASP.NET team member about his open source ASP.NET MVC ViewEngine called "Spark." It's a totally new DSL (Domain Specific Language) that might make your MVC Views more fun to write!

Running time: 0h34m File size: 24.00MB

Download Original File | View original post


One thing I always disliked about ASP.NET was the amount of angle brackets (<%'s) that I had to sprinkle all over my HTML. Especially when you are dealing with if statements that conditionally modify the HTML output. Wouldn't it be nice if you could achieve the same results without all the angle brackets and percent signs?

Fortunately there are alternative View Engines out there. One alternative view engine that has been getting a lot of buzz in the MVC community lately is Spark. According to their website, Spark is a view engine for ASP.Net MVC and Castle Project MonoRail frameworks. The idea is to allow the html to dominate the flow and the code to fit seamlessly. If you take the time to look at their documentation page you will probably agree with me on the fact that they have achieved their initiative.

Here is a simple example of how Spark differs from a traditional ASP.NET markup syntax:

   1: <% var names="new [] {'alpha', 'beta', 'gamma'}" %>
   2:  <% foreach( var name in names ) { %>
   3:      <% if( name == "beta" ) { %>
   4:         <p>beta is my favorite</p>
   5:      <% } else { %>
   6:         <p><%=name%> is okay too I suppose.
   7:      <% } %>
   8:  <% } >

Now, Here is the same code written with Spark

   1:  <var names="new [] {'alpha', 'beta', 'gamma'}"/>
   2:  <for each="var name in names">
   3:    <test if="name == 'beta'">
   4:      <p>beta is my favorite.</p>
   5:      <else/>
   6:      <p>${name} is okay too I suppose. 
   7:    </test>
   8:  </for>

If you ask me, the developers who created Spark are definitely on to something here. Since we can use tags instead of angle brackets it is easier to write and maintain the HTML. Especially when it comes to situations where you have a if statement nested inside a for loop. The standard ASP.NET markup can make it hard to match up the beginning and ending brackets in nested code blocks.

For me personally, I tend to shy away from using third party tools unless it is absolutely necessary. There is nothing worse then writing a large application based on a third party solution only to find out that the project died, is no longer supported or riddled with bugs that will never be fixed. Therefore, you probably won't find me replacing the standard view engine in my MVC apps anytime soon. Don't get me wrong, I am not saying that the Spark project will die or that you should be discouraged from using it. I just want to warn you that there are advantages and disadvantages from swaying from the norm.

In a perfect world, an employee from the Microsoft ASP.NET team will look at the Spark view engine and have an epiphany. Then they will take some of that Spark goodness and integrate into their code base. Until then I will continue to deal with the angle brackets until I have a better reason to make the transition.