Monday, 9 April 2012

My Favorite Relational Database.

When I first started programming; I mean really programming and not just bashing websites together with HTML/CSS; I went through a huge amount of tutorials for c#. I found video tutorials a great way to learn how Visual Studio works, how to write code and how to connect to a database and show the data in a half decent way.

However, one thing I have noted with the trends in Microsoft technology is how they favor their own brands of tech over others (not surprisingly). This is ok, until it comes to relational databases! Every tutorial I went through was based on MSSQL or the compact version. Whilst I know their are jobs around for these technologies and they integrate with Visual Studio much better than anything else does at the moment; I hate MSSQL. Heres why...

One of the first ASP.NET sites that I programmed for a local company (that was stupidly simple in that it just showed workers for their business.) was a great testing ground for me to learn Linq. I so wanted to learn linq that I did the project using MSSQL as a back end. I had used it before and had nightmarish problems with deployment which I will not go in to here. (or to any one other than a psycologist. )

So I am all fired up for going into a linq2sql project and getting all the benefits of a DAL without writing it. Wahoo! However, the customer was almost immediately unhappy about certain fields that they had asked for and others that they wanted to add in. Therein lay the first problem. The changing of the database was SO slow, even (or especially) in VS. Then you have to update the DataContext which took an age!

After some time they outgrew the shared host that they had been given, and we got them set up on a Cloud server. I took the oppurtunity to change the database structure to PGSQL (which is pretty much the only RDBMS that i use now, aside from obligitory MySQL) and boom. The whole app ran like a song even on my local machine.

The next thing i noticed was the bloat of the server for MSSQL. I had a phone call from the client saying that there was an error when trying to upload a picture. I looked in to it and voila! the Harddrive was full. I thought, that's naff. There isn't that much on it. When, however, I uninstalled the now redundant MSSQL server, I had 2/3 of my hard drive back!!

So although this is only one brief chapter in my pathalogical hatred of MSSQL, I hope that it will warn young devs away from the evil that lurks behind every VS tutorial.

PS. I am now writing an app using MongoDB and I would highly recommend that as well as MVC as it is so nice not to be patronized (as much) by VS!

Monday, 2 April 2012

Safari Issues with FormsAuthentication

So today, one of the customer's that we have had noted that his browser (on the iPhone) was losing his login everytime he closed it. Whilst fighting the urge to make rude comments about his choice of browser/os/life, I decided to see where the issue lay today.

So the long and short of it is this: Safari loves to lose Session Data if it is not persisted. So the way we were forwarding from logon :

FormsAuthentication.RedirectFromLoginPage("Username", false);

Simply did not cut the mustard! We needed to rethink so we put:

FormsAuthentication.RedirectFromLoginPage("Username", true);

Weren't we awesome? Well, whilst this did fix the problem of Safari forgetting everything like your aunty noris, one of our devs came up with the great idea that maybe we should have an ebay-esque, "log me in all day" feature.

This required a little reading and the result was the idea from stack overflow (as most of my google searches seem to end).

Now we choose the timout (default of 30 mins) based on the user selection. Much better! One thing I did note was that the code will default to the timeout if left in the web.config, therefore, keep the tag but remove the timout (if there!) from the tag.

Now, as long as our users have cookies enabled (resist the matrix runs on xp quote) and you are away. Of course, there may be more elegant solutions, however, we got it working!

Sunday, 1 April 2012

Welcome to my blog

Hi all. This blog is going to be all about programming and other aspects of life that are touched by computer use. I am not a programming master and as such I often come across new things that I learn in my travels. As I do so I will share them here and you all can get involved too.

One thing that I feel passionate about in the sphere of programming is the place of Open source and community software. Therefore, if I produce a tool, library or other set of code that I think will be useful, I will definately share it on either sourceforge or github (or both if I am feeling energetic.)

Contact me for more information or for a full CV!