Tuesday, September 21, 2010

PHP The following is an example of a class with a fluent interface implemented in PHP:


class Car {
 private $speed;
 private $color;
 private $doors;
 
 public function setSpeed($speed){
  $this->speed = $speed;
  return $this;
 }
 
 public function setColor($color) {
  $this->color = $color;
  return $this;
 }
 
 public function setDoors($doors) {
  $this->doors = $doors;
  return $this;
 }
}
 
// Fluent interface
$myCar = new Car();
$myCar->setSpeed(100)->setColor('blue')->setDoors(5);
 
// Example without fluent interface
$myCar2 = new Car();
$myCar2->setSpeed(100);
$myCar2->setColor('blue');
$myCar2->setDoors(5);

Sunday, September 19, 2010

Quick Tip: Working with MySQL and SUM

Quick Tip: Working with MySQL and SUM: "


In today’s quick tip screencast, we’re going to learn a MySQL query trick. You might be already familiar with the SUM() and IF() functions. We will be combining them to come up with some useful queries. This can reduce the number of queries you need to run for fetching certain types of summary data, and also provide a performance improvement.






"

Wednesday, September 15, 2010

How to find all the tables in MySQL with specific column names in them?


select  table_schema, table_name, column_name
from INFORMATION_SCHEMA.COLUMNS
where column_name like 'FraUrgente';

sudo update-alternatives --config x-cursor-theme