09 January 2010

I came across this article on a forum; it's about how Wal-Mart and H&M threw away unsold goods (clothes, mostly) and ruined them beforehand so that no one could profit from their loss by dumpster diving. The person who posted the article wanted to know: do you have a problem with this, and why? He also posted a fairly reasonable defense of Wal-Mart's actions (I'm not going to keep saying "Wal-Mart and H&M) on purely pragmatic grounds.

It's pretty simple reasoning: if they give their unsold goods to Goodwill, Goodwill will turn around and sell these totally undamaged, brand new goods at a small fraction of the prices Wal-Mart is asking. Since people don't generally buy the same good for a high price that they can have at a low price, Wal-Mart would basically be undercutting themselves, and encouraging people who would otherwise have bought their products at full price to wait until the same thing is available at low price. Keeping the goods around isn't very feasible, either, since Wal-Mart would end up paying taxes out of proportion to the expected return on the leftover stock.

Now, morally speaking, does the business Wal-Mart might lose from reduced demand really outweigh the benefit to people who don't have enough clothes? I don't think so, but Wal-Mart is a business, and we understand that businesses don't really care about people, so we'll let it slide.

However: does the cost to Wal-Mart of giving away the clothes really outweigh the benefit to Wal-Mart? Even supposing that they give the goods to Goodwill and not an organization that will give them directly to needy people, how many people are there, really who shop at both Goodwill and Wal-Mart? How many more would start shopping at Goodwill once they realized they could get Wal-Mart goods there? The numbers probably aren't negligible, but Wal-Mart will always have better selection (not just in terms of products, but in terms of having items in the right sizes and styles). And if Wal-Mart finds that they're eroding demand for their products by giving away too much stuff/giving stuff away too consistently, they can always order less product. Let's not forget, also, that there will always be people who are willing to pay extra money to have things now; stores already offer goods at reduced prices, but there are lots of people who don't wait for the sales.

Obviously, giving away unsold products still involves some cost to Wal-Mart, however small, but giving away products to competitors (as far as charities are competitors) isn't all they'd be doing - they would also be creating positive press. There's a lot of hate for Wal-Mart, and I know not everyone who dislikes Wal-Mart refuses to shop there because of it, but some do. If Wal-Mart did more things like give away excess goods to charities, they might win over some of those people - and I think that would put doing the right thing ("") at least even, fiscally, with what they're doing now.

I suspect, though, that the reason Wal-Mart didn't give away the goods isn't because someone performed a similar analysis and came up with different results. I suspect that someone looked at the costs of giving the goods away vs. the costs of destroying them, and didn't imagine that there could be practical benefits to helping other people.

That was probably unfairly cynical - but I can't always help my nature.

03 May 2009

Ubuntu 9.04 Jaunty on a Thinkpad X41 Tablet

Introduction and Other Easy Things

I recently bought a Thinkpad X41 tablet cheap off eBay. And, because it's the kind of thing I do, I promptly set to work installing the latest release of Ubuntu (9.04, Jaunty Jackalope) on it. Since the X41t doesn't have an optical drive, I installed via LiveUSB. The USB can easily be created from an existing Ubuntu install or LiveCD using the included USB Startup Disk Creator (System -> Administration -> USB Startup Disk Creator), or from Windows via instructions like these or these.

I won't trouble you with installation instructions, because the installer is well set up, the Ubuntu Installation Guide is very good, and I didn't have to do anything special to get it working. Installation took about 15 minutes (seriously: very fast), and afterwards it took about 30 seconds to go from GRUB to the login screen.

I'm happy to say that basically everything worked out of the box - including the wireless card and basic tablet functionality. For handwriting recognition, I used Synaptic to install the equivalent of Windows XP's Tablet Input Panel, Cellwriter. And, because it's useful, I installed a Windows Journal equivalent, Xournal.

Two things did not work right away: the tablet hardware buttons (including special PageUp and PageDown keys, a screen rotation button, and a few others), and (since there was no button for it) any kind of screen rotation that didn't involve going through the control panels. The volume keys work, but apparently control the hardware volume level (as distinct from the software volume level set in the Sound control panel), and therefore have no on-screen display.

My key resources for getting these things working were LIKEN Apuntes's Installing Linux, Ubuntu 8.04 Hardy, on a IBM X41 Tablet and Thinkwiki.org, which is a staggeringly good resource for getting Linux to work on Thinkpads.

Tablet Keys

Tablet keys were not actually difficult to make work, but took me a long time because Thinkwiki was down. My understanding of the problem is this: every keypress generates a hexadecimal key scancode in the kernel, which is then passed to X and assigned a separate keycode from 0 to 255. Keycodes from 0-119 are used for standard keyboard keys, and keycodes 120 and above are mostly unused. Once you find the keycodes the kernel uses, it's a trivial matter to find set a keycode in X and assign shortcuts to it. Unfortunately, in 9.04, the kernel's keyboard mask is set to disregard those buttons entirely, making it very difficult to find those keycodes.

Fortunately, though, Thinkwiki has an article on Tablet Hardware Buttons. Armed with these keycodes, I needed only edit my /etc/rc.local (sudo gedit /etc/rc.local) to assign those keys codes in X at startup. The keycodes for the tablet PageUp, PageDown, Enter, and Escape buttons aren't arbitrary: they're the same ones used by the normal PageUp, PageDown, Enter, and Escape keys. For those, add these lines to /etc/rc.local:

# PageDown, PageUp, Enter, Escape
setkeycodes 6e 109

setkeycodes 6d 104
setkeycodes 69 28

setkeycodes 6b 1

...where 6e, 6d, 69, and 6b are the kernel scancodes in the Thinkwiki article I linked, minus the '0x', and 109, 104, 28, and 1 are the keycodes X uses for PageDown, PageUp, Enter, Escape. If you're interested, you can find out what keycode X uses for what key by entering "sudo dumpkeys" (or, since the output is very long, "sudo dumpkeys | less") into the terminal. Sorry if that's a little over-deliberate.

For the other three keys, you can assign keycodes fairly arbitrarily. All the unused keycodes will be at the end of the dumpkeys output; I used 130, 131, and 132 for the Tablet Menu, Rotate, and Ctrl-Alt-Del keys:

# Tablet Menu Key
setkeycodes 68 130
# Tablet Rotate

setkeycodes 6c 131

# Tablet Ctrl-Alt-Del Key

setkeycodes 67 132

These keys are a little trickier, though, because they don't do anything by themselves. I wanted to assign my Tablet Menu key to open up Cellwriter, so I went to System -> Settings -> Keyboard Shortcuts, hit the "Add" button at the bottom, created a "Cellwriter" shortcut which called on the cellwriter command. Then, I clicked the shortcut box and pressed the Tablet Menu key, and the name X uses for that keycode showed up in the box. Unfortunately, when I was done with that, my Tablet Menu key still didn't do anything.

As a workaround, I went to the configuration editor (gconf-editor in terminal) and from there to apps -> metacity -> keybinding_commands. I arbitrarily assigned command_11 to cellwriter, then went to apps -> metacity -> global_keybindings and assigned run_command_11 to the name the Keyboard Shortcuts control panel gave when I pressed the Tablet Menu key. This is incredibly clumsy, but it worked for me.

I left the Ctrl-Alt-Del key alone, because I couldn't think of anything I wanted to do with it. The Tablet Rotate key requires some extra work.

Tablet Rotation

LIKEN Apuntes has a script and very good directions for setting up your tablet screen to rotate. You can even make the screen rotate automatically when it swivels. If you follow those directions, your tablet will screen will rotate automatically, and you can use gconf-editor to assign, say, command_12 to /usr/local/bin/rotatetablet, and run_command_12 to whatever name Keyboard Shortcuts gives you for your Tablet Rotate key.

There is a problem with this. Your screen will rotate, but the tablet input will not, making pen use awkward at best. This is because of a change in the way Ubuntu Jaunty interprets tablet input. Never fear; there is a fix. I've taken it directly from post 104 of this thread on the Ubuntu forums. Without further ado, run:

sudo gedit /etc/init.d/wacomtohal

and paste in these lines:

#! /bin/sh
## find any wacom devices
for udi in `hal-find-by-property --key input.x11_driver --string wacom`
type=`hal-get-property --udi $udi --key input.x11_options.Type`
## rewrite the names that the Xserver will use
hal-set-property --udi $udi --key info.product --string $type

Save it, close it, and run these two commands in terminal:

sudo chmod +x /etc/init.d/wacomtohal
sudo update-rc.d wacomtohal defaults 27

After you've done that, restart and everything should work just fine.


Tablet PC support in Linux obviously isn't great, but with a little work the tablet can be made to do everything you'd expect from Windows XP Tablet Edition. Cellwriter and Xournal aren't as good as the Tablet Input Panel and Windows Journal (Cellwriter's handwriting recognition is fairly rudimentary, and Xournal doesn't have it at all), but Ubuntu is snappy on the X41t, and even snappier if you switch (as I did) from the default Gnome desktop environment to Xfce - a simple matter of installing xfce-4 in Synaptic, going to Options -> Select Session and selecting Xfce. It'll even ask you if you want to make it default.

Overall, I'm very happy with the tablet functionality - handwriting recognition isn't something I care much about, since any serious input I do will be through the keyboard anyway. Inking in Xournal is perfectly satisfactory for notetaking, and the ability to annotate PDFs is a nice feature. My only complaint is that Flash videos (from YouTube and Hulu, mostly) are choppy in fullscreen or HD under Ubuntu. This is not the machine's fault, though, or even Ubuntu's - Flash videos run fine in Windows, and higher-definition video formats run fine in Ubuntu using VLC or MPlayer. The fault lies entirely at the door of Adobe's poor Flash implementation in Linux.

That's it - it works.

The Rating System

All reviews are done out of four stars. One star is bad, two is OK, three is good, and four is basically perfect. Two and a half is pretty good; three and a half is great.

"Baseline" reviews are works that everyone knows, or ought to - to give you an idea of where you disagree with me, and what I mean when I say 3.5 stars.

02 December 2008

About the Title

Let's talk about why words are all lies.

The argument comes from an essay by Nietzsche - "On Truth and Lies in a Nonmoral Sense." His reasoning is that words refer to ideas, not things. A word like "tree" stands for a concept that includes all trees, not for any specific tree. When I talk about a specific tree, I'm using that concept as a metaphor for the thing. That's fine, but we use words so much that we tend to forget how far removed they are from our direct perceptions. That's why words are all lies - we trick ourselves into thinking they can encompass our experiences, and then we use them to talk about the truth.

There's a second part to Nietzsche's essay, where he talks about the rational/scientific mind and the intuitive/artistic mind, and how the scientific mind cowers beneath the shelter of fixed definitions while the artistic mind tears the old concepts down and replaces dead metaphors with fresh ones. It's a little one-sided. Also, Nietzsche doesn't really believe in truth to begin with. I took something different away from the first half, which is that you can't tell someone a truth with words - you just have to concentrate on pointing them in the right direction.

A related point comes up in Tim O'Brien's "How to Tell a True War Story," q.v.