A Foolish Manifesto

fREWdiculous!

Using Cygwin instead of msysGit

Our main product at work is a Windows product. The reasons are complicated, but the main reason is that that is what our customers seem to want. What this means is that I do some of my development on a virtual machine. For a long time I was just using msysGit. msysGit goes a long way; you have a real bash console, a bunch of standard unix commands, and very good windows integration. On the other hand that’s about all you get. After reading his blog post I spoke with Caelum about getting zsh working with msysgit and he said it was probably just better to use cygwin

There are a handful of reasons to use cygwin, but the main reason I did was for zsh. If you want to follow my path just get the cywin installer and install at least git and ssh. If you are like me you’ll also want to install zsh.

A couple other things that are nice to install are screen and mintty. Screen is just great in general and I use it constantly. I should probably do a blog post on just that at some point. mintty solves the constant bother in windows that the console emulator is horrible and can’t be resized sensibly.

Make sure to follow the instructions in Caelum’s blog post as they are very helpful overall.

cygwin is certainly not perfect though. First off, it is noticeably slower than the already slow msysgit, which is very disappointing. On top of that the home directory is not the same as the standard windows home directory, which is just obnoxious. For some reason with msysgit I could run the vim installed in program files from the command line, but with cygwin I can’t. I even tried making a symlink but those don’t work with cygwin, even though they are supported by ntfs.

Either way, it’s nice to have zsh and screen and a real terminal. Hopefully this helps someone out there :-)

  • 1 Comment
  • Filed under: Uncategorized
  • zsh for the win

    In the past I’ve only touched on the fact that I am a z shell user. I figured I’d make a post about some of the tweaks I made to my config (mostly my prompt) yesterday, in addition to why I use it at all.

    First off, what are some features zsh has that make it work using for me?

    Various bundled “modules.” For example, the zsh-mime-setup module enables me to “run” files with extensions and have the mime setup use the right program to open them. Great for stuff like pdf’s or whatever that.

    Ridiculous amount of features and options:

    auto_cd: you can type .. or foo or any other path and leave off the cd. Brilliant.
    auto_pushd: cd implies pushd, which maintains a stack of directories. What that means is that popd (which I alias mk to) becomes “back” for navigation.
    no_case_glob: simple as pie to allow case insensitive globbing

    Oh and history is an amazingly powerful feature as well! First off, I save 10,000 lines in my history. That’s about a years worth of commands. Or at least it was in college. I think it’s probably less now, but still. It’s a lot. My history options allow me to leverage that to an extreme extent:

    append_history: don’t overwrite my history at the beginning of a session. Append it.
    various “dups” options: The main takeaway from this is that my history is a *stack*, not a list. I can’t stand doing ls, cd, ls and the pressing up twice to get back to ls.

    Speaking of history, zsh has it’s own super configurable line editor, unsurprisingly called ZLE, which I use to bind / and ? (in cmd mode) to searching forward and backward in my history.

    On top of that I have super configurable completion. Bash got this a while back, so it’s not as exciting. But one really cool thing you can do is fix up the completion such that kill lists all of your processes with nice levels and everything. It’s awesome. You should see it in action.

    Of course, everyone has awesome prompts nowadays, and mine is fairly plain compared to many others, but it *does* contain the current branch, mode (merge, rebase, etc), and whether or not there are changes or staged changes. Oh and because it uses a generic module to do all of that it works for git, svn, hg, and lots of others.

    Anyway, I actually spent a good part of yesterday reorganizing my configuration and adding in the version control bits to my prompt. I did a lot of research and I think it not only looks good but it works fairly efficiently. Check out my conf if you are interested.

  • 0 Comments
  • Filed under: Uncategorized
  • Chapter 7: Open Source

    Some of you probably know that I have some opinions, thoughts, and ideas. I actually started this blog because I wanted to write my own (can you guess what?) Manifesto. I chose to write it as a blog because I tend to change my mind. Ask some of my friends and family. They have all observed that I was going to be a math teacher, a psychologist, a biological engineer, a doctor, and a writer. (Take note: I am none of those things.)

    I started programming in earnest about 10 years ago, when I purchased Programming Perl. I had done some basic, but I knew that real programmers used perl. I knew I would never use any other language. 6 years later I turned my back on perl when a professor introduced me to ruby. While in ruby-land I learned functional programming, what MVC was, what an ORM is, and the beauty of syntax (I still dig 5.times {…}). I knew that Rails was the One True way to program websites and that Prototype and Scriptaculous were the only way to program javascript.

    Then 4 years later someone offered to pay me to write perl. I came back somewhat grudgingly, and I came extremely close to trying to write a certain project with rails. Fortunately (for my current dogmatism) my boss convinced me to stick with perl. Somewhere along the line I learned that perl 6 is truly being developed. I helped some and had some fun. I read the book currently titled The Passionate Programmer. After reading it I decided to start seriously look into switching from IIS to Apache.

    After setting up Apache on my personal computer so I could have a useful error log I started researching ORM’s. I found that The One True ORM of any given language is DBIx::Class. I will never use another ORM as long as I live. I have posted about it a few times now. I’ll leave that at that.

    Larry Wall says that the three programming virtues are laziness, impatience, and hubris. I agree with his conclusions. The first two often lead to code reuse. Code reuse is an excellent goal. Code reuse is what keeps my current codebase nimble and exciting to work on.

    Part of code reuse means using libraries to help you get your job done. Did I mention DBIx::Class? Yeah, it helps me get my job done. Now, when I first started getting paid to code I was told that in a professional context, we don’t waste our time reinventing the wheel. Agreed! Let us not reinvent the wheel.

    So instead of reinventing the wheel, we’ll purchase a library that does the job for us find some Open Source library that does (or almost does) the job for us. Before I got further I’d like to make a few points about Open Source software. (Also, let me remind you that I am Holden Caulfield right now so I may be lying, on purpose or accident.)

    I do not use Open Source software because I desire or need freedom. My political friends tell me that I am spoiled for saying that freedom is not the highest virtue and that I would not be willing to die for freedom. There are other virtues that I (hope) would be willing to die for, but that’s another chapter.

    I do not use Open Source software because I am poor. I purchase indie video games because they are awesome works of art and they are not cheap. I donate to Open Source and otherwise free software that I regularly use because I am glad to pay for the excellent work that someone will do to make my job/life easier. I think that it is fine to ransom features as an Open Source programmer.

    I do no use Open Source because I am a communist. There is no reason that a programmer should give you his time and effort for free. Let me redact that statement: there is no reason that a person should give you his time and effort for free. If you view me as a carbon offset to the earth and that everything I do should be given to the poor, that’s fine. We are all wrong sometimes. Let me be clear: I love Ayn Rand as a phiosophess and I agree with her unconditionally.

    I use Open Source software because I am a programmer. Jeff Atwood says that “If it’s a core business function, write that code yourself, no matter what.“. I agree Jeff! The problem comes when you purchase an over-the-counter library, it suits your fancy perfectly, and then six months later, as always happens, the customer wants more. The library no longer works for you, so you either pay the Closed Source vendor to implement the features you need, or find another library and port all of your code to that.

    This is what happens to me: I use an Open Source library that does what I need. I eventually outgrow it or it doesn’t meet a specific need, I either whine enough to get someone to add the feature I need, or I figure out how to add it myself. I’m not even a very good programmer; I just really like to program.

    Let me put it another way: do you have any friends who really like to work on their car? Do they buy the brand new drive-by-wire automatic Toyota that is more black box than car?

    This post is pushing up against the thousand word mark and we certainly wouldn’t want to go there, so I’ll repeat myself one more time: I am a programmer. I will continue to use Open Source software because I love to program and because I don’t want any Golden Handcuffs.

    So programmers, ask and it will be given to you; seek and you will find; untar and the code will be opened to you. Suits: feel free to purchase black boxes as Golden Handcuffs. Thank you and have a nice weekend.

  • 3 Comments
  • Filed under: Uncategorized
  • OLOTD

    1
    noglob zmv -W **/^*.flac **/*.flac

    I just ripped a bunch of music into flac and I forgot to add .flac to the end of the files until I was mostly done. If you are using zsh (and you load the zmv module) the above line will rename all files that do not end in .flac to whatever they used to be, but with .flac at the end.

    excellent.

  • 0 Comments
  • Filed under: Uncategorized