How Do You Make a Gem?

Posted on June 10th, 2010 by benhamill | No Comments »

This is not intended to be a how-to. I sort of talked a bit about that before. I’m writing this post because, as I breathlessly blogged before (alliteration!), I released my first gem. I then immediately turned around to start using it. And it was terrible. Yay for version 0.1! So I’m going to try something else.

The thing that sucked so bad was the API, basically. I didn’t really know how I wanted to use it or how best to fit it into a Rails app. I made a reasonable guess and got to work. It wasn’t a terrible first try, but it was a terrible API. However, I’m not sure what better looks like yet. And I think that I sort of got ahead of myself; I put the cart before the horse.

It’s a little like making the transition from drawing on paper to creating art with the GIMP. When you’re on paper, you draw the stuff that’s in front first and you only draw as much of the stuff that’s behind other stuff as can be seen. So you learn to think a certain way about how you build up your picture. In a program that has layers, you can draw in any old order and draw something entirely even if it’s obscured by something else in the long run.

I was thinking that the obvious path would be to develop my little gem of functionality and then use it in the larger Hey Go Vote application. Now I’m starting to think that’s backwards. I’m going to just work on Hey Go Vote and trust that doing so will give me insight into what parts of the announcement machinery can be made portable. Then I’ll extract those bits into a gem and refactor Hey Go Vote to use the new gem. I’m sure I’ll let you know how that goes.

Sudo on Windows XP… Sort of

Posted on December 16th, 2008 by benhamill | No Comments »

I’m mostly posting this to document it to myself, since I always forget, but it might be helpful to any readers, as well. You generally don’t want to be logging in to your computer as a user with admin privileges and a sane OS (like Mac OS or Linux), makes it a fairly painless experience. Windows, on the other hand, can be a real bear on the point. Specifically, Windows Explorer doesn’t like to do the whole “Run as…” thing. I’ve discovered a wonderful little run line that will solve this problem.

In the run line (Windows key, then R or click Start menu then Run…) put in runas /u:administrator "explorer.exe /separate". You’ll want to replace administrator with an appropriate user name if that’s not a valid one. A DOS prompt will appear asking for the password and away you go. This tip thanks to Stack Overflow.

I also found something else handy here: You can input run-line commands into the “location” prompt when creating a shortcut from scratch in Windows. So if you don’t want to type out all that /u:administrator stuff all day (or, well, probably not that frequently and you’d forget it), then you can right-click > New > shortcut and paste your command into the location. Call it whatever you want and then you’ve got a shortcut to an admin Windows Explorer right on your desktop.

I find this so much easier to deal with than any other solution when I need to muck with file permissions or any number of things in Windows. Helpful? Didn’t work for you? Thoughts on the site design? Let me know in the comments.