SerializationException Running Npgsql Commands on .Net Entity Framework

Recently, while working on a project for a client I was writing a .Net application using the Entity Framework backed onto a PostgreSQL database. All of a sudden I got a System.Runtime.Serialization.SerializationException when I was trying to run my app, and the stack trace (weirdly) didn’t help.

It turns out that while I had added the Npgsql dependency to the project, it wasn’t enough. Entity Framework it seems, needs to have access to Npgsql.dll assembly information.  When EntityFramework tries to use the library, it won’t find it (despite being in the project) unless it is in the Global Assembly Cache (GAC).

The Global Assembly Cache (GAC) is a folder in Windows directory to store the .NET assemblies that are specifically designated to be shared by all applications executed on a system. Assemblies can be shared among multiple applications on the machine by registering them in global Assembly cache(GAC). Source

The best way to resolve this is to use the Npgsql installer that matches the version in your project from: https://github.com/npgsql/npgsql/releases. Those setups take care of registering Npgsql in GAC and set up the machine.config file to include the Npgsql db provider factory.

After I did this, everything worked as it should, and all was right with the world.

Convert SQL Server Database to a SQLite Database

Recently, I wanted to resurrect an old project of mine I worked on in my spare time originally designed to work on .Net technologies. Naturally, I backed it against a SQL Server 2005 Database which turned out to be a bad idea because it made portability of that data a bit of a nightmare.

So it was with great happiness that I found this tool (mirrored here) by liron.levi who posted an article on CodeProject on how to accomplish this task. You still need a Windows machine and an install of SQL Server (Express Edition with Advanced Tools is alright) but it got the job done just fine for me.

If you want a no-fuss easy way to convert your databases into a format easier to deal with and a lot more portable to-boot.

Windows 7 Drivers for Apple’s USB Ethernet Adapter

Listen up, all you Boot Camp’in Mac users … Can’t find Windows drivers for the Apple USB Ethernet adapter? Want to use use the adapter on another Windows machine? Are you crazy?  Well, it turns out it CAN be done, with a little bit of trickery.

There is a lot to be said for Apple’s simplicity of design.  Even their adapters and cables look as if they were pain stakingly and lovingly hand crafted by an eccentric, gay, Swedish man. Everything just looks better.

Recently, after the onboard NIC died in my Acer Aspire L3600 (which runs Windows 7 x64, and I use as a dedicated Windows Media Centre).  After flashing the BIOS and jumping through several hoops with no avail, I needed to go looking for another way to get a wired >=100Mbit/s network interface into the machine.  Since its ultra-compact form factor makes an internal PCI option impossible, I needed to go looking for an external (USB) option.  It didn’t take long to realise that my options were going to be extremely limited and after checking out my nearby computer retailers, I had only two options.  A reasonably generic SWANN adapter, or Apple’s USB Ethernet Adapter – both were in stock at my local Dick Smith Powerhouse.  The problem with the SWANN adapter, is that its a single solid block, and since my Media Centre lives very close to the wall, it wasn’t desirable, while The Apple adapter can be flexed to a right angle.

Problem is, the Apple adapter says (on the back) that it can ONLY be used with an Apple MacBook.  But the adapter’s drivers ARE included as part of BootCamp, which means it can function when running Windows on a MacBook. So with a little trickery, you can get it working on any old Windows 7 or Vista PC (32 or 64bit editions).

  1. First, you need to download the driver for the adapter, either the 32bit or 64bit version.
  2. Next, extract the zip file and locate the file Ax88722.inf.  It needs to be altered in order to get the device drivers to be installed.  In order to simplify the process, I’ve simply got the tweaked version here, for you to download. Just replace the original Ax88722.inf file with this one inside this zip file.
  3. Next, attach your USB ethernet if you have not done so. Launch device manager (right-click on “computer” and select “Manage”). Locate the lonely unknown device “Apple USB Ethernet” and right-click it to select “Update Driver Software”.
  4. Select “Browse my computer for driver software” and in the file browser dialog select the folder of your recently modified .INI file and continue the wizard. This should bring your Apple USB ethernet to life!

Apparently there are drivers for 32bit versions of Windows XP, put together by the BootCamp community, if you’re an XP user and feeling lucky you can try your luck with this link (but like the rest of this post, use it at your own risk).

Download Microsoft .NET Framework 3.5 SP1 Standalone Full Redistributable Setup Installer

Many applications uses Microsoft .NET Framework 3.5 as development platform, and thus requires .NET Framework to be installed beforehand, else the installation will request to download and install .NET Framework from Internet. On offline system without Internet access or online server with slow downloading speed, the requirement to download setup files through web may hit the wall – a no go.

kamagra shipping

Microsoft initially just provides a minimal size dotnetfx35setup.exe download which is a bootstrapper that will still need to download more files via Internet. For users who prefer to perform offline installation or install .NET Framework 3.5 SP1 without waiting for download to complete will have to download and save a copy of full complete standalone or redistributable Microsoft .NET Framework 3.5 SP1 setup installer, which is finally published by Microsoft.

Microsoft .NET Framework 3.5 SP1 (Service Pack 1) is a full cumulative update that contains many new features building incrementally upon .NET Framework 2.0, 3.0, 3.5, and includes cumulative servicing updates to the .NET Framework 2.0 and .NET Framework 3.0 subcomponents. See KB951847 for list of changes and fixed issues in the .NET Framework 3.5 Service Pack 1.

Download full package of Microsoft .NET Framework 3.5 SP1: dotnetfx35.exe (231 MB)

For known issues and release notes, refer to Microsoft .NET Framework 3.5 SP1 Readme.

Woot! Valve Confirms Steam for Mac OSX

Its been speculated for some time now, but it turns out that sometimes rumours that seem too good to be true, do materialize after all.  Steam is coming to the Mac.

And not just im some crappy pseudo lameness through a dodgy emulation or some-such, but real honest to god native application which is, according to Valve to be considered a tier-1 level platform with simultaneous releases for PC, Mac and XBox 360 from now on.  Also, Mac and PC builds will be concurrent, patches will be released to both simultaneously as well.  The source engine, also gets the native treatment, now that Valve has incorporated OpenGL into its award winning, modular engine.

Portal 2 will be Valve’s first simultaneous release for Mac and Windows. “Checking in code produces a PC build and Mac build at the same time, automatically, so the two platforms are perfectly in lock-step,” said Josh Weier, Portal 2 Project Lead. “We’re always playing a native version on the Mac right alongside the PC. This makes it very easy for us and for anyone using Source to do game development for the Mac.”

This means that all steam games will be theoretically available to Mac users. Steam and Valve’s own library of games including Left 4 Dead 2, Team Fortress 2, Counter-Strike, Portal, and the Half-Life series will be available as soon as April (next month).

But looking at the bigger picture, I think this is a huge industry changing announcement from Valve.  I think this will be the event all Linux and Mac users had been hoping for to finally bust the lid off the “Windows is best for games”.  This is a great idea from valve because it means that they’re going to have access toa  huge market of new potential gamers.  I suspect that many OSX users will flock to Steam as their de facto games delivery platform, since historically only very large titles were ever ported to MAc, and generally years after the PC launch.

What’s more, if Valve is to be beleived, it may be more than just Source games coming, Gabe Newell, President of Valve said:

“As we transition from entertainment as a product to entertainment as a service, customers and developers need open, high-quality Internet clients, the Mac is a great platform for entertainment services.”

“Our Steam partners, who are delivering over a thousand games to 25 million Steam clients, are very excited about adding support for the Mac,” said Jason Holtman, Director of Business Development at Valve. “Steamworks for the Mac supports all of the Steamworks APIs, and we have added a new feature, called Steam Play, which allows customers who purchase the product for the Mac or Windows to play on the other platform free of charge. For example, Steam Play, in combination with the Steam Cloud, allows a gamer playing on their work PC to go home and pick up playing the same game at the same point on their home Mac. We expect most developers and publishers to take advantage of Steam Play.”

Given the lack of enthusiasm for Windows Vista, and given he number of people I know to be making the move from Windows to Mac, I think this will only lessen the ties people have with Windows.  Especially that source game licenses are granted for either platform.  Blizzard has done this too, for the record.  Its not quite as elegant as steam, but battle.net was (to my knowledge) the first way to get dual platform licences which could be downloaded from the web.

In summary, this is such exciting news for me, I am positively elated.  And I think that this will cause quite a stir in the games industry, in that games that support only one platform may finally be a thing of the past.

Fixing Audio Problems in Windows 7 x64 on MacBook (Not Pro) and Boot Camp

I was fortunate enough recently to get a license of Windows 7 x64 Home Premium which I promptly installed on my (non-pro) 15″ MacBook.

The install through the OSX Boot Camp wizard went really smoothly and wireless and most other drivers worked out of the box. However, on my early 2008 MacBook, the audio driver did not work (instead only red light constantly came out of the audio jack). Obviously, the driver provided by Boot Camp is not the right one. From my experiences using XP on my Mac, I remembered that the audio card is made by Realtek. After lots of googling, I downloaded the driver directly from Realtek and it worked. Here is the download link. The one I downloaded is Vista Driver (32/64 bits) Driver Version R2.14. Extract the files and run the setup.exe.

BTW, if you are looking for some older versions, you can use this ftp site.
ftp://202.65.194.211/pc/audio/. This is a mirror site used by Realtek. Note that the download speed is kinda slow, so be patient.

Why I Bought a MacBook

For my whole life, I’ve basically been a Microsoft Fanboi.  This isn’t because I actually believed Microsoft was better, but more so that I was a big gamer; and well, games sucked on everything that wasn’t a PC or a console.  My options were limited.

So after my impressionable teen years and I started my IT career, it was really only logical to continue down that road, since in my opinion at the time, Window’s worked fine.  Linux and BSD operating systems were still notoriously difficult to use, and had swarms of issues and Apple machines we’re for people who didn’t want a REAL computer.  And since I still liked gaming – Windows was my de-facto standard operating system and I never thought that would ever change – until a couple of months ago when Vista finally broke what was left of my patience and spirit.

Unable to tolerate the Vista rhetoric any longer, and having been frustrated with the “omg, your computer’s sex is on fire” beauty of the new Intel-based MacBooks I made the switch.  A long time ASP3, .Net developer by trade, doing the unthinkable – joined the army of  people who like to  wear berets, and watching Steve Jobs’ latest Apple keynote speech.

And I have never been happier, nor have I looked back.

Looking back on it, I actually think that the problem started the moment that WinFS was dropped from the (then longhorn) feature set.  This was followed by more dropped features until there was nothing left to look forward to.  Vista ended up being all bling and no substance.  It is the Amy Winehouse of operating systems.  But still, despite this, despite the endless trouble with driver accessibility, despite the pitiful security solution called UAC, despite the endless and constant flow of problems; I persevered – hopeful in the knowledge that if I gave Windows some love, it would love me back.  This has always been the case with previous versions of Windows, why should this be any different?  But try as I might, as patient as I was, there just ain’t no love coming from Vista.  It hates you from the moment you install it, until the day that you die.  And no matter how many service packs or patches I installed, it never got any easier.

It’s like the spoiled middle kid from a dysfunctional family.  What’s worse, is that I suspect Microsoft knows it!

And before all of my previous comrades start cheering for Windows 7, like its the second coming, can I just point out that Windows 7 is effectively a working, stable version of Vista.  Not much more.  And what’s worse, your going to be charged for the pleasure of upgrading to what Vista should have been in the first place.

Having had several conversations with various Windows user’s since the purchase of my Mac, has been an interesting experience.  I’ve come to realise, that Windows users have come to expect mediocrity from operating systems.  And when I try to explain some of the awesomeness of OSX I am met with either apathy or a serious lack of comprehension.

It didn’t take me long at all to fall in love with the MacBook.  And this is just as much a tribute to Apple elegance (when they choose to use it) as it is about Vista sucking harder than a hoover.  But the single, final feature which sealed the deal was the magical MacBook, sleep and wake-up/resume functionality.  It sleeps and wakes up on he close/open of the lid like any other notebook.  But the speed at which is goes from fully awake → fully asleep → fully awake is simply staggering.  And, unlike Windows, I mean fully asleep (minimal battery usage) to a fully awake (and fully usable) state.  I have the 2.0GHz version of the 2009 aluminum MacBook, and the whole process is only a few seconds!  Simply amazing.

And much of the things which have truly impressed me are not even immediately obvious.  The best way I have found to summarize the difference is this; “All of the things that you [Windows users] have learned to live with, just gone!”  Windows in Finder (the equivalent to Explorer) open instantly, viewing folder file properties are virtually instant, search is staggeringly fast (this is called spotlight) and often, close to instant.

Even gaming isn’t an issue (although I seldom get time for much of this these days) – I have a 30gb side partition for Boot Camp which runs Windows naively with correct drivers when I HAVE to use Windows with as much grunt as I can give it.  VMWare Fusion actually lets you run the Boot Camp installation as a virtual machine if you only need basic Windows functionality (such as testing browser computability).  This is sometimes to even needed, however, as many of the more popular games are sometimes available for OSX anyway.

I was expecting a lot more pain with the transition and its difficult to adequately paint the correct picture, but the simple fact is, MacBooks are amazing.

Enough said.

SBS POP3 Connector Polling Interval

The minimum level you can set through the GUI is 15 minutes.
This is how you can change this through a registry setting: ScheduleAccelerator.
Remember, this connector is only available for a Small Business Server !

1. Locate and then click the following registry subkey:
“HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/SmallBusinessServer/Network/POP3 Connector”

2. On the “Edit” menu, point to “New”, and then click “DWORD Value”.

3. Type “ScheduleAccelerator” (without the quotation marks) as the entry name, and then press ENTER.

5. On the “Edit” menu, click “Modify”.

6. In the “Value data” box, type the value that you want, and then click “OK”. To determine the polling interval, the value that is configured on the “Scheduling” tab in the GUI is divided by the value that you type for the ScheduleAccelerator entry.

For example, if a 15 minute interval is specified in the GUI and you set the value of the ScheduleAccelerator entry to 3, the connector will poll ever five minutes.

7. Quit Registry Editor and reboot the server.

IIS == FTP Server Hell

I’ve been having some troubles with fast and reliable FTP server software for my servers lately, simply because IIS FTP was being far more trouble than it was worth.

On @stormwarden‘s advice, I checked out FileZilla FTP Server, and WOW, am I impressed. Configuring it is easy, the server is fast and simple to use and installs so easily even my mother could do it.

One of the main reasons I found it so great, was that you can easily setup ‘home’ directories for multiple users, something which is a LOT more difficult to achieve using the FTP server in IIS.

In sum, FileZilla is an excellent FTP server and I highly recommend it to any one with a self-managed windows-based server which needs FTP capability.