Head.SmackOnTable();

Contains Nuts.

Archive for April, 2008

The British govt is run by arseholes

without comments

Nottinghamshire police have apologised to a family who had to wait three hours after dialling 999 when an armed gang forced their way into their home.

Source – http://news.bbc.co.uk/1/hi/england/nottinghamshire/7372106.stm

Nottinghamshire police HAVE ADMITTED THEY CANNOT PROTECT YOU. So why cant we have the right to defend ourselves? If you have a weapon and "use it in a threatening manner", you face prison, but criminals can just run around robbing people blind because they know the police cannot do anything.

We should have a right to be able to use firearms to defend ourselves.

And there is a simple test you can do to prove this – Would the armed gang have forced their way into the couple’s home, if they knew they were armed to the teeth? No, of course not.

If I had a legal firearm, and people broke into my house, this would have went down in one of two ways – I would have challenged them, told them to put down their weapons. If they accepted that, fair enough, I would let the police know. If not, I would shoot every one of them, and make sure they were dead. Yes, that involves shooting them in the head and in the chest while they are down. This way I can guarantee that they will NEVER harm anyone ever again.

This country’s police force is incompetent, they are more focused with drivers doing 35mph in a 30mph road at 3am (Who knows! Maybe a kid would run out in the middle of the road!), and giving out fines to people who "drop litter" (a piece of a sausage, that was eaten by birds in a matter of seconds), than do something about crime.

The country’s Crap Prosecution Service, who are known as flat batteries – because they always say "No Charge", and who charge and prosecute innocent people. How do I know this? Because I was one of them. I was cycling home one day, when a drunk fuckwit decided to try and kick me off the bike. I stopped nearby, called the police, while I was doing this, fuckwit and his boyfriend decided to chase me to give me a kicking – I cycled away at speed, and jumped a red light, that was caught on CCTV. I was arrested when I went to the station and was offered a formal caution – I told the police officer to shove his caution up his arse (my exact words) – and appeared infront of the magistrate the day after. The magistrate agreed with me, that jumping a red light on a bike, while being chased with 2 guys with knifes was acceptable.

"Community fixers", who deal out underworld justice on the behalf of clients, are being used instead of police, a senior policeman has said.

Source – http://news.bbc.co.uk/1/hi/uk/7370244.stm 

If there was a "Community Fixer" in the area, id have his number on speed dial. Id have a deal with him, ill scratch his back, he’ll scratch mine.

Feral kids are running around this country, and no one can do anything about them. Police cant touch them "I know my rights" they scream, citizens cant touch them.

Sooner or later, there are going to be more "Community Fixer"’s than police. And that’s when the fun happens.

Written by Monty

April 29th, 2008 at 2:15 am

Posted in Misc, Spleen Vent

Refactoring Made Easy with Resharper 4.0

without comments

Yes, yes, I know that Resharper 4.0 is still in the pre beta crappyness muchos error stage:

image

But I just love Resharper too much, its the best tool around for speeding up development with Visual Studio. If you don’t have it, I suggest you go grab it now!

Anyway, back to my point with refactoring. I am writing a simple website (maybe with facebook capabilities, not sure yet) to display random quotes from GLaDOS – the senile deranged computer from "Portals" – I’m sorry if you don’t like her, I think she’s great, with excellent quotes such as

The Enrichment Center promises to always provide a safe testing environment. In dangerous testing environments, the Enrichment Center promises to always provide useful advice. For instance, the floor here will kill you. Try to avoid it.

And my favourite:

Did you know you can donate one or all of your vital organs to the Aperture Science Self Esteem Fund for Girls? It’s true!

Anyway! Keep going off a tangent. Resharper speeds up development of an application, and the way I seem to work, is I write the code, then refactor it to make it all shiny and proper. We go from this:

image

To this:

image

Via:

image

And other assorted Resharper menu items – the quickest (I find) is to use Control-Shift-R which will allow you to dynamically use a "Refactor this" menu that will pop up, and give you only the valid things you can do with Resharper (instead of a very large list with things greyed out, like in the menu).

Im currently running Resharper Nightly build #783 – it dosent seem too bad, but it still has errors. Unlike Derik, I cant leave Resharper (arguably the love of my life) alone, I want to feel her up and touch her inappropriately. Im not that fussed by the fact that she doesn’t have manners, or farts uncontrollably in bed, I still love her.

Written by Monty

April 28th, 2008 at 1:53 am

Posted in .NET, Bad Humour, Misc

Tagged with ,

Stored Procedures are BAD

with 2 comments

This seems to be a really controversial topic between developers. The "Old Skool" developers insist that Stored Procedures are better, faster, and more secure. Maybe 5 – 10 years ago this was the case, but unfortunately these days, it isn’t.

"Its More Secure"

Err, not anymore its not. You can have parameterised adhoc SQL :

WindowClipping (155)

That is fully functioning code (Albeit it wont work, because of no connection string etc etc etc). Sql Injection wont work with that code.

"Its Faster"

Since SQL 2000 SP4 (I think?), SQL Server now caches the execution plan for adhoc queries too – assuming you run the same query, and only change parameters. And if speed REALLY is an issue, instead of trying to squeeze 0.004% extra speed out of the query (WOW It runs in 58.9 seconds instead of 59 seconds!), maybe have a look at clustering the database.

Other reasons I don’t like Stored Procs

People who insist that you have to write stored procedures for all database operations need their head examined. Writing a stored proc for simple CRUD is a waste of developer time, and violates the DRY principle. There is simply NO point in writing a stored procedure that will insert a record – you can simply do that from adhoc sql, and it will be easier to manage.

If you have logic in your stored proc, then you should read up on n-Tier applications, and separation of logic. The stored proc’s are simply an extension of the Data Access tier – the DA’s tier is simply to fetch the data. IT SHOULD NOT HAVE LOGIC inside it. That’s the job of things higher up.

Personally, I think writing SQL statements for CRUD is soo 1999. We have code generators, we have libraries to speed things up. In the 2 years, I havnt really seen a reason to hand write SQL code for use in apps. Simply point a code generator towards it, and hit the magic button, and you have all your CRUD for you.

Even things like nHibernate I dont agree with – personally I see them as DRY violators too. You have to declare the name of the table in the database, then in the code. You have to declare a column in the database, then use the same name in the code. Where you have more than one point you have to declare something, you will run into problems where one of them isnt upto date.

Written by Monty

April 15th, 2008 at 12:07 am

Posted in .NET

Faulty assumptions waste time

without comments

Iv spent the last 3 hours looking into the Facebook.NET api, which is a headache. I would have expected alot better code from someone who is very high up in the .NET community. The issue is, when visiting this Facebook application, if you don’t have the application added, this redirects you to add the application. I know this is wrong, because I read alot of the Facebook documentation, and it says you dont have to do this. After tracking down the code through alot of painful debugging (Facebook don’t make things easy), I came across this line:

image

Facebook.Web.FacebookFbmlSession.cs line 61

That piece of code, buried deep in the Facebook.Net framework makes a faulty assumption – you can only view this application if you have added it. I have proven you don’t need to do this, the only requirement is to have your self logged into the Facebook application.

Implications?

Basically, the way the Facebook.net API was written, if you want a user to interact with your application, they will HAVE to add the application – this is a pain in the arse for what im trying todo, since I only want certain people to have the application added (and stuff added to their profile) – for simple things like registering a vote, you shouldn’t need to have the application added – only their uid (user id), and we can do the rest.

Way forward?

Well im taking out that line, since it makes a wrong assumption. I’m not sure if it was an oversight on the developers side, or wishful thinking.

Written by Monty

April 6th, 2008 at 2:02 pm

Posted in .NET