Thursday, October 30, 2008

New Dell Laptop XPS M1730

Last week, I bought a Dell Laptop for my road clients. It's an XPS Model 1730 with a whopping 17" screen. I always buy my Dell stuff in the outlet store and this laptop was refurbished. It boasts a dual core 2.8 Ghz Intel CPU, 4 GB Memory and came with Vista Ultimate. I paid around $2k for the system. So far I like it very much, the bootup is very fast and all of my development software installed very nicely. It has one of those fancy new 128 MB solid state drives that the operating system resides on and I guess that's why bootup is so fast. I also have a 360GB standard Seagate drive that I purchased at tiger direct for around $80. I like the screen size very much. This is NOT a good laptop for portability since it weighs a lot and requires a mammoth sized power supply that is about 8 x 4 x 2 inches. It's great for me because I frequently need the power of a desktop without lugging a desktop around in my car. If you are working on a plane or while riding the bus, this probably would not be a good choice. The power drain on the batteries is about 1 hour, perhaps one could get it to two hours by adjusting the power settings. If you require a more portable model, the XPS 15" models are just about the same as this 17" model in power and features, but much more portable and the batteries last longer. My son, Erik, uses a Dell XPS 15 while in college and likes it very much.

Thursday, October 16, 2008

CodeSmith Review

Most of my coding happens to be repetitive. Therefore I'm always thinking there's got a be a way to generate the similar code and rename the classes and various attributes. While I was on David Hayden's site http://www.davidhayden.com/, I saw an ad for Codesmith. After reviewing the features and asking a few folks in the IT world what they thought about it, I decided to give it a try. Instantly I fell in love with it because of it's ease of use and I was instantly productive straight out of the box! Here's some things I was able to do:
Generate Code based on database schema - using included examples
Port my own code into a template for re-use
Generate both VB and C# Code

The possibilities are endless, you can create libraries of code you are confident works and you wish to reuse over and over. There's a handy properties pane similar to the one in Visual Studio that you can use to change the custom properties you define in the template file. Once the template file is written, all that's required is setting a few properties in the properties pane and generating the code.

There's a few videos to help you get started on the Codesmith website http://www.codesmithtools.com/ . I highly recommend the product if you find yourself writing similar code all day. Hey, you can do a days work in 5 minutes once the template is in place! Look good all day while hardly breaking a sweat. It is a bit pricey for those, like me that are buying this themselves for around $400, but worth it in time savings.

Wednesday, October 15, 2008

Seagate 1.5 TB Drive

Yesterday, I received a new Seagate Barracuda 7200.11 1.5TB Hard Drive ST31500341AS - Serial ATA 7200/32MB/SATA-3G. I run a Vista Machine with Dual AMD 3GHZ Processors and ran into problems when creating the partition for this drive. It takes a long time to format/partition the drive, I guess, due to it's size. When the format reached format: 73%, it just hung there all night. I googled on this and found one other person had this problem and it was resolved by enabling the second SATA controller. I don't have a second SATA controller so I ended up formatting it on another machine via a SATA drive enclosure using USB 2. Not quite the resolution I was looking for, but it worked ok. I still would hate to do this again but it worked. I guess sometimes it's whatever works. Why do I have such a large drive you ask? Well, I do a lot of data intensive programming and my 500GB drive is 2/3 full allready!

Saturday, October 11, 2008

SQLCE and ASP.NET

Sometimes it's difficult to decide which database to use for a particular application. I found myself in this dilemma when creating my website. Most of my website is not really data centric so I was thinking maybe using MySql since it's free, or perhaps Sql Server since I already have it installed on this machine. I decided to go with Sql Compact 3.5 since it's new and I wanted to see what was involved with getting it to work with LinQ. The first problem I ran into was creating the SQL Enitity classes with the Compact Edition. It's easy to create the entities with SQL Server 2008, which involves just going to the project and adding a LINQ to SQL Classes Template to your project and dragging over the tables, or whatever you need for you entity class. However, with SQL Compact, this doesn't work. You could create the entity class by hand, but that involves a lot of typing (no pun intended).

Here's how I solved the problem:

There's a command line tool in the Microsoft SDKs folder for creating entities for various databases called SQLMetal. It's in the folder: \Program Files\Microsoft SDKs\Windows\v6.0A\Bin\SqlMetal.exe

The use of the program is as follows:

SqlMetal.exe MyData.sdf /code:MyCode.cs

example: SqlMetal.exe northwind.sdf /code:northwind.cs

That solved the problem and created the Sql Compact 3.5 entity.

I created a batch file to make it easier (see below) :


@echo off
Set SQLMetalPath="C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin"
Set DBPath="C:\Users\Jonathan\Documents\Visual Studio 2008\WebSites\CSharpSolutions_8_2008\App_Data"
Set AppCodePath="C:\Users\Jonathan\Documents\Visual Studio 2008\WebSites\CSharpSolutions_8_2008\App_Code"

cd %DBPath%%SQLMetalPath%\SqlMetal.exe CSharpSol.sdf /code:%AppCodePath%\CSharpSol.cs



Here's problem #2 I had using SQL Compact 3.5 but the resolution came from Steve's site:

Force SQLCE to run under ASP.NET
Steve Lasker posted blog entry on how to use SQLCE under ASP.NET using the pre-release version of the SQLEV. Under SQLEV you set a flag that would tell the SQL Connection, “yes I know this isn’t supported, but let me do it anyway”:
AppDomain.CurrentDomain.SetData("SQLServerEverywhereUnderWebHosting", true)
As you can see the name of the product is right there in the key. Well they changed the name of the product and so they changed the name of the key. So, if you were using the beta for development and are now switching over to the release version of SQLCE , you will need to change the key:
AppDomain.CurrentDomain.SetData("SQLServerCompactEditionUnderWebHosting", true)
That should allow you to use the database under ASP.NET. Now you can revel in the fact that you are swimming in unsupported waters!

Note:
I placed the AppDomain.CurrentDomain.SetData("SQLServerCompactEditionUnderWebHosting", true) line of code in my default page's constructor in the code behind section:
Hope that helps