Tuesday, November 16, 2004

A Picture speaks a thousand words!

Apparently, there's been a survey in a number of countries around the world about how everyone perceives Britons.

Now the survey says nothing particularly new. We're reserved, polite, sometimes mistaken for cold and snobbish, but at the end of the day we're not a bad bunch. All this, of course, becomes null and void when sport and/or booze are involved. But we knew that already.

What caught my interest, however, was the pictures the beeb chose to accompany the article. They're all shots from hit BBC Comedy Little Britain.

Most amusing. Personally I though that said more about our sense of humour than any survey could have done!

Just wanted to share.

Monday, November 15, 2004

Cheap plug-a-tron

I've finally had a chance to download the first ever Mondays show from Carl & Rory.

This is my cheap plug for it.

It rules. Download it now.

NOW I SAY! GO!

More Mozilla

Okayt, so I've kinda go tused to Mozilla, and it's OK. That'a about it. It's OK. It does the job. It maintains the web-browsing status quo. Except for a couple of things.

The good bit
Tabbed browsing is a neat feature. Not as earth shattering as some people would have you beleive, but neat. Apart from anything else, it does give me an excuse to use my much neglected and seriously under-used middle mouse button.

The Bad Bit
I don't do a huge amount of browsing, but I know a fairly standard page o' HTML when I see it. There doesn't appear to be anything particularly hokey and weird about Rory's site, but I'm buggered if FireFox can render it right. I think it might have something to do with CSS, but I couldn't be sure (mostly because I'm too lazy to dig through and find out.

*** STOP PRESS *** STOP PRESS ***
I have, however, just seen a very cool feature. One that I must admit to being very impressed with. It doesn't quite rock my world, but it certainly makes my CD player skip. FF color-codes the source when you hit 'View Page Source'. Now THAT I can get behind.

Just wanted to share.

Thursday, November 11, 2004

Blogging on Demand #4

This search recently piqued my interest. Not only is it something that's quite interesting, it's also something that, although I've used it a couple of times,I haven't really explored it very much.

"Me.ServiceProcessInstaller1.UserName" (via Google)

The ServiceProcessInstaller works in conjunction with the ServiceInstaller in providing information for, and interacting with Windows' own service installation utility, InstallUtil.exe, for (as the name suggests) installing a service.

These classes should be included whenever you have a service that you want installed (again, the name says it all, really...). Visual Studio and the .NET framework make building Windows Services very easy. Although I haven't got any experience of doing it in the past, I hear services were tricky, to say the least! All you need to do in Visual Studio to create a service is select Add-->Windows Service in the solution explorer. Very Easy . Unfortunately, by default, when you go to install your service using InstallUtil, the compiled executable doesn't have all the information that Windows needs to install it as a service.

The ServiceProcessInstaller is where you set things like the Account Type that the service is going to run under (Whether it's the System Account, User Account etc.). More often than not, you'll be setting the Account property of the ServiceProcessInstaller to ServiceAccount.LocalSystem. The reason for this is that more often than not, you'll be building an application that needs a high privilege to be able to do the things you want (if you've got a service that monitors a folder, for instance, you'll want to make sure your service has access to that folder.

Just a quick note on security (Feel free to skip this paragraph, I'm more thinking out loud than I speaking from actual experience). The best practice is to run your code with the least amount of privilege possible. If you've got a process that needs a certain resource, give it access to that resource AND NOTHING ELSE. You might want to do this by setting up a new user (Ever noticed the ASPNET User account that gets set up when you install the .NET framework?That's what this is). You can also do it by putting together a security policy and deploying it to your machines. This does, however, mean extra stuff that needs to be done at installation, and it can only be done from an account with admin rights on the machine. LocalSystem, while it doesn't really follow best practices, and it does leave your system open to buggering about (Not necessarily malicious buggering about, it could just as easily be just a bit of flaky code. We've all written some of that!), is at least the easiest option when it comes to deployment. I can see from my machine, for example, that all but 2 of the services running on my machine run under the LocalSystem account.

If you do choose to run your services under a User account, the ServiceProcessInstaller is where you might want to specify your username and password. You don't have to put it there, but you may like to. If you don't specify it in there, you will be prompted for it when you go to install each service. I guess the most common need for that would be in a corporate environment where you have a user account set up on all your machines for running a particular service, and don't want to share those credentials with your users.

That's about it for the ServiceProcessInstaller class.

One of the things the ServiceProcessInstaller class does, though, is work with the ServiceInstalller class to get them... Well... Installed. Since you can have an exe that contains a number of services, you need a separate ServiceInstaller for each service within it. The serviceInstaller is where you can specify things like the name that's displayed in the Service Manager console, the Start behavior and things like that. The key properties of note are:

StartType - This can be one of 3 values 'Automatic', 'Manual', and 'Disabled'. You're not likely to use disabled much (I can't think of a situation that would warrant it, anyway...). Automatic means the service will be started up when Windows is fired up. Manual means it won't be started up when the OS starts up, but you can still start it manually either via the Service Manager, or by using a ServiceController in code.
Disabled, as the name suggests, means you can't start it, no matter what. See what I mean about using it when you write a service?

ServiceName - This is, as the name suggests, the name of your service. This needs to be the same name as the ServiceName specified in your code.

DisplayName - This is the friendly, fluffy name you want to appear in the Service Manager. For example, the ASP.NET State Server is actually called 'asp_state'. 'ASP.NET State Server' is it's DisplayName. You don't have to have friendly names, either. SQL Server's service is called 'MSSQLSERVER' (Imaginative, eh?) and it's DisplayName is also 'MSSQLSERVER'.

The ServiceInstaller supports transactions too. It's clever like that. If something goes wrong as it installs a service, it rolls back the whole installation and leaves your computer as if it had never even heard of your service.

By and large, I haven't played about too much in the code behind these classes. Visual Studio has quite a handy little tool that automatically creates ServiceProcessInstallers and ServiceInstaller for you. If you open your service in the designer, and select the service on the design surface, there'll be a handy little linkbutton there that says something along the lines of 'Create an Installer'. Click it, and you'll see your ServiceProcessInstaller and ServiceInstaller magically appear in the designer. You can just go through and change the properties you want to change and Bob's yer uncle. You'll have to go through and do this for each service you've written, but the widget is big enough and clever enough to produce one ServiceProcessInstaller for the executable, and a ServiceController for each service. Clever, eh?

There are a whole host of other things that you can do with ServiceProcessInstaller and ServiceInstallers. These are just the main bits I've used.

It's worth noting, however, that all your service's properties can be changed through the service manager as well. You want to go in and run your service under a User account, no problem, just open up the Service Manager console, and change away. These 2 classes only do their work at the point of installing your service.

If I've missed anything major, let me know. If there's anything wrong, then let me know. Hey, if you know something you didn't know before you read it, then still let me know. Some of this stuff I already knew when I set out, and some of it I learnt on the way whilst writing this post. So it's done it's job, I guess.

Man I wish I lived in the USA

Carl Franklin's posted some pictues on his blog of the DotNetRocks party in Vegas last Friday. It looks really cool.

In the same vein as Phil Weber I think I'm going to have to start a Geoff Maciolek fanclub. Well, not so much a fanclub, more of a one-man web stalking prescence. Or maybe just a bit of a blogliment*.

Man, that Geoff Maciolek really has some fine fine hair, and some fantstic beardage to go with it.

* I just made up that word, 'Blogliment'. It means 'Blogatory Compliment'. I like it. I think I'm going to have to use it more often.

Just wanted to share.

First days with Firefox

Although it's desperately dull, I'm going to add a couple of posts about the funny things I find as I start using Firefox. This isn't meant to be any kind of review, but more of an aide memoir to myself, just in case anyone asks, or anything particularly interesting crops up. Feel free to tune out now.

Firstly, I realised just how little I use a web browser in isolation. Normally I browse the web using the built-in browser in some other application (e.g. Visual Studio, RSS Bandit etc.). The only exceptions are when websites are tryng to do something unsupported or disabled by the integrated browser.

As a result, my initial reaction so far is 'And...?'. I haven't been able to do anything I couldn't do before. I haven't noticed being any more private, or secure. There are a couple of odd behaviours I've noticed - all the text on Neopoleon.com
disappears periodically, and I have to scroll up or down to make it reappear. But apart from that, it's just more of the same, only with more public shouting.

Call me an MS fascist, or call me small minded and stubborn, but y'know, I really can't see what all the fuss is about. Maybe I'm just too much of a grumpy old man.

I've just re-read this post, and man is it dull! Sorry about that.

Just wanted to share.

Wednesday, November 10, 2004

Firefox 1.0 is out.

For the one person on the planet who doesn't know, the much vaunted Firefox 1.0 is out now.

I'll download it and give it a go, I'm sure, but I daresay I'll keep using IE for now.

To quote from the Firefox website:
Why Use Firefox?

Popup Blocking - erm... Well... I've got that already. It works fine...

Privacy and Security - I think most people would agree that Privacy and Security are as much a user's responsibility as they are the software's. I've heard it said (many times!) tat no system can be made completely secure and still usable. SecretGeek has a very nice guide to defensive programming, and making your applications secure. There is also the rather woolly issue of what constitutes privacy. Security's pretty (or at least compared to privacy, anyway!) clearcut. But Privacy? Just look at the 2 main names for internet usage monitoring software. I say SpyWare, you say AdWare. Malicious? Who knows. Easily avoidable? For sure. Killable? Definitely.

Smarter Search - "Google Search is built right into the toolbar". As it is on my machine. The Google toolbar's not that difficult to install!

Live Bookmarks - From what I can gather, this is marketing speak for 'Integrated RSS Aggregator'. Okay, fair enough. If I want to go through my RSS feeds I have to go to the hassle of opening up RSS Bandit (What a drag!). I'll reserve judgment until I play with it.

Hassle-free Downloading - And how much hassle is IE? You've got a bit of a dilemma here when you're putting together a browser, I guess. Do you download a whole bunch of stuff automatically, and face the security consequences, or do you ask for confirmation at every step? Who knows?

S, M, L or XL—It's Your Choice - Yes, it's customizable. My only concern is how that customization fits in with its security and privacy model. Does that mean I can build a plugin that pings my server with the header information of every webrequest made from the browser? Woohoo! Wrap it around a pretty theme, and I've got my piece of SpyWare (or AdWare, depending on who you are) built into the very browse itself! Great! Also means there's more stuff that needs re-installing next time I repave.

Setup's a Snap - Okay, I guess this has just been put in there to attract people who are convinced that software installation is something only to be done by techheads (and there are a lot of them out there)

A Developer's Best Friend - Eh? I have a best friend. I don't want another!

And last but not least, the one thing that I've heard so much about. The one thing that I think has had more coverage than anything else. The one thing that is meant to be the IE killer. Ladies and Gentlemen, put your hands together and give it up for the one, the only...

Tabbed Browsing - Woo Hoo. Tabbed Browsing. Well if that hasn't solved all my problems. Tabbed browsing. I can have an entire group of windows open with only one taskbar item. I can flip between one and the other. Great. Come on. It's tabbed browsing. Much as I like the tabbed interface s la Visual Studio, I don't think it's really so hot as to make it the one selling point for a browser. Is that what we've been reduced to? Getting all frothy about the mouth over tabs.

As I said before, I haven't used it yet myself. I daresay I'll write another post in a few days saying 'Hey, Firefox is da bomb. I don't know how I lived without it!' We'll have to wait and see.

Don't flame me for writing so much about something I haven't used (yet). This is just my take on the marketing spin, and the 'Firefox is gonna kill IE' vibe I've been getting from the news.

At the end of the day, it's still just a web browser.

Just wanted to share. I've seen noting but Firefox Firefox Firefox for the past 2 days...

Tuesday, November 09, 2004

I think I finally get it.

I think I might have had a bit of a revelation yesterday on the way home from work.

Walking along, rain blowing in my face, bit of Metallica on my MP3 player (And yes, Metallica, I did pay for it!), deciding whether to get the carbonara sauce out of the freezer or get the chicken out for tea, and suddenly I saw a light. I don't know if it's the light, but it was certainly bright! This, by the way, has nothing to do with inheritance. Luckily, being cold, damp. tired, hungry and annoyed (the tube was delayed as well!) is not an analogy for inheritance.

I think I finally get it.

I was thinking about a general object 'Item' that you might get in a shop or catalogue. Now up until now, I would have put together a big old class that encommpassed all my functionality, including ordering, (Item.AddToOrder()), Catalogue information (Item.Image) and so on.

In the past, I would have done one of two things:

1) Had a great big IItem interface, and had to implement a whole shedload of dummy methods to make it compile

2) Implement a few extra classes, for orders and so on which contain within them a property 'BaseItem' which returns an item

1's a bit clumsy, and means writing a whole load of unneccesary code.

2 is a little better, but still means writing a whole load of extra code. I mean, to get to it, you're looking at a minimun 3 extra keystrokes to get to a property of the BaseItem ('B', then tab to autocomplete it, then a '.'). Not ideal.

Inheritance is the key. I can create an 'Item' class, implement methods and properteis for the bits that are universal and then create inherited CatalogItem classes, OrderItem classes and so on that expand on that.

Now this isn't anything new or revolutionary. I've just re-read this post and thought to myself 'Yeah. I already knew that. What's the big deal?'

The big deal is this: Although I knew it already. I could probably have even explained it to someone else at a push, and I certainly know what people are on about when they talk about it, I didn't really get it.

Does this happen to anyone else? I mean I've used inheritance in the past, I've expanded or customised frmaework classes to make it work exactly how I want it, I've even fixed bugs shortcomings in my own code using inheritance.

Only now, though, do I think I actually really get it. I might even go as far as to say I understand it.

Just wanted to share.

Thursday, November 04, 2004

That eery feeling...

Did you ever get that eery when you're not sure whether you're looking at a spoof site or not? I remember a couple of years ago, many people got that feeling with www.manmeat.com (I'd link to it, but the site was taken down after too many people got that feeling...).

I got that today reading this company's dress code.

I don't know whether to take it seriously or not. Thw whole site gives the same impression.

It's either an unfeasibly good, creme de la creme company, (for which nobody can work at all. No. Never!) or someone's having a laugh. I still can't work it out.

If you've got any ideas, then let me know. I'm flummoxed.

Just wanted to share my flummoxed-ness.

Ignoring my own advice...

Back in this post, the first rule (more of a guideline than a rule) I made up (from experience, I hasten to add!) was "Know that you know nothing". I've been surprised this week at how right I was. And not just for .NET, but for everything.

I've recently started reading Robert Vieira's excellent Professional SQL Server 2000 Programming, and my, is it good.

I thought I knew a little bit about SQL Server. Although coming from an Access background, I'd read a bit about good database design, I've heard a few people talk about SQL server (mainly on DNR) and can hold my own in a conversation about it. Although I knew there was plenty I didn't know, I thought I knew a few of the fundamentals. Scratch that. I thought I knew enough of the slightly higher level stuff that the fundamentals would slot into place fairly simply. I now know different.

I've just spent an hour on the tube reading all about Indexes. It's only about chapter 4, and a pitifully short way into the book. And my goodness, there's a lot in there to learn. That's good, since I quite like learning new stuff. But it has highlighted just how little I know about what goes on under the hood. I knew, for example, that clustered indexes are good in some situations and bad in others. I knew as well that sometimes table indexes are a bit superfluous and can actually impede the efficiency of your database. At a push, I might even have been able to drag out of my addled brain which situations were right for which. However, after reading this one chapter, I realize that I knew nothing. I kind of knew the 'what', just not the 'why'. Granted, to get to the 'why', there are a whole load of complicated hoops you've got to jump through. The 'why' takes up a whole lotta reading, but still, it reminded me just how little I really know.

I heard someone say once 'The more I know, the more I know I don't know'. Nary a truer word spoken.

On the upside, though, I do sort of know a bit about the 'why' of indexing tables, and even with this little bit of understanding it's sparked off a few questions in my mind about other things I'd like to find out about. Which is good (especially if you're me.)

Note to self: If you're going to offer advice, don't forget to follow it yourself!

Just wanted to share.