useful AutoHotKey script

I’ve been using AutoHotKey for a while now. I’ve got a few macros programmed into it that are pretty much wired into my brain at this point. There’s one thing I’ve been meaning to write for the last year or so, and just never got around to it. Well, I was in the middle of something on Friday, and I just decided that I needed to stop what I was doing, and just figure out how to write this macro. It turned out to be a lot simpler than I though it was going to be! Now I feel kind of stupid for putting it off for so long.

Basically, I wanted a macro that would do a “Paste Special / Text Only”. Mostly, I needed this in Lotus Notes, but there are other apps where it could come in handy. Long ago, I’d taken care of this in Word with a simple one-line VBA macro. But, I never really knew how to do this in Notes. The reason I need this, is that I’m often pasting text from Word, or a web page, or some other app, into Notes. The text goes to the clipboard as formatted text, and if I just do a straight paste into Notes, all the formatting info gets pulled in, and it’s usually not a good match for the default e-mail formatting in Notes. So, I’d settled on just selecting Edit, then Paste Special, then Text from the menus. But that’s a lot more work than pressing Ctrl-V.

Before yesterday, I’d never looked at the AHK docs closely enough to realize how simple this was. The contents of the clipboard, in plain text format (that’s the key there!) are available in a system variable called “clipboard”. So, all I really needed to do is call SendInput on that. Duh. Just to get fancy, I also decided that I wanted to trim trailing whitespace from the clipboard contents. So, here’s a simple macro that trims trailing whitespace from the contents of the clipboard, and sends it out:

^+V::
myStr := clipboard
myStr := RegExReplace(myStr, "s+$","")
SendInput %myStr%

I just have that mapped to Ctrl-Shift-V, so I can paste text anywhere, without formatting, no problem. And, yes, I could have written this in one line, but I broke it up so it would be easier to see what I was doing.

The point of this story, I guess, is that AutoHotKey is a wonderful thing, and that some things are simpler than you think they are, if you just sit down and spend a few minutes reading the docs.

programming books

I finished the Advanced .Net Programming class a couple of weeks ago that I was taking at NYU. While the class was going on, I limited my reading mostly to stuff that related to the class. I read bits and pieces of three books; I posted about those back in February.

I took a break from reading any programming-related books for the last couple of weeks, but now I’m looking to get back into something. I picked up Rocky Lhotka’s Expert C# Business Objects again tonight. I’ve had that book since 2007, I think, and I just haven’t been able to get all the way through it. The copy I have is now several versions behind. (Here’s a link to the current version.) I had read through the first six chapters previously. Tonight, I just sat down and leafed through the remainder of the book. I’ve decided that there’s nothing else in there I really need to read in depth right now, so I’m just going to drop it, and maybe pick up the new version at some point and start over with that.

Meanwhile, I also recently bought C# 2008 for Programmers by Paul and Harvey Deitel. I picked this up largely because I’d found some good stuff in an older version of the book that’s available on the Safari subscription I have through ACM. This is a general C# book, written for people who already have programming experience. It covers a lot of the newer stuff in C# and .Net that I haven’t really had time to pick up, since I first learned this stuff back in the days of .Net 1.1 — LINQ, generics, WPF, and so on. I’m thinking I should probably put this book on top on my reading list, since there’s a lot of stuff in there that could actually be useful to me at work.

Jira

I finally got around to installing Jira today. The Windows install was pretty simple. I did a default install, then went in and changed the database to MySQL. That worked fine. I then tried getting the CVS integration working, but I haven’t got that figured out yet. It just hangs when I try to set up a CVS module.

Either way, now I’ll have to spend some time setting up projects, and seeing if I can get myself used to tracking projects in Jira. Of course, I’ll also have to see if I can get the two other developers in the department interested in using it.

Jira

I picked up Jira and Confluence this week, during Atlassian’s “Stimulus Package” sale — $5 each! A while back, I’d looked at Jira, and several other bug-tracking/project-tracking applications, but I never got around to evaluating any of them. I’ve had a vague sort of a plan to implement Trac eventually, after first converting from CVS to Subversion (which was also a vague kind of plan with no particular timeline on it). I don’t think I could have ever talked my boss into paying $1200 for Jira, which is their cheapest commercial license. The $5 version only covers 5 users, but that’s fine, since I only have two programmers working for me right now anyway.

It looks like Jira can work with either CVS or Subversion. I’m still planning on converting to SVN before I install Jira though. Of course, since we’re a (mostly) Microsoft shop, I should probably look into TFS, but I think that might a bit too expensive for me.

It’s a bit of a balancing act, in a small shop, trying to figure out how much time and money to spend on infrastructure (for lack of a better word) — project tracking, version control, formal testing, and so on. I can’t spend too much time on it, but if I don’t do it at all, things start to fall apart…

DreamSpark

Whenever I take a class at NYU, I always spend a little time looking around to see if I can take advantage of any student discounts on software or hardware, while I have a valid student ID card. In the past, I’ve picked up some random software from the NYU computer store, if there was something I needed, and they had it cheap. Right now, Microsoft has a great program called DreamSpark that allows college students to download certain developer tools for free. The authentication mechanism ties into NYU’s Net ID system, so you can authenticate yourself as an NYU student just be selecting “NYU” from a drop-down at the DreamSpark site, then logging into your NYU account. Pretty simple. I’m downloading Visual Studio 2008 Pro, SQL Server 2008 Developer, and Windows Server 2008 Standard right now. I’m not sure that I really need any of these things; I have access to all of them through my MSDN subscription at work. But, this way, I’ll have a set of licenses that are definitely mine, and not the company’s, just in case.

.Net books

The instructor for my NYU .NET class listed three books on his syllabus. Programming C#, by Jesse Liberty, is the main book for the class. CLR Via C# by Jeffrey Richter is an optional book, as is Programming .NET Components, by Juval Lowy.
I bought all three of these books the old-fashioned way: from Amazon, in dead tree form. I have an older edition of the Liberty book, but I don’t have any edition of the other two, and I think they’ll come in handy.
None of these books is available on the Kindle, by the way, though the Liberty book is available as a DRM-free e-book directly from O’Reilly. Of course, the e-book costs $40, while the hard copy from Amazon is only $31.50. Oh, and the Juval Lowy book is available through the limited Safari subscription I get through ACM, though I didn’t figure that out until I’d bought the hard copy.
I actually haven’t bought any computer books in a while, so I was due to plunk down some money and (hopefully) spend some time reading. The last time I remember buying anything was after VS 2005 and .NET 2.0 came out.

random stuff

I’m spending the weekend just hanging out in the apartment, trying to get over a cold that I probably caught last weekend at NYCC, or possibly from someone at work. I started a new class at NYU this week, Advanced .NET Programming. It looks like it should be an interesting class. I don’t get a chance to delve into the more advanced .NET stuff often. When I’m doing .NET stuff, it’s usually pretty straightforward ASP.NET work. It was a little hard to get through the first class, since I was fighting this cold, and I really just wanted to get home and get some sleep. I’m hoping I’ll feel better by next Thursday, so I can maybe be a little more engaged with the class and a little less preoccupied with just trying to stay awake!

Vista: almost done

I’m nearly done moving all my stuff over to the Vista install on my desktop machine. I de-authorized iTunes under XP, so I can use it under Vista. I moved my OneNote files over. Almost all of my key programs are installed and working now.

I’m installing Visual Studio 2008 right now. I haven’t used VS 2008 before, so hopefully I can spend some time playing around with it now. I don’t think I’m going to bother installing any older versions of VS. I don’t really have any independent projects in .Net 1.1 or 2.0 that I need to worry about supporting.

I have Delphi 4 on my XP drive, and I have one fairly important program written in it: the database program that I use to manage my comic book collection. This is a program that I first wrote in BASIC on the Commodore 64, and have ported (or rewritten) several times. It’s probably time to rewrite it again, this time as a Windows Forms app in C#, maybe. I’ll have to see if I can even get the existing Delphi program running under Vista. I never really made an installer for it, and I think I may have used a weird library or two.

I think rewriting an old Delphi app in C# is particularly apropos, since I’ll basically be following Anders Hejlsberg from Borland to Microsoft. I considered upgrading the project from Delphi 4 to the newest version of Delphi, but I don’t see much point in spending time on that right now, since Delphi programming doesn’t seem to be a marketable skill anymore. And the new version of Delphi costs a minimum of $400, whereas I got a free copy of VS 2008 from Microsoft when I went to the launch event a few months back.

ASP.NET MVC

I went to the ASP.NET MVC Firestarter event in NYC on Saturday. It was an all-day (9-5) event with several speakers talking about various aspects of the MVC framework, and some associated topics. Nearly everything that was covered was new to me. I’m somewhat familiar with the idea of the MVC design pattern, and I’ve played around with SubSonic a bit, but I hadn’t really read much of anything about ASP.NET MVC specifically. I feel like I’m pretty far behind the times, given that most of the stuff I do in work right now is still in ASP.NET 1.1.

I still need to learn LINQ too. I haven’t really had time to sit down and play with that yet either.

Microsoft stuff

I went to a Microsoft Heroes Happen Here event today in Edison. I had registered for the NYC event that happened about a month ago, but things came up at work, and I couldn’t make it. Stuff came up at work today too, so I had to skip the developer stuff in the afternoon. The morning track basically covered Windows 2008. It was pretty interesting, and I did learn some new stuff. They gave out a software bundle that included Vista Ultimate, VS.NET 2008, and a few other things. Honestly, the bundle o’ stuff is one of the main reasons I went to this event.

I’ve put off installing Vista on my main desktop machine at home, for a variety of reasons. Now that I have a free copy of Vista Ultimate with SP1, though, I decided to give it a shot. I’m not doing an upgrade install, though. I’m still afraid to try that. Instead, I’m wiping out my Ubuntu install, and putting Vista on my second drive. I’ll have XP on my 250 GB main drive, and Vista on my 100 GB secondary drive. I’m hoping that dual-boot between XP and Vista works out OK. I’m running the install right now; it’s been going for about 20 minutes. I think it’s almost done.

I also registered for the ASP.NET MVC Firestarter event in NYC that’s coming up this weekend. It’s always a little hard to talk myself into spending a whole day indoors on a sunny Saturday, in a Microsoft office, but I really need to keep up with some of this stuff. And I think it’ll be kind of fun.