Iphone blackout 3194

Today my iPhone chrashed really. Nothing worked, except setting it in recovery Mode.

When i tried to restore the phone, the iTunes says “error 3194″ and cancles the Process.

Here is the Solution:

saurik.com/id/12

Worked perfect for me…

Now i have ios4 installed, it feels way much faster than 3.1.2

I only jailbreaked it for Managing multiple Exchange Accounts.

make PHPUnit functional Tests extendable

Currently im switching from lime tests to phpunit tests.
Therefore i installed the sfPHPUnit2Plugin.

Its working well, except the fact the the sfTestFunctional class is not extendable, for easier extending the browser (e.g. write a signin function to signin the user)

To solve this i’ve hacked a bit.

At first we extend the sfTestFunctional class:

class sfGuardTestFunctional extends sfTestFunctional {

  public function signin($username, $password) {
    $module = sfConfig::get('sf_login_module','sfGuardAuth');
    $action = sfConfig::get('sf_login_action','signin');

    return $this->
      get('/login')->
      with('request')->begin()->
        isForwardedTo($module, $action)->
      end()->
      setField('signin[username]', $username)->
      setField('signin[password]', $password)->
      click('sign in')->
      with('user')->isAuthenticated()->
      followRedirect();
  }

  public function signout() {
    $signout_url = '/logout';

    return $this->
      get($signout_url)->
      with('request')->begin()->
        isForwardedTo('sfGuardAuth', 'signout')->
      end()->
      with('response')->begin()->
        isStatusCode(302)->
      end()->
      followRedirect()
    ;
  }
}

This piece of code can be used im lime tests too, simply instanciate this class instead of the default sfTestFunctional:

include(dirname(__FILE__).'/../../bootstrap/functional.php');

$browser = new sfGuardTestFunctional(new sfBrowser());

$browser->get('/')->
  signin('user','password')
;

To get this new Subclass into the phpunit Tests we have to extend the default sfPHPUnitBaseFunctionalTestCase class:

class sfGuardPHPUnitFunctionalTest extends sfPHPUnitBaseFunctionalTestCase
{
  public function getBrowser(){
    if(get_class($this->testBrowser) != 'sfGuardTestFunctional')
    {
      $this->testBrowser = new sfGuardTestFunctional(new sfBrowser(), $this->getTest());
    }

    return $this->testBrowser;
  }

  public function _start()
  {
    new sfDatabaseManager(ProjectConfiguration::getApplicationConfiguration($this->getApplication(), 'test', true));
    $loader = new sfPropelData();
    $loader->loadData(sfConfig::get('sf_data_dir').'/fixtures');
  }
}

This is the PHPunit Testclass were extending from in our functional php unit tests:

require_once dirname(__FILE__).'/../../bootstrap/functional.php';

class functional_admin_dashboardActionsTest extends sfGuardPHPUnitFunctionalTest
{
  protected function getApplication()
  {
    return 'admin';
  }

  public function testDashBoardLinks()
  {
    $browser = $this->getBrowser();

    $browser->get('/')->
      signin('user','password')
    ;
  }
}

now both parts are extendable well.
You can add new functions to sfGuardTestFunctional to have additional browser functions, and you can move general code for every functional test to the new sfGuardPHPUnitFunctionalTest class.

now phpunit functional tests are well extendable, and integrated well.

setInterval vs. setTimeout in Javascript

Recently i ran into a strange javascript behavior.

I tried to periodically update a certain container on a page.

At first i tried it with:

foobar = function(){
  $('#my_div').load('myurl');
  setTimeout('foobar',10000);
};
setTimeout('foobar',10000);

I found out, its working correctly (it updates the div every 10 seconds), but i detaches the old DOM (the whole site), and adds the new Response-DOM as new Content, thats very strange because if you click another page, and then use the Browser-Back Button, there are no styles, or Javascript. So very very very bad, i didn’t get the clue what went wrong.

Then i refactored it bit, so it looks like this:

foobar = function(){
  $('#my_div').load('myurl');
};
setInterval('foobar',10000);

And voila, its working as expected. It updates the div correctly, and leaves the rest of the DOM untouched.
Dont know whats the difference between those 2 examples?!

reset of the digital kaoz

After a big bad Server-Crash, i had to reset my whole server :( . Good that i was able to backup everything i need.

The first steps were setting up all the system services again. Thanks to ubuntu that i love so much, and know so well :) .

The first and easiest way to be “online” again was to setup a wordpress blog, and voila here it is.

The installation and configuration is easy, and the system works perfect. Now i have to customize it. WordPress is a bit new for me, and it seems, it is not very organized and straight forward like the symfony framework.

After seeing some code, i hope i dont have to iteract that much with the codebase :) but the interface is very nifty, and easy to use.

I think i will stay at wordpress for the blogging software, so i have to work on my symfony sfWordpressPlugin again.

There is still so much todo, configuring wordpress, setting up my svn again, setting up my development sites again…