post-posterous

back to words 'n' deeds

Git : Diff'ing .docx files

I created a docx-to-txt converter (more like adapted it from: http://progit.org/book/ch7-2.html)

You can use it in your Git repositories to do some simple diffing of Office Open XML formatted Word files (.docx file extension).

Filed under  //   git  

:show_exceptions

I have a Sinatra app that wouldn't show the exception backtrace in the log when an error occured. Obviously, it's a bad idea to log backtraces, but in development/pre-production it can be really handy. It turns out that in my modular app, I needed to disable :show_exceptions. Once that was disabled I wouldn't see the error page in my browser, but the side effect is that I get the backtrace available to me in my log. I didn't expect such a side effect.

My actual code is something like this:

Here's a sample application that shows the behavior a bit better:

If you remove ", :show_exceptions" from line 9 of app.rb you won't get the backtrace in the log that is being logged at line 18 in the "error" block.

Filed under  //   ruby   sinatra  

GMail's new scrolling mail header bar

GMail's new scrolling mail header bar is nice, but it doesn't quite work in composition mode. All too often, I am writing a new email, or responding to one and the scrolling header has scrolled right over my send button. Out of habit I click the button that is in the same area as the Send button, which in this case is the back-to-your-search-or-inbox-or-whatever-context-you-were-in-before-getting-here button, a.k.a. the left arrow button.

Screen_shot_2011-10-13_at_10

Inevitably, I think I've sent my mail only to find that it's in my Drafts folder -- I then bang my head and exclaim "stupid me, I did it again". But it isn't "stupid me". This is a serious usability design flaw in GMail. I find the floating bar very useful when reading emails, but it just gets in the way when writing.

Filed under  //   misc  

SublimeText2 : Vintage mode

I just found the Vintage mode in SublimeText2: http://www.sublimetext.com/docs/2/vintage.html

Now, I can have vi-like capabilities in my quickly-becoming-favorite-non-Mac text editor.

For major text manipulation and/or macro recording I will probably still need to dump out to vim. We'll see how it goes.

Filed under  //   sublimetext2   vim  

Random Data

I just came across a neat little gem that helps you generate random data: http://random-data.rubyforge.org/. Great for generating random test data.

It is also simple to extend. Can't find the random data you are looking for? Create a data file for it, put it in your load_path and Random will look for it when you call a method on Random that doesn't exist (uses #method_missing). If Random can't find a data file on your load path, it will raise an error.

In this example, we are creating records for UK expatriates that are living in the United States, with their county of birth being read from the uk_county.dat file.

Filed under  //   ruby  

Removing markers from a Highcharts chart

I've been playing with Highcharts.js recently (http://highcharts.com).
Sometimes the markers on lines, splines, areas, etc. can get really
annoying. You can get rid of those pretty easily by setting the
plotOptions.series.marker.fillColor to 'none' and the
plotOptions.series.marker.lineColor to null (which causes it to
inherit the line color from the axis line). Here's a Gist to show what
I mean, lines 19-26 are the relevant code in this case:

Dell's Speed of Thought

Dell's "Speed of Thought" photo booth at the Austin City Limits Music Festival looked pretty neat: http://www.youtube.com/user/DellVlog

Check out the water balloon video: http://youtu.be/irwjERZgjR8

Filed under  //   misc  

Messaging

Recently, a famous post to the Squeak mailing list was resurrected in my memory. It's from Alan Kay on the real power of Smalltalk (http://lists.squeakfoundation.org/pipermail/squeak-dev/1998-October/017019.html). I am including the message in its entirety here:

 

Folks --

Just a gentle reminder that I took some pains at the last OOPSLA to try to
remind everyone that Smalltalk is not only NOT its syntax or the class
library, it is not even about classes. I'm sorry that I long ago coined the
term "objects" for this topic because it gets many people to focus on the
lesser idea.

The big idea is "messaging" -- that is what the kernal of Smalltalk/Squeak
is all about (and it's something that was never quite completed in our
Xerox PARC phase). The Japanese have a small word -- ma -- for "that which
is in between" -- perhaps the nearest English equivalent is "interstitial".
The key in making great and growable systems is much more to design how its
modules communicate rather than what their internal properties and
behaviors should be. Think of the internet -- to live, it (a) has to allow
many different kinds of ideas and realizations that are beyond any single
standard and (b) to allow varying degrees of safe interoperability between
these ideas.

If you focus on just messaging -- and realize that a good metasystem can
late bind the various 2nd level architectures used in objects -- then much
of the language-, UI-, and OS based discussions on this thread are really
quite moot. This was why I complained at the last OOPSLA that -- whereas at
PARC we changed Smalltalk constantly, treating it always as a work in
progress -- when ST hit the larger world, it was pretty much taken as
"something just to be learned", as though it were Pascal or Algol.
Smalltalk-80 never really was mutated into the next better versions of OOP.
Given the current low state of programming in general, I think this is a
real mistake.

I think I recall also pointing out that it is vitally important not just to
have a complete metasystem, but to have fences that help guard the crossing
of metaboundaries. One of the simplest of these was one of the motivations
for my original excursions in the late sixties: the realization that
assignments are a metalevel change from functions, and therefore should not
be dealt with at the same level -- this was one of the motivations to
encapsulate these kinds of state changes, and not let them be done willy
nilly. I would say that a system that allowed other metathings to be done
in the ordinary course of programming (like changing what inheritance
means, or what is an instance) is a bad design. (I believe that systems
should allow these things, but the design should be such that there are
clear fences that have to be crossed when serious extensions are made.)

I would suggest that more progress could be made if the smart and talented
Squeak list would think more about what the next step in metaprogramming
should be -- how can we get great power, parsimony, AND security of meaning?

Cheers to all,

Alan

Filed under  //   Smalltalk  

Dell V715w on Linux

I am running a 64bit Linux Mint distro and wanted to connect it to my
Dell V715w printer (made by Lexmark for Dell). The driver that comes
from Dell is for 32bit installations only (SuSE, Ubuntu, and RedHat).
What to do?

Well I went to Lexmark's site and downloaded a 64bit driver from here:
http://support.lexmark.com/index?docLocale=en_US&page=content&id=DR20852&loca...

Then, I unpacked the driver and ran it:
sudo sh lexmark-inkjet-legacy-1.0-1.amd64.deb.sh

It installed the drivers just fine, but when I clicked Next, to have
the installer "find" my printer wirelessly (which I had already setup
via my Windows machine) it couldn't find it. So, I clicked the box
that said I would specify my own IP, chose the Lexmark S300-S400
series option (just a guess), specified the printer's IP, and boom: I
got a wireless printer.

Printing is hunky-dory.

I haven't got the scanning working yet. Hmph...