Tomorrow is Black Friday. (a.k.a. Friday the 13th)
It really surprises me just how many people reply to a noreply@ e-mail address. (Hint: enough to make watching that address worthwhile.)
Feeling sorry for this 1TB drive after running BackupPC on it for the past few months. (And no, I’m not running ext4 on it. No way.)
@candrews Not yet. Not filing it in Ubuntu’s bug tracker…it’d never get fixed, and seb123 would criticise me for not filing it properly.
The six Australian states of mind (1993 gem by Jeremy Andrew): http://ur1.ca/fkdw
Groan…WordPress uses the ‘guid’ field in wp_posts to specify the location of image attachments. How sucky.
NetworkManager completely fails to establish a PPPoE connection to @Internode if native IPv6 is enabled. Not even IPv4 works. Use pppoeconf.
Does anybody here know GTK+ fairly well? I would really appreciate being able to have a heart-to-heart with regards to Python-iView issues.
@cydeweys It more realistically reflects the duties of a modern-day soldier. http://ur1.ca/fjoz
@ragnarokangel Agreed. Until Ubuntu 9.10, my BT headset was almost unusable too (though it worked beautifully with my phone).
@ragnarokangel Ouch. Buy an A2DP headset — it’s that much better. (Or buy a non-Bluetooth headset. Even better and less flaky.)
Oops, looks like my DreamHost–based sites were affected by their MySQL downtime. Ah well, guess I’ll just have to ride it out.
@ragnarokangel Try `pactl load-module module-bluetooth-device address=<address> profile=a2dp`
Somebody send me something on Google Wave.
There are only two hard things in Computer Science: cache invalidation and naming things. !q
New W3C home page has hover effects on items that aren’t clickable. Bad bad bad! On the other hand, it looks a bit fresher.
I’ve found GNOME Do’s Docky to be incredibly attractive, practical, and generally awesome over the last couple of weeks. Highly recommended.
WordPress should totally ship a .htaccess file by default. Drupal does, and it’s way convenient. !wp
Given that the @Internode native v6 prefixes are static, if I do the DHCPv6 mojo on my PC, I should be able to plug it into my WRT.
Our WRT54G doesn’t have enough space for the DHCPv6 client, so I can’t request my @Internode /60 prefix. :(
Off to Myall Lakes
6 November 2009I’m headed to Myall Lakes on a canoeing trip with our youth group. Should be wild, hopefully not wet, but hopefully fun.
Here’s hoping the Internets don’t break while I’m AFK.
Gonna upload some photos when I get back. Until then, adiós, weird world.
Dump environment of a C program
29 October 2009Here is a quick ‘n dirty way to dump the environment of a C program without the aid of any external programs (i.e. if you can’t exec() into /usr/bin/env):
#include <unistd.h> #include <stdio.h> int main (int argc, char *argv[]) { extern char **environ; int e = 0; while (environ[e] != NULL) { printf("%s\r\n", environ[e]); e++; } }
Outputs:
USERNAME=jeremy DESKTOP_SESSION=gnome PATH=/home/jeremy/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games PWD=/home/jeremy [...]
No DRI on X.Org with a Radeon? Check your Virtual size.
28 October 2009After I installed Fedora Rawhide on the eMac this week, I fired up X.Org, only to discover that…
(II) AIGLX: Screen 0 is not DRI2 capable (II) AIGLX: Screen 0 is not DRI capable
So it had fallen back to a software 3D renderer, which is pretty crap. So to make a long story short, it was because my ‘Virtual’ screen size was too big. I typed xrandr, and got the following:
$ xrandr Screen 0: minimum 320 x 200, current 1280 x 960, maximum 2048 x 2048
Because of various technical reasons, when the Virtual size is too big (which, evidently, 2048×2048 is), DRI gets disabled. So, to re-enable it, I put this into my xorg.conf:
Section "Screen"
Identifier "Main Screen"
Device "Radeon 7500"
Monitor "eMac CRT"
SubSection "Display"
Virtual 1280 960 # put the highest resolution you intend to use here
EndSubSection
EndSection
Obviously, edit the values to suit.
Python-iView update
23 October 2009Those of you running Python-iView should do an update to get the latest version, which contains a number of bug and compatibility fixes.
To update an existing Python-iView system, change to the directory where you installed it, and run:
$ bzr pull
Then, to support the new SWF verification ‘feature’, you will need to download and install rtmpdump, and install the resulting rtmpdump_x86 executable into somehere like /usr/local/bin.
(For those of you content with having their videos cut out every 8MB, feel free to continue using FLVStreamer — Python-iView will try both FLVStreamer and rtmpdump.)
If you don’t already have Python-iView, see the original post for instructions on how to get it.
WordPress 2.8.5, and a minor bug
22 October 2009I should mention that WordPress 2.8.5 has been released. No security holes as such, but fixes some other issues that were discovered in the past few weeks.
While I’m at it, here’s a weird bug I only just noticed in the post editing screen: in the Publish postbox (the one that contains the Publish button), when I click one of the Edit links, the edit link disappears, and when I press Cancel, it reappears. That’s fine, but when I open the top Edit link and another Edit link, and I press Cancel on the one that’s not the top, the top Edit link reappears even though the top Cancel link hadn’t been clicked.
What a mouthful. Let me show you a video. (To be honest, this whole post was just an excuse for me to use the <video> tag for the first time. I even had to write a WordPress plugin to let me upload .ogv files. Now my website officially doesn’t validate any more — whee!)
SWF verification sucks
19 October 2009Users of my Python-iView application may have noticed that when attempting to watch videos, they cut out after 8MB.
This is because the ABC have turned on “SWF verification”, which translates to “our incompetent head of IT who is a fan of Hello Kitty and also eats puppies decided we would enable this, similar to how passports and airport security actually keep out terrorists and criminals, and also explains why there is no crime in the world any more”.
Which also translates to “security by obscurity”, “papers please”, “fascism”, “коммунизм”, and “Miguel de Icaza”.
Because anybody watching videos from iView in anything other than the Flash-based web interface, e.g. on an underpowered Eee PC, an Xbox, or somebody offline, clearly shouldn’t be doing so. Doesn’t take a rocket scientist to figure that one out — even a manager could work that out.
(And if you’re the type of manager that actually likes to fix problems and get things done — I know, bowls me over too — then disable SWF verification. It’s, like, a checkbox fix.)
Solo sailor Jessica Watson has sailed out of Sydney Harbour to begin her round-the-world attempt.
How terminals work
18 October 2009Via @toros on Identi.ca, I stumbled across this awesome explanation by Scott James Remnant on how terminals (real terminals, virtual terminals, and pseudo terminals) in Unix work.
Because it is pasted from an IRC conversation, it is a little hard to follow, so I present it to you reformatted to be more readable. (I have tried to remain as faithful as possible to the original.)
How Terminals Work
In Linux, we have consoles, but really we mean Virtual Terminals (VTs), TTYs, and Pseudo-Terminals (PTYs). It’s all a bit of the kind of jumble sale you get after 40 years of different solutions to different problems. We can lump them together under the description “terminals” for the next bit.
We also have processes. Now, processes have a lot of odd little details: they have a parent, and they have a session. A session has a foreground process group and a background process group. (Stevens devotes an entire chapter for this and nobody but me apparently understands it. And hopefully the guy who maintains the kernel side. ;))
So, each process is part of a session — a process may begin a new session by calling setsid(). Every process that init creates is in its own session. The process is also then the leader of the foreground process group of that session. New processes are also in that session, and in that process group, unless otherwise placed into a new process group (setpgrp()). Any new process group is a background process group.
So now, you have a bunch of sessions. Each session has a bunch of process groups, one of which is the foreground process group. Each process group has a bunch of processes, one of which is the leader.
So this all has to do, fundamentally, with terminals, and who gets the signals.
When the leader of the foreground process group of a session opens a terminal device (without O_NOCTTY) that becomes the controlling terminal of that process group and session. The terminal and the session become bound to each other.
You can fake this another way by opening a terminal device without O_NOCTTY (or having one passed to you) and then calling the TIOCSCTTY ioctl().
Okay, so: terminals, controlling terminals and processes — here’s where this gets fun.
If the controlling terminal is hung up, SIGHUP is sent to the foreground process group. If ^C is pressed on the controlling terminal, SIGINT is sent to the foreground process group. If ^Z is pressed on the controlling terminal, SIGTSTP is sent to the foreground process group. And so on and so forth.
So this is how the relationship between magic key presses and signals gets established. Shells care about this a lot (and yes, when you use command & that becomes a background process group, and when you use command | command they are all in the same process group).
Now, this controlling terminal business applies to all terminals, whether they be true terminals (which Linux doesn’t have), virtual terminals, or pseudo terminals. So this is as true for your SSH login as your VT1.
You can always access your controlling terminal using /dev/tty — (it’s a badly named device node); it may also be called /dev/ttyS0 or /dev/pts/4, etc.
So, Linux has a bunch of virtual terminals. These are the things we think of when we say “console” but we’re using that wrongly. Virtual terminals behave just like ordinary terminals: they can be the controlling terminal for a process group, but unfortunately, stacked on top is the linux VT API — they didn’t think to make it separate.
So the stuff to set fonts — to place it in raw or graphics mode, create new VTs, switch VTs, etc. — is all loaded into the TTY API, so in order for X to function, it needs a VT. X needs access to that VT in interesting and familiar ways to place it into raw and graphics mode, and so on.
X also needs to know if the current VT is switched, so it opens the VT device it wants (/dev/tty7), and that becomes its controlling terminal. So if you were to delete VT7, X would get SIGHUP. :)
Now, on VT1-6 you have getty, and on VT8 you have usplash, and so on. This is all fine and dandy, except there’s this last mystical piece: /dev/console. /dev/console is, like /dev/tty, a fake device: it points at the currently active VT, whatever that is. But it behaves like a terminal in its own right (whereas /dev/tty just behaves as a proxy for the underlying terminal).
Now, Upstart has a few knobs to customise the standard input, output and error file descriptors. Normally it just starts all jobs with them as /dev/null, but for emulation of sysvinit, it has two other options:
- Set them to
/dev/console - Set them to
/dev/consoleand issue theTIOCSCTTYioctl()(console output, console owner)
Now, if your current VT is 7 (X), and you start a job that has console owner in it, the new process will take the terminal away from X! X gets SIGHUP, and either hits 100% CPU or crashes. Solving this problem for good requires jobs that need user input to be rewritten.
So this is clearly bad. The problem really is that things need a “console” at all — jobs that require interaction should do it themselves: they should open a VT, switch to it, and ask there. Or they should use usplash to do it — or they should use X.
It’s time we take back Times New Roman on the web. Used in new and inspiring ways, Times can be beautiful and fresh, and a brand new old tool in our pathetically limited web type case.
data.australia.gov.au is the home of Australian government public information datasets.
Anti-virus software is a racket indeed.
How to fix menu icons in GNOME 2.28
23 September 2009For some reason, the folks at GNOME (the “usability” team) decided to turn off icons in menus. Not only does it make them look ugly as hell, but it is nigh on impossible to navigate menus visually.
I am a very visually-oriented person, so this makes GNOME very difficult to use. I find myself constantly selecting the wrong items, even though removing the icons doesn’t actually change their position.
But as if that wasn’t bad enough, the “usability” team has taken the KDE approach to the problem. Rather than setting an obvious and sane default (i.e. enable icons in menus), there is a checkbox to enable the icons again. Brilliant! (not)
So you can go to System → Preferences (the first item in the menu, in case you prefer to navigate visually with icons like me) → Appearance (the second item in the menu), and under the Interface tab, you can check the box “Show icons in menus” to get the menu icons back, which gives temporary relief.
![]()
Like many GNOME features, this one is only partly implemented. GNOME’s new ‘feature’ also removes stock icons from buttons, and the above option does not put them back (well, seeing as though it is captioned “Show icons in menus” I don’t see why it would, but if you’re going to take the KDE approach, you may as well go the whole hog and add another option still).
At first, I thought this was a bug in Ubuntu Karmic (I am running the alpha on my desktop right now). While there’s nothing like being able to have the suspense of not knowing whether your computer will boot up in the morning, I thought this was preposterous. After I found out it was an intentional change (167 KB PDF), it now seems that it’s plain baloney.
New release: Haiku R1 Alpha 1
21 September 2009The Haiku Project, whom I wrote about earlier this year, have released version R1 Alpha 1 of their operating system.
It’s a very exciting milestone, both for me as a fan, and for them as developers. Despite being usable for a couple of years now, and having the ability to run many legacy BeOS applications, it has had no major milestones or releases made. Now that they have made a release, I hope the momentum they create will help them to follow the old adage, Release Early, Release Often.
If you haven’t heard of or tried Haiku yet, I would highly recommend it. The OS isn’t packed with bling; nor does it run the latest games with the highest FPS. What it is, though, is an awesome OS with a simple easy-to-use GUI, with a POSIX-compatible shell, built on top of a hybrid kernel (very microkernel-like), which means it always remains responsive, even under heavy load. Haiku can give you responsiveness and real-time-ness that you will never see under Linux, nor OS X or Windows.
R1 Alpha 1 release images have been built with GCC 2.95.3, not the more modern GCC 4. This has been done to ensure binary compatibility with legacy BeOS applications. It comes as a CD image, a raw image (for writing straight to a hard disk or USB flash drive), and a VMware/VirtualBox VM for those that only like to get their toes wet (see the downloads page).
Linked lists
6 September 2009A word of warning: don’t read this post. You’ll regret it. It’s basically a convoluted regurgitation of my brain with regards to using linked lists in C. Here be dragons.
In C, creating variables, and storing values in them is quite easy. You just declare them as such:
int i;
And then perform whatever operations you want with them:
i = 2;
i = i * 2;
printf("%d", i); /* 4 */
There is also a cool thing called struct, which lets you create a big variable that contains lots of sub-variables. It works a bit like this:
typedef struct tagGameObject {
int x;
int y;
} GameObject;
Then, you can create ‘instances’ of it like this: (note the scare quotes, because C isn’t really object-oriented)
GameObject rocket;
GameObject monster;
rocket.x = 20;
rocket.y = 25;
monster.x = 300;
monster.y = 250;
printf("rocket is at (%d,%d)", rocket.x, rocket.y); // rocket is at (20,25)
printf("monster is at (%d,%d)", monster.x, monster.y); // monster is at (300,250)
Now, let’s just say I wanted to have 3 monsters. I could create three of them like this:
GameObject monster_1; GameObject monster_2; GameObject monster_3; monster_1.x = 100; /* ...etc. */
However, that’s a bit tedious. What if I wanted 20 monsters? Surely I don’t declare each one individually. Nope — you can use arrays for that, which are pretty easy.
GameObject monsters[20]; monsters[0].x = 100; monsters[1].x = 110; monsters[2].x = 120; /* ...etc. */
But that has a problem. I’m stuck with 20 monsters all at the same time. Even if you are not using all monsters in the array, the memory is always allocated for each one. Sometimes that is what you want. Sometimes it is not. What if you wanted to be able to create and delete monsters at wish, and it didn’t matter how many you had at any one time?
