You are in: coder.html

It is ridicolous...

...that FIBA's dance team has been benched to agree muslim's costumes.

Focus on how those girls feel now because some dumb people involved in the organization didn't remind how muslim's view works.

After decades... skype + ubuntu

After lot of time I succesfully configured my office laptop to record the mike for skype.

Nothing too complicated, just:

sudo alsactl store
sudo vim /var/lib/alsa/asound.state

and then changed the Mic Switch values ( 0 and 1 ) from false to true.

After that:

sudo alsactl restore

and the job it's done.

So...

Yes, summer holidays. Smile

Italian taxes on the bash

Drasa is a simple tool I built this morning with bash scripting: it helps you calculate an amount of taxes given your (annual) total incomings.

Its aim's not to be perfect, nor to be a business consultant, but using it you can get an idea of how much you'll spend in taxes in Italy.

Please read the README that is far more explanatory.

Basic Git branching

Git is a new generation CVS originally developed by Linus Torvalds ( yes, him ).

I do not want to focus on why you should migrate from SVN ( or other similar tools ) to Git ( I'll do it in another post ): today I want to share a couple commands to easily ( for dummies ) understand how to work with branches under Git.

READ MORE

Be a SOLID PHP programmer

This is not a true article, just a reminder to myself: I will ( need? ) to blog about the SOLID principles

  • single responsability
  • open/closed
  • Liskov substitution
  • interface segregation
  • dependency inversion

and their implementations in PHP.

Add a default NOW() value to a date field

Today I've discovered that when assigning default values to columns Doctrine, for DATE and DATETIME column types, doesn't magically handle the default values like NOW().

This due to the incapsulation of the default parameter into the double quotes.

Not a big deal, if you want to override this behaviour you simply need to redefine that column in your record's class ( lib/model/doctrine/MyModelObject.class.php ):

 

public function setTableDefinition()
{
  parent::setTableDefinition();
  
  $this->hasColumn('scheduled_for', 'date', null, array(
       'type' => 'date',
       'default' => date('Y-m-d'),
       ));

public function setTableDefinition()
{
  parent::setTableDefinition();
  
  $this->hasColumn('scheduled_for', 'date', null, array(
      'type' => 'date',
      'default' => date('Y-m-d'),
    )
  );
}

and you'll be able to get a default value corrisponding to NOW() for you rows.

@giorgiosironi

Just a short to force you visit Giorgio's account on Twitter. please follow him, he's a talented PHP writer ( and obviously coder ).

The Law of Demeter in PHP

Seems pretty obvious the concept exposed by the Law of Demeter and its implementation in PHP.

The main concept ( badly explained ) is to not make two entities ( objects ) know anything about themselves unless they really need to.

You wouldn't say it, but this article also talks about a sad story! Cry

READ MORE

"A bad open-source software can be improved, not thrown away.

A closed-source one can only be sent to the trash."