Vim Is Wrong

I just saw this post on Stack Overflow about some clever vim commands and as a vim user  I was glad to learn some new tricks I can use.  Then I read the reddit comments about the story and found this (screencapped in case that link changes):

When writing software the code is written once but probably read dozens of times.  Therefore, readable code is very important.  This is one of the central tenets of Python.  These commenters are debating whether readability is equally as important with Vim commands as it is in programming languages.

Previously I would have sided with the advocates of Vim’s terse command syntax without much thought.  Short commands are easier to type and can be more effective.  However, this thread made me reconsider.  Because of Vim’s terse commands, they are harder to learn and to remember.  And once a command is learned, it may be learned as a magical incantation and not a sequence of instructions, so the components won’t be learned and reused for other needs.  So unless a Vim user spends a considerable amount of time learning commands, they’ll be using the editor inefficiently and getting less done than they could because of Vim’s terse commands and steep learning curve.  I’m no longer sure that the efficiency gained by having short, easy to type commands is worth the efficiency lost by having a large set of hard to remember commands in your brain, and an equally large set that you aren’t using because you don’t know them.

Python has a relatively small syntax.  Most things are explicit so there aren’t a bunch of implicit things you have to remember to know what your code is doing.  The advantage that gives a developer is that they can write code more quickly without having to look up syntax rules or function calls all the time.  Also, a new developer can come to the code and will understand the program more quickly with fewer things to learn.  As I thought about Vim’s command complexity, it occurred to me that we already have a command set that’s easy to write, read, and remember, and it’s quick and easy to write a short script like the one in that Stack Overflow comment: Python!  Why can’t Vim use Python to edit the working document?  The Python scripting support is a good start for complex add-ons, but why not make it even more integrated with things like :find(‘query’) instead of /query?  I’m very curious if a readily accessible, full blown python interpreter would make my vim use more effective.

P.S.  Emacs? </blasphemy>

Thing-A-Day Wrap Up & The Secret Cabinet Revealed

So obviously I haven’t kept up with my thing-a-day blog posts. I’ve still been doing some things but not every day, and all those knitting days during the weeks were disenchanting. I’ve decided to cover everything in one big wrap up post for the month.

I “finished” the secret cabinet project. The cabinet is an “emergency documentation box” for Pumping Station: One. It’s mounted near the soon to be new home for Electric Avenue in a fairly prominent place and contains a flip video camera graciously donated by Anne Petersen. Now there’s no excuse to not have video of the culmination of your awesome project. This camera really couldn’t be any easier to use, so I hope this box helps out the space. I said it’s “finished” because I really just got tired of working on it and moved on. There should be some lettering on the window but I’ll add it later.

Mounted and filled

I implemented the scary sharp tool sharpening system and sharpened a chisel and a hand plane. I sharpened them down to 1000 grit sandpaper and I intended to go down to 2000 but after seeing how amazing the results are with 1000 I don’t think it’s necessary.

.0035 inch thick wood shavingHand Plane

I produced a video of a Sun Jar for Element14. They approached PS:One a while back to send someone and record some of our projects and they got a good response from the video, so they asked for more. I hope it’s the first of a long series.

How to make a Sun Jar from Pumping Station: One on Vimeo.

I and several other members built three workbenches for the new shop in Pumping Station: One. It’s always fun to do those kind of large scale builds, but we could certainly use more tools so more people can work at once.

New workbenches

I still have plenty more projects on my list of stuff I could do this month and a few more cool things have popped up, so keep an eye out for weekend projects in March!

Thing-A-Day #13: Lathe Stuff & Painting

I had a very productive maker day today to make up for all the knitting throughout the week. First, I installed the new bearing on the metal lathe’s lead screw. It seems to be working much better now, but the change gears have been modified since I tested it before. I’ll have to change it back to absolutely confirm that it was an issue with that bearing, but for now it’s working well.

Metal Lathe

On the left of the lathe you can see my second project of the day. We have several brushes and tools that go with the lathe and they usually just lay in the chip tray or on the workbench. I made this rack for some of the tools and brushes to get the area more organized. It’s just some 1 inch holes in a scrap of 2×4, but it does the job well enough.

Tool Rack

Finally, I put what is hopefully the last coat of paint on the secret cabinet. Like I said in the last post, I think my sanding and use of a brush was a problem. I got a sander that could take my higher grit sandpaper and used some 400 on it to smooth out the painted faces. It worked very well, some other people commented that it feels like plastic rather than wood. I think I probably should have started even lower than 400, but 400 did the job. I also got a foam roller and did most of the painting with that. It left a nice finish and any bubbling that occurred during application had dissipated by the time I got back around to that side to examine it. I still had to use the brush on the inner corners, but it’s greatly reduced. Maybe that’s what those foam brushes are for. Anyway, this isn’t actually the last application of paint because the frame for the door is painted on both sides. I’ll have to get the other side painted tomorrow. However, this is hopefully the last time I paint over existing paint.

Secret Cabinet paint job

Testing Email in Django The Easy Way

Today a coworker showed me a very easy way to test django code that sends emails.  It’s straight from the documentation:

Another approach is to use a “dumb” SMTP server that receives the e-mails locally and displays them to the terminal, but does not actually send anything. Python has a built-in way to accomplish this with a single command:

python -m smtpd -n -c DebuggingServer localhost:1025

This command will start a simple SMTP server listening on port 1025 of localhost. This server simply prints to standard output all e-mail headers and the e-mail body. You then only need to set the EMAIL_HOST and EMAIL_PORT accordingly, and you are set.

Rot13 Utility

Rot13 is a common method for obfuscating text, often used to randomize passwords or to hide “spoilers” from online discussions. The tool I most commonly use to translate rot13′d text is http://www.rot13.com/, and that works well for translating long sections of ciphertext back in to plaintext. However, often there is just one or a few words to be translated from plaintext to ciphertext, and I find the site to be too much overhead for the task.

That’s why I made a simple php script on my website to do my rot13 translations from now on. The key difference between mine and rot13.com is that the form on mine uses the GET method rather than POST. This allows me to make a firefox bookmark to translate text directly from the url bar. To do this, bookmark this url: http://timsaylor.com/tools/rot13.php?plaintext=%s. Then in the bookmark’s properties add a value to the keyword field. My keyword is “rot”, so now whenever I type “rot [text]” into my url bar, it sends that to my script and opens a page with the ciphertext.

It’s just a simple utility, and writing this blog post about it took longer than actually making the script itself. I just had to rot13 something today, though, and I remembered wishing that I could do it more simply. A quick search turned up this rot13 php function, which meant all the hard work was done. I just wrapped that up in an html form and put it online. The source is here.

Maker Faire Videos

I’ve been planning to go to the Maker Faire in Austin, Texas this October, and I’m surprised none of you are interested in going too. If you’re not familiar with the kind of stuff that’ll be there, here’s some videos showing the cool stuff at the first two faires.

http://revision3.com/systm/makerfaire
http://revision3.com/systm/maker07

Check out information about this years faire at http://www.makerfaire.com.

Using Screen for Unreliable Connections

The other day I was working in a coffee shop and their internet connection went down a couple times. Unfortunately, I was ssh’ed into another box where my work was. Fortunately, I was using screen. I figured my session would disconnect and be sitting there ready for me to reconnect when the link came back up. Sure enough, it was. Saved me a lot of hassle reopening my files and saving more frequently. Here’s the article that describes how to reconnect to a lost screen session after your ssh session times out (not that it’s that difficult, but I’m sure I’ll forget and have to reference this).