Tuesday, September 18, 2012
Gooool!
Hooray. I still cannot believe it but we somehow managed to shot our submission "A SOFT Way for OpenFlow Switch Interoperability Testing" past defending reviewers and program commitee goalkeepers directly into the goal net of CoNEXT 2012 conference.
Tuesday, August 21, 2012
Little giants
After Nufenenpass and Gotthardpass, it was clear that Maciej and me should not leave waiting Furkapass for too long. Therefore, we (Maciej, Daniel and I) decided to use Swiss national day (1st of August) as an excuse to climb this very nice pass. And not only that -- because Furka is not big enough for one day, the plan was also to attack Grimselpass with a climb to Oberaarsee.
The start was at Realp where we arrived quite late (11am). As far as I can tell, Realp is one of the most train-time-distant places in Switzerland (at least as measured from Lausanne) -- the more time consuming travel is just to the south part of Switzerland (Locarno, Lugano). Although Furka is more than 2400m, climb from Realp is quite short because Realp itself is over 1500m. Moreover, the climb itself is not very steep -- after initial section of hairpins there is a long section with only 400m of ascent.
After Furka, our next stop was Belvedere with views to Rhonegletcher. There we even went inside an ice tunnel in the glacier. The result is that now I know why ice and glaciers in Ice Age movie are always blue. That is because they are blue!
Before we went all the way down to Gletch, we had another stop. This time not scheduled -- Maciej got a flat tire. And he did not have a backup one. Fortunately, we realized that it was compatible with my bike and I had a spare one (actually, I had two spares, just in case). Therefore, we were able to continue to the Grimselpass.
At the Grimselpass, Daniel decided to split from us and go ahead faster (generally, he was much faster than Maciej and me and was waiting for quite frequently). His plan was to go directly down to Meiringen and then "enjoy" a steep ascent to Grosse Scheidegg and down to Grindelwald. Maciej and I stayed at Grimselpass for a while -- I went to visit a crystal "cave" (a collection of crystals from different parts of Alps) and Maciej was having his late lunch. After a pause, we went for our final climb -- from Grimselpass to Oberarsee dam. We were half the way up when, surprise, we met Daniel. He changed his mind after seeing a map at Grimselpass and realized that the way to Oberaarsee is quite uphill. We said farewell again to him.
Oberaarsee is the second highest (elevation) dam I visited. With surface elevation of a few meters over 2300m, it was beaten only by a Griessee dam near Nufenenpass. With views to the Oberaarchletscher, this was a good reward for finishing our climb. And while you can definitely sit there for a few hours, we did not have so much time and after a I did a short walk (Maciej was lazy), we returned back (with a short stop at Triebtenseeroli lake) back to Grimselpass.
From there, we really enjoyed a 30km long descent to Innertkirchen. To Maciej's horror, the road from Innertkirchen to Meiringen was hiding another climb. It was however a short trip and we quickly managed to get to Meiringen with the bonus that we arrived on time to quickly get into the train in the direction to Interlaken.
For thoso of you who did not climb Furka&Grimse, here are photos.
The start was at Realp where we arrived quite late (11am). As far as I can tell, Realp is one of the most train-time-distant places in Switzerland (at least as measured from Lausanne) -- the more time consuming travel is just to the south part of Switzerland (Locarno, Lugano). Although Furka is more than 2400m, climb from Realp is quite short because Realp itself is over 1500m. Moreover, the climb itself is not very steep -- after initial section of hairpins there is a long section with only 400m of ascent.
After Furka, our next stop was Belvedere with views to Rhonegletcher. There we even went inside an ice tunnel in the glacier. The result is that now I know why ice and glaciers in Ice Age movie are always blue. That is because they are blue!
Before we went all the way down to Gletch, we had another stop. This time not scheduled -- Maciej got a flat tire. And he did not have a backup one. Fortunately, we realized that it was compatible with my bike and I had a spare one (actually, I had two spares, just in case). Therefore, we were able to continue to the Grimselpass.
At the Grimselpass, Daniel decided to split from us and go ahead faster (generally, he was much faster than Maciej and me and was waiting for quite frequently). His plan was to go directly down to Meiringen and then "enjoy" a steep ascent to Grosse Scheidegg and down to Grindelwald. Maciej and I stayed at Grimselpass for a while -- I went to visit a crystal "cave" (a collection of crystals from different parts of Alps) and Maciej was having his late lunch. After a pause, we went for our final climb -- from Grimselpass to Oberarsee dam. We were half the way up when, surprise, we met Daniel. He changed his mind after seeing a map at Grimselpass and realized that the way to Oberaarsee is quite uphill. We said farewell again to him.
Oberaarsee is the second highest (elevation) dam I visited. With surface elevation of a few meters over 2300m, it was beaten only by a Griessee dam near Nufenenpass. With views to the Oberaarchletscher, this was a good reward for finishing our climb. And while you can definitely sit there for a few hours, we did not have so much time and after a I did a short walk (Maciej was lazy), we returned back (with a short stop at Triebtenseeroli lake) back to Grimselpass.
From there, we really enjoyed a 30km long descent to Innertkirchen. To Maciej's horror, the road from Innertkirchen to Meiringen was hiding another climb. It was however a short trip and we quickly managed to get to Meiringen with the bonus that we arrived on time to quickly get into the train in the direction to Interlaken.
For thoso of you who did not climb Furka&Grimse, here are photos.
Mauvousin
My "Tour de Suisse barrages" continues. This time, I went to the dam of Mauvousin. The start is in Le Chable, under famous ski village Verbier. From there, I obviously went upwards valley, towards Fionnay which is hydroelectric power station and a little dam getting water from Grande Dixence complex (Grande Dixence is on my "to-climb" list). But the highlight of Fionnay isn't the little dam or hydroelectric power plant.
The highlight is a really high waterfall (unfortunately, I do not know the name as it is not named on the map).
From Fionnay, the road continues directly to Mauvousin. At the beginning there is a moderate slope but the height difference will catch on later, especially very near the dam. After catching my breath and having a lunch, I started my route around the dam. It starts with a long tunnel (+ several shorter ones) climbing a hundred meters above the dam.
Meanwhile, you will pass a tunnel with water which is a source of a big waterfall. Apparently, the Swiss people like digging tunnels because this one starts a few kilometers away in a nowhere place near the stream of Dyure de Sery. They probably need to supply a lof of water to the dam when they are producing the electricity.
The road, however, does not end at the other end of the lake. In fact, you can go much higher as there is a gravel road to a high alping hut Cabanne de Chanrion. From there (height 2460m) I had a nice view of all the big mountains around. For a while, I debated continuing even more (and completely around the lake) but that would mean climbing another two hundred meters and a road on unknown quality (it is a hiking road). Moreover, the sun seems to be smiling less through the clouds so I decided to simply go back the same way.
However, the way back wasn't so boring. Just as I was leaving Mauvousin, I managed to fell with my bike. I was going down on an asphalt road and with my right hand I was trying to fix my saddle. And suddenly, because I was braking with my left hand, the bike started to rotate (more precisely, started to pitch). You may guess what is the reflex for that situation (if you guessed "brake even more" than you are correct). Fortunately, I managed to land better than I expected at the moment. Although I scratched my right elbow quite deeply, it wasn't really bleeding and I managed to wash it in a stream. I hope it will heal soon.
As usual, photos are here.
The highlight is a really high waterfall (unfortunately, I do not know the name as it is not named on the map).
From Fionnay, the road continues directly to Mauvousin. At the beginning there is a moderate slope but the height difference will catch on later, especially very near the dam. After catching my breath and having a lunch, I started my route around the dam. It starts with a long tunnel (+ several shorter ones) climbing a hundred meters above the dam.
Meanwhile, you will pass a tunnel with water which is a source of a big waterfall. Apparently, the Swiss people like digging tunnels because this one starts a few kilometers away in a nowhere place near the stream of Dyure de Sery. They probably need to supply a lof of water to the dam when they are producing the electricity.
The road, however, does not end at the other end of the lake. In fact, you can go much higher as there is a gravel road to a high alping hut Cabanne de Chanrion. From there (height 2460m) I had a nice view of all the big mountains around. For a while, I debated continuing even more (and completely around the lake) but that would mean climbing another two hundred meters and a road on unknown quality (it is a hiking road). Moreover, the sun seems to be smiling less through the clouds so I decided to simply go back the same way.
However, the way back wasn't so boring. Just as I was leaving Mauvousin, I managed to fell with my bike. I was going down on an asphalt road and with my right hand I was trying to fix my saddle. And suddenly, because I was braking with my left hand, the bike started to rotate (more precisely, started to pitch). You may guess what is the reflex for that situation (if you guessed "brake even more" than you are correct). Fortunately, I managed to land better than I expected at the moment. Although I scratched my right elbow quite deeply, it wasn't really bleeding and I managed to wash it in a stream. I hope it will heal soon.
As usual, photos are here.
Family visit
My family again decided to visit me this summer. And as usual, I was supposed to come up with ideas for trips and excursions (and optimize them for travelling). Here is what I came up with
On Saturday, our first stop was Pissevache waterfall near Martigny. The waterfall is visible even from highway but standing below this impressive 60m high fall is another matter. After this short stop, we continued towards Sion and Sierre where we stopped at village Lac St Leonard with quite nice subterranean lake -- basically a cave filled with water. From there we continued to Blatten where I wanted to hike through a long suspension bridge. Unfortunately, I severely overestimated hiking speed of my mother and brother and therefore we made it only to Riederfurka (the weather wasn't so good and we would return too late from the trip)
Sunday was a bit harder to schedule. Especially because we wanted to visit salt mines in Bex and they recommend booking entry timeslots. As it turned out, we were not able to book the first possible entry and therefore needed to spend some time in the morning. Therefore, I decided to visit Orbe -- a village near where I live.
Orbe is small old village but it is really nice. Probably the biggest attraction is the Orbe castle and a big round tower called Tour Ronde.
From Orbe we went to Bex, an old salt mining city. The visit of salt mines starts with a more than 1km of ride in a train inside mine tunnels. From there, you will follow a short route during which you will learn about how the salt was mined in the past and what is different now. And in the end, you will get another long ride on a train.
Because the weather was really nice, after a lunch break we decided to try another trip. My plan was to go from Lac D'Emosson through Lac du Vieux Emosson to the place with real dinosaur traces. Unfortunately, my plans were destroyed because of construction works at Vieux Emosson. They are building another hydroelectric power plant and the whole road to the second dam is closed. As we learnt later, they even completely drained it. Anyway, because of this complication, the only possible road to the dinosaur traces was through mountain and I got a lot of complaints for this.
On the other hand, going through the gorge and mountain had its advantages. We saw a lot of Alpine Ibexes and they weren't really afraid of us. One of them let us to go just a few meters from him (but did not let us to touch him). Overall, a very nice bonus to the trip.
Photos from Saturday: Pissevachefalle, Lac St. Leonard and trip Blatten-Riederfurka.
Photos from Sunday: Orbe, Salt mines Bex and Lac D'Emosson
Sunday was a bit harder to schedule. Especially because we wanted to visit salt mines in Bex and they recommend booking entry timeslots. As it turned out, we were not able to book the first possible entry and therefore needed to spend some time in the morning. Therefore, I decided to visit Orbe -- a village near where I live.
Orbe is small old village but it is really nice. Probably the biggest attraction is the Orbe castle and a big round tower called Tour Ronde.
Because the weather was really nice, after a lunch break we decided to try another trip. My plan was to go from Lac D'Emosson through Lac du Vieux Emosson to the place with real dinosaur traces. Unfortunately, my plans were destroyed because of construction works at Vieux Emosson. They are building another hydroelectric power plant and the whole road to the second dam is closed. As we learnt later, they even completely drained it. Anyway, because of this complication, the only possible road to the dinosaur traces was through mountain and I got a lot of complaints for this.
On the other hand, going through the gorge and mountain had its advantages. We saw a lot of Alpine Ibexes and they weren't really afraid of us. One of them let us to go just a few meters from him (but did not let us to touch him). Overall, a very nice bonus to the trip.
Photos from Saturday: Pissevachefalle, Lac St. Leonard and trip Blatten-Riederfurka.
Photos from Sunday: Orbe, Salt mines Bex and Lac D'Emosson
Monday, August 13, 2012
Bike trilogy part III - A double
After our climb to St Bernard pass, Maciej and I looked seriously into the list of highest Alpine passes. St Bernard (2469m) was third highest in Switzerland. Remaining two are Nufenenpass (2478m) and Umbrailpass (2501m) (with bonus Stelviopass (2757m) part in Italy). Thus, the plan was clear -- we need to beat these two (three). As a part of this plan, we decided to do a grand triple Nufenen, Gotthard & Furka. However this was very ambitious and it was estimated to be a two-day ride which was fine except for the fact that there was nowhere to sleep (for a reasonable price). Thus, we decided that just two of them must do. The best option was Nufenen & Gotthard as this left a potential for Furka&Grimsel next time.
Therefore, on Tuesday (just two days after my Jura trip with Daniel), we take a train to Ulrichen and started a twelve kilometers long ascent to Nufenenpass with the stop at Griessee dam. We enjoyed views to Griesgletcher and then continued last two hundreds of meters of ascent to Nufenenpass.
Descent from Nufenenpass to Airolo was quite long (and on quite terrible road, welcome to Italian canton). In fact, it is so long (25km) that it was obvious we have chosen a correct side for climbing as the other way would take forever as we are quite slow even on very small slopes. This way, Airolo welcomed us with just small pedaling at the end (and most notably some road constructions with annoying traffic lights).
After a lunch break at Airolo, we were ready for Gotthardpass. And here it was again obvious that our decision to take trip in this direction was quite good. Quite unexpectedly, the asphalt route turned into an old stone-paved road which was quite pleasant (definitely not so boring as asphalt). Moreover, as this road was not built with speed in the mind, there were a lot of cute little hairpins and near the top we even met an coach with tourists. And then it was time for another set of pass-pictures.
But we did not stop at Gotthardpass. That would mean missing views to two dams -- the first was Lago della Sella with incredibly blue water. In fact, it was so blue that I had an impression that I am near the sea and not 2256 meters above. The second one was Lago di Lucendro but it was getting late and cloudy so we just did a quick climb without really going all the possible way around. And that was it, the rest of the trip was just a quick descent to Hospental where we took our train back.
You can enjoy photos here.
Therefore, on Tuesday (just two days after my Jura trip with Daniel), we take a train to Ulrichen and started a twelve kilometers long ascent to Nufenenpass with the stop at Griessee dam. We enjoyed views to Griesgletcher and then continued last two hundreds of meters of ascent to Nufenenpass.
Descent from Nufenenpass to Airolo was quite long (and on quite terrible road, welcome to Italian canton). In fact, it is so long (25km) that it was obvious we have chosen a correct side for climbing as the other way would take forever as we are quite slow even on very small slopes. This way, Airolo welcomed us with just small pedaling at the end (and most notably some road constructions with annoying traffic lights).
After a lunch break at Airolo, we were ready for Gotthardpass. And here it was again obvious that our decision to take trip in this direction was quite good. Quite unexpectedly, the asphalt route turned into an old stone-paved road which was quite pleasant (definitely not so boring as asphalt). Moreover, as this road was not built with speed in the mind, there were a lot of cute little hairpins and near the top we even met an coach with tourists. And then it was time for another set of pass-pictures.
But we did not stop at Gotthardpass. That would mean missing views to two dams -- the first was Lago della Sella with incredibly blue water. In fact, it was so blue that I had an impression that I am near the sea and not 2256 meters above. The second one was Lago di Lucendro but it was getting late and cloudy so we just did a quick climb without really going all the possible way around. And that was it, the rest of the trip was just a quick descent to Hospental where we took our train back.
You can enjoy photos here.
Wednesday, August 8, 2012
Bike trilogy part II
Second part of my bike trilogy was only a day after my bike trip to Lac de Moiry. Together with Daniel, we went to trip from Neuchâtel. I was quite happy to go (for a change) on somewhat flatter surface than Alps -- Jura is much flatter, isn't it? Well, although certainly Jura mountains are not so high as Swiss Alps, they are not negligible. In fact, we started with serious 500m climb directly from Neuchâtel to Valangin and then to Les Hauts-Geneveys where we had lunch. From there we obviously continued to the highest peak in the vicinity - Tête de Ran.
Here I must say that I really prefer Alps than Jura for a simple reason -- when you finally climb some high Alpine pass, the way down is zero-energy-expenditure. However, Jura is quite different. You are still going down and up and down and up ... Anyway, we descended to La Chaus-de-Fonds and took (hilly) bike road towards Tramelan. However, near St Imier it was clear that we are far behind the schedule (mainly because of me, Daniel was always faster). Thus, we descended to St Imier where we learn that we missed the train. And because Daniel was really in the mood for some serious workout, he suggested that we climb Mt Soleil while waiting for a train.
To sum up -- never underestimate Jura mountains. They might not be so big but they are still big enough to cause consistent trouble ;-)
P.S. More photos are here.
Here I must say that I really prefer Alps than Jura for a simple reason -- when you finally climb some high Alpine pass, the way down is zero-energy-expenditure. However, Jura is quite different. You are still going down and up and down and up ... Anyway, we descended to La Chaus-de-Fonds and took (hilly) bike road towards Tramelan. However, near St Imier it was clear that we are far behind the schedule (mainly because of me, Daniel was always faster). Thus, we descended to St Imier where we learn that we missed the train. And because Daniel was really in the mood for some serious workout, he suggested that we climb Mt Soleil while waiting for a train.
To sum up -- never underestimate Jura mountains. They might not be so big but they are still big enough to cause consistent trouble ;-)
P.S. More photos are here.
Tuesday, August 7, 2012
Small screen big window trick
Ever happened to you that you opened some application on your netbook with screen resolution small x even smaller and the application contains big unresizable window? And do you know the frustration when the thing you need to click (save/ok/whatever) is in the bottom part of the window which is invisible to you? Then you know what I am talking about. Especially because you cannot move window above top of the screen. Well, at least, not with only mouse. Today, I am proud to introduce you a linux (gnome) solution for this problem. It is called ALT+F7 and it is "move window" shortcut. Except, for some strange reason, there is no limitation on where you move the window with this shortcut, i.e. you can move it over top edge of the screen!
Bike trilogy - part I
The trip was quite eventful. I started by getting into a wrong train. Seriously! I was standing on the platform and two trains come, one to Geneva and one to Brig. But they arrived at different tracks that was announced. So I tried to be clever and entered the one in the good direction. Except for the fact that they reversed both trains (although I was keeping an eye on potential change of the locomotive) and I ended up going to Geneva instead of Sierre.
My goal was to go from Sierre (540m) to Lac De Moiry(2250m). In order to avoid frequent main road towards Zinal, I decided to take less frequent one through Vercorin and Val d'Anniviers. This implied ascending another couple of hundreds of meters more (from Giettes d'en Bas (1460m) I descended to Mayoux (1200m)). From Mayoux it was tiresome climb, the ascent was quite steep and I was already tired from previous climb. Therefore I was stopping a lot to catch my breath. The last half a kilometer was especially steep and I was glad when I climbed through the final tunnel directly to the dam.
There I worked a few minutes with my mouth in order to increase my chemical energy. I did not stay too long however. The sun was hidden behind clouds, the temperature wasn't exactly 30 degrees and the wind made it even worse. To heat up, I continued on the road for another 4 kilometers to the small lake below the glacier where the road ended. Took several photos and quickly decided to go back because the weather did not look so great.
On my way back, I took a "shortcut" down on a mountain-bike road. Very great and steep descent (I was glad I did not choose this road for ascent). The only problem with the road was that my hand muscles were quite tired from braking all the time.
After stopping at Grimentz for some food and consequently discovered that there was some culture festival, I descended again to Mayaux where I took a more direct road to Sierre. Maybe a kilometer later, near small hydroelectric plant, I decided that instead of taking main road which climbed a few tens of meters I can take an asphalt road parallel to the stream. Never mind that it was marked as dead-end. There was a bike sign there and also my GPS was pretty convincingly routing me there. It was therefore a surprise when after maybe five kilometers the road suddenly ended with another hydroelectric plant and that was it. GPS was happy directing me over some hiking trail which was obviously used only rarely. With panic, I figured out that the best solution would be to use different hiking trail which climbed maybe 200 meters but at least seemed to be decent. With sweating, I started pushing my bike ...
And because it was so nice day, my bike decided to make me even happier. Suddenly, there was a crash. When I looked back, the bag holder above rear wheel wasn't above rear wheel, rather it was lying on the ground. Great, what a fortune! Fortunately it was only unscrewed and I managed to fix it with plastic wire used for organizing computer cables.
Back to pushing the bike. And swearing that I should better check tracks proposed by my GPS. Finally up to small willage Fang and back on asphalt road. The rest of the trip was just dreamy downhill!
As usual, you can find photos here.
Wednesday, July 11, 2012
PHP and consistency? No way
Today I was debugging my PHP code and trying to figure out why my references (quite nasty feature of PHP but sometimes required) do not work only to learn that my bug was in array_key_exists function call.
So, try to guess what are the arguments for array_key_exists. If you think it is
you are quite wrong, just read the documentation:
You may say, ok, this is just a convention. Well, not exactly, looking at the manual, one can summarize the functions as following:
vs
But the best part is this (can you spot the black sheep?):
In summary, PHP requires a manual, unless you are good at guessing/coin flipping.
Bonus from the manual:
So, try to guess what are the arguments for array_key_exists. If you think it is
array_key_exists($array, $key)
you are quite wrong, just read the documentation:
array_key_exists ( mixed $key , array $search )
You may say, ok, this is just a convention. Well, not exactly, looking at the manual, one can summarize the functions as following:
array array_change_key_case ( array $input [, int $case = CASE_LOWER ] )
array array_chunk ( array $input , int $size [, bool $preserve_keys = false ] )
vs
array array_combine ( array $keys , array $values )
array array_fill_keys ( array $keys , mixed $value )
mixed array_search ( mixed $needle , array $haystack [, bool $strict = false ] )
bool in_array ( mixed $needle , array $haystack [, bool $strict = FALSE ] )
But the best part is this (can you spot the black sheep?):
array array_filter ( array $input [, callable $callback = "" ] ) array array_map ( callable $callback , array $arr1 [, array $... ] ) mixed array_reduce (array $input, callable $function [, mixed $initial = NULL ] )
In summary, PHP requires a manual, unless you are good at guessing/coin flipping.
Bonus from the manual:
string implode ( string $glue , array $pieces )
string implode ( array $pieces )
Sunday, July 8, 2012
Grand St Bernard pass on a bike
On Saturday Maciej and I went to a quite challenging bike trip from Orsieres (cca 900m) to St Bernard pass (2470m). It was very good trip. We started at Orsieres and used forest roads along the river all the way up to Bourg St Pierre (except for a special "bonus" section right before Pont de la Tsi where we needed to carry our bikes 200m uphill on a hiking trail with traverses and wooden steps).
From there, we continued to dam of Lac des Toules, where we climbed up and started second bonus part -- trail along Lac des Toules is just a big hiking trail and we were glad that most of the part was downhill. After the dam, we crossed the river and tried to go to Bourg St Bernard. Except ... it wasn't easy. There were two possibilities: a) cross another stream on an iron bar probably 30cm wide which would be fine on foot but a crazy idea on bikes b) cross the stream on a very inconvenient place c) take stairs to the roof of the tunnel. We took last option in the hope that it was designed as a hiking trail -- a big mistake. The roof wasn't particularly good for biking (or hiking for that matter). So we went down on the other side of the tunnel but our problem remained -- there was a road but there was also a big stream through it. After enumerating possible choices, we went for the easiest -- cross the stream with naked foot. And it was really cool (or I should say really cold -- water was probably from melting snow). This was however final obstacle and we reached Bourg St Bernard (1900m) where the majority of cars go to the St Bernard tunnel and thus there is less traffic on the old road. There we had a lunch and started the last part of our trip -- final (and quite hard) 600m of ascent on an asphalt road.
But it was worth the sweat. The views from St Bernard pass were amazing. After we went a few hundreds of meters in Italy, returned back, shopped for souvenirs and visited church with a display of old relics, it was time to go down. This time, we chose the main road all the way down.
Hungry for more photos? Here they are.
Vim, your gpx swiss knife
Did you ever have a gps file which was consistently moved from the map by few meters?
It happens mainly if you are travelling fast and the gps tries to catch up after tunnels or other losses of a signal. But now there is universal solution to it. And it is in VIM!
Just get the offset (in lat/lng), open file in vim, select problematic region (it helps if the file is not in one line as some programs prefer) and run following mega-command:
:'<,'>s/lon="\([0-9.]*\)"/
\='lon="'.printf('%.10f',str2float(submatch(1))+0.002).'"'/
To explain few things:
:'<,'> matches on selected lines
s/xxx/yyy/ replaces regrexp with yyy
\(xxx\) is a submatch
[0-9.]* matches floating point value
\= tells vim to use expressions instead of strings while replacement
'xxx' is a string expression
. concatenates string expressions
str2float(submatch(1)) gets a floating point value of the matched latitude/longitude
It happens mainly if you are travelling fast and the gps tries to catch up after tunnels or other losses of a signal. But now there is universal solution to it. And it is in VIM!
Just get the offset (in lat/lng), open file in vim, select problematic region (it helps if the file is not in one line as some programs prefer) and run following mega-command:
:'<,'>s/lon="\([0-9.]*\)"/
\='lon="'.printf('%.10f',str2float(submatch(1))+0.002).'"'/
To explain few things:
:'<,'> matches on selected lines
s/xxx/yyy/ replaces regrexp with yyy
\(xxx\) is a submatch
[0-9.]* matches floating point value
\= tells vim to use expressions instead of strings while replacement
'xxx' is a string expression
. concatenates string expressions
str2float(submatch(1)) gets a floating point value of the matched latitude/longitude
Tuesday, July 3, 2012
Ppershing:Sustenpass 0:1
Welcome to the match between Ppershing and Sustenpass. The bicycle is starting at home field near Realp and PPershing is pushing fast towards Andermatt. There, he kicks in the direction of Göschenen and bike is going fast downhill. The bike is near Göschenen and the player is kicking ... nooo, in the wrong direction. The bike is slowly climbing towards Göschneralp, through high grass. Bike and the player are in the off-road position. Finally, the touchdown in Göschnealp and half-time break. After the game is restarted, bike is again kicked towards Göschenen and from there to Wassen. And here Sustenpass starts actively playing. Sustenpass is defending by off-road and gradient tactic. Ppershing is clearly out of breath and he is not able to make any long kicks. In fact, several times he is just pushing the bike by hands. And the game is near the end -- the reserved time is almost over. It is unlikely that Ppershing will score in this game. In order to avoid even bigger defeat, Ppershing ends at 1600 metres out of 2200 and returns to home. The result of game is 0:1 but PPershing says he will try it again and will be better prepared.
Photos from the match
Photos from the match
He's half-dead, Jim
Computers never fail to impress me. At least mine computers. They always have some new way of failing. For example, yesterday my old laptop (really a piece of crap now, but I use it as my desktop) started running only on the battery. Hmm, wait, why is my laptop running on the battery, especially when it is plugged into the power? This happened a few times ago because of the overheating. However, right after the start there is a little change of overheating. So what is the problem? Finally my power source broken down? Or maybe n-times patched connector? Well, I just shot down the computer and ... surprise ... the battery is charging. What the heck? I turn on the computer and ... AC power led just dies. Veeery strange. Anyway, it seems that my power source is half-broken and not able to produce enough voltage/current. Therefore, the laptop decides to go with the battery which is after 5 years almost dead too. A very unlucky combo...
So, my third option -- go without battery. It seems that this is the most promising solution -- when laptop dehibernates, it seems to be running without any problems. Except for the fact that it dies with high probability (which can be reduced by plugging out usb devices) during the dehibernation process.
So, my third option -- go without battery. It seems that this is the most promising solution -- when laptop dehibernates, it seems to be running without any problems. Except for the fact that it dies with high probability (which can be reduced by plugging out usb devices) during the dehibernation process.
Saturday, June 16, 2012
Duathlon
Sometimes I am wondering why I am so stupid. Especially, so stupid to try to participate in different races. Recently I got this idea that biking + running (=duathlon) might be a good idea. It may push my physical limits.
Well, I was right. I severely underestimated biking part. 700m of ascent does not seem to be a big deal, except that 700m of ascent on unpaved road is ... hell. And even when I really tried (and my heart rate suggests that I tried), I was very slow. But the real bonus was running. After being completely flattened out during the biking, I was unable to run. It was just impossible. I just walked all uphill parts.
In total, it was a devastating experience. But one thing still bugs me -- with this perfect speed, how did I manage not to be the last? (I was the second last :-))
Well, I was right. I severely underestimated biking part. 700m of ascent does not seem to be a big deal, except that 700m of ascent on unpaved road is ... hell. And even when I really tried (and my heart rate suggests that I tried), I was very slow. But the real bonus was running. After being completely flattened out during the biking, I was unable to run. It was just impossible. I just walked all uphill parts.
In total, it was a devastating experience. But one thing still bugs me -- with this perfect speed, how did I manage not to be the last? (I was the second last :-))
Wednesday, June 13, 2012
First real bike trip
(English text below)
Mon première réelle route à velo a été. J'ai commencé à Aigle et je suis monté vers Corbeyrier. Après, j'ai continué à Les Agites. Il y a un tunnel juste avant Les Agites et vous pouvez aller qu'une seule fois par heure. Ce fut la première ascension, 1000m en tout. Après, je ai descendu vers Lac de l'Hongrin. Le lac est joli et il y a un grand barrage au bout. Apès le lac j'ai continuè vers Les Cases et je suis monté Col de Jamal. Le montée a été très diffucile -- 500m sur route des champs. Mais il a valu la peine. Le dernière descente a été 1000m sans interruption.
My first real bike trip was real success with two major climbs 1000m and 500m. I started at Aigle and climber through nice vineyards towards Corbeyrier. After that, I continued climbing up up to tunnel to Les Agites. After this initial 1000m climb, the route was better. I gradually descended towards Lac de l'Hongrin, went along its shores, near the big dam and down the valley towards Les Cases. Here I started my second ascent. This time only 500m. And with a bonus part blocked by cows. Anyway, on unpaved road and after the previous climb, this one felt more like several kilometers. But after reaching Col de Jaman it was clear that the sweat was worth it. The last part of my trip was descent. Plain, one kilometer of altitude descent. I briefly stopped at Caux to see a ibg meadow full of daffodils. And by full I mean full -- the daffodils made it pretty clear to any other flower that this is their territory. The final few kilometers were on flat -- in Montreux I learnt that I just missed my train so I continued on bike to Vevey.
Trip route (this is the plan, the actual route was a bit different from Caux)
Mon première réelle route à velo a été. J'ai commencé à Aigle et je suis monté vers Corbeyrier. Après, j'ai continué à Les Agites. Il y a un tunnel juste avant Les Agites et vous pouvez aller qu'une seule fois par heure. Ce fut la première ascension, 1000m en tout. Après, je ai descendu vers Lac de l'Hongrin. Le lac est joli et il y a un grand barrage au bout. Apès le lac j'ai continuè vers Les Cases et je suis monté Col de Jamal. Le montée a été très diffucile -- 500m sur route des champs. Mais il a valu la peine. Le dernière descente a été 1000m sans interruption.
My first real bike trip was real success with two major climbs 1000m and 500m. I started at Aigle and climber through nice vineyards towards Corbeyrier. After that, I continued climbing up up to tunnel to Les Agites. After this initial 1000m climb, the route was better. I gradually descended towards Lac de l'Hongrin, went along its shores, near the big dam and down the valley towards Les Cases. Here I started my second ascent. This time only 500m. And with a bonus part blocked by cows. Anyway, on unpaved road and after the previous climb, this one felt more like several kilometers. But after reaching Col de Jaman it was clear that the sweat was worth it. The last part of my trip was descent. Plain, one kilometer of altitude descent. I briefly stopped at Caux to see a ibg meadow full of daffodils. And by full I mean full -- the daffodils made it pretty clear to any other flower that this is their territory. The final few kilometers were on flat -- in Montreux I learnt that I just missed my train so I continued on bike to Vevey.
Trip route (this is the plan, the actual route was a bit different from Caux)
Sunday, June 10, 2012
Even running can be beautiful
J'ai un joli parcours pour la course. Le parcours se commence a Bussigny et il se termine a EPFL. La longuer est neuf kilomètres.
Au début, vous pouvez voir petits jardins. Après un certain temps, les jardins se transforme dans la forêt. Un joli forêt. Il y a beaucoup de fleurs différentes. Le plus belle est ail des ours. Il se trouve le long de entier parcours. Après la forêt vous vous trouvez près de la plage. Vous pouvez voir les Alpes françaises. Le dernière partie de la route est dans les roues de Saint Sulpice. Vous vous approachez l'église de St Sulpice, un parc et vous pouvez vous retrouver devant l'EPFL.
So, did you like it? If yes and you are not from Lausanne -- well, you should reconsider the place where you live. And if you are from Lausanne then just join us the next time will be running. It is worth it!
Saturday, June 2, 2012
Round and round around the floats
Isn't rounding numbers easy? Well, not always. And not always consistent:
Python (the same for C/C++,):
But that is nothing compared to results obtained from MySQL today:
+--------------+----------------+
| sum(penalty) | count(penalty) |
+--------------+----------------+
| 5091 | 24 |
+--------------+----------------+
+------------------------+--------------+
| ROUND(avg(penalty), 2) | avg(penalty) |
+------------------------+--------------+
| 212.12 | 212.125 |
+------------------------+--------------+
Python (the same for C/C++,):
>>> "%.1f" % 0.05 '0.1' >>> "%.1f" % 0.15 '0.1' >>> "%.1f" % 0.25 '0.2' >>> "%.1f" % 0.35 '0.3' >>> "%.1f" % 0.45 '0.5' >>> "%.1f" % 0.55 '0.6' >>> "%.1f" % 0.65 '0.7' >>> "%.1f" % 0.75 '0.8' >>> "%.1f" % 0.85 '0.8' >>> "%.1f" % 0.95 '0.9'
But that is nothing compared to results obtained from MySQL today:
+--------------+----------------+
| sum(penalty) | count(penalty) |
+--------------+----------------+
| 5091 | 24 |
+--------------+----------------+
+------------------------+--------------+
| ROUND(avg(penalty), 2) | avg(penalty) |
+------------------------+--------------+
| 212.12 | 212.125 |
+------------------------+--------------+
+-------------------+-------------------+
| ROUND(212.125, 2) | ROUND(5091/24, 2) |
+-------------------+-------------------+
| 212.13 | 212.13 |
+-------------------+-------------------+
The nightmare is over
IPSC, the nightmare of my dreams (or more precisely of their lack) is finally over. And I am really glad. Preparing tasks D (data mania) and J (jukebox) was really hard. Especially the former will be haunting me for a while and I will never ever look at SQL statements with the same eyes. During the final preparation night, we found so many differences and stupid mistakes in seemingly easy SQL statements that it it impossible to count (ok, it is possible. Roughly as number of a commits affecting inputs/outputs of that task). Just check the solutions for a quick peek over this nightmarish world of queries and results.
So what to do now? Just continue with the second nightmare -- my candidacy exam for which I need to finish my writeup in one week.
So what to do now? Just continue with the second nightmare -- my candidacy exam for which I need to finish my writeup in one week.
Wednesday, May 30, 2012
Busy? That is an understatement!
These days I am so busy that I really do not know what to do first. I need to finish my tasks for IPSC, optimally today's evening. I need to read 3 more scientific articles (5 done so far) and watch several presentations for tomorrow's exam from my networking class. Next Friday we are submitting a paper to CoNEXT. On 13th, I need to submit the final version of my candidacy exam proposal. On 20th, there is my candidacy exam for which I need to prepare (and beta-test) my presentation. One day after, I am submitting my networking class miniproject report. Finally, on 6th June I need to submit my project report. Did I forgot something? Oh well, there will be Java class exam (I do not know yet) for which I will need to judge a hundred sheets of paper handwritten in French, probably with the deadline roughly 10 days.
So, can you beat me? Do you have more (or more tighter) deadlines?
So, can you beat me? Do you have more (or more tighter) deadlines?
Rejected!
My paper to HotSDN about why rules should not rule was rejected. Certainly I am not in so bad mood as after the rejection from my first love. But that is maybe because I was prepared for paper rejections -- it is certainly not easy to get into a conference/workshop. So should I divorce with the idea? Maybe. It seems that I am playing on somebody else's ground and maybe there is not enough space. Anyway, I will let it be for now -- I have a lot of other things to do.
Saturday, May 26, 2012
EPFL Vivapoly's RLC run
Le jeudi j'ai participé à Vivapoly course à pied. La longueur était 3.5km, assez court. Mon plan était de terminer dans 16 minutes. Mais ce n'était pas possible. J'ai terminé et 17 minutes et 30 secondes -- exactement 5 minutes par kilomètre.
Codejam fail
Comme d'habitude, mes competences en programmation ne sont pas satisfaisants. J'ai fini sur 806e place et je n'ai pas avancer à 3e ronde. Mais j'ai gagné un tee-shirt :-)
Vous povuvez voir les problèmes et résultats.
Vous povuvez voir les problèmes et résultats.
Thursday, May 24, 2012
P=NP?
Based on the http://www.win.tue.nl/~gwoegi/P-versus-NP.htm I would like to take a new approach on deciding P=NP. Indeed, after sketching through the list, it seems that P=NP does not have a definite answer and its validity depends on some random variable.
Thus, the P=NP holds approximately 50% of the time.
Want to re-check my findings?
> wget 'http://www.win.tue.nl/~gwoegi/P-versus-NP.htm'
> NO=`cat P-versus-NP.htm | grep '\[Not equal\]' | wc -l`
> YES=`cat P-versus-NP.htm | grep '\[Equal\]' | wc -l`
> echo "100*$YES/($YES+$NO)" | bc -l
The result is that P=NP for approximately 51.7% of the papers, therefore under the assumption of uniform distribution we may conclude that P=NP holds roughly half of the times you try to solve it :-)
Thus, the P=NP holds approximately 50% of the time.
Want to re-check my findings?
> wget 'http://www.win.tue.nl/~gwoegi/P-versus-NP.htm'
> NO=`cat P-versus-NP.htm | grep '\[Not equal\]' | wc -l`
> YES=`cat P-versus-NP.htm | grep '\[Equal\]' | wc -l`
> echo "100*$YES/($YES+$NO)" | bc -l
The result is that P=NP for approximately 51.7% of the papers, therefore under the assumption of uniform distribution we may conclude that P=NP holds roughly half of the times you try to solve it :-)
Wednesday, May 23, 2012
Google translate
Google translate vous donne parfois des résultats étranges. Mais cette traduction est beaucoup trop.
Thursday, May 17, 2012
Jour férié? Pas pour moi.
Aujourd'hui est un jour férié en Suisse. Mais je n'ai pas eu le temps. Je prépare des problèmes de IPSC tout le jour. IPSC est une internationale compétition de programmation et je suis l'un des organisateurs. Vous êtes invités à participer le Samedi 2er juillet.
Going français
In order to practice my french, I decided to try to use it also on this blog. You may guess that I will write only a simple texts and with heavy help of dictionaries and Google translate. Moreover, there will be probably a ton of errors. So if you parle français, I will be glad to receive any feedback/corrections to my posts. And if you do not speak french, I guess you can use Google translate as well to translate my posts. If nothing else, you may get very funny results, especially if translating to a less common language.
Wednesday, May 16, 2012
Latex figures disappearing? Why not...
Latex is a fine system but sometimes it have its own quirks. For example yesterday I spend at least one hour trying to figure out where are my figures. Figures are parsed, but then, nothing is placed on the page. Even latex logs were not helping. Today, I know what was the problem -- I had one figure which is together with the previous figure longer than one page. This is normal case for figures. However, I am using the two-column style, the first figure is spanning two columns, the second one just one column. And apparently, if you combine all these aspects together you get -- nothing. Big nothing instead of second figure. And more interestingly, big nothing instead of all successive figures. So, beware of the long figures!
To hash, to map?
As the question in the title says, in this post I will be comparing the two C++ std library algorithms, unordered_map (formerly known as hash_map) and map. The focal point of the comparison is the memory -- which algorithm is more effective? For this purpose, I created a simple program which inserts N random keys into the data structure. Then I needed to obtain a memory information. At the first glance, it seemed that
will be sufficient. However, after going through a painful excercise with the std::vector, it seems that vector (and therefore probably also unordered_map) use some other weird technique -- instead of malloc()-ing the data, the vector mmap()-s some memory blocks! Thus, the real memory usage is more like
Anyway, here is the program:
And the results:
(Note that 2 integers (key&value) consume 8 bytes).
map: Items: 1000, Mem: 48000, per-entry: 48.0
map: Items: 10000, Mem: 480000, per-entry: 48.0
map: Items: 100000, Mem: 4800000, per-entry: 48.0
map: Items: 1000000, Mem: 48000000, per-entry: 48.0
map: Items: 10000000, Mem: 480000000, per-entry: 48.0
hash: Items: 1000, Mem: 46016, per-entry: 46.0
hash: Items: 10000, Mem: 441504, per-entry: 44.2
hash: Items: 100000, Mem: 4211808, per-entry: 42.1
hash: Items: 1000000, Mem: 40454240, per-entry: 40.5
hash: Items: 10000000, Mem: 463691872, per-entry: 46.4
The conclusion? Both hashing and binary trees use roughly the same amount of memory (hashing a bit less but it is fluctuating as the hash-table is resized). And the overhead is quite big -- 5 to 6 times for the integer key-value pair.
mallinfo().uordblks
will be sufficient. However, after going through a painful excercise with the std::vector, it seems that vector (and therefore probably also unordered_map) use some other weird technique -- instead of malloc()-ing the data, the vector mmap()-s some memory blocks! Thus, the real memory usage is more like
int mem = mallinfo().hblkhd + mallinfo().uordblks;
Anyway, here is the program:
#include <stdio.h> #include <malloc.h> #include <stdlib.h> using namespace std; #define HASH 0 #if HASH #include <unordered_map> typedef unordered_map<int, int> mymap; const char* text = "hash"; #else #include <map> typedef map<int, int> mymap; const char* text = "map"; #endif const int Ki = 1000; const int Mi = 1000 * Ki; const int TESTS = 5; int test_sizes[TESTS] = {Ki, 10 * Ki, 100 * Ki, Mi, 10 * Mi}; int main() { mymap mapa; for (int t = 0; t < TESTS; t++) { while (mapa.size() < test_sizes[t]) { int k = rand(); mapa[k]++; } // total memory (malloc + mmap) int mem = mallinfo().hblkhd + mallinfo().uordblks; printf("%s: Items: %d, Mem: %d, per-entry: %.1f\n", text, test_sizes[t], mem, mem * 1.0 / test_sizes[t]);
} }
And the results:
(Note that 2 integers (key&value) consume 8 bytes).
map: Items: 1000, Mem: 48000, per-entry: 48.0
map: Items: 10000, Mem: 480000, per-entry: 48.0
map: Items: 100000, Mem: 4800000, per-entry: 48.0
map: Items: 1000000, Mem: 48000000, per-entry: 48.0
map: Items: 10000000, Mem: 480000000, per-entry: 48.0
hash: Items: 1000, Mem: 46016, per-entry: 46.0
hash: Items: 10000, Mem: 441504, per-entry: 44.2
hash: Items: 100000, Mem: 4211808, per-entry: 42.1
hash: Items: 1000000, Mem: 40454240, per-entry: 40.5
hash: Items: 10000000, Mem: 463691872, per-entry: 46.4
Subscribe to:
Comments (Atom)



gluestring. Note: implode() can, for historical reasons, accept its parameters in either order. For consistency with explode(), however, it may be less confusing to use the documented order of arguments.