Emacs fiddling: show the menu-bar when the mouse is near the top of the frame

My wife is having dinner with the baby at her parents’, so I took a moment to do a bit of pure, pointless, fun hacking after reading a discussion of which emacs gui features to turn off on a site I frequent. I turn off the tool bar and the scroll bar to get as much screen real estate as possible, but leave the menu bar on, because it doesn’t take up that much space, and I occasionally use it to grab some little used feature whose full function name I don’t recall.

My idea: make the menu bar appear only if the mouse is in that general vicinity. This initial implementation is hacky and doesn’t work quite right; but it shouldn’t take much to make it work. It’s probably actually already been done somewhere, but it was fun to hack up something for the sake of hacking… something I don’t get enough time for these days.

    (defun menu-bar-show-hide-helper ()
      (if (< (cddr (mouse-pixel-position)) 20)
      (menu-bar-mode 1)
    (menu-bar-mode 0)))

    (defun menu-bar-show-hide ()
      (run-with-idle-timer 0.1 t 'menu-bar-show-hide-helper))

I’ll add fixes and updates as they are sent in.

The Economist on “Management Gurus”

One of the reasons why I created Squeezed Books was to “deflate” some of the hot air present in many business books, so I particularly enjoyed The Economist’s cynical take on “management gurus”:

The three habits of highly irritating management gurus

The first is presenting stale ideas as breathtaking breakthroughs

The second irritating habit is that of naming model firms. Mr Covey littered his speech in London with references to companies he thinks are outstandingly well managed, including, bizarrely, General Motors’ Saturn division, which is going out of business.

The gurus routinely ignore such basic precautions as providing a control group.

The third irritating habit is the flogging of management tools off the back of numbered lists or facile principles.

And their conclusion is spot on:

Which points to the most irritating thing of all about management gurus: that their failures only serve to stoke demand for their services. If management could indeed be reduced to a few simple principles, then we would have no need for management thinkers. But the very fact that it defies easy solutions, leaving managers in a perpetual state of angst, means that there will always be demand for books like Mr Covey’s.

LangPop.com Updates

It took me a while to get the September update of LangPop.com out. The reason: I had to redo the book statistics.

Previously, I got those from Amazon’s web service, which worked ok as far as those things go. However, recently, I ran into several problems:

  • They started requiring signatures on the requests, which meant I had to stop and fiddle with my code, which I did not appreciate. (If you have this problem and use Ruby, get the amazon-ecs Ruby gem)
  • Their results suffered from some kind of regression in any case: C, C# and C++ all showed up with the same number of results. They didn’t use to show the same numbers. Not good from my point of view.
  • They were completely unresponsive to requests for information or help.
  • And for good measure, they hid their information about their products API on some other web site, with no links from their web services page, which makes it kind of annoying to look for it, and suspicious that they may be removing it at some point in the future.

All of these together made me decide it was time to switch data providers. Where to go? The answer was obvious: back to my home state of Oregon, to Powell’s Books, a huge independent book seller. If you ever go to Portland, do yourself a favor and go to Powell’s. It is a city block full of books on multiple floors. When I lived in Portland, I would go there before eating to give myself a reason to leave (although they do have a cafe…). And that’s just the regular book store. They have another huge space a few blocks away dedicated entirely to technical books. Powell’s is one of my favorite things in Oregon, and a great experience.

Anyway, I decided that they’re big enough, and do enough business online that I’d ask them about getting data, so I sent some email asking after what options were available. I got a very helpful answer from a real person, CJ Stritzel, who was kind enough to explain what the options were, and work with me to help find the best one for what I needed. Definitely better than “/dev/null”, the Amazon message board!

The API is still something they’re working on, but it works well enough for what I need, and I’m quite happy with the situation. It has caused some changes in the rankings, though: they show Java books as being by far and away the most popular, which has pushed that language into the top spot in the rankings. We’ll see over the coming months; I may rework the queries I’m using some as their API stabilizes and I experiment with different combinations of keywords.

In any case, thanks Powell’s, and enjoy the new statistics everyone.

Tcl and the Tk Toolkit, 2nd edition

I’m not sure what I was expecting, but the news that “my” book is finally out is cause for excitement, anxiety, and relief.

It’s not actually “my” book at all; it was originally written by Dr. John Ousterhout, who created the Tcl programming language, and the Tk toolkit. And Ken Jones is listed as the co author of the 2nd edition, because he’s the guy that pulled everything together and managed to actually bring the project to fruition.

However, I did play a part a part in the project. About 5 years ago, I was doing a lot with Tcl, and then, as now, I thought it was a shame that the language was not promoted as well as it could be. It’s not a perfect language, but at nearly 20 years old, it has stood the test of time, and it has a lot going for it. In any case, at the time, I had noticed that there was no good, publicly available tutorial. Tcl has always had an excellent set of man pages describing all of its various commands and subsystems, but did not ship with a tutorial that would help new users get started.

I thought that that would be a good problem to solve in order to make the language more attractive to newcomers. However, writing a tutorial from scratch is no simple task, so I started looking around for material that might be adapted. One thing that sprung to mind was the first edition of “Tcl and the Tk Toolkit”. At that point the book was nearly 10 years old, which in tech years is practically forever, and indeed, the material in the book, while good, was quite dated for some portions of Tcl. Figuring it couldn’t hurt, I emailed Dr. Ousterhout to see what he thought of open sourcing the book, or at least the first part of it, with the idea of updating and utilizing that as a tutorial. He was actually ok with that idea, but the copyright belonged to the publisher rather than him, so he gave me a contact with the publisher, who I then sent my idea to. They weren’t necessarily against the idea of releasing the material under an open license, but came back with another idea: why not update the book? That sounded like an interesting project in its own right.

I don’t recall all the details (this was in 2004), but the publisher ended up with Ken Jones as the guy to run the project, as he’d participated successfully in updating another popular Tcl book. In the end, there were several of us (Eric Foster-Johnson, Donal Fellows and Brian Griffin, in addition to Ken and myself), that worked on the project, divying things up by sections, with Ken coordinating. I am honored to have my name listed amongst such august company.

Which brings me back to being nervous: the idea of having something I wrote “set in stone” is a source of some anxiety for someone like me used to working with such a malleable world as that of software. Also; I wrote most of my contribution (I focused on the C API) several years ago, and I hope it’s still valid, and of course that there aren’t any huge and glaring errors.

For a while, the book seemed like it was in limbo – just when I thought it was dead, Ken would come back with an update. This was also a cause for concern, as I wanted the thing to either die a dignified death, and get on with my life, or appear in print.

As for the tutorial, I did manage to make that happen as well. Clif Flynt, who authored a Tcl/Tk book of his own, was kind enough to donate some material from a tutorial of his own, which several of us hacked at to get it into shape. It’s available here: http://www.tcl.tk/man/tcl/tutorial/tcltutorial.html

In any case, I sincerely hope that the material I wrote manages to do justice to the years and years of work that have gone into the language and its implementation, and hope you find the book valuable if you pick up a copy.

Stopping DocBook Version Control Churn

I have been getting frustrated with DocBook’s generation of HTML files, because it seems to gratuitously insert random id’s for things in a pattern that doesn’t repeat, so you run xsltproc on the same file twice, and the output changes. subversion, git, etc… pick up on the differences and want to save the new version, which is quite annoying.

I figured out a way to get around this. I have no idea if it’s ugly or not, but it works and that’s enough for me. Comments/ideas/improvements welcome.

<xsl:template name="object.id">
  <xsl:param name="object" select="."/>
  <xsl:choose>
<xsl:when test="$object/@id">
  <xsl:value-of select="$object/@id"/>
</xsl:when>
<xsl:when test="$object/@xml:id">
  <xsl:value-of select="$object/@xml:id"/>
</xsl:when>
<xsl:otherwise>
  id-<xsl:number level="multiple" count="*"/>
</xsl:otherwise>
  </xsl:choose>
</xsl:template>

The key is the line:

  id-<xsl:number level="multiple" count="*"/>

which replaces

  <xsl:value-of select="generate-id($object)"/>

The problem is that generate-id, at least in xsltproc, uses a fairly random bit of data (memory location) to create the id.

My fix uses the location of the element within the document as the id.

Open Source Infrastructure?

What’s your opinion?

I’m considering moving the Hecl project to something a bit more modern in terms of infrastructure.

My rough idea is:

  • The web site stays at http://www.hecl.org

  • github for version control

  • Google Groups for the mailing list.

  • Google Code for the bug tracker. Or is github’s up to snuff at this point?

I don’t need much – Hecl isn’t a huge project in terms of code or number of committers, but SF is starting to feel a bit… “creaky”, so I have started thinking about alternatives, even if we’re in no hurry to jump.

Attracting talent to work on the project is definitely one of my biggest concerns. I think that Groups and Github definitely make that easier than SourceForge, but on the other hand, git is fairly new, and I’m not sure how widely it’s used outside of that geeky core that jumps on anything new.

What do you think? Is it going to be more disruptive to switch infrastructure than the gains from slightly more modern systems? Is it worth switching at all? Is it worth trying to use something like Google Code that at least groups most of the bits and pieces together? If you found it worthwhile to move away from SF, what was the “breaking point” for you?

Windows for Developers?

Unfortunately, in order to do some BlackBerry hacking, it looks like I need a copy of MS Windows, to run under some sort of virtualization software. It’s possible to get most of the bits and pieces sort of working under Linux, but I don’t want to spend too much time fiddling; I’d rather spend it hacking.

To be brief and to the point: anyone out there know if there are deals for developers, open source or otherwise, to buy a legitimate copy of Windows? It’d sure be easy to just download it, but I believe in respecting other developers’ licenses just as I want them to respect mine.

However, if I could save a few bucks and spend them on my daughter Helen, instead of Mr. Gates and company, I sure wouldn’t mind. Any ideas?

Running the BlackBerry Emulator on Linux

I seem to have gotten it to work, more or less consistently (although I’ll keep my fingers crossed).

The first step is: do everything this guy says, and thank him profusely, as he seems to have blazed a path for everyone else to follow.

http://www.slashdev.ca/2008/03/27/blackberry-simulator-in-linux-sort-of/

Keep in mind that newer versions of the JDE (mine is 4.7) have different devices, so create, for instance, a 9500.sh instead of the 8800.sh.

These points bear repeating, as gleaned from the comments on the above post.

  1. Make sure you have the very latest Wine that you can find and is somewhat stable. I used this: deb http://wine.budgetdedicated.com/apt intrepid main
  2. Get gdiplus.dll (search for it with Google) and install it in your .wine/drive_c/windows/system32/ directory. (From Cay in the comments).
  3. Get msxml.msi (Google, again) and run it like so: wine start msxml.msi, which should install it in wine for you. (From Patrick).
  4. Edit your shell script to make wine stick with one processor: task -c 0 wine fledge.exe .... (From Andrey in the comments)

To load up your hello world application, select the file menu, “load java program”, and then in the emulator, go to the ‘downloads’ section (double clicking on the main screen should get you to the applications). Your app should be there.

So far so good, although the whole thing is a gigantic pain in the neck compared to development with platforms like Java ME or Android, where Linux versions exist.

Update

Sadly, it still randomly exhibits problems. How frustrating.

Something I’d like to See: Cheap J2ME “device”

Here’s the idea: there are tons of games and things out there for j2me (err, make that “Java ME”), and it’s a fairly simple API, it’d be nice to have something that’s a bit less than an actual phone, that can be loaded up with stuff to play.

I’m specifically thinking of my daughter when I talk about this – she loves to grab mom and dad’s phones and run around with them, but it’d be better if she had something of her own, and, hey, why not make it something real where I could write some neat little games or interactive things?

There are some mobile phones that are getting very cheap, that would probably do nicely, but the really cheap ones don’t have J2ME. I think the price for this should be under 50 dollars.

I suppose the best thing would be to find a cheap phone on eBay, but I think there’s a market for something similar to what I’m describing.

Jeff “Tiara” Atwood release of LangPop.com

Jeff Atwood, of “Coding Horror”, snarkily writes, via twitter:

programming language popularity. they should award tiaras! http://langpop.com/

Since LangPop.com site was due for an update, in the same spirit of snarky fun, I am calling this release the Jeff “Tiara” Atwood release as a way of saying thanks for driving a lot of traffic my way.

Jeff "Tiara" Atwood

Nothing much new this month, really. A lot of people have been asking for Scala, so perhaps that will appear in the coming months. I think it probably shows up on most of the metrics now.

Yes, I know, the Amazon results are still borked. If anyone out there knows the team at Amazon that handles that stuff, it would be really great if you asked them to fix the fact that “C” == “C++” == “C#” in their search. Thanks!

PS, let he who is without copious amounts of “merit badges” cast the first tiara…