Today was my last day at PineSolutions. I’ve had my exit interview, taken home Sackboy, and paid my outstanding coffee dues. I’m a free man, and am on the way to the pub to say good bye to everyone. I’m technically unemployed for the weekend, which I’m going to celebrate by sorting out the tardis cupboard under the stairs. Seems like a metaphorically appropriate thing to do.
I’ve had a great 3 years working at PS, and we’ve done some amazing things. I’ve been lucky to work with some really passionate and talented people, who I’ll miss. Mind you, I’m not leaving the country, so stay in touch!
On Monday, I start at Modality Systems. Modality specialise in communication and collaboration technologies. This probably means that you’ll see an increased number of posts related to unified communication technology here, as my attention and knowledge tends that way.
I’m really excited to have been given the chance to work at Modality. As Microsoft’s UK Lync Voice Partner 2011 they clearly know their stuff, and it’s really exciting to go to a company that’s actively pushing the boundaries of what’s possible.
The other thing I noticed, whilst I’ve been trying to gather information about Lync and Unified Communications in general (so I can hit ground running), is that I keep coming across technical specialists in this area, only to find out that they work for Modality! For me, that was a really encouraging sign, and I’m looking forward to working with such talented people.
If you’ve started a new job recently, you’ll know that the first month or two is 200% brain-drain and early nights whilst you try and get your head round how things are done. If that results in a drop-off in blog postings, I apologise, but it’ll result in new and exciting posts about UC, so it’ll be worth it.
Recently, I was doing something in WPF where I had a table of data to output. According to my book, the ListView ships with a concrete ViewBase class, called GridView, which looks pretty much like the ‘normal’ Window data grid experience.
It was pretty trivial to add in, and takes the format, roughly, of:
<ListView x:Name="MyList" MaxHeight="300" ItemsSource="{Binding}">
<ListView.View>
<GridView>
<GridViewColumn Header="Name" DisplayMemberBinding="{Binding FullName}"/>
<GridViewColumn Header="Hair Colour" DisplayMemberBinding="{Binding HairColour}"/>
<GridViewColumn Header="Eye Colour" DisplayMemberBinding="{Binding EyeColour}"/>
</GridView>
</ListView.View>
</ListView>
So far, so good. I mean, it works pretty much exactly as you would expect it to.
During testing, it came out that it would be handy to be able to sort the grid by clicking on the columns, as you’d be used to do in Windows Explorer. I didn’t think this would be a big deal. In Windows Forms it’s a built-in feature, it happens automagically. However, I couldn’t find an equivalent in the WPF control.
I did find a MSDN article - How to: Sort a GridView Column When a Header Is Clicked – which describes how to attach a click event to the column header click, work out what needs to be done, and sort the results. I made a couple of changes, for instance, I rewrote the Sort function, arguably making it less generic, but much more readable, by adding a SortDescription directly to the ListView control. (In fact, I only did this because I thought it was causing the problems below. I’m pretty sure it would have been find if I’d left it alone.)
Something wasn’t right though. The event was firing, the code looked like it was working, but the list was either getting sorted in a seemingly random fashion, or not at all when I clicked it.
It took me quite a long time to work out why, because there were no errors, and the event always got called, even when it didn’t seem like it was doing anything.
Also, I guess I was a bit blinded by my faith in the MSDN code sample. Eventually, I saw the problem in the sample:
string header = headerClicked.Column.Header as string; Sort(header, direction);
The list is being sorted by assuming that the column header is the same as the binding source property name.
That’s quite an assumption, and I do think MSDN could have called it out better. It works in their simplistic example (column names of Month,Day,Year) but silently stops working for anything more complicated. It’s also why the list was either being sorted randomly (because you’re sorting by something that doesn’t exist) or not at all (once you’ve sorted it randomly once, you’re just repeating yourself).
Anyway, it’s fairly simple to fix, because you can still get at the real binding value, with something like this:
string header =((Binding)headerClicked.Column.DisplayMemberBinding).Path.Path; Sort(header, direction);
With that in place, clicking on the headers now works fine.
About a year ago, I was sitting in a pub with Steve and Rob. We were talking about this and that, when we came up with an idea. Now, I say “we”…but I think I mean “me”…but I don’t want to offend anyone, as it did happen after about 5 pints!
The idea was a plug-in for Visual Studio that rewarded you for good keyboard shortcut use. So, if you commented code with CTRL+K, CTRL+C then you’d get 10 points, that sort of thing. I imagined the points flashing up in the corner, and there being some sort of hi-score online somewhere.
Sadly, like so many of my good hair-brained ideas, I just never had time to do anything about it.
But, it seems I was not alone. The clever chaps over at Channel 9 have created a very similar sort of thing: the Visual Studio Achievements Beta Plugin!
Yes, this is as cool as it sounds. It’s not just keyboard shortcuts – you can be rewarded for a wide selection of things: loading custom VS Settings gets you 5 points, referencing 25 assemblies wins you 10 points, and unlocks the On The Shoulders of Giants achievement.
There’s also a leaderboard, where you can make your development début.
The only criticism I can see is that quite a lot of the ‘achievements’ awarded are for slightly shady, bad practices. I think that’s probably because it’s harder to identify good practice in a way that can be picked up by a plug-in. Mind you, my keyboard shortcut idea still stands, if anyone from C9 wants to implement it!
Get the plug-in from Channel 9 now. There’s also a display widget for your blog/homepage, showcasing your recent software skills.
The guys at RedGate have just released a Beta of a new tool, an extension for Visual Studio called .NET Demon.
Firstly, for everyone: it continuously compiles your code, so that you don’t get the delay when you hit F5. Also, by monitoring the public interfaces of the project your working on, it can make an intelligent decision on whether to re-compile any dependant projects or not.
If you use unit tests, it gets better: tests are run continuously as you develop, so you get instant feedback. In addition, the results of the test results (and coverage) are shown inline.
Because it’s in Beta, you can evaluate this tool, now. For free! Download it from the Visual Studio Gallery, or from RedGate. The final will be paid-for, but this evaluation lets you see whether it’ll make a significant difference to your day.
I’m going to download it and play with it now, and I’ll write up my experiences in a new post.
9am. Mary is writing code.
So…uhhh, yep, that goes there, and then that value gets passed to here…and, oh? What’s that doing there? That doesn’t look right. Hang on, who wrote this? <click, click> Oh, Bob. Well, his code usually makes sense, there’s probably a good reason for this. Let me check.
So, IM, there he is… and he’s online. Great.
09:01 Mary: hey, Bob, you have a second to talk me through some code?
09:01 Bob: yeah, sure, what’s up?
09:01 Mary: OK, I’m in project XYZ, version 3, in the Presenters folder, looking at Car Presenter. I’m at around line 300.
09:01 Bob: OK, OK, hang on. I’m doing something in another project, let me just fire up another instance of Visual Studio
…
09:02 Bob: OK, I’m in. Now, let me just find that project.
…
09:04 Bob: OK, I’ve got the project loaded. Line 300….let’s see… the case statement?
09:05 Mary: That’s not right. Oh, I see. I have it checked out and I’ve added some stuff. I don’t really want to check it in right now as it’s broken. I could make a shelf, but for this, I’ll just email it to you.
09:05 Bob: OK, I’ll shout when I’ve got it.
…
09:10 Bob: Allright, I have the email. Line 300. Oh I see, the constructor
09:11 Mary: Yes, that’s it. My question was…
Time to get to asking question: 11 mins.
9am. Mary is writing code. However, she also has the Lync 2010 Plug-In for Visual Studio.
So…uhhh, yep, that goes there, and then that value gets passed to here…and, oh? What’s that doing there? That doesn’t look right. Hang on, who wrote this? <click, click> Oh, Bob. Well, his code usually makes sense, there’s probably a good reason for this. Let me check.
So, I highlight the code here, click the Lync icon, there he is…and he’s online. Great.
09:01 Mary: hey, Bob, you have a second to talk me through some code?
09:01 Bob: yeah, sure, what’s up?
09:01 Mary: It’s this code here. My question was…
Time to get to asking question: 1 min.
That’s not an unusual scenario, and we’ve probably all had experiences of the first type.
The other great thing here is that Bob doesn’t have to be sitting at a computer running Visual Studio, tapped into the corporate source control system. He doesn’t even need Visual Studio to see the code Mary is talking about. He could be at home, relaxing on his tablet (oh, lucky Bob).
In this plug-in example the code is also editable by both parties, and the originating caller (Mary) can elect to replace the highlighted section of code in Visual Studio with the new version which was the result of the collaboration.
I see this being really useful – not just for geographically disparate teams, but even for developers who sit opposite each other. If you look after a significant amount of code located in lots of different projects, it really does take that long to get to the point where you’re both singing from the same hymn-sheet.
Marcelo Farjalla is a program manager with Microsoft Lync, and the author of the MSDN article above. He talks about the plug-in, and gives a working demo, in this Channel 9 video:
Everyone else does a ‘top tools’ list, so I thought I’d join in.
Before I do though, I must defer to the most excellent Scott Hanselman’s 2011 Ultimate Developer and Power Users Tool List for Windows. I regularly go here to check out what I’m missing out on.
These don’t include things like Windows7, Visual Studio, SQL Management Studio etc. Everyone knows you have to use them (well, for .NET anyway). These are more the “developer’s choice” selection of everything else that makes up your toolkit.
Oh, and another thing. Lots of the tools listed below are included in Ninite. Go and have a look. Basically, you select what you want to install, then download a automated install program which silently install all those applications. Takes no time, no mindless clicking, it’s brilliant for new installs.
In no particular order…
Spotify. I listen to a lot of different music, and like experimenting with different genres. Being able to do so instantly and legally, from anywhere, is brilliant. Get Spotify Premium, it’s only £10 a month, and you’ll save that in your first day if you listen all day at work.
Notepad++. If you develop you need a good text editor you’re happy with and that lets you perform magic tricks with text files. You may not get on with Notepad++, but I do.
Paint.Net. I don’t do massive amount of graphics work, but when I need to crop, rotate, layer and otherwise mess with photos, Paint.Net has everything I need, and it’s free.
CCleaner. This has been around ages. I have absolutly no scientific stats which show that it makes your computer cleaner, faster and a better place to work – but it feels like it does.
MyDefrag (previously JKDefrag). See above.
Evernote. You can use any note-recording software you want, but try and use something. It helps ease your mind knowing you don’t have to try and remember everything.
FastStone PhotoResizer. Bulk resize, squish, rename, watermark or otherwise mess with images. Good to have in the toolkit for when some marketing dude gives you 3TB of TIFF and wants them on the web.
Fiddler2. Excellent tool for monitoring HTTP traffic from your machine. Helps debug awkward communication problems.
FoxitReader. Faster than Acrobat Reader, seems to work just as well. There’s probably things it can’t do but I don’t do much with PDFs and I’ve not come across any problems.
MagicDisk. Easiest way I’ve found of mounting ISOs.
SearchEverything. I don’t use this very often, so I don’t keep it running 24/7. I don’t mind waiting for it to rebuild its cache on first run, because once it’s done, it can find anything instantly.
DropBox. Either as a handy mini-back of important files (or files that haven’t made it to backup yet) or as a way of sharing files across multiple computers, you need some sort of in-cloud storage solution. There are others, but DropBox gives you 2GB free and has a nice tool to keep it all synchronised.
TrueCrypt. If you have, ahem… sensitive material, or if you really do have sensitive material, then have a look at TrueCrypt. It creates a new drive volume which you can drop stuff into, then encrypts it into a file. Reverse to decrypt.
7-Zip. You need to have some way of extracting a variety of different archives, and you need to be able to compress files properly, and fast. The built-in Windows compression seems to have some issues, and can only work on ZIPs. 7-zip is free and fast.
WinSCP. FTP tool, with support for scripting and embedding into batch files. Saved my life recently.
LogMeIn. This has been a God-Send for diagnosing problem’s on Mum’s computer (200 miles away). Closer to home, sometimes it’s just really useful to be able to jump on a machine at home from the office in order to start something running, downloading or converting.
Finally…
This isn’t really a ‘tool’, but it’s a bit of fun and may interest you:
Wakoopa. Keeps a track of what programs you use and for how long, then charts it for you. I display a badge for this on the homepage, and you can see more information about my usage on my Wakoopa Profile Page.
Ben Day has a blog post on a really interesting idea: using Performance Monitor (perfmon) to monitor the performance of your applications at run-time.
You can create your own custom perfmon counters and record various things in your application. Then, if a client running your application has performance issues, you’ve got something concrete to go on. You get all the benefits of perfmon: graphing, max/min recording over time, comparison with other system variables etc.
It’s one of those “well, duh, obvious” ideas, but it’s never occurred to me before. It’s worth putting the time in to wrap this functionality, as I see it being useful in loads of different scenarios.
You can read Ben’s full post here, in which he credits this CodeProject article on how to create the counters (also worth a read).
This is more of an aide-memoir for me than anything else.
To find out when a server was last rebooted:
- System Event Log, filter for EventID 6009
- on Windows 2008 you can use systeminfo | find “System Boot Time”
- I think this works on other versions of Windows Server as well, but the text might be different so you might have to go looking for it.
- You’re supposed to be able to use net statistics server and examine the first line (Statistics since …) but for me that was 01/01/1980. Would have been impressed if it was true…
Zend Technologies have just released their latest ‘Developer Pulse’ survey results.
You can see the full report here, but it’s mostly PHP-based (as Zend are mostly PHP based)
However, at the end of the reports are some more generic, lighter results, such as the one that 86% developers prefer to listen to music to get them “in the zone” whilst coding.
The most popular artist was Metallica, with Pink Floyd and Linkin Park close behind. The least popular was that Bieber chap. In the ‘guilty pleasures’ section was Britney, ABBA and Lady Gaga.
Over at the Flickr HQ, they’ve done a quick poll of their developers for their favourite music. The poll was done in March, but you might find some inspiration. The list is here, and they also have a Last.FM group.
If you’re interested, you can see my own musical preferences on my /music page, which lists what I’ve recently listened to, or on my Last.FM page.
Resolutions
The report authors also asked developers about their New Year resolutions for 2012.
The most popular was to ‘take a vacation’ at 19%, with spending more time with family and getting more sleep close behind. Eating healthily was also up there.
Good to see that my own resolutions chime in pretty close to everyone else’s. Also, I’m pretty sure they’ll be the same as my resolutions for next year as well!
(data from Zend Developer’s Pulse Report)
I was pair-programming today and we made a change to a fundamental data type which required all the web-services to be rebuilt and republished.
We’d done this a couple of times before. The build is OK, but what then follows is a torterous process of manual FTPing 10 webserservices to a pre-live environment. Find folder locally, find folder remotely, select all..NOT web.config(!), double check you’re in the pre-live folder, copy, repeat.
The pragmatic part of me thought there had to be a better way of doing this. Why not just script it. Surely every man and his dog has a handy FTP upload script to recursively upload a folder of stuff?
Apparently not.
I tried PowerShell first. I like PS, but I’m a novice user trying to get better. Last time I used it (to find a string in a collection of files) I was blown away by how simple and elegant it was. 3 commands, piped together on one line, no fuss.
Turns out you can’t FTP in PowerShell.
OK, let me clarify… According to StackOverflow, you can, but only really by getting .NET to do it for you, and only then one file at a time. And the code…
# create the FtpWebRequest and configure it
$ftp = [System.Net.FtpWebRequest]::Create("ftp://localhost/me.png")
$ftp = [System.Net.FtpWebRequest]$ftp
$ftp.Method = [System.Net.WebRequestMethods+Ftp]::UploadFile
$ftp.Credentials = new-object System.Net.NetworkCredential("anonymous","anonymous@localhost")
$ftp.UseBinary = $true
$ftp.UsePassive = $true
# read in the file to upload as a byte array
$content = gc -en byte c:\me.png
$ftp.ContentLength = $content.Length
# get the request stream, and write the bytes into it
$rs = $ftp.GetRequestStream()
$rs.Write($content, 0, $content.Length)
# be sure to clean up after ourselves
$rs.Close()
$rs.Dispose()
That’s not a solution.
You could also do it using NetCmdlets, some sort of add-on for PowerShell, but seriously, even if it is free for one concurrent connection, registering, providing email addresses, downloading, installing … just to put some FTP away? In a scripting language?!
Where else did we try? Oh, we tried NAnt as well – I thought they must have a decent <ftp> task. Apparently not. The only one anywhere close was this NAnt FTP Task – but don’t waste your time getting excited about the example because although it looks like it does exactly what we needed, the link is broken and there’s no trace of an alternative.
We tried DOS’ FTP mput as well … but this isn’t recursive.
We did think that it would be pretty cool if there was an FTP client which recorded your commands, allowing you to play them back later, or save them to a script file, but alas, such a client doesn’t exist. Add it to the list of programs I will one day get around to making (yeah, right).
By this point, things were getting pretty desperate, and we started to consider just writing a small .NET Console Application to automate the transfer for us, although that would have had its problems as well.
Finally, however, we came across WinSCP. At one level, this is just another FTP Client. However, you can run it in command line mode, and you can send scripts to it. And it’s clever enough to know that when you specify a folder instead of a file, it needs to copy everything in that folder.
Within 10 mins of downloading, we’d thrown together a simple script using WinSCP’s put command which worked perfectly. The GUI isn’t too shabby either, so I’m pretty sure that WinSCP will be replacing CoreFTP as my new FTP Client of choice. It’s supposed to be a SSH file copy client (Win SecureCoPy), but it does FTP pretty well too, and is a true open-source app under GPL.








