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;
Tuesday, May 30, 2006
It's not well advertised but it is possible to use DCOM from .NET. It may not be as popular as the more recent RPC mechanisms but I still need to use it occasionally. So here's some C# code that should do the trick. The COM type library must be registered on the client machine. ComObject is the type of the COM object that you've imported into an interop assembly.
Thursday, May 25, 2006
Apple have always annoyed me. Many many years ago the original Mac was ahead of its time but slowly Windows caught up and eventually the old Mac OS was looking pretty dated. But still the Apple zealots would ramble on about how great Macs were. We had one of the original iMacs but it just wasn't very reliable, even though it looked quite photogenic. Which was another reason for not liking Macs. Even though 95% of the worlds' computers were Windows PCs, every film with a computer always had a Mac. I recently upgraded that old iMac to MacOS X and was quite impressed. Of course the problem was all the software I wanted to run was Windows software so it wasn't much use to me, so it is still languishing in the loft. But first Apple decided to switch to Intel processors (and seem to have admitted in the process that they are much better than the old PowerPC processors). Then they released software to allow Apple computers to run Windows XP, which solves the major problem for anybody coming from the Windows world. And now they've released a laptop costing as little as £749, which solves one of the other major problems with the Mac, the price premium. It's still there but it's much less than it used to be and I have to admit that if I do ever purchase a laptop, I will now consider an Apple. And that iMac in the loft will be moving into my new office very soon.
Sunday, May 21, 2006
I've known for some time that Google lies when I do a link: search to see which sites link to my sites. Even though I know of sites that link to mine, Google doesn't list them. So I was very pleased to discover that it's possible to use @: instead of link: and many more sites are listed, although it still doesn't show some sites I know link to mine.
Saturday, May 20, 2006
Looking through my logs is always an interesting way to find out how people end up at my blog. One of the most searched for terms is 'Environment.NewLine alternative'. I'm not entirely sure why that would bring you here but anyway, what alternatives are there to Environment.NewLine? On Windows, Environment.NewLine is simply "\r\n", so you could use that, which would save a few key presses possibly (which is the only reason I can think of for wanting to find an alternative). If you're one of the brave people trying to develop a cross-platform app with Mono, then Environment.NewLine will be "\r" on Linux and other Unix platforms. So depending on what you're trying to achieve you may want to go with Environment.NewLine anyway or you may want to hardcode your newlines to "\r\n" or "\r".
Friday, May 19, 2006
So after looking more closely at what I thought was a bug with Google, it turns out it's not. site:http://www.randompubfinder.com/ returns only the pages in Google's main index, site:http://www.randompubfinder.com returns all pages, including supplemental results. What are supplemental results? Basically pages that might show up in search results if Google can't find anything better. So we now have 4 pages in the main index! Unsurprisingly our hits are way down, since most of our traffic is driven by Google. So why did this happen? It seems that Google now won't store all pages in the main index if your site isn't popular enough. By popular, I mean having lots of inbound links. We don't so we get the big heave-ho. Doing searches now that used to bring up links to us now actually shows less relevant results, so I'm not entirely convinced this is helping improve the user's experience. Somebody at Google has written a fairly lengthy article about the latest updates there, with lots of unhappy people leaving comments. Here's a blog post from somebody in a similar position to ourselves.
Wednesday, May 17, 2006
Bonk probably has a different meaning in the US, but other than the strange name, this website is pretty good. I think it's pushing AJAX and Google Maps to its limits, as moving around can get pretty slow, but it has all the weather info you could ever need along with links to webcams. And even better, you can plug it into your own website in about two minutes.
So there I am panicking because the Random Pub Finder seems to be disappearing from Google and today it got worse. Only 58 pages in the Google index apparently. Then I looked at the search string, site:http://www.randompubfinder.com/ So I tried site:http://www.randompubfinder.com and there are 639 pages. Panic over. So it looks like Google has a bit of a bug in its search engine and in Google Sitemaps, which provides the first URL as a link to tell you how many of your pages are indexed.
Friday, May 12, 2006
I think I've made a reasonable job of optimising the Random Pub Finder for search engines. Our average hits are over three times what they were before I did any SEO on the site. I've not done anything dodgy and it's cost nothing. At this point I could claim to be a genius or I could tell the truth and just admit to reading this book. There are plenty of guys out there who will do the SEO work for you (for a price), but it's probably cheaper just to read the book. The disclaimer at this point has to be that the rules for search engines are changing all the time, so this book may well be out of date already...
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
A few weeks ago the Random Pub Finder had over 600 pages indexed in Google, pretty much the whole site, then a week ago it was down to just over 200. Now its bounced back to over 300, but where are the other 300? Who knows. The site has hardly changed during that time so I don't think it's anything I've done. The more I learn about search engines, the less sense they make.
Saturday, May 06, 2006
Football isn't generally any kind of morality play, good things don't always happen to good people and vice versa. But it did today. The most disliked team in England were finally relegated to the 2nd division. Why are they disliked? They uprooted the club and moved it across the country to Milton Keynes from South West London. This may be a common occurrence in the US, but franchising of clubs here has never happened here in the past. Why do I care? If they had been successful then they may have been the first of many clubs moving just to get a few more bums on seats and to hell with the club's fans. Not only that, but the club set up by the fans, AFC Wimbledon, is ten minutes down the road from our house. Unfortunately they missed out on promotion this year, but they are still one division closer to their nemesis.
Monday, May 01, 2006
If you're of a certain age and were brought up in the North West of England, Tony Wilson was probably a big part of your formative years. Not only was he constantly on the local TV news, he also ran one of the coolest record labels of the time and owned the hippest nightclub. Well now he's going to try to help regenerate the rundown parts of East Lancashire. This part of the world is close to my heart and it certainly has some things going for it, it has beautiful scenery, it's very cheap to live there and, OK, I can't think of anything else. Tony certainly has a bit of a challenge on his hands. The towns around East Lancashire have never really recovered from the industrial decline in the latter half of the 20th century. I went to school in Blackburn and of the people I've remained in contact with, only one still lives in the area. My family have also all moved away, so it's no wonder there's a problem with negative equity. I went to a pretty decent school, so all my friends are well educated and probably just the kind of people the area needs to help regenerate it. But they've all moved to well-paid jobs in the South East (except for one friend who's moved to Lancaster, one part of Lancashire that does seem to be doing quite well for itself). That's the main problem Tony needs to solve, getting these kind of people moving back to their roots. Manchester and Liverpool managed to recover from their apparent terminal decline, so I'm sure it will be possible.