Author: Jani

  • Dupes? In my Netvibes? It's more likely than you think.

    Since at least Monday, all the feeds I’ve subscribed to with Netvibes have been suffering from massive amounts of fake “new” entries; that is to say entries I’ve already marked as read are being reported as being unread. This has occurred occasionally in the past with individual feeds (Boing Boing being particularly susceptible), but never to this extent either in frequency or breadth of susceptibility. So it’s not likely to be due to the feeds themselves, but rather a flaw of Netvibes.

  • [Ratkaisu] Pakettienkäsittelyohjelma ja LHA-tiedosto: Arkistotyyppi ei ole tuettu

    Lähtökohta
    Kotihakemistossani on arkisto.lha -niminen, LHAlla pakattu arkistotiedosto. Haluan purkaa sen sisällön, joten avaan tiedoston Pakettienkäsittelyohjelmalla.
    Ongelma
    Pakettienkäsittelyohjelma ei näytä arkistotiedoston sisältöä, vaan seuraavanlaisen virheilmoituksen:

    Tiedoston "arkisto.lha" avaaminen epäonnistui
    
    Arkistotyyppi ei ole tuettu.
    Ongelman syy
    Lha-pakettia ei ole asennettu.
    Ratkaisu
    Asennan Synaptic-pakettienhallinnassa lha-paketin. Sen jälkeen voin avata ja purkaa LHAlla pakatun arkistotiedoston Pakettienkäsittelyohjelmalla.
  • X.org, i740 and blank console after startx

    I ran into this problem while testing X with OpenBSD 4.3: the console went completely blank after firing startx — that is, switching back to other virtual terminals while X was running would only display a black screen. And that was all I got after hitting Ctrl+Alt+Backspace from X, too: nothing but black. The command-line was still there alright, as I could blindly startx again and get X to show up, but the console terminals remained invisible until the next reboot.

    The display adapter I was using was an Intel i740 with the driver set accordingly in xorg.conf. I didn’t manage to get the video BIOS upgrading soft (Vflash.exe) from Intel to work, and never found the root cause of this problem. It was probably either the card itself or the i740 driver. I suspect that because once I swapped the card with an extra Radeon 8500LE I had laying around, and the switched to the ati driver, console VTs worked like a charm. Also, with the i740 in place they did work by using the basic vga driver, so my best bet as for the culprit would be the i740 driver.

  • How to identify a stylesheet in JavaScript

    I have been (mis)using the title attribute of stylesheets to identify and grab a specific one for further processing with my JavaScript. I did this by comparing stylesheet.title with a specified title for my embedded stylesheet. However, as I didn’t really intend the titled stylesheet to be a preferred one, once I added a title to another stylesheet higher up in the document, my other one (being lower in the document hierarchy) stopped working.

    This lead me to investigate the real significance of title, when applied to stylesheets. From what I’ve read, I have to say I’m somewhat confused by the logic with which the attribute has been named. After all, a title applied or left unapplied, to just about anything else on a web page is completely harmless, save perhaps for some decrease in the fine-tuning of your site’s accessibility. A title with relation to a stylesheet however, is so significant that HTML 4.01 categorizes stylesheets according to the presence or absence of a title. Although I don’t claim to know anything about writing specifications, I think they should have associated this categorization with the rel attribute, or at least name it differently so its significance wouldn’t get blurred by the use of title elsewhere. A stylesheet’s title‘s role would then reduced to accessory information similar to what it is when associated with, say, an a element.

    Anyway, I’ve now come up with what I at least think is a better way of identifying my embedded stylesheet. I tag the style element with an id attribute, and then compare stylesheet.ownerNode.id with whatever the string I’ve tagged it with is. I’m not sure if it’s the correct way or even whether there is one, but it seems to be working and is valid. From the specification I gather there is no id attribute associated with style in HTML 4, so it probably wouldn’t validate there. This isn’t a problem for me, since I nearly always use XHTML (Strict).

  • Mirroring a WordPress blog for offline viewing

    I’m making a note of this for my own future reference.

    As a premise, you need the blog to have pretty permalinks. There might be a way to make wget handle those http://site.com/blog/?p=123 -type URLs so that they can be viewed offline, but for me the easiest way around this was to simply switch to the Day and name option in Settings → Permalinks. That way individual posts will have URLs ending in slashes, resulting in the content being saved to a good old index.html inside a subdirectory, in the local copy.

    So obviously, if you’re mirroring someone else’s blog, whose settings you don’t have access to, and which doesn’t use pretty permalinks, you’ll have to find another way to make the downloaded filenames work.

    Otherwise, you’re good to go: fire up wget like this:
    wget --convert-links --mirror --no-parent --no-host-directories http://site.com/blog/

  • [Solved] WordPress: Cannot update permalink structure

    I ran into this strange problem, where the changes I made on the Customize Permalink Structure page of a WordPress 2.5.1 installation wouldn’t get saved, no matter how many times I pressed the Save changes button.

    Well, it turns out, for some reason you need to have JavaScript enabled for it to work.

  • [Ratkaisu] Firefoxin älykkäiden kirjanmerkkien poistaminen käytöstä

    Lähtökohta
    Firefox-selaimen versio 3 on tuonut kirjanmerkkipalkkiin Älykkäät kirjanmerkit -alasvetovalikon.
    Ongelma
    En pidä älykkäitä kirjanmerkkejä tarpeellisina. Haluan ne pois haaskaamasta tilaa kirjanmerkkipalkissani.
    Ratkaisu
    Osoitan kirjanmerkkipalkin Älykkäät kirjanmerkit -kohtaa hiiren osoittimella, ja avaan ponnahdusvalikon hiiren oikeanpuoleisella napilla. Valitsen valikosta kohdan Poista, jolloin älykkäät kirjanmerkit poistuvat kirjanmerkkipalkistani.
    Mikäli myöhemmin haluan älykkäät kirjanmerkit takaisin, avaan Firefoxin asetussivun, joka on osoitteessa about:config, ja etsin sieltä asetusavaimen nimeltä browser.places.createdSmartBookmark. Asetan avaimen arvoksi false, minkä jälkeen sammutan Firefoxin ja käynnistän sen uudelleen. Tällöin Firefox luo uudestaan älykkäät kirjanmerkit kirjanmerkkipalkkiin (ja asettaa samalla browser.places.createdSmartBookmark -avaimen arvoksi true).
  • Tulostaminen Firefoxista ei toimi

    Lähtökohta
    Tulostimeni on USB-liitännän kautta tietokoneeseeni kytketty Epson Stylux C42UX. Olen ladannut siihen paperia, ja käynnistänyt sen.
    Lataan Näytön lukitseminen pikanäppäimellä -ratkaisumerkinnän Firefox-selaimeen. Haluan tulostaa merkinnän, joten valitsen Firefoxin Tiedosto-valikosta kohdan Tulosta.... Valitsen avautuvan ikkunan tulostinlistasta tulostimeni (Stylus_C42), ja määrittelen tulostusalueeksi pelkästään ensimmäisen sivun valitsemalla Tulosta sivut -otsikon alla olevan Alue-kohdan käyttöönotetuksi, ja kirjoittamalla siihen liittyvään tekstikenttään 1-1. Lopuksi painan ikkunan alalaidassa olevaa Tulosta-nappia.
    Ongelma
    Sivu ei tulostu. Sen sijaan näytölle ilmestyy otsikoton ikkuna, joka sisältää seuraavanlaisen virheilmoituksen:

    XML-jäsennysvirhe: virhe käsiteltäessä ulkoista olioviittausta
    URL: chrome://global/content/printProgress.xul
    Rivinumero 6, sarake 67:<!DOCTYPE window SYSTEM "chrome://global/locale/printProgress.dtd">
    ------------------------------------------------------------------^
    Ongelman syy
    Firefoxin suomennokset sisältävässä kielipaketissa on ohjelmavirhe, jonka takia tulostaminen ei toimi Firefoxissa.
    Ratkaisu
    Ratkaisua ei vielä ole. Ongelman voi kiertää ottamalla XULRunnerin kielipaketin pois käytöstä seuraavasti:

    1. Valitsen Firefoxin Työkalut-valikosta kohdan Lisäosat.
    2. Valitsen avautuvasta Lisäosat-ikkunasta Kielet-välilehden.
    3. Valitsen Kielet-välilehdellä olevalta listalta Xulrunner (fi) -kohdan, ja painan siihen liittyvää Poista käytöstä -nappia.
    4. Painan Lisäosat-ikkunan yläosaan ilmestyvää Käynnistä Firefox uudelleen -nappia.

    Kun tämän jälkeen otan merkinnän uudelleen esille ja kehotan Firefoxia tulostamaan sen, tulostaminen toimii.

  • WordPress: Get permalink outside the loop

    $ID = $wp_query->post->ID;
    $permalink = get_permalink($ID);

    Adapted from Skippy.

  • [Ratkaisu] Englanninkielisen virheilmoituksen näyttäminen

    Lähtökohta
    Käyttöjärjestelmäni on suomenkielinen, eli locale-komennon antama tuloste näyttää seuraavalta:

    LANG=fi_FI.UTF-8
    LC_CTYPE="fi_FI.UTF-8"
    LC_NUMERIC="fi_FI.UTF-8"
    LC_TIME="fi_FI.UTF-8"
    LC_COLLATE="fi_FI.UTF-8"
    LC_MONETARY="fi_FI.UTF-8"
    LC_MESSAGES="fi_FI.UTF-8"
    LC_PAPER="fi_FI.UTF-8"
    LC_NAME="fi_FI.UTF-8"
    LC_ADDRESS="fi_FI.UTF-8"
    LC_TELEPHONE="fi_FI.UTF-8"
    LC_MEASUREMENT="fi_FI.UTF-8"
    LC_IDENTIFICATION="fi_FI.UTF-8"
    LC_ALL=

    Kun suoritan Päätteestä komennon ls /asdfgh, eikä hakemistoa /olematonhakemisto ole, komento antaa seuraavanlaisen virheilmoituksen:

    ls: tiedostoa /asdfgh ei voi käsitellä: No such file or directory

    Virheilmoituksen alkuosa on suomenkielinen, kuten sen kuuluu ollakin.

    Ongelma
    Suomenkielinen virheilmoitus on hakusanana paljon tehottomampi kuin englanninkielinen virheilmoitus, kun etsin ratkaisua ongelmaan. Haluan suorittaa komennon siten, että näen sen antaman virheilmoituksen englanninkielisenä.
    Ratkaisu
    Suoritan komennon siten, että nollaan kielen komennon suorittamisen ajaksi oletukseensa, seuraavasti:

    LC_ALL=C ls /asdfgh

    Tällöin komennon antama virheilmoitus näkyy kokonaan englanninkielisenä:

    ls: cannot access /asdfgh: No such file or directory

    Komennon suorittamisen jälkeen kieliasetus palautuu ennalleen, eli virheilmoitukset ja muut tulosteet näytetään jälleen suomenkielisinä.