Diary of a ninja
A blog about Life, Code and Beating level 99 to brag to your mates...
Hidden gems: Microsoft SQL .Net managed code support
I have been written a number of posts recently taking a look at Microsoft SQL and some items of it's more obtuse feature set – Microsoft SQL CLR support is one of these hidden gems. Whether you want to add SHA256 hashing to SQL or add managed code features to your database functions (MSMQ support?) this will get you there.

 

Google Analytics event tracking in native code – now in GaDotNet 1.2
So last week i released my new open source project GaDotNet, which allows you to track page views, events and soon to be supported, transactions, in your .net applications natively. I’ve had so much awesome feedback from the .net community, and have been busily adding features. Today i release the next version that supports events.

 

Make your XML strongly-typed: Because you can, and its easy
Earlier in the week i posted a Twitter post commenting on how if your not using the XMLSerializer class to you advantage, well, as Scott Hanselman puts it now and then: Your doing it wrong. I use the XML Serializer classes on a daily basis to refer to my XML in a strongly typed manner and often wonder why i see people go to so much effort in creating hard to maintain code just to get data from or send it to an XML file.

 

How to fake Optional Parameters in c# 2.0
With the launch of .Net 4.0 there have been a lot of excitement about some of the new features, Optional parameters being one of these. What a lot of people don’t realised it that with a bit of leg work you can pull this off with c# 2.0 – so those of you unable to deploy to a machine running .Net 4.0 can still join the party.

 

ASP.Net Http module for mobile device browser redirection
With all the advances and improvements in the mobile space of late, there is even more need to have a mobile presence/version of your website. Today I'm going to take a look at a quick and easy way to make sure that mobile browsers are always looking at the correct version of your site, and we’ll do it using a nifty little Http Module.

 

The black arts of custom Type conversion in c#
One of the little used features of c#, is user written implicit and explicit type conversion. Put simply: sometimes you have a object (custom or built-in .Net framework) and want to convert it to another type of object. While you can easily write left to right style code to accomplish this every time, there is a lot cleaner way of doing this by empowering your objects to cast themselves as another type.

 

Twitterify your strings using c# regex
So you’ve set up a twitter feed on your site – sweet. Now all your peeps can see how excited you are about the new limited edition Whitney Houston EP you’ve been listening to. But then you post a link – or a reply to a fellow twitterati member and those handy auto links you’ve become so used to aren’t there. Bummer duuude – lets fix that.

 

How to use the Not-so-new MailSettingsSectionGroup
Today i came across something that from my day-to-day coding i have noticed a lot of my fellow coders at work/play have let slide on their path to .Net Mecca – using the MailSettingsSectionGroup section of the web.config to specify both SMTP server host details as well as they other properties such as user/pass credentials in a central, single, easy to use manner. So I'll take this opportunity to make it as easy as possible for you to use.

 

C# Convert DataSet to CSV
Today i found myself wanting to quickly export a dataset to CSV and i didn’t want to bloat of a library that does more than i need. The following method is the result of this need/want.

 

C# reading an open text file in less than 10 lines
There are times when you want to read a text file that is in use – or as i have had many times, code you have recently execute hasn’t fully let go of the file when you go to read it – when you copy something to a directory and the AV scans it or any other times when you want a file’s contents but don't want to have to worry about locks.

 

SubSonic, SQLite, Sonic.exe and 64bit, oh my!
Well this week i started work on my new development machine – a 64bit Windows 7 machine mmmm tasty. Everything has run perfectly smoothly until i hit one weird little issue. While attempting to generate a new data layer for a SQLite database using Subsonic i received nothing but errors – Another simple fix which I'll show you in this post.

 

Retrieving a Flickr Photo ID from a URL using RegEx
While working on a recent Flickr/Google Maps mashup i needed to make it as simple for users to share their Flickr photos as possible. What is easier than simply asking them to enter the Flickr photo page URL? Using this I'll show you a simple way to use RegEx to retrieve the photo ID part of the URL using c# as well as a JavaScript RegEx version for your ASP.Net RegEx validators. Lets get to it!

 

Consuming an ASP.Net WebService with Jquery & JSON
ASP.Net Script Services and Web Services are an incredibly powerful tool for providing rich dynamic sites using AJAX. As good as they are, there are times when you want to access them in alternate ways. Combine JQuery, JSON and ASP.Net Web Services and you have a combination that rivals the A Team – lets take a look.

 

Consuming an ASP.Net WebService with Jquery & JSON
ASP.Net Script Services and Web Services are an incredibly powerful tool for providing rich dynamic sites using AJAX. As good as they are, there are times when you want to access them in alternate ways. Combine JQuery, JSON and ASP.Net Web Services and you have a combination that rivals the A Team – lets take a look.

 

Adding Windows Live Writer support to your Blog engine
If there is one blogging related tool that I've come across lately that i think has been a game changer it would have to be Windows Live Writer. However some people are using either a custom written blog engine (like me) or are using a blog engine that doesn’t support Live Writer. If that is the case i will show you a simple way to integrate Windows Live Writer support into you blog with WebServices and the MetaWebLog API.

 

Sending encrypted e-mail with C#
There are times when the invention that we all call E-mail just doesn’t cut it for sending information securely. It is because of this that in every case where information really needs to be sent securely E-mail is not usually the medium chosen to send it. As most developers know though there are times when you have to bite the unsecure E-mail bullet. I’ll show you a way to solve this conundrum and at the same time probably keep your current e-mail client.

 

Upgrading Umbraco from 3 to 4 – Not all smooth sailing
If you have ever had to setup or manage an Umbraco installation you will know both the pleasure and the occasional pain that it can bring. Umbraco is part of the growing list of “oober cool” up and coming Dot Net CMS that are getting attention in the “get it up quick” world of marketing driven sites in the market place (Ford Australia for example). I recently had to upgrade a clients installation from 3.0.5 to 4.0.2.1 and the story that follows will hopefully help someone in a similar position so that they can revel in the same relief that I do currently.

 

Getting a full ASP.Net rendered page as a string
So there i was looking for a simple solution to offer a preview function on a CMS for a client at work, when it hit me. Why try and replicate the content of the page in anyway (i could use a blank page and fill it in, i could carry values as a session and redirect to the front end view page. The reality is: I could do many different things. The real question comes down to “How would a Ninja do it”

 

Regular Expression to find the YouTube video ID from a string
Today i had to write a quick method to extract the YouTube video id from a YouTube video URL. So on with the show, lets get onto the code.