Sunday, 23 February 2014

We've been quite busy the last few weeks

Christmas time always is a quite different time for all of us in Treppendorf. Hotline and logistics are working almost 24 hours a day, the local store  and even we, the webdevelopers, change our mode from "productivity" to "lean back, watch stats and don't fucking touch anything". We survived the whole christmas sale pretty good without any outage and so we went back to work, which is actually the reason why no one of us was able to write anything here.

There are a few upcoming projects that will still keep us quite busy this year, on top of all probably our new search engine (including a redesign of our search result page) and our new mobile page. We have improved our team and our new developer just finished his first big project, the new customer centre (which is going live on Monday).

And that's all? We'll, for the next few weeks, yes. Other upcoming projects are some other pages we lost on our redesign process last year like the category page, the basket and single elements on the product detail page. And still we have some secret projects to work on which are quite exciting (and bring some great benefits to our customers.. we'll talk about that later).

Oh wait, I almost forgot the most important task we're on right now: Finding things we want in our new office building which is being built as I write. German building laws prohibit a slide (not explicit; it's something about fire safety) and so we accepted the challenge to find other weird and funny things to put inside. If you have any great ideas, just let us know. And if you're interested, our social media guys post updates on our Facebook page regularly.


So long!


Sunday, 12 January 2014

Drawing Graphs with MySQL

Drawing what with what???!?

Yes you read correctly. Let's suppose we got the following table layout in MySql:


+-------------+--------------+------+-----+---------+----------------+
| Fiel        | Type         | Null | Key | Default | Extra          |
+-------------+--------------+------+-----+---------+----------------+
| id          | int(11)      | NO   | PRI | NULL    | auto_increment |
| createTime  | DateTime     | YES  |     | NULL    |                |
| dur         | integer      | YES  |     | NULL    |                |
+-------------+--------------+------+-----+---------+----------------+

It's a very basic logging table that simply stores generic events, its creation time and the time this event took to run in milliseconds. Lets query that table:
SELECT creationTime, executionTime FROM myLogTable

+---------------------+---------------+
| creationTime        | dur           |
+---------------------+---------------+
| 2013-11-23 13:27:00 |            10 |
| 2013-11-23 13:27:08 |            11 |
| 2013-11-23 13:27:11 |             9 |
| 2013-11-23 13:27:18 |            13 |
| 2013-11-23 13:27:20 |            13 |
| 2013-11-23 13:27:21 |            25 |
| 2013-11-23 13:27:30 |             9 |
| 2013-11-23 13:27:35 |            30 |
| 2013-11-23 13:27:37 |            15 |
| 2013-11-23 13:27:45 |             8 |
+---------------------+---------------+
Obviously this data is a little hard to read, wouldn't it by nice to have some kind of a visualisation?
Let's try this query:
SELECT id, creationTime, executionTime, repeat('|', executionTime) as graph FROM myLogTable

+---------------------+-----+--------------------------------+
| creationTime        | dur | graph                          |
+---------------------+-----+--------------------------------+
| 2013-11-23 13:27:00 |  10 | ||||||||||                     |
| 2013-11-23 13:27:08 |  11 | |||||||||||                    |
| 2013-11-23 13:27:11 |   9 | |||||||||                      |
| 2013-11-23 13:27:18 |  13 | |||||||||||||                  |
| 2013-11-23 13:27:20 |  13 | |||||||||||||                  |
| 2013-11-23 13:27:21 |  11 | |||||||||||                    |
| 2013-11-23 13:27:30 |   9 | |||||||||                      |
| 2013-11-23 13:27:35 |  30 | |||||||||||||||||||||||||||||| |
| 2013-11-23 13:27:37 |  15 | |||||||||||||||                |
| 2013-11-23 13:27:45 |   8 | ||||||||                       |
+---------------------+-----+--------------------------------+
Now we got a graphic representation of the value that shows us anomaly on the first glance.

Thursday, 2 January 2014

Where true or false is not enough!

At some point we've found the following code candy in our source code:


function str2bool($str) {
    if ($str === false or $str === "0" or $str === 0 or $str === "" or $str === "false" or $str === "FALSE" or $str === "falsch" or $str === "FALSCH") {
        return false;
    }
    return true;
}

This piece of code is unused and someone forgot about to delete it. But it looks like it was used in one of our externally connected subsystems to translate values like FALSCH, falsch, FALSE to a boolean false. ("falsch" is german for "false")

We're not sure if there were ever values like "FALSCH" in our code - but it's a little bit scary for us ;)