2012 May

 

 Alles Komputer

May 24, 2012

I hate internationalisation. There is nothing as crap, as internationalisation. Once an OS starts getting internationalised it starts dragging with it a pile of shit, known as locales, languages, unicode, and god knows what other crap that all contributes to the bloat, slowdown and general utter uselessness that comes with a Linux distro.

Let me explain why I hate internationalisation.

1. Internationalisation breaks monitors

I use grub2, the default debian bootloader. I hate the fact that grub2 decides to switch to a fancy videomode, so that it can display unicode characters. I like my machine to boot up, in good old 80×25 text mode, thank you. No mode changes. Why no mode changes ?

Because mode changes causes my monitor to adjust sync, blank out, and do all kinds of crap I don’t want it to. It makes me me miss important boot information, and reduces the lifespan of my old CRT.

Mode switching also causes major crap with KVM tools such as HP’s ILO, or SuperMicro IPMI, especially when you’re remote consoling a box over a laggy connection (when is it ever NOT laggy?).

Once again, this stops you from using a computer usefully, which is kinda the frigging point, right ?

Fixing this on debian, is a royal PITA as well.

Observe, from grub.cfg on debian

function load_video {
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
}

if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=640x480
load_video
insmod gfxterm
fi

I don’t want that shit, thankyouverymuch, fuckoff.

So, to get around this crap on debian, we have to edit /etc/default/grub, and add

GRUB_VIDEO_BACKEND=dummy

because just

GRUB_VIDEO_BACKEND=

still causes update-grub to load all the vga drivers, and using

GRUB_VIDEO_BACKEND=vga

to force what I thought to be plain old vga, still let grub get it’s grubby paws onto a module that caused a mode switch. That took like an hour to sort out. Hopefully it saves someone some time.

All of this, in the name of presenting a UNICODE fucking font to some non-ASCII dude who probably doesn’t even understand what a bootloader is.

2. Internationalisation breaks keyboards, and monitors

The default debian console-setup gives us UTF-8, and Cyrrilic characters, and in order for it to support this, it has to adjust the console font, which fucks around with the VIDEO MODE yet again. This is an intricate arrangement between the keyboard setup, console setup, and god knows what.

The debian installer doesn’t ask all the questions that a ‘dpkg-reconfigure console-setup’ does, but suffice it to say that if you run it, you finally get given the option on NOT CHANGING THE VIDEO MODE DUE TO KEYBOARD SETTINGS.

Simply choose “Do not change the boot/kernel font” when asked about “Font for the console:”

Or to make the problem go away in an easier fashion, and save the planet by saving CPU cycles, disk space and that pain in your arse:

dpkg --purge console-common console-data console-setup console-terminus console-tools kbd keyboard-configuration

What you are now left with, is glorious, raw ASCII, C based console, the way God and Linus Torvalds intended. Your system bootup time will probably also have decreased by a few seconds.

Greenpeace will love you. I like Greenpeace, I contribute every month.

3. UNICODE Sucks

There’s a reason I’ve always used

LANG=C

in my /etc/environment file. It makes me avoid the bullshit that is UNICODE.

If you have ever seen crap funny characters like

· --where=âwhere_conditionâ, -w âwhere_conditionâ

when viewing a man page, for example on a Redhat box, then you have been the victim of unicode. Unicode is the most stupid idea for “fixing” a working system of character representation that is based on 8 bits, by attempting to hack on more bits, just so that some muppet can see his Chinese character.

What you see is not what you get, and all thanks to someone that doesn’t understand ASCII wanting to see what they get.

I cannot for the life of me think of a more fucked up hack than Unicode.

4. Internationalisation wastes power, and cpu cycles.

In debian squeeze, putting “LANG=C” in your /etc/environment file is somehow “deprecated”. (What, putting an environment variable in the obviously located file is deprecated?)

You are now supposed to stick “LANG=C” into your /etc/default/locale file, which is simply sourced at the same time as /etc/environment would have been sourced.

This is not a biggy, except that some fucking muppet decided it would be a great idea if cron whined about the fact that you are using a “deprecated” file.

Observe, from /etc/init.d/cron, on squeeze

for var in LANG LANGUAGE LC_ALL LC_CTYPE; do
value=`egrep "^${var}=" "$ENV_FILE" | tail -n1 | cut -d= -f2`
[ -n "$value" ] && eval export $var=$value

if [ -n "$value" ] && [ "$ENV_FILE" = /etc/environment ]; then
log_warning_msg "/etc/environment has been deprecated for locale information; use /etc/default/locale for $var=$value instead"
fi
done

A few comments on the above fucked-ness.

  1. You dumb shit package maintainer
  2. Thanks for wasting CPU cycles to warn me about a supposedly “deprecated” file, that is fo-sho, NEVER FUCKING GOING TO GO AWAY.
  3. Why the fuck does cron care about any of this shit ? Cron runs shit at intervals. That is all.

Oh wait, I can answer point 3.
(from /etc/init.d/cron)

# Read the system's locale and set cron's locale. This is only used for
# setting the charset of mails generated by cron.
To provide locale
# information to tasks running under cron, see /etc/pam.d/cron.
#
# We read /etc/environment, but warn about locale information in
# there because it should be in /etc/default/locale.

So, all of those CPU cycles were wasted, so that the correct character set can be used for the mails generated by cron. Holy fuck! WAT ?

5. Internationalisation make for insecure software

You need only to google “unicode exploit” to understand the size of the problem. Bytestreams that get interpreted differently based on a file stored on disc, that contains a language and an alternative character set that is managed by a complicated library is just asking for shit.

Language library programmers don’t focus on security, they focus on functionality

6. Internationalisation wastes time, money and resources

I’ve seen some Chinese engineers at work on their glyphical desktops, and if I just think about the amount of time that Microsoft, and other companies have spent, translating every little error message, into every language and character set across the globe — the mind boggles.

I think we’d probably be able to feed every hungry soul on the planet with that kind of effort and money.


To summarize:

  • Yes, I’m old skool.
  • Alles komputer must run LANG=C, English, and ASCII.
  • No, I don’t hate your culture/language/character set, just don’t break mine in the process of fulfilling your glyphical fantasy
  • If this is above your abilities then your rights to compute must be revoked
  • Internationalisation contributes to global warming
  • The sooner the planet speaks a single language, and uses a single character set the better
  • That is all.
Uncategorized | Leave a comment


 

 php-fuse, user-space file systems implemented in PHP

May 10, 2012

Creating a filesystem with FUSE, and PHP is quite easy, once you’ve read the code, read up about fuse and done about three hours of research. Ergo, it’s a fucking bitch.

If you’re lazy, or in a rush I’ve collated some of the steps, and filtered some of the crap. Hopefully this helps someone in the future.

I’m using it to do some nifty things for work, and plan to extend it for some more nifty things for my hobby, which at the moment is transcoding of video and rewriting lots of DLNA servers.

1.) Build the gree php-fuse module:

apt-get install libfuse2 libfuse-dev fuse-utils fuse-module php5-cli php5-dev
wget https://github.com/fujimoto/php-fuse/tarball/master -O php-fuse.tar.gz
tar xvfz php-fuse.tar.gz
cd fujimoto-php-fuse-*
phpize
./configure
make
make test
sudo make install

2.) Use the following php-cli script to test


#!/usr/bin/php -n
<?php
// vim: set sw=4 sts=4 et tw=100 smarttab :

dl("fuse.so");

class FuseTest extends Fuse {

        public function getdir ($path, &$retval) {
                echo("FuseTest:getdir: $path\n");
                switch ($path) {
                        case "/" : {
                                $retval["."] = array ('type' => FUSE_DT_DIR);
                                $retval[".."] = array ('type' => FUSE_DT_DIR);
                                $retval["subdir"] = array ('type' => FUSE_DT_DIR);
                                $retval["test.txt"] = array ('type' => FUSE_DT_REG);
                                break;
                        }
                        case "/subdir" : {
                                $retval["."] = Array ('type' => FUSE_DT_DIR);
                                $retval[".."] = array ('type' => FUSE_DT_DIR);
                                $retval["test2.txt"] = array ('type' => FUSE_DT_REG);
                                break;
                        }
                        default : return -FUSE_ENOENT;
                }
                return 0;
        }

        public function getattr ($path, &$st) {
                echo("getattr: $path");
                $st['dev'] = 0;
                $st['ino'] = 0;
                $st['mode'] = 0;
                $st['nlink'] = 0;
                $st['uid'] = 0;
                $st['gid'] = 0;
                $st['rdev'] = 0;
                $st['size'] = 0;
                $st['atime'] = time();
                $st['mtime'] = time();
                $st['ctime'] = 0;
                $st['blksize'] = 0;
                $st['blocks'] = 0;


                if ($path == "/" || $path=="/subdir") {
                        $st['mode'] = FUSE_S_IFDIR | 0775;
                        $st['nlink'] = 3;
                        $st['size'] = 0;
                } Else if (substr($path,-4,4) == ".txt") { //return same attrs for all 'txt' files
                        $st['mode'] = FUSE_S_IFREG | 0664;
                        $st['nlink'] = 1;
                        $st['size'] = 12;
                }
                return 0;
        }

        public function open ($path, $mode) {
                echo("open: $path");
                return 1;
        }

        public function read ($path, $fh, $offset, $buf_len, &$buf) {
                echo("read: $path");
                $buf = "hello world \n";
                return strlen ($buf);
        }

        public function release ($path, $fh) {
                echo("release: $path");
                return 0;
        }
}

$fuse = new FuseTest();
$fuse->mount("/mnt", "fsname=fusetest,debug,allow_other");

3). Now run with ./fusetest and use regular commands like “ls -l /mnt/” or “cat /mnt/test.txt” to see your data. The default for $fuse-mount() is to fork, and thread, hence the “debug” option being passed to the mount. If you don’t add the “debug” option you will never see what happens in your code, and all logging will just disappear. Of course, this may be what you want.

4.) Profit.

Uncategorized | Leave a comment


 

 Useful objdump args

May 8, 2012

I can never recall, or easily find the “best” set of args to use with objdump to disassemble a file usefully, so this serves as a reminder


objdump -M intel -Dslxwg /bin/foo

“-M intel” gives a sane disassembly instead of AT&T mnemonics, which should be the default really.
“-Dslxwg” gives, disassemble-all, full contents, with line numbers and all headers, wide format and includes debuginfo if available

Uncategorized | Leave a comment


 

 The end of Java, or Praise JESUS!

After today’s verdict around Google infringing on Oracle’s Java, there is a telling quote:

Oracle, the nine million Java developers, and the entire Java community thank the jury for their verdict in this phase of the case. The overwhelming evidence demonstrated that Google knew it needed a license and that its unauthorized fork of Java in Android shattered Java’s central write once run anywhere principle. Every major commercial enterprise — except Google — has a license for Java and maintains compatibility to run across all computing platforms.

And there we have it.

If you care about software freedom, and ESPECIALLY the freedom of retaining control of the environment (VM) in which your language operates, then it’s best to DITCH JAVA NOW.

It’s kinda funny that Oracle sued one of the biggest users of it’s language.

I predict that one shall see a bit of a turnaround at Google over the next few years when it comes to choice of language.

I also predict, that as previously predicted, the Apache Software Foundation shall be rethinking some things.

That is all.

Uncategorized | Leave a comment


 

 The Seminal Furs

May 3, 2012

Just looking at the list of covers of this single song, it’s pretty clear that Velvet Underground was a serious kickstart for alternative music. I consider it significant.

My favorite, however is the Rosetta Stone cover. Kicks in around 2:05

Of course, there’s also the decadent Courtesans cover.

Uncategorized | Leave a comment