Search Results: "andy"

30 May 2011

Christian Perrier: 2011 week 21 Debian work

This week saw again some progress for samba packages. May is indeed my samba month..:-). So, I uploaded samba 3.5.8~dfsg-3 and -4. For whatever reason, -3 was rejected three times and, as I already tagged it in our SVN then started adding changes for an upcoming -4, I finally uploaded that -4. It fixed about 10 more bugs and the bug count is now 62. Upstream also release 3.6.0-rc1, which I uploaded in experimental and which fixed an RC bug. I also began working on Pootle 2.1.6 as an attempt to resync with upstream. I integrated patches by Alaa Abd El Fattah to have it use dbconfig-common to setup a database. However, this revealed that more invasive work is needed to satisfy dependencies...that may depend on the database backend chosen by users. As I'm quite ignorant with these things, I might need some help, here. I uploaded a new release of xgridfit to fix an important bug and avoid an NMU. xgridfit is team-maintained in pkg-fonts. I'm not very active in this team ATM. I shoul dresume work for it as I proposed a talk about it at Debconf11..:-) I continued hard work on French DDTP. Martijn made changes to stats pages and it makes interesting challenges to complete. You know I like challenges.. Smith reviews continue to go on: I launched a call for translations for slapos.tool.format and started the review of ntfs-3g. Finally, on Saturday....I upgraded churro (aka i18n.debian.net) to squeeze. Really. All alone..:-)...on a server that lies in Spain. "Meme pas peur" (not even scared) as we say in French. I'm really highly confident in squeeze upgrades now....and I was right. After only 5 hours work (mostly looking at packages downloads and configuration), nearly everything was back to work. As of now, we got three glitches, with only one bignot yet fixed: Quite active week, finally. This week should be quieter as I'm on holidays with Elizabeth in our country house in Normandy, in Seine valley (this house belonged to Elizabeth parents and she inherited it). I'm in deep love with this house and there are tons of things to do there...which leaves few room for hacking. We'll see what will be next weekly summary!

Francois Marier: Code reviews with Gerrit and Gitorious

The Mahara project has just moved to mandatory code reviews for every commit that gets applied to core code.

Here is a description of how Gerrit Code Review, the peer-review system used by Android, was retrofitted into our existing git repository on Gitorious.

(If you want to know more about Gerrit, listen to this FLOSS Weekly interview.)

Replacing existing Gitorious committers with a robotThe first thing to do was to log into Gitorious and remove commit rights from everyone in the main repository. Then I created a new maharabot account with a password-less SSH key (stored under /home/gerrit/.ssh/) and made that new account the sole committer.

This is to ensure that nobody pushes to the repository by mistake since all of these changes would be overwritten by Gerrit.

Basic Gerrit installationAfter going through the installation instructions, I logged into the Gerrit admin interface and created a new "mahara" project.

I picked the "merge if necessary" submit action because "cherry-pick" would disable dependency tracking which is quite a handy feature.

Reverse proxy using NginxSince we wanted to offer Gerrit over HTTPS, I decided to run it behind an Nginx proxy. This is the Nginx configuration I ended up with:
server  
listen 443;
server_name reviews.mahara.org;
add_header Strict-Transport-Security max-age=15768000;

ssl on;
ssl_certificate /etc/ssl/certs/reviews.mahara.org.crt;
ssl_certificate_key /etc/ssl/certs/reviews.mahara.org.pem;

ssl_session_timeout 5m;
ssl_session_cache shared:SSL:1m;

ssl_protocols TLSv1;
ssl_ciphers HIGH:!ADH;
ssl_prefer_server_ciphers on;

location /
proxy_pass http://127.0.0.1:8081;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;


Things to note:
Mail setupTo enable Gerrit to email reviewers and committers, I installed Postfix and used "reviews.mahara.org" as the "System mail name".

Then I added the following to /home/gerrit/mahara_reviews/etc/gerrit.config:
[user]
email = "gerrit@reviews.mahara.org"
to fix the From address in outgoing emails.

Init script and cronFollowing the installation instructions, I created these symlinks:
ln -s /home/gerrit/mahara_reviews/bin/gerrit.sh /etc/init.d/gerrit
cd /etc/rc2.d && ln -s ../init.d/gerrit S19gerrit
cd /etc/rc3.d && ln -s ../init.d/gerrit S19gerrit
cd /etc/rc4.d && ln -s ../init.d/gerrit S19gerrit
cd /etc/rc5.d && ln -s ../init.d/gerrit S19gerrit
cd /etc/rc0.d && ln -s ../init.d/gerrit K21gerrit
cd /etc/rc1.d && ln -s ../init.d/gerrit K21gerrit
cd /etc/rc6.d && ln -s ../init.d/gerrit K21gerrit
and put the following settings into /etc/default/gerritcodereview:
GERRIT_SITE=/home/gerrit/mahara_reviews
GERRIT_USER=gerrit
GERRIT_WAR=/home/gerrit/gerrit.war
to automatically start and stop Gerrit.

I also added a cron job in /etc/cron.d/gitcleanup to ensure that the built-in git repository doesn't get bloated:
MAILTO=admin@example.com
20 4 * * * gerrit GIT_DIR=/home/gerrit/mahara_reviews/git/mahara.git git gc --quiet

Configuration enhancementsTo allow images in change requests to be displayed inside the browser, I marked them as safe in /home/gerrit/mahara_reviews/etc/gerrit.config:
[mimetype "image/*"]
safe = true

Another thing I did to enhance the review experience was to enable the gitweb repository browser:
apt-get install gitweb

and to make checkouts faster by enabling anonymous Git access:
[gerrit]
canonicalGitUrl = git://reviews.mahara.org/git/
[download]
scheme = ssh
scheme = anon_http
scheme = anon_git

which requires that you have a git daemon running and listening on port 9418:
apt-get install git-daemon-run
ln -s /home/gerrit/mahara_reviews/git/mahara.git /var/cache/git/
touch /home/gerrit/mahara_reviews/git/mahara.git/git-daemon-export-ok

Finally, I included the Mahara branding in the header and footer of each page by providing valid XHTML fragments in /home/gerrit/mahara_reviews/etc/GerritSiteHeader.html and GerritSiteFooter.html.

Initial import and replicationOnce Gerrit was fully working, I performed the initial code import by using my administrator account to push the exiting Gitorious branches to the internal git repository:
git remote add gerrit ssh://username@reviews.mahara.org:29418/mahara
git push gerrit 1.2_STABLE
git push gerrit 1.3_STABLE
git push gerrit master
Note that I had to temporarily disable "Require Change IDs" in the project settings in order to import the old commits which didn't have these.

To replicate the internal Gerrit repository back to Gitorious, I created a new /home/gerrit/mahara_reviews/etc/replication.config file:
[remote "gitorious"]
url = gitorious.org:mahara/$ name .git
push = +refs/heads/*:refs/heads/*
push = +refs/tags/*:refs/tags/*
(The $ name variable is required even when you have a single project.)

Contributor instructionsThis is how developers can get a working checkout of our code now:
git clone git://gitorious.org/mahara/mahara.git
cd mahara
git remote add gerrit ssh://username@reviews.mahara.org:29418/mahara
git fetch gerrit
scp -p -P 29418 reviews.mahara.org:hooks/commit-msg .git/hooks/
and this is how they can submit local changes to Gerrit:
git push gerrit HEAD:refs/for/master

Anybody can submit change requests or comment on them but make sure you do not have the Cookie Pie Firefox extension installed or you will be unable to log into Gerrit.

23 May 2011

David Welton: Summary: Built To Sell - Creating A Business That Can Thrive Without You

<iframe frameborder="0" marginheight="0" marginwidth="0" scrolling="no" src="http://rcm.amazon.com/e/cm?lt1=_blank&amp;bc1=000000&amp;IS2=1&amp;bg1=FFFFFF&amp;fc1=000000&amp;lc1=0000FF&amp;t=dedasys-20&amp;o=1&amp;p=8&amp;l=as4&amp;m=amazon&amp;f=ifr&amp;ref=ss_til&amp;asins=B004IYISQW" style="width: 120px; height: 240px; float: left; margin-right: 20px; margin-bottom: 8px;"></iframe> Many small business owners start a business with the idea of greater freedom in mind, yet end up chaining themselves to something that takes even more dedication than a regular job. This book discusses the dos and don'ts that business owners need to be conscious of in order to create a business that is independent of its owner(s) in order to be able to sell it. It does so in an easy to read format that's a bit of a gimmick - a fictional story illustrating the authors points. Like most business books, the core idea isn't that hard to explain. the book even includes a handy summary of the main points, which I'll paraphrase here:
  1. Focus on one thing you can do really well; even a service business can be 'productized' by creating a standard service that is the focus of the business.
  2. If your business revolves around one or two key clients, the risk inherent in that approach will lower the value or scare of potential buyers completely.
  3. Put a process in place, from sales through production.
  4. Don't "be" your company. If the company is all about you, what's a potential buyer really getting if you sell it and leave?
  5. By focusing on products, you can charge up front rather than having poor cash flow. If you pay people to work on a project for 3 months, and don't get paid for another month, you are, by the end, out 4 months salary while waiting for the payment.
  6. Say no to projects outside the scope of your business. Only by focusing narrowly can you really excel at what you do.
  7. Spend time doing some research and calculations to estimate your potential market size; buyers will want to know this.
  8. If you have a business that has sales people, hire at least two so that they'll compete with one another.
  9. You want people who are good at selling products, not services; the latter will want to tweak your offering for each and every client, rather than selling it as-is and trying to find how it can meet the customer's needs that way, which is the best strategy for a product.
  10. If you were previously running a more 'generic' services company, and you switch to a more productized approach, be prepared to take a hit the year when you switch.
  11. Potential acquirers will want to see at least a couple of years of steady growth with the new model after making the switch.
  12. If you grow, you'll need a management team that can work without you. Put an incentive system into place to reward their loyalty and results.
  13. When looking for an adviser to sell your company, aim for one where you will not be the largest or smallest client.
  14. If your adviser really only has one company in mind to sell yours to, they may be trying to sell you off cheap as a favor.
  15. Consider how much you could grow with the resources of a buyer. Think big, and show them what kind of growth could happen with the right backing.
  16. Think and speak like a product business with 'customers' rather than 'clients'.
  17. Stock options are more complex than simpler options like bonuses that are paid out over a period of time, in terms of ways to give people an incentive to stay.
All in all, it was an enjoyable read, with solid points. Even if you have no intention of selling your business, thinking of the business itself as a sort of "product" that is not dependent on you to work correctly is a sensible way to go about creating and growing a business. He's certainly not, nor claims to be the first one to discuss this idea, and indeed references the well known E-Myth Revisited which focuses less on selling a business, and more on how to go about extricating you and your skills from the business.

Gregor Herrmann: RC bugs 2011/11 - 2011/20

long time no post about my RC bug fixing activities. & indeed, I haven't been very active during the last weeks. here's a quick update; it includes two NMUs done for the perl 5.12 transition, the rest is just "normal" maintainance work (interesting to see how much stuff can break behind our backs ...). I still hope to find some more time in the future to look at other RC bugs; after all we want to have a not-too-long freeze for wheezy, don't we?

17 May 2011

Vincent Bernat: Debian on Thinkpad Edge 11"

This has been several months since I didn t use much my laptop, an Asus S5N: it was crippled by a short battery life and was hit by several bugs, most of them targeting the i855GME graphic chipset thanks to the use of GEM and KMS in the latest Xorg. I did not want to invest too much in a laptop and I have found a rebate from Lenovo for Thinkpad Edge series. Voil , I have a Thinkpad Edge 11 .

Hardware Thinkpad Edge is a entry-level notebook from Lenovo. In France, it is available for around 500 , thanks to the usual parity between dollar and euro. Thinkpad Edge 11" enclosure

Hardware configuration Lenovo do not sell directly in France. Therefore, you cannot configure your laptop as you want. There is two or three configurations available. This can be a bit frustrating if you want something specific. Thinkpad Edge 11" parts Here is the configuration that I bought:
  • Intel Core i3 380UM at 1.33 GHz CPU.
  • 11.6 LED screen, with a resolution of 1366x768.
  • 4 GB RAM.
  • 320 GB hard drive.
  • Wireless network (Centrino Wireless-N) and bluetooth.
  • Broadband modem (WWAN)
It s a small laptop but it is not as light as it should be (1.5 kg or 3.3 pounds). Apart from the power supply, you don t get any extra. My Asus was shipped with a wireless mouse, a transport bag, a sleeve, an USB key and a CD burner. On one side, you get two USB ports and on the other side, one USB port, an HDMI port, a network outlet and a speaker jack. The VGA connector is placed on the rear. Thinkpad Edge 11"

BIOS First step: checking BIOS settings. WiMAX can be disabled as well as any other component that you may not need. The keyboard can be configured so that function keys are available directly instead of having to use the Fn key. There is an option called Computrace from AbsoluteSoftware which seems targeted at find back your laptop in case it gets stolen or just let the FBI know where you are. I have disabled it.

Debian installation Debian can be installed from an USB stick. This is really easy now. You grab the ISO image you want to use (I take the one for AMD64 in testing because I will run unstable) and to copy it on the USB stick:
1
# dd if=debian-testing-amd64-netinst.iso of=/dev/sdb
The previous way of making the USB stick bootable, installing a kernel, an initrd and the ISO image is deprecated (and does not work). Moreover, using testing to install Debian allows me to use a 2.6.37 kernel and circumvent some problems that may have happen with an older kernel. During the installation, I choose a guided partitioning using encrypted LVM. I choose to have several partitions but I keep /usr in the root partition since having a separate /usr is less and less supported, especially with piece of software like udev. The partitioning tool in Debian installer do not allow to resize volumes, you need to destroy them and recreate them as well as their content. However, this is still faster than writing a patch for this. When the installation is finished, the laptop boots on a 2.6.38 kernel, asks for the passphrase to decrypt the LUKS volume and display the login prompt a few seconds later.

Software configuration Most of the hardware seems to be supported. No obscure commands to run to get a working network. Therefore, I start by setting up my usual environment.

Setting up the desktop First, I change /etc/apt/sources.list to get unstable:
deb http://ftp.fr.debian.org/debian/ unstable main
deb-src http://ftp.fr.debian.org/debian/ unstable main
deb http://ftp.fr.debian.org/debian/ experimental main contrib non-free
I also want that everything that is installed from experimental to be upgraded if an update is available in experimental. This is done by creating a file /etc/apt/preferences.d/experimental:
Package: *
Pin: release experimental
Pin-Priority: 101
Then, I install the following packages:
  • zsh, my favourite shell with my hand-made maturating configuration. I should put it on GitHub one day.
  • mg, is the editor that I use to quickly edit a configuration file. I don t like vi. I have used jed for a long time but its default configuration can be cumbersome and it misses some emacs keybinding.
  • emacs, my work environment. I use it as a text editor and mail reader (with Gnus). I don t use it as a browser nor as a terminal. As for zsh, I have my configuration files ready to be copied anywhere.
  • fvwm, my window manager since quite some time. I use fvwm-crystal on top of it. My configuration is described in another post. I also use conky.
  • rxvt-unicode, a terminal. It has a very good terminal emulation and some fancy features like transparency (using compositing or not). It is light and fast and allows to search in the backbuffer. It can use a client/server system that will close all your windows when the server crashes. This almost never happens.
  • unison, a synchronisation tool that allows me to keep the same files on my different computers.
  • gdm3 is the only display manager that is able to talk correctly to ConsoleKit and get the rights set correctly without adding yourself to a lot of groups.
Nowadays, I use the kernel from Debian and I do not have to run my own configuration for it. The glory days where I had to recompile the kernel before plugging a new USB toy have passed. I remove rpcbind and nfs-common. I use ferm to setup a simple firewall. Here is my ferm.conf:
domain (ip ip6)  
  table filter  
chain INPUT  
    policy DROP;
    mod state state INVALID DROP;
    mod state state (ESTABLISHED RELATED) ACCEPT;
    interface lo ACCEPT;
    proto tcp dport ssh ACCEPT;
    
chain OUTPUT  
    policy ACCEPT;
    mod state state (ESTABLISHED RELATED) ACCEPT;
    
chain FORWARD  
    policy DROP;
    
     
 
unison will then sync my configuration files and my documents. After this step, my environment is ready.

Hardware configuration This is usually the most troublesome part. However, looking at the output of lspci and lsusb, everything seems pretty easy to get supported. Here is lspci output:
00:00.0 Host bridge: Intel Corporation Core Processor DRAM Controller (rev 02)
00:02.0 VGA compatible controller: Intel Corporation Core Processor Integrated Graphics Controller (rev 02)
00:16.0 Communication controller: Intel Corporation 5 Series/3400 Series Chipset HECI Controller (rev 06)
00:1a.0 USB Controller: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller (rev 06)
00:1b.0 Audio device: Intel Corporation 5 Series/3400 Series Chipset High Definition Audio (rev 06)
00:1c.0 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 1 (rev 06)
00:1c.1 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 2 (rev 06)
00:1c.5 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 6 (rev 06)
00:1d.0 USB Controller: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller (rev 06)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev a6)
00:1f.0 ISA bridge: Intel Corporation Mobile 5 Series Chipset LPC Interface Controller (rev 06)
00:1f.2 SATA controller: Intel Corporation 5 Series/3400 Series Chipset 4 port SATA AHCI Controller (rev 06)
00:1f.3 SMBus: Intel Corporation 5 Series/3400 Series Chipset SMBus Controller (rev 06)
00:1f.6 Signal processing controller: Intel Corporation 5 Series/3400 Series Chipset Thermal Subsystem (rev 06)
03:00.0 Network controller: Intel Corporation Centrino Wireless-N 1000
09:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 03)
ff:00.0 Host bridge: Intel Corporation Core Processor QuickPath Architecture Generic Non-core Registers (rev 02)
ff:00.1 Host bridge: Intel Corporation Core Processor QuickPath Architecture System Address Decoder (rev 02)
ff:02.0 Host bridge: Intel Corporation Core Processor QPI Link 0 (rev 02)
ff:02.1 Host bridge: Intel Corporation Core Processor QPI Physical 0 (rev 02)
ff:02.2 Host bridge: Intel Corporation Core Processor Reserved (rev 02)
ff:02.3 Host bridge: Intel Corporation Core Processor Reserved (rev 02)
And lsusb output (I disabled the broadband modem in the BIOS and therefore, it does not appear here):
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 003: ID 0bda:0158 Realtek Semiconductor Corp. USB 2.0 multicard reader
Bus 001 Device 004: ID 0a5c:217f Broadcom Corp. Bluetooth Controller
Bus 002 Device 003: ID 5986:01a7 Acer, Inc Lenovo Integrated Webcam
There is a dedicated page for the Thinkpad Edge 11 on ThinkWiki. This wiki is one of the best source of information when you get a Thinkpad. The kernel as shipped by Debian kernel team contains every module that you may need. One of them, thinkpad_acpi will handle most of the perks under the hood. I do not use a complete desktop like Gnome. I usually prefer to use command line tools and put them in .xsession for persistence. There is usually some graphical utility to do the same thing. There are however some configuration steps that are now far easier to do with a graphical tool. Since I use X all the time, I just rely on those tools when necessary.

BIOS upgrade From lshw output, I see that I already have the latest BIOS available. No need to update then. In case you need to update, yours, ThinkWiki has a documentation to upgrade. You can find memdisk image in syslinux package.

Graphic card The graphic card is integrated into the CPU. Intel usually ships graphic cards well supported by open source drivers. ThinkWiki tells us:
A very recent Linux distribution with kernel 2.6.33 and Intel Xorg driver 2.11 or newer is recommended. Note that XVideo (Xv) playback at certain frame sizes does not work properly unless you have at least version 2.12 of the Intel Xorg driver.
With Debian Wheezy, you get version 2.15. Therefore, configuring the graphic card is just a matter of installing xserver-xorg-video-intel and that s all. No /etc/X11/xorg.conf needed. HDMI and VGA outputs are detected without configuring anything. They can be enabled with xrandr. I did not try if it was possible to use both of them at the same time.
Screen 0: minimum 320 x 200, current 1366 x 768, maximum 8192 x 8192
LVDS1 connected 1366x768+0+0 (normal left inverted right x axis y axis) 256mm x 144mm
   1366x768       60.0*+   50.0  
   1360x768       59.8     60.0  
   1024x768       60.0  
   800x600        60.3     56.2  
   640x480        59.9  
VGA1 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
DP1 disconnected (normal left inverted right x axis y axis)
Compositing works without any problem. I use only transparency and therefore, I don t know what the speed is on a desktop with all effects turned on. Regarding video acceleration, XVideo is supported but the graphic card also features hardware decoding with i965-va-driver package. Here is the output of vainfo:
libva: libva version 0.32.0
libva: va_getDriverName() returns 0
libva: Trying to open /usr/lib/dri/i965_drv_video.so
libva: va_openDriver() returns 0
vainfo: VA API version: 0.32
vainfo: Driver version: i965 Driver 0.1
vainfo: Supported profile and entrypoints
  VAProfileMPEG2Simple            : VAEntrypointVLD
  VAProfileMPEG2Main              : VAEntrypointVLD
  VAProfileH264Baseline           : VAEntrypointVLD
  VAProfileH264Main               : VAEntrypointVLD
  VAProfileH264High               : VAEntrypointVLD
With Debian, VLC can make use of this if you put ffmpeg-hw=1 in your ~/.config/vlc/vlcrc. We are then greeted by this:
[0x2629040] avcodec decoder: Using VA API version 0.32 for hardware decoding.

Network The network card works out of the box. ThinkWiki tells us that there can be stability problems with 2.6.36 kernel. During the installation, a 2.6.37 was used without any problem. I am now running a 2.6.38 and never got a glitch. It is likely that the described problem was solved with 2.6.37.

UltraNav UltraNav is the combination of the usual touchpad and the trackpoint which is a small joystick in the center of the keyboard and is well known to Thinkpad users since most of them have one. The trackpoint is a great input device. Nowadays, all input devices are configured with the help of xinput command. Here is the output of xinput list:
  Virtual core pointer                      id=2    [master pointer  (3)]
      Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
      SynPS/2 Synaptics TouchPad                id=11   [slave  pointer  (2)]
      TPPS/2 IBM TrackPoint                     id=12   [slave  pointer  (2)]
  Virtual core keyboard                     id=3    [master keyboard (2)]
  Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
  Power Button                              id=6    [slave  keyboard (3)]
  Video Bus                                 id=7    [slave  keyboard (3)]
  Power Button                              id=8    [slave  keyboard (3)]
  Integrated Camera                         id=9    [slave  keyboard (3)]
  AT Translated Set 2 keyboard              id=10   [slave  keyboard (3)]
  ThinkPad Extra Buttons                    id=13   [slave  keyboard (3)]
The command xinput list-props will give you additional information on each input device listed above. You can then configure any settings using xinput set-prop. For example, if you want to enable scrolling by using the edges of the touchpad and enable palm detection, you can use the following commands:
1
2
$ xinput set-int-prop "SynPS/2 Synaptics TouchPad" 'Synaptics Edge Scrolling' 8 1 1 0
$ xinput set-int-prop "SynPS/2 Synaptics TouchPad" 'Synaptics Palm Detection' 8 1
If you want to disable the touchpad and only use the trackpoint, use the following command:
1
$ xinput set-int-prop "SynPS/2 Synaptics TouchPad" 'Synaptics Off' 8 1
Each property has a type and a size. There is no place for guessing since every property is listed in man 4 synaptics. The same applies for the trackpoint but the correct manual page is man 4 evdev. For example, if you want to enable scrolling using the middle button, use:
1
2
$ xinput set-int-prop "TPPS/2 IBM TrackPoint" "Evdev Wheel Emulation" 8 1
$ xinput set-int-prop "TPPS/2 IBM TrackPoint" "Evdev Wheel Emulation Button" 8 2
All those commands can be tossed in ~/.xsession.

Keyboard hot keys Thinkpad laptops usually have a lot of hot keys. This is not the case of the Thinkpad Edge which only features a few of them:
  • volume control
  • brightness control
  • webcam and external screen toggle
  • wireless toggle
  • multimedia keys
All those keys trigger an event in one of the keyboard listed in xinput list. Therefore, your window manager or any other application can intercept them and act upon. You can use evtest to check which key triggers which event on which keyboard. The acpid daemon listen on those keyboards and can also trigger some actions. For example, it will run ibm-wireless.sh when you hit the wireless toggle. By default, this will enable or disable your wireless card. But you can configure the script to use a multistate toggle and disable or enable the bluetooth card as well.

Sound card As for the network card, the sound card works out of the box. I use PulseAudio because it allows per-application volume control and per-application sound card selection. It comes handy if you have some bluetooth headset. To make PulseAudio the default application for most applications, I put this in my ~/.asoundrc:
pcm.!default  
  type pulse
 
ctl.!default  
  type pulse
 

Wireless card A firmware is needed to make this card work. On Debian, you need to install firmware-iwlwifi package. Then, iwlagn module needs to be loaded. You can check with rfkill list that the wireless card has not been disabled. iw list will then give the status:
Wiphy phy0
Band 1:
    Capabilities: 0x872
        HT20/HT40
        Static SM Power Save
        RX Greenfield
        RX HT20 SGI
        RX HT40 SGI
        No RX STBC
        Max AMSDU length: 3839 bytes
        No DSSS/CCK HT40
    Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
    Minimum RX AMPDU time spacing: 4 usec (0x05)
    HT RX MCS rate indexes supported: 0-15, 32
    TX unequal modulation not supported
    HT TX Max spatial streams: 1
    HT TX MCS rate indexes supported may differ
    Frequencies:
        * 2412 MHz [1] (14.0 dBm)
        * 2417 MHz [2] (14.0 dBm)
        * 2422 MHz [3] (14.0 dBm)
        * 2427 MHz [4] (14.0 dBm)
        * 2432 MHz [5] (14.0 dBm)
        * 2437 MHz [6] (14.0 dBm)
        * 2442 MHz [7] (14.0 dBm)
        * 2447 MHz [8] (14.0 dBm)
        * 2452 MHz [9] (14.0 dBm)
        * 2457 MHz [10] (14.0 dBm)
        * 2462 MHz [11] (14.0 dBm)
        * 2467 MHz [12] (14.0 dBm) (passive scanning, no IBSS)
        * 2472 MHz [13] (14.0 dBm) (passive scanning, no IBSS)
    Bitrates (non-HT):
        * 1.0 Mbps
        * 2.0 Mbps (short preamble supported)
        * 5.5 Mbps (short preamble supported)
        * 11.0 Mbps (short preamble supported)
        * 6.0 Mbps
        * 9.0 Mbps
        * 12.0 Mbps
        * 18.0 Mbps
        * 24.0 Mbps
        * 36.0 Mbps
        * 48.0 Mbps
        * 54.0 Mbps
max # scan SSIDs: 20
Supported interface modes:
     * IBSS
     * managed
     * monitor
I don t know why, but 802.11a channels have been disabled. I don t have interest in them and therefore I did not search why this happens.
iwlagn 0000:03:00.0: Detected Intel(R) Centrino(R) Wireless-N 1000 BGN, REV=0x6C
iwlagn 0000:03:00.0: device EEPROM VER=0x15d, CALIB=0x6
iwlagn 0000:03:00.0: Device SKU: 0X9
iwlagn 0000:03:00.0: Valid Tx ant: 0X1, Valid Rx ant: 0X3
iwlagn 0000:03:00.0: Tunable channels: 13 802.11bg, 0 802.11a channels
iwlagn 0000:03:00.0: irq 44 for MSI/MSI-X
iwlagn 0000:03:00.0: loaded firmware version 128.50.3.1 build 13488
Wireless is one of the thing that make me use graphical applications like Network Manager. Command line tools are too low level to quickly connect to some random wireless network. There was a large debate in debian-devel@ldo to determine if Network Manager was ready to replace ifup and ifdown commands, even for servers. It seems that this is not something impossible and therefore, I think it has become flexible enough to ensure most of the configuration tasks I need.

Bluetooth The bluetooth chipset is hosted on the USB bus. hci_usb module will take care of it. It supports AD2P and can be used to listen to music with a compatible headset. hciconfig will tell us if the chipset is working. Again, bluetooth is easier to configure with a graphical tool. BlueZ, the bluetooth stack in Linux, uses DBus to communicate with other applications. The command line tools have been deprecated and therefore, you need to fight with some DBus binding to pair your computer to your headset. gnome-bluetooth package comes with an applet which allows you to quickly pair to any device. If you install pulseaudio-module-bluetooth package, any bluetooth headset should work out of the box.

Broadband (WWAN) To configure the broadband modem, the most difficult thing to do is to grab the appropriate firmware. ThinkWiki comes with various instructions to get it. I did not keep my Windows installation and therefore, I grabbed the Qualcomm Gobi 2000 Wireless WAN driver and I unpacked it with some Windows host with msiexec as instructed (I did have to execute the installation program first, otherwise, msiexec tells that the file is invalid). I choosed the default firmware since my laptop is unlocked. ThinkWiki page explains which firmware to choose in which situation. The package gobi-loader needs to be installed. The firmware files amss.mbn, apps.mbn and UQCN.mbn should be placed in /lib/firmware/gobi. They will be loaded by udev. To avoid to reboot, I used this command:
1
# /lib/udev/gobi_loader -2000 /dev/ttyUSB0 /lib/firmware/gobi
To configure the 3G connection, I just used Network Manager. Ensure with rfkill list that your WWAN card is not blocked. I did not test the GPS part that needs to be enabled on Windows.

Webcam Nowadays, USB webcam are UVC device and there is a driver to support this class of devices. Check that the uvcvideo module is correctly loaded and you should have something like this in your dmesg:
uvcvideo: Found UVC 1.00 device Integrated Camera (5986:01a7)
cheese is a small application that can be used to check if the webcam operates as expected.

Card reader Nothing to do. This works out of the box.

Suspend to memory and disk Install the uswsusp package which will also pull pm-utils. You will get pm-suspend and pm-hibernate commands. pm-suspend will enable suspend to memory. On resume, the system takes a whole minute to become operational. I get the following message:
r8169 0000:09:00.0: eth0: unable to apply firmware patch
PM: resume of devices complete after 60786.035 msecs
PM: Finishing wakeup.
Installing firmware-realtek package solves this issue. It should also be solved by a future kernel. I also have this message when I come back from sleep:
[drm:i915_hangcheck_ring_idle] *ERROR* Hangcheck timer elapsed... render ring idle [waiting on 9297, at 9297], missed IRQ?
The X server is then slow as hell. The message can be fixed by using i915.semaphores=1 as a kernel parameter but the X server is still slow. It seems that running powertop restores the original speed. This is a known problem. On sleep, the battery loses 2% every 6 hours. This allows you to keep your laptop on sleep for several days if needed. pm-hibernate enable suspend to disk. The suspend part works well but on resume, the kernel freezes after reading back the image into memory. There are some documentation to debug this problem but I prefer to wait for 2.6.39 which may just solves this issue.

Power management Let s see on how we could enhance battery life. First, cpufrequtils package will slow down the processor when it is not used by using the ondemand governor. The frequency will drop from 1.33 GHz to 666 MHz. Several tools are then available:
  • pm-utils package comes with scripts to enable some powersaving features. Those scripts are run on ACPI events (for example, when you unplug the AC adapater). There is no way to put the laptop to sleep after two hours of inactivity for example. You need something like sleepd to handle this part. I have found nothing that could dim the screen on inactivity.
  • laptop-mode-tools is also a set of script to be run on ACPI events. It is therefore somewhat superseded by pm-utils.
  • gnome-power-manager is a daemon that makes use of upowerd. Despite its name, you can run it outside of the Gnome environment. It will put your laptop to sleep on inactivity and will dim the screen when needed. All other functionalities are handled to upowerd. This seems the way to go on today Linux desktops.
Behing the scene, upowerd will call at some point pm-powersave from pm-utils. This allows to run scripts when unplugging the AC adapter. There are some scripts shipped in /usr/lib/pm-utils/power.d. You can add your own in /etc/pm/power.d. Some scripts are configurable. For example, if you create /etc/pm/config.d/local and put SATA_ALPM_ENABLE=true in it, this will enable SATA ALPM mode on battery. You can check what needs to be done with powertop or go to a website like Less Watts to get some tips on what to configure to get a better battery life. Without adding any script, I get 5 hours of battery life with the laptop doing almost nothing. Lenovo tells that you should get 6 hours of battery life. I think that on moderate workloads, you should get 4 hours.

Conclusion This Lenovo Edge has a good value for money. It features a great keyboard for a laptop of its size. It could be lighter and thinner. Its battery life is pretty good. Almost everything works out of the box with GNU/Linux. I hope that 2.6.39 kernel will solve the remaining issues like the suspend on disk issue.

11 May 2011

Vincent Bernat: New website with Hyde

My previous website was generated (dynamically) with mod_autoindex, a module from Apache targeted at rendering an index page for the files contained in a directory. Pretty basic (but themable). Here is a new revamped web site using Hyde, a static web generator written in Python.

Static or dynamic ? It has been a long time since almost everybody is creating dynamic websites. Most often, they are powered by some blog engine written in PHP like DotClear or WordPress. Infrequently, they are crafted with bare hands using one s preferred language. Nowadays, hosting a dynamic website is pretty easy. There are a lot of cheap virtual servers solution that allow you to get a root access. However, dynamic websites have some drawbacks:
  • Security need to be monitored tightly, especially security upgrades; some platforms are more often vulnerable than others.
  • Dynamic websites may have some problem to handle increased load.
With a static website, security problems are easier: there are far less components to monitor and most of them (for example, the web server) are pretty solid and well audited. A site powered by nginx can handle several thousands of new connections per second without any special tuning. Getting this kind of performance with a dynamic website is far more difficult. Scaling is also easier. Just add more webservers and copy the content. No database, no synchronisation mechanism needed. Hosting can even be done on simple platforms like Amazon S3, even if there is now more appropriate platforms for this like Amazon CloudFront. Moreover, even a static website can receive comments using a system like Disqus which leverages the use of Javascript to add comment system to any static page.

Hyde Hyde is a static website generator written in Python. There exists a lot of those beasts. On StackOverflow, a question about this got some interesting answers. You will also find a fairly complete list on this blog. If you like Ruby, I assume that nanoc and Webgen are good candidates. Let s go back to Hyde. It was rewritten recently and the documentation is a bit incomplete. You will need to read the source code or look at examples (like the shipped one or this site) to understand how things are handled. Everything is handled by a plugin system. I hope it will not become a mess in one year (I play a large part in this). Hyde takes your files, apply a lot of filters on them and generate the final website. It uses Jinja as a template system, Markdown for markup syntax, Less to write CSS in a more efficient way (and to minify them), UglifyJS to minify Javascript, etc. It is also possible to add metadata to files (title, author, creation date, etc.). But since everything comes as a plugin, you can use any technology you like. In the end, you can tune all knobs but you need to do most of the work (HTML, CSS, Javascript), as well. Conveniently, there is a small web server that rebuild modified files on the fly. This comes handy but this is a common feature with this kind of generator.

New website Here is a new website crafted with Hyde. It is translated both in French and in English. This is done with the help of a small plugin plugin. I am quite happy about the result. Technically, there is one minified CSS file, one minified Javascript file and the dependencies (like jQuery) are loaded with the help of yepnope.js which will become part of Modernizr. I don t want to support Internet Explorer 6, but I plan to support Firefox 3, Internet Explorer 7 and recent versions of Chrome and Safari. For the design, I have always been undecided. I am pretty impressed by some raw website but also by some others more elaborate. Since I am not a talented graphic designer, I have tried to keep things plain and simple. If you are interested, sources are available on GitHub !

10 May 2011

Ian Wienand: PLT and GOT - the key to code sharing and dynamic libraries

(this post was going to be about something else, but after getting this far, I think it stands on its own as an introduction to dynamic linking) The shared library is an integral part of a modern system, but often the mechanisms behind the implementation are less well understood. There are, of course, many guides to this sort of thing. Hopefully this adds another perspective that resonates with someone. Let's start at the beginning - relocations are entries in binaries that are left to be filled in later -- at link time by the toolchain linker or at runtime by the dynamic linker. A relocation in a binary is a descriptor which essentially says "determine the value of X, and put that value into the binary at offset Y" each relocation has a specific type, defined in the ABI documentation, which describes exactly how "determine the value of" is actually determined. Here's the simplest example:
$ cat a.c
extern int foo;
int function(void)  
    return foo;
 
$ gcc -c a.c 
$ readelf --relocs ./a.o  
Relocation section '.rel.text' at offset 0x2dc contains 1 entries:
 Offset     Info    Type            Sym.Value  Sym. Name
00000004  00000801 R_386_32          00000000   foo
The value of foo is not known at the time you make a.o, so the compiler leaves behind a relocation (of type R_386_32) which is saying "in the final binary, patch the value at offset 0x4 in this object file with the address of symbol foo". If you take a look at the output, you can see at offset 0x4 there are 4-bytes of zeros just waiting for a real address:
$ objdump --disassemble ./a.o
./a.o:     file format elf32-i386
Disassembly of section .text:
00000000 <function>:
   0:	 55			push   %ebp
   1:	 89 e5                	mov    %esp,%ebp
   3:	 a1 00 00 00 00       	mov    0x0,%eax
   8:	 5d                   	pop    %ebp
   9:	 c3                   	ret    
That's link time; if you build another object file with a value of foo and build that into a final executable, the relocation can go away. But there is a whole bunch of stuff for a fully linked executable or shared-library that just can't be resolved until runtime. The major reason, as I shall try to explain, is position-independent code (PIC). When you look at an executable file, you'll notice it has a fixed load address
$ readelf --headers /bin/ls
[...]
ELF Header:
[...]
  Entry point address:               0x8049bb0
Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
[...]
  LOAD           0x000000 0x08048000 0x08048000 0x16f88 0x16f88 R E 0x1000
  LOAD           0x016f88 0x0805ff88 0x0805ff88 0x01543 0x01543 RW  0x1000
This is not position-independent. The code section (with permissions R E; i.e. read and execute) must be loaded at virtual address 0x08048000, and the data section (RW) must be loaded above that at exactly 0x0805ff88. This is fine for an executable, because each time you start a new process (fork and exec) you have your own fresh address space. Thus it is a considerable time saving to pre-calculate addresses from and have them fixed in the final output (you can make position-independent executables, but that's another story). This is not fine for a shared library (.so). The whole point of a shared library is that applications pick-and-choose random permutations of libraries to achieve what they want. If your shared library is built to only work when loaded at one particular address everything may be fine until another library comes along that was built also using that address. The problem is actually somewhat tractable you can just enumerate every single shared library on the system and assign them all unique address ranges, ensuring that whatever combinations of library are loaded they never overlap. This is essentially what prelinking does (although that is a hint, rather than a fixed, required address base). Apart from being a maintenance nightmare, with 32-bit systems you rapidly start to run out of address-space if you try to give every possible library a unique location. Thus when you examine a shared library, they do not specify a particular base address to be loaded at:
$ readelf --headers /lib/libc.so.6
Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
[...]
  LOAD           0x000000 0x00000000 0x00000000 0x236ac 0x236ac R E 0x1000
  LOAD           0x023edc 0x00024edc 0x00024edc 0x0015c 0x001a4 RW  0x1000
Shared libraries also have a second goal code sharing. If a hundred processes use a shared library, it makes no sense to have 100 copies of the code in memory taking up space. If the code is completely read-only, and hence never, ever, modified, then every process can share the same code. However, we have the constraint that the shared library must still have a unqiue data instance in each process. While it would be possible to put the library data anywhere we want at runtime, this would require leaving behind relocations to patch the code and inform it where to actually find the data destroying the always read-only property of the code and thus sharability. As you can see from the above headers, the solution is that the read-write data section is always put at a known offset from the code section of the library. This way, via the magic of virtual-memory, every process sees its own data section but can share the unmodified code. All that is needed to access data is some simple maths; address of thing I want = my current address + known fixed offset. Well, simple maths is all relative! "My current address" may or may not be easy to find. Consider the following:
$ cat test.c
static int foo = 100;
int function(void)  
    return foo;
 
$ gcc -fPIC -shared -o libtest.so test.c
So foo will be in data, at a fixed offset from the code in function, and all we need to do is find it! On amd64, this is quite easy, check the disassembly:
000000000000056c <function>:
 56c:		 55			push   %rbp
 56d:		 48 89 e5             	mov    %rsp,%rbp
 570:		 8b 05 b2 02 20 00    	mov    0x2002b2(%rip),%eax        # 200828 <foo>
 576:		 5d                   	pop    %rbp
This says "put the value at offset 0x2002b2 from the current instruction pointer (%rip) into %eax. That's it we know the data is at that fixed offset so we're done. i386, on the other hand, doesn't have the ability to offset from the current instruction pointer. Some trickery is required there:
0000040c <function>:
 40c:	 55			push   %ebp
 40d:	 89 e5                	mov    %esp,%ebp
 40f:	 e8 0e 00 00 00       	call   422 <__i686.get_pc_thunk.cx>
 414:	 81 c1 5c 11 00 00    	add    $0x115c,%ecx
 41a:	 8b 81 18 00 00 00    	mov    0x18(%ecx),%eax
 420:	 5d                   	pop    %ebp
 421:	 c3                   	ret    
00000422 <__i686.get_pc_thunk.cx>:
 422:	 8b 0c 24		mov    (%esp),%ecx
 425:	 c3                   	ret    
The magic here is __i686.get_pc_thunk.cx. The architecture does not let us get the current instruction address, but we can get a known fixed address the value __i686.get_pc_thunk.cx pushes into cx is the return value from the call, i.e in this case 0x414. Then we can do the maths for the add instruction; 0x115c + 0x414 = 0x1570, the final move goes 0x18 bytes past that to 0x1588 ... checking the disassembly
00001588 <global>:
    1588:       64 00 00                add    %al,%fs:(%eax)
i.e., the value 100 in decimal, stored in the data section. We are getting closer, but there are still some issues to deal with. If a shared library can be loaded at any address, then how does an executable, or other shared library, know how to access data or call functions in it? We could, theoretically, load the library and patch up any data references or calls into that library; however as just described this would destroy code-sharability. As we know, all problems can be solved with a layer of indirection, in this case called global offset table or GOT. Consider the following library:
$ cat test.c
extern int foo;
int function(void)  
    return foo;
 
$ gcc -shared -fPIC -o libtest.so test.c
Note this looks exactly like before, but in this case the foo is extern; presumably provided by some other library. Let's take a closer look at how this works, on amd64:
$ objdump --disassemble libtest.so
[...]
00000000000005ac <function>:
 5ac:		 55			push   %rbp
 5ad:		 48 89 e5             	mov    %rsp,%rbp
 5b0:		 48 8b 05 71 02 20 00 	mov    0x200271(%rip),%rax        # 200828 <_DYNAMIC+0x1a0>
 5b7:		 8b 00                	mov    (%rax),%eax
 5b9:		 5d                   	pop    %rbp
 5ba:		 c3                   	retq   
$ readelf --sections libtest.so
Section Headers:
  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
[...]
  [20] .got              PROGBITS         0000000000200818  00000818
       0000000000000020  0000000000000008  WA       0     0     8
$ readelf --relocs libtest.so
Relocation section '.rela.dyn' at offset 0x418 contains 5 entries:
  Offset          Info           Type           Sym. Value    Sym. Name + Addend
[...]
000000200828  000400000006 R_X86_64_GLOB_DAT 0000000000000000 foo + 0
The disassembly shows that the value to be returned is loaded from an offset of 0x200271 from the current %rip; i.e. 0x0200828. Looking at the section headers, we see that this is part of the .got section. When we examine the relocations, we see a R_X86_64_GLOB_DAT relocation that says "find the value of symbol foo and put it into address 0x200828. So, when this library is loaded, the dynamic loader will examine the relocation, go and find the value of foo and patch the .got entry as required. When it comes time for the code loads to load that value, it will point to the right place and everything just works; without having to modify any code values and thus destroy code sharability. This handles data, but what about function calls? The indirection used here is called a procedure linkage table or PLT. Code does not call an external function directly, but only via a PLT stub. Let's examine this:
$ cat test.c
int foo(void);
int function(void)  
    return foo();
 
$ gcc -shared -fPIC -o libtest.so test.c
$ objdump --disassemble libtest.so
[...]
00000000000005bc <function>:
 5bc:		 55			push   %rbp
 5bd:		 48 89 e5             	mov    %rsp,%rbp
 5c0:		 e8 0b ff ff ff       	callq  4d0 <foo@plt>
 5c5:		 5d                   	pop    %rbp
$ objdump --disassemble-all libtest.so
00000000000004d0 <foo@plt>:
 4d0:   ff 25 82 03 20 00       jmpq   *0x200382(%rip)        # 200858 <_GLOBAL_OFFSET_TABLE_+0x18>
 4d6:   68 00 00 00 00          pushq  $0x0
 4db:   e9 e0 ff ff ff          jmpq   4c0 <_init+0x18>
$ readelf --relocs libtest.so
Relocation section '.rela.plt' at offset 0x478 contains 2 entries:
  Offset          Info           Type           Sym. Value    Sym. Name + Addend
000000200858  000400000007 R_X86_64_JUMP_SLO 0000000000000000 foo + 0
So, we see that function makes a call to code at 0x4d0. Disassembling this, we see an interesting call, we jump to the value stored in 0x200382 past the current %rip (i.e. 0x200858), which we can then see the relocation for the symbol foo. It is interesting to keep following this through; let's look at the initial value that is jumped to:
$ objdump --disassemble-all libtest.so
Disassembly of section .got.plt:
0000000000200840 <.got.plt>:
  200840:       98                      cwtl   
  200841:       06                      (bad)  
  200842:       20 00                   and    %al,(%rax)
        ...
  200858:       d6                      (bad)  
  200859:       04 00                   add    $0x0,%al
  20085b:       00 00                   add    %al,(%rax)
  20085d:       00 00                   add    %al,(%rax)
  20085f:       00 e6                   add    %ah,%dh
  200861:       04 00                   add    $0x0,%al
  200863:       00 00                   add    %al,(%rax)
  200865:       00 00                   add    %al,(%rax)
        ...
Unscrambling 0x200858 we see its initial value is 0x4d6 i.e. the next instruction! Which then pushes the value 0 and jumps to 0x4c0. Looking at that code we can see it pushes a value from the GOT, and then jumps to a second value in the GOT:
00000000000004c0 <foo@plt-0x10>:
 4c0:   ff 35 82 03 20 00       pushq  0x200382(%rip)        # 200848 <_GLOBAL_OFFSET_TABLE_+0x8>
 4c6:   ff 25 84 03 20 00       jmpq   *0x200384(%rip)        # 200850 <_GLOBAL_OFFSET_TABLE_+0x10>
 4cc:   0f 1f 40 00             nopl   0x0(%rax)
What's going on here? What's actually happening is lazy binding by convention when the dynamic linker loads a library, it will put an identifier and resolution function into known places in the GOT. Therefore, what happens is roughly this: on the first call of a function, it falls through to call the default stub, which loads the identifier and calls into the dynamic linker, which at that point has enough information to figure out "hey, this libtest.so is trying to find the function foo". It will go ahead and find it, and then patch the address into the GOT such that the next time the original PLT entry is called, it will load the actual address of the function, rather than the lookup stub. Ingenious! Out of this indirection falls another handy thing the ability to modify the symbol binding order. LD_PRELOAD, for example, simply tells the dynamic loader it should insert a library as first to be looked-up for symbols; therefore when the above binding happens if the preloaded library declares a foo, it will be chosen over any other one provided. In summary code should be read-only always, and to make it so that you can still access data from other libraries and call external functions these accesses are indirected through a GOT and PLT which live at compile-time known offsets. In a future post I'll discuss some of the security issues around this implementation, but that post won't make sense unless I can refer back to this one :)

24 April 2011

John Goerzen: Adventure: 1 dad, 2 boys, and lots of trains

Terah and I recently decided that each of us could use a day off of not having to do work or supervise boys. Yesterday I had the day off work so that was mine. I took my Kindle, along with its Gutenberg copy of War and Peace, which yes, I m reading for fun. I slept in a bit, then got breakfast and sat down at Botanica, the Wichita Gardens with the Kindle for awhile. That was a nice way to spend the morning. Today was Terah s day off. Initially I thought of taking the boys to The Cosmosphere, one of the world s premier space museums, or to the Kansas Aviation Museum. But then I realized that the Midland Railway, a historic excursion line in Baldwin City, KS, was having their first train trip of the year. And it s the Easter special: you take the train a few miles out of town, get off, the kids do an Easter egg hunt, then also get to get their picture taken with the Easter bunny. Kid paradise, right? What could be better? So this is how my alarm came to be set for 5:15 on a Saturday morning. Oliver woke up early, but I had to get Jacob up. He was groggy, trying to cover his face and ears, and annoyed at me for trying to wake him up. Until I said, Jacob, it s time to get ready for the car trip to the train ride. Can you go get dressed for the day? Silence. Then about 5 seconds later, he jumped up, said, OK dad, I will do it, and he did. We drove our 2.5 hours. I had set out a non-dirty breakfast in the car for them the night before, so they munched while we drove. Then had to wait in a huge line for our tickets. An hour later we had them got the last 3 tickets for the first departure of the day, 10AM and ran to get on the train before it left. Jacob and Oliver both got very quiet. Sometimes Jacob especially does that when he s very excited about things. He doesn t always look it right then, but I knew I d be hearing about it later. He had his face almost pressed to the window the whole way. IMG_5685.JPG Oh, and yes, he dressed himself and I didn t check to make sure he had the correct shirt, or that it wasn t on inside-out, until it was too late. Oops. We rode in an ex-CP car built in 1936. One of the cars on the train was built in the 1890s quite some neat equipment. Anyhow, next came the hunt. There were two large lawns covered in eggs, separated by age group. Jacob and Oliver were in the younger group, but still only got a few eggs (there were lots of other parents, uhm, helping their kids by picking up eggs the kids were too slow to get and putting them in baskets ) But they were thrilled with the experience so that s what counts. They moved the locomotive to the other end of the train for the trip back using an adjacent track. Lots of the kids watched them couple it back on. Jacob and Oliver were particularly interested nothing could have distracted them from watching that train though they didn t particularly like the noise of the horn. IMG_5655.JPG On the way back, someone in an Easter bunny suit was on the train for pictures. I took the boys there. They usually refuse to sit on laps of Santa and such, so I didn t figure much success. They actually agreed to do it. And despite their expressions in this photo, Jacob later told me over and over how much fun it was to be with the Easter bunny. IMG_5671.JPG After we got back, we headed for the car. Jacob insisted on carrying his own Easter bag, and predictably wound up carrying it upside down for awhile. So his bag had some grass in it from picking the candy back up. Oliver discovered some rocks by a ditch and had fun throwing them in to make a splash, so we paused for that for awhile. By this point it was about noon. So at this point, what does a dad who has managed to keep two active boys in line for an hour, help them with an egg hunt and giant rabbit, and keep them from falling into the ditch they re throwing rocks into, do? Say that it s time to eat lunch and then head for home so we can be there in time for supper? Or go for MORE ADVENTURE? I said, Jacob, how would you like to eat lunch inside a big train station in Kansas City? Pause for a couple of seconds to think. YEAH! I have never had lunch in a train station before! Let s go! Shall we go NOW? So I gave them the leftover breakfast to eat during the hour drive on towards the beautiful Kansas City Union Station. It s one of the few grand American train stations that survives intact, and is just stunning. Jacob and Oliver both fell asleep on the way there. We parked, walked inside, and Jacob just froze. Dad WOW! That ceiling is SO HIGH! I can t even reach it! He then raised his hand as high as it would go and said, See dad, it is so high I can t touch it! (Most ceilings are, but this one is indeed much, much taller than most.) We ate lunch in the second level of a restaurant right in the Grand Hall, which Jacob really enjoyed. Here s Jacob, annoyed that I pulled out the camera again: IMG_5693.JPG Then we went exploring for an hour. Jacob talked about his adventure . We went up the elevators and checked out the balconies. Then we found the Model Railroad Experience. And oh my. The boys were visibly the most excited they had been all day. Oliver just froze at the spot he walked through the door, not caring to move and see the rest of the exhibit because he was so fascinated by what he already saw. There was a huge layout in the middle of the room, and smaller ones in adjacent rooms. We finally made our way there, and Oliver just ran round and round one of them, following a train, excitedly yelling There it is! There it is! There it is! Here s a photo from the big layout: IMG_5706.JPG Jacob cried when it was time to go, but I had promised them some dessert before we left, so after a bite of ice cream we were on our way. On the way home, every 15 minutes or so, Jacob would make a remark like this: Dad, the train ride was SO fun! or Dad, I really liked Kansas City Union Station! and so forth, naming every highlight of the day for him several times over: the Easter bunny, the egg hunt, train ride, and everything about Union Station. On the way home, we stopped at our favorite restaurant in Emporia: BobbyD s Merchant St. BBQ. This is always a hit for everyone in the family. A down-home place that has excellent food, is not far off our path, and never seems to have a wait. Yum.

17 April 2011

Russell Coker: More about the Xperia X10

I ve now had a Sony Ericsson Xperia X10 for almost two months (here is a link for my first review) [1]. This is a phone that people seem to really dislike because the battery life is poor and Sony doesn t allow replacing the kernel. I m happy with mine, happy enough that after buying one for my wife and trying it out I bought one for myself. I knew about it s problems in advance and wanted a relatively cheap phone with a large high resolution screen, and the Xperia X10 was the best match for my criteria.ChargingThere has been a recent trend towards using USB for charging devices. Sony provides a tiny wall-wart PSU which has a USB socket and a short (1m) USB cable that can be used to charge the phone from it s PSU or from a PC. The size is really convenient, as the phone has a short battery life I ll probably want to take the PSU to more places than I would for other phones I ve owned.The short USB cable saves weight and tangle when travelling, but can be inconvenient. I m currently working on the phone while it s plugged into my laptop, that works well and I can make calls while it s connected. If the phone was connected to a USB port on a tower computer that was on the ground then the cable could be too short to make a call, if it was charging on a power point near the floor then I wouldn t even be able to use the computer functionality let alone make calls without kneeling. My Viewty has a 175cm charging cable which alleviates these problems. I ve got a 50cm USB extension cable that I use for charging my phone while I m in bed that is just long enough to allow me to check my email without getting out of bed!The socket for connecting the USB cable is protected by a plastic lid that is connected by a strip of rubber. For a socket that will be used at least twice a day this isn t a good mechanical design. The plastic slide on the LG U990 Viewty seems like a much better design.As an aside it s a pity that they aren t designing cars with USB charging sockets built in. Some new cars have a socket for one USB flash drive to be attached to the radio, but really they need at least one USB charging port per seat. It would also be nice if they made power points with USB charging sockets built in, I d buy a few of those if they made them.Preserving the BatteryI ve been running Juice Defender to reduce the battery use, at the moment it is claiming to have extended battery life by 69%. That combined with turning off things that aren t needed (such as WiFi) has made the phone reasonably usable. I can survive more than 12 hours during which I use the phone a lot without charging it.XperiaX10.net has an interesting review of replacement batteries [5]. I m not going to buy them because the largest battery requires a replacement back case which prevents using an external case to prevent damage and the smaller one doesn t provide enough of a benefit and the design of the phone makes it difficult to change batteries so carrying a spare battery isn t a good option.Cursor Control KeysThe HP/Compaq iPaQs that I own from ~10 years ago have a single button that can be moved up/down/left/right to act as a cursor, it can also be pressed inwards to act as an ENTER key (or whatever the application might want for a fifth function). Having some sort of hardware cursor control is really handy, I often end up deleting several characters when I want to replace one because getting the cursor onto the desired character is too difficult.Adding more hardware keys would require making the phone bigger, but that would be fine by me. As described in my previous post about phone cameras I d like to have a phone that s thicker to have a better camera with a greater focal distance for a larger lens [2].Core Phone FunctionalityI really miss having separate green and red buttons for making/answering calls and for rejecting/ending calls.A really common operation is to call back the last person who called. To do this on my LG U990 Viewty I press the green button twice on my home screen which took less than a second. On the Xperia this involves selecting the phone icon from the home screen, then the call log icon, then the call that is desired, then the Call user line. That is four presses in different parts of the screen compared to pressing the same hardware button twice. I m investigating dialer applets right now, the Dialler One applet has a good interface for calling people who have called or been called recently but it still requires two presses on different parts of the screen. With my old Viewty I could call back the last person by feel without even looking at the phone!In the last 6 years the standard functionality of phones has been to include multiple profiles for noises. My Viewty has profiles named Normal , Silent , Vibrate only , Outdoor , Headset (automatically selected when a headset is connected), and three customised ones. The Xperia has only one setting, and that is three icon presses away from the home screen. It does allow changing the volume by hardware switches on the side which includes going to vibrate-only and silent mode. While this is useful, it s not the best way that two precious hardware keys could be used. It also doesn t allow control over all the different notifications, I d like to be able to activate a noise profile and have every application respond to it in an appropriate manner. This is a deficiency in Android 2.1 not in the phone itself.In many ways this phone has the worst phone functionality of any mobile phone I ve ever owned, I think that this is more the fault of the Android designers than Sony Ericsson.Android UpdatesSony had previously claimed that they wouldn t support Android later than 2.1. Now Sony has announced that they will support Gingerbread Android 2.3 [3]. So one of the major complaints about the Xperia will soon be addressed.TetheringThe build of Android that the Xperia runs at the moment doesn t support Wifi tethering. I m currently using with Easy Tether for USB tethering [4]. It s not free software and requires it s own code to run as root on your Linux system that is being tethered (which is easily locked down with SE Linux), but it basically works. The down-side with Easy Tether is that it proxies all the connections so you can t run traceroute etc and in the free version you can t use UDP.K9 MailK9 Mail fixes some of the problems in the default Android email program that I described in my previous post. It allows selection of SSL with a default port of 993 for IMAPs. It uses mail.example.com as the mail server address for an email address of user@example.com (so I ll add a mail CNAME to the domains I run). When I connected initially it told me that the SSL key was not signed by a CA and asked if I wanted to save it or reject it this is the correct and desired functionality. It also correctly parses URLs from the email (or at least has fixed the bug that I discovered in the default email app).One problem I ve found with K9 is that it seems to timeout on large folders. This is probably partly the fault of Virgin Mobile being slow for IP access, but I wonder whether K9 doesn t pipeline IMAP commands as Virgin can do bulk transfer at reasonable speeds (80KB/s) and it mainly fails on latency (900ms being typical). The result is that a folder with more than 500 messages that need to be copied to the phone will never get synchronised. When I started reading mail on my phone I had to move mail from some of the bigger folders into other folders to avoid timeouts. As an aside the amount of time I ve saved by reading email on the go has already paid for the phone.MediascapeThe Sony Mediascape software is used for categorising photos. One function of this is to assign names to photos, the names come from the contact list so if you photograph someone who you can t phone then you need to add a contact list entry for them. This also means that you couldn t conveniently add names to non-humans, I guess I could have added a contact list entry Mr Crash Dump for photos of system crash logs. But a bigger problem is that it decides what is a picture of a person, a picture of someone who is not centered in the photo or a profile picture can be regarded as not a photo of a person and therefore not subject to being associated with a contact list. Finally when selecting a name for a picture it displays the entire contacts list in a small font instead of displaying favorites, I have the phone numbers of many clients in my contacts list who I will never photograph Mediascape just isn t much good. If I feel the need to do something serious in this regard I ll search the app store for something free that s better.ProtectionFor $15 each I bought one grey and one clear Gel Case from J2K. This case covers the sides and back of the phone with a firm rubber layer that will hopefully allow it to bounce rather than break. It also extends slightly higher than the screen which should stop the screen being scratched if the phone is left face-down on a hard surface on the vibrate setting.One problem with the Gel Case is that by it s design it has to cover the buttons on the sides, due to a design or manufacturing problem the clear case that my wife uses can press slightly on the shutter button which disables the three main buttons on the front. So when the menu or back button stops working she has to slightly move the Gel Case out from the side. I m thinking of just cutting out a section of the Gel Case there, that will make it difficult to press the shutter button, but you can use the touch screen to take photos and there doesn t seem to be any other use for the shutter button so this shouldn t be a problem. The clear and grey cases have different designs, the grey one has a hole over the raised Sony logo which makes it fit a little better as well as not having the shutter problem, so it seems to be a later design I don t know whether all clear cases have the same problem but I recommend that someone who only has one Xperia X10 get the grey case just in case.Web BrowsingI m experimenting with using my own web proxy to compress the data sent to the phone. Unfortunately the Android settings for a web proxy only apply to the main web browser, not to all the other applications that use web services. Also the built-in web browser requires pressing the settings hardware button followed by at least two touch-screen presses to change between windows or close a window and it doesn t seem to support making the short-press action be to open a link in a new window. So I will have to find another web browser to use.Bandwidth UseThe 3G Watchdog applet is really good for tracking the data transfer and optionally cutting off 3G access before the quota is exceeded. Unfortunately Virgin has already sent me a bill with $234 in extra charges for bandwidth use because I used 1.6G instead of my 1.5G quota. A Virgin representative had told me over the phone that the billing period would be based on the end of the month, so while every calendar month has had less than 1.5G used because I used more than average in the end of March and the start of April that counts as excess data in the 14th March to 13th April period.I m going to appeal this to the Telecommunications Industry Ombudsman, I don t think that it s reasonable that I should be billed almost 7* the normal bill for exceeding the quota by 7.4% based on following the instructions of a Virgin employee. While I could have read the previous bill that they sent me to discover the end of billing period dates, I don t think that I should be expected to distrust everything that a Virgin employee says. If they billed me an extra $20 then I d just pay it, but $234 is unreasonable.ConclusionSince using the phone I ve found significant benefits in web browsing and reading email with the major limitation being the small screen (relative to a Netbook or Laptop). So if I was to buy another phone I would probably consider a Dell Streak which seems to be the largest Android phone on the market at the moment.Given the amount of use that I ve got I would be happy to spend more money and therefore consider a more expensive phone. But I don t regret the decision to save money by getting an Xperia X10.Finally when a telco tries to stick me with a $234 excess charge it really detracts from the value of having a phone contract. If I end up having to pay that then it s half the value of a smart-phone lost in one telco scam. This is enough to make a contract with Virgin a bad option, after this contract expires I may use VOIP and a pre-paid SIM from Telstra NextG if their network is still the best. Another possibility is to just use a small tablet and skip having a mobile phone, email and Jabber plus SMS from the people who lack net access will probably do.

14 April 2011

Mirco Bauer: The Big Split: Mono 2.10 Debian Packaging

Most probably haven't noticed yet but I finished the Mono 2.10.1 debian packaging effort of the past 3 months and uploaded it to Debian/Experimental. With Mono 2.10 I had to make the biggest changes in Mono packaging since the big Mono 2.0 upload. The runtime no longer supports the 1.0 and 2.0 runtime profile, instead it now supports the 2.0 and 4.0 runtime profile. This meant I had to drop all libmono*1.0-cil packages and add libmono*4.0-cil packages. This sounds like a lot of s/1.0/4.0/ work but it actually wasn't. Mono 2.10 ships a lot of new libraries over 2.6 and I had again to decide where they should go. "Where should this $library go?" I have been playing this game for the past 7 years maintaining Mono and I finally gave up on it... What, where, when, why? I could give now a 2 hours talk of the issues behind the current packaging approach (keeping the number of library packages low) but instead I will do something else. Please, just take a look at this picture for a second: Brain Melting Device If your browser crashed, your eyes hurt or your brain simply melted, I think you have got the idea. The Big Split The cure? cli-common-dev! This is a package that contains 2 extremely important debhelper packaging tools for packaging Mono/CLI related packages called dh_makeclilibs and dh_clideps. If you don't know these, they do exact the same thing as dh_makeshlibs and dh_shlibdeps do. dh_makeclilibs generates library dependency tracking information and dh_clideps consumes that information to automatically generate the package dependencies for you. So each library of the 4.0 runtime profile has now it's own package, simple as that, the rest does cli-common-dev for me and you. "Hey, that Mono packaging bastard is polluting the Debian archive because of his laziness!" No, I am not. This packaging change not only has the advantage of simplifying the packaging and with that bringing new Mono versions faster to you but also reduces the typical install size for applications as they will only pull in the really used libraries of Mono instead of groups of them. I don't have any numbers handy right now as none of the applications are built against Mono 2.10 (yet), but when the transition starts we will get numbers. New Features There is also a new SGen flavor of Mono available called mono-runtime-sgen which is no longer using the conservative non-generational Boehm's garbage collector but SGen which is a simple generational garbage collector with promising advantages. And here some more Mono 2.8/2.10 news from /usr/share/doc/mono-runtime/NEWS.Debian.gz: Architecture Regressions With the initial upload of Mono 2.10.1 to Debian/Experimental the architecture world broke apart and it regressed on all Mono architectures except for i386 and amd64 :-D There is a reason it's called experimental isn't there? In mono 2.10.1-3 I could solve all regressions except for kfreebsd-* and armel. Jo Shields fixed the remaining regressions and the world started to look good again in mono 2.10.1-4! He also took care of mono-basic, mod-mono and xsp, but mod-mono and xsp are still waiting for the translation call deadline to pass by so they can also be uploaded to Debian/Experimental. Planned Transition As mentioned above, there will be a Mono 2.10 transition needed when the packages hit Debian/Unstable. There is no ETA yet on this when it will happen as I have to coordinate this with debian-release first. But as things are not showtime ready in experimental anyhow, this will not happen too soonish. The Mono 2.10 transition plan will be covered in a following post. GIVMENOWPLX OMG, all this rumbling about Mono 2.10 and I still haven't said a word on how to obtain it, sorry about this, just do this and I will shut up now:
echo "deb http://ftp.debian.org/debian experimental main" >> /etc/apt/sources.list
apt-get update
apt-get install -t experimental mono-complete
(this is the easiest way of getting only mono 2.10.1 from experimental)

5 April 2011

Daniel Kahn Gillmor: Debian on Thecus N8800Pro

I recently set up debian on a Thecus N8800Pro. It seems to be a decent rackmount 2U chassis with 8 3.5" hot-swap SATA drives, dual gigabit NICs, a standard DB9 RS-232 serial port, one eSATA port, a bunch of USB 2.0 connectors, and dual power supplies. I'm happy to be able to report that Thecus appears to be attempting to fulfill their obligations under the GPL with this model (i'm fetching their latest source tarball now to have a look). Internally, it's an Intel Core 2 Duo processor, two DIMMS of DDR RAM, and a PCIe slot for extensions if you like. It has two internally-attached 128MiB SSDs that it wants to boot off of. The downsides as i see them:
BIOS
The BIOS only runs over VGA, which is not easy to access. I wish it ran over the serial port. It's also not clear how one would find an upgrade to the BIOS. dmidecode reports the BIOS as:
        Vendor: Phoenix Technologies, LTD
        Version: 6.00 PG
        Release Date: 02/24/2009
RAM
The mainboard has only two DIMM sockets. It came pre-populated with two 2GiB DDR DIMMs. memtest86+ reports those DIMMs clearly, but sees only 3070MiB in aggregate. The linux kernel also sees ~3GiB of RAM, despite dmidecode and lshw reporting that the two DIMM modules each are only 1GiB in size. I'm assuming this is a bios problem. Anyone know how to get access to the full 4GiB? Should i be reporting bugs on any of these packages?
SSDs
The internal SSDs are absurdly small and very slow for both reading and writing. This isn't a big deal because i'm basically only using them for the bootloader, kernel, and initramfs. But i'm surprised that they could even find 128MiB devices in these days of $10 1GiB flash units.
processor
/proc/cpuinfo reports two cores of a Intel(R) Core(TM)2 Duo CPU T5500 @ 1.66GHz, each with ~3333 bogomips, and apparently without hardware virtualization support. It's not clear to me whether the lack of virtualization support is something that could be fixed with a BIOS upgrade.
I used Andy Millar's nice description of how to get access to the BIOS -- I found i didn't need a hacksaw to modify the VGA cable i had. just pliers to remove the outer metal shield on the side of the connector i plugged into the open socket. lshw sees four SiI 3132 Serial ATA Raid II Controller PCI devices, each of which appears to support two SATA ports. I'm currently using only four of the 8 SATA bays, so i've tried to distribute the disks so that each of them is attached to an independent PCI device (instead of having two disks on one PCI device, and another PCI device idle). I don't know if this makes a difference, though, in the RAID10 configuration i'm using. There's also a neat 2-line character-based LCD display on the front panel which apparently can be driven by talking to a serial port, though i haven't tried. Apparently there are also LEDs that might be controllable directly from the kernel via ICH7 and GPIO, but i haven't tried that yet either. Any suggestions on how to think about or proceed with a BIOS upgrade to get access to the full 4GiB of RAM, BIOS-over-serial, and/or enable hardware virtualization?Tags: n8800pro, thecus

2 April 2011

Gintautas Miliauskas: Amazon Kindle 3

For the past couple years I had been reading very little, two or three books a year.

For the past month my average has been two books per week.

The culprit is the Amazon Kindle 3 I bought during my stay in the US. I just can not recommend it enough. For starters, it is quite affordable at $139. The image quality is wonderful, and reading in daylight or even in direct sunlight is pleasant. This is a welcome change from a backlit screen as the eyes get noticeably less strained. The format of the device is even more convenient than of a real book (the size is perfect for plain text, start thinking about the Kindle DX if and only if you intend to read PDFs). The Kindle is quite thin and convenient to hold (and you do not need to keep it from closing as with paperback bindings). Battery life is on the order of weeks. Extra functionality (e.g., web browsing) is available, but not convenient, but that is almost an advantage as distractions are kept at bay. The Amazon store is great, I have already shelled out over $50 with little remorse (my time is much more expensive than the measly $9.99 a typical book costs). There are quite a few free books around too. And to top it off, the "screensaver" with pictures of writers is a very nice touch.

The Kindle is also useful for going through longer articles you would normally be reading on your laptop. The Chrome extension Send to Kindle has worked well for me, do check it out.

The most important drawback of the Kindle is that it is slow to turn pages, so it is not easy to browse a book. Turning a page takes a second or so. This is extremely annoying when reading in non-linearly, e.g. taking in study material, when you constantly need to go back to check up details of previous material. A PDF interpreter is available, but the screen is too small to show a full PDF page (a Kindle DX or an iPad would probably be better) and scrolling is painful because of the delays. Wireless seems to drain the battery noticeably, there have been a few cases where I forgot to turn it off and found a dead Kindle a few days later. I wish the WiFi connection would manage itself intelligently somehow.

The Kindle drove the point home for me that dead-tree books will be going the way of vinyl soon, much sooner than I had expected. And for good reasons. Go order now if you do not have an e-book reader yet (and do not forget to order a sleeve too, given the time you will be spending carrying the device it will come in very handy).

13 March 2011

Steve Kemp: A few forks.

Although I promised in my previous entry that I'd made my last mention of the redisfs - replication friendly redis-based filesystem I have to disappoint. Ben Sykes informed me that he'd made a fork of redisfs, called shredisfs. I like forks. Forks are good, and this particular one was very welcome - from the README:
Steve's original managed around 250k per second for writes on my test machine, this version does about 15MB a second writes. ... Read speed on the test machine here now is around 180MB/sec..
Needless to say I "stole" the improvements and rolled them into my original release. Thanks all round to those of you that submitted bug reports, suggestions, and codez. I also had a release out briefly which used zLib to compress the values of keys stored in memory. Unfortunately that lead to a net-slowdown for files which were bigger than a single block - due to the overhead of file-system appends which translated to: "fetch", "compress", "append", and "decompress". Finally on the subject of qpsmtpd, my favourite SMTP-server - the exceptionally talented Matt Sergeant released a proof of concept rewrite in Javascript. Using nodejs this new SMTP server is heavily asynchronous and you can find it online under the name Haraka. Although my javascript-fu is weak I'm very impressed by the codebase out there so far, and I'd expect good things of it in the future. Even if it does use Javascript and not my beloved Perl. Finally I'm a year older. But birthdays aren't important. ObQuote: "Do you wanna know what makes all my candy taste so special? " - Epic Movie.

10 March 2011

Peter Eisentraut: My new Git pre-commit hook

This appears to be kind of useful:
#!/bin/sh

output=$(find . -name '.#*' -print)
if [ -n "$output" ]; then
echo "unsaved Emacs files:" 1>&2
echo "$output" 1>&2
exit 1
fi
Had that kind of problem a few times. :-)

Now what would be really handy are system-wide Git hooks that apply to all repositories, like ~/.gitignore complements .git/info/exclude.

8 March 2011

Evgeni Golov: Desktop in a shell: irssi

Continuing my series about my desktop in a shell, in this chapter I will present you my irssi setup.Irssi is the most customized part of my setup, using many scripts from the irssi-scripts Debian package and some from the internet , handling 6 irc networks with a total of 34 channels plus JabberXMPP, ICQ, Twitter and identi.ca. My custom irssi settingsI like my conversations to look like Buddy, you rock instead of Buddy: you rock , so:
/set completion_char ,I also like *long highlighted text*, so:
/set emphasis_multiword onHide mIRC and ANSI colors when turned on. This can be used to eliminate angry fruit salad syndrome in some channels. (Quote from irssi.org/documentation/settings, do I have to say more?):
/set hide_colors onWhen talking in more than one channel, it sometimes comes handy to repeat something from the past said in THAT channel, not searching though all:
/set window_history onTell irssi to shutup when away, noone will hear/see the beep anyways:
/set beep_when_away offI want my screen to inform me about new messages, so I need this:
/set bell_beeps onBeep for query text, notices, dcc, dcc text and hilight:
/set beep_msg_level MSGS NOTICES DCC DCCMSGS HILIGHMy used irssi scriptsactive_notice.pl (from irssi-scripts)Show notices in the active window or the corresponding query instead of the status-window.
No further configuration needed.adv_windowlist.pl (from anti.teamidiot.de)Some really smart windowlist, see my previous post about adv_windowlist.pl, I won t explain its features and settings here again.autorealname.pl (from irssi-scripts)Show peoples real-name when they join (my $nick $name memory is poor :()
No further configuration needed.chansort.pl (from irssi-scripts)Automatically sort my channels alphabetically, grouped by network.
Enable via /set chansort_autosort on<Update>kaimi asked me yesterday, whether chansort could ignore the network and just sort ALL channels in alphabetical order. Well, it could not, until yesterday ;) Fetch either the patch against chansort.pl or my chansort-ng.pl and set chansort_ignore_network to ON. You can also set chansort_ignore_windowtype to mix channels and queries if you like to.</Update>hack-whois-in-current-window.pl (from dgl.cx)Display /whois in the current window or the corresponding query instead of the status-window.
No further configuration needed.keepnick.pl (from irssi-scripts)Restore my nick after it is free again (like after a ping timepout).
Set the nick via /keepnick [-net chatnet] [nick]nickserv.pl (from irssi-scripts)Automatically authorize me on networks with NickServ.
Enable by settings services address, nick and password via:
/nickserv addnet freenode NickServ@services.
/nickserv addnick freenode Zhenech mypass
screen_away.pl (from irssi-scripts)Set away when screen is detached.
Will be enabled automatically, but you maybe want to tweak screen_away_message :)seen.pl (from irssi-scripts)Add a /seen nick command to lookup when and where nick was online the last time.
No further configuration needed.trackbar.pl (from irssi-scripts)Draw a line when you switch irssi windows so you can see which part of the conversation you have already seen.
No further configuration needed.BitlBeeI m using BitlBee as my irssi-to-every-im gateway of choice ;) But while it sounds easy, my setup isn t. I am using BitlBee only to connect to jabber.die-welt.net, my Jabber/XMPP server. There I have a pyICQt instance running, to connect to ICQ via Jabber (yes, BitlBee would support that directly, but that would fail on me when I would like to connect from a different Jabber-client). Twitter and identi.ca are handled via Jabber too: identi.ca does support this by themself, for Twitter I use the tweet.im service.
But besides of my strange setup, BitlBee is easy: apt-get install bitlbee, connect irssi to localhost:6667, you will be force-joined to &bitlbee, where you do:
register somepassword
account add Jabber you@jabberserber.example.com jabberpassword
account on 0
and done, you@jabberserver.example.com is online :)The all awaited screenshot (from my last irssi-post):

And the whole ~/.irssi/config: http://files.die-welt.net/irssi-config.txt, read it carefully while waiting for the next post about newsbeuter :)

1 March 2011

Joachim Breitner: Nomen est Omen

Google provides a handy image search, and given that the Internet is for porn, it is a good thing that they provide a filter that tries to remove pornographic images. This allows us to define the pornyness of a name (or of any word): It is the percentage of images found by Google that are removed when enabling the SafeSearch filter. For those who want to find out the pornyness of their name without having to count pictures that are NSFW, I have created the pornyness calculator. The range of values goes from 0% (for Ursel) to 97% (for Aletta, exact percentage depends on your location, it seems). This is implemented by some simple JavaScript in a static file, and using Google s API. PS: It was pointed out to me that Maschinenbau (civil engeneering) has a score of 0%, but Mathematik (mathematics) has a score of 2%. Feel free to add more interesting results to the comments.

20 February 2011

Christoph Egger: CSSH but without X

There are many ways to run some commands simultaneously on multiple hosts like cssh or dsh. They come handy for example when you are installing software updates on a set of hosts. dsh is a rather simple comandline tool allowing to execute a command over ssh on multiple hosts. However it doesn't allow any interactive input -- so you can't look at the potentially upgrading packages and press y to accept and you can't go through debconf promts or similar. This is solved by cssh which opens a XTerm for every host and a input area that is broadcastet to all of them. this is working really well -- you can execute your update on all hosts and still do individual adjustments just as needed: switch focus from the broadcasted input to one of the terminal windows and anything you type just goes there. Now cssh has a big disadvantage: it requires a running X server (and doesn't do too well with a fullscreen windowmanager). Requiring X is quite a blocker if you need to run that ssh multiplexer on a remote host, for example if the firewalling doesn't allow direct connections. Fortunately you can make tmux behave as we want -- in a simple terminal: First you need a script spawning the ssh sessions in separate tmux panes and direct input to all of them -- here called ssh-everywhere.sh (you could also write a tmux config I guess):
#/bin/sh
# ssh-everywhere.sh
for i in $HOSTS
do
  tmux splitw "ssh $i"
  tmux select-layout tiled
done
tmux set-window-option synchronize-panes on
Now start the whole thing:
tmux new 'exec sh ssh-everywhere.sh'
And be done. Update If you want to type in just one pane (on one host) you can do that as well: C-b : set-window-option synchronize-panes off and moving to the right pane (C-b + Arrow keys)

19 February 2011

Kees Cook: ptracing siblings

In Ubuntu, the use of ptrace is restricted. The default allowed relationship between the debugger and the debuggee is that parents are allowed to ptrace their descendants. This means that running gdb /some/program and strace /some/program Just Works. Using gdb s attach and strace s -p options need CAP_SYS_PTRACE, care of sudo. The next most common use-case was that of crash handlers needing to do a live ptrace of a crashing program (in the rare case of Apport being insufficient). For example, KDE applications have a segfault handler that calls out to kdeinit and requests that the crash handling process be started on it, and then sits in a loop waiting to be attached to. While kdeinit is the parent of both the crashing program (debuggee) and the crash handling program (debugger), the debugger cannot attach to the debugee since they are siblings, not parent/descendant. To solve this, a prctl() call was added so that the debugee could declare who s descendants were going to attach to it. KDE patched their segfault handler to make the prctl() and everything Just Works again. Breakpad, the crash handler for Firefox and Chromium, was updated to do effectively the same thing, though they had to add code to pass the process id back to the debuggee since they didn t have it handy like KDE. Another use-case was Wine, where for emulation to work correctly, they needed to allow all Wine processes to ptrace each other to correctly emulate Windows. For this, they just declared that all descendants of the wine-server could debug a given Wine process, there-by confining their ptrace festival to just Wine programs. One of the remaining use-cases is that of a debugging IDE that doesn t directly use ptrace itself. For example, qtcreator will launch a program and then later attach to it by launching gdb and using the attach command. This looks a lot like the crash handler use-case, except that the debuggee doesn t have any idea that it is running under an IDE. A simple solution for this is to have the IDE run its programs with the LD_PRELOAD environment variable aimed at a short library that just calls prctl() with the parent process id, and suddenly the IDE and its descendants (i.e. gdb) can debug the program all day long. I ve got an example of this preloadable library written. If it turns out this is generally useful for IDEs, I could package it up like fakeroot and faketime.

18 February 2011

Russell Coker: Sony Ericsson Xperia X10i First Experience

I have just got a new Xperia X10i for my wife. It s with Virgin who use the Optus network. Optus apparently have better coverage than Three (who we have been using for 6.5 years) and Virgin offers the best deals they have good phones on low monthly rates and do nice things like selling most phones unlocked (the Xperia is one that comes unlocked).I chose the phone for use in system administration work. A large screen should be good for reading email and running a ssh client. Hopefully I will be able to use the phone s Wifi to provide mobile net access to a laptop for any problem that can t be solved on a tiny screen. My wife doesn t do much sysadmin work nowadays, but it ll save some effort if we can both use the same model of phone. Also according to Amobil.no the Xperia X10 is the second best phone for camera-phone functionality [1], and my wife would really like to take some good pictures with her phone (she loves the LG U990 Viewty that she has right now).ScreenOne major reason for choosing this phone is that it has the biggest and highest resolution of any phone that doesn t cost a huge amount of money. It does well in this regard, the screen is very good to look at. However it is apparently not particularly sensitive and we still have the protective cover on the screen which makes the swipe to unlock operation quite difficult. My wife generally likes to keep the protective plastic on such screens for a while to prevent damage, but she may take this off sooner than on other devices.Sony FoolishnessOne reason that this phone is cheaper than any other phone with similar specs is that it s made by Sony. Sony won t provide updates to Android 2.2 or better and they have their own stupid applications installed in an intrusive manner. The main screen of the phone has a large icon for the Sony Timescape program. If you choose a background image of a person s face then the Timescape logo is in the ideal location to obscure the person s eyes. Generally it s not desired to have the person in your phone background look like Zorro. Fortunately you can delete icons from the home screen, you just have to press and hold the icon until a trash-can appears at the bottom of the screen and then drag it to the trash.Phone BookThe core phone functionality is fairly important for a mobile phone. But it seems that every modern phone has some serious failings in this regard. The Xperia comes with a phone book that is reasonably good for managing contacts and partially coalesces multiple entries with the same name which is convenient as I somehow managed to import 3 copies of each entry in my wife s phone book. The down-side is that the multiple entries are still stored, so when it comes time to update someone s phone number my wife will have to separate the entries and then delete all but one of them, adding probably a minute of effort for each one. With 60 phone book entries that s probably an hour of wasted time during the course of her phone use.They really should do a time based analysis of phone use and optimise the UI for efficiently performing common tasks. I think that an ideal design would start off by asking the user to rate the importance of phone functionality, camera, facebook, twitter, etc and then give a UI that matches the important tasks. A device that has 384M of RAM, 1G of built-in Flash storage, and an 8G micro-SD card (which Virgin provided with the phone) should be able to offer a selection of UIs.CameraThe configuration for the camera allows some settings to be changed easily and others have to be changed through the advanced settings which requires one more button press and a few extra taps on the screen. One real stupidity is to have the phone light be in the advanced settings, so if the room happens to be a little darker than expected you suddenly need to go to a lot of extra effort to turn on the light.Finally it would be really good to be able to take a quick picture. I would like to be able to be able to press a combination of buttons and have it immediately take a picture regardless of what had been running before. Not press the main menu button, the camera icon (which I made a link from the home screen), wait a second for it to load, and then press the shutter button. Ideally I would like to press a combination of hardware buttons to have it immediately take a picture even when the screen is locked. I don t want to wait for the screen unlock process, sometimes the perfect shot is only available for a second.WifiIt doesn t support ad-hoc networks. This is really annoying for me as I don t own an access point and I don t plan to buy one just for a phone. My laptop (Thinkpad T61 with Intel Corporation PRO/Wireless 3945ABG [Golan]) doesn t seem to support running as an access point, and my EeePC 701 with an Atheros AR5001 has the same problem, here is the error message:# iwconfig wlan0 mode master essid x
Error for wireless request Set Mode (8B06) :
SET failed on device wlan0 ; Invalid argument.I have a cheap Realtec USB Wifi device that claims to support being an access point but just fails when I try it. So presumably it doesn t really support it but the driver is buggy.It seems that I may need to put a custom Android installation on it to get ad-hoc working.Also it s apparently necessary to root the Xperia to get Wifi tethering to work for providing net access to a laptop. So I guess I ll hacking it soon.Internet AccessThe Virgin web site couldn t help me set up the Internet access because I ported a phone number from another Telco. I had to use the phone number supplied by Virgin to login to their web site and the site then wanted to sent (probably SMS) the settings to my phone, but of course it couldn t SMS to that number as I ve got the Three number active. Presumably they were expecting that customers would setup Internet access before porting their old number.I phoned the Virgin tech support and used the settings they suggested, but it didn t work. Then I took the phone to a Virgin store and it started working after they rebooted it with no changes to settings. Just like Windows used to be. :(Email Access Default AppThe email setup defaults to port 143 IMAP access, so even when a mail server provides access on port 993 for IMAPS and on port 995 for POP3S probably most users will not use any encryption because their phone doesn t default to it. Also one annoying feature is that when I gave it the email address test@coker.com.au it decided to use test as the user-name for IMAP by default. It seems that a very large portion of the active email accounts nowadays are on systems that handle multiple domains and thus require the domain name in authentication, and a large portion of the remainder accept domain names even when they aren t required. Besides it s a lot easier to delete a domain name when it s not needed than to type it in when it is.The default hostname for sending and receiving mail is the domain name, if the MUA configuration program had checked the MX record it would have known that smtp.sws.net.au is a better default choice for the mail server. I ve now started the practice of creating a CNAME entry named m in every domain I run, so when someone is setting up a mobile phone they just have to add m. to the start of the default hostname to use for sending and receiving mail. By doing this I can probably save an average user at least 30 seconds of typing, which is particularly important if I happen to be talking them through the process!The MUA uses IMAP commands to load the text of the message without attachments and then loads attachments on demand, this will be handy for when people attach unreasonably large files. With IMAP caching and partial loads the core functionality seems OK, and some quick tests of standard but not commonly used IMAP functions such as noticing that mail has been deleted by another client seemed to work well. The performance of loading a new mailbox with 369 message was quite poor, I m not sure how much of this is due to the network connection and how much is due to the client implementation. This is a real concern for me as I typically have about 7,000 messages in my IMAP account and 3,000 unread messages most of which are in two folders.Another problem is the fact that there seems to be no way of searching in the list of messages, sorting/grouping by subject or sender, or showing unread messages. This makes the Xperia unsuitable for the task of reading mailing lists when on public transport. I would really like to be able to sort through a folder of mailing-list mail, delete messages that I don t need to keep and flag ones that need attention when I have the resources of a desktop system when I m on a tram or in other situations where a laptop can be inconvenient.One undeniable bug I discovered (as opposed to the missing features I listed) is that when a message has a line with a URL followed by many spaces it won t load correctly in the web browser, the spaces will be treated as part of the URL. I ve changed the default signature in my email to have a description followed by a URL to avoid triggering this bug. Presumably other Android phones are bug for bug compatible. :(Moxier MailThere is a complete set of email and calendaring applications preloaded from Moxier.com. The Moxier mail client uses company.com as an example domain name (they should use example.com does no-one read the RFCs?). It s nice that they verify the SSL certificate and display the details when it s not signed.Unfortunately Moxier doesn t support anything other than Exchange, and I can t delete it either as it s part of the base set of applications from Sony.SMSThe SMS application is supposedly conversation based. This doesn t seem like a benefit to me, it s a pity that there is no option to make it act more like every other SMS implementation I ve used over the last 12 years.BatteryThe battery is described as having a capacity of 1500mAh, for comparison a AA rechargeable batteries have capacities ranging from 1800mAh to 2800mAh. My first mobile phone had a rechargeable battery that took the same space as 4*AA batteries and the phone was designed to run on AA batteries if the main battery wasn t charged. I would like to have an Android phone that had a battery pack of similar size to at least 2*AA batteries, and 4*AA would be OK too.The Xperia battery was reported as being half discharged after playing with the phone for less than an hour. Basically when doing anything with the phone that is remotely intensive I need to have it plugged in. Unless of course I m using one of the star-chart applications LightsThere are two white leds in the gaps between the keys for Settings, Main-Menu, and Back on the front. They are quite bright and annoying to look into at night.SSHSSH was one of the reasons for getting an Android phone, but it was one of the last things I worked on because everything else was so much fun. I m currently using ConnectBot, it supports storing ssh host keys, generating a key-pair from random screen touches, locking and unlocking the key-pair (with a pass-phrase) and pasting the public key to an open window. All the basic functions just work although it s rather inconvenient to enter the CTRL keys.The next thing to investigate is a small and light Bluetooth keyboard. Using an external hardware keyboard will save me from the pain of entering CTRL keys (which is even worse than the pain of entering passwords that contain digits and mixed case). It will also allow me to type a lot faster and use the entire screen for the ssh session.Current Bug SummaryWifi doesn t do ad-hoc mode or tethering.MUA doesn t correctly handle URLs in messages if many spaces follow the URL and is also unsuitable for mailing list mail.Sometimes requires a reboot to make Internet access settings take affect.Camera light can t be easily turned on and off.This isn t too bad.ConclusionMost things do what I want. Once I get a MUA working with all my email, Wifi doing what I want, and a Bluetooth keyboard it ll be a fairly ideal mobile sysadmin terminal. I ll probably order one for myself this weekend.

16 February 2011

David Welton: Rails Application Templates

Thanks to some friends on twitter, I recently discovered RailsWizard which is a very handy way of generating new Rails applications with the "right" things included. I liked what it did a lot, so I took the generated file and saved it as a github gist: https://gist.github.com/829521
Which provides me with a very handy starting place for new Rails projects. This is a great way to get some of the housekeeping out of the way before we start: ensure we're using jQuery, add some gems that I always use like exception_notifier and will_paginate, and so on.

Next.

Previous.