Friday, August 31, 2012

Akashi

Summer is soon over. I'm taking my summer vacation late, and we're going to Hakodate for three nights beginning tomorrow. The plan was that it'd be pleasantly cool by now; as it turns out it's still almost 30° there, so while it's better than in Osaka it's not by much.

Meanwhile, here a few shots from a day trip we did to Akashi Kaikyo Õhashi earlier. Spectacular bridge.

Akashi Kaikyō Ōhashi
Akashi Kaikyou Õhashi - Akashi strait Great bridge. And great it is, absolutely huge close up.

Shōgi
Shōgi players in the shadow of the bridge. The foot of the bridge is a park of sorts, with seaside walks, museum and exhibition and so on. There's quite a lot of people around, including a group of elder men that spend their time smoking and playing Japanese chess in the cool breeze and shadow under the bridge span itself.

Akashi Kaikyō Ōhashi
Inside the bridge span. The span is huge, with another dedicated roadway inside for repairs and emergency vehicles. And there's a covered walkway inside, leading to a observation deck complete with cafeteria and souvernir shop.

Thursday, August 30, 2012

T430 and Ubuntu

Thinkpad T430

As I mentioned in my previous post, I use Ubuntu 12.04 on my new Thinkpad. I wanted to post some tips and tweaks I've made, but as the main post was getting far too long already I thought I'd separate it out into its own post.


It All Works


Basically, you don't have to do to anything in order to get Ubuntu working on this machine. Once I'd installed Ubuntu the system was up and running. Most things work just fine already. Everything below is akin to adding high-performance tyres and racing exhaust, chipping the engine and painting go-faster stripes on your family car. Lots of fun if you're interested, but you can safely skip it all without losing any sleep.

USB3 works and is great with a compatible hard drive. The trackpad and trackpoints all work nicely out of the box, and two-finger scrolling just needs to be enabled in the settings screen. I've never tried to use the Mini DisplayPort or the SD-card reader. I didn't get the lid camera or fingerprint reader so I have no idea if they're supported in Ubuntu.
 


The Tweaks


First, I have a machine with so-called "Optimus" graphics. That is, there's an NVIDIA graphics card in the machine in addition to the Intel integrated graphics. This is not supported out of the box. What will happen under Ubuntu is that you use the integrated graphics, but the NVIDIA card is also active and drawing a fair bit of power. Not good for your battery life.

If you have yet to buy a laptop, I would actually suggest you skip the NVIDIA card altogether. The Intel system is surprisingly good, and the NVIDIA card is reportedly only about twice as fast. If you plan to play a lot of new and demanding games it can make sense to get one; I got one because I'll want to try out GPU processing at some point. Other than that, don't bother.

If you want to use both the Intel and NVIDIA graphics together, you'll currently need to install something called "Bumblebee". It controls the NVIDIA card power and lets you use both graphics systems in a pretty neat way. But Bumblebee looks a bit tricky to install, and I don't actually need the NVIDIA card at the moment, so I've disabled the external card in the BIOS at boot-up.



I have two drives: an SSD (that is, a solid-state drive — USB memory on steroids) as a main disk, and a hard drive as a secondary one. The SSD will work fine out of the box without touching anything. But there is a few things you can do to improve performance and extend the lifetime of the drive.

SSD drives are really fast when reading from them. But writing is slow, and it also wears out the drive over time (Ars Technica has the whole story in exhaustive detail and multiple installments). You want to avoid unnecessary writes as much as you can. You also want the drive to reuse all its memory as evenly as possible, so it doesn't wear out any one area too fast.

We want to set a parameter called "discard". The OS will inform the drive immediately when a data block is no longer in use which helps the drive spread out writes and prolong the life of the drive. File systems can record the last time a file was read, but that generates a write — which is bad, remember — every time you read. So we also set "relatime", which tells the disk to only record the first time you read the file after it has been written. I think this is the default in Ubuntu already, but setting it can't hurt.

You set these parameters in /etc/fstab — there may be some graphical tool to do this but frankly I don't really know what it'd be. In a terminal, do:

$ gksudo gedit /etc/fstab

You'll see a line like this (I assume the first disk — sda — is your SSD):

# / was on /dev/sda1 during installation
UUID=something /  ext4  errors=remount-ro 0 1

Add "discard" and "relatime":

UUID=something /   ext4 relatime,discard,errors=remount-ro 0 1

Another tip is to change the scheduler to "noop" for the SSD. A scheduler orders the reads and writes to a disk to maximize performance. But schedulers are typically made for spinning disks, so it's generally better to let the SSD decide this for itself. There's no simple parameter to set this. Edit /etc/rc.local in the same way as above, and at the bottom of that file, add this command:

echo noop > /sys/block/sda/queue/scheduler

I've got plenty of memory in the machine, and one easy way to make use of it is to mount /tmp as a ramdisk. Accessing it is much faster, and it also saves wear on the SSD as well. Add the following line to /etc/fstab (I limit it to 1GB):

tmpfs  /tmp  tmpfs  defaults,noatime,mode=1777,size=1G 0 0

Also, I set Firefox to keep its cache in /tmp; again, that speeds up Firefox
and saves the SSD. Go to about:config, right-click->New, and add
"browser.cache.disk.parent_directory" with value "/tmp".


What about that second hard drive? I formatted it and mounted it on /data during installation. I put all my pictures and archival research data there. I also run a very simple back-up script every evening that copies all changes on the SSD to the second drive. If the SSD fails I'll lose no more than a day of work.

This means the drive isn't actually used very often. Having it spinning all day long is annoying, and it uses up the battery for no good reason. I set the drive to spin down and sleep if it's unused for more than a minute. In /etc/hdparm, add the following:

command_line { hdparm -B 1 -S 12 
    /dev/disk/by-uuid/something }

Where "something" is the same as you can find for the drive in /etc/fstab.

I also set the swap partition on the second hard drive. The idea is that I hardly ever need swap with the amount of memory I've got, and I don't want to sacrifice a few GB of precious SSD space to something I rarely use. On the other hand, if you do need swap on a regular basis, an SSD is a better place for it.


The Bugs


Not everything is a bed of roses, though (and a good thing too; those thorns are scary sharp). The Intel Ivy Bridge chipset is brand new, and there's a fair number of bugs that can affect people with such computers. And before anybody starts to snicker about Linux: New Windows and OSX machines use the same Intel-supplied drivers at heart and have their own share of related bugs.

I've had two bugs affect me. One where the graphics driver (and thus the machine) will completely hang about once a day or so. My solution was to install kernel 3.4.0 from this PPA which completely stopped this from happening. I've seen that recent updates presumably fixes this bug but I have no particular reason to switch back from 3.4.0 so I can't confirm this.

And there's one bug where putting the machine to sleep by shutting the lid — and only shutting the lid — would give you a frozen screen on wakeup. You had to kill X and lose all your currently open work. My guess is that closing the lid triggers the driver to turn off the screen twice — once for closing the lid and once for sleeping — and that messes up something internally.

There is no fix released for 12.04 yet, though it is fixed for 12.10. Meanwhile I've turned off sleep when closing the lid and simply use the "sleep" button on the keyboard instead. And frankly, that is my preferred behaviour anyway; when I go to and from seminars and meetings I don't want the computer to shut down just because I have the lid closed.

It's notable that both these bugs are already fixed for the next version in October or were never present there in the first place. The takeaway is to not by the very latest and shiniest new stuff the moment it is released. You pay the most and get all the bugs. Wait a while, just a few months, and you'll get the same thing but cheaper and free of most teething problems.

I know this of course, and my plan was to wait until October and Ubuntu 12.10 before I got this computer. But my previous computer died before its time, leaving me with little choice. Oh well; I've been able to fix or work around it so no harm done. And anybody installing 12.10 on this hardware will find the rock-steady experience they have every right to expect, in part because people like me have been shaking out the bugs.

Monday, August 27, 2012

Lenovo T430


Yay, new computer! Just get a whiff of that new-machine smell! Of course, I've had it for two months now, and the new-toy excitement is fading already. A few years down the road I'll start looking longingly at new models again1.

Never mind, let's enjoy the new toy while we can. I've used Panasonic Let's Note laptops for the past eight years or so. They're full-featured laptops with long battery life in a remarkably small and light package. But you do pay for the portability in performance, size, screen quality and price. It made sense when I used it everywhere: in the subway, airport lounges, meetings, coffee shops. But the laptop is no longer my primary portable device so I decided to get something a little bigger and beefier, with fewer compromises.

Thinkpad T430
Lenovo Thinkpad T430. The dusty screen is an optional extra. Embarrassing, but I'm not redoing the picture just for that.

I got a Thinkpad T430 laptop from Lenovo with an 14" screen. It has 16Gb memory2 and an 128Gb SSD drive. It has an NVIDIA graphics card in addition to the integrated Intel graphics, and I added a 500Gb disk as a second drive for data storage and backup. No DVD player, no camera and no fingerprint reader. A USB stick can store far more data than a DVD and I use my phone for video chat, so no reason to add cost and weight.



I've installed Ubuntu 12.04 on it. I hardly ever use Windows and saw no reason to keep it around, though I have the license key (couldn't buy the machine without it) and should be able to install it on a virtual machine if I want to. Maybe I will, though doing so seems like a lot of trouble.

Installation of Ubuntu was remarkably smooth and uneventful. Boot from the USB stick, answer a few questions such as what language do I want to use and off it goes. Completely finishing the setup took a few weeks before I'd set everything up to my liking, moved over all data and added back all applications I use. I don't want to do this automatically; a new computer is a great opportunity for cleaning up your system. There are some Ubuntu-specific issues and tweaks you should be aware of, though, and I'll bring them up in a separate post.

I've set up the SSD as the main disk with the operating system and my home directory. The hard drive is for my pictures, for archived data (there's lots of stuff I need to keep from earlier research projects) and for local backup. Every night I run an automatic backup from the SSD to the hard drive. If anything happens to the SSD — they have a reputation for failing suddenly and completely if they malfunction — I'll lose no more than a day's worth of work.



First impressions are good. The T430 is larger than my previous machine, but not as large as I feared it would be. The design — a flat black slab with clean lines and just a few red accents — makes it seem more compact than it is. It is noticeably heavier, though; there's no getting around that. Low weight is a hallmark of the Panasonic Let's Note series, and 2.2 Kg for the T430 versus 1.2 Kg for the Panasonic is very noticeable. It's another kilo or almost double the weight. I could hold the Panasonic in one hand while using it if I needed to; I couldn't do that with the T430. The weight and the flat lines does make it feel very solid and durable.

Lenovo laptops are renowned for their keyboards and it's obvious why. The Panasonic keyboard was good but this is in a different league altogether. It's their new "chiclet"-style keyboard, with each key in a separate socket. Smooth, responsive and it's hard to miss a key. I can write on this all day long and not get tired. The keyboard may sound like a small detail, but when you spend most of your day writing on it, it becomes one of the most important parts of the computer. The keyboard is full-size, drip proof and comes with separate sound volume and mute buttons, microphone mute and a special "Lenovo" button that isn't mapped to anything under Ubuntu. The keyboard has both backlight and a top light, alone or in combination. Neat.

The trackpad and the trackpoint (the red "nipple" thing) both work fine and are set up nicely under Ubuntu. Two-finger scrolling (you need to enable it in the trackpad settings) is reliable and smooth. The nipple takes a little getting used to but is surprisingly useful. I especially like the scroll function: hold down the middle key and the nipple lets you scroll in any direction. This is especially useful in drawing and illustration apps like Gimp and Inkscape where it lets you smoothly move around the workspace literally without lifting a finger. I wish I could make the scrolling just a bit less sensitive, though.

There is one problem. Some designer that will hopefully soon "explore other career opportunities" decided to make the right Alt and Ctrl keys really, really narrow3, and squeeze in a Print Screen key right in between them. After almost two months of use I still hit the Print Screen key by mistake almost every day4. Why is that key there? Are there people out there that really need to take a screenshot several times per day every day?

But overall the keyboard and trackpad is great. A good measure is how quickly you get used to a new keyboard. After just a weekend with the T430, the Panasonic keyboard was feeling a little cramped by comparison. And the Dell desktop keyboard at work that I've always felt was pretty good now feels odd, unresponsive and awkward; cramped and too large at the same time. The Lenovo keyboard managed to spoil me in just a few days.



The screen is wide, large and decently high resolution at 1600×900. Now, I would really have wanted a bit more; about 2000×1200 would be perfect5. It is a matte screen, with pleasant colours and quite nice as long as you sit directly in front. The viewing angle isn't great; shift to the side and the corners will darken. With that said, it is clearer, larger, with better viewing angles and better colour than the Panasonic, and I've had no problem using that screen for years.

1600 wide is a significant step up from 1280 on the Panasonic. It's wide enough that I can easily keep two source code files or two terminals side by side without feeling cramped. It's wide enough that I can move the browser bookmarks on to the same line as the address bar, giving me more vertical space. Of course, it's also wide enough that the design of some web sites — Google+ comes to mind — becomes ridiculous, with huge tracts of unused white space all over the screen.

The integrated graphics are surprisingly speedy. I don't run anything graphically cutting edge, but anything I do use is really snappy and smooth. Things the Panasonic would struggle with or flatly refuse to run at all are flawless on the Lenovo. Minecraft, a building-block game I play occasionally, would barely run on the lowest graphical settings on the Panasonic, but is fast and stutter-free on high graphical settings on the T430. I've yet to find anything it doesn't do well, in fact, so I've never even set up the NVIDIA graphics card that is also installed on the machine. I know I should, but so far I've just not found a reason to.



This is a fast machine overall. With the exception of my workstation it's the fastest computer I own today. It's not that the CPU itself is so very fast — it's a laptop processor and raw CPU speeds just don't improve all that rapidly nowadays — but the SSD and the ample memory means it spend its time actually doing things instead of waiting for data to read or write. I can even run one of my simulations on it — though that is "can", rather than "want"; you really need high speed and many cores to get reasonable simulation times.

Booting takes 12 seconds from pressing the power button to a usable desktop. Apps like Gimp, Octave, Firefox and ipython all pop up almost instantaneously. My film scan processing scripts are actually quicker on the T430 than on my desktop. The desktop CPU is faster, but the rapid file access on the SSD and the extra memory for data caching means the laptop still finishes first. And it's not just faster, it feels faster with almost everything I do.

I can't repeat this often enough: when you buy a computer, don't worry too much about the CPU. Spend your money on an SSD and on lots of memory; that will make far more of a difference than a faster processor.



Battery life with the standard 6-cell battery is about 4-5 hours or so with web surfing and writing (average around 12W in use). I could squeeze out more by dimming the screen, turning off Wifi and so on. And Lenovo offers various other batteries that can give you up to over 24 hours if you really need it — and if you are prepared to accept the weight.

It's not just batteries; Lenovo computers are made to be configurable and repairable. Every part can be disassembled, replaced and assembled again. And they give you hardware maintenance manuals with detailed instructions. Here's the T430 manual, and detailed part-by-part instructions for installation and removal. There's manuals for products going all the way back to the 1990's.

If I decided I really did want a lid-mounted camera after all, for instance, I could bring it in to get it upgraded or order the part and do the installation myself. It's a refreshing attitude, and the complete opposite of companies like Apple and Sony that try to restrict and control how you use your devices in every way they can.



Overall this is a wonderful machine and one that I would warmly recommend as a general-purpose machine for work and play. It's not a true workstation, but it does well for development. It's not a graphics powerhouse or gaming rig, but it handles all photo editing and gaming I need without breaking a sweat. It's not an ultraportable but it is still compact and light enough to bring every day. I am very happy I got this machine.


--

#1 This is why your money and time is better spent on experiences such as books and movies, travel, dinners and learning stuff. New experiences gain emotional value over time, while new things lose it.


#2 No, you really can't have too much memory. It is not possible.


#3 The right Alt key is used on a Swedish layout to type "@" for remail addresses as well as "[]", "{}, "\", "$", "~" and other characters you use a lot when programming. I use it a lot more than, say, the Tab key or Caps Lock. Having it smaller than almost any other key on the keyboard is annoying.


#4 Anybody need a screenshot of me trying to type '}' in an editor window? Don't be shy, just ask. I have lots of screenshots available. Lots and lots and lots.


#5 Because of the spread of flat-screen TVs, laptop makers no longer offer decently high resolution screens. TV-screen resolution panels have become very cheap compared to higher resolution panels, so most laptops use them. They top out at about 720-1100 vertical pixels or 100-130 ppi. Then there is nothing, then nothing, then Apples new my-wang-is-bigger-than-yours 1800 vertical pixels and 220 ppi laptop screen.

Which is too much; you get diminishing returns on quality as the resolution increases, while the cost — in graphics performance, memory needed and so on — rapidly grows. A moderate 160-180 ppi screen, or 1250-1400 pixels vertical, would be ideal. They used to be readily available on laptops before the shift to digital TV; I hope they'll reappear in time for my next machine in another few years.


Friday, August 17, 2012

79


79. It's not my weight. Nor — believe it or not — is it my IQ. Instead, 79 is the number of vending machines visible to me on my walk from home to my subway station. All but a handful are selling soft drinks; mostly tea, coffee and juices with the occasional carbonated soda.

44. That's the number of vending machines not only visible but standing directly in my path. As in, I would have to do no more than stop and turn to buy myself a refreshing beverage.

750. That's the distance, in meters, from our front door to the subway entrance. A nice, brisk morning walk.

17. As in, one vending machine every 17 meters on average, not counting the ones not directly along the path. I'd have to drink one bottle every 12 seconds or so if I wanted to drink from each vending machine in turn on my way to work.

Living in a busy city can present plenty of dangers. Dying of thirst is, however, apparently not among them.

Vending Machine
An office worker gets herself a morning coffee.




Tuesday, August 14, 2012

Birthday Dinner(s)

Every year we go somewhere to eat for our birthdays. We pick a place we don't normally visit because it's too far, too expensive, or not our usual style of food. It's usually the highlight of our birthdays.

This year we didn't do a dinner for Ritsukos birthday. There were various reasons, including that the restaurant we'd picked had burned to the ground. Things have been really busy all spring and summer, so we figured we'd do a single dinner for both birthdays instead, once we had time.

This weekend is Obon, with three days off work1, a good time for a relaxed restaurant visit. Ritsuko got to decide, and being Japanese she decided we go to Kani Dōraku, a crab restaurant in Namba in Osaka2. We'd been there once before, a long time ago, and it was a good experience.

Kani Douraku
The signature sign is a huge mechanical crab over the entrance. As I write this it is not actually moving though; they had trouble with it a while ago and have yet to repair the mechanism.


It didn't disappoint this time either. It's not really high-class — dōraku (道楽) means debauchery or indulgence — but it is good quality food, and true to its name you will not lack for crab during your visit. In fact, pretty much every dish except the desserts contain crab in some form. We had the crab hotpot menu, with crab croquets and a crab gratin on the side.

Appetizer
The appetizer was cooked crab with a vinegar dipping sauce.

Kani Sashimi
Crab sashimi. The raw crab was, I think, briefly soaked in a light broth to give it a slight salty tinge. Delicious.

Kani Nabe
The ingredients for the hotpot: Crab, cabbage, mushrooms, bean sprouts, tofu and herbs. Good, tasty, solid food, and cooking it yourself at the table adds to the fun.

Kani Nabe
Starting the pot. There's no actual crab in it yet; once we got down to eating I forgot about taking pictures. The finish is great: once you're done the waitress will bring cooked rice and egg and cook up a savoury porridge with the remaining broth. It's full of delicious flavour and really fills you up. You will not leave hungry.

Blue Beer
I had a bottle of Abashiri beer. This was a special edition, meant to "evoke the blue of the Okhotsk Sea". The colour is neat, and the beer is fine though nothing extraordinary.


As a final note, I took these pictures with Ritsukos Panasonic GF2. I'm mostly happy with the results; a 4/3 format camera really is good enough for any normal use today. Even these kind of low light scenes come out fairly well, with only moderate noise.

The lens was the 14mm/2.5. It's wide (28mm on 35 format) and very small and light. It gives you contrasty and sharp images, but it does have noticeable barrel distortion — see how the left side of the bottle and the row of lit up signs curve inwards in the beer picture. You wouldn't want to use this for architecture without correcting for this either in camera (the GF2 does it automatically for jpeg images) or in post-processing.

There's any number of light and compact bodies and lenses for this system. If I didn't already own other cameras and lenses, I'd probably pick a 4/3 body as my main digital camera.

---
#1 Well, except for editing a paper, reviewing another one, and trying to write some visualization code. Mostly no work, though.

#2 Really, what is it with Japanese and crab? It is good, and I like it, but I don't understand the near hysteria a lot of people here show for it. There's even bus tours where you spend a day or two just going from place to place to eat crab or buy crab-related foods and souvenirs.

Friday, August 10, 2012

Google Voice

Google voice is interesting, I think, and surprisingly you soon. It lets you use your voice no just the web search is not for any text input. And with jelly bean, the newest version of android, the voice recognition can happen with your phone, with no network connection needed. Of course, as these paragraphs shows, recognition is not quite there yet at least not for a second language speak in such as myself.

Google Voice is interesting, I think, and surprisingly useful. It lets you use your voice not just for web searches but for any text input. And with Jellybean, the newest version of Android, the voice recognition can happen all on your phone, with no network connection needed. Of course, as this paragraph shows, the recognition is not quite there yet — at least not for second-language speakers such as myself.

The results above are pretty good, but I read a pre-written text and spoke slowly and clearly while in a quiet room, and I used the correction feature to select the right word when I could. With my usual fast, sloppy speech or in a noisy environment it works much worse. The biggest hurdle is ad-libbing your text. A large part of recognition is to match your speech to lots of existing texts and figure out what words you most likely meant to say. When you "umm" and "aaa" and "no, wait", break off mid-sentence, repeat yourself and mix words together then you completely ruin that. The result is probably even worse than if it didn't try to match to other texts at all.

With some way to train it, better recording and processing hardware and more familiarity on my part I'm sure it would get better. The ideal is to dictate an email in my usual hurried, broken English, while rushing through a crowded airport, with the phone still in my pocket. We're clearly still nowhere close.


Some people speculate that voice input will eventually completely replace the keyboard. That's not going to happen. You can't speak aloud for long stretches when at home, when on the train or in public without disturbing other people. Imagine the noise in a large office with dozens of people talking to their computers all day long. You couldn't work on anything the least bit confidential or sensitive without hiding in a separate room with a closed door.

A keyboard is faster than speaking; it is quiet and precise — try to dictate a research report and see the word salad that results from all the specialized vocabulary — and is essential for things such as programming or editing. The keyboard will remain the best choice for most kind of writing. True, you can get RSI from using a keyboard all day long — but you risk laryngitis if you spend all day using your voice.

While it'll never be the main input method, it'll be a good alternative for short texts, especially when a keyboard is impractical. If want to send a quick message about your schedule when moving through a terminal then it's faster to dictate than to stop and slowly peck it out on your phone. When you make a shopping list is far easier to read the items out loud as you rummage through the fridge than to write them down. We'll never have onlyone way to input things. Voice will coexist with touch screens, with gesture interfaces, with physical keyboards and probably with other modes we've yet to even see.

Monday, August 6, 2012

World Press Photo - A Reminder

World Press Photo is a competition for the best press photography of the year. The winning images go on world tour, and we go see it every year when the exhibition is held in Osaka. It's a great variety of images and not everything is great, but the best ones are very articulate about their subject matter as well excellent images in their own right. It's well worth seeing if you have the chance. And you should have; they actually tour several copies of the exhibition the world over so chances are good it gets somewhere close to you.

In Osaka it stops by over the O-bon holiday each year, making it extra easy to catch. This year it's held from August 7 — that's tomorrow — to August 16, in Umeda. Here's the Osaka exhibition page, and here's all upcoming exhibitions. If you like photography it's worth a visit.