Hooked on org-mode

January 10, 2012 at 08:46 PM | categories: emacs, vim | View Comments

So, what's a long-time ViM user doing with an Emacs session running all the time? Using org-mode of course.

First a little bit of a problem statement: I forget everything. I've tried lots of different ways to solve the problem. I started with writing a TODO list at the beginning of each day. For a while I succeeded in using a Palm Pilot to keep track of everything. Next was a Google Calendar. For stuff that didn't fit in the calendar I tried to keep a personal wiki. Each method ended up in failure because it was cumbersome. Let me be clear, to me cumbersome means requires more work than typing on a keyboard.

I was pretty excited when I heard about org-mode. Look at the slogan: Your Life in Plain Text. How could that not be good? Not being a Saint in the Church of Emacs it took me a little longer to get comfortable with org-mode, but it was worth it. I'm sure my org-mode use hardly scratches the surface of what's possible, but it's been enough to keep me organized for the past year.

Here's what it took to get started. I created a directory called ~/notes and added the following to my Emacs startup files:

(add-to-list 'auto-mode-alist '("\\.org$" . org-mode))

(global-set-key "C-cl" 'org-store-link) (global-set-key "C-ca" 'org-agenda) (global-set-key "C-cb" 'org-iswitchb)

(setq org-log-done t) (setq org-log-repeat "time")

(add-hook 'org-mode-hook 'turn-on-auto-fill)

(setq org-directory "~/notes") (setq org-agenda-files (file-expand-wildcards "~/notes/*.org"))

Whenever I want to record something I open up a relevant .org file in ~/notes and add entries like this:

* Chores
** Empty garbages
** Mow lawn

It's just an outline, with the number of leading * characters determining the level of each entry.

The only keys I really use frequently are:

  • C-c C-t: transition states (make this a TODO or mark it done)
  • C-c C-s: schedule this entry
  • C-c C-d: set a deadline for this entry
  • Tab: fold (show/hide children of this entry)
  • C-c a a: show the agenda for the current week

org-mode is far more customizable, but for me, that's enough. I'm especially pleased at how easy it is just to start logging things that happen in a meeting or adding something that I just remembered needing to do around the house. There's almost no friction. And everything about the entry lives in the text file. Then, with a few key presses (C-c a a) I know what my next week looks like.


Learning to Run

November 17, 2011 at 07:13 PM | categories: running | View Comments

Two and a half years ago I found myself overweight and out of energy. I decided it was time to lose the extra weight. With the help of The Hacker's Diet I spent the next six months getting to an acceptable weight. Life was great; my weight problem was solved and I felt like I had more energy.

But there was still a problem: I wasn't really in shape and I really had to watch how much I ate so that the weight wouldn't come back. Sitting at a desk all day for work wasn't helping my fitness at all. This spring I decided that I could definitely fix the getting into shape part. I looked at a lot of different possible activities and finally decided that running would be best for me. The deciding factor was that I could run in any weather and anywhere.

Now for the specifics. When I was looking for a way to get started it was helpful to see other specific success stories. So, in that vein, I'll stop short of recommending this program, but I will say that it worked for me.

When I started in May, I could run for about three minutes. After that it was extremely hard to breathe and I hurt everywhere. I set what I thought was a fairly reasonable goal: run a 5K in under 30 minutes by the end of the summer. To add a little motivation, I picked a race and registered.

Knowing nothing about running, I needed a program I could follow. I noticed quite a few other programmers talking about Couch to 5K on Twitter and decided that was as good a start as any. I'm terrible with a watch and too cheap to buy an app to keep track of the intervals for the program so I was really happy to stumble onto Podrunner: Intervals. I loaded up my MP3 player and started running. After five weeks, I'd burned through my cheap tennis shoes and visited the local running store for a pair of running shoes. I'd like to say that I was able to follow the Couch to 5K program without a problem, but it didn't work out that way. I finished week six with a 22 minute run and didn't, but it didn't feel good at all. I backed off to doing 10 minute intervals with a 90 second walk in between and then adding a minute to the running portions for each run. Since I was no longer on the Couch to 5K program, the Podrunner podcasts weren't as helpful so I tried out audiobooks. After doing fifteen minute intervals for a week I found that I could pretty reliably run for 20 minutes without stopping. The two weeks before my first race I struggled to run for more than 20 minutes.

My sister agreed to run that first race with me. I showed up early feeling poorly prepared. To make things more interesting I decided to run with music. We started the race together and quickly found someone running a pace we thought we could keep up. Just a little less than 30 minutes later I crossed the finish line. First goal accomplished.

I set a goal to run my next 5K in less than 27 minutes and registered for a 5K three weeks after the first one. My runs during that prep time finally started to feel good and I found myself easily running for 30 minutes. I also started using CardioTrainer to track distance and time for all my runs. It's a lot of fun to be able to see that map after a run and see just how far you've come. The three weeks passed and I finished the race in a little under 25 minutes. All the real runners can laugh at how slow that is, but I was pretty excited.

At that point, I wasn't sure how much time I could trim off the 5K, but I was pretty sure that I could add some distance. My next goal was to finish a 10K, hopefully in under 60 minutes. I spent the next month adding 1km to my runs each week. Unfortunately, right about the time I got up to 9km, I got sick. Two weeks later I felt better, but I had a hard time running even 3km and had to start building up again. I had registered for a 10K, but I was really worried because I only got back up to 7km on my regular workouts before race day.

It rained on race day, but at least it wasn't too cold. I started the race too fast, then had to talk myself out of quitting during the 3km. Around the 4km mark, I started to feel really good. Goal accomplished: I ran the entire race and finished in 51 minutes.

Next up on my list is a 10K in under 50 minutes next spring and finishing a half marathon next summer. It's taken a lot of work to get to this point, but I'm really happy about it.


Scala as a Java REPL

November 08, 2011 at 09:10 PM | categories: programming, scala | View Comments

After years of Python programming, I've been spoiled by always having a REPL available when I want to test something out. As I spend more and more time in Java, I find myself missing a REPL. Well, no more. I'm happy to report that I've finally found a REPL I like using to test out libraries when I'm working in Java: the Scala REPL.

Today I needed to send some JMS messages to ActiveMQ. Instead of firing up eclipse, creating a maven project to get the dependencies, and then writing some Java code, I used sbt and Scala to create a REPL where I could easily send JMS messages.

Create an sbt project

The first step is to create an sbt project. This is as simple as creating a directory with a build.sbt file in it. My example build.sbt file pulls in two library dependencies that I want to have available in the REPL.

name := "jmstest"

scalaVersion := "2.9.1"

libraryDependencies ++= Seq( "org.apache.activemq" % "activemq-core" % "5.5.1", "org.slf4j" % "slf4j-simple" % "1.6.4" )

Run the REPL

Running the REPL is as simple as running sbt console from the newly created sbt project. From there, it's off to the races:

import javax.jms._
import org.apache.activemq.ActiveMQConnectionFactory

val factory = new ActiveMQConnectionFactory("tcp://localhost:61616") val connection = factory.createConnection val session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE) val destination = session.createTopic("jms.test") val producer = session.createProducer(destination)

val message = session.createMapMessage message.setString("command", "basic_setup") message.setBoolean("do_stuff", false) producer.send(message)

That's all there is to it. Scala, with the help of sbt, makes a great REPL for testing out Java libraries.


Astricon2011 Roundup

October 27, 2011 at 07:26 PM | categories: asterisk, conferences | View Comments

I attended Astricon for the first time this year. Getting some facetime with the Asterisk developers was great and I'm a lot more comfortable with what I'll need to do to get some of my changes upstream. Now for some highlights.

Great Presentations

  • Asterisk Architecture (part of the Introduction to Asterisk Development block) by David Vossel. While the presentation rehashed a lot of the information in the Asterisk chapter of The Architecture of Open Source Applications, the presentation made Asterisk development feel much more approachable.
  • Asterisk Webphone by Chris Mattheiu. Very impressive minimal softphone in a browser. Fun to watch someone daring enough to write code live during a presentation. The only downside was that the web phone requires a proprietary Jingle to SIP gateway.
  • IPv6 -- the (Only) Way Forward by Owen DeLong. No nonsense presentation about what it takes to start using IPv6. I appreciated the candor about what works and what doesn't. Especially enjoyable was the VOIP vendor wall of shame.
  • Clustering and Scaling Asterisk with Kamailio by Klaus Darilion. Using a proxy in front of Asterisk is a complex subject and Klaus did a great job distilling the details into a great look at what's possible. I use OpenSIPS for a similar purpose and picked up a few config items I can simplify.
  • Cooking with Asterisk by Leif Madsen. Solid examples of neat things you can do in the dialplan. The example using Originate and chan_spy to playback a recorded message to one side of the call was impressive.

Stuff I Want to Try Now

  • Adhearsion - Advanced Asterisk call control in Ruby
  • StarPy - AGI and AMI interface for Twisted
  • CMU Sphinx and PocketSphinx - Voice recognition
  • Phono - Almost pure Javascript web phone
  • Tropo - Voice, SMS, and XMPP API

The Fun Stuff

  • Overheard some "creative" methods to deal with users that want to fax during a discussion about fax support on Asterisk SCF.
  • Watching Clod Patry win all the tickets in one of the arcade games at the party.
  • Best Business Card: TechPro used cleaning cloths for glasses as business cards. Especially useful with all the snow and water I got on my classes on the way to the conference.

udiskie

June 03, 2010 at 08:55 PM | categories: archlinux, tools | View Comments

With the deprecation of HAL proceeding at full speed it's time to find a new solution for automounting disks on my Linux box. I've been happily using halevt, which does a lot more than disk mounting, but won't be of much use once HAL really goes away. udisks is the replacement that the major desktops are moving to, so I decided to write a simple automounting daemon for those of us not using a major desktop: udiskie. It's a simple udisks client that just takes care of mounting removable media right now. I run it by adding udiskie & to ~/.xinitrc. When I'm done using a removable disk, udiskie-umount will take care of the unmount. I probably can't stress enough how simplistic and undocumented this approach is, but it works for me.

And, of course, for the Archlinux users, it's already packaged in the AUR: udiskie


Next Page ยป