Thursday, May 19, 2011

Zombies, Emacs and Orgmode

Zombie Graph with Emacs and Graphviz Zombie Apocalypse Digraph

I was playing around with Graphviz inside orgmode inside Emacs. Come the Zombie Apocalypse I'll be prepared, thanks to Emacs and Orgmode. Here's the Graphviz src:

digraph D {
  size="8,6"
  node [shape = polygon,
        sides = 4,
        distortion = "0.0",
        orientation = "0.0",
        skew = "0.0",
        color = "#aaaaaa",
        style = filled,
        fontname = "Helvetica-Outline" ];
  apocalypse [sides=9 skew=".32" color="purple"]
  apocalypse -> zombie
  apocalypse -> zombies
  shovel [skew=".56" color="#aa2222"]
  subgraph singular {
    label="one"
    color=purple
    zombie -> shovel [color="#440000"]
    shovel -> run
  }
  run [sides=9, color=salmon2];
  subgraph plural {
    label="many"
    color=red
    zombies -> run [color="#00a4d4"]
  }
}
save this file as zombies.gv, then run: graphviz zombies.gv.
If you are interested in graphviz, you can click on any graph in this gallery and see the graphviz source for the graph.

I wrote the graph source first in Emacs in Orgmode 7.5. Here's the src for experimenting with graphs in orgmode using the new org-babel, which lets you evaluate code in special code sections right inside of Emacs:

#+begin_src dot :file digraph2.png :cmdline -Kdot -Tpng  
digraph D {
  size="8,6"
 node [ shape = polygon,
  sides = 4,
  distortion = "0.0",
  orientation = "0.0",
  skew = "0.0",
  color = "#aaaaaa",
  style = filled,
  fontname = "Helvetica-Outline" ];
  apocalypse [sides=9 skew=".32" color="purple"]
  apocalypse -> zombie
  apocalypse -> zombies
  shovel [skew=".56" color="#aa2222"]
  subgraph singular {
    label="one"
    color=purple
    zombie -> shovel [color="#440000"]
    shovel -> run
  }
  run [sides=9, color=salmon2];
  subgraph plural {
    label="many"
    color=red
    zombies -> run [color="#00a4d4"]
  }
}
#+end_src
Then inside the buffer you can evaluate the code with "C-c C-c", and you can see the results of evaluating the code with "C-c C-o". This is made possible by Org-babel, a cool tool that allows you to run scripts from different languages in a single Org-mode buffer. Not only that but you can pipe output from one code block to another code block written in a different language. I will have more blog posts about this in the future. Org-babel is a part of Org-mode since Org-mode 7.x or so. Exciting stuff!

Further Reading


Org-babel Documentation
Graphviz
Edited with the emacs-chrome plugin

Tuesday, May 3, 2011

Updated the Scuttle Plugin to work with Firefox 4

I updated the Scuttle firefox plugin to work with Firefox 4. This was the one utility that was holding me back from upgrading to Firefox 4. I created a github repository. for the project. Feel free to fork the project. Its a good simple plugin if you’d like to learn how to write one.

The original scuttle firefox plugin hasn’t been upgraded since 2007. The version in This updated version is compatible with Firefox 4. You can view the source or fork the project at my github repository. or you can download the plugin directly: scuttle-0.4.2-firefox+fl.xpi

Scuttle is an open source Website Bookmarking System. I switched to it for my bookmarking needs after Yahoo! announced they were shutting down delicious.com. The cool thing about Scuttle is that its open source, (its written in PHP.) so you can download the source and run it on your own web server and if there's a new feature you want for your social bookmarking you can write it, also since it runs on your own server, you can be sure that the service will never end (just make regular backups.) The bad news is that you need to have a web server to run it. If you are just interested in an alternative to delicious you can try pinboard.in.

Also the credit goes to Marcus Campbell, original developer of scuttle and the scuttle plugin and also to Andreas Keller for originally updating the scuttle plugin for Firefox 3.