Jason R. Fruit

stay-at-home father and computer programmer

kiwi

Programming


trunc.py: Cleanly truncate XHTML to a given content length

I know this weekly release is very late, but in the interim I've moved across several states with two small children. I think I deserve some understanding here.

trunc.py is an XHTML truncating library I put together for this website; I use it to make preview snippets of pages that include 500 characters of content, no matter how much markup that may include, without the overhead and programming annoyance of using a full (X)HTML parser. It also does the truncation in a linguistically-sensitive . . .

Read more

Line BASIC

INTRODUCTION

Line BASIC is an imitation of the mode of interaction common to home computers in the 1980s. Most user programs were written in BASIC, and the environment was rudimentary, as it had to be given the constrained resources of available systems. In case someone begins to feel nostalgia for those days, Line BASIC is offered as a cure.

DOWNLOAD

Line BASIC can be downloaded here: Download Line BASIC.

INSTALLATION

Install Vintage BASIC and Python (the language in which Line BASIC . . .

Read more

weather.el --- Weather Reports in Emacs

I've created a little Emacs Lisp tool to get weather reports in Emacs using worldweatheronline.com's JSON API. To get a weather report, do M-x weather-report and enter a location as a ZIP code, city description (e.g. Akron, OH or Helsinki, Finland) or a Canadian or UK postal code. The minibuffer will show a weather report that looks like this:

Weather (via worldweatheronline.com):

Current weather (as of 11:46 AM): Sunny, 28 degrees F, wind E at 0 mph, humidity 60%, 
pressure 1027mb, precipitation  . . .
Read more

Weekly Release

I've decided to try to release a piece of code every week. It doesn't have to be big, it doesn't have to be good, and it doesn't have to be particularly useful --- but it does have to do something, and it does have to find its way into the world.

Read more

Leaving Google App Engine

As a part of my de-Googlifying effort, I moved my website off its Google App Engine foundation. As is detailed here, the site was built using CherryPy, Cheetah templates, Markdown, and a few lesser libraries; very little of that required changes. The most significant dependencies on App Engine were the approaches to user authentication and data storage.

For user authentication, I settled on CherryPy's built-in authentication mechanism, which implements RFC 2617 and works very simply. I can . . .

Read more

Script to Build GNU Guile 2.0.5 on Debian-Based Systems

I've been very impressed with the advances in GNU Guile in the 2.0.x series. Andy Wingo has been doing some things that are excellent for performance and a variety of uses, both as an extension language and as a standalone Lisp programming environment. In fact, I think Guile comes closer than any other Scheme implementation to providing the advantages of Common Lisp.

Of course, it's not in most Linux distributions' repositories yet. It's also kind of a pain to build, partly because it requires . . .

Read more

Language Matters

When programmers discuss languages and somebody asks about advantages of one language or another, it is inevitable that some professional point-misser will bring up Turing-completeness. Stack Overflow is particularly given to this. For example, on this question about what Python is good for, someone answered that "All the languages you've mentioned are Turing Complete, so in theory there is nothing one can do and another can't."

That's true, but irrelevant and almost meaningless. Though . . .

Read more

Emacs, SQLite, and Widgets

In a Stack Overflow answer to a question about using SQLite from Emacs there was a link to a tutorial by Mortimer B. Cladwell III. In it, he shows how to use Emacs as a rapid application development (RAD) tool, using the widget library to create user interfaces and his own SQLite wrapper as a starting point for database interaction.

It's a good idea, but the code --- especially that for SQLite interaction --- needs a little work. It sprays temporary buffers all over the place and . . .

Read more

Oh, Yeah --- and JavaScript

A couple months ago, I wrote about limiting myself to two languages. I forgot something that should have been obvious: you can't avoid JavaScript. No matter what language you are ostensibly writing in, if your application is destined for the web, or uses web technologies, you will end up writing JavaScript, because that's what web browsers understand. (We won't discuss VBScript in polite company.)

JavaScript is a nice little language, and I like it, for the most part. I wish it were a little . . .

Read more

My Productive Computer Setup

I was thinking this afternoon about what I need from a computer to be productive. It's not very much:

I think that about does it: a means of efficiently creating text and code, languages to tell the computer what to do, and ways of viewing others' content in a few common formats. Anything beyond that is probably making me less productive, not more so.

This is a good thing in . . .

Read more
Next 10 >>>