Mad Props!

Omniscience is just a Google-search away.

Login

You're reading Mabsterama, the weblog of Matt Hamilton. Enjoy your stay.

Comicster 4 Released!

Comicster users have waited quite a while for a new version, but the wait is over! Today sees the release of Comicster version 4!

Download Comicster 4 Here

Comicster 4 is a ground-up rewrite and features a revamped user interface. The familiar folder/trade/title tree is still there, but now we have a separate list of issues. Select a folder in the tree, and all the issues underneath that folder will be displayed. Select a character, and every issue that character appears in is displayed. It’s totally context sensitive. Here’s a screenshot – click to embiggen!

image

This version of Comicster has (limited) support for plug-ins, both for file formats and for online catalogs. I don’t yet have anywhere formal to get plug-ins from, but once I do I’ll make one available that existing users will appreciate: one that’ll let you open your Comicster 1.x collections. If you’re desperate to switch to the new version, leave me a comment here and I’ll send you the plug-in directly with instructions.

Let’s consider this a “public beta”, because I’m sure you guys will find little niggles that I haven’t caught yet. Make sure you let me know if something is horribly broken.

The source for this version of Comicster is available online. If you want to look behind the scenes and see how the sausages are made, check out the repository on BitBucket! If you do find problems, you can log them there under the “Issues” tab.

I hope you enjoy using Comicster, or learn something from the source. I’m switching to v4 now for my own catalogue. Time to organize those comics!

A Look Back at 2010

2010 has been a really good year.

In April I was awarded the Microsoft MVP Award for Client Application Development, which was a huge milestone in my career. I don’t know if I’ll ever get it again, but it at least lets me attend the MVP Global Summit in 2011 which I’m really looking forward to.

Throughout the year I’ve continued to attend (and often present at) the Albury/Wodonga .NET User Group. Attendance has been down, but we have a core group of passionate coders who are all great guys. I hope we’re able to swell the numbers somewhat next year.

I started my first open source project, Halfwit, and rewrote it in the form of Halfwit 2, whose source I will make available when TweetSharp v2 is released. Halfwit has a few users out there, but more than anything I hope it has helped someone with WPF, either by looking at the source or by reading some of the blog posts I’ve made about it.

Speaking of blog posts, I managed to get hold of http://matthamilton.net in 2010 and started a coding-oriented blog there. Mad Props is now a personal blog and you’re unlikely to see many code samples here from now on.

My development blog runs on FunnelWeb, which is an open source project that I helped kick off this year. Of course, it was open source for a while before I got involved, but Paul Stovell, Aaron Powell and I gave it its new name and new home on Google Code, and we’re seeing more and more FunnelWeb blogs pop up as “real developers” adopt it. FunnelWeb was a great way for me to get exposure to ASP.NET MVC, and I’d like to think that it serves as a reference ASP.NET MVC 3 application.

I’ve also starting working again on a WPF version of Comicster, which is really coming along nicely. My work on FunnelWeb introduced me to Mercurial as a version control system, and I’m using that (via BitBucket) for Comicster too. There’s a conceptual chasm between Subversion and Mercurial, but I think I’ve bridged it and I’m really starting to enjoy working with Hg.

While on the topic of software development: I attended both DDD Melbourne and Code Camp Oz this year. I hope to be able to get to more conferences of this kind next year – perhaps DDD Sydney and/or Remix. Fingers crossed. The conferences are a great technical resource, but more than that they’re a great way to catch up face-to-face with people I converse with every day on Twitter.

In August/September/October Sal and I travelled to the UK and Europe (via Dubai) which was my first time in a non-English-speaking part of the world. (Unless you count New Zealand. Heh.) The trip was outstanding and one I’ll look back on fondly for the rest of my life. I hope to do something like that again one day, but probably not for a few years!

2010 was something of a gadget year, with me purchasing a Zune HD from eBay, a Kindle 3 for Sal, and getting a Kinect for Christmas. I also bought a new PC which has been kick-ass as a development box and a media centre.

I think I’ve covered all the big ticket items from the year. I look forward to 2011 – I think it could be even better!

Xmas Haul 2010

As per tradition, the haul from 2010!

We also received a restaurant voucher for Gigi’s of Beechworth from the folks, which I’m sure we’ll be putting to use ASAP!

Merry Christmas everybody!

Halfwit 2 Public Beta

Halfwit 2 is now available, in what I’m calling a “public beta”. I’m calling it a beta because I know there are one or two little glitches, and still a few features I’d like to add.

The Halfwit 2 user experience is essentially identical to Halfwit. There are a few minor additions and changes:

  • A new “Retweets” button on the toolbar that takes you to a “Your Tweets, Retweeted” timeline
  • A more comprehensive username autocomplete that looks for users mentioned in tweets as well as those who authored them
  • A “conversation history” view (shift+click on an “in reply to” link to view the full history of a conversation)

Other than that, the memory usage is right down and the performance is right up.

Also, Halfwit 2 has the beginnings of a plug-in architecture, so you can be notified of new tweets. I’ve been working on a Windows 7 Taskbar Icon Overlay plug-in, and Brian from Growl for Windows has his own plug-in in the works. Look for announcements regarding their availability soon. I’ve also included a “Safe Mode” feature to run Halfwit 2 with no plug-ins loaded (hold left-shift down when you launch) in case anything goes awry with a plug-in.

 

You can install Halfwit 2 side-by-side with Halfwit without any issues. Be aware that they share the same icon, so it may be a little hard to tell which is which! I’d advise uninstalling v1 before you try v2. Have fun!

Is This an SSD I See Before Me?

Yes! It’s my new OCZ Vertex 2 120GB solid state drive! And look at what it did to my Windows Experience Index!!!

image

You may remember that the bottleneck in my previous WEI score was the hard drive. Well, no longer! 7.4 will do me very nicely, thank you very much! :-)

Right now the drive is sitting on the floor of my PC rather than screwed in, because the screws that would normally attach it to the drive bay won’t fit into the holes provided in the 3.5” adapter. I’ll probably just duct-tape it to the inside of my PC, MacGuyver-style.

It’s interesting to note that my Processor index has dropped by 0.1 for no apparent reason. It’s the same CPU so I don’t know what’s going on there. Never mind – it’s still insanely fast.

Foiled Again!

Too good not to share! I returned to work today after our eight week vacation across Europe and the UK, to find that my co-workers had done this to my office:Foiled Office

Every single thing was hand-wrapped in aluminium foil. Every pen, every CD, every cable. Took me about an hour, and three trips to the bin outside, to get working.

I’m just glad they thought to unplug everything from the mains power before they started!

AWDNUG August 2010

After a month off in July, the Albury/Wodonga .NET User Group met again last night. Numbers, as usual, were down, but it was an enjoyable meeting.

Nathan demonstrated SpecFlow, a behaviour-driven development framework for .NET, in which you write your “specifications” as “features” and “scenarios” in a plain text, human-readable format, and match them to actual code in the form of “steps”. I was sceptical at first, but having seen Nathan’s demo and watched Rob Conery’s Tekpub video, I’m starting to think that this might be a valuable tool – especially if you’re designing an application from scratch.

Unfortunately I’ll be away for the next two meetings, since Sal and I will be travelling around Europe and the UK. It’s a dirty job, but someone’s gotta do it! I’m sure the guys have some interesting presentations and discussions lined up, so do consider coming along to the meetings. You never know: you might even learn something! Winking smile

Halfwit Hits Version 1!

Last night I released version 1.0.0.0 of Halfwit, my streamlined Twitter client.

As of version 1, Halfwit requires the .NET 4 Client Profile, but if you don’t have it it will be downloaded and installed at the same time.

The only new feature in v1 is URL shortening, and at this point it’s still something of a work in progress. The idea is that you type (or paste) in the URLs you want to tweet about, and then you have the option to shorten them. Here’s a screenshot (click to embiggen):

URL Shortening Screenshot


The idea is that you can choose to shorten a single URL in your Tweet, or shorten them all. I’ve forgotten to include the keyboard tip next to the “Shorten All” menu item in this release. For reference, it’s Ctrl+Shift+U. Hit that just before you hit Enter and all the URLs in your tweet will be shortened for you.

Right now, URL shortening is limited to the http://is.gd service. I have plans to add others (and, obviously, a way for you to choose which one you prefer) in a future version.

To try out version 1 of Halfwit, you should first uninstall the current version. Because this one requires a new version of the .NET framework, I decided not to automatically update users of version 0.x. Once you’ve uninstalled, you can click here to take you to the Halfwit v1 install page. I will update the Halfwit home page later to point there too.

Hope you enjoy using Halfwit! Remember, all feedback is appreciated, be it on Twitter, UserVoice or Codeplex!

Give WPF’s DatePicker some Keyboard Love

I’ve just started using the DatePicker control from the WPF Toolkit for .NET 3.5 SP1. DatePicker is built into .NET 4, but for reasons I’ve already explained, we’re stuck on 3.5 for the time being.

Anyway, the DatePicker is a simple enough control. It has a TextBox where you can type in a date, and a button that pops open a calendar if you prefer to use the mouse.

For us keyboard junkies, though, it’s lacking a few little niceties. For example, I want to be able to use the up- and down-arrow keys to increment and decrement the date. I’d also like to be able to jump straight to today’s date using Ctrl+D – a habit I picked up from using Microsoft Money for many years.

So here’s some code that will introduce those keyboard shortcuts into all the DatePickers in your application. Basically I’m using the EventManager class to set up a “global event handler” for the PreviewKeyDown event on the DatePicker.

First, override the OnStartup method in your App class (in App.xaml.cs):

protected override void OnStartup(StartupEventArgs e)
{
    base.OnStartup(e);

    EventManager.RegisterClassHandler(typeof(DatePicker),
        DatePicker.PreviewKeyDownEvent,
        new KeyEventHandler(DatePicker_PreviewKeyDown));

Next, define your “DatePicker_PreviewKeyDown” method in the same class:

private void DatePicker_PreviewKeyDown(object sender, KeyEventArgs e)
{
    var dp = sender as DatePicker;
    if (dp == null) return;

    if (e.Key == Key.D && Keyboard.Modifiers == ModifierKeys.Control)
    {
        e.Handled = true;
        dp.SetValue(DatePicker.SelectedDateProperty, DateTime.Today);
        return;
    }

    if (!dp.SelectedDate.HasValue) return;

    var date = dp.SelectedDate.Value;
    if (e.Key == Key.Up)
    {
        e.Handled = true;
        dp.SetValue(DatePicker.SelectedDateProperty, date.AddDays(1));
    }
    else if (e.Key == Key.Down)
    {
        e.Handled = true;
        dp.SetValue(DatePicker.SelectedDateProperty, date.AddDays(-1));
    }
}

Note that I’m using “dp.SetValue” in this code rather than just assigning a value directly to dp.SelectedDate. The reason I’m doing it this way is that the SelectedDate value might be data-bound. If it is, assigning a value to it directly will “cancel out” the binding.

The “global event handler” trick with EventManager is a very powerful and flexible way to add application-wide behaviour to any control. Give it a try!

Creating a WPF Style in Code

The other day I was designing a page in WPF, and wanted to show or hide a TextBlock depending on whether one date was after another.

Both dates were stored in properties on the DataContext of the page, so theoretically I could have gotten to either of them via a binding. I have an “AtLeastConverter” class which will return true if the supplied value is equal to or greater than the converter parameter, so I decided to use that.

So I wanted to do this:

<TextBlock.Style>
    <Style TargetType="TextBlock">
        <Style.Triggers>
            <DataTrigger Value="True">
                <DataTrigger.Binding>
                    <Binding Path="Date" 
Converter="{StaticResource AtLeast}"
ConverterParameter="{Binding Pig.WithholdDate}" /> </DataTrigger.Binding> <DataTrigger.Setters> <Setter Property="Visibility" Value="Hidden" /> </DataTrigger.Setters> </DataTrigger> </Style.Triggers> </Style> </TextBlock.Style>

The problem, of course, is that you can’t bind the ConverterParameter property – it has to be a fixed value. I could have created an IMultiValueConverter and passed both values in, but I figured if I was going to write code, I might as well take the YAGNI approach and write it just for this one page.

So here’s the equivalent code in the constructor of my page. It creates the same style in C#, and assigns the correct value to the ConverterParameter of the Binding without having to bind it (since I know it won’t change during the lifetime of the page):

WithholdWarning.Style = new Style
{
    TargetType = typeof(TextBlock),
    Triggers = 
    {
        new DataTrigger
        {
            Value = true,
            Binding = new Binding("Date") 
            {
                Converter = new AtLeastConverter(),
                ConverterParameter = _removal.Pig.WithholdDate 
            },
            Setters = 
            {
                new Setter 
                { 
                    Property = TextBlock.VisibilityProperty, 
                    Value = Visibility.Hidden 
                } 
            }
        }
    }
};
This is making use of C# 3’s wonderful object and collection initializer syntax, which really tidies up what could otherwise be very messy code. In the end, the C# doesn’t look dissimilar to the XAML – it just has more curly braces and no angle brackets. It’s nice to know that there’s always an alternative.