• Relative vs. Absolute Paths: Which Way To Go?

    A quick search for relative links and image references in my most volumous blog yields about 3000 hits. Switching them to absolute ones is one click away, but it’s no different the other way round: a simple search and replace for about 1700 hits of absolute paths. So which way should I go?

    I don’t see myself moving domains in the foreseeable future, but for me relative paths do have the advantage of being shorter to write when making links and such by hand — that’s the reason for the (almost) 2:1 ratio of relative vs. absolute figures I mentioned. Therefore it’s likely I’ll keep using them even if I now switch the ones I’ve produced hitherto into absolute ones. So I’d have to do this change again at intervals, for all the new links.

    But it’s the same if I went the other way: despite choosing to use relative paths I’d still occasionally pick up links local to my domain using copy and paste, resulting in absolute paths. Anyhow, I don’t think the occasional cleanup chore would be too troublesome either way to warrant not going through with unifying my policy at this point.

    I probably would have gone relative already, if it didn’t hinder direct duplication of hypertext from one site to another. If you bring up the source code for what you see on a web page in order to copy it onto another as such, with links and all, you’ll find out it doesn’t work once the server changes. The relative paths have to be changed into absolute ones before it will.

    I wouldn’t want my site to have that hindrance, because I find it highly annoying myself when duplicating material from places such as Wikipedia. From what I understand, they probably do this because it saves capacity on such a high-profile site. Yet others, worried for their material being exploited, do it for the precise purpose of obstructing the free flow of information.

    I have neither of those concerns, so going absolute doesn’t pose problems — apart from being cumbersome to use, when crafting markup manually, as I usually like to do. So both ways have very strong arguments going for and against them.

    I’d like to have a policy I could stick to, because having to stop and wonder about the practice used in each link I write irks me. From a practical point of view however, the mixed solution I’ve used in the past seems like the most natural and sensible one: to let the circumstances pick the practice in each case. Nevermind the ideal of adhering to a strict policy.

  • [Ratkaisu] Uuden välilehden avaaminen Ctrl + T -näppäinyhdistelmällä Tekstieditorissa

    Lähtökohta
    Olen käynnistänyt Tekstieditorin. Haluan avata uuden välilehden, joten painan Control + T -näppäinyhdistelmää.
    Ongelma
    Tekstieditori ei avaa uutta välilehteä.
    Ongelman syy
    Tekstieditorin vakionäppäinyhdistelmä uusien välilehtien avaamiseksi on Control + N, ei Control + T kuten esimerkiksi Firefox-selaimessa.
    Ratkaisu
    Otan Muokattavat valikoiden pikanäppäimet käyttöön, ja muutan Tekstieditorissa uusien välilehtien avaamiseen käytettävää näppäinyhdistelmää.

    1. Käynnistän Järjestelmä → Asetukset -valikosta Ulkoasu-sovelman.
    2. Ulkoasu-sovelmassa siirryn sen Käyttöliittymä-välilehdelle ja merkitsen siellä olevan Muokattavat valikoiden pikanäppäimet -kohdan käyttöönotetuksi.
    3. Suljen Ulkoasu-sovelman.
    4. Tekstieditorissa avaan Tiedosto-valikon, ja siirrän hiiren osoittimen valikossa olevan Uusi-kohdan päälle niin, että sen taustaväri muuttuu valittuna olemisen merkiksi.
    5. Uusi-kohdan ollessa edelleen valittuna painan näppäinyhdistelmää Control + T.

    Tällöin Uusi-kohtaan liittyvä näppäinyhdistelmä muuttuu vakioyhdistelmä Control + N:stä haluamaani yhdistelmään Control + T, joten nyt voin käyttää näppäinyhdistelmää Control + T uuden välilehden avaamiseen.

    Huomautus

    Tämä ratkaisu ei ole yhteensopiva Sisennä rivit -liitännäisen kanssa, sillä Sisennä rivit käyttää Control + T -näppäinyhdistelmää. Mikäli ylläolevaa ratkaisua on käytetty, Sisennä rivit -liitännäisen näppäinyhdistelmä ei toimi, vaan sisennys sillä täytyy tehdä valitsemalla Tekstieditorin Muokkaa-valikossa oleva Sisennä-kohta.

  • A PHP Regular Expression To Look For Unterminated img Tags

    After I had finally managed to craft this beast, I felt so proud that I just had to share it:

    /(<img([^\/]|\/(?!>))*)>/U

    If I were to try and translate this into common language, it would perhaps go like this: after each occurrence of <img, skip all non-/ characters, and also all occurrences of / immediately followed by a > — up until the next occurrence of >. Unless you have a match at that point — a > without an immediately preceding / — move on to the next occurrence of <img.

    And with each part of the expression in parenthesis, between quotation marks, following the corresponding translation: after each occurrence of <img, skip all (“*“) non-/ characters (“[^\/]“), and also (“|“) all occurrences of / immediately followed by a > (“\/(?!>)“) — up until the next occurrence of >. Unless you have a match at that point — a > without an immediately preceding / — move on to the next occurrence of <img.

    The outermost parentheses (/(<img...)>/U) grab the contents of the unterminated <img> tag apart from the closing angle bracket, so that it’s easy to pair with a “ />” to properly terminate it. Other parentheses are for defining subpatterns.

  • Old news, but news to me: WordPress security key definitions in wp-config.php

    While investigating an entirely separate issue with one of my WordPress installations, I came across this:

    “Beginning with WordPress Version 2.6, three (3) security keys, AUTH_KEY, SECURE_AUTH_KEY, and LOGGED_IN_KEY, are used to insure better encryption of information stored in the user’s cookies. Beginning with Version 2.7 a fourth key, NONCE_KEY, was added to this group.

    If you don’t find the keys in your wp-config.php file, add the keys definitions with reference to Editing wp-config.php – Security Keys, and upload to your server.”

    Step 13: Add security key definitions to the wp-config.php file
    WP Codex

    Since most of my WordPress installations are pretty ancient, and upgrading them has long since become a routine job, this was the first time I heard about this feature. So my blogs have been lacking in this security feature, until now (I set up the aforementioned keys in each of my wp-config.php files).

  • Abduction

    There was something vaguely familiar about the glowing blue backdrop of Windows 7 Beta’s installer. Then I remembered: Fedora 9.

  • Trying Python

    I tried my hands on the Snake, and was quickly defeated. It’s an ugly mess currently from the point of view of an international beginner: 2.5 (Lenny’s version) doesn’t work too well with unicode, and  3.0 isn’t yet in the repos. Ubuntu 8.10 has the basic 3.0 interpreter, but that failed me at the beginning of the 3rd chapter. Apparently the examples there require Tk, which for 3.0 isn’t in the repos.

    I was surprised by the somewhat flaky unicode support in 2.5. This was due to my misconception that Python was new — newer than Java for instance. As I have no background in Python, and no code to support either, I’m just happy they’ve fixed this in version 3.

  • WP:n SVN-päivittäminen ja räätälöity oletusteema

    Päivitin kaikki WordPress-blogit 2.7:ään. Siinä ilmeni, ettei SVN-päivittäminen pelaa kovin hyvin, jos teemana on kustomoitu default: SVN täyttää muokatut tiedostot muokkauksia ihmettelevistä kommenteista (<<<<<<< .mine) ja hakemiston .mine-päätteisistä varmuuskopioista (tjsp.).

    En keksinyt tähän äkkiseltään parempaakaan ratkaisua kuin kopioida (cp -a) kustomoidun teeman kokonaan uudelle nimelle, tuhota .mine-tiedostot ja nuo SVN:n lisäämät kommentit (sed -i '/blaablaa/d') kopiosta, sen jälkeen tuhota default-hakemiston kaikkineen (rm -rf) ja lopuksi noutaa uuden kopion alkuperäisestä defaultista SVN:llä (svn up).

  • My first ticket in the Debian BTS

    Just filed my first Debian bug — yay! And a boo to reportbug for not wrapping the lines and failing to mention it. Either would have resulted in a nicer layout on the web page: I could have wrapped the lines myself, had I known this. Oh well, I’ll know next time.

    Also, despite picking ‘novice’ mode in reportbug’s initial configuration, I was confused by the SMTP question “Do you have a “mail transport agent” (MTA) like Exim, Postfix or SSMTP configured on this computer to send mail to the Internet?” Since exim4 is installed by default, I picked the default (yes), and this resulted in my first report being lost, a fact which I could only verify by looking at exim’s log (which a true novice probably couldn’t do). There was no error message, and even worse, reportbug claimed to have sent the report successfully when it had in fact not done so.

    But anyway, I was fortunate to spot the broken link on debian.org, as that was a perfect excuse for finally trying this bugreporting thingy.

  • RIAs and Free Software

    Some issues with RIAs I’ve been wondering:

    • How come there’s no Flash-based Ogg player? Actually, it seems that a Vorbis player is being worked on, which is great, but I’m still puzzled that this hasn’t come about way, way earlier.
    • How come there’s no Flash-based Ogg player that would work with the free Flash player implementations? Granted that having one that works with the non-free plugin, which is the most prevalent, is of massively bigger importance for spreading Ogg, than having a fully freedom-friendly one. And also, those of us who choose to use the free implementations probably have no problems playing back Oggs without a Flash-based player. However, I’m not trying to be critical here; these are just issues that I find confusing in how the free software community works. (More on this below.)
    • Is Flash a non-free format? Is there such a thing as a ‘non-free format’, or am I just confused in my terminology?
    • Are there any truly free RIA platforms? I know of none. Based on what I understand from the Wikipedia article, Moonlight can hardly be considered one, given its MS-imposed restrictions.
    • If there aren’t any truly free RIA platforms, why not?

    As I said, this isn’t a criticism. I’m just genuinely puzzled by these questions and how the community works. More generally, I would presume that it would be natural for those striving to free people from non-free formats and software, to begin from their own side of things (the free software world), and from there to reach towards those still locked in. This would pave a nice, finished road for the unfree to flock back to the other side with them.

    Let’s say a locked-in user comes to contact with Ogg through a Flash-based player on the web. They then, through proper evangelising, start to contemplate switching to a free Flash player. But if the free player can’t play the Ogg files displayed on their favourite sites, they face the added difficulty of having to try and get them to play otherwise.

    If, instead, they’d find that the free Flash implementation they’ve now switched to plays the Ogg player just fine, they won’t have to go through the hoop of getting the Oggs to play otherwise — at least not until they start contemplating ditching Flash altogether for being a non-free format.

    And what about ditching Flash, if you still want to have RIAs in your truly free world? With Ogg itself it seems to me that the work began as it should have, with laying the foundations by creating a free alternative. But what if there’s no free alternative for the non-free RIA platforms?

  • Miro 1.2.8 is in the archive

    No need to compile Miro 1.2.8 for Lenny anymore, just pick it up from your local ftp mirror’s pool. It hasn’t yet migrated to testing and I don’t know if it will, but it (1.2.8-1) seems to work ok for me at least. And it fixes the issue with YouTube subscriptions, which was why I wanted to upgrade in the first place.