Tuesday, October 16, 2007

On 40 tips for optimizing PHP code

I saw something like Reinhold Weber's 40 tips for optimizing PHP code maybe a year ago. Recently, this particular set of 40 tips popped up on reddit. I decided to test. Now, my tests are trivial, on the command line, on Ubuntu. YMMV. Particularly with respect to "trivial", since the tests are so small they're likely to stay in L1 or L2 cache, so they may not look like other people's more complex tests since they're not likely to trigger cache misses.

Alright, after the first two tests, I've decided that this is probably not worth doing. I may continue writing some tests, but:

1 - use static if possible - 1.25 percent difference.
2 - echo is faster than print - yeah, by 1.35 percent.

Some of those tips might actually be pretty useful (I'll run some more tests over the next few days), but these two aren't very useful. Sure, if you applied 100 optimizations, each giving a 1 percent improvement you'd double the speed of your program. But I routinely improve the speed of programs by orders of magnitude by improving SQL queries, creating appropriate indexes and simplifying complex code. Most of those 40 tips sound like micro-optimizations which aren't worth the trouble to implement.

To be sure, error suppression with @, apart from being slow, is usually a mistake (turn on error logging in development, push error logging to a file or syslog rather than stdout in production), and $row[id] is just stupid and the sign of an incompetent developer, as are incrementing uninitialized variables and #31. Using mysql is almost always a mistake (it has its uses, but everywhere I've worked, mysql has always been the wrong tool and anyone who implemented it [i.e., me] always regretted the decision later).

3 - avoid magic (__get, __set, __autoload) functions - OK. magic __get and __set [together]
are half the speed of accessing the variables directly. So there's certainly some cost
to the indirection. It may be that high level frameworks could (and should) use the
magic functions to abstract away details. I've avoided them for now though since they
don't improve maintainability or quality of the code I currently work with, although I'd
be open to using them if I were to work on something significantly more complex than what
I work with now. I don't see anything that complex on the horizon though, I'd probably
switch to another language for anything complex (perhaps java, perhaps python, it'd depend
on the project).

Thursday, October 11, 2007

More RAM in my next job -- and multitasking limits (not enough RAM in my brain)

I've got a slow computer (800Mhz) with a reasonable amount of RAM (640MB) at work. My laptop is twice as fast, with twice as much memory. But of course, the laptop hard drive is slower than the desktop hard drive.

I've been twiddling my thumbs quite a lot lately because a lot of my work has been very disk intensive. I could be speeding things up by not doing svn update of 300MB of source, instead going to just the directories that have been modified and doing the svn update there, but then that would require knowing intimately what the other developers are doing. And *they* don't necessarily remember all the directories they committed into.

So, in my preference for dumb solutions that work all the time (e.g., svn update at the root of the tree) versus smart solutions that can easily fail (svn update to targeted directories, possibly missing other directories with fixes), I just svn update at the root. I do similar things with very large databases too, and very large file copies (rsync). The dumb solution that works all the time but is not always optimal is more cost-effective than the smart solution that will take three weeks to shake all the bugs and corner cases out of.

I'll optimize (spending that three weeks later on), when the need arises.

If I'm going to be doing much the same in my next job, then I'm going to require my employer to get me the right hardware. So I'll have 4GB of RAM (or more), and the fastest SCSI drives money can buy, in RAID-0 with rdiff-backup to RAID-1 slow SATA drives. And then I'm going to do all my svn work in a 2GB ramdisk. Hahahahaha.

I was discussing the edges of this (in the context of multitasking) with the boss of my boss and he said, "well, so you can do other things while waiting for those long tasks to finish, right?". This was in the context of a query that ran for 22 hours (and yes, I got pissed off enough at that to set up an aggregated materialized view built via triggers [postgresql] so that it now runs in an hour). At the time I said, yes, so I can multitask and need not twiddle my thumbs.

I'm finding that there are limits to multitasking though. I get confused and forget to do important steps when the list of tasks hits more than 5 or so. So its best to stick with 4-5 concurrent tasks. So if all 4 or 5 of those tasks take more than an hour, I'm back to twiddling my thumbs because I just don't do well if I add another task. As designated mentor at work, I don't actually have to twiddle my thumbs though. Instead, I can stick my nose into my colleagues work and offer unsolicited advice. Sometimes it's even good advice :-).

Wednesday, October 03, 2007

Software is Hard

Kyle Wilson has a great article on software development, compromises, economics, complexity, lines of code, and why Software is Hard

I use "economics" the way I normally do though (which is not the way it usually is meant in RL, but possibly how it would be meant among economists). It's not just about money but about compromises among competing values and how different weights among the different values affect the outcome (which is usually also measured along several dimensions).

Monday, October 01, 2007

vim on slow links (sshfs)

Sometimes (as today), I need to edit files remotely. If the bandwidth is slow (PLDT myDSL has some occasional bogosity where my route to the office, which is normally just 5 hops, bounces between two internal routers whose IP addresses differ only by 1 in the last octet, so then my vpn goes to the other links and the hop count goes to 18 or so because it's overseas), editing remotely is intolerable.

Then I go with sshfs. I've got a script that mounts my working copy over sshfs. I always need to remember to setup vim though to not use swapfiles. So, from the man page,

-n No swap file will be used. Recovery after a crash will be impossible
Handy if you want to edit a file on a very slow medium (e.g. floppy).
Can also be done with ":set uc=0". Can be undone with ":set uc=200".

I've got an annotation in my ~/.vimrc (normally commented out) to set uc=0,
but I forget that it's there and I always google for sshfs vim swap file. And
then I go to this page, which doesn't have the answer :-).

I would post the solution so that the question doesn't stay unanswered indefinitely. If I could reply without joining the group I'd do that. But joining is required, and I'm no joiner. So the best I can do is point at it here.

Heheh, this will also help ME since I would normally query something like:

monotremetech sshfs vim swap

:-)

Sunday, September 30, 2007

OLPC -- Inspiring

There's a great post on OLPC uptake and how it's changing the school experience in Arahuay, Peru.


This is very inspiring. If all (or even half of all) social/economic development projects were to end up 1/10th as effective as OLPC-Peru/Arahuay has been, the world would be incredibly good.
Antonio is repeating second grade, but:


The first day Antonio came to school with his XO laptop, instead of playing during recess, he kept on exploring the XO. He quickly became one of the most acquainted with it and empowered to help his classmates by telling them how to do this or that. The change was suddenly and highly noticeable. His teacher was amazed of how he had become more focused doing the class work and was helping his classmates with the computer activities.

And Diego's story is hard but heartwarming.


Diego is in second grade. He had stopped coming to school. However, he did come to pick up his XO laptop the day we handed them out. His teacher explained to me, that he has no father, and that his mother went to Lima, the capital, to work. And now, Diego and his two brothers are living by themselves, but a kind neighbor gives them their meals.

After that quote, there's a picture of Diego helping a first grader on using the OLPC.


Emilio is a hero:


“Once, when the teacher was explaining to the children how to look up some new words in the on-line Diccionario de la Real Academia EspaƱola [the best Spanish dictionary, costly and practically out of the children's reach in book form]. Emilio understood the procedure and quickly looked up the entire list of words while the teachers and the other students, together, slowly went through the process. The Internet connection went down. The teacher made the best of the situation and explained what the Internet was and about the satellite connection, for them to understand what was going on, and ended by saying, "We will have to wait a little bit until the connection is reestablished." To which Emilio replied, "No need, teacher. I got all the words, and everybody can copy them from me.”

But not just any hero. Anyone can shoot other people or order peons to shoot other peons. Emilio is a hero of the mind.


It's pretty clear that the OLPC is inspiring kids to stay in school. At best, they get interested in school and using the OLPC. At worst, they'll stay in school because if they don't, the OLPC will be taken from them.

Saturday, September 29, 2007

high speed!

I've been very disappointed in my external USB laptop drive enclosure. Whenever I'd run my rdiff-backup or just a regular rsync backup (with --progress, because speed is what I'm nuts about) I'd get pissed off because the speed would only stay at arund 1-1.2MB per second.

Today though, I hit 5-5.5MB per second. I figure it was because I read some random advice (I think on the Philippine Linux users group mailing list) about plugging both USB jacks into the laptop because sometimes the power coming down one cable isn't enough (or the cable is substandard).

I'm a Psych major, so I never actually took any courses on electricity or electrical engineering (the computer science and computer engineering people do). I'm very glad though that, in fact, plugging in the second cable seems to have sped up the transfer rate. I may go buy a higher quality cable too as that is supposed to increase transfer rate too. For now though, ohhhh, 5+MBps is SOOoooo much better than 1+Mbps.

It's now fast enough that backups will be a joy, or only a minor nuisance, rather than the big production it used to be (I've got tens of gigabytes of data to transfer, it takes a while to rdiff-backup all of that, even if nothing's changed and all rdiff-backup has to do is read through the files to see if any bits have flipped).

[Update]
I don't think anymore it was the second cable (or the power issue). I think I probably got an kernel update that finally supports fast USB on this laptop. I experimented tonight, copying the data with both cables, and then with one cable. The speeds are the same. I'm still very glad to be getting 2.5-20MBps, all speeds are a lot faster than the 1.0-1.2MBps I'd get previously. But it's not the cable. That's too bad, since waiting for the kernel to get fixed for a particular laptop chipset is harder and less deterministic than just plugging in the other cable :-).

I'll keep the other cable plugged in though, still. I'm sure it'll help with stability, if the external drive gets enough power instead of sometimes getting too little.

Saturday, September 22, 2007

Wrestling with pure eeevveeeel

Jeremy Miller has a whiny rant on a project he's working on.

The whiny part isn't from me, it's from his comments section.

I've been wrestling with pure evil too. It's not java, and it's a whole program that's too long, not a function. there's only one function in there, it's called doublenum, and it doesn't arithmetically double its parameter (which would be at least descriptive), instead it doubles its LENGTH. sometimes. by prepending a zero if it's only one digit wide.

so, applying some items from Jeremy's rant,


  1. Very long method [check, although it's not even a method, it's just PHP code that's not in a function, so everything is global]

  2. Variables are reused for different things throughout the method [check, but at least variable names aren't totally bogus, although it does use a class prepended with the initials of its author]

  3. Lots of if/then exception cases [check - in fact, since there are about 8 common cases, the whole program is bunch of nested if/thens with one code path being one of the common cases, with exactly the same actions copy-pasted all over the place, plus deeply nested if/then exception cases peppered through the code (copy-pasted again), and at the end, just one of those common cases will be executed]

  4. Deeply nested Arrowhead code [ check, except its several arrowheads ]

  5. All data stored in Hashtable's -- and it's this data that's getting bamboozled somewhere [check - plus parallel PHP arrays (integer indexed), plus parallel (sort of) associative arrays where the keys are concatenated strings of the subkeys, plus some two dimensional arrays where the concatenated string keys previously mentioned are split up and make up the two dimensions]

  6. Numbers that come out wrong - [ check, or, actually, a really obscure bug where orders get their order quantity zeroed ]



And for extra bogus points:

  1. $r=7-($cday-$x);
    $mt = sprintf("%2d",chop(`date +%m --date '$r days' `));
    $dy = sprintf("%2d",chop(`date +%d --date '$r days' `));
    $yr = sprintf("%2d",chop(`date +%Y --date '$r days' `));

    what moron calls a system function THREE TIMES to get the pieces of a date? If they didn't know anything about time functions in php (or perl, this crap is all over the perl code these people wrote too), they could at least have called date once, and then extracted the fields out of there. But then, if they were too dumb to learn how to use the time functions (or even just to learn that they exist), I suppose it's too much to expect that they would figure out, The function names aren't helpful, but that's not as much a bogosity as forking to get the time, three times. Even selecting the date from the database would be better than this stupidity, and if they couldn't wrap their brains around that, at least fork only once!,

    date +%m-%d-%Y --date '1 day'

  2. oh, and that doublenum function? The only function defined in the whole program? It's actually inline in the code TWICE. But php doesn't do static analysis worth anything. Instead, if the two function definitions are in perfectly separate code-paths (it's never possible for both function definitions to be executed in the same run), then PHP sees no problem with that. PHP only points out function redefinition errors when the function definition is actually executed, e.g., no error here:

    function f()
    {
    return 0;
    }

    if(false)
    {
    function f()
    {
    return 31415;

    }

    }

My mistake with this abortion is that I've been trying to live with it, fixing it incrementally, when fixes needed to be done. I should have thrown this away long ago though, and just rewritten it so that it wouldn't be so bogus.

I was avoiding doing that because the horrendous date logic was totally obscured by the implementation, so it wasn't possible to extract what the date logic was supposed to do at all just from the source code (not possible for me anyway, I would get angry too early and give up). Now I'm going to have to understand the date logic and rewrite it all. Or if that can't be done, then use the current horrendous implementation as a test for proving that my implementation is "correct" (or at least complies with the current implementation, since I can't understand the current implementation, I'm not currently capable of proving *IT* correct. I can only take it as a given).

I'd better not meet any of the previous implementors in this or any future world. They're going to KNOW what I think of them, and then I'll hire them so I can fire them one second after.

Thursday, September 20, 2007

screen multitasking

I've known about screen for a few years. I never did use it until recently though. When I tried it out a few years ago I came away with the impression that it wasn't worth the trouble since I'd have to learn another set of keystrokes. When I tried it back then, I didn't like Ctrl-A or any of the other keystrokes that came with it (all prefixed with Ctrl-A).

Of course the activating keystroke (Ctrl-A) can be configured to be something else, but the rest of the keystrokes still seemed unnecessary cruft to learn.

I recently looked at screen again though and I've fallen in love with it. I don't use it as efficiently as I might. I still have a problem with the keystrokes, so I learn the minimum that I need (Ctrl-Ad, Ctrl-AA, Ctrl-A[, Ctrl-A],Ctrl-An, Ctrl-Ap, Ctrl-A", Ctrl-AX) and leave the other commands alone until I find that I need them. I still only have limited space in my brain for keystrokes, so I economize.

The problem with screen now is that I've got 8 processes running in screen at work (I'm working remotely because my baby is sick and I need to be home to help take care of him). I can barely multi-task 3-4 processes, and now I'm running 8. Of course, they're all long running database processes and once they're set up they run independently until they complete. I could then move on to another set of 3-4 things to do. I avoid doing that too though since when any in the first set of tasks finish, I'll have forgotten what the purpose of it was :-). And frankly, some of these tasks are going to take hours. I can't afford to keep adding sets of 3-4 tasks until I can't count them anymore :-).

I do find screen very useful though. Mainly, as a replacement for nohup. Now I can start a screen session remotely, run the program in screen, give it any interactive commands it might need (hard with nohup) and then leave it running. Previously, I'd have problems with running a program over ssh (when the vpn would burp, I might lose the session, I certainly couldn't control it remotely anymore). And nohup has problems with interactivity. Screen is a great help there since I can get interactivity, and if ssh breaks because of network issues, I just ssh there again and re-attach to the screen.

I didn't know about -x back then too, when I was first looking at screen. I like working with 3 or 4 actual terminals on my monitor. That's one reason I don't like KDE, it's necessary to manually detach a tab. In gnome, I can just turn off the menus (in fact, I use aterm now, but for a while I was using gnome-terminal) and have terminal windows automatically open in new windows rather than tabs (when I do Ctrl-Shift-N in one terminal it creates a new terminal as a separate window.

For screen, I just ssh to the remote box, screen -x, do that 3 or 4 times, and then have each terminal go to a different screen sub-session (Ctrl-Alt-" or Ctrl-Alt-n a few times).

I've even used screen for discussing/team-programming. The several people in the discussion all connect to the same screen session and then discuss, view, and test code while all looking at the same editor sessions, debug screens, etc. That works for command line work, or just basic code slinging. of course, testing in a browser, or in some graphical environment is harder. I've avoided those complexities for now though, although of course vnc is waiting in the wings for when I need it.

Tuesday, September 11, 2007

robinson's free wifi - going downhill

I used to love sitting in the Cafe Mediterranean in Robinson's Galleria because of the good food, cold beer, and free wifi. I've also used it downstairs, by Bo's cafe. At the time, the wifi signal itself was good. The DNS was slow, as was the actual connection, but I didn't mind since I wasn't downloading huge files anyway. It was a pleasant place to surf and have coffee or a snack.

The wifi at Robinson's Pioneer was always bad, one could use it, but it was intermittent and slow when available.

I recently went to both Pioneer and galleria and checked out the wifi situation (at Cafe Med at galleria, and at Old Spaghetti House at pioneer). The wifi is much worse than it used to be. Possibly the hotspot has been moved at Galleria, but when I was last there, the signal wasn't available at all at Cafe Med. There were some secured networks, but no free wifi. I didn't go to Bo's to test there. It wasn't important enough.

At Pioneer, Old Spaghetti House charges a ridiculous PHP 50.00 per half-hour just for plugging in to the wall. And the wifi was very slow and unstable when I was there and it's completely down now (right now, my wife is meeting a fellow developer there). We liked the coffee and dessert at Old Spaghetti House, but the cost of plugging in is sufficiently stupid that I believe I'm going to tell anyone interested about how Old Spaghetti House is extremely unhospitable to laptop warriors. I think it's great that they have wall plugs at all. A more reasonable price or policy would be cool. For now though, absent either, the policy is just dumb and I'm not going to give them any of my money again. Although if my wife insists on going there, she can pay for lunch. The creme brulee WAS very good.

ionice - redux

I love ionice enough to give it thre exclamation points but I'd been having some problems with it. Mainly, I was optimizing too much. I was using -c 3 on the assumption that everything would run much better if svn update or git-svn rebase was taking too much IO bandwidth.

This was a mistake. I would have problems when the ionice -c 3 process was running since -c 3 (idle priority) requires root access, so if it created files, those files would be owned by root since ionice -c 3 needs to be run under sudo or directly, as root (sudo su, root login or /etc/crontab).

It took me more than a month of frustration (and actually stopping the use of ionice, or doing a chown -R at the end) to finally ask google :-). I must not have been all *that* frustrated.

There's an explanation here of why ionice -c 3 requires root access.

So finally I'm convinced and will now run large svn updates (or my huge rdiff-backup based backup system to a slow external USB drive that only runs at USB 1.0 speeds) under ionice -c 2 -n 7. A few quick tests shows that performance of the laptop (no locking of X, etc) is about as good as with -c 3 but there's no need to run under sudo, so no problems with file ownership or permissions later.

Thursday, September 06, 2007

Downloading OpenSolaris sucks

After a good email from David Meyer, on the PLUG mailing list I decided to download OpenSolaris and test it out on vmware.

I chose to use the Sun Download Manager last night. I'm not going to do that again. The download was chugging along slowly but steadily but today it stopped. And the Sun Download Manager has this clunky, unintuitive interface and apparently some weird logic in there so that only one file can download at a time and there's a maximum number of retries and then a file will never be downloadable again. Possibly the internet went up and down today and it hit the maximum 10 retries so it stopped trying to download. I changed the retries to 20 though (the maximum, why is there a maximum??? If I want to keep downloading forever on an expensive and slow GPRS link, why not let me do it?) and it STILL wouldn't download anymore.

When I got back this evening it was still downloading, but at 5kBps, when I can normally get up to 80-120kBps on my DSL connection at home, I wasn't going to wait 70 hours or whatever it predicted the wait time to be.

Since I couldn't make it work anymore, I just nuked the whole Sun Download Manager thing and am currently downloading the files via the browser. I'm downloading all three files at the same time and they're all coming down at 30-80kBps. That should get faster as the night deepens.

This sucks though. I should get better speeds from Sun microsystems. I'll keep trying to download, but the piece of crap that is the Sun download manager doesn't inspire any confidence in me. Likely OpenSolaris will be very good. It's a very mature piece of work. I'll see if I get comfortable with it. But my expectations aren't very high just now. I hope I'm disappointed in my expectations.

Saturday, September 01, 2007

svn mv and atomicity - lesson learned

I was moving some directories around in $DAYJOB's svn repository and I wasted a lot of time doing it. The problem was that I didn't realize that svn mv requires that both source and destination parent directories need to be committed at the same time.

I needed backward compatibility, so what I was doing was similar to:

svn mv {parentdir/srcdir} {elsewhere/destdir}
svn commit {parentdir} -m "some message"
ln -s {elsewhere/destdir} {parentdir/srcdir}
svn add {parentdir/srcdir}
svn commit {parentdir/srcdir} -m "some message"

svn commit {elsewhere/destdir}

usually I'd do that for a few directories before bunching the
commits of elsewhere.

I was then getting svn errors because the source wasn't around anymore. When
doing svn mv, it's necessary to commit the A (in the destination directory) and
the D (in the source directory) in the same commit, otherwise there will be
a lot of backfilling and rework necessary. What I had to do was find the
revision at which the given directories were deleted from the parentdir,

svn cp -r [rev] [URL] [destdir]

them (specifying a revision one less than the one they were deleted in), and
commit, bringing them back. Then I'm doing the svn mv operation again, but
this time committing both at the same time and only doing the "ln -s" at the end,
and in its own commit (can't be done along with the svn mv because I want the
link to have the same name as the source file, but the source file hasn't been
deleted yet, the ln -s and svn add of the link needs to be done after the
source file D operation has already been committed.

The links (for backward compatibility) are making a regular svn update fail.
This is because svn update needs to create the link, but the original file
is still there. svn doesn't replay the commit history, so it doesn't have
the opportunity to delete directory entries which are no longer the same type
(formerly directories, now links). I was going to just check out the whole
tree, but I think I'll wait on that, instead I'll first just remove all links
(find . -type l | xargs rm -f) and then svn update since the only same-name
files in there are links inserted for backward compatibility.

Friday, August 31, 2007

rsync speedup -- only 2.49

I had to transfer 2.4GB of svn working copy over the internet and I wanted to save as much bandwidth as possible. Just plain rsync of the working copy wouldn't have given me enough bandwidth savings since the duplicated data (not just blocks inside files but actual full files duplicated) are in different files.

I decided to try to take advantage of that duplication detection by creating a tar (not tar-gz) of the working copy. I hypothesized that there would be at least a 2x bandwidth saving because the pristine copies (in .svn/text-base) would be exactly the same as the working copy except where the working copy was modified, and even then only a few lines are typically modified, out of perhaps 500-1500.

There should be even more savings because the reason the working is so large is because there are a few branches (experimental working directories tracked via svnmerge) and 5 or so tags left lying around (older tags are removed and documented in a readme so they can be resurrected by referring to the revision number, but we don't keep everything around since we release very often and the tags are very large).

Because of the tags, I expected a speedup of 10-20. I only got 2.49 though. Which is good, but close to an order of magnitude away from what I expected. I'll play with this some more. I just took another quick look at the rsync technical report and it doesn't seem to invalidate my hypothesis
{alpha} searches through A to find all blocks of length S bytes (at any offset, not just multiples of S) that have the same weak and strong checksum as one of the blocks of B.

Possibly tweaking the block size might help. Blocksize is set according to the size of the file, and I expect it to be directly proportional to the file (to minimize the amount of data to transmit for checksums, probably). Setting it smaller will make sending the checksums larger, but possibly increase the efficiency. I expect to waste quite a lot of time and bandwidth on this :-).

Thursday, August 23, 2007

git-svn again

I'd been having trouble figuring out git-svn and git. I worked at it a bit more this week and I've finally got something working.

mkdir svn-git
git-clone [URL]
cd [directory]

and the files are there. I can do most of the basic things. I haven't yet practiced branching and merging. I'll do that in a week or so. Or tomorrow, as the mood arises. For now, I'm happy that I can remotely mirror a repository (my personal backup of the entire repository, including commit messages). It also makes viewing log messages a lot faster when the svn server is far or my link to it is slow (as happened to me and sol the past three nights, the route to the svn server passed through an ISP in singapore that was experiencing 50% packet loss, it took a few days the upstream ISPs to figure out that they shouldn't go through that lame router).

I had some confusion earlier since I deleted a subdirectory (with just rm -rf) and then couldn't figure out a way to revert. I still don't know how to revert from a "pristine copy", if git has that at all. Instead, what I had to do was a local commit and then a git-revert (which reverts a commit, something that svn doesn't have yet). I don't know if that's the canonical way to do that, but it worked.

I tested git-commit and git-svn dcommit and that worked pretty well. The commit messages are clean, which is my main issue. I'm looking into git-svn partly so that I'll be able to work with version control even if not connected to a repository. I'd previously used svk but wasn't happy with the format of the commit messages pushed into svn when it came time to merge back into svn. That might have improved by now, but then there were problems with speed too. Those won't be fixed except by rewriting in something faster than perl. If I learn, like, and learn to like git, I'll stick with it for disconnected work.

But first I need to test out its features. There's a long weekend coming up (two long weekends in a row this month), I'll play with git a bit then.

[Update]
Ok, The git workflow description at Calice points me at git reset. So

git-reset --hard HEAD

does what git commit+git revert does, but without the bogosity of actually having a commit message in the logs.

Now I'm trying to figure out how to get the list of files modified in a given commit (in svn, svn log -v).

Ah well, now it's just time read the git manual. I read the CVS manual and the SVN manual, I should be able to wrap my brain around git :-).

Friday, August 17, 2007

gmail smtp requires TLS

I use evolution at work (none of that Outlook creationism for me) and, on my laptop too. At work I was confused because I couldn't send email through smtp.gmail.com. I thought it was just work firewall rules. It wasn't though. Formerly, I could send from my *@gmail.com addresses using the company SMTP server. Then the SMTP server was reconfigured to be tighter and to require authentication. I couldn't send mail with a From: of bopolissimus@gmail.com anymore. I tried to set up SMTP+SSL to smtp.gmail.com. And then I wondered for a long time why that was failing.

Well, it's because I'm too lazy to read the damn manual.

It says so right on gmail (i.e., mail.google.com), SMTP requires TLS. It's POP3 that requires SSL. If I cared more about the asymmetry there I'd wonder why they aren't both TLS or SSL. But no, I'm too busy with other work to care about that just now :-). I'm just glad I can send mail out again without having to log into the web based gmail client. That's a great client (I was testing out mail.yahoo.com yesterday and that site is ridiculously slow on my ridiculously slow 800Mhz workstation :-), but I do prefer to have everything in one place, retreating to the web based client only in emergency (which is never, actually, since if I can't check my mail on my laptop or my work desktop, then I just won't check mail. I'm too paranoid to check my mail at internet cafes since they all run windows.

Wednesday, August 15, 2007

Windows is Free

Dave Gutteridge, on tlug.jp has a great article on how common windows piracy is and how that affects Linux uptake.

He says a lot of things I've always wanted to say but never had the time or patience to set down at such length.

Bravo.

Tuesday, August 14, 2007

HP sales versus newbie

A very good friend of mine went to buy a computer. I couldn't go with her, and she's comfortable enough financially that she doesn't need to find the cheapest computer, so she went to an HP reseller.

I prefer for her (and other newbies) who can afford it to buy branded hardware anyway (although I wouldn't necessarily go with HP, I'd go with something a bit cheaper, say Lenovo, or Acer). The presumption being that the hardware quality will be a bit better than that of pure clones and while it's possible to build superior boxes out of clone parts (with careful study of all the parts/options), I didn't have the time to help her with that, and she didn't have the knowledge (frankly, neither do I, anymore) to do that.

Well, the HP reseller sold her on the "fastest computer available", it came with Vista Home Basic and with evaluation versions of Home/Student MS Office 2007.

Gripe #1: the computer came with 512MB of memory. For a $1000 computer, there should be
1-2GB of memory in there.

Gripe #2: the CPU is 1.6Ghz. That's not a speedster by any standard. My laptop is faster
than that.

Gripe #3: Vista Home Basic is ridiculously slow. A lot of the user interface has changed
so it's difficult to find things.

Gripe #4: MS Office 2007 has completely discombobulated the user interface. I couldn't find
anything until, after some random clicking, we clicked on the icon at the top right
of the window (sort of like the [Start] button, except Vista doesn't have a start
button anymore, it's just an icon, in Office, it's a something button that brings
down a vertical menu because the former horizontal menu isn't there anymore).

Even the random clicking didn't help much at first since the computer is so slow
that clicking on that icon didn't do anything (or it caused some flicker as the
menu popped down and then went away instantly due to clicks elsewhere).

Boy, I'd forgotten how dumb windows makes me feel. And the fact that MS changes the user interface gratuitiously and so radically makes me wonder about its future. I'm not going to have any fun helping my friend with her computer. If I had the time I'd save her a bunch of money and get some other brand from any store other than the one she bought from, and definitely not HP either. Unfortunately, she's going to upgrade her computer to a better CPU and I'll go back there to help her set things up on it. The only fun I'll be having is when I surreptitiously repartition the drive and put Linux on there, and when I claim my unlimited beers. The beers will deaden the pain of working with Vista (yech) and Office (yech, yech, gaaak), and HP (gaak).

Thursday, August 09, 2007

10 things your IT guy wants you to know

Good article on 10 Things your IT guy wants you to know.

I like it because it's solution oriented and very mature. the very opposite of the BOFH

Saturday, July 28, 2007

no git-svn yet

I was going to test out git-svn, but I couldn't make heads or tails of it. So I'm working with svnmerge and I like it very much. It looks like git would be very nice to work with, but since I can't understand it for now, I'm going to watch linus' youtube presentation on git.

Linus is pretty irritating in the presentation, and vlc won't fast forward over the flv file I've got, so I can't skip the pointless part. I'm just going to have to sit through the whole thing I guess. Maybe mostly listen to it and only look at it when he discusses something that looks like the slide is important.

Thursday, July 26, 2007

backup and restore

I'm backing up my laptop's /home filesystem to my USB harddrive because I think it's time to change filesystems. /home is xfs. A few weeks ago though I found what seems to be a bad sector on that partition (an ISO image on /home had sections that were unreadable, although the same CD that the ISO was built from was perfect). Unfortunately, neither XFS nor JFS has the capacity to accept badblocks output so that the blocks found bad can be marked unusable (decreasing usable disk space a bit, but keeping data safe).

So I'm backing up my data (damn it's taking a long time to backup 37GB over a USB cable) so I can reformat /home as reiserfs (likely) or ext3 (less likely). And then it'll be another night of running badblocks so I can feed that to the new filesystem.

This isn't a big deal. I'm reading widely and playing chess against crafty (and losing every game). So it's not time lost. I'll go to bed soon and hope (but unconsciously) that the backup will be done by tomorrow morning, so I can format, badblocks, and slowly copy the data back.

This laptop doesn't have any S.M.A.R.T. options in the BIOS, so I can't take advantage of those options (apparently JFS and XFS rely on S.M.A.R.T. to handle bad blocks for them). Heck, since Ubuntu makes the IDE drive look like a SCSI drive, I can't even hdparm -d1 /dev/sda. I get:


/dev/sda:
setting using_dma to 1 (on)
HDIO_SET_DMA failed: Inappropriate ioctl for device


Yech. There's probably a way to force Ubuntu to treat the drive as an IDE drive instead of emulating SCSI for it. I haven't gotten around to surfing for that solution though. It's not important enough just yet.

The next morning: Wow, badblocks has gone through just a fourth of the disk and the badblocks file is already 135MB. I think I'll have to go with ext3 instead of reiserfs so that I can take advantage of the -c parameter to both mkfs.ext3 and fsck.ext3. Yech, I've always had more problems with ext2/ext3 than with reiserfs/xfs with corruption after powerloss. But I'm going to have to bite the bullet here. And anyway, it's a laptop. The only time the OS wouldn't be shut down correctly would be if there were some sort of kernel panic (haven't got those in a long time, since I stopped compiling and using win4lin kernels) or if I were to turn the laptop off. The battery works as a UPS, so I won't get instant off when the wall power goes out.

I should really buy a new harddrive, of course. I'm not able to just yet though, so I'll limp along with this one and make weekly rdiff-backups to the USB drive, and another rdiff-backup everytime I transfer pictures and videos of Timmy from the digital camera. :-)

Thinice

I thought I'd look for an Ubuntu (gnome) desktop theme I liked. So I looked around and tested the themes in System | Preferences | Theme. I didn't much like what I saw, but then I clicked on "Customize" and, testing the different themes there, found that I liked the *darkness* of the Thinice theme.

I tend to lower the brightness of the screen on any computer I use. Even on a laptop LCD, I prefer for the screen to be less bright. That isn't consistent with the dark text on light background of my terminal windows, but there it is, Very well then, ... I contain multitudes.

In any case, I liked thinice and I'm going to move all my computers (work and home) to that theme :-). The scrollbar sliders are cool too.

Monday, July 23, 2007

DRY

So this code I'm working through (it was supposed to be a trivial exercise in fixing brace style) has turned into a nightmare. I can understand when people copy and paste some code. Maybe copying and pasting the same code twice or three times is OK, although three times is stretching it. BUT GODDAMN IT, MUST THE SAME DAMN CODE BE COPIED 23 TIMES????

And it's not just one function it's more like 8 functions copied and slightly modified (or not modified) all over the place. If this had to be done at the beginning because there was no time to refactor, __NOW__ is the time to refactor because any bugs that come up (will need to be fixed 23 times. And I guarantee that at least of those bugs will be missed.

Parameterize, abstract, and remove redundancy. Dammit.

Oh yeah, that's Don't Repeat Yourself.

the root of all evil

Alright, it's not all that evil, but I'm looking at this PHP code:


$message = 'Hi, ' . "\r\n";
$message .= "\r\n";
$message .= 'Your account at ' . $this->domain . ' is awaiting activation.' . "\r\n";
$message .= "\r\n";
$message .= 'To activate your account, please visit ' . $this->domain . '/members/activate/' . $activation_key . "\r\n";
$message .= "\r\n";
mail($to, $subject, $message, $headers);


And I'm thinking,

  • mixing single quoted strings and double quoted strings.
  • mixing single quoted strings, double quoted strings, and concatenating variables instead of putting them inline


I don't care too much about the strings being hardcoded, the app doesn't need to be multilingual, yet. But I'm struck by the fact that in the attempt to optimize (in PHP, single quoted strings are faster than double quoted strings since the runtime doesn't need to try to do string interpolation (parse the string to find variables, and replace the variables with their values).

On the other hand, this code is going to send mail. This is a classic too early optimization. The network will be the bottleneck, or writing the file will be the bottleneck (if we write the emails into a file first for batch sending later [which isn't relevant for the concrete case, the email is sent immediately, see the mailto(...) function call]). And it's harder to read (mixing two kinds of strings always is, and in fact the code is mixing three kinds of strings, the third being variables. Code for maintainability first, code for performance only after profiling and finding the hotspots in the code.

Sunday, July 22, 2007

ionice!!!

Hot damn! ionice is incredible.

I was going to say "nice", but that would have been obvious and shallow.

I know, that's a link to a short tutorial on how to use ionice, I like short tutorial links though, so I can test something out quickly.

I'm installing something very IO heavy in vmware. This is on a single-core 1.5Ghz, 1.25GB Ram laptop (slow IDE hard drive). Before ionice, the browser and sometimes all of X would stall on me for some seconds (30-40) before getting more responsive. I don't mind if the vmware process takes a long time to run. If it finishes tomorrow, well, I'll just sleep through it. So it's very nice to be able to lower its IO priority so that it doesn't make the laptop completely unusable when it's shoveling gigabytes around on the disk.

Highly recommended. Requires at least kernel 2.6.13 though. I've already asked the system administrators at work for one of the debian servers at work to be upgraded to 2.6.13 or higher. That box runs a very long running doxygen process that makes everything else crawl for a while. It'll be great to get some of that performance back :-).

Saturday, July 21, 2007

trying out git-svn

I've got a pretty good solution to the merging problem in svn. I've also previously used svk for disconnected work. I couldn't stand the ugly commit messages svk created though. I'm now testing out git-svn. If the commit messages from git-svn are reasonable, and there are no problems with branches and merges and commits to svn, and it runs very fast, then I may personally switch to it.

If git-svn works out as well as promised then I'll switch to using it and the others on my team can decide whether they want to stick with pure svn or try out git-svn.

svnmerge heaven

There are three major problems with subversion.

  • It's slow
  • You have to be online to the repository to do many operations (not distributed)
  • Merging is hard

Git apparently solves all those problems. So says Linus on youtube.

I haven't used git and I'm not likely to at $DAYJOB. It took a long time to convince the developers and system administrators at $DAYJOB to actually use svn and I'm not done with the conversion yet, technical support isn't on the version control bandwagon yet. So there's just no way I'm going to spend another year or two convincing people to switch to git from subversion.

I don't worry too much about being online to do most operations. At the office I'm online to the svn server, and at home or anywhere else with an internet connection I can get through to the office on the VPN. If I'm not online, well, I just won't work. Or I'll work with svk if necessary.

The current full working copy (including branches) at work is pretty large, so an svn status on that *is* pretty slow. Even svn status on just the trunk is slow. But we work around that by avoiding working at the top of a branch unless it's really necessary. Working in individual subdirectories is much faster and the only time we ever need to work at the top of a branch is when we need to see what all the uncommitted changes have been to that branch, or when we need to do an svn log to see what all the committed changes have been to the branch.

For a long time though, I would make branched tags but would not actually do experimental or development branches because, while branching is easy, merging was painful. It could be done, but it was so inconvenient I never tried to do it.

Finally, svnmerge has landed. Svnmerge is a python program (on Ubuntu feisty, part of the subversion-tools package) that takes the tedium and complexity out of merging in svn. The link above has a good introduction to svnmerge. I learned the basics, though, from Ken Kinder's little howto for svnmerge.

I've tested it out once or twice with real branches at work, it works pretty well and hasn't failed me yet. I wouldn't be surprised if there were some weird or extreme corner cases where svnmerge could get confused and do the wrong thing, but I'll worry about that when I get there. I haven't seen any reports of that yet and I intend to stay away from the more complex features anyway unless I really need them (e.g., no bidirectional merge until at the end, when the experimental branch is stable and is ready to be fully merged back into the trunk). In any case, I expect that development on svnmerge will fix any such showstopper bugs before I ever see them since I intend to be as considerate and conservative as I can be when using svnmerge ;-).

I'm very happy that merging in svn is finally convenient. It's been a long time, I've done my share of hand-merging branches. I'm glad that tedium is going away.

Wednesday, July 18, 2007

firefox multi-tab home

Long ago I knew that firefox supported multiple-tabs for the "Home Page". And then I forgot.

Just the other day I rediscovered this. It's very convenient. My "Home Page(s)" button now opens


  • a cacti tab to monitor the database server, our internal time tracking web page,
  • a gmail tab,
  • a tab that opens our internal doxygen documentation and,
  • because I'm studying svnmerge, since I've been waiting for decent merge support in svn since early svn betas:
    Ken Kinder on "Subversion merge tracking with svnmerge"

Tuesday, July 17, 2007

SQL subtotals, grandtotals

I really should google more. I sat down and thought for several hours trying to find a way to get running totals out of an SQL query. I should really give up earlier so I could have googled and found:

SQL Server: Calculating Running Totals, Subtotals and Grand Total Without a Cursor


It's got some SQL-Server-isms in there but it's generic enough that I learned the basic technique pretty quickly and implemented it in postgresql. I got my query to use running totals, and used that as a springboard to getting running balance working. I haven't yet gotten around to getting subtotals and grandtotals working, but I'm sure I'll get around to that soon, SQL use where I work is getting more sophisticated. Years ago the code used monkey-see-monkey-do and mysql style treating the database as a dumb datastore. We're on the way to something between mysql style dumb queries and doing joins in php and oracle style "do everything in the database". I think both styles have their appropriate niches, but our systems are in neither of those niches, we need to be more moderate, using SQL where it's appropriate and business logic in applications where *that's* appropriate.

Monday, July 16, 2007

minimal centos vmware image

I had to build a minimal centos 4.4 vmware image recently. Two projects I'm working on use centos because our team systems administrator is an RHCE, so he uses a familiar distribution. I don't much care which distribution I use. CentOS is fine as long as I can get reasonably new versions of the software I require (php, postgresql).

In fact CentOS 4.4 isn't that distribution, with php stuck at somewhere around 4.3 and postgresql at 7.4. But it's certainly stable. And I can build any necessary software from source, so I don't feel any great need to upgrade to 5 (although we should probably have a plan for that upgrade path for sometime in the next 6 months).

For this distribution, I had to install Oracle 10g Express Edition (for learning Oracle, and for prototyping). That makes the installed VM bloat up by a lot. I went through the installed RPMs and removed everything I didn't think I'd need (and a few things that I found I needed later on). Later, I had to reinstall some development packages since I needed to build php from source (because I couldn't figure out how to get CentOS' built-in php to talk to oracle). I eventually wound up installing php 5.3.2 since I couldn't get php 4.3.9 to do what I wanted (connect to oracle). That's probably pilot error, but I don't mind the upgrade, and if there are incompatibilities with the installed php 4.3.9 on the deployed live servers, well, I'll ask the team sysad to deploy 5.3.2 there (after some paranoid testing on the vmware image).

After building php, I removed the development packages again :-). For when I need the list again:

gcc apr-devel gcc-c++ libtool bison flex make
autoconf automake cpp db4-devel apr-devel
glibc-devel glibc-headers apr-util-devel
httpd-devel libstdc++-devel openldap-devel
openssl-devel pcre-devel postgresql-devel
zlib-devel libpng-devel libxml2-devel

The vmware image we use doesn't have any X anything in there except what is needed for vmware-toolbox (useful for resizing). I thought that I absolutely needed to have X actually running in the VM. That may have been true with older versions of vmware, but with the free vmware-server, I can safely do X11 forwarding over ssh and do the vmware-toolbox resizing using the X on the host. No need to have gnome and all the rest of the packages it pulls in just for resizing the vmware virtual drives.

Tuesday, June 26, 2007

vmware networking - wireless bridge, nat problems

I was setting up a vmware image of Ubuntu Feisty the other night and I had a heck of a time with the networking. I went through and tried bridged, nat and host-only. I couldn't get bridged or nat to even talk to the host computer. host-only could talk to the host, I could even get it to NAT to the wifi-router, but I couldn't get it to go past that.

I wiped that image and redid the work and now I've got it working. The first basic problems was that I didn't look in dmesg. On ubuntu, it's necessary to use vmware-any-any to get vmware to work with the Ubuntu kernels (or something, in any case, something doesn't work, maybe compiler issues, and it's necessary to patch with vmware-any-any so that the vmware modules will compile).

After I finally looked in dmesg, there was a section that said that vmware bridge over a wifi device doesn't work with vmware-any-any. OK, next up was nat.

That didn't work either. It wasn't until I rebuilt the image (in fact, uninstalled and reinstalled free vmware-server) last night that I finally got nat working. Previously I had used vmware-config.pl to edit the networking settings (using the editor) and I had decided to always use vmnet0 for the bridge, and then later the nat, and later host-only and then, in the vmware client, chosen BRIDGE, NAT, HOST-ONLY as appropriate. That doesn't always work because apparently vmware has some sort of mapping for the vmnet numbers. Choosing NAT but having manually edited it at vmnet0 makes it not work because NAT starts at around vmnet8.

The trick, I found last night, was to select CUSTOM and then select the correct /dev/vmnet[0-9] entry. I've got networking working now (NAT though, since bridging on a wireless device still doesn't work) and have got the rest of the project done (install oracle 10g express edition with a small sample database, for use by my team in testing an oracle application we're developing for a large government owned corporation).

Oh yeah, and to solve it without a trick (i.e., canonically), just use the network connection wizard. It'll choose the correct number for the vmnet device type that you want to use. I like having things numbered sequentially though, which is why I got into trouble in the first place.

Sunday, June 24, 2007

Oracle bogosity - no boolean column type

Oracle has no boolean column type. That is, in a create table statement, you can't say:
MY_BOOLEAN_COLUMN boolean
I've seen some discussion of this and most of it boils down to what Tom Kyte says, that you don't need a boolean type since you can use an integer(1/0), a character(T/F,Y/N,even 1/0) or anything you like. I suppose you could use varchar(5) and use "true" and "false".

For a while I accepted this explanation, until I ran across an oracle database that had boolean types using all of these conventions (in different tables, although I did see T/F and Y/N for different columns in the same table!).

Of course it was implementer error that they didn't use check constraints on those pseudo-boolean fields. So in the integer field, it was possible to set the "boolean" to 314. and in the character fields, well, it was possible to have T/F/Y/N/1/0 all in the same column (fortunately, the character field was limited to one character, else I would have had even more fun with that stupidity).

I suppose Oracle is that way (bogus) because of legacy code, compatibility issues, and inertia. I can see internal discussions going sort of in the direction of creating a boolean type but stopping short of actually doing so because it just seems so hard, or no one wants to rock the boat and introduce potential compatibility issues (e.g., when oracle software uses boolean, and then won't work with oracle installations which didn't have the boolean type).

Another problem, of course, is that anyone confused enough to use all those different encodings for pseudo-booleans, and worse, IN THE SAME COLUMN with no check constraints, is going to continue being confused when the boolean type is introduced. They won't use the boolean type, they'll continue using their iodine-deficiency-generated solution. But just because idiots will continue in their idiocy is no reason to avoid doing the right thing. As it is, when a boolean field is concerned, there's going to be a discussion as to which convention to use and then there's going to be a random choice (unless the shop in question has advanced to the point of having a convention for boolean fields, in which case I say, bravo). If a true boolean column type were available, the canonical answer would be to use that. Iodine-deficient DBAs could still use their non-boolean hacks, but at least a canonically correct solution would exist, guiding iodine-sufficient (but trained by incompetent or iodine-deficient DBAs) in the right direction.

Friday, June 22, 2007

auto-convert images for blog

Sol and I take a lot of pictures. The camera automatically names them (with zero prefixed integer sequential filenames) but it's very easy for filenames to collide (two different days can have 000001.jpg files). I also take pictures at a rather high resolution. The resulting images take up a LOT of space.

I wrote a shell script that, with the help of GraphicsMagick (or ImageMagick) takes all those jpgs and creates two files, one a thumbnail (ending in -th.jpg) and one a large images (ending in -1024.jpg). The date of file transfer (from camera to laptop) is prepended to the image name so that filename collisions become impossible.
irec
I originally put the thumbnails and -1024 files in separate directories. Now I put them in the same directory so that the files are easy to upload to photobucket (they're in the same directory, so clicking on the Browse to select an image button brings me to the same directory. It's very easy this way to upload the thumbnail and the -1024 together).

I still keep the thumb directory around but I populate it with links from the "smaller" directory. Keeping thumb around doesn't really make sense anymore. It's not like I have programs or scripts that depend on existence or contents of that directory. Just laziness, I guess.

If the script were named "picstoblog" (see below) I would do something like the ff to process all the directories in my Pics directory.

for fn in *
do
if [ -d $fn ]
then
pushd .
cd $fn
picstoblog
popd
fi
done


----
picstoblog script below, some things could be improved (mainly be simplifying/eliding, e.g., thumb), but i don't care enough to actually do the fixes)
-----

#!/bin/bash

if [ ! -d thumb ]
then
mkdir thumb
else
rm -f thumb/*
fi

if [ ! -d smaller ]
then
mkdir smaller
fi

for fn in *.jpg
do
base=`basename $fn | cut -f 1 -d '.'`
d=`pwd | cut -f 1-3 -d "-" | sed "s/-//g"`
d=`echo $d | basename $d`

sm=$d-$base-1024.jpg
th=$d-$base-th.jpg

if [ ! -f smaller/$sm ]
then
gm convert -scale 1024x768 -quality "70%" $fn smaller/$sm
fi

if [ ! -f smaller/$th ]
then
gm convert -scale 200x150 -quality "50%" $fn smaller/$th
fi

# for older files, remove if already there so can link
rm -f thumb/$sm
ln -s smaller/$sm thumb/$sm
ln -s smaller/$th thumb/$th
done

Sunday, June 10, 2007

php-oracle bogosity #1

That's not #1 as in it's the worst of its kind. I'm very new to playing with oracle on php, and it's only Oracle 10g Express Edition, so I am definitely not saying anything about oracle in general.

This might even be just a php-oracle thing, not necessarily in the oracle API at all (i tried to read that, got bored and came to no conclusion). In any case, I wasted a few days on this. I'm on vacation and getting online to fix something involves going to the internet cafe in the city. I only do that once a day. Of course, reading the documentation of oci_fetch_array would have helped :-), but I didn't realize oci_fetch_array could be this bogus.

In PHP, oci_fetch_array takes as parameters a resource statement (result of oci_parse) and some integer parameters. Apparently, Oracle (or the PHP-OCI8 library anyway) by default will not return null columns. It's necessary to specify OCI_RETURN_NULLS if you want null columns in the returned row. This is just bogus though. What does it cost to return some extra array entries, after all. Particularly if they're null or empty (which is a separate pure-oracle bogosity for later). It certainly creates an unnecessary asymmetry to have rows sometimes be 10 columns and sometimes 12 depending on whether certain columns in the returned row are null.

Monday, June 04, 2007

Maybe catching up

I've been away from mailing list email for months because the pressures of work don't allow me to even scan, let alone post, mailing lists. That's too bad. I really enjoy reading on the postgresql-general mailing list, for instance, since there's so much to learn and the signal to noise ratio there is incredibly high. On Plug I think the SNR has also been improving. But I'm not sure about that since, well, I just haven't been reading it. I've looked there once in a while and there seems to have been some improvement.

I'm going away for a two-week vacation with my family. We'll be in Cagayan de Oro, Duka Bay, and Camiguin. CDO, to visit, to prepare for timmy's baptism, and for the actual baptism, Dukay Bay for a break. My parents and brothers and sisters have been there many times, I never have, so we'll go. I may dive there, if they've got a mask with the right corrective lenses. If not, I'm sure we'll be going on the glass bottomed boat.

On camiguin, of course, we'll be diving No camiguin adventure tours> for us though. I've done most of them and timmy can't go with us. I'm really looking forward to diving. Sol hasn't been to Sunken Cemetery or Canyons yet and we've got a divecase now to go with the digital camera, so I want to take a lot of pictures :-). I don't know if the pictures will be good. Visibility might not be so great during rainy season, but it'll be great to take our own dive pictures and videos. Sol wants to do a night dive. That'd be great. The last and only time we did that, it was for qualifying for PADI advanced open water diver. It'll be good to do it again without having to worry about exercises, etc. The last time we had a really great time. There were incredible numbers of lionfish (I guess they come out at night, they're a common sight on camiguin, but they were really out in force that night, we even saw two that were doing the deed, or would have been, if they were mammals :-) and a huge cuttlefish, among a lot of other things. I can't wait to do that again. twice :-).

Oh, wait. This was about catching up. I get carried away sometimes. Back on topic, I'll have two weeks of free time. I'm sure I won't be in front of the laptop the whole time (although sol and I are both bringing laptops, we'll be working too while away) but I'll certainly spend 2 or 3 hours a day catching up.

Saturday, May 26, 2007

Online feisty upgrade - washout again

I decided to do an online distro upgrade to Ubuntu feisty. As with my last online distro upgrade attempt (Dapper to Edgy), this one didn't go well either. Apache2 wouldn't upgrade cleanly, so I just removed all of apache2. I planned to install it from scratch when the distro upgrade was done.

Unfortunately, there was a problem with removing or upgrading the kernel and I went nuts and decided to completely throw away the Edgy kernel and give Feisty the change to install a few of its kernels. That was a mistake since Ubuntu likes grub and I prefer lilo. Something went wrong the kernel upgrade and I was left with a system that died with kernel panic when trying to mount the root filesystem.

A bit of work with a Dapper installer, and Edgy alternative installer, and a Mandriva 2006 installer gave me no joy. My old trick of chroot to the old mounted root and then mounting the other filesystems didn't work (so I couldn't get /boot to mount, nor could I lilo to write the MBR). There may be a way to do all of that, but I don't know what it is.

Finally I broke down, backed up my /etc and installed Feisty from a CD I'd previously made but not used (since I wanted to just update everything in place). I've spent a few hours downloading the other packages I need (postgresql, subversion, g++, apache2, a whole bunch of php, java, openvpn etc) and by morning I'll have a usable system.

I always have my /home on a partition separate from /. Occasions like this remind me of the wisdom of making that choice.

Thursday, May 24, 2007

I broke my laptop

I'd been trying to upgrade to Ubuntu Feisty online but my laptop kept turning itself off after a few beeps. I realized that the fan was not turning on.

I had a spare fan (from a time when I thought the fan wasn't turning on but in fact was just a bit hard starting, somehow that fixed itself and stayed fixed for a year and a half or so). So I decided to replace the fan. Unfortunately, the laptop is an older Winbook model and apparently, in their first few iterations, the case design was rather obtusely inelegant. I've got a more recent Winbook and *that* is *very* much nicer to work with.

So I had to take out a whole bunch of screws (some of which I'm not able to put back in the same place again) and detach some cables and do a whole lot of other work just to get the *power* cable of the fan attached. Replacing the fan was trivial. It was connecting the power cable of the fan that was a pain. I should have just gone to the local cell phone repair shop and had the guy there solder the cut ends of the new fan to the cut ends of the old fan power cable.

I didn't do that though. Instead I actually tried to get the fan connected to power directly. Unfortunately, this involved opening up the laptop to a degree far greater than I had anticipated. And in doing all of that, I seem to have touched something and now the power won't go on. I might bring this laptop to a repair shop (or ship it to the U.S. to be fixed for a fee). It won't be anytime soon though. Instead, I just swapped the hard drive with a slower but much lighter winbook laptop I had lying around, and took the RAM from the bad laptop and put it into the new winbook (after doing some online research to make sure the memory was the same for both models, it was).

Now I've got a laptop that's half the speed (3Ghz to 1.5Ghz but with a bit more RAM 1GB to 1GB+256MB since I just moved the RAM over to the new laptop).

I like the smaller laptop. It's certainly a heck of a lot more convenient to lug around than the 3Ghz desktop replacement. I'm going to miss that 3Ghz though. I hope I can get it fixed. I'd love to keep working with it, despite its weight, for another 3-4 years :-). by then quad-core CPUs will be out and dual-core laptops will be as cheap as these winbooks were when I got them :-).

Wednesday, May 09, 2007

perltidy

perltidy -b -i=4 -et=4 -t -cti=0 -bl [filename]

Friday, May 04, 2007

NEVER buy software that requires activation more than once

The company I work for has a custom program for handhelds. We bought tens of handhelds (might be a hundred by now, not sure) and installed the software on it. Unfortunately, we used Appforge to develop the software. The software requires real-time activation per-handheld device that the software is installed on. If we'd gotten the ISV license, no real-time activation per handheld would have been required, but the ISV license expires every year.

Now Appforge has closed (bankruptcy) and the activation servers have gone dark. We can't install on handhelds which we have licenses for because we have that activate-in-realtime license, not the ISV license.

Now, it wasn't my choice to go with Appforge, I'd have gone with J2ME or similar, probably. But we made the right decision at the time. Development in VB really *was* much faster than in J2ME or something else. We just didn't know that AppForge was in financial trouble. Next time we think about buying anything with similar "copy-protection" though, I'm going to put my foot down. NEVER buy anything that requires that the selling company still be around in order for you to use it. Open source is better, if it's available, but even for payware, if the company you buy it from can turn your service off at will (or when they go bankrupt), walk away.

Tuesday, May 01, 2007

geek gear

I'll never get this

.

It's too dangerous and while I'd enjoy it, my wife won't stand for it.

On the other hand, maybe I can get the tie-fighter desk!

Wednesday, April 25, 2007

graphicsmagick and photobucket

I just discovered photobucket and have been uploading pictures there. I like that I can't even find (in some desultory FAQ searching) what their bandwidth or space limits are. And I really like that I can display those images from elsewhere (can't do that with flickr, need to surf to the flickr link).

I have no idea how these guys make money, but there must be money being made somehow.

When uploading images though, I've just been pushing up 2.5MB images (because my camera is set to take pictures at a very high resolution, have 1GB, will use it all ;-). Even at that high resolution I rarely ever run out of space on the memory stick. I've run out of battery 3 times more than I've run out of memory.

But it's impolite to push up images that large. I don't even dare show them on my other me because they're just too big. It took me all of five days to get up the initiative to install graphicsmagick. I used to use imagemagick and graphicsmagick is a fork of that project. Imagemagick is still around, but I'm just testing stuff out and decided to download graphicsmagick instead.

So now it's easy to increase the jpeg compression while at the same time scaling images to a lower resolution. I haven't decided yet what resolutions to use for thumbnail size and medium size, I'll look around and figure that out tomorrow. I'll ask around too, for what people think is a good "standard" thumbnail size.

mkdir medium
cd medium
for fn in ../*.jpg
do
gm convert -scale 800x600 -quality "75%" $fn `basename $fn`
done

cd ..
mkdir thumbnails
for fn in ../*.jpg
do
gm convert -scale [xw]x[yh] -quality "75%" $fn `basename $fn`
done

and just have a script to rotate left or right.

Tuesday, April 24, 2007

counting your money

I see that US$20 bills have RFID. And so do some euro banknotes.

I don't care that much since I don't intend to visit the U.S. or use U.S. currency for much of anything (if I do, it'll be to receive payment and convert it immediately). And I doubt if I'll ever have euros in any interesting amounts.

What I do wonder is, is it going to be possible for someone walking (or someone with an RFID long range gun) to count how much money is in someone's wallet? Or if not how much exactly, at least count the number of bills there?

Do all the bills radiate the same signal? If they do, then what help would that be with respect to counterfeiting? It shouldn't be hard to create a counterfeit that would radiate the same signal (it might be too expensive today, but I bet 10 years from now it'll cost nothing). And if the bills don't all radiate the same signal (e.g., they radiate something correlated to the bill's denomination and serial number), then it might be possible to deduce how much money is in one's wallet. If it's encrypted, that won't matter much. Banks will need to know how to decrypt it, and once it's in a few hundred bank branches, one of those decrypting boxes is going to get stolen (might even get stolen during a bank robbery) and reverse engineered.

Of course, though, it wouldn't be bad, in the eyes of any government, if people were to shy away from cash transactions and go with electronic transactions instead. Taxes are easier to collect that way.

Wednesday, April 18, 2007

I get pissed off when I look at old code like this:

1. No vertical whitespace between the pg_exec and the if.
Alright, the developer was just ignorant and was following the
bad standards in his environment.

$rs=pg_exec($common2_conn,$query);
if (pg_numrows($rs)==0) {
} else { # if (pg_numrows($rs)==0) {

2. WHAT IS THAT EMPTY BLOCK FOR? DID NO ONE TEACH THIS PROGRAMMER
(dammit, I want to change my title because of idiots like this).

DID NO ONE TEACH YOU != OR <> (yech, but at least it does
exist in PHP).

That code is wrogn anyway, pg_numrows will return -1 on error
(e.g., network goes down, db server reboots, db server daemon
dies, connection disconnected because the server restarts because
someone did a kill -9 on a client).

3. I'm sorry. K&R indention is dumb. Yes, it saves lines, but
we're not in the age of teletypes and 300baud modems anymore,
there's no great need to save screen refreshes. vertical space
is valuable, sure, but clarity and maintainability is more
important.

if (pg_numrows($rs)>0)
{
--- read the rows and do something with them
}

and suddenly there's no else to clutter things up.

There are a lot more stupidities in that program, but this scheisse makes me tired. If that developer were still around I'd fire his ass. Yes, I'm looking at you, A.M.

gmail problem

It's close to 8AM in the Philippines now, so around midnight UTC. We just had a short brownout. It's probably because of summer airconditioning power demand. Last night we had a short (less than 10 minutes) brownout too. This is better than when I came back to the Philippines in 1993 or so when there were 8-12 hour brownouts. Summer nights were terrible then.

I was in the middle of drafting an important (timmy's baptism requirements) email on gmail when the power cut out. Now that it's back (again, less than 10 minutes), I can't get to gmail. google.com and here, blogger, are fine. Gmail just isn't replying though. It isn't a DNS issue, the domain resolves. It just isn't replying yet. Ah well, i'll send myself the incomplete draft from one of my other web-based free email addresses.

Friday, April 13, 2007

pgsql COPY doesn't fire rules

I've got a very large database at $DAYJOB. Two and a half years worth of data takes up around 500GB. The largest table is around 80GB. I use postgresql, and with the right indexes, performance is very good. I've sort of become a specialist at database performance tuning since I've never had the benefit of working with anyone else who could avoid sequential scans on large tables.

So raw query or insert/update/delete performance isn't a problem. However, database management *is* a problem. On rare occasions, I need to vacuum a table, or many tables. That's very hard to do when the table is so large (I stopped the vacuum after 2 hours). It's the same thing when I have to backup a table. pg_dump -t takes a very long time to scan a very large table.

So I decided that I needed to partition the larger tables. Perhaps into per-month tables. My program to load data into the database uses COPY because that's the fastest way to load data into a table. Unfortunately, COPY doesn't fire rules or triggers, so the ON INSERT DO INSTEAD rules didn't fire and the data was still going into the base (parent) tables.

Just yesterday I was scanning through the pgsql-general list and saw Tom Lane say that COPY doesn't fire rules. It didn't strike me as significant at the time since I was thinking of something else. Tonight though, as I was working on it again and, again, finding that rows were going into the base table (or the whole transaction failing, since I decided to add a constraint on the parent so that no rows could insert into it at all), I finally put it together and knew why COPY wasn't doing what I wanted.

It was a simple thing to replace the COPY code with insert statements. Inserts will run more slowly now, (although I might get some performance gain by upgrading to 8.2 and using the new multi-row insert syntax) but the database will be much more maintainable. It'll probably run faster too since most queries will be against the most recent months, so indexes and whole tables for the most recent months will be more likely to fit in the OS cache/buffers and postgres' shared memory.

In any case, I'll keep the old non-partitioned database and the new partitioned database, inserting data into both. When I prove that the new partitioned database is stable and faster, I'll retire the old non-partitioned database.

My last concern is aesthetic. With new rules being added every month (and 2 or more years of data being loaded) a \d on a base table will yield a very ugly list of ON INSERT DO INSTEAD RULES. There's nothing to be done about that though, unless maybe I move the parent tables into a schema and replace them in the public schema with views :-).

Thursday, April 12, 2007

gmailfs slow to connect - fix

I installed gmailfs using apt-get (on my Ubuntu Edgy laptop) because I thought it'd be interesting to see what file format gmail stores emails in. And I thought I'd download all my spam too, to see if my bogofilter classifies them correctly, and for those that it doesn't, train bogofilter with.

I thought there was something wrogn because it just wasn't mounting. A look at gmailfs.log shows:

04/12/07 19:28:15 ERROR gmailfs did not connect in less than 12 seconds, aborting...
04/12/07 19:28:15 WARNING Child process 24621 received SIGHUP, exiting...
04/12/07 19:28:15 INFO Successfully reaped child 24621

Clearly it was timing out. I tried a few more times and finally edited /usr/bin/mount.gmailfs. There's a define right there for the GMAILFS_MOUNTING_MAX_DELAY so I just set that to something higher (64, from the default of 12). Running mount.gmailfs under time shows that it's taking around 30s to complete.

Ah, except the filesystem looks empty. I can't see my email there. Copying files there makes email appear in my gmail Inbox, but I can't get my spam. Ah well. It's still cool, but I'm not sure I can see what use it's going to be to me :).

Tuesday, April 10, 2007

Who would win?

Somewhere at around 1/6th of the way down this Slashdot article Neal Stephenson describes a battle between himself and William Gibson.

Hi-freaking-larious.

In the first instance,

You don't have to settle for mere idle speculation. Let me tell you how it came out on the three occasions when we did fight.

The first time was a year or two after SNOW CRASH came out. I was doing a reading/signing at White Dwarf Books in Vancouver. Gibson stopped by to say hello and extended his hand as if to shake. But I remembered something Bruce Sterling had told me. For, at the time, Sterling and I had formed a pact to fight Gibson. Gibson had been regrown in a vat from scraps of DNA after Sterling had crashed an LNG tanker into Gibson's Stealth pleasure barge in the Straits of Juan de Fuca. During the regeneration process, telescoping Carbonite stilettos had been incorporated into Gibson's arms. Remembering this in the nick of time, I grabbed the signing table and flipped it up between us. Of course the Carbonite stilettos pierced it as if it were cork board, but this spoiled his aim long enough for me to whip my wakizashi out from between my shoulder blades and swing at his head. He deflected the blow with a force blast that sprained my wrist. The falling table knocked over a space heater and set fire to the store. Everyone else fled. Gibson and I dueled among blazing stacks of books for a while. Slowly I gained the upper hand, for, on defense, his Praying Mantis style was no match for my Flying Cloud technique. But I lost him behind a cloud of smoke. Then I had to get out of the place. The streets were crowded with his black-suited minions and I had to turn into a swarm of locusts and fly back to Seattle.


and, yes, there's quite a lot more ;-)

I haven't read all of Stephenson, although I read snowcrash (+5) and cryptonomicon (-3) several times. I might eventually read all of Stephenson's work, but I'm in no hurry. Jerry gave up on quicksilver, I think, at some point, with some disparaging comments on pace, continuity and point. Which is why there's no hurry. I don't agree with some things Jerry says. For instance, he says that U.S. nuclear waste should be dropped down into the subduction zone in the Surigao deep, without compensation to the philippine government, or even coordination or permission. That's more of the same thinking which brought about the Iraq tragedy (where U.S. intervention has killed more than half a million people and led to an exodus of the most productive parts of the Iraqi population). I'm aware that he thinks Iraq is a mistake, but that's just because the U.S. can't win in Iraq. In the Philippines he calculates that the U.S. can bully the government without much of a substantive cost, so he's willing to drop the nuclear waste in philippine territory without payment.

Well, Hell no. if the U.S. wants to drop nuclear waste here, LET THEM PAY FOR IT. And ask for the privilege. It may be completely safe, but we don't care. PAY, or keep the poison on your own land.

Crap, this post got away from me and turned into an anti-US screed again. Ah well, never mind. The U.S. certainly deserves it.

Saturday, April 07, 2007

Greylisting -- bad

At Marco.org there's a short article discussing why greylisting is a bad thing.

I've always thought it wasn't much more than a stopgap. Marco says that his beef is the fact that email is no longer instantaneous because of the delays that SMTP graylisting injects. I agree that's important, but it's not that important to Me since I never send anything urgent in email (I'm aware of graylisting and delays) and I let my mail sit and ferment a few hours, usually, before reading it. Immediacy is important to other people, but it's not a big deal with me.

The reason it's a stopgap is that eventually botnet spammer software and viruses will be modified to retry. When that happens, we'll be back where we started, with spam classifiers.

Likely, then, there'll be some new mode of speeding things up, perhaps by putting fast but not so good classifiers in the front of the queue, passing through anything that clearly isn't spam, and passing the possibles to the heavyweight classifiers like spamassassin (which I can't stand because it's so heavy, I use bogofilter instead, it's simple and I don't mind training it from the command line, but that really doesn't scale and there should be an easy way to train so that non-geeks can use it without trembling).

Friday, April 06, 2007

Advice for young programmers

Jeremy Allison has good advice to himself, if he could travel back in time.


  • If it's not what you love, don't do it

  • Learn the architecture of the machine

  • Reputation is important

  • Proprietary environments are a trap

  • The network really *is* the computer

  • The community is more important than your employer



On an unrelated note, and a bit late for April 1, I was reading about how J Striegel fails the Turing Test. That's amusing in itself, but I was fantasizing about modifying gaim so that whenever it sees "cutie" or "sexy" it replaces the words with "moron" or similar. After all, what kind of people have cutie or sexy in their logins? This would be for my own amusement only. Hmmm, might be interesting to modify evolution the same way. If I receive mail from anyone with cutie or sexy in their email address, it's not like I'd actually want to reply to them, after all. And if I did, it would be a good thing if my mailer were to make any such attempts fail anyway.

Tuesday, March 27, 2007

dropping duplicate email in evolution

I recently had to reload all my mail from gmail again (I have an always-on computer that runs postfix and stores the email in maildir format, fetchmail gets the email from gmail and delivers locally, I then check my mail at that box regularly).

I had to reload because I decided to run a script that I have that removes duplicate emails from mboxes (evolution uses mbox, unfortunately). Due to a brain fart and Ctrl-C, and because the script isn't very smart, I lost some mboxes. It was simplest to just reload everything from gmail, even if it takes three days or so to get everything from gmail.

My scripts used formail and wrote temporary files which, once complete, were written back to the main mbox, with duplicates removed.

I'm switching to a safer alternative. In Evolution, I've created a filter thus:

Filter action is Pipe to Program
The program is /usr/bin/formail -D 9999999 /home/tiger/.evolution/dup-idcache
Action is move to some folder (e.g., ZZZZDups)

I've tested it with a mailbox that was horrendously bloated due to duplicate emails, and it found the dups, kept one email in the original mailbox and moved the duplicates to the designated dup folder). I double checked the emails (well, sampled, since there were too many) and ever dup found really was a dup (same email was in the original mailbox).

This is a much safer way to find dups, although I'll need to Ctrl-E the Inbox regularly, it's not that efficient (runs formail for every incoming email) and evolution doesn't much like the program specification (when I open filters, it shows an error with the filter with spaces converted to %20, etc., so URL-encoded). It's very convenient though and I'll use this until I can figure out a better way (probably hack up a script that hides the parameters and returns what formail returns).

The same technique works pretty well with bogofilter. I'd wondered how to integrate bogofilter into evolution. I'm OK with just finding spam and running bogofilter -s on it directly, so I don't need any fancy interface. For now (well, for my first test run earlier), bogofilter successfully found spam and moved them to a designated folder. I'll see if it catches more spam in the future.

I don't really get a lot of spam anymore. Gmail catches most of what goes there, and the mailserver at work has reasonably good spam filters. But sometimes some spam does get through. I'll see if bogofilter does a good job with those.

Monday, March 26, 2007

Wrong place, and how to transfer

Alright, The link to bacon wrapped inedible crepe was supposed to be on my other me. I'm going to waste some time trying to see if there's a quick way to move it over without having to copy and paste. And if there isn't, well, it may or may not move over, depending on how lazy I feel just then :-).

No Google Browser Sync

I used to use Google Browser Sync. I resisted it for a while, although Ian Sison at Q Software Research kept telling me how great it was. I resisted because I didn't think it would be useful (in the same way I didn't buy a celphone for years, and when I'd got one, I wouldn't send SMS messages because all the replies I got were illiterate). I also resisted using it because I was concerned about security. But BrowserSync won't sync passwords if you don't want it to.

When I finally installed it, it was just as with SMS. Eventually I was using it quite a lot (I also deal with fewer illiterates these days). I've given up on it though. I've removed it from all the firefox profiles I use. The main reason is that browser sync goes insane if the computer goes off without the browser being shut down nicely. Now, that doesn't happen a lot with me since I use linux, but I do occasionally use a computer that isn't on an AVR and when the power trips (gonna have a lot more of those for the next 3-4 months, it's summer now in the Philippines), BrowserSync loses its memory and tries to sync everything from the network when firefox comes back up. That takes too damn long, even on broadband. I don't want to wait 5 minutes or more for the browser to become usable again after a power outage. Once I went to sleep and in the morning it was still trying to sync. Something probably went wrogn with the bandwidth or the connection, but still...

In any case, i found myself cancelling the sync whenever this would happen. I was doing this enough that I finally realized there's no benefit to BrowserSync anymore. In any case, the only reason I really liked BrowserSync was, I could open a whole lot of windows in one browser, close it, go home (or to work, or to QSR, or wherever) start a browser, and have BrowserSync open the same windows/URLs. I was using it as a multi-client session synchronizer. After thinking about it though, I concluded that using it that way is anti-productive. Most of the time, when I'm reading articles from digg or reddit (or my feeds at bloglines) I'm just wasting time anyway. There's far too much to read, I spend too much time on it and not enough time thinking or coding.

Dropping BrowserSync increased my productivity by a bit because I didn't have to wait for syncs after power outages, and I didn't have to read non-work related articles at work. Of course I still read a lot at work. But it's more focused, it's more work related, and it's not synchronized all over the place :-).

Wednesday, March 21, 2007

bacon-wrapped, cheese-filled, battered and fried hot dogs!!!

If syphilis were a product this is what it would look like

But you'll have to follow the link and read the article. Or, hmmm, click here for the image. I would post an IMG link there, but again, that'd be rude.

Tuesday, March 20, 2007

Gmail Loader

Wow, I see that Mark Lyon has developed a Gmail Loader, which can take mail in standalone mail clients and load them into gmail. That's cool. I'd use it, but I've been using gmail so long that I don't even remember some of my old email addresses :-). I certainly don't have those mboxes around anymore.

It'll be very useful though, for when I convince everyone around me to upload their mail to gmail for archiving/backup purposes :-).

I should test it though to see what happens with executable attachments. Currently Gmail blocks executable attachments and even looks inside zip and .tar/.tar.gz files to see if they contain executables, so likely the same happens with uploaded email.

Sunday, March 18, 2007

SQL Injection cheat sheet

SQL Injection cheatsheet is over there

Looks good, so far. Haven't read it all yet. I'm learning a lot though. There are a lot of tricks there that I might have seen before but didn't pay enough attention to.

Friday, March 09, 2007

Apple Not for me

A friend of mine bought himself a MacBook. That's a lovely computer and it's pretty rugged too. It survived having beer fizz up and explode all over the keyboard. Another friend is considering getting the same (MacBook, not the beer).

I've never been one to buy brands, so, while they'll certainly be very happy with their purchase(s), it's not a choice I would have made. At the price the MacBook is going for (close to $2000 in the Philippines), I could get two reasonably fast (but not dual-core) Windows/Linux capable laptops. And since I can get Winbook laptops (or Thinkpad, or HP) from my brother in the U.S., for even less than that, I could get three previously but lighly owned laptops for the price of one MacBook :-). Since I use Linux (it does all I need a computer to do) and didn't much like the Mac interface when I tested it out, there's nothing there to tempt me to go Mac. I might be slowly seduced by a Mac's smooth design (hardware and software) if I had one at work, or if I could borrow one and use it exclusively for a month :-). I doubt, though, if that seductive smoothness would get me to overlook the price difference though. I would enjoy the MacBook, but then forget it and switch back to Linux since $1000 is (to me) much more valuable and useful than whatever psychological benefits I would get from using a MacBook.

On the other hand, I'll work very hard to justify the cost, if I get one for free :-)

in-place upgrade successful but bumpy

I did the in-place upgrade to Edgy and it was mostly successful. I got stuck on one thing though. It seems to be a common bug with upgrade-in-place from Dapper to Edgy. A quick google search finds this:

https://launchpad.net/ubuntu/+source/apt/+bug/64615
http://www.nabble.com/Removing-a-Broken-Package-(courier-authdaemon)-t3331317.html

I only just found those links after I'd fixed the thing though. The fixes suggested there are too scary for me since I'm not an experienced debian user. Instead, I followed the hack that mhulboj suggested at this blog post

He noticed that the courier-authdaemon un-install script was trying to first stop the daemon and that it was getting stuck on the fact that /usr/sbin/courierlogger didn't exist anymore (probably a package dependency thing, something else removed courierlogger, could be fixed in the package by first checking if courierlogger even exists before removing it).

Anyway, the fix was:

sudo touch /usr/sbin/courierlogger
sudo chmod a+rx /usr/sbin/courierlogger

and continue with

dpkg --configure -a
apt-get remove courier-authdaemon

which successfully removed the package. I'm now continuing with the update in place (re-downloading a lot of packages since I also misunderstood something and did an aptitude autoclean :-).

Wednesday, March 07, 2007

Feeling Daring, in place upgrade to Edgy

I'm feeling daring and am going to do the in place upgrade to Edgy from Dapper.

Oh, there's a better link
here
and running update-manager with -c and -d brings up the help page on upgrading to edgy

ten coolest numbers

There's a page that discusses ten cool numbers. Naturally, some of that judgement is subjective. I think the page itself is pretty cool.

I would write about e to the i pi and -1, except, I have no idea how to formulate that in HTML :-) and I'm too proud to read the HTML of CoolNumbers :-)

I like a lot of those numbers. I'm going to read all of that and understand perhaps 20% of it :-). hahahaha. I'm not enough of a number theory geek to know the math. I just know enough to enjoy what I see. Including the parts I just don't grok.

Saturday, March 03, 2007

Downloading FreeBSD

I'm downloading FreeBSD tonight. It'll all be here by tomorrow. I've got a big spare partition because I was finally able to migrate my root directory to a smaller partition, although I had to switch back to lilo to do it.

I'll install FreeBSD tomorrow on that spare 40G partition. I'll then see if I like it. I'll install all my favorite tools, see if I can do everything I need to do in it, and I'll decide whether to switch to it from Linux. I'll probably keep both, actually. Although I'll work in Linux more than on FreeBSD.

I'm told that FreeBSD doesn't quite have the SMP support that Linux does, among other things. That doesn't really matter to me. I don't have two CPUs (or even hyperthreading) on this laptop, although the Toshiba laptop has that. I may install FreeBSD there too, just to see which OS performs better with hyperthreading.

I've got a postgresql performance test case ready to go ;-).

So it's going to be a fun weekend. I'm very happy with Ubuntu just now. If I don't want to keep testing FreeBSD, I'll drop it for Ubuntu Feisty. Or I'll just split that partition and have Feisty and FreeBSD plus my workhorse ubuntu Edgy on the same box. If I can get a copy of Mandriva 2007, I may install that too. Either that or Mandriva 2006 had svk support built in already. I don't use svk a lot, but I definitely need it. So I may split the drive yet again :-).

This whole thing approaches lunacy. Fortunately, I don't actually have the time to try out all of that. I'll certainly test out FreeBSD. I'll almost certainly test out Feisty. Probably won't try Mandriva or NetBSD though. Although, I'm always ready to be surprised by myself.