Fiio E10 DAC on Ubuntu 12.04 on a Dell Latitude E6510

Since the sound card in the Latitude e6510 is not really good, at least on linux it does not perform good
- sound volume with my headphones and over the speakers is … not enough
- loud stuff sounds really really crappy

I was missing something, especially when listening to musik a bit louder, I wanted a little cheap boost for now to power my AKG K242 HD, nothing to expensive, I first planed for 50€ but extended the budget to 100€ and went with the E10 for about 80 €.

Most important it had to work on Linux without quirks or problems, so something driver less would be nice, I prefer an analog volume control instead of some buttons to turn the volume up and down.

As far as I can tell it works fine, attached it, switched output to it:

Not perfect, but a big step in the right direction and enough for now.

Multiple streams seem to be absolute no problem (playing a game while listening to music or watching a dvd).

I tried playing Torchlight over STEAM via WINE, while running VLC and Rhytmbox with audio files, playing a video from youtube and running a tutorial video via totem and it work nicely (nothing I normally need but after reading that it seems some DACs have problems with more than 1 stream, i wanted to be shure it works).

 

And compared to my Galaxy Nexus it i small:

What can go wrong on switching application-context in symfony 1.4

It’s was the end of my first week after the winter holidays and I noticed something strange in the working branch of the base applications backend. Most parts of this backend were based on the admingenerator. Each plugin hooks itself into the backend, includes menus, configuration and has generator based CRUDs for its models.

Listing, editing, creating new entries all no problem.
But deleting wasn’t possible in the list-view, it always showed me the errorpage of symfony, deleting an entry from the edit-page worked.

Switching to dev-mode showed me a csrf-warning. I cleared cleared and reset everything related to the application, deleted the sessions, restarted all services related, reset the database, created a new entry and tried to delete it … again failing.

Last point where it worked: before the holidays.
Since I was the only developer touching the code, there wasn’t anybody else to blame.

Switching to another plugins generators, some had the bug, some didn’t, now it was really getting weird, since all use the same modified theme as base, configurations was nearly the same.

After hacking around with the generator.yml, trying everything and not getting anywhere I choose to just go back in time. Thanks to git aka version control, I went back commit by commit in a plugin which had the problem and it showed me where the problem was located.

The problem was introduced by what looked like a simple feature short before the holidays: Linking from the admingenerator-list to the entries in the frontend by using the frontends context.

After finding Accessing the frontend routing from the backend application and modifiying it a bit I used it to create columns in some generator lists which fetched the frontend-router and generated the url by using the router.

Everything was perfect, expect, switching back with sfContext::switchTo($current_application); wasn’t really enough to switch back to the backend-application. It reset sfConfig and some other things, but doesn’t call sfApplicationConfiguration->initConfiguration(); which usally runs

if (false !== sfConfig::get('sf_csrf_secret'))
{
  sfForm::enableCSRFProtection(sfConfig::get('sf_csrf_secret'));
}

So what you need to do is running an additional

    $current_configuration->initConfiguration();

after running the switchTo, else you application will use the csrf-tokens from the application you switched to and it probably has more sideaffects.

WYSIWYG Editor for Markdown and reStructuredText on Linux / Ubuntu

Because I sometimes miss a needed linebreak or my lists don’t look like expected in Markdown or reStructuredText (mainly for use with sphinx), I was looking for a better editor with some kind of live preview for linux. Normally I edited those files directly in Netbeans or Gedit.

I found ReText a nice Gui-Editor written in python with QT for the frontend. It does exactly what i wanted, 2 Columns, one with markdown or reStructuredText, the other shows a live preview.
For Ubuntu there is a PPA:

https://launchpad.net/~mitya57/+archive/ppa

which includes integration into the menu and you don’t have to create the entry yourself to automatically open files

If you don’t install via the PPA you have to create the menu-entry yourself to be able to automatically open files with it since Ubuntu seems to no more support opening files with programs which aren’t installed in the menu: Add Custom command in the Open with dialog.

Extending Heise SocialSharePrivacy to pass a dynamic title to twitter

Yesterday I had a look at Heise SocialSharePrivacy and experimented around with it (probably will integrate it here via a plugin) but one think I was missing was a way to use it on a list of items, while having different titles for the twitter text, not using the current pages title. Currently it only allows for a static title or a function. But the function was worthless in this case, since I wanted to use the title each specific link.

An example based on their ones to describe it a bit more.

<div class="anriss">
    <h3><a href="http://www.heise.de">heise</a></h3>
    <p>lorem ipsum</p>
    <div class="social"></div>
</div>

<div class="anriss">
    <h3><a href="http://www.heise.de/security/">heise security</a></h3>
    <p>dolor sit amet</p>
    <div class="social"></div>
</div>

<script>
$(".social").socialSharePrivacy({
    uri : function(context) {
        return $(context).parents(".anriss").find("h3 a").attr("href");
    }
    service : {
        twitter: {
            'tweet_text': function (context) {
                return $(content).parents(".anriss").find("h3 a").text();
            }
        }
    }
});
</script>

All you need to do to get it working is changing line 196 of the jQuery Plugin from

text = text();

to

text = text(context);

Now you have access to the context inside your function.

I just mailed it to Heise, let’s see what they thing about it.

ReflectionException: Method PHPUnit_Framework_Warning::Warning() does not exist

If you ever get

ReflectionException: Method PHPUnit_Framework_Warning::Warning() does not exist

That may be because you are using @dataProvider and your dataProvider returns the data in an invalid way.

This may be caused by forgetting one dimension in the returned array when using only a single value as parameter for the test.

Wrong:

<?php

public function myDataProvider()
{
    $data = array();

    $data[] = 'some value i want to pass as param';
    $data[] = 'another value i want to pass as param';

    return $data;
}

Right:

<?php

public function myDataProvider()
{
    $data = array();

    $data[] = array('some value i want to pass as param');
    $data[] = array('another value i want to pass as param');

    return $data;
}

Switched to WordPress

I never thought I would switch to WordPress.

But there were several causes why i switched from something self-developed to WordPress:

  • Get to know WordPress better
  • Don’t waste time inventing features wp already has
  • Just have more time for other things
So from now one, this is WordPress Zone.

Identifier “request_context” is not defined with silex

If you ever receive a message like:

Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Identifier "request_context" is not defined.' in phar:///.../vendor/silex/silex.phar/vendor/pimple/lib/Pimple.php on line 12

And it is not directly about the AsseticExtension in Silex-Extensions,it is probably because some of your code wants access to the url_generator – in my case it was my own Routing-Extension for twig.

First some background informations why it happens.

The problem is that some Extensions – like the url_generator – need access to the requestContext, which is defined after you have already called $app->run(); so in your bootstrap-code that probably has not happened.

The creation of the RequestContext is inside Silex\Application::onKernelRequest (Line may differ – works current master).

There are too solutions to the problem – either you lazyload the url_generator by passing in the app instead of the url_generator and access it only when you really need it or you let Silex run your code inside Silex\Application::onKernelRequest by putting it in a closure as a callback to add it to the dispatcher as a listener for the SilexEvents::BEFORE-Event – which is triggered inside Silex\Application::onKernelRequest.

Netbeans, Symfony, Xdebug and the magical file_link_format

Originally I was looking for a solution to get Chromium to open Files in Netbeans directly from symfony1 stack traces, because some time ago in a video I had see how it was done for other editors.

Here we have two screenshots for a symfony1 stack trace, which is shown in dev-mode when an error happens or an exception is thrown but not caught and a xdebug stack trace:

For symfony1 to create the links you need the following in settings.yml

all:
  .settings:
    file_link_format:       netbeans://%f?line=%l

For xdebug you need to have html_errors = On in your php.ini set xdebug.file_link_format

xdebug.file_link_format = "netbeans://%f?line=%l"

The next thing we need to do is to create a new url-handler in Gnome’s gconf.

gconftool-2 -t string --set /desktop/gnome/url-handlers/netbeans/command "/path/to/netbeansprotocol.sh %s"
gconftool-2 -t bool --set /desktop/gnome/url-handlers/netbeans/enabled true
gconftool-2 -t bool --set /desktop/gnome/url-handlers/netbeans/needs_terminal false

Screenshot of the url-handler in Gnome’s Configuration Editor (/usr/bin/gconf-editor)

netbeansprotocol.sh will do the parsing – a snippet I found in my desktop-wiki from a search for the same problem some time ago – it probably can be done in a nicer way – but it works (for me).

#!/bin/bash

url=$2
file=${url#*\/\/}
file=${file%?line=*}
line=${url#*line=}

/home/robo47/netbeans-7.0/bin/netbeans --open $file:$line

Further Links: