Text Editors

Possibly the most time-honored and effective way for a programmer to procrastinate on his or her work is to spend time messing around with text editors and/or IDEs. There’s a good case to be made that spending time selecting the right editor/IDE, and tweaking it appropriately, pays off in spades, due to increased productivity over time. But honestly, I can’t say that I haven’t sometimes spent time messing around with my text editor or IDE just as a procrastination tactic.

Yesterday, a new beta of Sublime Text 3 was released, along with the new version of Komodo Edit/IDE, so it makes sense to think about editors a bit.

I bought a personal copy of Komodo IDE about a year ago, and I’ve been using it on the Mac and on Windows, mostly for PHP programming. And now I’m using it for Ruby too. It’s a little heavy to use it as a general text editor. For quick text file editing, I’m using Notepad++ on Windows and TextMate on the Mac. But Komodo is pretty good for PHP and Ruby.

I messed around with Sublime Text a few years ago, but didn’t really like it enough to stick with it. (And, at the time, I didn’t really have a good use case for it anyway, given the kind of work I was doing then.) Occasionally, I think about giving it another try.

At work, I don’t really need to worry about text editors much, since nearly all of the work I do is being done in either MorphX (the Dynamics AX IDE) or Visual Studio. Both of those environments work fine, for their intended use, and (in both cases) it wouldn’t be realistic to consider using a different tool for text editing.

But, for my recreational programming, whether that be PHP, Ruby, or whatever else, it’s nice to have a good programmer’s editor handy. I’ve already shelled out the $59 to upgrade my personal license for Komodo IDE to version 9. (If I thought I was going to need to do any serious Ruby development, I’d probably give Sublime Text another shot and see if it was significantly better than Komodo.)

I keep thinking I should be a real programmer, and learn more about VIM and/or Emacs, but I never quite get around to it. VIM Adventures looks like it might be a fun way to learn VIM. (Of course, I’ve been saying that I should learn more about VIM and Emacs for years; I just found blog posts from 2008 and 2005 saying basically the same thing I just wrote here.)

My Ongoing Parking Woes

I try not to complain too much about first world problems on this blog. But I feel like venting about the parking situation for my apartment building, so I’m going to go ahead and whine about it. (If not here, then where?)

I pay my landlord for a reserved spot behind the building. There’s a municipal parking lot right behind our building, and a portion of that lot is ours. I’m not sure if it’s technically owned by the town, or if our part belongs to our landlord, or how that works. But our area is basically our own mini-lot, with numbered spots that are all clearly marked as “reserved.” The rest of the lot is metered parking, with some other reserved spots for other buildings.

It used to be that the only time I had trouble parking in my own spot was on Friday nights during the summer, when Somerville hosts a classic car show. So, between the classic cars and all the people who come to see them, the lot fills up and people decide to poach the reserved spots. That was a pain, but there wasn’t much I could do about it, and it was only one day a week, for part of the year.

But it’s been getting worse over the years, for a variety of reasons, and, to make a long story short, it’s now pretty much guaranteed that I’ll lose my spot if I go out on Friday or Saturday night, any time of the year, and come back any time before 10pm. And if I’m back before 9pm, I might not find any available spot in the lot. Which means I have to park on the street. But it’s illegal to leave the car on the street overnight, so then I have to go back out again and move it back into the lot once spots open up.

And I’ll often lose my spot on a weeknight, if I go out, or if I get home from work late. It’s getting kind of ridiculous.

So the landlord came up with the idea of issuing everyone a traffic cone with the word “reserved” printed on it. The idea would be that we’d put out the cone any time we left our spot, then toss it in our car when we got home. Well, that lasted about a week before the rotten kids around here started swiping the cones. God knows why. (What are they gonna do with traffic cones?)

I think I need to hire someone to sit in a lawn chair in the middle of my parking spot all day and chase away anyone trying to poach it. And I’ll give the guy a Taser or a can of pepper spray to ward off the rotten kids. (Otherwise, I assume they’d beat up the guy and steal the lawn chair.)

So that’s my “first world problem” rant for the day. I feel a little better now.

more fun with Ruby

I’ve been making good progress through The Book of Ruby this week. I’ve continued to use the simple Ruby install on my ThinkPad, since it’s working fine, and I don’t yet need any of the fancy stuff; I’m still just working my way through language basics.

But I stumbled across an interesting class on Coursera that was just starting up, called Web Application Architectures, which covers Ruby on Rails. Initially, I resisted the urge to sign up for it, since I don’t think I’m really ready to start messing with Rails yet, but my curiosity got the best of me, and I went ahead and registered for it.

So now I’m messing with the somewhat arcane process of setting up Rails. Initially, I looked at trying to get Rails to work with my existing Ruby install on the ThinkPad, but (to make a long story short) that didn’t work out. So I looked at a couple of other options for installing a Rails dev environment on Windows, including RailsInstaller and RailsFTW, but I had some problems with both of them and decided to go a different way, rather than try to resolve the issues. (Finding pages like this and this on Reddit pretty much convinced me that setting up Rails on a Windows machine was a bad idea.)

So I went ahead and installed Ubuntu 14.04 under VirtualBox and followed the instructions found here to set up Rails. That seems to have gone smoothly, but I won’t really know for sure until I’ve done some meaningful work. I’m still not entirely sure if I’m going to stick with it, or punt on the course for now and avoid the messy complications of Rails until I have a better grounding in basic Ruby, but I’m going to spend some more time on it this weekend and see how it goes.

Oh, and as a side note, it’s fun to be messing with Linux again. I haven’t really touched Linux in a while. Ubuntu was fairly easy to set up under VirtualBox, and it seems to be running fine. The desktop UI is attractive and reasonably fast, even in a VM with only 1.5 GB of RAM allocated to it. (I’ll probably have to bump that up to 2 GB if I get serious about the Rails stuff.)

Learning Ruby

I’ve always been curious about Ruby, but never got around to learning it. I was inspired to actually dive in and start learning it recently, after listening to a Hanselminutes podcast where Scott Hanselman interviewed the creator of Ruby, Yukihiro Matsumoto, aka “Matz”. After messing around with SharePoint recently, I was in the mood to work on something as different as possible from that. Something where I could just install a nice little interpreter, and start working, without having to worry about spending a whole day setting up a VM first. Ruby sounded pretty good, on that front. The community seems to be pretty friendly, and there’s lot’s of good training material out there.

After looking around for a good place to start, I settled on The Book of Ruby. The publisher had a Pi Day sale this weekend, so I got the book/ebook combo for a good price. For a development environment, I’m using Komodo IDE. which I bought some time ago, for PHP work. It works OK for Ruby too, though I think there are probably better options. (But it’s good enough for now.) For Ruby itself, I installed it on my ThinkPad using the Ruby Installer for Windows, which was simple and straightforward. I also have Ruby installed on my Mac, apparently by default, since I don’t remember ever installing it myself. But I’ve decided to use the ThinkPad for my Ruby work for now, for a few reasons (bigger screen and keyboard, mostly).

I’m finding that The Book of Ruby is pretty well-written and organized, with good sample programs, at least so far, where the material is pretty basic. (I’m about 20% of the way through the book.) One slight annoyance though is that the sample code, as downloaded from the web site, is not formatted according to the usual Ruby standards. There are actual tab characters in the files rather than spaces, and the indentation isn’t always consistent. That might not seem like a big thing, but it bothers me a bit. So that set me off on a search to find a good code formatter for Ruby. Komodo doesn’t have one built in, but their web page on how to set up a new formatter links to a specific tool that looked like it work work well. Unfortunately, I found that it would always delete the last line of any code file I fed through it. This is probably due to some specific weirdness with the sample code from this book, and not a general problem, but regardless, I can’t really use that formatter. So that set me off on a search that led me to Rubocop, which is a static code analyzer that happens to also include a code formatter. That works great, though I haven’t tried to integrate it with Komodo yet.

TFS query PowerShell script

It’s been a while since I posted any PowerShell code here, so here’s a quickie script that I’m using to help with my workflow for checking in Dynamics AX changes.

First, a little background: We have a slightly odd workflow set up in TFS for tracking the projects we do in Dynamics AX. For each project, we open a TFS work item. We then check in all changes for that project under that work item. So far, so good. But we also routinely close out a work item after the first deployment that contains a check-in for that work item. So bug fixes and enhancements after the initial deployment are technically being checked in against a closed work item.

The problem here is that the check-in dialog within AX shows a list of open work items assigned to the current user, and doesn’t provide a mechanism for searching for other work items. It does allow you to manually add a work item to the list, but it can only do that by ID. But we have our own project number, which is stored as part of the work item title, and we generally don’t use the TFS work item ID for anything, so I generally don’t know it off the top of my head. So I often have to go into Team Explorer in Visual Studio to look up the work item ID for a project before I can check it in. That’s not a huge inconvenience, but I thought it would be nice to have a little PowerShell script that could look up the work item ID for me, given an AX project number.

The script shown below isn’t terribly complicated, but it shows off a few interesting little things. I started with an example script taken from Julian Kay’s blog.

First, we’re using the TFPT command-line query capability. This is part of TFS Power Tools, and uses a query syntax called WIQL.

Second, we’re doing a little rudimentary parsing of the data returned from TFPT to pull out the first work item ID. Then, we’re copying it to the clipboard with the clip command. (Looking at this script, I’m pretty such there’s a better way for me to pull out the work item ID, but the way I’m doing it now works fine.)

And finally, we’re displaying the results to the screen, so if by chance more than one result is returned, I can see the list and decide which work item is the right one.

If I wanted to go a few steps further with this, I could probably integrate this into AX completely. The check-in dialog in AX is a regular AX form named “SysVersionControlCheckIn”, and there’s no reason I couldn’t customize it. (But that’s a problem for another rainy day.)


# Given AX project #, return ID.
param (
[string]$projno = $( Read-Host "Enter project # (e.g. 123.4)" )
)
[string]$tfpt = "C:\Program Files (x86)\Microsoft Team Foundation Server 2012 Power Tools\TFPT.EXE"
[string]$svr = "http://myTfsServer:8080/tfs/defaultcollection"
[string]$projname = "myProjName"
[string]$query = "SELECT [System.Id], [System.Title] FROM WorkItems " +
"WHERE [System.TeamProject] = '$projname' " +
"AND [System.Title] CONTAINS '$projno' " +
"ORDER BY [System.Id] asc"
$data = & $tfpt query /collection:$svr /wiql:$query /include:data
if ($data -ne $null) {
$line = ($data | select first 1)
$taskid = $line.split("`t")[0]
$taskid | clip
}
$data
Write-Host "Press any key to continue …"
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")

view raw

tfpt_ex1.ps1

hosted with ❤ by GitHub

 

Beginning SharePoint 2013 development

Beginning SharePoint 2013 DevelopmentBeginning SharePoint 2013 Development by Steve Fox
My rating: 4 of 5 stars

I’m supposed to be getting involved in some SharePoint development at work soon. But I have no details on the specific project that I’ll be working on yet. So I’ve been doing some general background reading on SharePoint, in the hopes that some of it proves useful.

This book is structured so that each chapter gives you a quick introduction to one aspect of developing for SharePoint. A lot of stuff can be considered under the general heading of “SharePoint development”, and the book tries to cover as much as it can. I think it does a good job of covering the basics, and giving a new SharePoint developer a good overview of the various ways in which a developer can interact with SharePoint.

If, like me, you really have no idea where to start with SharePoint, this is a good book to pick up and read through. It covers enough of the basics that it should get you pointed in the right direction. But it’s not going to take you very far, once you’re actually off and running.

View all my reviews

A nice day

We finally had a nice day with moderate temperatures yesterday, so I took the opportunity to make another NYC museum-hopping visit, and also did some walking. (It’s funny how my definition of “nice day” has been downwardly adjusted by this harsh winter. It was overcast yesterday, and the streets were full of melting grey slush. But it was above freezing!)

I first went to MoMA. I’m curious about their Björk exhibit, but I didn’t bother trying to get in to that. There are actually multiple parts to the exhibit; the centerpiece, I guess, is the “Songlines” exhibit, “an interactive, location-based audio experience”, which required timed-entry tickets, even for members. So, if I decide that I’m really interested in that, I’ll come back on a day when I can go in early. I’m not sure I care about a Björk exhibit that much. It seems like mostly just a novelty exhibit. But I guess stuff like that helps pay for the more interesting, less popular, exhibits, like the Toulouse-Lautrec exhibit that’s coming to an end soon.

After MoMA, I went to the Met. While I had no particular agenda for that visit, when I got there I realized there was a members preview of the Plains Indians exhibit going on, so I went in and took a look around. It’s actually really interesting and well-done.

To get some additional exercise, I walked from the Met back to Penn Station, making a quick stop at Kinokuniya. I don’t think I’d ever been in this particular Kinokuniya location before. I was surprised at how many English-language books and comics they had. They have a really good selection of American and European graphic novels on the second floor.

So it was a good day, overall. I’m looking forward to an even nicer day when all the snow is melted and the Met roof garden is open, so I can spend a little time in the sun up there, maybe enjoying a beer or coffee.

Life After Cancer

I’ve been following Federico Viticci’s site MacStories for a while now. He posts some really great in-depth and thoughtful reviews and articles. I was really blown away by his recent article about “Life After Cancer.” I don’t know much about him personally, and I had no idea that he’d had Hodgkin’s lymphoma, which is the same kind of cancer that killed my brother Pat.

Reading about his treatment, it sounds like some serious advances have been made in the last ten years, which makes me wonder if Pat would have survived if he’s gotten Hodgkin’s today rather than ten years ago. (Or maybe Federico’s case was just different from Pat’s.) There’s probably not much point in speculating.

All of his notes on the various health-related apps he’s using are quite interesting. I’m pretty well satisfied with the weight-loss app I’m currently using, LoseIt. And I use RunKeeper to track my exercise (what little I do). I’m kind of interested in the sleep-tracking app he uses, Pillow. I’d never heard of it before. I’ve been sleeping pretty well lately, I think, but I have had problems with insomnia in the recent past.

SharePoint and more

Just a quick follow-up on Saturday’s adventures with SharePoint: On Sunday morning, after letting my VM chug through 100+ Windows updates, and increasing the amount of RAM allocated to it from 1 GB to 2 GB, I eventually found myself with a barely-operational SharePoint install.

But I decided I didn’t want to spend the whole day staring at my laptop, alone in my apartment, so I turned it off and hopped on the train into New York, and spent some time at the Metropolitan Museum. Overall, I think that was a better use of my time than banging away at my SharePoint VM all day.

I spent some time this morning reading various blog posts about SharePoint development environments, and I’ve come to the conclusion that I’ll never be able to get a useful one up and running on my current hardware. With only 4 GB of RAM on my ThinkPad, there’s no way I can allocate enough to the VM. Most of the advice I’ve seen recommends 8 GB minimum for the VM, so I’d really need a laptop with at least 12 GB of actual RAM. (And some blogs indicate that 24 GB is really the reasonable minimum for SharePoint development.)

I’ve also looked at a few options for running a VM in the cloud. The one no-cost option is to sign up for a free Azure trial, and set up a VM in Azure. That might be interesting, but I don’t think the trial would be long enough to be really useful.

So I think I’m going to have to give up on the idea of setting up a SharePoint environment on my own, and wait for my new project at work to firm up a bit more. At that point, I’ll know enough about exactly what I need to do that I can make specific requests related to a specific project, and hopefully get the software/hardware I need to get up and running. Until then, I’m just going to have to settle for reading books and using my imagination!