A Handy Calc Tip

mxavier has a nifty tip for calc:

It’s hard to put a lot of context into a tweet so let me fill in the blanks. If you’re in the calc buffer, typing【y】 (calc-copy-to-buffer) will copy the top of the stack to the most recently used editing buffer. The documentation clarifies that as

More specifically, this is the most recently used buffer which is displayed in a window and whose name does not begin with ‘*’. If there is no such buffer, this is the most recently used buffer except for Calculator and Calc Trail buffers.

This makes it easy to pop into calc, make some calculations, and then copy the result back to the buffer you were working in. Actually, calc-copy-to-buffer is a bit more flexible. You can read the Yanking into Other Buffers section of the manual to get the details. It’s short and well worth a look.

Posted in General | Tagged , | 2 Comments

Storing and Retrieving Files by Tags

Wilfred Hughes points us to this interesting paper on tag-based file systems. The idea is that rather than storing files in the traditional hierarchical manner, they are stored and retrieved by tags. The idea of tags is quite general and can even include key word searches. If you’re like me, the idea of doing away with hierarchical file systems is unnerving. Still, I find that a great deal of my workflow amounts to exactly that through my use of Org mode.

I file notes, links, and other information in a handful of files and retrieve that data via tags. Org mode makes this easy and natural and I can even do regular expression searches through the same Org mode interface. I’ve become very interested in this approach after hearing and reading about Karl Voit’s work on Memacs.

If you’re interested in this sort of thing, Voit has a research implementation that you can try out. He also has some interesting papers on the system and related ideas. On a smaller scale, there’s Memacs. If you’re on Linux, it looks to be pretty easy to get it going. If, like me, you’re on OS X, it’s going to take more work but looks doable. I’m slowly implementing much of the same capabilities and will probably steal and adapt some of his scrips as I add more data gathering functionality.

Posted in General | Tagged , | Leave a comment

Adding Custom CSS to a WordPress Site

When I first started blogging with WordPress, I needed some custom CSS. Being a WordPress n00b, I simply added it to the theme’s CSS file that controls what the site looks like. Of course, that bad decision came back to bite me in the butt and I moved to using a child theme to separate my custom CSS from the theme’s.

Timo Geusch over at The Lone C++ Coder’s Blog has another way of adding CSS to your site. His method requires the jetpack plugin but is easy to use once you have jetpack installed. Geusch says that he thinks adding a child theme is too heavy duty for what he wanted to do but I didn’t find it any more complicated that what he did. For example, here is my entire child theme

/*
 Theme Name:   Twenty Ten Child
 Theme URI:    http://irreal.org/twentyten-child/
 Description:  Twentyten Child Theme
 Author:       jcs
 Author URI:   http://irreal.org
 Template:     twentyten
 Version:      1.0.0
 Tags:         light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
 Text Domain:  twentyten-child
*/

@import url("../twentyten/style.css");

/* =Theme customization starts here
-------------------------------------------------------------- */
pre {
        font-family: "Courier 10 Pitch", Courier, monospace;
        border: 1pt solid black;
        padding: 3pt;
        background-color: #F0F8FF;
        overflow: auto;
}
.key, kbd {
        border:solid 1px #989898;
        border-radius: 3px;
        background-color: #F4F4F4;
        padding-left: .25ex;
        padding-right: .25ex;
        font-family: monospace;
}
.footpara:nth-child(2) { display: inline; }
.footpara { display: block; }
.footdef  { margin-bottom: 1em; }
#site-title {
        float: left;
        font-size: 60px;
        line-height: 36px;
        margin: 0 0 18px 0;
        width: 700px;
}

Other than the header, it’s just my custom CSS. Exactly like Geusch’s solution.

Whatever method you like best, be sure to use one of them if you want to add some custom CSS. Believe me, you don’t want the pain that messing with the theme’s CSS will bring you.

Posted in General | Tagged , , | Leave a comment

Sacha on Supplying an Argument to a Capture Template Function

Org mode capture templates are more flexible than you might think. You can specify that the entry be stored in a file in a variety of ways. You can, for instance, ask that it be put in a date tree at the proper place. That’s just what you want for something like a journal or other date-based file. You can check the documentation to see the available methods.

The most general method is to supply a function that determines where to place the captured data. One downside of that is that you can’t specify an argument to the function. That’s not fatal, of course, because you can always supply nearly identical functions to different templates that have the argument specified implicitly. Of course, as programmers we find that an objectionable solution.

Happily, Sacha Chua has our backs with a neat hack to supply an argument to a template function. The idea is to pass your argument as a property that gets saved in the template’s plist and then have the function retrieve the argument with plist-get. Check out Chua’s post for the details and an example.

Posted in General | Tagged , | Leave a comment

Writing Mastering Emacs

Mickey Petersen has a really interesting post on the technical details of how he wrote Mastering Emacs. It’s not surprising that he used Emacs, of course, but less obviously he chose reStructedText as his source format. That choice was driven by the fact that he wanted to produce both PDF and ePub output. My first thought was, “Why not use Org?” but Mickey says that Org documents have problems being converted to other formats. I export Org to HTML and LaTeX all the time with no problems at all but I don’t know how the ePub would play. Even Knuth won’t recommend an ePub version of The Art of Computer Programming because he can’t make the output faithful to his intentions.

Many publishers these days require that a book manuscript be delivered in docx format. My thoughts on Word are well known. I would never undertake to write a book—or anything, really—in Word (or any of its unholy siblings) but it does provide one very useful feature: the ability for copy/technical editors to suggest changes in the manuscript, which the author can accept or reject on a per suggestion basis. Mickey shows how to do the same thing with ediff.

As with all of Mickey’s writings, you’re sure to learn a couple of things you didn’t know from his post so it’s worth reading even if you have no interest in writing a book. If you are interested in producing a book, it’s essential reading.

Posted in General | Tagged | 1 Comment

Evaluate An Expression and Insert the Result

A handy tip from Wilfred Hughes

It’s easy to forget about the additional functionality you get by adding a prefix.

Posted in General | Tagged | 2 Comments

The FBI and Computer Games

If you’re like me you’re probably often bemused by law enforcement’s almost comical misunderstanding of computers and software. As entertaining as it can be, it can also lead to tragedy. A recent example is the prosecutorial abuse in the Aaron Swartz case.

Over at Boing Boing, they have an absolutely hilarious, if frightening, article about the FBI’s panic over computer games in the early days of the home computer revolution. People were investigated and questioned, equipment and game scripts were seized, companies were put out of business because the FBI was worried that these games were passing on forbidden knowledge of computer hacking to the masses. Obviously something had to be done.

It’s funny at this remove but the same attitudes are prevalent today. Consider the life without parole sentence given to Ross Ulbricht for the crime of running a dark-web drug trading site. However you feel about drug use and those who enable it, this seems excessive. I’d be willing to bet that absent the computer involvement, Ulbricht would have received a much less severe sentence.

Posted in General | Tagged | Leave a comment

The TSA and Airport Security

Bruce Schneier talks sense on the TSA and airport security. After recent reports that the TSA missed 96% of Red Team attempts to smuggle simulated guns and bombs through the check points many are asking why we even have a TSA. As one Israeli wag1 quipped about the TSA, “This is not an airline security system, this is a system for bothering people.”

Last year, Americans spent seven billion dollars on the TSA, apparently for little benefit. We didn’t get improved security, just increased inconvenience and annoyance. Schneier has some thoughts on why, despite the TSA’s dismal performance, we haven’t seen any successful attacks since 9/11 and how we can better use that $7 billion to make flying and other routine activities safer.

Footnotes:

Posted in General | Tagged | Leave a comment

History of BSD Unix

I just stumbled across a nice Salon article on the history of BSD Unix. The article is from 2000 but still very interesting and relevant. Although it examines many of the key players in project, especially Bill Joy, the theme of the article is how BSD Unix and Joy essentially created the open source software movement.

Originally, the software wasn’t open the way it is today although Joy apparently wasn’t too assiduous in making sure recipients had the proper AT&T license. His and the project’s real contribution to open source was in pioneering a development process. A small core team acted as gatekeepers for contributions from many individual developers. Everyone was eligible to play although the filtering was strict and most contributions were not accepted. It worked pretty much the way present day big projects work. Linux, of course, has a core team of one and the organization is a bit different but you can see its genesis in the BSD project.

If you’re a Unix fan or interested in computing history, you will find this article interesting and worth reading. It’s a part of our heritage that every serious developer should be aware of. I really enjoyed it.

Posted in General | Tagged | Leave a comment

The Editor Wars

Colin Weir nicely captures the absurdity of the editor wars:

Posted in General | Tagged | 2 Comments