Day of the Year

This is really a note to myself. The other day I needed to figure out what day of the year it was. I was pretty sure that the Unix date command could tell me but I couldn’t remember how to do it and it wasn’t clear from the manual. It turns out the answer is there but not obvious.

The first thing to know is that a starting character of + in the argument tells date that a custom display string is coming. In that string you can use any of the strftime options. One of those is %j for the Julian day of the year. Thus, the answer is simply

date +%j

which for today gives

319
Posted in General | Tagged | Leave a comment

Using Emacs and Org Mode for a Journal

Howard Abrams has an excellent post on journaling with Emacs and Org Mode. The post documents how his use of Org Mode evolved over time so you can see what (at least for him) worked and didn’t work. That’s very useful for figuring out your own strategy even if you settle on something different from what he did.

One of the things I like about his approach is that he uses org-capture to make his entries. That’s nice because no matter what you’re doing you can pop up a capture buffer, make a quick entry, and go back to what you were doing with very little effort. That makes it easier to maintain the journal because it’s almost frictionless.

Another nice thing I learned from his post is autoinsert. It allows you to automatically insert text to the start of a file when you first create it. It’s another in the long list of ways that Emacs can make your workflow more frictionless.

Even if you’re not interested in maintaining a journal, you should give this post a read. You may learn a useful technique or two.

Posted in General | Tagged , | Leave a comment

Counting Spanning Trees

I really enjoy Atabey Kaygun’s blog. If you like Mathematics and Lisp, you’re sure to enjoy it too. A typical post looks at a mathematical problem and either presents a solution or experiments with the problem with Common Lisp.

One of his recent posts considers spanning trees (ST) and how to count them. Most of us—at least those who have taken an algorithms course—are familiar with the simple construction to find an ST but may not know how to count them.

Atabey introduces the notion of the Laplacian of a graph, \(L\), defined by \[l_{ij} = \begin{cases} \text{deg}(i) & \text{if } i=j,\\ -1 & \text{if there is an edge between } i \text{ and } j,\\ 0 & \text{otherwise}. \end{cases}\]

Kirchhoff’s theorem tells us that the number of spanning trees is equal to any of the minor determinants of the Laplacian. This is a pretty neat result and one that I didn’t know. Atabey’s post has a couple of worked examples and Lisp code to make the calculations.

As I said, if you like Mathematics and enjoy programming in Lisp, you should definitely give this post a read.

Posted in General | Tagged , | Leave a comment

Org Mode and Reproducible Research

EmacsNYC has another great video up. This time, its Evan Misshula talking about Org-mode and reproducible research. Misshula is a graduate student in Criminal Justice at CUNY who does a lot of statistical research on Criminal Justice matters.

Like me, he’s a big advocate of reproducible research and spends much of his presentation talking about how Org-mode can facilitate that. In the first part of the talk he explains why reproducible research is so important. If you’re any kind of scientist, the statistics that he gives will set your hair on fire.

As a result of the high error rate with research that is not reproducible, Misshula refuses to review or cite any papers that aren’t reproducible and he urges other researchers to do the same. As I said, the statistics for research that is not reproducible is staggering. Sadly, this applies to Computer Science as much as it does to other disciplines. Watch the video to learn the details.

Posted in General | Tagged , | Leave a comment

Emacs on Git

It’s been a long time coming but as of today, Git will be the official repository for Emacs. It’s easy to miss what a monumental achievement this is.

It would be easy to shrug off the news with a so what. Move the files over to Git and be done with it. It turns out to be way, way harder than that. Eric Raymond (esr) has spent most of the last year making the transition. That’s more amazing when you realize that esr is probably the world’s leading expert on moving repositories to Git.

Emacs is about 30 years old and has been hosted on several VCS systems. Here’s a post by esr that describes some of the problems he had to deal with. Elsewhere he remarks

You might think “Huh? Emacs already has a git mirror. What else needs to be done?” Quite a lot, actually, starting with lifting Bazaar commit references into a form that will still make sense in a git log listing. Read the recent emacs-devel list archives if you’re really curious.

Along the way, he’s also transferred other large repositories, including Groff, and has looked at doing the same for the NetBSD codebase. He’s also developed several tools, such as reposurgeon and cvs-fast-export. Search his blog for either of those two terms to get an idea of the huge amount of effort he’s expended just in engineering the tools.

We all owe esr a debt of gratitude for the yeoman service he’s put in on this project and on migrating other code bases to Git. Well done, sir.

UPDATE: esr is reporting that the new repository is on-line and available for cloning at git://git.sv.gnu.org/emacs.git.

Posted in General | Tagged | 4 Comments

IE on Mac

Why?

Posted in General | Tagged | Leave a comment

Building gnuplot on OS X

As part of my on-going efforts to get my new MacBook Pro set up with my normal working environment, I tried to compile gnuplot. The first problem was that libpng and libgd were not installed so there was no png support. In short order, I downloaded the libraries and got them compiled. On to building gnuplot.

The problem was that the configure script for gnuplot could not verify that libgd was installed even though it was. I tried all sorts configure arguments and other machinations but no joy.

I asked DuckDuckGo and it said that everyone was having the same problem but none of the suggested solutions worked. Finally, I gave up and just modified to configure script to believe that it had found it. configure scripts are notoriously opaque and very hard to figure out. After a bit of fussing around, I got it to believe that libgd really was there. After that, gnuplot compiled with png support and works perfectly.

I think this is probably some artifact of Apple using LLVM instead of gcc. If you’re trying to build gnuport on a recent version of OS X and having problems with libgd support, here’s a patch for configure that worked for me.

--- configure.orig      2014-10-19 08:18:04.000000000 -0400
+++ configure   2014-10-19 08:46:47.000000000 -0400
@@ -10266,7 +10266,9 @@
 else
          { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libgd not found or too old, version >= 2.0 is required" >&5
 $as_echo "$as_me: WARNING: libgd not found or too old, version >= 2.0 is required" >&2;}
-       with_gd=no
+       with_gd=yes
+$as_echo "#define HAVE_GD_PNG 1" >>confdefs.h
+libgd_LIBS="$libgd_LIBS -lpng"

 fi

@@ -15456,7 +15458,8 @@
 fi


-if test "$ac_cv_lib_gd_gdImagePng" = yes; then
+#if test "$ac_cv_lib_gd_gdImagePng" = yes; then
+if true; then
   { $as_echo "$as_me:${as_lineno-$LINENO}: result:   png terminal: yes" >&5
 $as_echo "  png terminal: yes" >&6; }
 else

This is probably not an optimal patch since I was flailing around trying to get it to work but it is, after all, just to get configure to agree that libgd is there. Just make sure that libgd really is installed.

Posted in General | Tagged , | Leave a comment

Join the NSA and Do Illegal Things

You probably can’t legally do those things at the NSA either. It’s just that you likely won’t get caught.

Posted in General | Tagged | Leave a comment

Rating Secure Messaging Applications

The EFF has published its Secure Messaging Scorecard that rates several messaging applications on several important security axes. Some have all the desired attributes, others have none. Some, like Apple’s iMessage have most of the attributes but fail to be open source or have the ability to verify a contact’s identity.

The EFF says this is just an overview and that they are working on additional, deeper analyses of the usability and security of the tools that scored best in this initial phase. As the EFF says, this scorecard is not an endorsement or guarantee, just an indication of which of the applications are on the right track.

I’m looking forward to the future reports. I consider iMessage reasonably secure for day-to-day use but if I had something I really needed to be sure was secure, it would be nice to have some help choosing the best tool.

If you have any interest in secure messaging, you should take a look at the score card. And, of course, though I haven’t said so for a while, you should help support the EFF. They are working to protect us all.

Posted in General | Tagged | Leave a comment

Microsoft

Still evil after all these years.

Posted in General | Tagged | Leave a comment