Thursday, August 03, 2006
Use the tool, tool part 2
OK, before I get onto .NET tools, a bit of a diversion first into the realm of web based tools and HTTP.
Fiddler is a great tool to see the traffic between IE and any web servers it's talking to. I've used it to track down performance problems and to see what cookies applications are using so I can hack them (meaning interact with them in a non-supported manner rather than steal credit card details...)
If you're interested in HTTP calls that are made through some other app than IE, then TcpTrace is the tool for you. It's a little bit harder to set up than Fiddler (but not exactly difficult) and the UI isn't quite as polished but it gets the job done. It also supports any protocol, not just HTTP.
Use the tool, tool part 1
OK, the title is pinched from an article by Malcolm Groves, but I like it.
After a week of having to work on an XLA written in the worst development language of all time, VBA, I suddenly realised the importance of using the right tools. You can be the best programmer in the world, but if you're using crap tools, your solution will still be crap.
So here is the first in an occasional series of articles highlighting what I reckon are the best development tools. I spend most of my time doing .NET development, so I'm going to concentrate on that side of things.
The first and probably most important tool is your IDE. And the clear choice is VS.NET 2003. OK, it falls over occasionally but I've very rarely lost any work. The choice is also easy just by a process of elimination.
VS.NET 2002 was essentially a 1.0 product, so best avoided.
VS.NET 2005 is a beta, so best avoided. And is just me, or is it one of the most butt ugly pieces of software ever?
Delphi 2005 is, by all accounts, flaky as hell. Note, I still think Delphi is the best development language for Win32 client-side development, but for .NET forget it.
SharpDevelop has one thing going for it, it's free, but other than that, it's pretty poor.
So, almost by default VS.NET 2003 wins.
Next time, more .NET tools
Wednesday, August 02, 2006
BPM software comparison
Over the coming days/weeks/months (depending on when I get bored) I'm going to take a look at some Business Process Management (BPM) software and see if it's any good. What is BPM software? Good question. I'm in no position to give a definitive answer to that and I'm sure a BPM expert would give a different answer but to me it's all about automating all the boring repetitive crap associated with any business so workers can get on with more interesting stuff. Or alternatively workers discover they aren't needed anymore and get shown the door...
The BPM market is growing and there are heaps of vendors out there producing software so I'm only going to look at products that meet one criteria, they have to provide a downloadable demo version of their software I can play with. If a company doesn't have the confidence to provide a demo then I am deeply skeptical of their software.
So the vendors I'll be looking at will be (in no particular order) Savvion, Fuego, Metastorm, Tibco, Fujitsu and Microsoft. I may cover some more if I find they have demo versions I can download. Keep reading!
Monday, July 31, 2006
House price crash? I hope so
When we bought our first flat in 1998, it cost us £99,950. At the time I thought it was a huge amount of money and I thought house prices couldn't rise any more. How wrong I was. Two years later we sold it for £175,000 and bought our current house for £220,000. Again I thought house prices couldn't rise any further and again I was way off the mark. In both cases I wasn't particularly concerned with house prices, since I never thought of buying a house as an investment but rather somewhere to live. Buying was (and still is) cheaper than renting for us since we were lucky enough to buy at a good time. Now our house is worth over £300,000 and by all accounts still rising, although the price rises have certainly slowed down.
If we were starting over and looking to buy a place now we couldn't afford to, certainly not where we bought our first flat. I do wonder who can afford to buy somewhere now. But rising prices don't help us either. If we ever did want to move house, chances are anywhere we bought would be over the magic £250,000 mark, meaning our fees would be about £10,000. I can think of lots of things I could do with £10,000 and handing it over to the government doesn't seem the most appealing option.
The guys at House Price Crash have been predicting a crash for some time, but they are still waiting for it to happen. The sooner the better as far as I'm concerned.
Friday, July 28, 2006
Windows Live Local vs Google Maps part 2
So I tried to switch to Live Local but my first problem with it is a bit of a showstopper. The map doesn't show tube or train stations, so for getting round London it's completely useless. Back to Google Maps...
Windows Live Local 1 - Google Maps 1
Wednesday, July 26, 2006
Windows Live Local vs Google Maps
It all started with a trip to the wilds of Lincolnshire. We'd been there before but I didn't know the way too well, so thinking Google has the answer to everything I thought I'd use Google Maps to give us directions. Turns out the directions it gave us weren't too hot, causing much screaming and shouting between me and my other half who was trying to decipher the instructions. Admittedly where we were didn't help, all the roads and countryside looked the same. In the end we had to call the people we were visiting and ask for their help. Somehow they worked out where we were and guided us in.
So for my next little trip I thought I'd give Windows Live Local a try. I was dropping my brother off at Heathrow airport so searched for directions for that. It's been a while since I've used the MS mapping stuff and it has certainly improved, in fact I think it may well have moved ahead of Google Maps. Google may have been first with the whole draggable map thing but they don't seem to have done a great deal since.
But back to Heathrow, Windows Live gave sensible driving instructions and printing was completely customisable. Google Maps on the other hand suggested a completely insane route, via the M4. For the reverse trip it suggested a completely different insane route via the M25 and M3. Looks like Google thinks motorways are super fast which in the case of London certainly isn't the case.
Final score, Windows Live Local 1 - Google Maps 0
Cunts are still running the world
Jarvis Cocker is back with a new ditty that won't be getting much airplay I guess. Not a great song but I can't help agreeing with the sentiment.
Tuesday, July 18, 2006
An unobjective review of Metastorm BPM 7
First the disclaimer, I used to work for Metastorm, I use Metastorm e-Work/BPM most days for my job and I'm a techy so may not be interested in the same things as a business user of the software. Finally I haven't got my hands on the software yet, so can't comment on stability etc. And because of all that, this review will be completely unobjective and uninformed.
First up, and possibly the least important new change, the name. To my mind, e-Work was a good name, if only because my boss's company ranks highly on the search term 'Metastorm e-Work'. BPM on the other hand doesn't set the software apart from every other BPM product out there. It's like Microsoft calling their word processor software 'Word', what they did? OK, perhaps I'm wrong...
Having had a quick look at the webinar, there are quite a few new features. Metastorm seem to be making a lot of fuss about the SharePoint integration, I'm not hugely interested in this but if you're a SharePoint shop already it looks pretty sweet and much improved over the previous ActiveX implementation, perhaps not in features but certainly in acceptability in the corporate world.
The Designer gets a makeover, going down the Visual Studio route with dockable windows, which should be pretty useful in terms of screen real estate. There are new icons, but they look pretty ugly to my eyes. There are a few new features (including the ability to specify roles in a library which made me laugh since this used to be possible until it was pulled out of the product for some reason). You can now find which procedures use which libraries in the database, which is most welcome.
Internationalization has improved but is not complete. It also hasn't been added to the Outlook client which is a shame and perhaps signifies the Outlook client may be coming towards the end of its life.
There is a new Integration Manager, although I'm unclear what this is for, integrating with the bought out CommerceQuest stuff I guess.
Overall I'm pleased to see there has been a reasonable amount of time spent on the core product, rather than features required to be buzzword compliant (anybody using that rules engine integration?). My personal bugbear with the product is the e-Work scripting language that just isn't powerful enough as a scripting language. Unfortunately the integration with other scripting languages still needs improving and it looks like these two issues haven't been addressed at all.
Friday, July 14, 2006
MMC RIP?
I never quite understood the point of Microsoft Management Console. It is a framework for building administration tools that allows end users to create their own admin environments by adding together as many 'snap-ins' as they like. But the cost of this is that any snap-ins have to fit into the MMC framework, which is fairly inflexible and forces an Explorer style interface on every snap-in. And who actually uses the customisation facilities provided? I certainly don't and have never seen a machine where the admin tools have been customised. So I was intrigued to see that the main admin tools in SQL Server 2005 are no longer MMC-based, they are just standard Windows applications (written in .NET methinks). So although Microsoft continue developing MMC (version 3 is coming out soon with support for .NET based snap-ins) it seems to me that the end may be nigh for MMC.
As an aside, I helped develop an MMC snap-in for some software I worked on. Although they are generally pretty tricky to develop, Colin Wilson has written a great Delphi component set to help with the job if you really must develop one.
Friday, July 07, 2006
How to choose colours for a website
With my grade E in GCSE Art, my art skills have never been up to much. So my website colour choices have always been pretty ugly. I was therefore very pleased to find Colour Blender, which makes the choices for you.
Wednesday, July 05, 2006
Ajax.NET Professional
As always I'm late to the party, but I've finally got into some AJAX development. Since the project I'm working on is an ASP.NET 1.1 website, Atlas is no use to me, so I was pleased to find the free Ajax.NET toolkit. It makes development of AJAX based websites really simple. Add a line to web.config, add an attribute to a server-side method and then call it from client-side Javascript, it's that easy. The lovely thing about it is the way it copes with classes as well, my server-side method can return a class that can then be used in my client-side code. It may not actually be using magic but it sure feels like it.
Sunday, July 02, 2006
England suffer completely predictable World cup exit
It came as no great surprise to see England getting knocked out of the World Cup yesterday. As ever, the first time they had to play a decent team, they failed to progress. But what made this worse than previous efforts was that we appeared to have a squad capable of making a real challenge. Unfortunately our manager was clueless and decided to only bring 3 strikers (OK 4 if you count Walcott who Sven was clearly never going to select), 2 of whom were not fully fit. That meant when Owen was injured we were forced to play a formation that clearly didn't work. If we'd been able to play a more attacking formation, we might have got a goal that we could have protected when we went down to ten men. But with two strikers, Rooney would probably not have been so frustrated in the first place and might have been on the pitch for the whole match.
Friday, June 30, 2006
How to rescue a Delphi project
Delphi has been around a long time and there is a lot of Delphi code around but there aren't so many people around to work on it anymore. Developers are moving onto more modern technologies. To me it looks like the people who continue to maintain this code aren't always the most technically proficient so due to this and the fact that the code is getting long in the tooth means projects are becoming a bit of a mess. These days if I'm asked to look at some Delphi application, it is invariably in a bit of a bad state.
So how to deal with this situation? How can these ill projects be rescued? These are the steps I've been taking with the latest bit of code I've been asked to look at.
First up, I added all the source to source control. Without source control, you're doomed. There are plenty of source control products around, many of them free. I've been using SourceGear Vault, because it's free for a single user and does averything I need.
Next, I attempted to compile the project. The main problem here was libraries I didn't have. Fortunately these were all available free, so I could compile it quite easily.
Now it was time to see what the code was actually like. Unsurprisingly it was a bit of a mess. Compiling with hints and warnings on generated several hundred warnings and this was before I noticed somebody had put the {$WARNINGS OFF} compiler directive in several files... Warnings are there to help and can generally be fixed pretty easily, so don't hide them!
Fixing these errors took some time but helped to learn about the code. I'd recommend removing all code that is never called and all commented out code, there is no point learning about code that is never actually called. And it's always recoverable from source control. Also searches through the project that throw up commented out code are generally pretty annoying.
Another great tool for finding problems in Delphi code is Pascal Analyzer, which finds lots of things that the compiler will miss. Even the trial version has enough functionality to be useful.
Reading the code can give you clues about a few things as well. Given that the developers of this code had a habit of leaving in lots of commented out code, my guess is they didn't use any source control. I'm also guessing they started work on this a long time ago, with lots of pointer based operations and references to WinTypes and WinProcs (which if I remember correctly was removed after Delphi 1).
So this is where I'm at now. What I need to do now is take this Windows application and convert some parts of it into a web service. This is where it could get interesting...
Tuesday, June 20, 2006
What is System.RuntimeType?
I was trying to get the metadata for a query coming back from SQL Server. I'm not interested in the data, I just wanted to know what the columns were in a particular table. So I was executing a query like so - 'SELECT * FROM blah WHERE 1=0'. When I executed it, I took the DataReader returned and used GetName to get the names of the columns and GetFieldType to find out the types. Perhaps there is a better way to do this but I'm unaware of it. But weirdly, GetFieldType returned System.RuntimeType for every column. I thought WTF is that? A quick Google then a quick Yahoo and quick MSN didn't show up anything useful. The only thing I could find was the comments from the MS Rotor source which said
"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
Here are some photos of the construction of my disco shed. I'm very pleased with the final outcome and I learnt a few things on the way. First I discovered that air-raid shelters are very difficult to pull down, especially when the bolts are all rusted in. Cutting through them with a hacksaw takes a flipping long time. Then I learnt that laying a concrete slab is a pretty big job. When I calculated I needed 68 bags of ballast (which is sand mixed with gravel) I thought I'd made a mistake. In fact it turned out I actually needed more. A cement mixer was pretty much essential as well. Also, getting the base level is quite important. Mine is a little bit out so my chair rolls down the slope when I'm sat at my desk. Not so bad that I fly out the door, but if I'd made more of an effort to get the base exactly level I wouldn't have the problem.
Finally, a disco ball is absolutely essential for the modern 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
There was a reason for adding the user-agent string to my ASP.NET error handling code, some errors are browser specific. One bug that has been biting me is view state getting corrupted. View state is a big chunk of base-64 encoded data that gets passed from the server to the browser in a hidden field. The browser does nothing with it (or at least it shouldn't) except pass it back to the server in a post-back. Unfortunately it seems some bug in FireFox causes the data to get corrupted for some of our pages which then causes our app to blow up when the data gets posted back. But more weirdly, there doesn't seem to be any mention of this bug when I Google for it. The conspiracy theorist in me thinks this may have something to do with the geek community not liking to say anything bad about FireFox, but it's more likely that this is is just a very uncommon bug.
Anyhoo, there seems to be a pretty good fix for this. This article describes how to store view state server-side. Not only does this solve the problem, it also reduces page size quite dramatically. Of course the downside is that server memory usage is increased.
Monday, June 05, 2006
Handling errors in ASP.NET
It would be nice if my sites never crashed, but unfortunately they occasionally do. First off I don't want users to see the ugly ASP.NET error page, so I add this to web.config.
<customErrors mode="RemoteOnly" defaultRedirect="error.html">
<error statusCode="404" redirect="index.aspx" />
</customErrors>
I redirect to a HTML page, just in case ASP.NET is so ill it can't display an ASPX page (although whether it will be able to redirect at all is open to question). The exception to this is 404 errors which are redirected to the home page.
The code below is what I use to handle unexpected errors. This is added into global.asax. Some people will say log errors to the event log but I prefer logging to the database because it's easier to configure. By default, the ASP.NET user can't write to the Application event log. You can set up your own event log, but again this requires some configuration. Most projects have a database back-end, so I just need to add another table.
I also send out an email so if there is a serious problem, I get notified pretty quickly. Note, the error also includes the full URL so if a test server or development machine starts sending out error emails, it's clear it's not a real problem. You could also configure this from web.config.
Update - Now logs more information about the error, such as the type of browser making the request and any session data. Any objects being stored in session data must have a sensible ToString() implementation
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
OK, so I'm about 12 months late but I've only just got round to using Skype on a regular basis and it's great. Most importantly it just works. I've had long conversations with people in the US and Australia and it drops out very rarely. Compared to my experiences with Yahoo Messenger (where conversations tended to consist of 'what was that?', 'you still there?', 'I'll call you again, see if it's any better', 'can you type out whatever you're trying to say', 'I give up, I'll call you on the landline') this is very pleasing.
Any negatives? Sending files can sometimes be very slow (but this is still better than MSN which sometimes just refuses to accept files) and I can't seem to find a way to search through past chats.
And it's written in Delphi, so perhaps there is life in the old dog yet.
Subscribe to:
Posts (Atom)