Sunday, May 25, 2008

Gnome + Compiz + Virtualbox Seamless Window + Workaround = Awesome

I have been a long time user of Linux, with various desktops and servers throughout the years (technically both Linux and Windows), and currently I have been using Ubuntu 8.04 with VMWare Workstation 6.5 Beta.  A while back I tried out VirtualBox, now owned by Sun, and I was disappointed with the featureset and speed versus VMWare.  However times have changed, and VirtualBox 1.6 is way faster, and I am definately impressed, even with it's Seamless Desktop functionality.


Before it gets mentioned, I swapped out the vmware-vmx executable from the debug executable to the release executable to try to gain speed benefits, and of course my virtual machine was tweaked (Windows Server 2003) with the tools installed.


There has only been one issue, which was with compiz enabled, caused a nasty drawing bug with Seamless Windows when there was no windows open on the desktop.


Until a proper workaround is provided, I created this small .NET application that will force an open window into the upper left hand corner of the screen, with 1x1 pixel visible on the desktop, which seems to satisfy the seamless desktop functionality and allows things to function normally.  The window does not provide any kind of functionality, and is not available through the taskbar, in order to kill it off you must kill the process through task manager.


It was almost simple to convert my VM from VMWare to Virtualbox also.  I uninstalled the VMWare Tools, as this can cause conficts once the Virtual Machine is running under VirtualBox.  I used a registry hack called MergeIDE to ease the kernel loaders ability to load the OS from a different type of disk interface (my VMWare machine had SCSI, VirtualBox has IDE), and also I swapped the HAL in my virtual machine from Multiprocessor ACPI to the generic ACPI HAL (not uniprocessor ACPI, instead the generic ACPI hal which has the acronym for ACPI spelled out).  Since VirtualBox reads VMDK files (VMWare's disk file format), it booted right up, installed the VirtualBox Guest Additions, and was noticeably faster, with only losing support for the DirectX 9 compatibility supported by VMWare Workstation 6.5.  This is not a comparison of VMWare Workstation 6.5, the same speed differences are noticeable with VMWare Workstation 6 and VMWare Server.


You can get the full source and binaries of debug and release mode for the compiz and seamless desktop workaround here.  I simply dropped the executable into the startup folder for "All Users", under the start menu, and the issue disappears.

Friday, March 14, 2008

Repository Library - Initial Feedback Release

I am releasing my own repository library, mainly for feedback at this point, however it should be somewhat usable, proceed at your own risk (I have yet to build tests or use in a real app), under the ISC license (BSD).

You can pick up the source code (includes dependencies) here.


The library, while simplistic in nature, allows for the simplification in usability by making use of extension methods.  The following interfaces are available:


IRepositoryContext : This interface is what replaces the IxxxxRepository interfaces or IRepository<xxxx> of the typical Repository Pattern.  The Context Interface allows reference of types as such: context.Xxxxx().Find/Save/etc, all wrapped (optionally) within a Transaction when used with the NHibernate Repository Provider.

IRepository/IQueryRepository : This is the interface (one of) returned via the context.Xxxxx() call.  The generic types are <ModelObject, KeyType> for IRepository and <ModelObject, KeyType, QueryEnumType> for IQueryRepository.

IBuilderRepository : This interface allows passthrough of query objects which may be specific to the underlying repository provider (I plan to use this to implement a generic query generation UI system, using NHibernate specific features, etc...)


In additional to these Interfaces, located in the Acqusys.Repository assembly, a provider for NHibernate is provided with the implementations, as well as a small set of example projects.


While this blog posting doesn't give the full attention this project deserves, and with all the debate on the ALT.NET mailing list, I figured the best bet would be to push this out there for whoever wants to take a look and possibly provide feedback.

Time for my own implementation of this repository!

Thursday, December 6, 2007

Extension Powers for Good instead of Evil

There's been quite a bit of discussions lately on a variety of mailing lists that I subscribe to about the power behind the Extension Methods functionality that is present within the C# 3.0 and VB.NET 9.0 compilers.

While I definitely agree that Extension Methods could potentially be abused, they may also provide a good service as well, which I will describe with an example.

I use the Castle Project components, for instance Windsor and ActiveRecord.  However, to keep functionality separate and distinct, instead of inheriting from ActiveRecordBase<> and allowing everyone able to see the domain model access to use the data services, instead I implement a repository service.  Besides limiting the functionality of accessing the repository only to the tiers of the application that need the access, this also allows me to not require the Castle.ActiveRecord dependency throughout the program, and I can abstract the concrete class and limit the exposure of Castle.ActiveRecord to only one assembly.

However, this technique also leaves some horrid syntax compared to the ActiveRecordBase<> implementation:

Product[] items = Product.FindAll();


Product[] items = container.GetService<IRepository<Product>>().FindAll();

And it gets worse if you do anything fancy, like for example I like to wrap transactions within my repository:

using IRepository<Product> repo = container.GetService<IRepository<Product>>();

I also like (whether it's proper or not is left to the reader), to create a "core" of my application for the logic layers, and with a base static class, such as "App".  This App class houses my windsor container (allowing me to contain the exposure of Castle.Windsor and Castle.MicroKernel as well).  Within this class I separate functionality into sub properties, such as a Model property of type "ModelServices" for model services:


which changes the code above:

Product[] items = App.Model.NewRepository<Product()>().FindAll();

While this is a little cleaner, in my opinion anyway, it still is very involved when it comes to reading code.

Extension methods can actually help here, at least to some extent.  As an example, if I were to create a new extension method, that is in the same namespace as the Product class, such as:

public static class ProductExtensions


public static IRepository<Product> Product(this ModelServices target)


return target.NewRepository<Product>();


Now with this extension, any code which pulls from the same namespace as where the Product class is can clean up a little bit:

Product[] items = App.Model.Product().FindAll();

I like this because it allows me to bring in new pieces into my services in a cleaner manner than having to request GetService, while at the same time keeping things separated and loosely coupled.

Any comments or feedback on this tactic would be appreciated :).

Thursday, November 29, 2007

SSIS - Am I Overlooking Something?

I'm currently working on a project that involves a couple of SSIS Packages.  There's something that seems like it should be simple to do, yet I haven't found a clean way to do it yet:  I want to add a column to a Flat File Source when reading the file in a Data Flow that stores the line number for each record from the flat file.  The flat file's records are delimited by CR-LF.

There is a RowCount Task that seems like it shouldn't do what I want but I don't see many other option over creating custom scripts and variables.

Is there something simple I'm overlooking here?

void Main()

Hello, and welcome to my blog, "Translucent Reality". My name is Rick Fleming and I am a software consultant in Bloomington, Illinois. This is also my first blog post so bear with me as I probably ramble on way to much.

I have programmed in a variety of languages, mostly on the Microsoft platform however also on the Linux platform to an extent. Currently I mostly work with Microsoft.NET Languages, but I also like to keep my mind open to new things.

A little bit about me, when I was six years old I used a computer for the first time. It was an Apple II, we had one in our first grade classroom. Of course back then I didn't know about programming but I knew I wanted a computer. We got to use the computer from time to time in the classroom, and the main program I remember using was Paws, because the school was impressed at the speed at which I could type, according to Paws anyway.

When I was somewhere between eight and nine I got my first computer. Neither one of my parents knew much about computers, and there was a computer for sale for two hundred dollars, a Texas Instruments 99/4A. Keeping in mind that this was approximately 1989, and the TI was far from obsolete, but also keeping in mind they didn't know anything about computers, they bought it for me.

The TI changed everything for me, it came with a couple of books, one of them taught TI Basic, and the other was the TI Basic Reference Manual. I can remember when I first turned it on, and all those colors showed up, I was impressed (since the Apple II looked so dreary in comparison), and then I pushed a key to get to the menu and then 1 for TI BASIC.

And then there was a prompt. Of course, I didn't know what to do, so I started reading the books.

Within one week of having the computer I had went through all of the examples that were in the book and learned the commands of TI BASIC. It was as though I was born to program, and hence started my journey to where I am at today.

That Christmas my dad bought me an Epson dot-matrix printer. I can still remember scouring the booklet that the printer came with, because it had a listing of all of the Escape Codes to make the printer do different things. My TI had the expansion box, and a port card, so I was able to hook the printer up. And I wrote my own word processor. It wasn't elaborate, but it worked.

Eventually I moved on to an old IBM PC XT that my dad got from a lawyer friend of his who upgraded their offices, and from there a 286, then 486 (my first new computer), and so on, and on, the repeating cycle of upgrading. I moved on to GW-BASIC, and then QBASIC, PDS 7.1, Turbo Pascal, Turbo C++, TASM (I used to create libraries I could import into BASIC), Sphinx C-- (anyone remember this thing?), and then Windows with Visual Basic, Visual C++, Turbo Pascal for Windows, Java, .NET (C#, VB.NET, Boo, etc...) and the list goes on...

Now that the personalization and introduction is out of the way, this blog intends on focusing on software development, mostly with a .NET edge but also potentially more generic constructs such as practice and methodology. We'll see where we lead.

Stay Tuned!