blog.autopsy.se

basically; it sucks. everything sucks. but.. in a good way..

Canada sucks, really!

I'm on my way back to montreal.. Two more months to go, eight weeks or fifty-six days.. It's not that bad, but the per-diem has been lowered by 50 SEK.. Hopefully I'll manage.. ;)

posted by ube in On the road,Rants and have Comments Off

SJ sucks!

Here in Sweden there are two train companies, Tågkompaniet and SJ. I'm on a train operated by the latter.. In first class you get free internet, so now I'm entering this post from my iPhone.. Kinda ok appart from the problem with writing in english with a swedish dictionary. When I type "a" it becomes "å" (river in swedish), I erase and type "a" again and my phone tries to be helpfull and corrects it to "att" (to in swedish).. Well, I know I could change the keyboard to english, but where does that leave me when I'm texting?

posted by ube in On the road,Rants and have No Comments

7 deadly sins of regexp

Lust /(.*?)/
Gluttony /(.{1,})\b/
Greed /^.*$/
Sloth http://www.amazon.com/Regular-Expression-Pocket-Reference-Expressions/dp/0596514271/ref=pd_bbs_sr_2?ie=UTF8&s=books&qid=1229670757&sr=8-2
Wrath s/.*//g
Envy FUCK IT!
Pride /(\((?:[^()]++|(?-1))*+\))/

posted by ube in just for fun and have No Comments
Tags:

mdadm sucks

A couple of months ago my box at home died. I came back home for vacation two days ago and started to check why it doesn't start.. One of the disks had been marked as failed (or acctually two, but only one is dead), I was wondering of removing all the data by re-creating the array and scrapping ~3Tb data.. But when I woke up from a nap this evening I thought that maybe the -f flag works with mdadm as well:

# mdadm -A -f /dev/md0 /dev/sd[acdefgh]1

Did the trick, it resetted the failed status on sdh1

posted by ube in Linux and have No Comments

my powersupply sucks! (really) but my friends rocks!

My server at home went down on Friday evening.. I guess it was the power supply or a power outage, probably the latter. However, it did not restart when the power went back on. I know I set the BIOS to start the computer when the power came back. But it did not.

So my very best friend went to my apartment and resetted the power, and it worked! Thank god! I would not managed without my server at home, neither would my colleagues..

posted by ube in Rants and have No Comments

my macbook sucks! really!

My MacBook has started to behave badly. I'm staying at a hotel for 5 more months (no it's not really nice) and the internet connection is NATed (free though). So I want to access my macbook from work. It's quite easy; just set up a ssh tunnel back to the mac. But the last two days it has frozen after I left my room. So this means that I can't download my tv-series to my mac from the office. Which means that I have to wait until I get home and my collegues starts downloding Swedish Idol which means that I just get about 20kb/s compared to 300kb/s.

I'm about to go and get myself a new laptop, probably a MBP or a MBA, haven't decided just yet. Luckilly I'm in Montreal where there is a Apple Store four blocks from the hotel so I can go down there and get a new one in a heartbeat. But I have to wait, no matter how much I want a new computer I'll have to see what's being released on October 14th..

posted by ube in Rants and have No Comments

validating user names sucks!

You know when you're writing any application, and you want to restrict the characters in the user name? Instead of checking for non allowed characters, look for allowed. Sounds strange? Not really, you'll understand:

function checkname($string, $allowed) {
$allowed = "/[$allowed]/s";
$string = preg_replace($allowed, "", $string);
if ( $string )
return FALSE;
else
return TRUE;
}

So what you'll do is remove all allowed characters, and if there are any left in the string the user has chosen an invalid username. Ofcourse it's regexp that does the trick. Using the code:

if ( ! checkname($input, "A-Za-z0-9_\.") )
echo "Invalid username!";
else
echo "Ok, lets go!

We're allowing A-Z, a-z, 0-9, underscore and dots in the username.

posted by ube in PHP and have No Comments

javascript and timers sucks!

Have been trying to get my head around timers in javascript. And I guess i know how it works now. My approach:

<script>
var timer;
function whatever() {
if ( timer )
clearTimeout(timer);
alert("you just wasted 15 seconds of your life..");
timer = startTimeout('whatever()', 15000);
}
</script>

and in the html:

<body onLoad="timer = startTimeout('whatever()', 15000);"> yada yada..

this will generate an annoying popup (if I made the example correct..) every 15 seconds..

Why I need this? Well, on tv.autopsy.se I want to update the search cloud continuously without having to do some reloads. And I also have a timer that waits 4s to insert data into the database for the search cloud. Neat, huh?

posted by ube in Javascript and have No Comments

“first post” sucks!

Standard first post..

posted by ube in Uncategorized and have No Comments