Archive for the ‘Unix / Linux / *BSD software’ Category

My Technorati ranks "toy"

Monday, May 21st, 2007

Inspired by Carlos Andrade’s own tool, I’ve just coded a couple of scripts to take an OPML file and show an ordered table of Technorati ranks. Naturally, I used it for my own Planet site, Planet Atheism.

Here it is: Technorati Ranks for Planet Atheism members

The implementation was ridiculously simple (and there’s a lot of room for improvement), but, other than Carlos’ tool, I didn’t find any scripts or utilities to do this. And, yes, I searched. Therefore I may release the code soon, as the 2nd project on software.dehumanizer.com, since this can be a fun “toy”. :)

[EDIT: added each blog's Google PageRank to the table. Why not? :) ]

Using 64-bit Firefox on Linux

Thursday, April 19th, 2007

Since the dawn of 64-bit Linux distros, they have included 32-bit versions of browsers such as Firefox, because there aren’t 64-bit versions of plugins such as Java (the 64-bit version doesn’t have a plugin) or Flash.

A couple of days ago, however, I was reading the “what’s new” list for Suse 10.3 Alpha 3, and found this entry:

On x86-64: Firefox is now a 64-bit package and uses nspluginwrapper to handle 32-bit i386 plugins if needed.

Naturally, I had to investigate. I downloaded a 64-bit build of Firefox from Autofox, and nspluginwrapper. With that wrapper, I can use Flash without any problems. (Not Java, though; I think Blackdown offers a 64-bit plugin, but it’s Java 1.4.2 only. But I have found out that I don’t miss Java in the browser at all, for the past few days.)

The browser feels faster. I tend to use bookmark folders to open dozens of bookmarks at the same time on different tabs, which actually makes the browser “hang” for a couple of seconds, and those delays seem shorter now. No, I didn’t do any benchmarks. But the overall experience just “feels” better. It even appears to be more stable, though that may actually come from the fact that I’m using a 2.0.0.4pre build, which is the latest version (2.0.0.3) plus bugfixes… or maybe it’s because this version was built with a non-ancient, and possibly less buggy compiler.

Announcing DailyTasks 0.1

Friday, February 9th, 2007

A few minutes ago, I submitted my first piece of software to Freshmeat (it hasn’t been approved yet; it will probably take a few hours): DailyTasks. It’s a small utility, written in PHP, with both a command line mode and a web interface, which, surprisingly enough, reminds you of daily tasks. :)

The web page linked above tells the “story” in more detail, but, basically, I’m much too chaotic to use traditional task management programs (every time I tried, I seemed to spend more time updating tasks than actually doing them), but I wanted something to remind me, every day, of doing something — from “clean up GMail’s spam folder” through “update a blog” to “do the laundry, if necessary”. :) There was already a similar program (frequent-task-reminder), but it lacked some features that I wanted (such as non-accumulating tasks), and so I wrote my own.

It’s really basic stuff, with no bells and whistles, and the PHP code would probably scare you, so impressionable young people should avoid looking at it. :) But maybe — just maybe — you’ll find it useful.

More about tidying up HTML

Tuesday, February 6th, 2007

If you’re curious about the last post

I accept that making some HTML code validate in validator.w3.org shouldn’t be the be all, end all of the problem. A piece of code can validate and yet be… horrible. On the other hand, a piece of code may not validate because of a minor problem, and yet be better than 99% of what you see out there.

Still, that applies mainly to your code. What if you’re aggregating other people’s code? What if they’re using bad HTML, which their blogging systems (mostly Blogger or WordPress) automatically converts to a feed, which is then converted back to (simplified) HTML by a Planet? And what if you want all of that to validate?

Well, tidy works very well; it fixes the worst problems, mainly, badly nested code, and unclosed tags. But… well, if you’re being pedantic (like the W3 validator is), then there are still problems.

They’re mostly one of the following: 1) img tags without an “alt” attribute, and 2) proprietary attributes.

tidy, by default, doesn’t deal with those (since its point is for you to correct your code, and those problems should really be fixed in the code itself). But you can make it do so.

How? Well, here’s the command line I’m using for Planet Atheism:

/usr/local/bin/tidy -wrap 79 -m -i -utf8 --alt-text "" --drop-proprietary-attributes 1 -asxhtml filename

It should be obvious what each parameter does. The “ alt-text "" ” part adds some empty alt text to any img tag that hasn’t got one. The “--drop-proprietary-attributes 1” part removes those weird attributes inside other tags, which make the W3 validator choke. I don’t want them anyway, since a Planet site is supposed to display a basic version of a post — not a Flash-y, YouTube-d, animated one.

The result is: complete W3 validation, and readable code. From many other blogs, by many different authors. Automatically. What more could anyone want? :)

Adventures with moonmoon and tidy

Tuesday, February 6th, 2007

As I’ve mentioned here before, for Planet Atheism I’m using moonmoon, mostly because 1) everyone else uses planetplanet, and 2) it’s in PHP instead of Python, and I know a little PHP. :)

moonmoon is still on version 0.2, however, and, while it removes “dangerous” tags from feeds automatically, it doesn’t (yet?) deal with unclosed tags. As most of PA’s members are as far from being geeks as possible, they tend to use WYSIWYG editors, and aren’t really worried about “validating HTML”. So, from time to time, a post would make every other post after it show in bold or italic. Annoying, to say the least.

Yesterday, it was even worse: some posts “spilled over” to the sidebar. And it wasn’t just one post causing it, but two, from different blogs, at the same time!

Well, enough was enough.

“Fixing” moonmoon (or, more precisely, SimplePie) was out of the question; I simply don’t know enough PHP / XML parsing to do it. But I tried something else: I saved the generated HTML to a file on the site’s directory, and used tidy on it. Surprise: this new version was perfect! So, I got the idea of using tidy on the generated HTML every time.

Now, PHP has a tidy module, but in PHP5 I would have to compile PHP by hand. Ubuntu doesn’t have a package for that module, unfortunately, and I really didn’t want to make an exception from using apt packages on that server. So, I had to find another way.

My solution was to dump all the page into a buffer (using the ob_ functions in PHP), save it to a temporary file, use the system command to apply tidy on it, load the altered file, and show it to the browser. It’s probably not very efficient, but it works… better than I expected, too. It may be a crude solution, but I’m proud of it anyway. ;)

Blog moved

Saturday, November 18th, 2006

I finally had some time today to move Way of the Mind (note the new URL) to my Slicehost virtual server. The new WotM Forum is also up, using MyBB, instead of phpBB like my other two. So far, I’m liking it (MyBB) a lot, though it’s a bit weird to have the entire theme inside the MySQL database instead of normal .php or .css files. :)

Moving the WordPress blog was simply a question of following these instructions. Basically, you go to the WP options in the old blog, change the 2 URL fields to the new address, dump the database, do a search & replace to change any images and other URLs in the database to the new address, import the database to the new server, copy the files, and that’s the proverbial “it”.

As for redirection, there came the eternal dilemma: if you redirect everything, then people will be lazy and keep using the old address (thus wasting your bandwidth); if you don’t, it’s inconvenient, and you lose everything you had in terms of incoming links and SEO.

What I did was to redirect (301, to signify a permanent move) every URL except the front page, which shows a message telling people about the change, and redirects after 5 seconds. I believe that this is the best of both worlds. Any link to an individual post will be redirected transparently, but whoever arrives at the front page will told about the change of address, encouraging them to update their bookmarks.

That user-friendliness thing again

Thursday, November 2nd, 2006

I was replying to the following comment by Bruno Rodrigues in the Firefox tab annoyances post, but I think that this deserves a new post; it’s a different subject, and longer than an average comment. :)

Uhhh? Obviously everyone *knew* that triple-click-control-middle-abcde-enter-enter-space(*) with your leg above your back would close a tab. What would *you* be thinking about? If Apple has close buttons on each tab, and not a single close at the right side, nor no-buttons at all, what do you think is the best user experience?

(*) did you know that most computer-savy users *still* don’t know about the right mouse button? Unbelievable, but true.

Two big problems tere, IMO. First, “triple-click-control-middle-abcde-enter-enter-space with your leg above your back” is a strawman attack. You can’t present something absurd as your opponent’s position, show that it is indeed absurd, and then pretend that you have refuted his original position as well. Middle-click is simple, quick and pratical, and your example isn’t. Sorry, I’ve been reading a lot about logical fallacies on Wikipedia. :)

Second, you seem to equate Apple with user-friendliness, which is an argument to authority: if Apple does it, then it must be correct. If Apple does it that way, then that must be the most user-friendly way possible.

Well, telling people about the middle button would be a much better idea than introducing multiple “dangerous” close buttons that only get in the way anyway… but maybe that’s just me.

Should the close buttons be added simply because Apple does it? Like I said, I don’t agree that Apple should be considered the “standard” for user-friendliness. If it was, then it would never change, would it? It would already be perfect. But it isn’t.

A thing should be as simple as possible, but not simpler (paraphrasing Einstein). If you take away usefulness (note that I don’t say “features”, but real usefulness) just to make it simpler, you’re making the software less useful. If the software doesn’t do what I want it to do, then it’s not useful to me, even if it’s the most easy to use piece of software in the world… right?

And, historically, that’s what Apple did (I admit that I haven’t used MacOS X yet, though I was familiar with previous versions). Their philosophy was: “normal” users should never need to do this, so we’ll actively prevent people from doing it – even if they happen to be advanced users. For some reason, I have a problem with this kind of attitude. To be fair, I don’t know if it’s changed in OS X.

Besides, “user-friendliness” is a subjective concept. To most people, the most important thing for a piece of software isn’t really being simple, clean, or logical, but simply being what they already know. Between Windows XP and MacOS X, they’d say Windows was more “user-friendly”, merely because, with MacOS, they’d have to learn new stuff – which is the thing people hate the most about computers.

The close buttons on tabs waste space, make it easy to close tabs by mistake, are harder to click on than the entire tab, and there was already a quicker, easier way to do it. People don’t know about it? Find a way to tell them. Hell, pop up an information window the first time a user opens a new tab, or something. It’s much better than adding a redundant, confusing feature that will only make the browser more difficult to use to anyone who already knew how to close tabs quickly.

What’s next? Take tabs away completely, because many people don’t know how to use them anyway, and they only make the browser “more confusing”?

Fixing tab annoyances in Firefox 2.0

Thursday, November 2nd, 2006

Firefox 2.0 has been out for a while, and the response to it has been mostly positive.

However, there were a couple of changes to how tabs work, and I, for one, didn’t like them at all. Looking around, I found the solution to one of them, and the other one was pretty easy to figure out.

Here’s the changes, and how to “undo” them:

1- “X” close button on every tab

This one, to me, qualifies for the “What were they thinking?” award. :) Don’t people know that you can close any tab simply by middle-clicking on it (yes, even on Linux)? Not to mention that the “X” button is both harder to click on than the entire tab, and makes it easy to close tabs by mistake, when you just wanted to select it? In other words, there’s already an easy way, and they add a more difficult way, which, besides, can easy lead to mistakes?

Sigh. Sorry about the rant. :)

Fix: open about:config, look for browser.tabs.closeButtons, and set it to 2 (no close buttons) or 3 (a single close button on the right of the tabs, like in previous Firefoxes – though, again, middle-click makes it useless).

2- tabs don’t get smaller past a certain point; if you have too many, you need to scroll the tab bar to see them all

Maybe I’m weird, but I have tab folders with 10-15 bookmarks of a particular subject, and I like to open them all, with a single click, daily. In Firefox 1.x, the tabs would get as small as they needed to be, to fit in the window. Now, they don’t get smaller than a certain size, and force the user to scroll.

To me, this is annoying. I haven’t found an option to completely disable this behavior, but I can make it virtually go away by reducing the minimum tab width to a much smaller value.

Fix: open about:config, and change browser.tabs.tabMinWidth to a much smaller value, like 1.

AWStats fix for Portuguese search engines

Monday, October 30th, 2006

If, like me, you use the current CVS version of AWStats, you may have found that, since they recently added Sapo to its list of known search engines, if your web site is located in Portugal (like mine are), your top search query is, suddenly, “Resumo“. Even if your site is in English. :shock:

“Resumo” is, in this context, Portuguese for “short version“, and it’s included by default in all Sapo queries. But why is this happening?

I’ve tracked it down to an AWStats bug, which I reported to the author, along with a patch. That patch, in addition to fixing that problem, also adds support for Clix queries. For more details, including the patch itself, please visit the SourceForge page for this bug.

WordPress 2.0.5 is out

Sunday, October 29th, 2006

As usual, get it from the usual place, and follow the instructions if you’re upgrading from a previous version. I’ve just upgraded 11 blogs in about a minute (most of which was spent backing up the databases and the files, in case Something Bad ™ happened).

List of changes here.

Apparently, there’s a new problem when running on a server with FastCGI installed: it may give a 500 error in some cases. If that’s your situation, there’s a workaround.


Creative Commons Attribution-NonCommercial-NoDerivs 2.5 Portugal
This work by Pedro Timóteo is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 2.5 Portugal.