jlm-blog
~jlm

17-Mar-2012

Berkeley library fire

Filed under: biking, sfba — jlm @ 13:39

I just got home from biking to the Berkeley Central Library, to find the police and fire department there, the library closed off. The BFD was non-urgently sweeping water out the doors, while the evacuated library building had its fire alarm still going. So, it looks like there was a fire there, extinguished by the sprinklers. It didn’t look like there were any injuries, but I worry about the damage to the books, hopefully it won’t be significant.

4-Mar-2012

More links, less commentary

Filed under: biking, misc — jlm @ 20:12

I seem to be bereft of interesting prose to spout, so here’s a link dump instead.

File-sharing based Kopimi (as in, “copy me”) recognized as a religion in Sweden. Interview with the founder.

Witness some software management failure recorded in a bug log.

Growing up in postindustrial Wales.

How the Dutch got their bike paths — they fought hard for them.

African development’s killer app: Cell phones.

Enjoy, peeps.

6-Jan-2012

Gitmo warden: “Close Gitmo”

Filed under: politics — jlm @ 19:59

Ten years ago, M.P. Col. Terry Carrico became the first commander of Camp X-ray, the Guantánamo Bay detention camp. Now out of the military, he talks to the media about the camp he opened.

Carrico also says plainly that he believes it is wrong to keep people indefinitely without trial based on secret evidence.

America should be a nation where this never happens. That we will not imprison people without trial should be woven throughout our identity of what it means to be American. Gitmo is an open wound, self-inflicted, on our very national identity. It’s been bleeding for ten years. We must close it, or lose what being American is.


More: Story from an innocent who spent over 7 years at the camp before being released via habeas corpus. This is what we’ve done. Let’s change. Ten years is long enough to know that this experiment has failed.

4-Jan-2012

With Iraq, it’s the 1980s all over again

Filed under: politics — jlm @ 21:36

While visiting family over the Xmas break, I came across this article from the New York Times republished in the Sacramento Bee.

BAGHDAD – The Obama administration is moving ahead with the sale of nearly $11 billion worth of arms and training for the Iraqi military despite concerns that Prime Minister Nouri al-Maliki is moving to consolidate authority, create a one-party Shiite-dominated state and abandon the U.S.-backed power-sharing government.
[…]
While the United States is eager to beef up Iraq’s military, at least in part as a hedge against Iranian influence, there are also fears that the move could backfire if the Baghdad government ultimately aligns more closely with the Shiite theocracy in Tehran than with Washington.

Well, how about that. Just substitute Obama with Reagan, al-Maliki with Saddam Hussein, and swap Shiite for Sunni and enjoy the déjà vu.

14-Dec-2011

Kentucky Board of Education smacks down creationist school superintendent

Filed under: politics, science — jlm @ 17:50

http://www.evolvingscientist.net/2011/12/someone-got-ahold-of-lines-full-letter.html

That is one awesome response letter. Hard to believe it came from a bureaucracy. I just hope the Board in Frankfort can exert more influence over the schools than Line the Hart County local.

30-Nov-2011

Recommended software: disper

Filed under: linux — jlm @ 12:23

One of the common use cases for laptops is to plug into an external display at a docking station or with a projector, and unplug and use the internal display, then plug into another external display, then later back to the internal display, and keep on cycling like this. Unfortunately, Linux distributions haven’t supported switching displays very easily.

Enter disper to save the day. This is a command-line (and so easily scriptable) tool to switch the display in use. For example, to make only the internal display active, run disper -s. For only the external display, disper -S. And to toggle between them, disper --cycle-stages='-s:-S' -C. So when I want to bind one of the special laptop function keys to alternate between external-display-active-only and internal-display-active-only in Gnome, I run gnome-keybinding-properties, add a custom shortcut to run disper --cycle-stages=-s:-S -C, and bind that to XF86LaunchA. Voilà, with one keypress I can switch between the laptop’s screen and the projector. Other flags to disper let you activate both displays, etc.

15-Oct-2011

userdel dmr

Filed under: obit — jlm @ 09:19

I’m staggered by the enormous discrepancy in news coverage here, with the media still eulogizing Steve Jobs after a week and a half, Dennis Ritchie passes away, and receives hardly a blip.

How can this be? The man was a giant in the field. He was one of the inventors of C, which became the most successful programming language, remains extremely popular after four decades, and was a direct ancestor to many of the most used languages of the present day. It’s difficult to overstate its impact; nearly all of the software you encounter today — on PCs, on servers, in embedded systems, or anywhere — was written in C or a language that traces back to C. It was Ritchie who decided on one of the keys to C’s success, its “portable assembly” aspect: It had to let you get close to the metal, while still abstracting away the architecture’s particulars. Another aspect to C’s success was its excellent manual written by Ritchie and Brian Kernighan, commonly called simply “K&R”: short, clear, and comprehensive; information rich yet simple writing; it set a standard that few computer texts come close to reaching.

He was a father of Unix, which has led to more of today’s operating systems than you can shake a stick at. The first great wave of webservers was on Solaris and other System V variants. There’s a BSD Unix sitting inside MacOSX and iPhoneOS. Richard Stallman modeled his GNU project on Unix, and Linus Torvalds’ Linux kernel was a clone of Unix’s — and the second great wave of webservers was build on these. Nearly all of the servers you encounter online run operating systems using Ritchie’s designs. And every Android smartphone as well. How is it that one OS family can span such a range? It was Ritchie who pushed for Unix to be rewritten to have a portable core for the bulk of the OS, with the hardware-specific bits isolated away for easy migration to new machines. No operating system had ever done this; it let Unix escape the PDP, and escape it did.

News media be damned. I feel Ritchie’s passing much more keenly than Jobs’. He wasn’t showy, but his influence was legion.

6-Oct-2011

Better SelectableChannel registration in Java NIO

Filed under: programming — jlm @ 12:01

Java NIO’s Selector class is surprisingly difficult to use with multiple threads. Everyone that tries it encounters mysterious blocking, much of which is due to it sharing a lock with SelectableChannel.register. So, if you happen to try to register a channel in a thread other than the selector thread, it blocks that thread until the select is done. Boo.

So, this is a NIO rite of passage of sorts, finding this misfeature and then looking up how to work around it. The usual answer is to keep a ConcurrentQueue of pending registrations, and have your select loop process that queue between select calls. Uggggleeee. It occurred to me that using a synchronization lock, we can do better.

To register a channel and get the SelectionKey:

  synchronized(registerLock) {
      selector.wakeup();
      key = channel.register(selector, operations, attachment);
  }

And in the select loop:

  // before
  synchronized(registerLock) {}
  // between
  numEvents = selector.select(timeout);
  // after

If the loop is before or after when our registration block takes the registerLock, we’re fine, as having the registerLock prevents the loop from reaching select until we’ve registered and released the lock. If the loop is inside select(), then the wakeup() will cause it to exit select, and it won’t re-enter because we hold the registerLock, so we’re fine.

The tricky case is when the loop has the registerLock or is between releasing the registerLock and entering select(). In these cases, the registration block takes the registerLock and races with the loop over select() and wakeup(). Fortunately, the NIO designers anticipated that programmers would have a desire to ensure a Selector wasn’t selecting, even if the wakeup was called in the window between checking it was okay to enter select and actually entering it. Selector.select() returns immediately if wakeup() had been called after that Selector’s prior select(). So, our race doesn’t matter, the select() always exits, and we’re safe.

This is so much simpler than building up a queue of registrations and processing them in the select loop, and we get the SelectionKey right away, I wonder if I’m missing something. Why is the textbook technique to use a ConcurrentQueue, instead of a synchronization lock like this?

30-Sep-2011

Interesting video on psychopathy

Filed under: science — jlm @ 20:49

Time to take a break from my break from blogging.
Today I found this video pretty interesting, a neuroscientist discovers his brain scan matches those of psychopaths.

[Update: link “http://wsf.tv/videos/embedded/1361” has died, sorry.]

18-Jun-2011

Linux distribution switch, 2011 edition

Filed under: linux — jlm @ 23:15

I switched to OpenSuSE tonight.
PCLinuxOS had been grating on me for the last few months, since they decided to drop most of their man pages in favor of entering “man foo” into Google. But after an ordinary update, tonight I discovered that the new kernel hung on boot. To my distress, GRUB didn’t list any previous kernels when I intercepted its autoboot. After trying and failing to get grub to show me any files on the filesystem so I could select another kernel from /boot to boot from (why is this so hard?), I booted from a rescue disk… and discovered that there was only one kernel version in /boot, PCLinuxOS had been deleting the previous versions. This bad practice dismayed me, it’s standard for distributions to keep the previous one or two kernels around, in case of a case like this, where a kernel that doesn’t boot on someone’s hardware get pushed.
I’d been meaning to try out SuSE again for a while, and this pushed me over. I backed up my disk and did a clean install.
We’ll see how the new distribution goes.

Powered by WordPress