Great Stuff, being able to type utf-8 characters in a Terminal on OS X!

I know what you are thinking: »Those poor OS X users with their mutilated unix user land. I wrote about the ancient version of locate that OS X ships with, now this also applies to the standard shell, bash. OS X ships with version GNU bash, version 2.05b.0(1)-release, which just like locate has poor or non UTF-8 support. If you start typing characters like ä, ü or ö you get everything but that. You can’t search for them and so on. Seriously, this is so weak but again, you can help yourself with MacPorts. I found this article on the web, describing the steps nessecary for enabling UTF-8 in Terminal.app, iTerm and X11 Term. For the sake of redundant information storage I’ll give you the management summary for Terminal.app.

  1. Use MacPorts to install the latest version of bash: sudo port -c install bash (-c is for autoclean mode)
  2. Edit /etc/shells and add the path to the new version of bash which is /opt/local/bin/bash
  3. Edit ~/.profile and add the following lines:
    export LC_ALL=de_DE.UTF-8
    export LANG=de_DE.UTF-8

    This adds support for german utf-8 characters. Use locale -a to find your favorite language code.
  4. Run chsh and change the path of the shell to /opt/local/bin/bash
  5. Open the window settings, select Display and make sure the drop-down at the bottom is set to UTF-8 and make sure Wide Glyphs are enabled too. Then click the »Use Settings as default« button.
  6. Restart Terminal.app – Tada.wav
  7. If it doesn’t work open the Terminal.app preferences and see if you manually set the shell path, if so change it to to /opt/local/bin or switch back to the default login shell

Now if you want to have UTF-8 support in locate and all the other tools as well, you have to read my previous post about findutils and coreutils.

Afterwards you are able to do things like this and feel less handicapped.

:~ $ touch äüö
:~ $ ls äüö
äüö
:~ $ rm äüö
:~ $

Getting proper unix user land tools on os x

Personally, I think the Mac OS X unix userland is rotten. There are apple tools mixed with some current unix tools and there are outdated unix tools like locate. Maybe you didn’t even notice that but locate for example doesn’t even know the -i option for case insensitive lookups in the locate.datbase. As usual, you can help yourself with MacPorts. Simply install the GNU coreutils and findutils. For convenience provide the +with_default_names option. If you don’t add this option you get glocate instead of locate and so on. Now the new locate can’t find anything unless you run updatedb from /opt/local/bin/updatedb. After that everything should be fine. Checkout what tools are included in coreutils and findutils by clicking on the equivalent hyperlinks. This resolves the weird behavior of tools on OS X that you might expect to work like on your FreeBSD or Linux machines.

Install coreutils (the -c option is equivalent to sudo port clean portname):

sudo port -c install coreutils +with_default_names
sudo port -c install findutils +with_default_names

Locate before the installation:

man locate
LOCATE(1) BSD General Commands Manual LOCATE(1)

NAME
locate -- find files

SYNOPSIS
locate pattern

DESCRIPTION…

and afterwards:

LOCATE(1) LOCATE(1)

NAME
locate - list files in databases that match a pattern

SYNOPSIS
locate [-d path | --database=path] [-e | -E | --[non-]existing] [-i |
--ignore-case] [-0 | --null] [-c | --count] [-w | --wholename] |-b |
--basename] [-l N | --limit=N] [-S | --statistics] [-r | --regex ]
[--max-database-age D] [-P | -H | --nofollow] [-L | --follow] [--ver-
sion] [-A | --all] [-p | --print] [--help] pattern...

DESCRIPTION…

I think you get the idea.

Cheating the hacker way

A couple of days ago I found this cute little game for OS X called »Chopper«. I played it several times but I couldn’t make it to the last level although I played it on »easy«. Since it is open source I thought I could compile it with more lives but unfortunetly it didn’t compile because the file libfmodUniversal.a was missing for some reason. Good to have hackers around though – with the help of one of them I used »gdb« to get the job done. This is what I did (with Chopper Version 1.04):

First download Chopper and its Source from majicjungle.com. Then I navigated to the source folder for chopper and started gdb in that directory with the executable path

$> cd /Volumes/Data/Downloads/Chopper_104_src/Source
/Volumes/Data/Downloads/Chopper_104_src/Source $> gdb /Volumes/Data/Downloads/Chopper\ 1.0.4/Chopper.app/Contents/MacOS/Chopper

Then I set a breakpoint in playerStats.m on line 33. This is where the initial lives are set.

(gdb) break playerStats.m:33
Breakpoint 1 at 0x23ede: file /Users/davidframpton/Documents/Code/Old Projects/Chopper_104/Source/playerStats.m, line 33.

Then run the app:

(gdb) run
Starting program: /Volumes/Data/Downloads/Chopper 1.0.4/Chopper.app/Contents/MacOS/Chopper
Reading symbols for shared libraries ............................................................................ done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries .. done
Reading symbols for shared libraries . done
Reading symbols for shared libraries .. done
Reading symbols for shared libraries . done
Reading symbols for shared libraries .. done
Reading symbols for shared libraries ... done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries .. done
Reading symbols for shared libraries .. done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done

Now click »new game« with whatever difficulty you prefer. Now press escape to switch to windowed mode so you can see the terminal output. As you can see gdb stopped at the breakpoint we set before:

Breakpoint 1, -[playerStats init] (self=0x17198290, _cmd=0x90a64924) at /Users/davidframpton/Documents/Code/Old Projects/Chopper_104/Source/playerStats.m:33
warning: Source file is more recent than executable.
33 lives = startLives;
(gdb)

Now press »n« to step into

(gdb) n
34 nextExtraLife = 2000;

If you now enter the following you see the original number of lives to start with:

(gdb) print lives
$1 = 4

Now set your preferred number of initial lives

(gdb) print lives=1000
$2 = 1000

Now enter »c« to continue

(gdb) c
Continuing.

Now switch back to Chopper and have endless fun! Cool huh?

Chopper with 1000 lives

Continue reading

Berlin – Brennende Autos und so

Wusstet ihr eigentlich, dass zur Zeit fast jede Nacht in Berlin Autos brennen? Kann man sich hier von überzeugen: http://www.berlin.de/polizei/presse-fahndung/presse.html
Es gibt auch einen RSS Feed

Im Kreuzberg formiert sich außerdem gerade Widerstand gegen eine geplante McDonalds Filiale. In der Zwischenzeit veranstaltet die Polizei Bundesweit Razzien bei potenziellen G8 Gipfels Störern und der Spiegel stellt überdies hinaus fest das die Republik nach links (link) rückt.

Zur Krönung verspricht unsere Kanzlerin, Frau Merkel, noch folgendes:

»Im Zusammenhang mit dem G8-Gipfel in Heiligendamm wird es sehr, sehr große Demonstrationen geben von Tausenden und Abertausenden friedlichen Demonstranten. Es gibt überhaupt nicht die geringste Besorgnis, dass diese Demonstrationen nicht auch abgehalten werden können und auch sehr stark unterstützt werden zum Teil von Popsängern und anderen mehr.«

(link)

Man könnte meinen es dauert nicht mehr lang bis nicht nur Autos brennen …

Hihi

Apple Wahlcomputer

Schon etwas älter aber dennoch lustig. Hier gibts noch mehr.