Skip to main content

Posts

Showing posts from 2007

ExcelPackage

I've been reviewing the ExcelPackage project on CodePlex. It is a useful project but one thing I was wondering is why does it directly interact with the XML? I think it is a performance and a code maintenance hit to work directly with the XML for the workbook and worksheets. In my oh so humble opinion I think it would be easier to create plain old C# objects to work with the cells, rows, sheets, etc. and then serialize and de-serialize as needed. I say this because in the XML for a worksheet the cells are stored in XML nodes that have the row number and individual cell addresses in them: [xml] [/xml] So if we work directly with the XML what has to happen when we insert a row? We have to loop through all of the XML nodes and update the row values. Note that I am not even talking about how to deal with merge cells or ranges (which the ExcelPackage does not work with). I think that creating a Attribute-value system would be a better approach. Rows and Columns could be a linked

EntLib Data Access Block and Excel

I need to be able to open an Excel workbook and grab the data from one of the worksheets. I don't want to use any Office InterOperability (as that sucks) and I know I can do it using ADO.Net. But since 1.) I hate writing all of that DataAdapter / Connection code because 2.) I am lazy I decided to see how hard it would be to use the EntLib DAB. Turned out it was pretty easy. Create your configuration as such: Then call your code as such: [csharp] public static DataSet GetWorksheet() { string sql = "SELECT * FROM [Sheet1$]"; string connectionName = "Book1"; return DatabaseFactory.CreateDatabase(connectionName) .ExecuteDataSet(CommandType.Text, sql); } [/csharp] And that is that. One DataSet ready to go.

Crappy Apps

Why is it that so many crappy apps are out there in the wild? Is it because of the visual tools available in the .Net realm that generate so much crap that the average programmer just does not have time to clean it up? Or are the developers just too lazy to clean up the mess as they go?

CueCat vs the USB Keyboard

Ages ago I picked up one of the RadioShacks CueCats but I never used it.  Up until today it sat in a box of computer junk having survived several purges.  You know Purges:  You have so much junk you have to get ride of the old. I never got ride of the CueCat because barcode scanners are not cheap, which I do not understand. Any way, I came across Scott Hanselman's article on a .Net app for the CueCat, Coding4Fun Hardware Boneyard - Using the CueCat with .NET , and decided to break out the old dusty cat and give it a spin. The code was no problem, getting my machine to read the CueCat was.  See, I have a Logitech wireless keyborard and mouse so Windows XPdid not load the PS/2 drivers.  I wound up having to dig up an old PS/2 keyboard (from the same junk box, you should always have PS/2 keyboard and mouse handy!) plugged it in, rebooted and vola, it worked. Now I am off to inventory my CD collection.  And my books.  Maybe the comic books.  If I do the pantry my wife my smack me..

Chevy Vega vs. TestDriven.Net

My Dad originally made a living as an auto machinic and working on cars is still his favorite pass time. Besides working on cars my Dad liked to swap cars. Swap cars, car parts, you name it he would swap it. The benefit of that to me was that I was exposed (read - drove) to a lot of different cars, some clunkers some not. One of the cars he swapped for was a Chevy Vega with a 327 small block V8 in it. That little car was freaking FAST and I am surprised that he actually let me drive it at all. I recall that I broke at least three speed-odometers just from peeling out. Now Chevy did not make a stock Vega with such a powerful motor. No, someone got the bright idea to take out the crappy four banger that was in it and replace it with a 327 small block V8 with a 3/4 inch racing cam and a Herts speed shifter. They even had to take out the cross bar member on the front end so that the motor would fit in the tiny Vega, which made the tires sit funny when it was parked. And you know we

Learning TypeMock.Net

We need to implement a better unit testing strategy at work but unfortunately we have code that is not written to be unit tested. Our unit test rely on the state of our database and this has caused so many issues that I'm hesitant to even run them. To fix the issue I have started working with TypeMock.Net an AOP mocking tool.  TypeMock will intercept calls to objects that are called by the code you are testing without actually creating or executing the object.  I'm still fuzzy on the details but I plan on using this tool to help me test some pretty untestable code.

Scratch Programming

I have started doing more scratch programming, one off little bits of code that I use and throw away. I found that I am not coding as much at work as I need to be, or want to be for that matter. I am loosing my touch. Like any thing else, if you don't use it you loose it. When I create projects I like to follow a specific file structure. Nothing fancy, I use a solution folder with folders for lib, src and tests. So when I create my scratch solutions I want to create the same folder structure, but there is no easy way to do it with Visual Studio. I tried to create a project template, which would work if what I wanted was skeleton projects. But what I want are skeleton folders and the VS templates won't create those. What I wound up doing was create an MSI using NSIS that would create the folder structure and copy core libraries that I like to use. So far it is working out pretty good and was surprisingly simple to create, not by hand of course but with HM NIS Edit, a fre

The Pruitt's

David Hayden [MVP C#] : Validation Application Block - Integrating It Into Your Business Layer

Now that we have this cool Validation Application Block we want to use it with all our business objects. This should immediately send up a red flag that there will probably be some common functionality among all these business objects in how they use the Validation Application Block. Hence some type of layer supertype ( business base class ) will probably be necessary to contain common functionality to remove code redundancy. Source: David Hayden [MVP C#] : Validation Application Block - Integrating It Into Your Business Layer David Hayden presents another great article, this time on the newest addition to the MS EntLib: Validation Application Block . I go back and forth on the EntLib as a whole. Parts are great, other parts are overkill. I love the Data Access Block and use it in tandem with my other data access frameworks (ActiveRecord, NHibernate, etc). The UI block though, WTF! David's article is a good read. Go forth and read.

No, wait, I am Dr. Doom

If I were a villian I would be Dr. Doom Dr. Doom 74% Apocalypse 69% Lex Luthor 59% Juggernaut 58% Kingpin 54% Green Goblin 54% Magneto 53% The Joker 51% Dark Phoenix 40% Venom 35% Mr. Freeze 32% Two-Face 30% Riddler 29% Catwoman 29% Mystique 22% Poison Ivy 19% Blessed with smarts and power but burdened by vanity. Click here to take the "Which Super Villain are you?" quiz...

Top four reasons Windows wins and Linux loses

  Top four reasons Windows wins and Linux loses 1. The Installed Base 2. PC Vendor Support 3. Hardware Vendor Support 4. Software Support Source: Top four reasons Windows wins and Linux loses To this list I would like to add:      5. Consistent Package Installation In windows you have MSI files to install stuff with.  They are simple to use and pretty much standard for every program I've installed. In Linux I've used RPM's, APT and PORTAGE.  Granted they are all easy to use it is still frustrating to me to have to know how to use all three.  The less I have to think about something mundane (i.e. installing software) the better it is. What would really rock Linux's world would be a single distribution system that would work with all distributions.  That way the distributions could work on making their distro better and not have to worry about maintaining an Open Office or FireFox install.