DataContractJsonSerializer / Linq oddity? Nope, it’s just me :-(

[Once again the code is on my other machine but…]

So using Microsoft’s Entity Framework with .NET 4 as a data access layer, I select some entity Client objects properties that meet my criteria and take 20 via linq. Something to the effect of:

var clientList = (rom client in entities.Clients where
client.LastName.StartsWith(“min”) select new ClientInfo() { LastName = client.LastName, FirstName = client.FirstName}).Take(20)

So far so good, nothing magical here. I then assign add it as a range to a new List<ClientInfo>

var clientInfos = new List<ClientInfo>();
clientInfos.AddRange(clientList);

When the DataContractJsonSerializer hits that list, it correctly does it, however it manages to add in quite a few \0 characters (that’s a null character) into the string which prevents it from properly being parsed by the built in jQuery JSON functions.

Scratch that, I’m likely reading an entire memory stream in instead of just the used portion.

Well, in the end, it’s a good idea to double check your thought process lest you be missing the real problem. I had hacked around my initial noticing of the \0’s by replacing them out of the string so I could move on and come back later and figure out what was wrong. Done and done. I’ll verify it of course but I bet you a dollar that’s it. Funny how things come to you out of the blue, like when you’re trying to complain about an oddity. Chances are, the oddity is you Open-mouthed smile

Oooops, I blew up Drupal

Well, everything was going very well with my Drupal installation. I've got TinyMCE working as my WYSIWYG editor, and added a bunch of other modules to do this, that, and the other. And all was well, I had encoutered a module or two that didn't work correctly and it was simple enough to remove them so I was pretty pleased. And apparently lulled into a false sense of security.

I ended up having to install about 5 modules to allow a 6th to work and I turned them all on at once and… *KA-BOOM* a module load error occurred and blew out parts of my database… The site still functioned but all permissions were wiped. 

Very disappointing… Of course I should have backed up the database before doing this sort of thing, but… I hadn't and that's exactly what I get. I've cautioned clients to back up frequently and religiously and here I am not listening, I know better. I got swept up in the ease of installation and configuration in my very first test run that I got complacent. I didn't feel that the site was in it's initial “1.0″ state and so didn't need a back-up just yet. It went so well, I switched over the blog features of my site to it. That switch to production should have made me back it up at that point… Alas.

However, the whole incident did afford me the opportunity to re-install Drupal. I should say, reconfigure, the file-system portion of Drupal was completely intact. Again it went relatively painlessly, and having had some experience on administering the system, it was a lot easier to do! Easily took me 1/2 the time. Which in real terms put's it at about 4 hours for a fresh install and config of a small Drupal site using a WordPress Blog as a data source for content. Not too bad, not too bad at all!

The irony is, I was installing the “Chaos Tools” module and it's dependencies so that I could investigate the “Bulk Export” utilities that CTools adds. Primarily for back-up plans…

All in all I'm grateful for the experience, I just wish I had planned it!