Sunday, August 20, 2006
Pompous rock star is hypocrite shocker
Thursday, August 17, 2006
More Windows Live Writer
A comment to my previous post from Spike Washburn (of the Windows Live Writer team no less!) suggests image uploading won't be supported until Blogger improve their API, which is a shame. So Blogger, get your finger out! And apologies if it appeared that I was suggesting Windows Live Writer deliberately wasn't supporting image uploads to Blogger.
A couple of other points about Writer. First, I'm very pleased to see it is a managed application. Great to see MS dogfooding the .NET Framework and proving it's possible to produce professional apps using WinForms.
Second, it's great to see developers from MS responding to blog posts from little old me. Fact is I'm a Z-list blogger that no-one reads but I've had two lots of feedback from MS people. That kind of communication will really help build a good feeling towards MS in the IT community.
And yes, I'm using Writer to write this post.
Windows Live Writer
Just playing around with Windows Live Writer and it's mostly pretty cool. The first problem I've encountered is the lack of image support on Blogger, which is pretty much a showstopper. Odd really, because Blogger does support images, but I guess this is a beta...
More fun with <noscript> tags
The guys at BetterDeal wanted to know why their website didn't rank as highly as some of their competitors. Short answer is inbound links, which seems to be the prime ranking decider used by Google. To illustrate I did a link:www<dot>carbroker<dot>com<dot>au search (replace the <dot> with ., don't want them getting anymore inbound links), which is one of their competitors. The odd thing was that one of their inbound links came from a penis enlargement site. Penis enlargement doesn't have a lot to do with new cars, other than the obvious psychological enlargement for men who buy big red Ferraris. Looking at the source of the penis site (purely for research of course) showed up the reason. The link was hidden away in a <noscript> tag. Car Broker are also the guys who have <noscript>betterdeal</noscript> hidden away in one of their pages slagging off reverse auctions, which is why they rank pretty highly for a search on "BetterDeal reverse auction". Although Google know about this, they haven't done anything about it and their algorithm still doesn't seem to handle <noscript> tags too well...
Tuesday, August 08, 2006
Borland goes Turbo
Monday, August 07, 2006
Land Rover's misplaced marketing
Sunday, August 06, 2006
Richmond Park
Truth be told I don't much like London. When hearing this, people will often trot out the usual Samuel Johnson line, but the fact is Johnson lived in an entirely different London to the one I live in now. But one of the great parts of London has to be Richmond Park (although some people will claim this isn't really part of London, because it's in zone 5). When cycling around its huge area, I can almost forget that I'm anywhere near the busy, unfriendly city I know.
Thursday, August 03, 2006
DesignerSerializationVisibility attribute
Use the tool, tool part 8
Use the tool, tool part 7
Use the tool, tool part 6
Use the tool, tool part 5
Use the tool, tool part 4
Use the tool, tool part 3
Use the tool, tool part 2
Use the tool, tool part 1
Wednesday, August 02, 2006
BPM software comparison
Monday, July 31, 2006
House price crash? I hope so
Friday, July 28, 2006
Windows Live Local vs Google Maps part 2
Wednesday, July 26, 2006
Windows Live Local vs Google Maps
Cunts are still running the world
Tuesday, July 18, 2006
An unobjective review of Metastorm BPM 7
Friday, July 14, 2006
MMC RIP?
Friday, July 07, 2006
How to choose colours for a website
Wednesday, July 05, 2006
Ajax.NET Professional
Sunday, July 02, 2006
England suffer completely predictable World cup exit
Friday, June 30, 2006
How to rescue a Delphi project
Tuesday, June 20, 2006
What is System.RuntimeType?
"RuntimeType is the basic Type object representing classes as found in the system. This type is never creatable by users, only by the system itself. The internal structure is known about by the runtime. __RuntimeXXX classes are created only once per object in the system and support == comparisions."
But this still wasn't much help. So I thought I'd have a hack around. The reason it isn't documented and doesn't show in many searches is because it's an internal class, which makes it a bit surprising I'm seeing at all. But it does have a useful property called UnderlyingSystemType that returns the type I'm interested in. Of course because it's internal I can't access that property. The way round this is via the best thing since sliced bread, reflection. So here is the litle snippet of code I came up with to do just that.object val = reader.GetFieldType(index); Type runtimeType = val.GetType(); PropertyInfo propInfo = runtimeType.GetProperty("UnderlyingSystemType"); Type type = (Type)propInfo.GetValue(val, null);
Update - As mentioned in the comments (only took me three years to respond!), this code is actually pointless. The thing I hadn't noticed is that RuntimeType inherits from Type, so although it isn't possible to deal with an instance of RuntimeType directly, you can just treat it as an instance of Type instead.
Sunday, June 18, 2006
The construction of a disco shed
Thursday, June 15, 2006
The story of an SL-1210
When I was 17, my main ambition in life was to own two Technics SL-1210s and be a world famous DJ. The SL-1210 is a design classic. It has been around in one form or another for over 30 years and it is built to last. Everything about it is industrial strength, except the tone arm which by its nature has to be pretty fragile. The most impressive thing is when you lift up the platter and there isn't any kind of belt, just what looks like a magnet and some coils. I think this was the first direct-drive record deck and although it has been imitated many times, the SL-1210 is still the de facto standard in the world of DJing. But this design comes at a cost. When I was looking to buy one, they cost £400. I scrimped and saved and finally got together the money. In fact I only paid £360, since I was paying in cash. But I only had one, which was pretty useless when you want to be a DJ.
Which is where Ali comes in. Ali was a friend of mine at school. I don't remember when he told me he was HIV positive but it was pretty soon after meeting him. He was a haemophiliac and had contracted HIV from a contaminated clotting factor injection, before testing for HIV had begun. The government had compensated all those who had contracted HIV, so Ali was a well-off young man, though one with a potentially terminal illness.
So Ali bought himself two Technics decks and even got them put in flight cases, for the professional DJ look. We weren't great friends at shool but we ended up at the same university (Newcastle) doing the same degree so ended up becoming good friends. We also started DJing together, after getting an amp and some very big speakers. We were a good pairing, he did bang bang dance music and I did Indie pop with some mainstream pop music.
When I finished uni after four years, Ali had missed a year due to illness and was still trying to finish his degree off. He never got the chance to though. I last saw him during the Christmas holiday of '94. He was in bed and was unable to come out for Christmas drinks, but I presumed it would be another passing illness, like the ones in the past. But not long after he was dead.
At his funeral, Ali's dad told me that Ali had left me his decks. After leaving uni, DJing had dried up, not least because Ali wasn't around to get the contacts, since he was always much more gregarious than me. But I obviously wasn't going to say no.
So now I had three decks, which was too many even if I was still DJing. So I gave my SL-1210 to another of Ali's friends and kept the other two for myself.
Time went on and the DJing thing was obviously never going to happen so I gave one of the decks to my brother Simon, with the proviso he didn't sell it on eBay.
And the other one has been mostly been doing nothing but gather dust for the last ten years. CDs and MP3s have replaced records in my life.
And now I have a shed and space to spare, so out has come the SL-1210. I cleaned it up and threw on one of my ten-year old records and the deck still works perfectly. So thank you Technics and thank you Ali.
Saturday, June 10, 2006
HTTPS and stupid error messages
Ever seen this dialog box appear in Internet Explorer? Chances are you have. And guess what, most people who see it don't have a clue what it means and just get scared that the website they are on isn't as secure as they thought it was. And know what else? It's wrong most of the time when it appears. It will appear when there is a standard link to a non-secure page. Yeh, the other page may not be secure but the user isn't looking at any content from that page. Since it will appear whenever there is a link to a non-secure page, it's very easy to accidentally add stuff to your page that will cause this to show up. I wonder how much time has been wasted by developers getting rid of this? And IE7 doesn't fix it either...
Wednesday, June 07, 2006
Server-side view state
Monday, June 05, 2006
Handling errors in ASP.NET
public static void LogError(string errorMessage) { // log error to database using (SqlConnection connection = new SqlConnection()) { connection.ConnectionString = ConfigurationSettings.AppSettings["connectionString"]; connection.Open(); using (SqlCommand command = connection.CreateCommand()) { command.CommandText = "INSERT INTO Log VALUES (GETDATE(), @Error)"; command.Parameters.Add("@Error", errorMessage); command.ExecuteNonQuery(); } } // send email SmtpMail.Send("webserver@initech.com", "doogal@doogal.co.uk", "IniTech web server information", errorMessage); } protected void Application_Error(Object sender, EventArgs e) { // log exceptions Exception ex = Server.GetLastError().GetBaseException(); StringBuilder errorMessage = new StringBuilder(); errorMessage.AppendFormat("An unexpected error occurred{0}", Environment.NewLine); errorMessage.AppendFormat("Type: {0}{1}", ex.GetType().ToString(), Environment.NewLine); errorMessage.AppendFormat("Source: {0}{1}", Request.Url.AbsoluteUri, Environment.NewLine); errorMessage.AppendFormat("Message: {0}{1}", ex.Message, Environment.NewLine); errorMessage.AppendFormat("Browser: {0}{1}", Request.UserAgent, Environment.NewLine); errorMessage.AppendFormat("Stack trace: {0}{1}{2}", Environment.NewLine, ex.StackTrace, Environment.NewLine); errorMessage.AppendFormat("Session data: {0}", Environment.NewLine); foreach (string key in Session) { string val = string.Empty; if (Session[key] != null) val = Session[key].ToString(); errorMessage.AppendFormat(" {0}: {1}{2}", key, val, Environment.NewLine); } LogError(errorMessage.ToString()); }
Friday, June 02, 2006
Skype rocks
Tuesday, May 30, 2006
DCOM from .NET
Type type = Type.GetTypeFromProgID(progId, serverName); if (type == null) throw new Exception("Unable to find the object, ensure the type library is registered"); Object objTest = Activator.CreateInstance(type); ComObject comObject = (ComObject)objTest;
Thursday, May 25, 2006
Apple finally gets it
Sunday, May 21, 2006
A better link: search
Saturday, May 20, 2006
An alternative to Environment.NewLine
Friday, May 19, 2006
Not Google site: bug
Wednesday, May 17, 2006
Weather Bonk
Google site: bug
Friday, May 12, 2006
SEO made easy
It's a small virtual world
This image shows where the hits to my main website are coming from. I'm blown away by the fact that my crappy little site can attract hits from so many places on earth. OK, people mostly come from the US and Europe, which I guess is due to the higher levels of internet connectivity in those areas, but I've managed to get hits from every continent (OK, if you want to be pedantic I probably haven't had any hits from Antartica but Google Analytics seems to ignore it so I don't know for sure).
My guess is that when air travel becomes too expensive for the average man in the street (which will be pretty soon I reckon) this kind of virtual travel will be the best way to see what goes on in the rest of the world.
Thursday, May 11, 2006
The crazy world of Google
Saturday, May 06, 2006
Milton Keynes are relegated
Monday, May 01, 2006
Pennine Lancashire
Friday, April 28, 2006
Is AdSense worth it?
Tuesday, April 25, 2006
Diabolical dialogs
Sunday, April 23, 2006
Serialization in Delphi
Monday, April 17, 2006
What is wrong with visible instance fields? Part 2
Saturday, April 15, 2006
The fear
Thursday, April 13, 2006
What is wrong with visible instance fields?
Sunday, April 09, 2006
Another tech bubble?
Saturday, April 08, 2006
Virgin Wines are spammers
Thursday, April 06, 2006
Nobody has ever needed to do this before
private ArrayList SplitString(string str, string separator)
Monday, April 03, 2006
The copy and paste anti-pattern
Wednesday, March 29, 2006
For sale: Several IDEs, one careful owner
Friday, March 24, 2006
Beware the ribbon
Tuesday, March 21, 2006
Creating thumbnails in ASP.NET
private void CreateThumbnail(string fileName) { string physicalThumbFileName = Path.GetDirectoryName(Page.Request.PhysicalPath) + "\\images\\" + fileName + "_thumb.jpg"; if (!File.Exists(physicalThumbFileName)) { // create thumbnail using (Bitmap img = new Bitmap(ImageFileName(fileName))) { using (Bitmap smaller = new Bitmap(img, new Size((img.Width*120)/img.Height, 120))) { smaller.Save(physicalThumbFileName, ImageFormat.Jpeg); } } } }The thumbnails are created when the page needs them, thus simplifying the upload process, since there's no need for any manual thumbnail creation.
Thursday, March 16, 2006
SEO works, but it shouldn't
Friday, March 10, 2006
The Road To Guantanamo
There's a reason they are called exceptions
int val = 0;
try
{
val = int.Parse(stringVal);
}
catch (FormatException)
{
}
This solution can be fine when stringVal will generally be a valid int, but if it's used when stringVal is often not a valid int (when reading the value from a config file that by default doesn't contain any value for instance), it can become annoying. Why's that then I hear you cry? Just turn off breaking into the debugger when an exception is thrown and all is well. Well perhaps but I always want to break into the debugger when an exception is thrown. Why not just break into the debugger for unhandled exceptions? Because my applications have a global exception handler to do logging etc when an unexpected exception is thrown. So turning off breaking into the debugger when an exception is thrown means I never break into the debugger for any exceptions, which is less than ideal.
When developers follow this pattern too often, it can actually become increasingly difficult to ever break into the debugger when an exception is thrown. The IDE option can be become impossible to switch on because the developer is thrown back into the IDE so often. When this happens, we've lost a very useful tool and our debugging becomes much more difficult. Having the option always switched on means we are more likely to find those obscure bugs that only happen once in a blue moon.
Another point to make is that this kind of exception handling can affect not only the developers working on your project but developers working on something completely different. I've been working on an ASP.NET project that requires me to run another ASP.NET project at the same time. This other project uses a very similar technique as that shown above which constantly throws me back into the debugger when I'm working on my own project!
So how to solve the problem? In the case of the code above, there are probably several solutions, although they will all require some work. Checking for an empty string often solves the problem in 90% of cases, whilst doing some kind of check of the characters in the string would cover the other cases. For most other scenarios where an exception will be thrown, there is almost always a different implementation approach that does not require exceptions.
Wednesday, March 08, 2006
The Doogal Effect
No, no, no, not the effect I have on people, but rather how the release of the film 'Doogal' (based on the drug-fueled children's programme 'The Magic Roundabout') has affected the hits to my home page http://www.doogal.co.uk.
See that spike? That was the weekend it was released in the US. And it looks to me that it hasn't been too successful since my hits are already back to normal...
Sunday, March 05, 2006
Tab completion in command prompt
Friday, March 03, 2006
Does PageRank matter?
The IT Crowd
Monday, February 27, 2006
Serialization considered harmful
Monday, February 20, 2006
Make your own radio station on the net
Thursday, February 16, 2006
Search engines still have a lot to learn
Wednesday, February 15, 2006
Friday, February 10, 2006
Have you heard of Windows XP?
Windows XP came out about five years ago, but looking at some of the software around you'd never have guessed it. Here's a dialog box from IE7, a pretty new application in anyone's book and yet it still has remnants of Windows 2000 even now. I'll let it off since it's still in beta but it's hardly the only example of the retro look.
The depressing thing is it is so easy to make sure your application uses the correct XP controls. Just search for 'XP manifest' and all will be revealed. In the simplest implementation, your app doesn't even need to be recompiled and it will take about 5 minutes to get up and running. OK, a bit of testing will be required and those screenshots in the manual might need updating but it isn't a big job. So just do it. Not doing it suggests you haven't got the attention to detail required to write a decent Windows application.