Procrastiblog

March 18, 2009

The Golden Shield of Law

Filed under: Politics, Tech — Chris @ 12:05 am

It sound like the legal system might be the next RIAA, doomed to stand athwart history, yelling stop:

Jurors are not supposed to seek information outside of the courtroom. They are required to reach a verdict based on only the facts the judge has decided are admissible, and they are not supposed to see evidence that has been excluded as prejudicial. But now, using their cellphones, they can look up the name of a defendant on the Web or examine an intersection using Google Maps, violating the legal system’s complex rules of evidence. They can also tell their friends what is happening in the jury room, though they are supposed to keep their opinions and deliberations secret.

A juror on a lunch or bathroom break can find out many details about a case. Wikipedia can help explain the technology underlying a patent claim or medical condition, Google Maps can show how long it might take to drive from Point A to Point B, and news sites can write about a criminal defendant, his lawyers or expert witnesses.

“It’s really impossible to control it,” said Douglas L. Keene, president of the American Society of Trial Consultants.

Judges have long amended their habitual warning about seeking outside information during trials to include Internet searches. But with the Internet now as close as a juror’s pocket, the risk has grown more immediate — and instinctual. Attorneys have begun to check the blogs and Web sites of prospective jurors.

Mr. Keene said jurors might think they were helping, not hurting, by digging deeper. “There are people who feel they can’t serve justice if they don’t find the answers to certain questions,” he said.

But the rules of evidence, developed over hundreds of years of jurisprudence, are there to ensure that the facts that go before a jury have been subjected to scrutiny and challenge from both sides, said Olin Guy Wellborn III, a law professor at the University of Texas.

“That’s the beauty of the adversary system,” said Professor Wellborn, co-author of a handbook on evidence law. “You lose all that when the jurors go out on their own.”

All of the lawyers or judges quoted in this article seem to think the question is: how can we make these people STOP?

The real question is: how are we going to adapt?

Instead of reinforcing the levees, let’s tear them down and let the wetlands do the work. Instead of “nobody looks at the Internet,” how about “everybody looks at Internet”? The jurors are encouraged to independently research the case. If a juror finds something she thinks is interesting or relevant, she has to present it to the judge so the lawyers can respond. Nothing gets cited in the jury room that hasn’t first been aired in open court. If that means the jurors have to work harder to look past prejudicial evidence, so be it. (It probably means the end of the exclusionary rule, but that was all over but they crying anyway.)

You think this idea is stupid? Give me an alternative, short of sequestering all juries five miles from the nearest cell tower.

March 16, 2009

Planet Courant

Filed under: Tech — Chris @ 6:02 pm

Am I the only one who would prefer not to see unfiltered arxiv.org posts and SVN commit logs on Planet Courant?

I’m not saying my posts have been all-time greats, but we need more signal and less noise… Could we convince at least one member of each research group to blog regularly about what’s going on with their colleagues? Tutorials on cool open-source software developed at Courant? Abstracts of Courant people’s publications? Reports on conferences that Courant people have attended?

March 11, 2009

LD_LIBRARY_PATH and the dangers of .bash_env

Filed under: Linux — Chris @ 3:48 pm

So, I have two versions of a shared library: the stable version, which is installed under ~/builds/libfoo and a development version, which lives in the source tree ~/src/libfoo. I have just compiled a new version of the source and I want to test it, so I run make test.

Crash. Uh oh.

Let’s try the static version of the library.

OK. That works.

Maybe it’s picking up the wrong version of the shared library. I set LD_LIBRARY_PATH=~/src/libfoo and run make test.

Crash. Damn.

make test is, after a fashion, running ./bin/test. Let’s try that ourselves.

That works. Huh?!

$ export LD_LIBRARY_PATH=/home/chris/src/libfoo/lib
$ ldd ./bin/test
...
	libfoo.so.1 => /home/chris/builds/libfoo/lib/libfoo.so.1.0
...

Do you trust export?

$ LD_LIBRARY_PATH=/home/chris/src/libfoo/lib ldd ./bin/test
...
	libfoo.so.1 => /home/chris/builds/libfoo/lib/libfoo.so.1.0
...

Do you trust ldd?

$ /lib/ld-linux.so.2 --list ./bin/test
...
	libfoo.so.1 => /home/chris/src/libfoo/lib/libfoo.so.1.1
...

Damn you ldd. I knew it was you all along.

So, what happened? Some time ago, in the pursuit of a PATH-related bug, I moved all my shell path-munging preferences—including adding ~/builds/libfoo/lib to LD_LIBRARY_PATH—to .bash_env. .bash_env gets read every time that a new shell is created, including—wait for it—when running shell scripts or make. (ldd is a shell script. ld-linux.so.2 isn’t.) In other words, the line

export LD_LIBRARY_PATH=~/builds/libfoo/lib:$LD_LIBRARY_PATH

in my .bash_env was clobbering all of my attempts to set LD_LIBRARY_PATH at the command line.

The moral of the story? Munge LD_LIBRARY_PATH in your .bash_profile. And never trust ldd.

February 16, 2009

Using an iPod Nano on Linux

Filed under: Linux — Chris @ 6:43 pm

I recently bought an iPod Nano and I’m pleased to report it works just fine with Ubuntu 8.10 (aka Intrepid) and Amarok. I’m able to sync MP3s and podcasts (including video podcasts). I’m even able to transcode videos to MP4 and copy them over by hand. The only hitch is certain special menu entries like “Videos -> TV Shows” that seem to be controlled by iTunes and are, in my case, sadly depopulated. (This isn’t a Linux-specific issue. I was never able to get Audible audiobooks into the top-level “Audiobooks” menu on my old iPod. That was on a Mac, using iTunes. I’m thinking Apple wants to nudge you towards the iTunes Store.)

The instructions here and here are for the most part sufficient, but I thought I’d try to update and boil them down to a few easy steps, if only to increase the overall quality of Google searches for “ipod linux”. The instructions below are for Amarok, but should be easily adapted to Rhythmbox or gtkpod.

[UPDATE] These instructions are for a FAT32-formatted iPod, which includes any brand-new iPod which has not previously been connected to a Mac. I don’t recommend trying to use an HFS+-formatted iPod on Linux. The support for HFS+ is flaky and the filesystem tends to get corrupted frequently. (This may mainly be a problem with going back and forth between Mac and Linux, but there’s no good reason to use HFS+ unless you are going back and forth.) [/UPDATE]

  1. You will need to install libgpod and Amarok. Unfortunately, the version of libgpod in the stable repositories of Ubuntu, Debian, and Red Hat (v0.6.0) doesn’t support the newer (4G) Nanos. The only real consequence of this is a lack of per-track cover art (“Cover Flow” works fine), so you may be tempted to ignore it. Fortunately, it’s relatively easy to backport v0.7.0 to Intrepid. Unfortunately, you also need to rebuild Amarok/Rhythmbox/gtkpod/whatever against the new library (the Jaunty repo has the right version of libgpod, but not the rebuilt version of Amarok). Fortunately, I did this all for you, and you can grab a versions of libgpod and Amarok that support 4G Nanos on Intrepid from my PPA (click on “Follow these instructions” to add the PPA as an APT repository, or just download the .debs and use gdbi or dpkg).[UPDATE] Hardy packages are available here. Jaunty packages are here (Note: you have to use an unofficial Amarok 1.4 package, because Amarok 2.0 doesn’t support iPods at all (don’t ask)). The official Jaunty repos now have an updated version of gtkpod, but  not Rhythmbox AFAICT.  [/UPDATE]
  2. The iPod’s track database is encrypted, so you’ll have to help your computer decode it. Find its serial number using
    sudo lsusb -v | grep -i 'Serial.*[0-9A-Z]\{16\}'

    This will output something like

      iSerial                 3 000A27001DE47C90

    Copy-and-paste the 16 hex digits into /media/IPOD/iPod_Control/Device/SysInfo like so:

    FirewireGuid: 000A27001DE47C90

    (If your iPod isn’t mounted at /media/IPOD, use mount and look for an entry for /dev/sdb1, sdb2, or sdc1.)

  3. Now, you can go into “Settings -> Configure Amarok… -> Media Devices” and add your iPod. It should be automatically detected.
  4. If you click on “Devices” on the left-hand side of the Amarok window, you should see your iPod. Click on the iPod button and set your iPod model. Wikipedia has a handy illustrated table if you don’t happen to know which G your model belongs to (current on-sale models are the 6G Classic, 4G Nano, and 3G Shuffle).
  5. You can connect, you can sync (“Transfer”), and you can disconnect. You may have to fiddle with the “Post-disconnect command” in the “Media Device Configuration.” This one works for me:
    gnome-eject -n -p /media/IPOD

    If the iPod is still mounted after disconnection (i.e., the iPod screen still says “Connected”), you can use

    sudo eject /dev/sdb1

    (or sdc1, or whatever. You may accidentally eject a different USB device.)

[UPDATE 4/17/2009] I’m giving up on Amarok for managing my Nano: it stopped working with videos and I can’t figure out why.

November 22, 2008

An Intrepid Upgrade

Filed under: Linux — Chris @ 3:45 pm

Intrepid Ibex

Every Ubuntu upgrade gets a little bit better, but they are never painless. Why is that?

  • Wifi didn’t work at first, or after a reboot, or after the next one. But then it started working—I don’t know why—and it’s fine. The blinking light is annoying, though.
  • Sound completely died: any attempt to play a sound would yield a quiet crackling noise from the speakers. The semi-official PulseAudio HOWTO didn’t help (though it didn’t hurt). It turns out the PCM setting in alsamixer was at 0. Jacking that up fixed the problem. (Thanks to psyke83 on the Ubuntu forums.)
  • Boot-up doesn’t drop down to the console for interminable fsck runs, which is nice.
  • Ibexes are cool, but the old logo was better.

November 16, 2008

A CharBuffer is Not a StringBuffer, or Something You Already Knew If You Read the Documentation

Filed under: Tech — Chris @ 3:46 pm

A Java CharBuffer doesn’t behave the way I would expect.

CharBuffer buf = CharBuffer.allocate(8).put("foo");
System.out.println( "'" + buf + "'" );

yields

'^@^@^@^@^@'

or

'

This is because a CharBuffer is not a StringBuffer: toString() gives you everything from the current “position” to the end of the buffer. I.e., what you haven’t written yet. (Those funny symbols, or the lack thereof, are nulls.) Instead you want

CharBuffer buf = CharBuffer.allocate(8).put("foo");
System.out.println( "'" + buf.flip() + "'" );

which yields

'foo'

flip() makes the current view of the buffer what has been written to it so far.

P.S. Why can’t flip() return a CharBuffer, so that

September 2, 2008

WINE Paths

Filed under: Linux — Chris @ 11:02 pm

If you try to run a Windows command-line app on Linux under WINE, you may find that filename arguments yield errors like the following:

$ wine z3.exe -smt /tmp/smtlib2b129a.smt

Error: invalid command line option: /tmp/smtlib2b129a.smt
For usage information: z3 /h

The problem here is that the ‘/’ at the beginning of an absolute path can be interpreted as the beginning of a Windows-style command-line argument. The following script takes a Windows command-line and Windows-ifies Unix path arguments.

#! /bin/bash

if [ "${1+set}" != "set" ]
then
  echo "Usage; winewrap EXEC [ARGS...]"
  exit 1
fi

EXEC="$1"
shift

for p in "$@";
do
  if [ -e "$p" ];
  then
    p=$(winepath -w "$p")
  fi
  ARGS="$ARGS $p"
done

wine "$EXEC" $ARGS

The script can be used thus:

$ winewrap z3.exe -smt /tmp/smtlib2b129a.smt

Which will execute

wine z3.exe -smt Z:\tmp\smtlib2b129a.smt

P.S. You can also just use the WINE drive mapping (in this case / == Z:\), but I’d rather keep my Unix mindset and let the script do the work.

August 29, 2008

Using lp/lpr with CUPS

Filed under: Linux — Chris @ 4:12 pm

Ubuntu provides the traditional Unix lp/lpr commands via the cupsys-bsd package, but they annoyingly don’t pick up the CUPS default printer.
How do you identify your current default printer from the command line?

lpstat -d

How do you set your preferred default printer?

lpoptions -d PRINTER_NAME

Ah, yes. But how do you find the names of your installed printers?

lpstat -a

What’s all this good for anyway?

lpr [-P PRINTER_NAME] PS_OR_TXT_FILE
-OR-
enscript [-P PRINTER_NAME] TXT_FILE

August 27, 2008

Portrait of Frustration in Eighteen Commands: An Abbreviated History

Filed under: OCaml — Chris @ 4:28 pm
  354  ./configure --prefix=/home/chris/tools/builds/why
  359  godi_console perform -build godi-lablgtk2
  370  sudo apt-get install libgl-dev
  371  sudo apt-get install libgl1-mesa-dev
  372  godi_console perform -build godi-lablgtk2
  380  sudo apt-get install libglu1-mesa-dev
  381  godi_console perform -build godi-lablgtk2
  384  sudo apt-get install freeglut3-dev
  385  godi_console perform -build godi-lablgtk2
  391  sudo apt-get install tcl-dev
  392  godi_console perform -build godi-lablgtk2
  394  sudo apt-get install tk-dev
  395  godi_console perform -build godi-lablgtk2
  398  sudo apt-get install libgtkgl2.0-dev
  403  godi_console perform -build godi-lablgtk2
  404  ./configure --prefix=/home/chris/tools/builds/why
  408  make
  409  make install

Finding the Trash in GNOME

Filed under: Linux, Tech — Chris @ 12:56 pm
GNOME Disk Usage Analyzer

GNOME Disk Usage Analyzer

I somehow moved a file owned by root into the Trash, then I couldn’t make it go away: “Empty Trash” failed with permission problems. Thanks to the Ubuntu Geek blog—and especially commenter Ayenack—I found the secret location of the trash:

~/.local/share/Trash

The files in this folder can be chmod‘d and rm‘d just like any others (e.g.,

rm -rf ~/.local/share/Trash/*

is observationally equivalent to “Empty Trash”).

NOTE: The (otherwise very cool) GNOME Disk Usage Analyzer (aka Baobab) moves files to ~/.Trash—which is not the Trash—on “Move to Trash.” This is annoying.

[UPDATE 9/8/2008] If you do gksudo nautilus and delete files, then click on the trash icon in Nautilus it says, “The folder contents could not be displayed…” and “Empty Trash” is grayed out. But the files are in /root/.local/share/Trash, as you might expect. Just do

sudo rm -rf /root/.local/share/Trash/*

« Newer PostsOlder Posts »

Blog at WordPress.com.