Archive for the 'Computer' Category

Wed
7
Mar '12
Unblock-us for Mac OS
by Frank Spychalski filed under Computer

I’ve been using unblock-us for some time (update: at the time I wrote this article I was creating a trial account every week, but after a few months of flawless service I decided it’s time to become a paying customer, which I am since April) and took only a few precautions like not signing in to any service but hulu.com while using this other DNS service.

Yesterday Damon wrote a great article on how to secure your system for unblock-us and I followed his lead.

My only machine runs Mac OS, so I had to do a bit of research… Read the rest of this entry »


Last week I was asked whether I knew how to set up a dyndns server. Well, I didn’t at that time, but I did some research. This is what I found. Read the rest of this entry »


Tue
26
Jul '11
Cups and duplex banner pages
by schlumpf filed under Computer

After a system update on my computer (Gentoo linux), CUPS (version 1.4.6-r2) suddenly decided it was a good idea to print the banner pages before each printing job double-sided, i.e. with the banner text on both sides of the page. This is annoying because it ruins the usefulness of the blank side of the banner page as scribbling paper.

So how to get rid of this?

There is no simple solution like checking a box somewhere in the CUPS settings. But there is an easy solution nonetheless: you can define your own banner page as described in the CUPS FAQ.

Mine is now a plain text file and looks like this:


           Job Name: {?job-name}

          From User: {?job-originating-user-name}

       Printer Name: {?printer-name}

      Creation Time: {?time-at-creation}

You can also use a postscript file, though I haven’t tried how the {?parameter} thingies work there.

This file needs to go into /usr/share/cups/banner/, then you need to restart the cups-demon, and then you can select the new banner page in the CUPS settings at http://localhost:631, go to Printers->Administration->Default Settings->Banner.

This is then printed single-sided as it should be.


Thu
15
Oct '09
pgrep or pkill sometimes do not find process
by Frank Spychalski filed under Computer, Work

The usual problem: you want to kill a process.

$ ps aux | grep randomprocessname
psycho 20429 0.0 0.0 11824 1580 pts/7 S+ 12:00 0:00 /bin/bash ./randomprocessname
psycho 20528 0.0 0.0 4188 740 pts/17 R+ 12:00 0:00 grep randomprocessname
$ pkill -9 randomprocessname
WTF? Kill that sucker!
$ pkill -9 randomprocessname
No typo... Am I crazy?
$ pgrep randomprocessname
What's wrong?
$ pgrep randomprocessna
20429
$ pkill -9 randomprocessna

For some arcane reason pgrep/pkill matches only the first 15 characters.


Last week I added the 1gb data plan to my Simyo contract to use the SIM with my Christmas G1. I tried a few configurations I found online for simyo but they did not work for me. After some frustration I tried an eplus configuration and this one finally worked for me:


Name: does not matter
APN: internet.eplus.de
Proxy: <empty>
Port: <empty>
Username: eplus
Password: <empty>
Server: <empty>
MMSC: <empty>
MMS proxy: <empty>
MMC: 262
MNC: 03
APN type: <empty>

Update:

The recommended configuration is:


Name: does not matter
APN: internet.eplus.de
Proxy: <empty>
Port: <empty>
Username: simyo
Password: simyo
Server: <empty>
MMSC: <empty>
MMS proxy: <empty>
MMC: 262
MNC: 03
APN type: <empty>

After the initial success with the eplus configuration, I had some problems with it, too. But I guess these errors were internal eplus network hiccups because they were gone without me changing anything and now both configs work.


Thu
26
Feb '09
Tab + Firefox on OS X
by Frank Spychalski filed under Computer

A few days ago I finally upgraded my (== my employer’s) Macbook Pro from Tiger to Leopard. Everything worked flawless except for one crazy problem: I could not use to tab key the way I used to in forms. My usual routine of quickly entering username, tab, password, tab, hit return did not work anymore. I searched through the Firefox settings but couldn’t find the “Drive psycho crazy”-option.

But thanks to the omniscient internet I found a solution. At the bottom of the “Keyboard & Mouse” preferences page is a setting which allows you to navigate only between text boxes or between all controls. I don’t know who came up with the great idea that the default should be “text boxes and lists only”, but I guess the mighty Steve knows what he is doing.


Sat
21
Feb '09
Pair Programming killed the Uber-coder…
by Frank Spychalski filed under Computer

I stumbled over a great essay on pair-programming (via James Shore).

Rod Hilton explains it much better than I could ever do, why you should Pair-Program. But I haven’t heard about the “ping-pong pairing”:

When doing Test-Driven Development, one of the things we do is called “ping-pong pairing”. So the other developer will write a test, then make it compile but fail. Then he passes the keyboard to me. I implement the feature just enough to make the test pass, then I write another failing test and pass it back.

I have to try this on Monday…


Sat
31
Jan '09
Drop all tables from a mysql database
by schlumpf filed under all, Computer, Work

Sometimes you want to reset a database to its virgin state, without actually deleting and re-creating the whole database (perhaps because your user doesn’t have the right to create a database). There are a lot of links out there that give you a quick answer on how to drop all tables from a database in a single-line shell script. Some examples:

However this does not work if there are foreign key constraints between the tables (because the tables constraining others need to be deleted first). Here’s the advanced version that solves this problem:

#!/bin/bash
USERNAME=myUser
PASSWORD=myPassword
HOSTNAME=dbHost
DATABASE=mydb
while (true) ; do
    TABLES=`mysql -h $HOSTNAME -u $USERNAME -D $DATABASE --password=$PASSWORD 
                  --batch -e "show tables" | grep -v Tables_in`
    if [ -z $TABLES ] ; then break; fi
    for i in $TABLES ; do
        mysql -h $HOSTNAME -u $USERNAME -D $DATABASE --password=$PASSWORD  -e "drop table $i"
    done
done 

I agree this is not nice because it’s a brute force approach – but hey, it works! And resetting a database is most probably not a performance-critical task anyway.


Today I wanted to implement something that would prevent me from accidentally closing the browser window while I was doing stuff in my webapp. I’m no javascript expert, so I checked some newsgroups and found more and more complex solutions the longer the threads were. Read the rest of this entry »


Mon
2
Jun '08
Chumby goes i18n – soon available outside US?
by Frank Spychalski filed under Computer, Fun


I just stumbled over a this ad for someone to do the internationalization for (probably) chumby.com. I hope this means that they will start selling the chumby outside the US soon :-)

Title: Ruby On Rails I18N Developer
Skills: I18N, Ruby on Rails, mySQL

Job description:

Chumby Industries is looking for a Ruby On Rails/I18N Contractor to deliver results for the internationalization (I18N) effort on the server.
This candidate would be responsible for externalizing all the text strings (both static and dynamically generated) that the website uses so that Chumby could later change the language of the site based on location.

Skills required:
Previous I18N efforts on browser-based platforms
Strong web-based development experience
Ruby on Rails experience
mySQL database experience
Familiarity of layout issues involved with I18N