Owner: Bell End URL:http://doogalbellend.blogspot.com Join Date: Sat, 24 Mar 2007 17:04:06 -0500 Rating:0 Site Description: "quite amusing and drastically geeky at the same time" Site statistics:Click here
Validating a XOML workflow 2007-06-19 16:03:00 If you're using workflow assemblies, there is no need to validate your workflow since the compilation process has already done this for you. But if you're working with XOML files you'll probably want to validate it at some point before deploying it. Unfortunately there doesn't seem to be anything provided by Windows Workflow just to validate a workflow. The workaround is to start up the runtime and load up your XOML and see what errors you get. You can use something like the following (ripped off and modified from a newsgroup posting) - WorkflowRuntime workflowRuntime = new WorkflowRuntime(); workflowRuntime.StartRuntime(); StringReader stringReader = new StringReader(xomlString); XmlTextReader reader = new XmlTextReader(stringReader); try { instance = workflowRuntime.CreateWorkflow(reader); } catch (WorkflowValidationFailedException exp) { StringBuilder errors = new StringBuilder(); foreach (ValidationErro Read more:Validating
Invalid FORMATETC structure (Exception from HRESULT: 0x80040064 (DV_E_FORMATETC)) 2007-06-19 10:35:00 I've been caught out by this twice now. If you create a new web control by creating a new class and then inheriting from Control (or some other derived class) it will appear in your toolbox, but when you try and put it on a web form, either nothing happens or you'll get the error: Invalid
FORMATETC structure (Exception from HRESULT: 0x80040064 (DV_E_FORMATETC)) This somewhat baffling error message is caused by the fact that when you create a new class Visual Studio 2005 makes it private by default. I'm not sure if this is a good or bad thing, it sure as hell beats the "everything is public, every parameter is passed by reference, every variable is a variant" ethos that used to cause so much horrendous VB code to come into existence. Just a shame the error message doesn't give a clue to the real problem.
Implementing your own workflow type in Windows Workflow 2007-06-19 00:33:00 Windows Workflow is extensible in almost every way. But one thing I didn't realise until seeing this example is that it is possible to implement your own workflow type as well. This looks really interesting. Although the state machine workflow models what I want to do pretty well, I'm not too happy with the UI of the designer so I might have to look into this further. Read more:Windows
, Windows Workflow
Windows Workflow isn't workflow 2007-06-21 16:05:00 Ask anybody who's had any experience of workflow software what it is and they'd likely give you a different answer to the next person you ask. But I'm fairly certain if they took a look at Windows
Workflow they'd probably say it's not what they understand workflow to be about. I'm the same and it's one reason why when I first looked at WF I was a little disappointed. But as time goes on and I play with it more and more I'm realising what a really nice piece of technology it is. In fact I'd say I'm actually very pleased that Microsoft didn't build another workflow system because it very likely wouldn't have met my needs either. There are hundreds of workflow systems out there, all implemented differently from each other and all meeting certain needs and failing to meet other needs. I guess somebody at Microsoft realised this and rather than producing yet another workflow system (YAWFS for short), they wrote a framework for developing any kind of long-running process y Read more:Windows Workflow
Compiling a XOML workflow 2007-06-20 14:33:00 In my last post I talked about validating a XOML workflow. Another way to validate a workflow is to just try and compile it and see what you get back from the compiler. The disadvantage of this approach is the fact you have to start to write things out to file. So I've been validating using the previous method and then just compiling when necessary*. The downside of this approach is the x:Class attribute which can't be present when trying to execute a XOML workflow and must be present when trying to compile it. The simple workaround for this is to add the x:Class attribute before writing the XOML out to a temporary file. Anyway here's the code - // copy to a temporary file and add the x:Class attribute string tempFileName = Path.GetTempPath() + "temp.xoml"; XmlDocument doc = new XmlDocument(); doc.LoadXml(xoml); doc.DocumentElement.SetAttribute("Class", "http://schemas.microsoft.com/winfx/2006/xaml", WorkflowName
Adding icons to custom activities 2007-06-25 14:25:00 In a few places I've worked, it seems like some people's jobs pretty much entails selecting and adding icons to development projects. Nice work if you can get away with it and that's what I spent some time doing the other day. It's actually ridiculously easy to add an icon to a custom
activity. In fact it's just the same as adding an icon for any component. Add the image to your project, set its 'Build Action' property to 'Embedded Resource', then add the following attribute to your activity class.[ToolboxBitmap(typeof(UserActivity), "user.png")]The icon will then appear in the toolbox and will be shown when the activity is rendered in the workflow designer. It's possible to completely change the rendering of the activity and I may investigate that at a later date, but this simple addition seems to provide the biggest bang for buck. Read more:activities
Property Snake 2007-06-24 16:29:00 I remember Fucked Company appearing on the web around the time of the dot-com bubble bursting so perhaps the appearance of the Property Snake
website (along with House Price Crash) is evidence that the property bubble is finally about to burst. That and the more bearish coverage in the press...
Something for the ladies 2007-07-04 10:32:00 Or more specifically any mothers who've stumbled across this site. My other half has set up a website dedicated to providing tips for mothers and parents in general. There are other sites out there providing similar resources (Mumsnet being the obvious example if only due to their legal problems with Gina Ford) but Mums Guide is providing a different angle on things. She was after a link from the Random Pub Finder (due to it getting many more hits than this site) but I couldn't for the life of me think of any kind of link between pubs and parenting. Read more:ladies
Aren't web services meant to solve interoperability problems? 2007-07-03 14:17:00 Somebody has written a web service using JBoss. I'm trying to call it from .NET 1.1 or, heaven forbid, the MS SOAP toolkit. And neither of them can call any operations that have parameters, which kind of restricts what we can do with it. I guess one solution might be to have methods called method1(), method2(), method3() etc all the way up to MAXINT. Doesn't seem a great idea. Or perhaps an ASP.NET 2 web service could call the JBoss web service and expose the functionality as another web service? Yeh it's daft, but it might just work. So could it be the folks telling us web services were the panacea for all our interoperabilityproblems
were actually just snake oil salesmen? Surely not...
The Complicators 2007-07-05 16:19:00 I was under the impression that computing was meant to make our life easier, but it seems there's a bunch of people out there who want to make my life more difficult through poorly thought out APIs or badly designed user interfaces. I call them the complicators. There are three types of complicators. Dumb Complicators - These are the developers who aren't really too hot at programming. They copy and paste and generally fumble around in the dark until they have a solution that seems to work, then quickly move onto the next problem, not thinking too much about how the UI or API they've just produced will be used in the outside world. This may be down to inexperience, the need to get something out there ASAP or just a lack of interest in producing quality software. Evil Complicators - The second group of complicators are a cynical bunch who complicate things to make themselves indispensable to their company. Depending on how cynical I'm feeling, I may confuse either of the
Blogging is like the lottery 2007-07-09 16:17:00 The lottery people Camelot used to say "You've got to be in it to win it". Of course the chances of a big win are tiny but if you never buy a ticket you'll never win anything at all. So it is with blogging, you're pretty unlikely to ever get a big crowd of people to your blog, but occasionally you might get that £10 win. Every post is another ticket in the blogging lottery and every so often you'll get a few hits from one. Which is what happened with my little post about SonicWall on Vista, if only because nobody else has bothered to post about it. And if anybody wants to know, the latest beta still has the same problems for me, Vista complains that two computers with the same IP address are connected to the network. But I'm coming to expect these kind of issues with Vista. Bring on SP1... Read more:Blogging
Annoying Vista UI 2007-07-08 17:15:00 In Vista
, Media Player and Photo Gallery have very similar user interfaces. The toolbar thingy at the bottom of their windows looks almost exactly the same. This is Media Player This is Photo Gallery But the big button in the middle works differently. If I'm watching a video in Media Player, the biggest button on the toolbar pauses the video. In Photo Gallery, it switches to slide-show mode, an operation that takes several seconds and I never want to do. If I'm not thinking about what application I'm in, I'll hit that big button to pause the video and see my computer grind to a halt whilst it does something I don't want it to do. Why have very similar UIs if the buttons do different things??? Consistent UIs are only any use if they behave consistently. Read more:Annoying
Adding services to the Windows Workflow runtime and a simple activity implementation 2007-07-17 15:45:00 There are two groups of WindowsWorkflow
service that you'll come across. The first group are the well-known services that are used by the runtime itself (well-known because they are well-known to the runtime not necessarily to the developer using the runtime...). These are things like the persistence service, tracking service, data exchange service etc. You can use these services out of the box or you can inherit from them and modify them as required. Fortunately a lot of the methods in these services are virtual so you can quite easily hook in new functionality (and quite possibly get yourself in a whole heap of trouble as well). The second group of services are services that can be used by your own custom activities. At this point it's worth considering when using your own service makes sense. For instance I downloaded an email sender activity that required me to configure the SMTP host address and port as properties on the activity. Since i
How rich are you? 2007-07-18 16:44:00 I've got a theory, not a particularly original theory admittedly, that we all think we're poorer than we actually are (something to do with our celebrity obsessed culture). It only takes a few seconds to plug in some numbers to the Channel 4 Rich-o-meter or The Institute for Fiscal Studies' 'Where do you fit in?' page to see how rich, or otherwise, you are. The Channel 4 one is interesting since it allows you to compare yourself to the rest of the world, which shows even a very modest UK salary is pretty damn good when compared globally. The Institute for Fiscal Studies' version is probably more accurate since it is based on household income rather than personal income.
Rain 2007-07-20 17:37:00 So there was a bit of rain today, almost enough to flood our house but not quite. And our roof leaked. But the shed is intact. Then as quickly as it arrived, it stopped. And a few hours later, all the evidence had gone. Here are some pictures.
Visual Studio Express 2008 2007-08-01 16:46:00 I'm a big fan of the Visual
Studio Express
2005 range of products. They cost nothing and are pretty powerful. In some respects they're better than the full-blown version of Visual Studio
. They are super quick to load and if you're using FTP to upload ASP.NET web sites, Web Developer is easier to use than Visual Studio. I've been using it for the FreeFlow web site for a while. So I took the plunge and downloaded the beta 2 of the 2008 version of the C# and Web Developer. First impressions are good. The install was flawless. C# comes with a WPF designer, so I can finally get down to learning that without having to hand-code it. The Web Developer version comes with some AJAX controls so I can play around with them as well. And it's still free. The question is will there come a time when all Microsoft's development tools are free? We're signed up for the Empower program so they are virtually free for us anyway and presumably lots of other companies ar
Road trip 2007-08-07 18:01:00 It all started when my brother read Trek by Paul Stewart. The book describes the story of four people attempting to cross Africa (including the Sahara) in a Morris Minor during the 50s. Unfortunately it all ended in tragedy. Oddly enough, due to this story, we head out on Thursday on a road trip of our own. Not quite as dangerous as crossing the Sahara (although by all accounts, thanks to GPS, even that journey is much less risky than in the past), we're heading off to Spain to see my dad. The original plan was to go in a Rover P4, but the demands of teenagers mean we have to go in an air-conditioned people carrier. From a personal perspective, I also see this as part of the slow travel movement. I haven't worked out the figures but I'm hoping this will be better for the environment than flying (although staying at home would be even better of course) and will be much more fun than being crammed on an EasyJet plane. So move along, there won't be anything to see&
What I learnt on the road trip 2007-08-23 17:39:00 Take as few tents as possible - Campsites in Europe generally charge per person, per vehicle and per tent. Since you can't do much about the first two, the only way to save money is to bring a single tent that's big enough for everybody to fit into. The downside of this is the possibility that your big tent won't fit in the plot, but most sites seem to provide a pretty big space for you. Take some kind of mattress - I've always slept directly on the ground in the past without problem, but the campsites in Europe can have much harder ground than the sites in blighty, with little or no grass, leading to some not very restful nights. Spanish people stay up very late and have exceedingly loud TVs - I guess I already knew they stay up late, but hadn't considered the potential problems when staying in a camp site. Most of Spain takes the whole of August off and some of them head off to camp for a month, along with their tellies. They are then involved in an arms war in an atte
Increment by increment 2007-08-27 15:25:00 Popular music lyrics don't often use the word "increment" so I was pleased to hear British Sea Power use it on their first album. In fact they use quite a few unusual words and phrases. But "increment" has stuck in my head because it's such an important word to me. Take programming for instance. Joel Spolsky calls development "The Game of Inches", but personally I prefer to think of it as a game of millimetres. It's probably partly due to my metric background but also inches suggests you might spot you've made progress after a day, whereas often I'll only recognise some progress has been made on a development project after weeks or months. Perhaps I'm just a slower programmer... The fact is you can't make a lot of headway in a day. Which is probably why agile development has become popular. I'm not sure about parts of agile development but the idea of taking baby steps to get to where you want to be seems like a pretty damn good idea and I've do
Road trip map 2007-09-02 16:02:00 After some fiddling around with Google Maps I've managed to come up with a little map of our journey through France and Spain. It would be way cool if somebody came up with a web app that could be used by normal people to do this kind of thing...
A simple 'Check for updates' 2007-09-25 14:25:00 My brother asks when I'll post something interesting on here, but it hasn't happened yet so I doubt it will anytime soon... Anyway it seems the most boring posts are the most popular so I'll keep on posting crap. Back to the point of this post. Lots of applications these days will check for an update when they start or when you press a 'Check
for updates
' button or menu item. Some really annoying applications have some little helper process that runs continuously and checks on a regular basis then throws up a big dialog telling you that there's an update (that's you Apple). Not wanting to be left out, I thought I'd do the same. But being incredibly lazy, I couldn't be bothered to implement it completely. So this little bit of code will read a text file stored on the web server and tell the user that an update is available. It won't do anything fancy like download it for them or install it but I might add that at some point. Usage is simple, set the Ur
Getting directions using Google Maps 2007-09-20 15:17:00 I'm not sure when this feature was added but Google
Maps now lets you drag your route around, if you want to go via a particular place. I'm not sure how useful this will be for me, but it's certainly cool to play with. Saying that I have asked for a web app to create Google Maps routes previously, and this is certainly heading in the right direction. It's possible to embed the map in a web page via an IFrame pretty easily, but I can't add markers and images, so not quite there yet. I was going to embed the route of my bike ride today but of course it doesn't understand about going off road or, erm, going through pedestrianised areas so I didn't have any luck with that. Another great new feature is the information about bus departures, although weirdly I'm only seeing these in my local area, Kingston. It seems to be getting its information from Transport Direct, a website I've never seen before, but that looks like it goes some way to fulfilling my requ
Buy a people carrier 2007-09-19 15:45:00 It got us to Spain and back in one piece with not a hiccup, but now it's time to pass our trusty vehicle on to someone else. If you're interested then check it out. All reasonable offers will be considered. Read more:people
, carrier
More reliable wireless 2007-09-17 15:49:00 When I set up our wireless router, I initially set it up as an unsecured network and restricted access to certain MAC addresses. This worked fine but when we had visitors who wanted to use our wireless connection, it was a bit of a pain to allow access to their laptop. So I changed the router's configuration so it used WPA security and it all seemed to be working fine. But then a couple of things happened which I didn't realise were related to this seemingly simple change I'd made. First, the wireless connection would stop working every few hours. This affected any computer connected to the network and would typically last a few minutes and then everything would be fine again. This was particularly annoying when I was connected to somebody's VPN and would have to re-establish a connection. The second problem was my Vista PC started to lock up completely. This was less frequent, about once a day. I put the first problem down to the number of wireless networks in close
Are we in a fast moving industry? 2007-09-16 16:20:00 It's virtually taken for granted that we work in a fast moving industry
and the facts would appear to back up this theory. Just look at the new programming tools coming out of Microsoft (I'm just going to talk about them since I don't really even try and keep up with technology coming out of other companies). In no particular order, some of them are: WPF, WCF, WF, Silverlight, Linq, CardSpace, Virtual Earth, ASP.NET AJAX, Vista... But hang on a second, who is using this stuff and how much of it will be relevant in five years time? Myself, the only new technology I'm looking at is Windows Workflow, since it may well be useful in my job. The rest may become relevant at some point and if and when it does I'll start looking at it then. And I'm a geek who likes to fiddle around with new technology. What about the normal people out there who aren't obsessed with software? Well, it doesn't look so good there either. Take IE7, which has been out for almost a year. Usage sta
Handling 404 errors in PHP 2007-09-11 14:00:00 If you're running a PHP site on your own server, you can find out what 404 errors have occurred by viewing the log files. If, like me, you're running your PHP site on a cheap and cheerful host, you're probably not going to have access to the log files. But you can probably still do something to find out about them. The first thing to do is ensure your users see a useful error message, rather than the default provided by your host, which will probably be some page advertising their services. This can be achieved via the .htaccess file, if your site is running on Apache. IIS has similar features, available through its admin tool (although I can't believe there are many people using PHP on IIS). Add something like the following to the .htaccess file to tell Apache to show your custom error page. ErrorDocument 404 /error.phpThe next thing to do is to make sure you get notified if somebody ends up on a non-existent page on your site, so just add the following code to err Read more:Handling
Yet more tick mark fun 2007-09-07 14:56:00 I've written about this three times now. Read my previous posts here Displaying a tick mark in HTML More on tick marks in HTML Even more on tick marks in HTML But it turns out it's not as simple as the browser somebody is using. The other day I noticed that my tick marks weren't displaying on a computer that had IE7 installed. After more fiddling around I realised the fonts installed on that particular PC must be different to the ones installed on other PCs I'd tested and IE7 was unable to find the tick mark. I'm not sure whether IE7 only uses the current font or if it tries other fonts in an attempt to find the correct symbol but in any case it just displayed a square block. Because of this I'm thinking perhaps the only 100% reliable solution is to either use an image or to display a checkbox in all situations, not just for IE6. In a desperate attempt to avoid either of those solutions, I've started using the 'Arial Unicode MS' f
Excel-like select all in a DataGrid 2007-10-02 15:20:00 Clicking on the top-left cell in Excel
selects the whole worksheet, which always seemed like a good use of an otherwise useless cell. So I've done the same with the DataGird-derived control I've been using in one of my apps. It's pretty damn simple to implement, but for the lazy amongst you, here's some code. public void SelectAll() { BindingManagerBase bm = BindingContext[DataSource]; for (int i = 0; i < bm.Count; i++) { Select(i); } } protected override void OnClick (EventArgs e) { base.OnClick(e); HitTestInfo hitInfo = HitTest(PointToClient(Cursor.Position)); if ((hitInfo.Column == -1) && (hitInfo.Row == -1)) { SelectAll(); } }
Radiohead's pay as much you like strategy 2007-10-12 15:40:00 I had every intention of buying the new Radiohead
album from their website. After all, they've done exactly what I've asked for. It's DRM-free and the price is reasonable (since it's whatever I consider to be reasonable*). But I had some problems. First the site constantly timed out when I tried to connect yesterday (which I guess is a good sign since it suggests they are getting a good number of hits). When I did manage to connect and I registered, I was asked for my mobile number, which was a required field. Er, I don't have a mobile. And if I did, why do I need to give the number to you? Unsurprisingly, the album is pretty easy to find from illegitimate sources and there are no hoops to jump through to get it from those sources. So if I wasn't fussed about a bit of copyright infringement, that's what I'd probably do. It's clear the music industry and Radiohead are still missing the point about downloading music. Price isn't the key