World No Tobacco Day 2012 – Tobacco industry interference

Hi,

Weltnichtrauchertag 2012 - Lass dich nicht einwickeln!for everybody who don’t know it yet, today is World No Tobacco Day. The most will probably not care and the smoker don’t give a sh** anyway. But I wanted at least to point on it. :)

The World Health Organisation (WHO) invented the World No Tobacco Day exactly 25 years ago. Since that day it is celebrated ever 31th of Mai.

Like for many other things as well does the World No Tobacco Day a slogan. This year it is Tobacco industry interference.

I don’t need to mention that smoking is not good for you and your surrounding. Additionally it cost money, it makes you stink and has no sense at all.
And now I shut up and smoke one… ^^

Best regards
Gordon

Image source: http://www.who-nichtrauchertag.de

[PHP] Comments in PHP scripts

Hello together.

Lets talk today about comments :)
When you start coding a script then is it useful to comment your code. So a small documentation in the script. Because as long as you are working on the script and it is in a relative small size, then you know still which line of source code is doing what.

But latest when you source code is growing bigger and/or you need to work on it after a few weeks or months… then is everything gone. How was it? What is this line doing? Where do I find this and this now? Everything gone… the code is just a big pile of confusing.
Latest now you’ll kick your ass that you haven’t commented the code.

Of course it takes a bit longer if you write also comments in the code… but some when it will pay back. Also (and especially) if the code will be handed over to another programmer is it important that the code is commented.

And it is soooo simple ;) 2 slashes (//) for one line and a slash with a star for a multiple-line comment (/* at the beginning and */ at the end). And it will look like that:

<?php
echo "vor dem Kommentar";
// Hier ein Einzeiliger Kommentar
echo "nach dem Kommentar";
?>

And a multiple line comment:

<?php
echo "vor dem Kommentar";
/* Dieser Kommentar
   geht über mehrere
   Zeilen */
echo "nach dem Kommentar";
?>

Best regards
Gordon

Diving at Cape Greco Cyprus – The canyon and the caves

Hello together,

last Saturday we was finally diving again. :) A luxury which I actually can’t really afford, at the moment. But what can I do… just sitting stupid at home can’t be everything. And this year we’ve sworn us to go really diving.

And so we was going the dive shop of our confidence (Aloha divers Limassol) for a small adventure. This time we was going with the truck in the middle of nowhere. It was good it was a pickup truck… the last end to the dive spot was really off-road. :)

The plan was that we go to Cape Greco (after Ayia Napa) and to the dive spots The canyon and the caves. I’ve heard a lot already from the caves. Everybody was enthused about this spot… To be honest, I was a bit disappointed. Probably because everybody was telling me how nice it is there, so my expectations was bigger then the reality is.

But it was anyway great… and very adventurous (especially the entrances :) ). But have a look by your own. Of course there is a video. ;)

By the way video… I need to do anyway some more dives. The GoPro doesn’t have viewfinder or display. I need to record blind… and I need more practice in it. Especially in the first cave I was holding the camera to high :( But skills comes with practice. ;)

Also the video cut leaves a lot to be desired… I hope it will be not boring anyway.

[PHP] Delete a file with PHP

Hi together,

today I wand to answer the question how to delete a file with PHP.

First of all we have to separate. Files on the web server or files on the local hard disk. First yes, second no.
PHP doesn’t have access to files of the local file system of a visitor. No server side programming language can do it. Also client side languages (like Javascript) can’t do it. Else it would be easy for every single webpage to delete randomly files from your computer. That would be an disaster.

But on the web server is it – partly – possible to delete files. Partly means that you can’t delete every file. Also this would be a disaster.

The PHP-Script needs the right to delete files or at least specific files. Under Linux is the right system very strict.

But in the normal situation is it not so complicated like it sounds like. Because usually you delete a file which you created with the script. Like a temporary file or a file from a user upload (a picture for example). Such a file was created by the PHP script and inherit it’s user rights. And also the script has the right to delete this file again.

But how?
Very simple. All we need is the PHP command for deleting a file and the path of the file itself. It fits all in one code line.

$res = unlink("testdatei.hm");

That’s it. In $res we get a return value. 1 = successful deleted or 0 = Couldn’t delete the file.

You can use relative as well as absolute paths.

That’s it. Hope it was helpful :)

An octopus which pretend to be a stone

Hi,

I went yesterday snorkeling again. Of course with my new camera :) I bought a short while ago a new underwater camera (the GoPro Hero 2). Actually it is a action camera (for action sport). But also for diver very interesting. After the lens modification (with the Blurfix lens) is it also able to catch sharp underwater HD videos.
I just need to get in used to the recording itself. There is no viewfinder and no display. Everything by instinct and experience. … And when I see then something interesting, then I am so excited and fixed on the “great thing”, that I forget to handle the camera proper. :) :D

But yesterday I caught the first good recording. I was snorkeling so my round… till I saw an odd stone. Looked somehow strange. And then I saw that there was something attached, which doesn’t belong there.

An Octopus was holding itself on the stone and tried to pretend to be a part of this stone. It looked like he would think that it would work…. till I was one meter in front of him (pity the video just starts short before). Then is seemed like it become to hot for him… that his cover got blown… :) :)
So he break away from the stone slowly and swum under a close ton.

This Octopus was the second largest I ever saw, till now. Was already very impressive.

I hope that I can fly soon somewhere else… where I can explore and record more life under water. Here I can find maybe 1-2 times per week something interesting (and interesting is here already anything beside the usual small fish) :( Maybe Egypt or so. It’s not soo far… If the money is left for it.

But now first the video to the story… :)

Ahh, once more before: Our Nature is wonderful! Help to save and protect it!

My 31st birthday

Hi together,

my 31st birthday is already a few days ago, but anyway I want to write some words about it.

My birthday was on a monday. But here on Cyprus was it Easter Monday. Which means that everybody was off, except of some Pubs. Easter Sunday was everything closed.

Ira made me a special birthday present. She invited me for a dive. Of course to the Zenobia. The sunken roll-on/roll_off ferry in Larnaca.

So my birthday started very early. At 7, to be exact. A very uncivilized hour for me. But somehow I managed it. Not least because of Ira’s wake up calls. :)

I was already one day before diving and had still everything in my car. So I just had to go first to the dive shop to unload all the equipment. Then back at home, to bring the car back… and by foot back to the shop.

Ira catch me on the way and we walked together to the shop. We arrived together with Anton. So we putted everything on the pickup truck an started to Larnaca.

The dive boat is in the small harbor. We arrived and carried our stuff on the boat. Then parking the car and we was off to the buoy. The only remaining indication on the surface. The buoy is also used to land for the dive boats. It’s just a few minutes drive from the harbor to the buoy. It’s just time to change and then straight in the water.

Of course we was prepared with warm water, to flood the suit, not to get straight the cold water in. But I forgot my socks and undershirt. :( Well, the water was here a few degrees warmer. Just not soo much. But anyway. We submerged to a depth of 30 meter, to the Zenobia.

This time we came up on another spot. At the stern of the vessel. We went quickly over the side and ended up direct at the parking level. Just the view over the railing is stunning. You watch from 18 meter down to over 30 meter and you see there the trucks lying and hanging. The first thing you realize are the wheels… and then that this are basically whole trucks.

We went further down and slowly more forward to the bow. Till a hatch was letting us in the huge wreck. Now it became dark and tight. It’s easy to loose orientation and it feels a bit strange. :) Especially because the wreck is lying on it’s side. So you’re swimming basically transverse to the normal direction. But there is not much time to think about it. You’ll be more busy not to loose the person in front and not to hit yourself somewhere.

We went up and down… swimming through the wreckage and wholes in the steal beams. Sometimes between was even the sun shining trough the – still intact – windows. Which are now – in sideway position – above, instead on the side.

The most stunning thing was the last room. I guess it must be the dining hall or meeting room. The room is at least very big. At least here you’ll realize that something is strange. Because this room does not goes longer in it’s wide, it’s going down. That is really impressive and surreal.

Through another hatch, on the other side of the room, we came back outside. Just out of the wreck again you look straight 15-20 meter down again. And for a short moment I was afraid to “fall down”… but I didn’t, I was flying in the same height. That is fascination diving!

We went then for a short time down to 34 meter. But just quick, we was running out of time. So, we went back up and the same way back.
After a deco stop was our great dive at the end. And this day was no second one, because it was Eastern. The captain of the dive boat made just one trip that day.
Ok, at the end of the dive it became a bit chilly… and partly the one dive was enough… but… well :)

Then we went back to Limassol. To wash our equipment, a good hot tea and then we went back home.

At home I also needed a shower to wash myself and the rest of the equipment. Then calling home and relaxing a bit :)

In the evening I went out with some friends – for a beer – first in a restaurant on the beach and later in a pub.

It was a great day. Thank your for all involved people and especially to my buddy Ira, for the great birthday present. (All other was of course also great! ;) )

While editing the dive movies I got the idea to make maybe a small movie or a reportage about the Zenobia. I work still on the concept… below a small trailer, how it could look like :)

Best regards
Gordon