computer

Aug 192013
 

nirgends habe ich im internet das wurzelzertifikat für die nutzung des 802.1x netzes der uni tübingen für leute mit uni-tuebingen.de nutzerkennung zum anklicken gefunden und ueberall, wo die url einsehbar ist, kann man sie weder anklicken, noch ordentlich rauskopieren. das nervt auf einem schlauen telefon ja schon einigermaszen, diese adresse ab- und einzutippen. deshalb hier als link:

http://www.pki.dfn.de/fileadmin/PKI/zertifikate/deutsche-telekom-root-ca-2.crt

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

Sep 032012
 
Saving encoded as UTF-8 without BOM in notepad++

i nearly went crazy the other day when i tried to write a simple php script that would read a json-formatted database file into an array. it simply wouldn’t work and the worst thing was that it had been working shortly before that. but all of a sudden, the perfect and well-formed json file which had been nicely read into an array using the json_decode() function of php simply would only give back NULL as a result.

after hours and days of meticulously checking the json file again and again, and the function as well, searching the internet forums up and down to no avail i found the bug. it was so annoying that i need to help anyone stumbling across the same problem by writing it down here.
i have saved the json file (utf-8 encoded, which is important for the json_decode function of php to work!) in different editors: in notepad++ on windows and gedit on linux (and i had done so before, i.e., before the problem first emerged). as it turns out, for some reason that was neither retraceable nor intelligible to me, at some point the file was saved encoded as utf-8 with a byte order mark (BOM).
don’t ask me why that BOM is needed and what it is exactly – i am sure there are good reasons for the BOM to be included in documents – but it was a) not readily apparent that such a mark was included in the file (fucker’s invisible!), nor was it clear that and why it would jack up the json_decode() function in php. i finally realized something was wrong with the file when i saw that – contrary to the file itself which showed no problems in the editor – the content of the json file, when read with the file_get_contents() function (without transforming contents into an array) and print_r()d into the html, had this little mark at the beginning:



this character string is in fact the BOM and you need to get rid of it using an editor that offers a flexible option to chose encoding, so that json_decode() does what you want. to fix this bugger in notepad++, simply chose ‘Encode in UTF-8 without BOM’:

Saving encoded as UTF-8 without BOM in notepad++

Saving encoded as UTF-8 without BOM in notepad++

and magically, the damn thing works again.

lo and behold, of course i did find a similar comment and alert to the problem in one of the comments in the php manual at php.net where i did not look far enough – simply because i did not look for “BOM” as i didn’t know yet: http://www.php.net/manual/en/function.json-decode.php#107107. in this comment, another solution for the problem is offered that does not necessitate caring too much for the json file itself, but rather prepare the contents before it gets fed to json_decode(). of course, that may be considered more elegant (or not, as you need more convoluted code in the script), but it definitely tempts to take attention away from coding proper json files and instead rely on some code later fixing the problem if it exists. so i do not recommend it – why not avoid the problem altogether instead of fixing it later?

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

Aug 152012
 

i was trying to customize recaptcha 1.11 so that it would show instructions in a language different than english (mind you, showing words to recognize in different languages appears not be available yet, this post only concerns the language of the instruction).
according to this instruction this can be achieved by inserting a javascript snippet before the form in which the recaptcha appears:
[codebox 10] source: https://developers.google.com/recaptcha/docs/customization#i18n.

this does not work, however. this is especially annoying if you have dynamic language content on your original page and want to administer different languages (also through to the recaptcha widget) depending on user settings. but here’s a work around until this gets fixed:

  1. open the file recaptchalib.php from the folder in which recaptcha resides.
  2. find the function recaptcha_get_html
  3. change [codebox 1] into [codebox 2][adding $language as a parameter to the function]
  4. add this: [codebox 3] as the first statement in the function, so that the whole thing looks like this:[codebox 4]
    this bit ensures that you can pass a language parameter to the function, but if this language parameter is anything other then the languages available at this time (dutch=nl, french=fr, german=de, portuguese=pt, russian=ru, spanish=es, turkish=tr), then english will be chosen.
  5. then find, still within the function recaptcha_get_html, this line: [codebox 5] and change it to [codebox 6]. also change this line: [codebox 7] into [codebox 8] still within the same function.

note that the requests to the recaptcha api now submit the extra parameter hl with the value of the language you want.

  1. now, within your original script, instead of using the original function recaptcha_get_html with only one parameter ($publickey) you would insert [codebox 9] which calls the function you edited above with the extra parameter of the language. $lang_pass is in this case the language parameter you get from somewhere else in the script.

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

Dec 232009
 

in thunderbird 2, the shortcut for ‘show the address book’ was CTRL+2. it apparently was changed to CTRL+SHIFT+B in thunderbird 3.

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

 Posted by at 12.12 am
Nov 092009
 

bei welchem web angebot ich seit einer stunde versuche, eine fahrkarte zu kaufen? na???

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

nachtrag 20:40. so, die fahrkarte ist ergattert, 1h 40 minuten nichtstun, auf fehlermeldungen starren und wie ein eichhoernchen refresh druecken und damit 150 euro gespart – eigentlich nicht schlecht. fuer 40 euro von rottenburg am haesslichen neckar nach hamburg an der haesslichen elbe und zurueck. das geht.
aber mal im ernst: das geht doch wohl gar nicht: da ruft die bahn vollmundig ein riesen tolles angebot aus und 2 minuten nach beginn der verkaufszeit schmieren die server ab. das wussten die doch vorher… das quelle, ein insolventes unternehmen, das versucht wenigstens noch die lagerbestaende abzuverkaufen, internettig einknickt, das lasse ich mir noch gefallen. aber ein unternehmen, das eigentlich gerne an die boerse moechte, es aber nciht auf die reihe kriegt, sich auf einen online-andrang, der vorhersehbar ist, einzustellen. tse, tse, tse… jedenfalls bin ich froh, dass ich nicht am schalter in echt herumstehen musste. die verkaufenden kann man ja wahrscheinlich heute abend um 23 uhr, wenn die sonderverkaufsoeffnungszeit zuende geht, mit besele und schäufele aufkehren.