Saturday, January 07, 2006

Quickly...

Just in case anyone actually visits this blog 'in person' (rather than subscribing to the feed) the comments seem to be on the blink at the moment.

If they're not sorted out shortly, I think I might move back to Blogger's native commenting system. It's been made much better since I first moved aaway from it all those many moons ago...

If you don't visit the blog itself (You're not missing much. I really need to have a sit down and redesign it) then ignore this post.

Anyone for Windows Live Messenger 8.0?

I have a some invitations to the Windows Live Messenger 8.0 Beta.

mail me here if you're interested.

Just want to share.

Thursday, January 05, 2006

Quick thought before bed

I've heard it said that the biggest security hole in any system is the one between the keyboard and the chair. People (or at least a lot of people) need to be kinda protected from themselves. Particularly when it comes to 'all that technical stuff' like computers. Which is a shame, considering how ubiquitous they've become.

Here's a really tiny thought, but one that only occurred to me today.

Would it really be that hard to have a header or a flag or something on a web page that told the browser that under no circumstances should they cache, autocomplete, or in any way retain on the computer and values put into a form?

Just occurred to me today when Firefox autocompleted my bank details and password when I was paying some bills online.

Don't get me wrong, most of the websites I go to that need authentication have their username and passwords autocompleted. I love it. I'm even right down with Firefox's domain-level password remembering stuff (so if your site of choice puts its session ID in the URL, it'll still complete your details). But there are just some places that I really don't want to be able to do it, event if I wanted to!

PS - Yes, it's fixed now. I was in a rush one time to see my bank statement for various reasons, working on a brand new machine that I hadn't configured yet, so that's why all the details were there. But very few people I know even know how to clear their saved passwords.

Just wanted to share. I'm off to bed.

Monday, January 02, 2006

Well whaddya know?

If you type something into the address bar in Internet Explorer and hit ctrl+enter, it forms a complete .com URL from that word, so enter 'microsoft' and hit ctrl+enter and it'll complete it to 'http://www.microsoft.com'.

This is not new. It's been there for donkey's years, and it even got through to Firefox.

However, Firefox took it one step further.

FF completes the addresses with the following top-level-domain extensions:

Key comboSuffix
CTRL+ENTER.com
SHIFT+ENTER.net
CTRL+SHIFT+ENTER.org


Who knows - there may even be more. I just haven't found them yet, though.

Discovered it on the last day I was at work before christmas. Been running round like a madman since then, though. I'll be glad to get back into the office for a break!

Anyway, hope y'all had a good one.

Just wanted to share.

Saturday, December 03, 2005

Quick SQL Reporting tip

I usually have to customize the data that's presented in a report in SQL Reporting services based on the currently logged in user. I'm guessing I'm not the only one.

The good news? It's really really easy!

What you can do is simply create a new String parameter (called something imaginative like 'CurrentUser' or something). When you create the parameter in the report designer, it'll give you a bunch of configuration options for the parameter. The main one you're interested in is the Default value.

Select 'Non-Queried' from the radio button list on the left, and then in the text-box that's enabled, enter the following function:
=Right(User!UserID, len(User!UserID)-instr(User!UserID, "\"))
Looks ugly, yeah? But it's quite logical, if you break it down a bit:
Right(string, length) gives you the right n characters of string. So if you entered Right("Monkey", 3) the resulting string would be 'key', the right 3 characters of the work 'Monkey'.

In this context, the string we're initial string is User!UserID. This is a report function that gets the login of the user viewing the report. The value is in the form DOMAIN/USER, which might be fine as is for your reporting. However, when I was using it, I just wanted the name part of the login, rather than both the domain and name. instr and len both combine to give me the user portion of the UserName. len(User!UserID) returns the length of the UserID string in its entirety. So for 'MARVIN\Ben' (my current login) it would return 10.
instr(String, StringToFind) returns the index of StringToFind within String. So taking my current login as an example, instr("MARVIN\Ben", "\") returns 7.
If you evaluate those 2 expressions, the outer expression then reads =Right(User!UserID, (10-3)), which is why the expression returns 'Ben' in my report.

That's not the clever bit, though.

The clever bit lies in the rest of the parameters.

If you have a datasource that requires parameters, say you're pulling results from a stored procedure, the report designer automatically adds those parameters to the parameters collection off the report. Since all the report parameters are evaluated in the order they appear in the list (Or are displayed in the order they are evaluated, if you like) you can out your CurrentUser parameter at the top of the list, and then if any of your query parameters need the current username, rather than repeat the function, you ca just refer to the CurrentUser parameter using Parameters!CurrentUser.Value. Just hide those parameters (more on that in a minute), set their defaults to the CurentUser parameter's value, and you're away!

The final stage is to hide the current user parameter. This differs depending on which version of SSRS you're using, but the 2 I know about are:

  1. the SSRS 2005 parameter dialog box has a 'Hide Parameter' check box. Just tick that and you're done
  2. In SSRS 2000 (which is what I'm using at home) if you clear the 'Prompt' value in the dialog, it'll automatically hide the parameter for you
But wait, there's more! Something that I was absolutely overjoyed to find out!

You set the default value of the CurrentUser parameter when the report fires up. Now normally, if the parameter is hidden, that value will never change. However if you un-hide that parameter, you can edit it and re-run the report using that value. This makes it an absolute doddle to debug and test. If you want to test the report output using several different users, you can just do it right there and then. And if you've set all the rest of the report parameters' defaults to refer to CurrentUser, then they'll all pick up the value you enter.

When you're done testing and are happy with the results that are being produced for your users, then you can just re-hide the parameter in the designer and publish the report. Once that's done, your report will produce custom output for each user, with no user intervention required or, in fact, allowed.

Clever eh? I love SQL Server Reporting Services. They're my friend.

Just wanted to share.

Wednesday, November 23, 2005

So much stuff, so little time...

Gah! So busy of late! Been writing lots of C#, and here are my cool features, in no particular order, and with no (at the time of writing) links (Sorry).

  • Refactoring Support
  • Windows Forms designer guide lines
  • Generics - say no more
  • Partial classes

There are so many more as well. I just love it. The joy is back.

Been working on some other cool stuff as well:
SQL Reporting Services - Just check it out. They rule!
SQL Server 2005 in general - Okay, I'm cheating. I'm on a SQL Server 2005 course this week.

Yes. I'm afraid there's nothing new to report. I'm just a jobbing developer, after all. Although I must admit, that amid the furore over the minor bugs that still inevitably remain in VS2005, Mike Gunderloy has some words of sanity.

Not a lot to share, but I have anyway. So there!

Wednesday, November 16, 2005

It's only a real little thing...

... But am I the only person who thinks that it would be a good idea fo a text editor to not only use punctuation and spacing to skip from word to word when you ctrl+crsr, but to include CapitalLetters in how it delimits word boundaries?

It's just been plaguing me over the past few days. I guess the alternative is to learn how to type properly...

Just asking the question...

Saturday, October 29, 2005

Great articles about Generics

Like most people, I daresay, the only way I've really been using generics over the past couple of months is for creating strongly types collections with System.Collections.Generics.List's, but I know in my heart of hearts that that's only half the story. Not even half of it. It's more like the first paragraph in the novel of Generics.

There are some great articles about generics and their use up on MSDN (Gratuitously nicked from the excellent VBFeeds.com)

Generics FAQ: Fundamentals
Generics FAQ: .NET Framework
Generics FAQ: Best Practices
Generics FAQ: Tool Support

Not just sharing, I wanted to remember them as well...

Tuesday, October 25, 2005

A grand day out. And a Grand night in!

So I spent my Saturday in the company of a whole bunch of UK nerds this weekend. And oh my, what a cool day! I've never really been to any real developer events, certainly not one that was so fiercely community driven as DeveloperDeveloperDeveloper on Saturday. And oh my what a day it was.

In keeping with my general philosophy of trying to learn new stuff that I wouldn't really have an excuse to get to know about otherwise (i.e. pretty much avoiding anything that I'm likely to encounter in work) I saw some really great people enthusing about some really cool things.

My personal highlights included:

  • Barry Dorrans being very excited about MsBuild.
  • Liam Westley being very quick and cool about SubVersion (Despite the organisers' best efforts to kleep him off the agenda ;-))
  • Ben Lamb bubbling over with the funky new stuff headed up for C# 3.0

Those are just the ones that leap readiliy to mind. I also saw some cool stuff around the CLR in SQL Server 2005, new stuff in the System.XML namespace and many many more.

It was also just really cool to see so many people there, all of whom sort of share a bit of an interest. I've discovered through my travels in the world of the fledgling developer that it's something of a solitary path to tread. Thanls to all the organisers and attendees who made it such a fun day out. No doubt I'll be at the next one.

And then, to cap it all, got home from Reading only to find that Mrs Mawoo had organised a surprise birthday party for me, so there was much beer, merriment and general fun afterwards as well (although I'm ashamed to say I was the first to leave the party. Sat down for 5 minutes, and all of a sudden all of my friends had gone and Mrs Mawoo was waking me up to put my PJ's on. That's what you get for going out all day then trying to party after!)

And last but not least, a big thanks to John who let me scrounge a ride from my house to Reading. And back. Eventually!

That's it for now. No doubt there'll be more coming. I've got a bunch of tech stuff in my head just dying to come out, but so little time to actually write it! Damned commute! Gah!

Just wanted to share.

Sunday, October 02, 2005

Non Smokers look away now...

I know it's a particularly anti-social habit, as well as being about the least politically correct thing one can do, but I am a smoker.

Even worse, I don't even have the decency to be a victime of smoking. I dont't smoke 'Because I Can't Help It' or 'Because I need to' or any ligitimate reason like that.

I smoke because, bad as it is, and an unpopular an opinion as it is, I actually enjoy it. Every cigarette is as good as the last, and so on and so forth.

I smoke for the same reason some people eat chocolate. It's nice. It makes me feel good and I like it.

So I've just got one thing to say in this post. If you're a smoker, try a shisha pipe. I brought one back from my holiday in Egypt, and it's a really nice smoke. Bought back 4 flavours of tobacco, Cappucino, Pistachio, Apple and Cola (just to see what it was like). I'm working my way through my Cappucino at the minute, and it's really quite nice. Doesn't taste much like coffee, but it certainly has something about it that's coffee-esque.

Really quite nice. And smoing a shisha's very nice as well. I heartily recommend it.

Apologies for irrelevance, political incorrectness and bad-for-your-healthness.