Friday, January 6, 2012

vim compiled with ruby support on Lion

If you are a vim user on a Mac and you also like the Command-t plugin you have no doubt had to deal with the default vim, which does not come with ruby support out of the box. I have resorted to using MacVim for most of my needs but once in a while I wish Command-t was there for me in a vim terminal (read tmux).

Well, I just found out that MacVim ships with a Vim and MacVim executable, so just use that.

I added this alias to my bash profile and all was good:

alias vim='/Applications/MacVim.app/Contents/MacOS/Vim'

That will take precedence over /usr/bin/vim (except if you do sudo vim, then you are back to the old /usr/bin/vim).

Good enough, is what I say.


PS. I made a symlink from /Applications/MacVim.app/Contents/MacOS/Vim into /usr/bin/vim and it didn't work quite right. I got a bunch of warnings about color scheme, etc. Not sure why, but I didn't feel the need to dig deeper. That is why I went the alias route.

Thursday, August 18, 2011

Updating rubygems on an old 10.5 Leopard machine

I ran into this problem today when trying to update my ruby gems on a fresh OSX 10.5 machine for testing:

Updating RubyGems...
ERROR: While executing gem ... (Gem::RemoteSourceException)
HTTP Response 302 fetching http://gems.rubyforge.org/yaml


After a little googling I saw where gems were stored on S3 so I just added the --source option and that worked. Here is the command for posterity.

gem update --system --source http://production.s3.rubygems.org/

Thursday, April 14, 2011

Using git at work on a Windows network drive

Rarely do I program without using some sort of version control. I've been using git locally on my Windows machine at work to manage some scripts and I use a network drive as my remote in case my machine dies. Here are the steps I used to get that up and running.

You will need to install git (try msysgit windows installer) and learn about git (try git immersion) before setting up your remote repository.


Create a folder that will hold your git repository on your network share.
I have a mapped drive on g: and my repository is g:\scripts so that is what my examples will use.

From a cmd prompt change to your mapped drive.
> cd g:

Then cd into your soon to be git repository.
> cd scripts

Then create an empty git repository. If you do not use the --bare option, you will have issues so don't leave that out.
> git init --bare

Now if you don't have a local git repository yet, then you can clone your new repository wherever you like by navigating back to your local drive.
> c:
> cd work/scripts

> git clone file://g:\scripts
(UNC paths also work file://\\server\share\username\scripts)

When you clone, you automatically get a remote called "origin" and you can push to the server for safe keeping any time you make changes locally.
> git push origin master

If you already have a git repository and you just want to push out to the shared drive then you can do this from within your local git manged project.
> git remote add origin file://g:\scripts
> git push origin master

Friday, July 30, 2010

Mind Share (Part Two)

Exactly one year ago today I posted about "mind share" and how I was going to "punch out" of the tech world and enter fully into my home life with my full attention. Well, it has gone pretty well. There is definitely a correlation between programming too much and mind share issues. The biggest lesson I've learned is to recognize when I've been pushing too hard, and deliberately let go of the things I don't have time for.

Here are a few thoughts about what has worked for me and what has not in my ever elusive quest for work life balance.

Things that worked:
  • Early mornings:
    I have been reading and working on projects by getting up really early in the morning. Working early in the morning has several benefits for me. 1) It is a natural time box that I can't easily lengthen since I need to get ready for work eventually. 2) My mind is fresh and doesn't feel tired like it can later in the evening. 3) I'm not taking away from time with anybody else (they are all still sleeping).
  • Family projects:
    My wife and I worked on a project together. It is a website that helps her keep track of things she buys in bulk to better understand which of those things are making her money and which are not worth the investment. This was fun because it was something we could work on in the evening but it wasn't taking time away from us being together. It also was different than when I worked on a project by myself because now we were both thinking about the same thing, so if I had an idea for Homestore Lane (http://homestorelane.com) it was something we could talk about, unlike if it was some project she was not interested in.

Things that didn't work so well:
  • One night per week to work on projects:
    There are several reasons I don't think this worked very well for me. 1) I was already mentally tired by the time I started on my projects. 2) It was hard to unwind and go to sleep after programming late into the night. 3) It was hard to get back into things after waiting for the whole week (or sometimes longer since it was easy to skip a week).
  • Trying harder to compartmentalize:
    It wasn't mind over matter for me. I had to stop trying to do so much before I noticed the difference in my attention span and my engagement in my home life. Even though I would tell myself to stop thinking about projects, my brain just could not unwind enough because it was too tired (or engaged, or ?).

I'm going to stick with the morning thing and maybe some more family projects and see how it goes. If there is anything else along these lines I am sure I will blog about them next year. Or the year after, maybe. (I am already staying up too late to write this, so what am I doing? Time to stop.)

Monday, April 12, 2010

Objective-C scarcity continues

There is a lot of angst among developers of the iPhone/iPad community over the language restrictions of the new iOS 4.0 license, and rightfully so. Mobile Orchard closed shop because of it and there may be more high profile developers leaving the Apple platform in the future.

There is one positive for the Objective-C developers, though. The scarcity of their skill set will most likely continue. Objective-C developers have experienced a renaissance in their once obscure language and frameworks, but now they are the chosen ones and they get paid like it. Scarcity will give them the advantage in the market, driving up their rates/salaries as long as Apple continues to dominate in the arena of sales.

This may be the only positive that comes from Apple's decision, and it is only a positive for a minority of developers, so in the end ... blech.

Wednesday, January 27, 2010

iPad could be for an older generation

Somehow, the complaints I am seeing about the iPad don't resonate with me. No sd slot, no USB slot, too restrictive, too much DRM. What I mean is this: I think the iPad will be a huge success, just not among the peope we think it will.

There are a lot of people in the world who are not very tech savvy and who don't even know what a micro SD card is and wouldn't even know if they are buying DRM free music, video, etc. The baby boom generation, and the non-technical masses are going to love a device that "just works" for so many things. At the same time, it makes these same people look and feel like the geeks they know and admire (ha ha).

For example, I could see my Dad getting and iPad and a $15 monthly data plan so that he can do basic web browsing and email from home (he does not have internet right now). It would be the simplest solution for him, and he doesn't have to use a mouse. Some people just hate mice.

Apple does such a great job of giving non-technical people fewer choices and a great experience. The same may hold true for the iPad. When the tech community criticizes Apple for the above mentioned things, they may be missing the point. Apple doesn't care so much about developers, and alpha geeks as they might like to think.

Watch out for the iPad revolution coming to a senior center near you!

Thursday, December 3, 2009

Why do clojure examples always use the REPL?

I was frustrated by the getting started guides in clojure in that they did not give a quick intro to how to run a .clj file. Instead all the example are using the REPL, which is not something I like. I want to be able to edit a file with code in it and then execute the code in the file. It should be easier to find out how to do that. Here is what I did:

Assuming you have the clojure.jar and contrib-clojure.jar files built or downloaded somewhere.

I created the following env variables to point to the jars.
$CLOJURE_JAR
$CONTRIB_JAR

Then I created a source file called fun.clj with this line of code in it:
(println (+ 1 2 3))

Then from the directory of the fun.clj file you can run this command.
java -cp $CLOJURE_JAR:$CONTRIB_JAR clojure.main fun.clj

I created an alias to clojure that takes a file name so I can now do this in any directory:
clojure <filename> and it will run it.

(Update: I found the link I was missing. It should be in a more prominent place maybe.)
http://clojure.org/repl_and_main