davidb dives in

various musings and babblings.

Another Revival

| Comments

…And another two years has past without updating the blog. Mostly this is because I’ve been having a hard time thinking of suitable topics to actually blog about, but also because I let my blogging setup fall into disarray.

A few things have changed since the last time I tried this. At the moment, I’m somewhat inspired to write this because I’ve upgraded my venerable 6 year old iMac to a fancy 5k iMac, and working on this screen is very nice.

Getting Octopress to work again was a bit easier than last time, partly because I knew some past lessons, but mostly because I’m a bit more familiar with the Ruby ecosystem.

Going back over some of the older blog posts, I have a few updates:

  • Marked 2 didn’t necessarily make me a better writer, and I don’t actually use it everyday, but I do really like the tool. The latest update has a new step that you can use to tune Marked for use either with prose or code, which is nice. The “code” tuning is largely about rendering “github flavored markdown”, which is useful for my main use case work: writing README.md files for github projects. However, I have it tuned for “prose” for writing this post.

  • In “hosting your own git repositories”, I did a little survey of local git hosting software solutions. In the meantime, my employer went ahead and bought GitHub:Enterprise (which was called GitHub::FI back when I wrote that blog post), which is quite nice if you can afford it. In the open-source self-hosting world, I think gitlab has more or less emerged as the solution of choice, but I haven’t tried it. Or rather, I tried it a long time and many many release ago, and got stuck on providing an authentication solution.

Hopefully, my next blog post won’t be two years from now.

Trying Marked

| Comments

I saw something about an application named “Marked”. Is it a markdown editor? Would it help me stop forgetting to convert angle brackets into html entities? Like <this>?

First answer: No.
Second answer: Maybe.

Marked is a markdown previewer. Instead of being the editor, it watches the file you are working on, and updates whenever it changes. Presumably this is quite nice if you are using an editor which auto-saves. It claims that the easiest way to get your document into Marked is to drag the icon from the toolbar. Unfortunately, this doesn’t work with Emacs, as there is nothing to drag.

I’m trying out Marked while writing this post. Octopress’s document format is markdown, which is primarily why I care in the first place. Editing README.md files that will render on github is another reason why I might care.

Marked can be tweaked to match your actual use case. For example, at the moment, I need line breaks to not be preserved, as I know that octopress won’t preserve them, yet Emacs is adding them. Additionally, you can instruct Marked to ignore YAML front-matter, which octopress also uses, and is a bit distracting to see in the preview.

Since I seem to frequently produce Marked documents with formatting flaws (how do I create a code block, again?), this tool might find its way into my workflow.

Of course, just reading the features page of Marked 2 was fascinating, as I had no idea that things like CriticMarkup and Fountain existed.

Reviving the Blog

| Comments

It turns out that if you migrate your blog to octopress, but then fail to do anything with it for two years, it is a bit of a pain to get it working again. In the interim:

  • Xcode on your mac has probably updated 4 times and wiped out the command line tools (e.g., the command line compiler and build environment). Making this a bit harder is that installing the command line tools changed to something entirely non-obvious in Xcode 5. (Hint: from the command line, run ‘xcode-select –install’). So we spent a bit of time wondering why /usr/include is no longer present.
  • Ruby has utterly changed on your mac (what? ruby-1.9.2 isn’t current anymore?) , and you have to struggle to get anything to work as now all of your previously installed gems are gone.
  • You don’t work with ruby projects enough, so you struggle to get bundler to install an ancient version of some ruby gem which doesn’t realize that Mac OS X 10.9 is a perfectly valid OS release. Deleting the Gemfile.lock file and trying again is much more successful.
  • Octopress itself has changed a lot. After pulling the changes from upstream, dealing with the merge conflicts, and running ‘rake preview’, you are greeting with a now totally broken blog with now zero posts. This is because you have to actually upgrade the source and style.

Now that I’ve beaten my blog software back into shape, I’ll have to actually thing of something to write about…

Migration to Octopress

| Comments

I’ll admit it. I’ve been ignoring this blog for a while. Recently, over lunch, my friends started talked about their moribund blogs and the basic security threat they implied. My friend Sean said that he’d migrated to octopress based on a blog post. Given that we had all been running various versions of wordpress, it seemed like a good idea to investigate some other, less risky solution. I had sort of kept up with wordpress upgrades, but didn’t make the leap to the 3.x series. I actually tried it recently, and discovered that my PHP version on the host wasn’t up to snuff.

So, I’ve decided to take the plunge as well. I haven’t yet decided to move my blog to github pages, but I have done some work to get octopress working on my existing host. This is the default octopress theme. I’m going to leave it like that for a while, because a) it works and looks fine, and b) I’m not entirely sure how to change it. As part of the migration, all of my posts were transcoded into Markdown (in some cases, back into Markdown, but the majority were straight html.) As such, some of the formatting is broken. I plan to fix them as time goes on.

Octopress has the advantage of just generating static HTML sites (which you then move to the host via rsync or git.) This makes me much happier from a security standpoint. On the other hand, I now have to have Octopress installed on any machine that I want to be able to post from.

Since comments were actually useful on my site (although I was very remiss in moderating them), I’ve moved them to disqus, as octopress can’t handle them in line.

Hosting Your Own Git Repositories

| Comments

Github is all the rage, but what if you don’t want to store your code up in the sky? No, you want to host it yourself. Or, more likely, you have to host it yourself, because you work for some giant corporation who doesn’t believe in letting their coders store their stuff in the unclean world.

So. What are your options?

Let’s back up a little. Why do you need to host git repositories at all? What sorts of things should a hosting solution give you? First of all, if you want to actually work with other people, and those other people use, um, different computers, it is quite convenient to have a central repository around to use as a conduit. Also, if you want to be able to push changes anywhere, a central hosted git repository is a not-very-confusing place to do so.

Generally hosting solutions range from just providing push and clone access to a bare git repository somewhere, to bundling repository browsers, bug trackers, wikis, graphs, ugh. The top end of the hosting solutions integrates everything you need to run a successful software project, the bottom end solutions do the bare minimum, letting other apps handle the metaphorical heavy lifting. Unless you are the only one going to use the hosted repositories, your hosting solution likely has to deal with account management (i.e., letting other folks get accounts, upload keys, etc.), and likely it will have to make trivial the task of adding new repositories to the service. Some other things that it is useful to know:

  • ssh is the gold standard for pushing changes. It can be done other ways, but why waste your time with anything else?
  • The git protocol and http (or https) are pretty common for pull protocols, although, you can use ssh too, of course. The nice thing about using http is that is almost always works (unless you don’t add the right post-commit hook). The git protocol is nice when it isn’t blocked by an annoying firewall.

And back to the main business at hand: your hosting options. This list is non-exhaustive, but it should get you headed in the right direction.

The high end:

  • github:fi. This is the commercially available version of github that you can install yourself. It costs money, so it makes it hard to install as part of a stealth project. Count on paying at least $8k-ish. However, it does everything that github.com does, and looks to be quite easy to install.

  • gitorious. (This project always makes me think of Duran Duran.) As an open source project, gitorious can be downloaded and installed on your own system. I haven’t tried this yet, but it looks like it has a fair number of dependencies, and no one has wrapped this thing up in a nice bow for you, so installation may be non-trivial.

  • girocco. This is basically gitweb on steroids. That is, it looks mostly like gitweb, but also provides mechanisms to allow users to set up repositories, handles “forks” of projects, and can “mirror” an external git repository (that is, use a pull model rather than a push model). It is a bit non-trivial to set up, but has fewer dependcies than gitorious. You will likely have the easiest time of it if you are installing onto Debian “Lenny” (so I gather from the documentation). If you aren’t prepare to edit some of the scripts.

The low end:

  • gitolite/gitosis. Both of these packages do roughly the same thing: manage user access. Project browsing, repository creation, etc. are not included. The basic technique with either tool is to create a single account (probably called ‘git’) on your host, then uses the package to add other user’s ssh keys to that account while still maintaining the idea that different users are committing to the repositories. Of the two packages, gitolite is still active and has more features, while gitosis hasn’t been updated in 3 years. gitolite is implemented in Perl, gitosis in Python.

Or, just give everyone an account on a machine and tell them the path to the bare git repositories. Or you could use a combination of straight ssh and gitosis/gitolite. With the “low end” solutions, you’d typically want to set up repository browsing (at least). Fortunately, git comes with a reasonable one, gitweb. However, there are others: cgit, Trac, and FishEye, to name a few.

Switching to Cocoa Emacs

| Comments

… from Carbon Emacs, That is. I pretty much assume that if you aren’t already a dedicated Emacs user you will just stick with TextMate Or TextWrangler, or whatever.

Anyway, did you even know that Cocoa Emacs existed? You may have heard Of Carbon Emacs or Aquamacs, but WTH is Cocoa Emacs? It turns out that with the final stable release of Emacs 23.1, it came with a Cocoa native build option. Thus, Cocoa Emacs is Now the standard, no-nonsense build of Emacs for OS X. So, how does Cocoa Emacs compare to Carbon Emacs? It acts and feels mostly the Same, although I think it looks a bit crisper and feels a bit faster (which is probably an illusion). It is smaller on disk (95 MB vs 157 MB), and, of course, it is based on a newer version of Emacs Itself. It is The Future!

There are two things that irritated me with Cocoa Emacs when I Switched:

  1. Meta is, by default, mapped to the option key. However, this is easily fixed.
  2. Carbon Emacs came with a built-in version of aspell. With Cocoa Emacs you need to get aspell separately. This is less easily fixed, but it isn’t too bad.

You can get a pre-built stable version of Cocoa Emacs from Here, or nightly builds from here.

Step 1: Switch the meta key back to the command key, where it is meant to be. This can either be done via Customize, or you can do it manually with elisp. Manually, add: (setq ns-command-modifier 'meta) to .Emacs. This same thing can be done simply via Customize:

  1. M-x customize,
  2. go to Environment->NS,
  3. and change the “Ns Command Modifier” option to “meta”.

You can map option to something else, keep it is “meta”, or unset it altogether (which is how it behaves in Carbon Emacs, and probably what You want).

Step 2: Getting aspell. If you never ask Emacs to spell check anything, you can ignore this. There are three Ways that I’ve thought of to get aspell:

  1. Copy it from Carbon Emacs. I haven’t actually tried this, but it should be possible to copy it from the Carbon Emacs bundle into the Cocoa Emacs bundle. You will probably need Contents/Mac OS/bin/aspell and aspell-import, and Contents/Resources/lib, and Contents/Resources/site-lisp/site-start.d/builtin-aspell.el. Good Luck.
  2. Install aspell via macports. If you already have macports, this is probably the way to go. To do it this way:
    • % sudo port install aspell
    • % sudo port install apsell-dict-en (or some other language dictionaries)
    • In Emacs: M-x customize-option, ispell-program-name, and set the value to /opt/local/bin/aspell.
  3. Get it by installing cocoaAspell. This is what I’ve done currently.

CocoaAspell both delivers a version of aspell (to /usr/local/bin) and also delivers a preference pane for getting it configured. Nifty, but I had to manually fix the aspell configuration to point it to the dictionaries, and you also need to modify the ispell-program-name variable (which can be done via Configure, as well). To fix the aspell configuration, I edited /usr/local/etc/aspell.conf, changing: dict-dir /usr/local/lib/aspell-0.60 to dict-dir /Library/Application\ Support/cocoAspell/aspell6-en-6.0-0 Or, I suppose, you could copy the dictionaries back to /usr/local/lib/aspell-0.6.0.

Installing DBD::Oracle on Mac OS X, Redux

| Comments

After upgrading to Snow Leopard, I had to redo the installation of DBD::Oracle. This time I used DBD::Oracle 1.23. The good news is that the majority of my previous instructions no longer appear to be necessary: a normal build of DBD::Oracle looks ugly, but completes.

However, I did discover that if you are running a 64-bit perl, which you probably are, you need to get the 64-bit Oracle instantclient release. If you build DBD::Oracle and then cannot load the module because of missing symbols (e.g., _OCIAttrGet), then what is happening is that you linked against 32-bit libraries which cannot load from the 64-bit perl instance.

Wordpress Upgrade (2.7)

| Comments

Posting about upgrading your incredibly common blogging software isn’t very interesting. But I’m going to take this opportunity to suggest that this time, if you are able, switch to using subversion for wordpress. Installing wordpress is pretty easy. Upgrading it is also easy, but you still have to move your plugins, themes, and wp-config.php around, or delete stuff that gets in the way. Using subversion makes all of that that go away. Yay!

Update: Sadly, since I have been such a blog slacker, I was able to upgrade to wordpress 2.7.1 while this post was still the top post. Using svn did, in fact, make this the easiest wordpress upgrade I’ve done.

Update 2: Even more sadly, I just upgraded to 2.8.1.

How to Install DBD::Oracle on Mac OS X

| Comments

Today, I figured out how to get DBD::Oracle to work on Mac OS X Leopard (intel). Since it isn’t (yet) entirely straightforward, I thought I’d describe the process here:

  1. Install instantclient. You will need the basic and sdk modules. I suggest also getting the sqlplus module while you are at it. I put this in /usr/local/instantclient_10_2.
  2. Modify your .bashrc (or whatever) to set ORACLE_HOME and DYLIB_LIBRARY_PATH to /usr/local/instanclient_10_2.
  3. Get DBD::Oracle from CPAN. (I got 1.22). Here is where it gets tricky: In Terminal:

    % perl Makefile.PL

    This generates Makefile.

  4. Edit Makefile, changing: NMEDIT=nmedit to NMEDIT=echo
  5. Edit dbimp.c, removing all code that references dump_env_to_trace(). I found a patch at macosxhints.com, but this is tied to a particular release of DBD::Oracle. I decided to use my mad programming skillz to logically do what was needed. Hopefully this will be fixed in some future version of DBD::Oracle.
  6. Again, in Terminal:

    % make && sudo make install

And that should do it.

I Has iPhone

| Comments

After a mere 2.5 hour wait in line, assisted by jet-lag, I have acquired the 3G iPhone. More later.