Skiing 2008

February 3, 2008 – 16:18

I just uploaded some fresh pictures from skiing in Hochsoelden, Tirol, Austria. Also you will find some pictures from Schwangau, Hohenschwangau and Neuschwanstein. Yes I was writing these names from memory ;)

Have a look, they are great.

Getting the Spanish N.I.E. – social security number for foreigners

October 7, 2007 – 20:21

Just recently I obtained the Numero de Identidad de Extranjero, which allows me in Spain to get a job, buy a car/house etc. Very important number if you want to live in Spain for a longer time. The number you get is valid forever, you just have to renew the certificate (every 5 years).

For European Union citizens there are 2 steps involved in obtaining it. The first one is to get an appointment. You can try calling the COMISARIA GENERAL DE EXTRANJERIA to get the appointment but in my case it was easier to go to the office at 4am and wait for the registration at 9am. The good thing was that I went there with 3 friends, so we were not that bored as you can see on the pictures. Remember to bring your passport for that meeting. The officer will schedule you for an appointment that will take place after about 8 days. You will get forms needed to be filled out and a form to pay 6.70EUR for the issuance of the number.

Fill out the forms, pay the “tasa” at any bank, bring your passport, 1 photocopy of your passport and to be on the safe side, bring 3 recent photographs of yourself (I didn’t need to give them in but…). You should obtain you N.I.E. number on the same day.

ATI Radeon XD 2400 XT

September 29, 2007 – 16:10

UPDATE thanks to Hendrik: Acer has released a new driver pack, which should work for XP.

I got a laptop Acer Travelmate 6592 with ATI Radeon HD 2400 XT. After a few whiles of using Vista I decided to go back to XP and there was a problem with supplied drivers from Acer. There was none that could be used with my XP version…

Therefore after looking for a while and trying different solutions I came up with a one of my own.

Just follow these steps if you have problems:
1. Download and install Driver Pack.
2. It will say it doesn’t recognize the driver, but it will leave its drivers on your hard drive.
3. Go to your device manager.
4. Click on the graphics card not beeing recognised
5. Choose reinstall driver.
6. Click “Install from specific…”.
7. Click “I will choose…”.
8. Choose “Display adapters”.
9. Click “Have a disk”.
10. Point it to the dir where you installed the above file – ending has to be something like “7-9_xp32_dd_ccc_wdm_enu_52443\Driver\Driver\XP_INF” and click OK.
11. Search for your video card driver. Trust me it is there.
12. Click yes to continue and ENJOY!

If you have questions, please post in comments.

A php function to return random values

September 22, 2007 – 11:24

I was looking for a method in php that would return unequal numbers using the rand() function. I found an answer on php.net and all credit goes to alishahnovin at hotmail dot com. The method is as follows:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
function randiff($min, $max, $num) {
    if ($min<$max && $max-$min+1 >= $num && $num>0) {
        $random_nums = array();
        $i=0;
        while($i<$num) {
            $rand_num = rand($min, $max);
            if (!in_array($rand_num, $random_nums)) {
                $random_nums[] = $rand_num;
                $i++;
            }
        }
        return $random_nums;
    } else {
        return false;
    }
}

Usage:

$nums = randiff(0,10,2);
$var1 = $nums[0];
$var2 = $nums[1];

Stardust

September 19, 2007 – 00:46

I have just watched a movie called Stardust and I am greatly impressed by it. An unknown actor to me – Charlie Cox shows some great acting skills and makes a firm leading role. Movie was entertaining, full of wit, romantic and simply pleasant to watch. The storyline seemed very unique to me, although I am not a fan of fantasy like movies. Oh, and very important thing – you get seamlessly guided by a narrative voice throughout the movie, so you never get lost :) )  Last but not least, Claire Danes is playing the actual star, and always great Robert De Niro is a ship’s captain. Fabulous!

It was definitely worth spending those €6 ;) I might actually watch it again

I highly recommend it!

localhost.customs or localhost:1001

September 17, 2007 – 20:12

Well, just recently I discovered an error in my Apache2 log file saying:

127.0.0.1 – - [17/Sep/2007:20:10:32 +0200] “GET /” 400 466

Well, that is a SSL log, so I am working to figure out what it really is…

Ok, “tshark -i lo -S -V > dump.shark” command comes in handy to see the packets, and here is what we get:

Internet Protocol, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Version: 4
<cut>
Source: 127.0.0.1 (127.0.0.1)
Destination: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 53612 (53612), Dst Port: customs (1001), Seq: 1, Ack: 1, Len: 155
Source port: 53612 (53612)
Destination port: customs (1001)
Sequence number: 1 (relative sequence number)
[Next sequence number: 156 (relative sequence number)]
Acknowledgement number: 1 (relative ack number)
Header length: 32 bytes
Flags: 0×18 (PSH, ACK)
0… …. = Congestion Window Reduced (CWR): Not set
.0.. …. = ECN-Echo: Not set
..0. …. = Urgent: Not set
…1 …. = Acknowledgment: Set
…. 1… = Push: Set
…. .0.. = Reset: Not set
…. ..0. = Syn: Not set
…. …0 = Fin: Not set
Window size: 32800 (scaled)
Checksum: 0xfec3 [incorrect, should be 0x14e9 (maybe caused by checksum offloading?)]
Options: (12 bytes)
NOP
NOP
Timestamps: TSval 289375346, TSecr 289375346
Data (155 bytes)0000 47 45 54 20 2f 20 48 54 54 50 2f 31 2e 30 0d 0a GET / HTTP/1.0..
0070 28 69 6e 74 (int
0080 65 72 6e 61 6c 20 64 75 6d 6d 79 20 63 6f 6e 6e ernal dummy conn
0090 65 63 74 69 6f 6e 29 0d 0a 0d 0a ection)….

Looks like a known error of dummy connections, but a bit different one, since Apache2 didn’t speak SSL to its SSL server, so no proper “GET” request has been logged – just info about the 400 error.

The way I fixed it was to to increase the number of “MaxSpareServers” to “10″ in my Apache2 configuration file. I don’t need more…

Using wget to download all *.rar over ftp

September 16, 2007 – 21:38

Today I read a news about Helion.pl releasing a Polish version of Wikipedia on a DVD and providing a download possibility as well. Having a 8Mb line I decided to get it.
Handy came a wget command:

wget -c "ftp://ftp.helion.pl/wikipedia/*.rar"

DVD version of Wikipedia is definitely a good thing for “laptopers”.

Using sed to change strings in multiple files

September 15, 2007 – 21:56

Ok, one more tip for today, which makes it very simple to change text within multiple files.
Say for example that you want to change Bush to Kerry in 50+ files ending with “html”.
OK, now you could edit them, but it is too much of a hustle. Instead let’s use sed and some bash scripting:

for F in `find ./ -type f -name '*.html' -print`;
do mv $F $F.tmp;
sed 's/Bush/Kerry/g' $F.tmp > $F;
rm $F.tmp;
done;

Be careful however, when changing “<” or “>” or any other character that has to be escaped! You have to escape it using a backslash – “\”. So for example to escape a “<” you would write “\<”. SIMPLE, right?

Questions? Here is a sed string changing script that I used.

Unzip, untar, unpack all archives

September 15, 2007 – 21:13

Once I came to a point of having downloaded 20+ tar.gz files and facing a need of finding an efficient way to extract them. If you are having such a problem then this simple solution will help:

for F in `find ./ -type f -name '*tar.gz' -print`;
do tar xvzf $F;
done;

What it does is for every file ending with “tar.gz” found in current folder “./” it executes a command “tar xvzf“, which unpacks the archive. Very simple but also VERY useful. Try with unzip and other commands.
Yes, you may delete files after unpacking by adding “rm $F;” after the tar statement.
However, it is always good to keep the original source!

How to use the gallery

September 15, 2007 – 21:04

New gallery is very powerful and features some dynamic content. I am sure you will be able to use it in the most efficient way. Here are some tips:

Click on Show sidebar in order to show the sidebar. After the sidebar is shown you can click on “Show Item Links” in order to have access to direct slideshows. A new icon will be shown next to the photo Action. Click on it and choose option of your interest.

When you are done with choosing options for your slideshow it is better to hide the sidebar by clicking Hide sidebar.

Polska wersja tutaj: Read the rest of this entry »