Thiemo Mättig

Thiemo Mättig

Wikimedia Blog: Warum ich Freie Software liebe.
Kommentar hinzufügen
This doesn't happen often but some times I hate command line tools. For example when you have to remember export XDEBUG_CONFIG="idekey=PHPSTORM" to turn on remote Xdebug debugging in PHPStorm and unset XDEBUG_CONFIG to turn it of. How should anybody remember this? Thanks for helping!
Wahrscheinlich muss der Versuch, kritische Antworten auf kritische Blogbeiträge via Twitter zu formulieren, schon aus technischen Gründen zum Scheitern verurteilt sein. Lasst es mich statt dessen hier versuchen.
Weiter lesen …
(bereits 1 Kommentar)
Aktuell bei den Kurzkritiken: »Edge of Tomorrow«
I'm working with MySQL databases in PHP projects for about 14 years now. You connect to the database server, select a default database, query a result set resource with $result = mysql_query( 'SELECT column FROM table' ) and start fetching the rows with $row = mysql_fetch_assoc( $result ) in a loop. mysql_query does not fetch the rows, right? That would be stupid, right? It can't know what you are going to do with the result, right? Wrong. mysql_query fetches the rows. All of them. Which means using mysql_num_rows for everything with more than a few dozen rows is a stupid idea.

PHP, I love you, but you are still weird.
So Ubuntu/Unity really utilizes the same rainbow effect as Windows and MacOS?
Subpixel rendering in Ubuntu/Unity
But why does this feel so much more comfortable than the ridiculous color bleeding Microsoft calls »ClearType« for unclear reasons?
(bereits 1 Kommentar)
Why are you still using Opera 12?

There is nothing wrong with using Opera 12. It's a recent browser. It was updated to version 12.17 in April 2014. That's just a few weeks ago.

Using so called »major« version numbers is completely pointless nowadays. The original development team spent 19 years, from 1994 to 2013, to develop Operas first twelve major versions. And as a Opera 12 fan I can assure you it was worth the time. Then they started over, used the product name for something different, even skipped some numbers completely and increased the number to 21 in less than a year.

So hell, no, Opera 12 is not »9 major versions numbers behind«. Even if you do not count the security updates, Opera 12.10 is only one and a half year old.

For comparison: The first non-preview release of Internet Explorer 10 is older.

Sure, Opera 12 starts getting old. So gets IE 10. We all must move forward and even I as a deeply hooked Opera 12 fan had no other choice and started using a Chromium build in parallel. But still, one misconception always annoyed and keeps annoying me: You just can't blame the browser if a website stops working. Hell, the browser doesn't change. It's the website that changes and stops working.

Opera always was ahead of it's time and is still not at a point where it falls behind. Some of it's HTML 5 features are still better than what's in the current Firefox version. Opera 12 supports transparent colors, gradients and transitions, for example. Sure, there is no way to make recent games work in Opera 12. But if we are talking about content driven sites like Wikipedia it's still an absolutely valid, flexible, feature-rich and heavily customizable browser that does exactly what it's supposed to do: Let me edit Wikipedia.

I don't care if a gradient is missing or a transition looks odd. But using and editing Wikipedia in Opera 12 must be possible for at least another year.
(bereits 6 Kommentare)
In PHP, there is no difference between arrays and hash tables. Arrays are always associative arrays. There are several methods to check if a specific key or value is present in an array. If you know a little bit about data structures you should know that searching for a key should be much more efficient than searching for a value. But how big is the difference? Does it even matter?

My simple benchmark compares in_array( $value, $array ), array_key_exists( $key, $array ) and isset( $array[$key] ) on arrays of different sizes. The number of function calls is always the same (10000), randomly spread so that half of them succeeds and the other half fails. Time is measured using microtime( true ) and rounded to milliseconds.

Array search in PHP: Benchmark to compare in_array, array_key_exists and isset
(Same graph on quadratic/logarithmic scales.)

The result really looks how you think it should look. Searching for a key in a hash table needs constant time, no matter how big the array is. That's exactly why we have hash tables, right? On the other hand, searching for a value in an array needs dramatically more time even on relatively small arrays with only 100 elements. For an array with 10000 elements in_array is more than 100 times slower.

So never ever do in_array( $key, array_keys( $array ) ), that's just stupid.
(bereits 2 Kommentare)

[ Ältere Einträge → ]