Welcome!
I am a .Net developer by day; a PHP developer, Linux systems administrator and small business owner by night and a husband and father 24/7/365!
This is my blog about technology and my life in general!
On July 27, 2009 in Technology, Uncategorized, Work
There has been some discussion online recently between public servants about how the public service is still overwhelmingly using Microsoft Internet Explorer 6. I got involved when someone tweeted a link to this site: http://hey-it.com/download.html. The site provides cute posters asking the IT folks to basically get off their arses and give us a newer web browser. I responded back that there are other issues involved when upgrading web browsers, such as legacy application compatibility, and that things aren’t as clear cut as it may seem from the perspective of someone outside IT.
Well, responses to that included “don’t punish users for your deployment issues” and “are you afraid of losing your job if I upgrade my own browser”? Oh, and the term “visionless IT geeks” was tossed around. My response to this was a flurry of tweets quoting other folks rhyming off reasons why large organizations all over still use Internet Explorer 6. I then signed off Twitter and did not log back in for two days.
I essentially had a hissy-fit.
On March 05, 2009 in Subversion
Subversion (also referred to as SVN) is an open-source revision control system. Subversion tracks changes to files and folders, and keeps copies of all revisions, or versions, of your files and folders. Subversion allows you to retrieve at any time older versions of your files and folder. And because subversions keeps copies of all revisions of your files separate from the copy you’re currently working with, there’s an element of a backup system to it. Subversion can work across a network, with more than one user as well, and can help manage the situation where many users may be modifying the same file. Subversion can help manage any conflicts that may arise when more than one users makes changes to the same file.
For this tutorial we are going to start with the basics. We will assume that there is only one user, and we won’t deal with Subversion being used across a network. We are also going to focus on one particular Subversion program, TortoiseSVN. TortoiseSVN is an open-source windows implementation of a Subversion client program.
On January 30, 2009 in Windows
I’ve had a number of people ask about the two posts I made to Twitter (and this blog) yesterday. So here’s the story.
I’d heard a lot of good things about the new Windows 7 Beta operating system. I’d read a number of posts about how easy it is to dual-boot a Windows 7 installation along side a Windows XP or Vista installation.
My computer has 2 Windows XP installations: one that I use for everyday computing and one that basically exists only for those rare occasions when the main installation won’t boot for whatever reason (I’ve used the second installation 2 or 3 times in the last 5 years. It’s handy to have around). I figured a Windows 7 installation would be just as useful a as second installation for recovery. So I decided to install Windows 7 on the hard disk partition that contained my second Windows XP installation.
So I started up the Windows 7 installation, found the partition that contained the second Windows XP installation, re-formatted it, and installed Windows 7. Piece of cake, worked like a charm. Poked around in Windows 7 for awhile, overall a pretty cool operating system. Then I started thinking about rebooting into Windows XP (my primary computing environment). Started looking around to check that Windows 7 had set itself up with an entry to boot “Previous Version of Windows” as all the blog posts had told me it would.
It hadn’t. In fact it wasn’t even aware that the hard drive containing my Windows XP installation even existed.
Then it hit me. My XP installation is on a RAID 0 volume. Windows 7 didn’t have the drivers, so it didn’t find the drive, didn’t see the existing XP installation, and didn’t set up dual-boot automatically. Fortunately Windows 7 was able to recognize the older RAID drivers, and I was able to get it to find the RAID volume. Now I just had to get the boot loader set up. Well, I can tell you one of the things about Windows 7 that isn’t that great the tool for managing the boot loader bcdedit.exe. I tried a couple of times to get a working boot record going, but ultimately had to give up.
How was I going to get back into my Windows XP installation, where ALL my files are located? Fortunately I have a Windows Home Server that backup all the PCs on my home network every night. I was able to pop the Restore CD into my PC, and rebooted into the recovery console. At first it didn’t find my network card, or my RAID volume, but all I had to do was put the network and RAID drivers on a USB drive and hit the “Scan” button. It takes a minute or two and scans the USB drive, finds the drivers and enabled the network card and RAID volume.
It then connects to the Windows Home Server, prompts you to pick which volumes you wish to restore and from which backup. I choose my D: drive (my second Windows XP installation) and let it do it’s thing. In about 20 minutes my D: drive was back to the state it was in at 2:30 am that morning. Boot loader and all.
So, in the end it wasn’t necessarily Windows 7 that messed things up. But it was Windows Home Server that saved me in the end.
In about 20 minutes.
On January 05, 2009 in Fluent NHibernate
I am posting this because it took me a little while (longer than it should have) to figure out how to define the access strategy for an domain object’s fields or properties. The documentation for FluentNHibernate is still fairly basic, and Googling for the answer didn’t get me anywhere. In the end I figured it out from Visual Studio’s intellisense (which frankly is where I should have looked in the first place).
For all those like me who decide to Google first, here is the answer.
A number of the *Part classes in the FluentNHibernate.Mapping namespace implement the IAccessStrategy(Of ComponentPart(Of T)) interface. This interface defines one property, Access which returns an AccessStrategyBuilder(Of T) object. The AccessStrategyBuilder object has a number of methods used to define the access strategy:
This information I found relatively quickly. What I was missing was how to specify that my camel case fields are prefixed with the underscore character. But all of the CamelCase, LowerCase and PascalCase variations of the methods listed above have an overload which accepts an instance of a Prefix object, of which there are 4 variations:
So in the end, my mapping is as follows:
WithTable("client") Id(Function(c) c.ID, "id").WithUnsavedValue(0).GeneratedBy.Identity() Map(Function(c) c.AccountName).TheColumnNameIs("account_name") Map(Function(c) c.Company).TheColumnNameIs("company") Map(Function(c) c.Created).TheColumnNameIs("created") Map(Function(c) c.Updated).TheColumnNameIs("updated") Map(Function(c) c.UseAdministrativeContactAsBillingContact).TheColumnNameIs("blg_is_adm") Component(Of Client)(Function(c) c.AdministrativeContact, _ AddressOf MapAdministrativeContact).Access.AsCamelCaseField(Prefix.Underscore) Component(Of Client)(Function(c) c.BillingContact, _ AddressOf MapBillingContact).Access.AsCamelCaseField(Prefix.Underscore)
On December 27, 2008 in S#arp Architecture, VB.Net
This evening I wrote my first VB.Net extension method while working on my S#arp Architecture based project. I added another overload of the TextBox method (which is itself an extension method, I believe). I wanted to be able to specify the size of the text box. One of the existing TextBox methods has the following signature:
HtmlHelper.TextBox(name As String, value As Object, htmlAttributes As IDictionary(Of String, Object))
I wanted to be able to specify a text box size without having to declare a new IDictionary every time. So I wrote the following extension method:
<Extension()> _ Public Function(html As HtmlHelper, name As String, value As Object, size As Integer) Dim attributes as IDictionary(Of String, Object) = New Dictionary(Of String, Object) attributes.Add("size", size) Return html.TextBox(name, value, attributes) End Function
Neat stuff.
Now I just have to figure out how to create an extension method that will allow me to pass a lambda expression to RedirectToAction().
On December 23, 2008 in ASP.Net, ASP.Net MVC, C#, S#arp Architecture, VB.Net, Visual Studio
During the conversion of the S#arp Architecture template project from C# to VB.Net I inadvertently broke (at least) one thing: the ability to add ASP.Net MVC items directly to the SharpArch.Web project directly from the “Add New Items…” dialog. This led to my first question asked on StackOverflow.com (which I ended up answering myself, 38 minutes later).
Turns out Visual Studio project files can have an element called <ProjectTypeGuids> which contains one or more guids identifying what type of project the file describes. ASP.Net MVC projects have a particular guid specified: {603c0e0b-db56-11dc-be95-000d561079b0}.
So I added this guid to both my SharpArch.Web project file and my SharpArch.Controllers project file, and now I can add new MVC template items directly from the “Add New Item…” dialog. Cool!
On December 19, 2008 in ASP.Net MVC, C#, Fluent NHibernate, NUnit, Rhino Mocks, S#arp Architecture, VB.Net
I’ve been poking around in the latest release of the S#arp Architecture over the last couple days. I like what I see.
Pronounced “Sharp Architecture,” this is a solid architectural foundation for rapidly building maintainable web applications leveraging the ASP.NET MVC framework with NHibernate.
This evening I took about an hour and converted the basic starter solution template from C# to VB.Net. Why? Well, for the following reasons:
The conversion was straight forward. Pretty well every line of C# had a corresponding line in VB.Net. The only thing I had to add was an Imports tag in the markup of the Site.Master page in order to get the ActionLink and Image extension methods to resolve. I had already tried adding an imports to the code-behind with no luck. Not sure why that was necessary, but it worked.
The architecture is pretty neat. Here’s a few things I’ve noted already:
I’m going to go ahead and trying putting together an actual application based on S#arp Architecture.
On December 18, 2008 in Security
I been using Secunia Personal Software Inspector (PSI) on my primary PC at home for about 3 or 4 weeks now and today I finally got my Secunia System Score to 100%.
Secunia PSI is an application that scans your PC for installed programs and compares them against Secunia’s list of applications with known security vulnerabilities. It’s free for home users. When it’s not scanning it sits quietly in your system tray watching for changes in programs (added or removed).
It helped me realize that even though I was updating some software regularly, the updates would often leave the old, vulnerable version installed (I’m looking at you Java). Here’s what the overview screen looks like on my PC right now:
On November 29, 2008 in .Net, Microsoft
I attended Tech Days in Ottawa this past Thursday. I stuck with the “Web Developer” stream all day and I have to say, I was a little disappointed.
To be fair I think I had very high expectations. I’ve been watching a lot of the PDC session videos online, videos of presentations by Oren Eini (aka Ayende Rahien) and attending Karl Seguin recent excellent presentation at ODNC. Needless to say, the people who presented at a one day conference in Ottawa (of all places) were not all of the same calibre. On top of that, the presentations and slide decks used are not created by the presenters. These are just people re-presenting someone else’s presentation (and in some cases re-telling someone else’s jokes).
The conference’s swag bag, or rather box, was a cereal box of “Techie Crunch” with some relatively good stuff including:
The last one includes hundreds of presentations, including the presentations I attend, but presented by the original presenters, by engaging and entertaining people.
Ironically, the best presentation I attended all day was given by a man with a primarily Unix/Linux background who nearly completely skipped over the Microsoft specific topics in the slide desk he was presenting.
On November 24, 2008 in Technology
I spent nearly 2 hours trying to get it working yesterday (or rather spent 15 minutes trying to get it working, and 1 hour 45 minutes trying to undo the damage and get my computer useable again). I decided to try again this evening and got it working in 5 minutes.
This picture is a (slightly chopped) image of my complete desktop. The original image is 3200×1024, my actual screen resolutions are 1920×1200 and 1280×1024 so the image cropped 176 pixels off the bottom of my big screen.
Mind blowing screen real estate! Awesome!