Archive for January, 2006

"Worriors" - worries outsourced

Wednesday, January 25th, 2006

Everybody has worries, which stay in our minds. For example, Currently, I am worrying about at least a dozen of things (maybe Poles are a worrying nation, or it is just me, don’t know) and, you must admit, it’s hard to stay productive being occupied with worrying.

Hence, during our lunch discussion yesterday we came up with the idea of worriors, to whom you can outsource your worries. To be completely honest this idea came from My Outsourced Life, I think the notion of “worriors” is ours ;-)

The idea is to have a website, where you can submit your worries, which a professional worrior (human or automated) can worry about. You can log in and check what they are currently worrying about or maybe even sign up for a comforting e-mail:

Don’t worry.
We are currently worrying about <> for you.
Yours professional worriors”

This can also be a “worries outlet”: discussions, support groups and of course a great chance for advertising.

TaskJuggler - a project planner software

Tuesday, January 24th, 2006

TaskJuggler is an extremely powerful open-source project management software. Unlike other tools of this sort it is almost completely text-file driven and batch mode (yes, it has a nice GUI as well, but the operation is editing of the text project file). Also, the reports it generates are completely scriptable (actually there’s no other way of doing them). This is different from you’d expect, but maybe for us geeks it’s better to have something that works this way? ;-)

It is really powerful and looks actually usable (unlike some other open-source projects like planner, which aspire to be but are IMO not even close).

Additional advantages I see are: - easy to track changes if you keep the project file in CVS/SVN - can easily script it, so that you can see your project status on the website?

Maybe I will use one day? ;-)

  • List of thermal baths in Switzerland. If you are a hot-spring fan you can use it as your checklist ;-) My favourites are:
    • Vals - excellent both in terms of the surroundings as well as the pools themselves. I really like the “echo well”, thermal pools and the outdoor pools with amazing views. The building itself built in granite is a masterpiece. Note: you need to make a reservation before hand (call or internet)
    • Schinznach - close to Zurich and can get a bit crowded. I like the “river” outdoors and the sauna (need to pay separately).
    • Leukerbad - a bit far from Zurich, but quite nice. The “Burgerbad” is quite bit, but you really cannot compare it to masterpieces like Vals. Amazing views: You can admire the rocky mountains above you while soaked up in warm water…. BTW: Don’t miss the Klettersteig in Leukerbad!
    • Scoul - quite nice. Supposedly the Roemisch-Irish bad is supposed to be what people come to Scoul for, but I never tried it. I the spa you can buy the mineral water per glass… rip-off. You can drink, probably similar mineral water from the marmot fountain for free ;-)
    (0)

BetterShoppper FireFox plugin

Saturday, January 21st, 2006

Bettershopper is a really cool plugin showing doing automatic price comparisons on amazon.com for a number of amazon.XX, alibris or other sites and converts them to your favorite currency. Saves a lot of time and money ;-)

I’ve been using version 1.1, which at some point stopped working :-( Now I discovered that version 1.2 is on its way and you can download 1.2beta2, which works great for me (you can get it here). BTW: it also works with FireFox 1.5.

Great idea and execution. Well done! Looking forward to trying 1.2 out!

Gallery2 - removing "302 redirects".

Monday, January 16th, 2006

I noticed that our Gallery2 webpage has been ignored by Google Images. I researched this topic a bit and found the list of search engine optimization tips for Gallery, among which there was a line about avoiding “302 redirects”.

As it turns out Gallery uses a “302 redirect” to load main.php on the initial load and it is also redirected from index.php, which is claimed to incur some anti-spam penalties for the Google engine. I don’t know whether this is true or not, but to be on the safe side, I decided to remove the reidirects.

Here’s what I did:

  1. Move my site-specific index.php somewhere else.
  2. ln -s main.php index.php
  3. Add the following line in the site-specific config.php:

    define('GALLERY_MAIN_PHP', 'index.php');
    

Everything seems to work now. We will see in a couple of weeks how well it works for the search engines ;-)

Upgrading WordPress1.5.2 to WordPress2.0—my account

Sunday, January 15th, 2006

The new WP2.0 has been out for more than two weeks now and seeing there haven’t been any urgent patches/bug fixes/etc I assumed it is mature enough to be upgraded. Other than that, it seems like a perfect Sunday procrastination task ;-)

I basically followed the official WP upgrade instructions, but as my WP has been somewhat customized, I had to do some extra steps. Here’s what I did:

  1. Backup the database, disable the plugins (SK2 and Markdown).
  2. Move the old WP directory to blog-old.
  3. Install a new blog directory, fix permissions, copy the configuration files.
  4. Upgrade the blog using upgrade.php script.
  5. Check that everything almost works ;-)

That was easy. Now the difficult part.

First, my theme has been somewhat customized (including Diego’s “linky” patch). However, even if WP2.0 still uses WP1.5 theme, some things have been changed (don’t know exactly what and why). To port my changes, I used the following procedure:

  1. Create a diff against “vanilla” WP1.5.2.
  2. Apply the patch on the new WP2.0.
  3. Fix those little changes that didn’t merge.

Second, I once fixed a bug in WP1.5.2 concerning categories counts on the main page. Basically the problem is that the counts reflect only the “posted” posts and the private posts are not counted. However, when you are logged in and click on a given category you get to see all the posts, also including the private ones. Similarly, (sub)categories containing only private items do not show. The patch for WP1.5.2 was basically a one-liner, but it doesn’t work in WP2.0 :( Looking at the relevant file, it turned out that the new version uses precached counts stored in the database, instead of computing them dynamically. Hence, the patch doesn’t and cannot work. There also doesn’t seem to be an easy way of fixing it, so it has to stay the way it is.

Third, I had to upgrade SpamKarma2.0 to SpamKarma2.1 (I still doesn’t want to use Akismet, which is shipped by default in WP2.0).

Fourth, I upgraded Markdown plugin, to a new verison and disabled the new WYSIWYG editor (seems to conflict with Markdown).

Finally, I made a small fix to “linky” code, as it also conflicts with Markdown plugin. As the linky doce uses wptexturize to get the content of the entry Markdown is not converted correctly. I changed wp_texturixe to apply_filters('the_content',...) as the latter calls the plugin conversion function. However, in this case I had to remove extra p tags, or more precisely, remove all p tags alltogether. Finally the code looks like this:

<li id="p<?php the_ID(); ?>">
    <?php echo preg_replace('{</?[pP]>}', '',apply_filters('the_content',$post->post_content)); echo ' '; comments_popup_link('(0)', '(1)', '(%)')?> <?php edit_post_link('(e)'); ?></li>
</ul>

Actually, this had nothing to do with the upgrade, but it was high time I did it.

Now WP2.0 works well for me. It’s slightly more polished on the editorial side, uses some flashy AJAX stuff and has a new theme. It is probably a bit faster, but other than that looks very much like the old version to me ;-)

UPDATE: My old “press it” bookmarklet stopped working. I generated a new one (from the bottom of “Write Post” page) and… it doesn’t look that cool anymore, but it works.

Intuitive table layouting in Latex (package tabulary)

Wednesday, January 11th, 2006

While writing my paper I found out a nice page table layouting package - tabulary). If has the following advantages over tabularx:

  1. The results are “intuitive”, i.e. the table columns can be scaled proportionally to their original width (it takes some manual tricks to make X with different widths). This is similar to HTML rendering in the browser.
  2. Yet you can specify maximum and minimum width for layouting to avioid overly imbalanced tables.
  3. You can use various aligning (C, L, R does exactly what you think it does).
  4. Obviously, similarly to tabularx you can mix the variable-width columns with fixed width ones.

The only problem was that tabulary (v.0.8) didn’t work well for me in all cases. I looked a bit into the code and I think I found the bug (I’m not a TeX expert, so I’m not sure, but it works for me now). The fix is the following one-line patch file:

--- tabulary.dtx        2006-01-11 15:45:03.000000000 +0100
+++ tabulary.dtx.orig   2006-01-11 15:44:29.000000000 +0100
@@ -599,7 +599,7 @@
   \let\TY@checkmin\relax
 \ifdim\TY@tablewidth>\z@
   \Gscale@div\TY@ratio\TY@linewidth\TY@tablewidth
- \ifdim\TY@tablewidth <\TY@linewidth
+ \ifdim\TY@tablewidth <\linewidth
    \def\TY@ratio{1}%
  \fi
 \else

Messing up with command-line arguments in Bash: $*, $@, "$*", "$@",…

Thursday, January 5th, 2006

It’s stupid, but it took me a good hour to figure this out, so maybe I’m not the only one…

I’ve recently had a problem with command-line arguments in my Java program. The problem was that command line arguments containing spaces were parsed incorrectly, i.e. chopped into individual arguments. My initial suspect was gnu.Getopt package I use for parsing arguments, but as it turned out I was wrong.

The real culprit was a shell wrapper script I used to wrap my java code. The code was the following:

java <some parameters> <programm.class> $@

See the problem? I didn’t. You need quotes around "$@" in which case the parameter gets expanded to: "$1" "$2" "$3"... With no quotes the shell expands it to $1 $2 $3, hence all parameters containing spaces get chopped (also globbing takes place in this case).

BTW: There’s also "$*" which is used to combine all parameters into a single one, i.e, "$*" expands to "$1c$2c$3c..., where c is $IFS (or space). Here it’s also important to have it enclosed in quotes.