Archive

Author Archive

Why Karmic Koala Sucks 3

December 19th, 2009 subogero Comments off

Movies. Or at least one of them to be precise. I have an avi file which is played like a breeze in Jaunty, but it crashes Mplayer in Karmic immediately.

Scanners. There is no more “scanner” group, so you have to manually sudo chmod 666 the scanner device before using. Otherwise the driver simply does not detect the device. And this is a Canon scanner, where a Linux driver is kindly supplied from the factory.

On the positive side, the bloke with the scanner problem is the same colleague who nearly gave up last time. He did not. He managed to install Karmic eventually. But he will replace it with Jaunty.

There is an ever increasing ubuntu user group at the office, and the general consensus is that Karmic is to be avoided. I apologise again for the rude title, but if you’re not a kernel wizard, avoid Karmic. It is probably very nice, but one thing it is not: Linux for human beings.

Categories: Uncategorized Tags: ,

Ubuntu 9.04 Jaunty on Asus UL20A

December 11th, 2009 subogero 7 comments

I’ve just purchased an ASUS UL20A-2X022V notebook. Or netbook. I don’t know. It’s actually the best of both worlds. On one hand, it has a small 12″ display, weighs in at 1.5 kg, has no CD/DVD drive, and runs 5 to 7 hours on battery. On the other hand, its small display’s resolution is 1366×768, it has a Core 2 Duo ULV SU7300 processor, 3 GB RAM, a 320 GB hard disk and a fully functional keyboard with all the special keys on the right side.

A short summary of how the different hardware components work with ubuntu:

Component                    Status  Notes
------------------------------------------
Intel Core2 Duo ULV SU7300   OK
12.1" WXGA LED display       OK      resolution autodetected
Intel GMA 4500MHD graphics   OK
3 GB RAM DDR2 800 MHz        OK
HD 320 GB 5400rpm SATA       OK      install with manual partitioning
battery Li-ion 5600 mAh      OK
power management             OK      battery life 5-6 hours
ethernet Atheros 8131        OK      see below
WLAN Atheros 9285 802.11bgn  OK      see below
Bluetooth                    OK
Sound AC'97 16bit            OK      Audacious mp3, speaker or headphone
Synaptics touchpad           OK      scrolling OK too, see below
webcam                       OK      see below
card reader                  OK
Linux kernel                 2.6.28-17

It came with Windows 7 Home Premium, which is a joke. A huge monster of an OS with the functionality of Google Chrome OS: it has a web browser.

First thing was to install ubuntu 9.04 Jaunty Jackalope. As the laptop has no CD drive I had to create a bootable Ubuntu 9.04 LiveUSB on my other ubuntu-box. The tool to use is usb-creator, which uses the iso image of the ubuntu LiveCD.

I installed ubuntu with manual partitioning. I shrank the Win7 partition from 80GB to 50GB (automounted to /windows), added a 2GB ext3 swap partition, a 50GB ext3 root partition and the rest as a /home partition. The boot menu was added, and even Win7 ran fine after a chkdisk.

The network cards were not detected upon installation. Neither LAN, nor WLAN. So there I was with no connectivity, reading with a sad irony all those posts about fixing this with apt-get xxx-backports and the likes.

I ended up downloading compat-wireless-2.6.30.tar.bz2 on another box to a USB stick, and then unpacking and compiling it on the laptop. I realised too late these kernel modules were for a newer kernel. Nevertheless I did “make install”, I did “make unload” and I did “insmod ath9k.ko”. It did not work due to incompatible kernel versions. I sadly rebooted to Windows, but later gave it another try. Miraculously, all network cards worked like a breeze! Don’t ask me why…

Touchpad: everything works, but it’s hard to feel where is the scrolling area. And the left button is too hard.

Keyboard (Hungarian): OK, but it will be swapped for a US layout, whose Hungarian is worse, but speaks better Code.

Webcam: I installed the UCview package to record videos with it. Skype works too.

I downloaded all the updates, then SynapticPackageManaged Rhytmbox/Evolution out, Audacious/Thunderbird in, I installed basic development stuff, and last but not least git-cloned and compiled the newest Midnight-Commander master with utf8-support.

One more thing: it is very very quiet. Summary? Bloody marvelleous!

Linux On Laptops

Categories: Uncategorized Tags: , ,

Why Karmic Koala Sucks 2

December 9th, 2009 subogero Comments off

A friend of mine in the office, who was a bit fed up with Windows’ slowness and vulnerability at home, tried to install Ubuntu Karmic Koala last night.

It took him some time to overcome a Raid-connected PATA hard-disk first. But finally Karmic was installed. It just did not boot. It took ages to show the boot menu (if at all) and, after selecting Linux, the best performance was continuous reboot.

The new superfast Grub2  bootloader is apparently to blame. The goal was to create a faster bootloader. The results?

  • If you update from Jaunty, Karmic admits a full bootloader update is too risky, so you get some kind of hybrid, which is half a minute slower
  • If you make a fresh Karmic installation, it just does not work

Apparently, many people in the office are having these problems. Is there anybody out there  who is happy with Karmic?

Sadly, the conclusion of my colleague is that “this is NOT the beginning of a beautiful friendship” with free software. They will stick with Windows. However hard I tried to convince him to have a go with Jaunty.

Categories: Uncategorized Tags: ,

Git Submodules

November 22nd, 2009 subogero Comments off

The scariest free open-source tool of all – Git – proved to be one of the best. Again.

It is scary. I grew up on MKS, with a nice GUI, a central repository and files locked for editing. With git all that is blown out of the window. Instead, you get cryptic commands (git bisect bad, anyone?), a separate repo for everybody, branches and merges.

After the initial shock, which may have lasted a few months I must admit, I begin to see MKS Source Integrity as a broken tool. Nice GUI? It crashes after a few hours, anyway. Central repo? Why can’t I work off-line? And why shall I wait ages until someone breaks his lock for me? And it takes only one “git commit -a” to realise that those Check-ins, Update-Members and Checkpoints may be a bit over the top.

My most recent discovery in Git was submodules. It’s for reusing code. I realised that I had implemented the -h/-V switches (for help and version display) in multiple projects separately. That’s a cardinal sin, while constructive laziness is the cardinal virtue.

So I created a project called arg1 with a single module with a single function, which takes your program’s argv[1] as an argument, checks whether it’s -h or -V and prints the usage or version text respectively if it is, and exits.

void arg1Eval(const char* arg1);

The texts shall be stored as simple text-files (usage.txt and version.txt) in the reusing superproject’s up-dir. The arg1 project contains a makefile as well, which turns these txt files into .h files with a string initializer-list. It’s made by a tricky sed command:

%.h: ../%.txt
 @sed -e 's/[ \t]*$$//g' -e 's/^/"/g' -e 's/$$/\\n",/g' <$< >$@

To reuse this little thing in your project simply type

git submodule add ~/Projects/arg1 arg1

Now comes the best part: Instead of reusing something from your filesystem (~/Projects/arg1) you can use any URL. You can reuse the whole internet. You can even develop that submodule from within your main project.

My new MKS vs Git page explains a lot of submodule related functionality.

Categories: Uncategorized Tags: , ,

Interpreter Scripts

November 9th, 2009 subogero Comments off

I wanted to turn the ogc calculator into a full-blown interpreter, to be able to create an executable ogc test-script:

#!/usr/bin/ogc
# Test script for ogc.
# Invoke: "ogc Test" or simply "./Test"
# It shall produce the following output:
# 42
# 42
# 42

# 42 hex
11*3*2 x

# 42 oct
 F*2+4 o # Leading space

# 42 dec
 52 d # Leading tab

 # Leading tab and comment

This is called an executable interpreter script, starting with the Shebang line, which tells the kernel which binary program shall run the script.

Unfortunately it did not produce any output, ogc just started waiting for user input in its particularly silly way. What was wrong? I had to find out more about how interpreter scripts and shebangs work in Unix. It turned out the kernel passes the filename of the interpreter scipt as an argument to the interpreter. Upon executing Test, the kernel actually does this:

/usr/bin/ogc Test

Should have thought. A simple stdin-stdout filter is not enough, the interpreter itself shall be able to redirect its input into a specified file.

I modified ogc, so 3.0 can be used in both ways:

ogc Test
./Test

And to make it even more elegant, ogc 3.1 skips printing an output for whitespace/comment-only lines, including the shebang. The test script now does only what it really should: stressing 3 times what Life, Universe and Everything is all about.

Categories: Uncategorized Tags: ,

Why Karmic Koala Sucks

November 3rd, 2009 subogero 7 comments

I’ve just upgraded to ubuntu 9.10 Karmic Koala. I should not have.

1. Login

The Login Screen is ugly. It displays the computer’s users. There is no way to change it. And nothing else, for that matter. And it is booting SLOWER than Jaunty by 9 seconds.

2. Gnome

Everything seems to be slower. My customized desktop theme fell apart.

3. Firefox

No Hungarian spell-check dictionary available for Firefox 3.5.
And the too-tiny-font problem is still here.

4. Thunderbird

It became slow and unstable. It’s on the verge of being unusable.

5. Gnome-terminal

My customized xterm size was overwritten to the ridiculous 80×24 during the upgrade. Config Wizardry again.

6. Gnometris (Tetris)

The biggest disaster: it is completely broken!

I know. I’m an evil and rude bastard. I should not criticize people who kindly develop software in their spare time. But you have been warned:

If you’ve got Jaunty, do not, by any means, upgrade to Karmic.

Actually, I wanted to rearrange my partitions anyway. Where did I put that Jaunty CD?

Categories: Uncategorized Tags: ,

Melding Git

October 29th, 2009 subogero Comments off

After switching to Linux, one feels the need to switch to an equally cool version control system as well. And none is cooler than the one invented by Linus Torvalds himself: Git.

It’s called the Fast Version Control System. Being an MKS user professionally, git was a bit on the scary side. No GUI, strange commands and a completely different workflow. Instead of the central repo, there is cloning, pulling and pushing. Instead of the rigid but readable version numbering, there are unreadable SHA1 hashes but, at the same time, user-defined tags as well. Instead of locking, there is branching and merging. Instead of dealing with separate files, there is the universal commit. Main advantage: FAST! And I feel the workflow more and more natural.

I could not get used to one thing, however. The “git diff” command displaying source differences. I’m a huge fan of command lines, but there are limits. So I googled for a visual difference tool. I found meld.

sudo apt-get install meld

Then I looked for a way to integrate git and meld, so when I type git diff, it would open meld, instead of displaying that unreadable mess on the terminal. I found Nathan Hoad’s website.

First step is to tell git it should use meld. While the Bash Guru types

git config --global diff.external meld

the Config Wizard adds a few lines to ~/.gitconfig:

[diff]
  external = /usr/bin/meld

It does not work, however. Git sends 5 parameters to the diff tool, while meld expects only the 2 filenames to compare. So a little filter is needed. Nathan Hoad proposes a Python script:

#!/usr/bin/python
import sys
import os
os.system('meld "%s" "%s"' % (sys.argv[2], sys.argv[5]))

I know that Python is the language of the day, but in this case I felt it was a bit like Shooting a Sparrow with a Cannon, if you allow me this Hungarism. If one is lazy, one needs a one-liner. And the language of choice is non other than the Bourne Again Shell. The filter is called ~/gitvdiff:

git config --global diff.external ~/gitvdiff

And it contents:

#!/bin/sh
meld $2 $5

Let’s see the results.

Before

Before

After

After

On the right side you may notice the entire source file displayed. With syntax highlighting. With a map of the diffs. And with the diffs nicely highlighted.

Categories: Uncategorized Tags: , ,

Nautilus Image Converter – My New Toy

October 26th, 2009 subogero Comments off

I’ve got that other blog. About Psychlismo. Which, while being the hard sport that it is, has its advantages as well. You may be out of oxigen, but at the same time, a spectacular view may just take your breath away.

Which means photographs. Which in turn get uploaded to the blog. WordPress has a nice interface to do that, a thumbnail image will be created automatically, which you can insert into the text right away. There are a few problems though. If the image is too big, the thumbnail is not generated. And it’s rather cumbersome to upload a high number of images one by one via this GUI.

The bulk upload is sorted out easily. During the brief history of computing, humanity has invented various protocols to transfer files. But these protocols do not create thumbnails. Bulk thumbnailing, and rotating for that matter, has to be done before and, in my case, Google has found the solution very quickly:

sudo apt-get install nautilus-image-converter

Become Mr Rightclickalot, open Nautilus (Gnome’s file manager), navigate to the directory of the new images, select and right-click a bunch of them, select “Resize Images…” and a dialog-box appears with the options. You can chose the new size. You can resize them in place or make a copy with “.resized” appended to the filename. Or you can change that to “.thumbnail” to please WordPress.

Now try it with another bunch of images. Yes, all your previous settings are forgotten, and the suffix is “.resized” again. And Gnome, being the Epitomy of Usability, offers exactly zero options to change the default settings.

But don’t give up just yet! If Mr Rightclickalot has failed, the Config Wizard will sort it out. Every program has some sort of config file:

/usr/share/nautilus-image-converter/nautilus-image-resize.glade

Search for “.resized”, replace by “.thumbnail” and enjoy. It’s easy to find all the other default settings as well. Bonus: nautilus-image-converter can rotate pictures as well. I’ve not uploaded any image via the WordPress GUI ever since.

Bash Job Control

September 24th, 2009 subogero Comments off

Having already explored the  possibilities of starting parallel processes using the Gnome window-manager, as described on my go page, it was high time to immerse myself, being the keyboard-addicted geek that I am, into doing the same by using just a simple terminal.

But what’s the point? In my case, it was a commit process with a revision-control system called foo. The commit is done with a script, and I wanted to make sure the project compiles OK before the actual commit.

This involves two quite long processes, which could nicely run parallel, one is composing the commit-message with an editor, and the other is the compilation. We shall go on with the commit after BOTH are finished. Oh, I nearly forgot, the commit shall be canceled, if the compilation fails!

I studied bash job-control a bit and then:

# The '&' character runs the command in the background
# which in turn becomes job number 1, later referred to as %1.
make &

# Compose the commit-message in the foreground
foo-status > CommitMessage
mcedit CommitMessage

# Wait for the make (job 1, alias %1) to complete,
# check its exit status and abort if it's failed.
# The 'wait' command's exit status is the same as the job's we wait for
wait %1
if [ $? -ne 0 ]; then exit 1; fi

# Do the commit
foo-commit --message=CommitMessage
rm CommitMessage

Try this with batch-files on Windows. Actually, you can do it with Cygwin. I’m sure Richard Stallman calls this platform GNU/Windows.

Bash is cool. Bourne Again Shell for Born Again Christians, that’s what I always say. Or as Master Foo put it once:

“There is more Unix-nature in one line of shell script than there is in ten thousand lines of C.”

Categories: Uncategorized Tags: ,

Compile on Linux for Win32

September 12th, 2009 subogero Comments off

This is perverse. I’ve just compiled a native Win32 application on Linux. What’s even more perverse it runs on Linux too with Wine.

To cut a long story short I needed a command line tool to send emails using the MAPI protocol, the only language spoken by Outlook and MS Exchange. Don’t ask me why. It’s by the way my first ever Win32 application using the Win32 API. Or `mapi.h’, to be precise.

I started developing it on a Win32-cygwin platform with gcc, but I wanted to control the sources with git. Which prefers Linux. So I ended up rebooting the box a few times to change between the two. But I’m extremely lazy, so I soon googled for a way to cross-compile Win32 programs on a Linux host. It did not take long. I summarize my findings in a few lines:

What to install:

sudo apt-get install mingw32

How to compile:

i586-mingw32msvc-gcc -L/usr/i586-mingw32msvc/lib \
  -I/usr/i586-mingw32msvc/include -o foo.exe foo.c

The result? See the mapis page.

Categories: Uncategorized Tags: , , ,