Framtiden
Är du i framtiden?Följeslag
Bloggar
Kategorier
- Emily
- Filmat
- Fotograferat
- Fototriss
- Ingen kategori
- IT/BBVote (Votech)
- IT/Blandat
- IT/Data
- IT/Development
- IT/Integritet
- IT/Telefoni
- Komponerat
- Media/nöje
- Musik
- Predikan
- Projekt: Moralspaning
- Projekt: Pose
- Projekt: Roadrage
- Projekt: Svensk sophantering
- Roadrage i verkligheten
- Roadrage: Bakom raseriet
- Seriös Journalistik
Tornevall @ Twitter
Blogglänkningar
Arkiv
Monthly Archives: mars 2010
Stavningspolisen
Posted in Ingen kategori
2 Comments
Numeric values in a DB2-table
I’ve read a bit about people that wants to find out if a columnvalue in a DB2-table contains numerics only. I’ve also read solutions that’s is more advanced than it have to be. So the solution I found, is the following… Can it be easier?
LENGTH(REPLACE(TRANSLATE(COLUMN_NAME, ' ', '0123456789'), ' ', '')) = 0
It’s all about removing all numerics in the search, so the column only returns non-numerics. Then count the characters that were left alone. If the length of the output is zero, we know that the column contains nothing after the clearout. If that’s the case, we’ve found a numeric-only value.
Posted in IT/Development
Leave a comment
NNTP Gateway Modification – vB4 Compatibility Fix
With a quite simple solution based on a version-check ($vbulletin->versionnumber actually), this script now seem to be compatible with both 3.x and 4.x. My (only) test was at least successful – at last. The solution to (hopefully) make the gateway compatible with both vBulletin 3.x and 4.x, was to separate the insertion data into two sections: one for the old attachment-query, and one for attachments handled by vBulletin 4.x (where attachment-tables are separated), starting with this little helping row…
if (!preg_match("[^4]", $vbulletin->versionnumber))
Probably, this is not a foolproof solution, but it seem to work! The script was tested with vB 4.0.2 with a successful output, so far. So here we go!
includes/functions_nntp.php version 2010-03-26 22:17
http://tmm.tornevall.net/dev/functions_nntp_vb4_100326_2217.tar
Example post from de.alt.dateien.misc
http://forum.tornevall.net/showthread.php?343942-Eislutscher-am-Wiener-Heldenplatz
Läs även andra bloggares åsikter om console, cron, gateway, news, nntp, NNTP Gateway Modification - vb4 Compatibility Fix, php, script, usenet, vb4.0, vbulletin, vbulletin 4.0
Posted in IT/Development
Tagged console, cron, gateway, news, nntp, NNTP Gateway Modification - vb4 Compatibility Fix, php, script, usenet, vb4.0, vbulletin, vbulletin 4.0
1 Comment
Autogirot segrar!
Jag har alltid viljat övervaka alla räkningar själv tidigare. Men nu faller jag på knä inför tekniken. Det är kört. Nu åker alla räkningar in den vägen! Jag pallar inte längre. Autogirot har segrat över mig.
Posted in Ingen kategori
4 Comments
Dating in the dark
Dating in the dark spär definitivt på min cynism ytterligare! Programmet visar en enda sak, som jag redan kände till – folk tror ALLDELES för mycket om precis ALLTING. 90% besvikelse? Ohyes, we know! Det är ganska skrämmande någonstans dock, att folk inte fattar det. Och jag skulle kunna satsa min högerarm på att samma människor skulle kunna göra om samma misstag igen och igen och igen…
Folk famlar i mörker även dagtid!
Posted in Predikan
Leave a comment
Higher state of…
Ikväll fann jag en bit av mitt gamla jag igen. Det var visst bortsprunget.
Ack, så bra det kändes…
Higher state of conciousness – Level 2
Posted in Komponerat
1 Comment
Request: WordPress Comment-Link-Scanner
This is a URL-scanner, that grabs the url from a selected comment on a blog, via direct urls. Using anchors to find the right comment.
Example: You want to see the posted link for this comment.
The command, to find the link for the post is in this case:
GetCommentLink(”http://tmm.tornevall.net/blog/2010/03/14/sa-gor-media-dig-pissed-off-lattast/#comment-2667″)
return(array($getlink)); // Found link successfully – returning link as an array.
The rest is numerics, if we fail – see the source!
OBSERVE
All blogs has their own design. This script does not cover them all.
Sourcecode
< ?php highlight_file('../php/t_commentscanner-1.0.0.php'); ?>
Posted in IT/Blandat
Leave a comment
NNTP Gateway Modification – 100312
This post is for the guys at vbulletin.org, by request.
First of all, here’s the current source:
http://tmm.tornevall.net/dev/nntpgw-100312.tar
Changes made:
- admincp/nntp_settings.php
- Added settings for ”static email” for the from-header. Using this, will set a non-dynamic sender e-mail.
- gateway.php
- Added ”support” for console-runs (fix for vBulletin 4.0 that doesn’t like this)
- ”Debug”-modes: 1 = Activate debug (not used), 2 = Unlock the script if it got stuck (this is a console thing)
- Added some info into a logfunction to get more verbose info on connection
- Dupechecker for threads/posts. If the xref/lastpost-value changes due to the nntpserver, this function avoids duplicate posts from the newsserver. This is extremely nice, if the newsserver used in some reason has been reset due to reinstallations, crashes etc (yes, this has happened to me – this is the fix)
- Last-Insert-ID fixed, an old issue that happens when trying to read a new post from a forum
- includes/functions_nntp.php
- Small fixes, including footer changes – in some reason the original footer added to posts, made from a forum disturbed me, so this has been cleaned up so it looks more like a ”real” post on usenet. This fix was something about the signatures, so to speak.
- Message-ID, References and From manipulated (partially referred to the static-email-setting above)
- Another first-post-id/last-post-id fix
- An old issue about attachments fixed here (observer that this is always accepting attachments/thumbnails). It also includes some kind of extension fix. Well, this is a very old fix and one of the first made to the script and my memory is quite blurry in this case… But I’ve never needed to change this back to it’s original state
- require class_image.php replaced for attachments support. Also this is an old issue, and documented somewhere in the thread at vbulletin.org
- includes/nntp.php
- Fix for handling usenet-traffic if the webserver where the script is running, happens to run a peer for the nntp-server (sending MODE READER on connection – if the server is a peer, some servers initially are expecting MODE STREAM, which the script won’t understand)
This is it I think. Wishes and questions will be answered if possible!
See you at vbulletin.org!
Läs även andra bloggares åsikter om console, cron, gateway, news, nntp, php, script, usenet, vb4.0, vbulletin, vbulletin 4.0
Posted in IT/Development
Tagged console, cron, gateway, news, nntp, php, script, usenet, vb4.0, vbulletin, vbulletin 4.0
2 Comments
Dagens regexp
$loc = preg_replace("/(.*?)Location: (.*?)\n(.*)/s", '$2', preg_replace("[\r]", '', $test));
Rensar allt framför och bakom exempelvis följande text:
Server: Apache X-Powered-By: PHP/5.3.1 Expires: Wed, 11 Jan 1984 05:00:00 GMT Location: http://www.tornevall.net/index.php?id=77 Content-Type: text/html
Utresultatet blir:
http://www.tornevall.net/index.php?id=77
Posted in IT/Development
Leave a comment
MediaWiki
Kort och koncist, media när de beter sig som om de vore faktaböcker…
”Så tar du dig fram i rusningstid”
”Här äter kamelen upp hela pajen”
”Så genomfördes rånet”
”Här kastas han ut – för att han inte ville gå ut själv!”
”Så svårt är det för kommunerna att hitta lagliga presenter”
”Så var schlagerfinalen”
”Här blir Christensen straffhjälte – på nytt”
”Så gräver man sin grop på tvären”
”Här visar aftonbladet hur tröga de är – genom att skriva såna här rubriker”
”Så var idioten född när han skrev den här artikeln”
”Här blir vårat kära media dumförklarat”
Och så vidare!
Posted in Predikan
2 Comments
SQL-Implode – Injection control
TorneEngine har fått ytterligare en funktion för att förenkla livet – saker man borde ha tänkt på tidigare… Denna gången handlar det om att snabbt kunna skicka in SQL-frågor i en databas och samtidigt slippa tänka själv. Det sparar åtminstone en del tid och en del kodutrymme.
Exempel:
Parametrar och dess värden lagras i en array. Dessa vill jag snabbt kunna skicka in i en databas, antingen för att modifiera värden, eller för att lägga in helt nya.
$sql[username] = "Pelle"; $sql[password] = "p4ssw0rd123";
Implodefunktionen fixar det galant! Den skall dock användas från en class, så att den inte förstör PHPs befintliga implodefunktion.
$ins = $tornevall->db->implode($sql); $upd = $tornevall->db->implode($sql, "update"); echo "INSERT INTO test ($ins[0]) VALUES ($ins[1])\n"; echo "UPDATE test SET $upd[0] WHERE userid = 3\n";
Resultatet blir fantastiskt bekvämt enligt nedan!
INSERT INTO test (username, password) VALUES ('Pelle', 'p4ssw0rd123')
UPDATE test SET username = 'Pelle', password = 'p4ssw0rd123' WHERE userid = 3
/*
Implode columns and their values
Returned data:
INPUT TYPE: Insert
$array[0] - "Column names"
$array[1] - "Column values"
INPUT TYPE: Update
$array[0] - "Columns = '$values'"
- Tornevall
*/
function implode($sql = array(), $type = "insert")
{
foreach ($sql as $p => $v)
{
$inserts[] = $p;
$values[] = "'" . $this->injection($v) . "'";
$updates[] = "$p = '".$this->injection($v)."'";
}
if ($type == "insert")
{
$ret = array(implode(", ", $inserts), implode(", ", $values));
}
else
{
$ret = array(implode(", ", $updates));
}
return $ret;
}
Posted in IT/Development
Leave a comment
Add and edit cookies – Firefox 3.6
Anpassad för att fungera med Firefox 3.6
http://tmm.tornevall.net/php/addneditcookies-0.2.1.0.xpi
Inte fel att ha tillgänglig alls!
Posted in IT/Blandat
Leave a comment
