Wednesday, February 13. 2008
Judith posted about a funny experiment: Try to enter each letter of the alphabet into your browsers (I guess - or hope - most of you use Firefox, but most other browsers also support autocompletion) and collect the website it suggests first. This is most probably the website you visit most, starting with the specific letter. So, here is my list:
Tuesday, May 1. 2007
If you live in the north half of Germany or in a country that also has "Aldi Nord" discounters, you can now get a professional Chorizo cheaper than from Mayflower. ;)
Monday, April 2. 2007
I don't know which is the most common way to calculate Pi in computer programs, but from the stochastics book a read for my recent stochastics exam, I have a randomized variation, which is quite cool I think. To show it, I implemented it in PHP:
$precision = pow( 10, (int ) ini_get( "precision" ) - 5 ); $hits = 0; for ( $i = 0; $i < ITERATIONS; $i++ ) { $x = mt_rand( 0, 2 * $precision ) / $precision - 1; $y = mt_rand( 0, 2 * $precision ) / $precision - 1; if ( ( $x * $x ) + ( $y * $y ) < 1 ) { $hits++; } } echo "Pi is about " . ( ( 4 * $hits ) / ITERATIONS );
The basic assumption in this algorith is, that the generated coordinates are rectangular distributed in the rect (-1/-1) - (1,1). For the numbers I generate using mt_rand() this should be almost correct (note that the generation is not part of the algorith itself, it only says, that you need rectengular distributed points). For each of this generated points, a check is performed, if the point is located inside the unit circle. If it is, a hit is recorded. The relative frequence for this event is exactly the ratio between the unit circle and the whole square, which means it is Pi/4.
The algorith is not really fast, but gives usable results for a large number of iterations:
| Iterations |
Pi estimation |
Time (sec.) |
| 100 |
3.2 |
0.000174045562744 |
| 1000 |
3.128 |
0.00145411491394 |
| 10000 |
3.1436 |
0.0180418491364 |
| 100000 |
3.13876 |
0.16107583046 |
| 1000000 |
3.143652 |
1.64533686638 |
| 10000000 |
3.1423896 |
18.0556662083 |
Update, 2007-04-02: Note, that you should never use this algorithm to calculate Pi in PHP! There is the predefined constant M_PI, as well as the function pi() to retrieve a value with the precision specified in your php.ini! This is just a cool algorith and it's really slow (in comparison of using the constant)!
Tuesday, March 13. 2007
Today I needed to start up my VMWare to test some PHP stuff on a Windows XP installation. I was quite curious, how I would perform after more than 4 years completly without Windows. Here are my experiences...
The first thing I wanted to do was setting up PHP. After a glance of "emerge dev-lang/php" I decided to download XAMPP and install the all in one package. So far so good, PHP seemed to be running after not much hassle, although I first needed to figure out the website of XAMPP (it is here, if you are ever searching), then downlod the installer and run it manually. Anyway, it gave me a lot of extra stuff and in fact installed a complete web develompment environment for me.
Good, so I wanted to checkout eZ Components from SVN. I remebered how to open a (what they call) "console" using "Start" -> "Run" -> "cmd.exe" and typed "cd De<tab>". Wow, that even worked! I'm amazed. But that only for a few milliseconds, because "svn co http://svn.ez.no/svn/ezcomponents/trunk" produced a nice error message. So - after downloading SVN manually from the web, installing it and adding its binary to the PATH variable (thank god, someone in the office knew how to do this) - this worked, too. Setting up the eZ Components environment was as easy as on Linux, since we provide a script called "setup-env.bat", which handles that job for you.
I tried out running some of our test suites, which also worked fine and turned to debug the things I neede to debug... "vim ConsoleT<tab>/s<tab>" *gnarf*, the auto completion "feature" of the "console" only works with backslashes. Again... "vim ConsoleT<tab>\s<tab>"... gives "vim ConsoleTools\.svn"... *argh*. Whatever, when I finally had the correct path to the file I wanted to edit, I realized: There is no VI on Windows... Ok, so I downloaded GVIM for Windows and started editing and fixing.
Great, after some messing around with newlines on Windows, stuff worked as expected. "svn diff" produced a nice patch, which I could finally copy from VMWare to Linux again. Over there I noticed that I broke something and fixed that again. Another patch, copy to Windows "patch -p0 < patch.txt"... runs into an error... *grrr* So, I downloaded the patch binary, installed it and... ran into some weird error. Thank god I only changed 1 file and so decided to copy this one manually.
That's only a short abstract of my day with MS Windows XP and my personal result from this is: My finger hurts from all those mouse moving and clicking, my eyes hurt a bit from all those jumping windows and popup stuff, my blood presure is on about 180 because of the piece of shit what they call a console, I lost about 1 hour to search for software on the web and I was 3 times close to throwing my notebook out of the window...
My conclusion (again): Windows? No thanks!
Note: Some of the mentioned stuff definitly results from me not being used to that $%&!?ยง anymore, anyway, I think it sucks...
Friday, February 16. 2007
Yesterday (and today) I had an experience, which showed me once again, why I pay so much for a high quality notebook. During our (currently daily) learning sessions, the keyboard of my 1.5 years old IBM Thinkpad T43p lost it's backspace key. Somewhat annoyed I opened a support call on the IBM website (luckily, IBM has 3 years of guarantee) about it and (while having the chance) I added anothe issue with the notebook I now had for about 2-3 months. This one was, that I had a bunch of weird light-gray dots on my display, which actually looked like tiny liquid splashes. I was not able to kill them with a towel and therefore added the phenomenon to the support call, too. Anyway, I did not expect IBM to react on that issue, because it simply did not look like a guarantee issue to me.
After entering the support ticket, I went for a coffee, leaving my cellphone in another room. When I returned back (about half an hour later), IBM had already tried to call me back. A look at the trouble ticket showed me, that they already had taken 3 steps: 1. "Customer called". 2. "Problem strategy defined". And 3. "Mechanican will come out". The 3rd step actually wondered me most, because I don't have the extended on-site guarantee and expected to get a request to send the notebook. Whatever, 2 hours later, IBM tried calling me again and finally reached me. The question was, if I would be at home today between 11 and 1, which I agreed on, and they promised to send me a technican for repair.
Around 12 today the mechanican turned up, took a look at my keyboard and (which wondered me a bit) at the display. Around 45 minutes later I had a brand new keyboard and 'a brand new display in my thinkpad and he was gone again.
I am really amazed by this support! Not really 20 hours after my support call arrived, they finished repair, sent someone on-site and also exchanged the display. Fantastic! Now I really know, why I pay such a price for a piece of hardware!
Thursday, February 1. 2007
At our weekly usergroup meeting, which is taking place just right now, we again discussed our beloved topic, the Ternary Operator. I like that thing really much and I believe it makes code much more readable in a lot of cases. Anyway, I tend to stack ternary operators and I didn't even know, that the PHP manual recommends to not do that. I think this recommendation is only valid of you don't add appropriate braces, to indicate the precendences. Anyway, while having a beer, we thought about some more "funny" things you could do with it... For example, executing mutliple statements, within one section of the operator... here is the result:
Update:
Some more funny constructs after some more beer. I simply love lambda calculus. :)
Wednesday, December 20. 2006
As posted before, Kore and me went to a the "Christmas Cookie Baking" event of the PHP Usergroup Bielefeld last Saturday, organized by Carola (Sammy). We were quite suprised, that we found Bielefeld so easily, although the internet told us about the great Bielefeld Conspiracy before. Anyway, we found Sammies home and had a great time with brunching and baking cookies, together with her husband and Arne from Hamburg. Afterwards we went to the Christmas Market of Hamelin, the town which is famous in Germany for its story about The Pied Piper of Hamelin. It was really a great event and I want to thank Sammy for this!
When we left Bielefeld, we had to take some evidence photo, to proof that we really found Bielefeld. Sammy brought us to a Bielefeld town sign, so we could take a photo in front of it. But... see what happened:
The sign is clearly visible, but Kore and me seem really fake on this picture (click to enlarge). Beside that, you can see a really weird license plate in the background, which has the mysterious number 1337 on it... I'm kinda scared about these happenings, because we actually took 5 pictures and all have the same strange artifacts... Is it possible, that we've never really been to Bielefeld? I guess we will never really know...
Anyway, using this little mysterious blog entry, I want to thank the whole PHP community for another great year and want to wish you all a merry and reflective Christmas time! Enjoy some silent days with your families, take a deep breath and gather some energy for the upcoming 2007!
Thursday, November 2. 2006
As the result of the Helloween afterpain, PHP Usergroup Dortmund proudly presents:
Saturday, July 22. 2006
Hehe, as Markus did, I took the so-called "Brainbench PHP 5 certification" yesterday night after some beers. ;) Nevertheless, the result was, that was I still "scored higher than 90% of previous examinees".
I have pretty much the same feeling about this exam that Markus has. Most questions are easily solveable using php.net online docs, if you are unsure about the answer. I don't really see a point in testing how familiar people are with the docs, but that seems to be the main purpose of the exam. The also have a lot of questions with a large mess of code, where it takes you at least 1 minute to read the code itself, before you can look at any question. Beside that, there are a lot of questions, which deal with deprecated PHP features. For example I got 3 questions about ereg functions and 2 about the old mysql extension.
Basically I think this so-called "certification" is completly useless. :) But, make yourself a picture, it's free! ;)
|