Jon-Michael Deldin

BMX, bike trials, & software from the Pacific Northwest

Recent Posts

Showing sunrise and sunset information in Emacs

As days get shorter and shorter, I find myself wondering when the sun will set at whichever skatepark I plan on visiting. In the past, Googling “sunrise|sunset <location>” sufficed, but I wanted something that ran locally and automatically on my Linux machine, and like any Emacs user, I wanted it to run inside Emacs. As it turns out, this functionality is already built into Emacs’ diary feature.

Read more…

* * *

Calculating business days in Emacs

I do all of my client invoicing inside Emacs, and one thing I keep track of is an expected payment date, which is the invoice date plus NET15/NET30/etc. terms (i.e., 15 business days after the invoice date). Until now, it’s been a rough guess, but thanks to Emacs calc, it is now more precise.

Read more…

* * *

Counting the number of XML elements with REXML and XPATH

Sometimes you need a quick-and-dirty way of counting some elements, but not as dirty as calling out to shell and using grep and wc on it (e.g., grep '<resident>' my.xml | wc -l). Imagine you have the only have the Ruby standard library available and wish to count the number of <resident> elements:

Read more…