Yesterday I had a terrible terrible day at work. A lot of work to get done so I needed to stay till evening (well I must admit I got there pretty late :”> ). So I decided to get on the bike and take it for a ride. Nothing fancy, nothing spectacular, just a short spin to release some stress while searching mostly for tarmac free roads.
Category : Motorcycle
Category : Stuff
Today while I was out I had taken these two shoots. The quality is poor, pictures were taken with phone at twilight, and have some amount of granulation. But I like this place, I would love to see as more places like this as possible in this city. Also, a nice picture with transalp :D
Category : Motorcycle
The long break I took from riding my motorcycle finally came to an end today. I made a small trip with some friends (they were with cars), to a beautiful location not far from Cluj. I must say it was truly delightful and made me dream again of journeys with no worries and no destinations.
Displaying imagine location in wordpress using their gps coords proved to be not as easy as I initially thought, but it is something I wanted to get done from some time now, so I decided to get down on it. I have chosen to use geotag plugin for its capability to read exif data from images spread through a post and nicely locate them on a google map, among other stuff.
Unfortunately, after uploading few images I discovered that the cool functionality of searching photos with gps exif data and displaying their location on map was not working. That was because the images displayed don`t have any exif data stored in the file, as wordpress automatically stripes it down on image upload, but not before data is read so it can be stored serialized in postmeta table from db. Instead of altering wordpress core files to modify this behavior, I preferred to find a different approach and try using the meta info already stored into database. But the problem is that wp save only some tags from exif, and GPS information in not among them, so first step is to add the following filter to the wp_read_image_metadata hook:
add_filter('wp_read_image_metadata', 'saveGeoExif','',3);
function saveGeoExif($meta,$file) {
$exif = @exif_read_data($file);
if (isset($exif['GPSLatitude'])){
$meta['GPSLatitude'] = $exif['GPSLatitude'];
}
if (isset($exif['GPSLatitudeRef'])){
$meta['GPSLatitudeRef'] = trim($exif['GPSLatitudeRef']);
}
if (isset($exif['GPSLongitude'])){
$meta['GPSLongitude'] = $exif['GPSLongitude'] ;
}
if (isset($exif['GPSLongitudeRef'])){
$meta['GPSLongitudeRef'] = trim($exif['GPSLongitudeRef']);
}
if (isset($exif['GPSAltitudeRef'])){
$meta['GPSAltitudeRef'] = trim($exif['GPSLongitudeRef']);
}
if (isset($exif['GPSAltitude'])){
$meta['GPSAltitude'] = trim($exif['GPSLongitudeRef']);
}
if (isset($exif['GPSTimeStamp'])){
$meta['GPSTimeStamp'] = $exif['GPSLongitudeRef'];
}
if (isset($exif['GPSDOP'])){
$meta['GPSDOP'] = $exif['GPSLongitudeRef'];
}
if (isset($exif['GPSImgDirectionRef'])){
$meta['GPSImgDirectionRef'] = trim($exif['GPSLongitudeRef']);
}
if (isset($exif['GPSImgDirection'])){
$meta['GPSImgDirection'] = trim($exif['GPSLongitudeRef']);
}
return $meta;
}
This will save all GPS information into database upon image upload.
Next we need to search all the photo attachments belonging to a post, calculate their coordinates and extract image url, and then pass them to geotag plugin.
add_filter("the_content", 'getGeodataFromMeta');
function fractionResult($fraction){
list($sup, $sub) = explode('/', $fraction);
if(floatval($sub) != 0){
return $sup / $sub;
}else{
return 0;
}
}
function getCoord($fractional, $ref){
$coord = 0;
if(is_array($fractional)){
$coord = fractionResult($fractional[0]) + fractionResult($fractional[1]) / 60 + fractionResult($fractional[2]) / 3600;
}
if($ref == "S" || $ref == "W"){
$coord = -$coord;
}
return $coord;
}
function getGeodataFromMeta($content){
global $photoMetaCoords;
$postId = get_the_ID();
$attachments = get_posts('post_type=attachment&post_mime_type=image&post_parent=' . $postId);
foreach ($attachments as $attachment){
$meta = wp_get_attachment_metadata($attachment->ID);
if(isset($meta['image_meta']['GPSLatitude'])){
$lat = getCoord($meta['image_meta']['GPSLatitude'], $meta['image_meta']['GPSLatitudeRef']);
$long = getCoord($meta['image_meta']['GPSLongitude'], $meta['image_meta']['GPSLongitudeRef']);
$imageUrl = wp_get_attachment_image_src($attachment->ID, array(133, 133));
$photo = array(
'lat' => $lat,
'lon' => $long,
'uri' => $imageUrl[0]
);
$photoMetaCoords[] = $photo;
}
}
return $content;
}
Last thing we need to do in order to get all this to work is to alter a bit geotag plugin, so it will also load the images from $photoMetaCoords array. In function getGeotagsFromPhotos() add the following line before if (empty($geotags)) {return null;} else… :
$geotags = array_merge($geotags, $photoMetaCoords); $photoMetaCoords = array();
Also at the begining of getGeotagsFromPhotos() function change:
global $post;
to
global $post, $photoMetaCoords;
That`s it!
All the code presented here should be added in functions.php or in geotag.php (except the last line which should always go in geotag.php, of course :) ).
Well this isn`t php, is a JavaScript code that validates a car chassis number (VIN). I expect comments on improving the code, as JavaScript isn`t my strong point, I know just as much as any php web developer should know.
var vinletters=new Array();
vinletters[1]="AJ";
vinletters[2]="BKS";
vinletters[3]="CLT";
vinletters[4]="DMU";
vinletters[5]="ENV";
vinletters[6]="FW";
vinletters[7]="GPX";
vinletters[8]="HY";
vinletters[9]="RZ";
//--------------12345678901234567
var vinweight= "8765432T098765432";
function valvin(serie){
if(serie.length == 17){
suma = 0;
for (i=0 ; i < serie.length; i++) {
nextchar = serie.charAt(i);
for (j in vinletters){
if(vinletters[j].indexOf(nextchar) != -1){
nextchar = j;
}
}
val = parseInt(nextchar);
weight = vinweight.charAt(i);
if(weight == "T"){
weight = 10;
}else{
weight = parseInt(weight);
}
suma += val * weight;
}
controlchar = suma % 11;
if(controlchar == 10) controlchar = "X";
if(controlchar == serie.charAt(8)){
return true;
}else{
return false;
}
}else{
return false;
}
return false;
}
Category : Stuff
Well I`m sure that most of you saw this video and heard about Matt. A regular 32-year-old guy who suddenly realized that life can offer a lot more than what he was asking for. This is his first video, who made him very popular over YouTube. I can`t describe the feelings I have when I see thees movies… amazing.
In 2008 he released a second one.
It really makes me shiver.
Category : Painting
Three drawings I made in charcoal. First is a quick sketch for the header of the new site skin :) . I`m so disappointed with the second one. Wanted to be something really special, but it seems I got to work a lot before I`ll ever try to do a portrait again.
I taken picture of the drawings with iphone, but quality is pretty decent, at least I assure you they doesn`t look worse than they look on paper :D .
These are my first attempts to draw something on iphone. Neither one is finished, but is enough to see the possibilities of the two applications.
Is nice to draw with your finger, but it takes a lot of time zooming, choosing color, opacity etc. And a big downside if you have think finger :) . First drawing is made in Brushes, said to be the best drawing application for iphone. Two big points for having opacity and multi-layer support – up to 4 layers (not much, but enough if you manage your things right) that can be rearranged, deleted, merged, and even copied between paintings. Also, fast access to controls as you draw by just taping the screen on any spot saves some amount of time. For color choosing it has the friendly well known color wheel and an opacity slider, wich makes it pretty straight forward, but I find it a bit difficult fine tuning the opacity at low values.
Second drawing (ergh…) is made using MyPaint2, the first iphone painting app I ever tried. Also a decent painting application, but lacks of layer and opacity support. It has a brush softness slider wich slided to the low end point makes the brush transparent but is not what you`d expect, and certainly not a true opacity option. A very interesting feature is the possibility to upload your masterpieces directly to their website, where drawings are rated and commented. I tell you I found some amazing drawings there, made me feel so talent-less. Another good thing is the ability to save some colors, if you frequently need them, but the color choosing tool is… uhm… I don`t like it. Overall, a decent painting application, but when I found out that there is no “redo” button, I given up.
So, if you ever fell like finger drawing on you Itoy, my advice is to go with Brushes, even though is a bit more expensive, both applications are very cheap (3,99 euro Brushes, 1,59 euro MyPaint) .
Few days ago, a fine evening, my motorcycle was quietly waiting in front of my house, where I usually left it during the day. I though I should bring it into the yard, as I don’t have to go anywhere else for that day (unfortunately). Since I started riding it not a long time ago (I got my license like 3-4 weeks ago), I`m always in the mood for a ride, and feel such a pity every evening when I have to get him inside. Fortunately, when I got on an started it I remembered why I wanted it in the first place: to be free and to ride wherever and whenever I feel like it. So I took some money, a backpack and a bottle of soda, and turned on the engine for my first longer road: to my family in Lesu (BN).
I got there that evening without any incidents, thinking of returning to Cluj Napoca the second day. But in the morning I thought I should make a small detour, that I would get a little soft-enduro also (I just knew my motorcycle wants it), so I took the opposite direction, on the forest road from Lesu to Tihuta Pass (about 20km), having in mind that I will return via Bistrita – Cluj.
After resting a little at Dracula`s Castle, took a meal and got back on prepared to go down the Bargaie toward Bistrita when… pfff… the road was bad… potholes… The road up toward Suceava was just so inviting. Brand new hot tarmac. See ?! Really had no choice there. From Tihuta to Vatra Dornei the road was simply superb, but from there on I bumped into lots of portions of road with work in progress, and that slowed me down a lot.
Once I got in Suceva I meet a friend of mine who owns a motorcycle service, so I changes the brake pads and engine oil. I spent the evening partying with some friends at their favorite bar (with that occasion I also called my boss, announcing that I took a vacation). Next day I decided that the road back trough Vatra Dornei – Tihuta would be boring now, so I headed south, without knowing where, although I had some ideas already. Riding from Suceava to Bacau I realised that essentially I have to decide between motorcyclist meeting at Brasov and Vama Veche. Lots of kms a thought about it, balancing over and over the options, but when I finally reached the crossroad where I had to decide, it al became a lot easier. Yes… the sign was there. I could see some heavy clouds on the way for Brasov. So Vama Veche will be. Leaving Bacau behind I pulled the gas a little harder, planing to reach Galati till evening and stay over night at some friends. Was the first time when I cruised at higher speeds (for what I was used to), maintaining about 140kmh, with 160kmh sessions. The red TransAlp behaved exemplary.
I took the route Marasesti – Tecuci heading for Galati. Unfortunately, somebody lost a sharp screw in the middle of the road, and I couldn’t leave it there, so I decided to pick it up with my rear tire :) . About 60km away from Galati (the night was slowly taking over), I had from time to time the strange feeling that my rear is drifting a little. Well… must be because I’m so tired, or because of the road. But I kept sensing this harder and harder, so eventually I decided to stop and take a look. I didn’t dismounted, and from my pov everything looked ok. When I started…. whooohaaa… my back was running sideways like crazy. Flat tire. Excellent. In some forgotten village, about 60km away from Galati, and outside was completely dark. No… you won’t find a service here. No chance. Nope, the next village neither. Same with the next one. All the replies were negative, and I was beginning to get worried, as it seemed more an more to be a no exit situation.
Finally I managed to get on the phone with my friends from Galati. When they heard what happened they didn’t wasted a minute, prepared themselves with some vulcanization tools and jumped into car, heading my way. Pfiu… that was a relief. In the mean time, I asked some enthusiastic kids who came to see my motorcycle if they know anyone that could help me.
I was finally pointed to the right direction, and by the time my friends arrived, the wheel was back on, fixed and I was ready to go.
I spend the night at one of my friends home, getting some good food and good sleep, and of course a long awaited shower. Next day they also were so kind that they even came with me on the ferry when I crossed Danube. After that, they headed back home and I continued my way, going to Vama Veche. About six in the afternoon I was there, I parked quickly and jumped into the Black Sea for a swim.
In Vama Veche I met some friends of mine from Cluj, Taipan, Camelia and others. After partying late into the night, I slept on the beach, next to my motorcycle so the sun should not burn me in the morning. The next day we decided we should go and visit the bulgarian resort at Black Sea, Balchik.
After another night in Vama Veche, I finally headed back home in the morning. But first I had to go to Limanu, so Ehor Jan, a guy I had a deal with, could mount some crash-bars on my bike.
I left Limanu in the afternoon, worried a little about my gas money, and the dark expected to fall pretty soon. I was hoping to pass the Carphatians before the sun went down, as Prahova Valley has a magnificent scenery that I was overexcited to see. I just followed the road signs, and passed rapidly city after city, with just once cigar break, founding myself on schedule. But after Urziceni, just when I was about to enter next village, I began to feel very tough every little bump in the road. Flat tire again… this time the front wheel. As I was just 100m from the village entry sign, my thought was to go and find some help there. Luckly, a friend who does that route regularly, called to see how I`m doing and told me to get the fuck away from there as soon as possible, as that village was one of the worst, full of gypsies that “would dezmembrate your motorcycle in no time”. So I walked about 3km back pushing the motorcycle all the way to Urziceni. After spending some time asking and searching, I finally found a service open, but “they are just closing, sorry man”. I explained the situation to the manager, he said “go talk with the boy, maybe he wants to stay over and help you, of course, you pay now to me and give him something extra”. Just great… my TA`s fuel consumption was very low and nice, but now I was really worried that I won`t have enogh money to get me home. But didn`t really had a choice there, so I accepted. “The boy” snorted at me and finally said the he will do it, but I have to dismount and mount back again the wheel by myself… well ok.
About half past ten I left Urziceni, so the road home will be during night. The thought scared me at first, to ride such a long distance without any serious night-riding experience previously acquired, but in the end it turned out to be quite pleasant. Night drivers act with more “professionalism” than usual drivers, its not so hot, and the road is usually clear. About 5 in the morning I was finally parking the motorcycle.








































