Subscribe to RSS feed

splitbrain.org - electronic brain surgery since 2001

Weblog

Toastabags

For Christmas I got a new toaster. I wanted one because our old one was so slow.

That was a success:

But this post is about a discovery I made shortly after: Toastabags! Best invention since toast itself!

2016-04-06_18.jpg

Sorry for the shitty pic. I was hungry ;-)

Tags:
toast, review
Similar posts:
Last updated: 2016/04/06 19:09 · Permalink · Comments

Visualizing XDebug Traces

As alluded to in yesterday's post, I'm currently hunting an elusive bug with xdebug.

The problem is, that it only happens sporadically and when I know it happend it is too late to set a break point. So usual debugging methods don't work. Instead I want to use xdebug's execution tracing: let it log all function calls and then pick through the log when the bug occurs.

Now, the trace function offers three different formats set in the xdebug.trace_format option:

  • 0 - a human readable plain text format
  • 1 - a computer readable plain text format
  • 2 - simple HTML (basically the first format wrapped in a table)

However for what I want, I found the human readable formats much too verbose. A full function trace of a page load in DokuWiki has about 25k lines.

To ease my debugging I looked for tools that could read the computer readable format. I found a few promising candidates, but in the end they either didn't work or they did not provide what I needed. So instead of hunting the bug, I built a tool:

It's a very simple PHP script that parses and outputs the function trace. A bit of CSS and some jQuery makes it easy to collapse parts you're not interested in. Eg. you can hide all PHP internal functions and you can hide functions by clicking their name. You can also hide whole blocks of code.

You'll find the code at Github.

Now back to finding that bug…

Tags:
xdebug, code, php
Similar posts:
Last updated: 2016/02/26 21:35 · Permalink · Comments

Apache's private /tmp/ on ArchLinux

Today I figured something out that really confused me yesterday. I was trying to use up xdebug's function tracing, so I set up my config like this:

/etc/php/conf.d/xdebug.ini
zend_extension=/usr/lib/php/modules/xdebug.so                                                                           
xdebug.remote_enable=off                                                                                                
xdebug.remote_host=127.0.0.1                                                                                            
xdebug.remote_port=9000                                                                                                 
xdebug.remote_handler=dbgp                                                                                              
 
xdebug.trace_enable_trigger=1                                                                                           
xdebug.trace_output_dir=/tmp/                                                                                           
xdebug.trace_output_name=xdebug.%t

But sending the XDEBUG_TRACE trigger never did produce any output in /tmp/. I then tried to call xdebug_start_trace() and xdebug_stop_trace() directly. But still no output in /tmp/.

Next I made a simple test script doing nothing more than starting tracing, echoing “test” and stop tracing. I ran it from the command line and I got a trace file in /tmp/! So I ran the same file through my webserver… and got nothing.

That's when it dawned on me and I changed my test file to this:

<?php
xdebug_start_trace();
echo "test";
xdebug_stop_trace();
print_r(glob('/tmp/*'));

I ran it from my webserver and there they were! All the traces I produced earlier. But doing an ls /tmp/ did not show them!?

A bit googling finally brought the answer. In ArchLinux, Apache is started from systemd with the option PrivateTmp=true. Apparently that creates a virtual /tmp/ using the Kernel's file system namespace feature – here's a blog post describing it a bit more.

So the solution is to reconfigure the xdebug.trace_output_dir to point to a different directory.

TIL: /tmp/ might not be what you think it is.

Tags:
archlinux, xdebug, tmp, apache, systemd
Similar posts:
Last updated: 2016/02/26 11:52 · Permalink · Comments
  • Ein paar naive Fragen | Das Nuf Advanced 2016-02-20
    &quot;Sie stehen also um diesen Bus herum, brüllen aus vollem Halse und blicken auf einen Bus voll mit verängstigten Menschen. Einige von ihnen fangen an zu weinen. Wenn ich das auf dem Video sehen kann, haben die Menschen die da waren, es erst recht gesehen. Sie schreien weiter. Da steht am Ende also ein hasserfüllt schreiender Vater und brüllt so laut er kann einigen weinenden Flüchtlingskindern, Frauen und Männern entgegen: „Wir sind das Volk“ und „Ausländer raus!“ und andere Ekelhaftigkeiten. Sieht er nicht, dass das Menschen sind? Kinder? Kinder verdammt nochmal. So wie seine?&quot;
  • Funny Or Die Presents Donald Trump's The Art Of The Deal 2016-02-16
    Johnny Depp plays Donald Trump in a fake 80ies Biopic. 50min movie.

Marley Spoon

This weekend we cooked three meals from a Marley Spoon recipe box. A recipe or cook box is a subscription were you get a box with ingredients and recipes each week so you don't need to think about what to cook or go shopping.

There are many different services offering such services. My friend Anika recently tested a whole bunch of them and reviewed them in detail. Check her posts on how the different options compare1).

Our box was a trial we got as a gift for Christmas. It was a three meal box for two. It contained ingredients for the following recipes:

The beef was our absolute favorite but the other dishes were very good, too. When you look at the ingredients you'd think they are not enough to feed two people, but in the end we found the amount always exactly right.

All in all we really enjoyed the experience. We won't keeping the subscription though for just one reason: the price. A box is 48 EUR - that's 8 EUR per meal. We can get a meal for that price in any of the surrounding restaurants and won't even have to cook!

However as a gift idea, this is quite wonderful. The next time someone asks what to give us for birthday this will be a really nice option.

Here are a few pics.

Tags:
marleyspoon, recipe, cooking, review, cookbox
Similar posts:
1) Though the German services might differ slightly from their UK counter parts
Last updated: 2016/01/10 20:35 · Permalink · Comments

Trash Solution 2

A while ago I blogged about our self-built trash manager inside an IKEA BEKVÄM. And while it worked fine in general, it turned out that getting a full trash bag out of it was really cumbersome. It also held only two kinds of trash (plastic and residual waste) but had no room for paper.

So we began thinking about other solutions. Kaddi always thought it would be nice to have a bench in the kitchen to sit on and that it would be a great way to combine that with the trash problem. This week we finally talked it through and came up with a plan.

Below you can see some pictures of how we built it. The inner box runs on wheels and contains two IKEA VARIERA bins. It has enough space for paper recycling as well. Material cost was about 160 EUR.

Tags:
diy, woodworking, furniture
Last updated: 2016/01/06 15:51 · Permalink · Comments

Older Posts are available in the Archive. Keep up to date with the RSS Feed.

Blog

Older Articles are available in the Archive, subscribe to the
Full Content RSS Feed to stay tuned. You can also subscribe to the Link RSS Feed.

← Flattr me ;-)