Monday, November 22, 2010

the difference between include and require in php

The documentation below also applies to require(). The two constructs are identical in every way except how they handle failure. include() produces a Warning while require() results in a Fatal Error.

Friday, November 05, 2010

Remote MySQL Access

We just have to tell Mysql to allow remote logins.
sudo vi /etc/mysql/my.cnf
Out-of-the-box, MySQL only allows connections from the localhost identified by the IP Address of
We need to remove that restriction, so find the line that says
bind-address =

netstat -tupan | grep mysql

Recursively delete .svn directories

$ rm -rf 'find . -type d -name .svn'
find . -iname ".svn" -print0 | xargs -0 rm -r

Install subversion in ubuntu 10.10

First start off by installing Apache:

sudo apt-get install apache2

Enter the root password and follow the instructions. Check that is it installed correctly by going to http://localhost and checking that you see the standard Apache "It works!" message. Then install subversion and the subversion Apache module:

sudo apt-get install subversion libapache2-svn

Then create a directory to store repositories in:

sudo mkdir /var/svn/
sudo mkdir /var/svn/repositories

and create a test repository:

sudo svnadmin create /var/svn/repositories/test

So that Apache can read and write the repository its user (www-data) needs to be given ownership of it:

sudo chown -R www-data:www-data /var/svn/repositories/test

To be able to authenticate users who access the repository a password file is needed:

sudo htpasswd -c /etc/subversion/passwd paul

Enter a password for the user paul. For additional users repeat the command without the -c option to make sure the existing file is appended to rather than replaced.
Then edit the Apache config file:

sudo gedit /etc/apache2/apache2.conf

Add the following to the end of the file:

#svn users
<Location /svn>
     DAV svn
     SVNParentPath /var/svn/repositories/
     SVNListParentPath On
     AuthType Basic
     AuthName "Test"
     AuthUserFile /etc/subversion/passwd
        Require valid-user


Save the config file and restart Apache:

sudo /etc/init.d/apache2 restart

The Test repository can now be accessed via


Monday, October 04, 2010

MarkPassociates (site versão alfa)

O site da MarkPassociates já está no ar. É só pesquisar no Google por MarkPassociates ou pelo endereço
Como poderão ver ainda falta conteúdo, sugestões são bem vindas. logo

Sunday, October 03, 2010

Monitor Test

Fiz uma imagem com 5 tons diferentes para ajustar correctamente o brilho e contraste entre vários monitores.
Os brancos têm uma diferença de 1% e os pretos e 3%.

Colocar a imagem como wallpaper e configurar o monitor de forma a ver os 5 tons


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();
// Example without fluent interface
$myCar2 = new Car();

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
where column_name like 'FraUrgente';

Friday, August 27, 2010

Google – Chamadas gratuitas para telefones via Gmail

Google – Chamadas gratuitas para telefones via Gmail: "A Google anunciou esta quarta-feira que os utilizadores do Gmail vão poder começar a realizar chamadas directamente para telefones e telemóvel, a partir do próprio site do Gmail. A conversação de voz e Videochat já era possível de realizar via GMail, no entanto a gigante Google quer agora expandir esta funcionalidade para que seja possível [...]"

Friday, August 20, 2010

Saturday, August 07, 2010

History of the Internet

Adriana Lima’s comeback video

Directed by James, the video was conceived to mark Adriana’s return from hiatus after giving birth and showcases the intense boxing workouts she used to get her body back in supermodel shape.
The video was premiered as part of the recent live-stream photo shoot for Russell’s critically acclaimed Nomad Two Worlds project, which is dedicated to preserving indigenous rights and creating awareness for child health research.
The video was edited by Academy Award nominated editor Barry Alexander Brown via Beast Editorial who also cut all of Russell’s new work shot on Necker Island for Victoria’s Secret

Monday, June 07, 2010

What is hiberfil.sys and how to delete in Windows 7 free up hard drive space

The best way to delete hiberfil.sys or disable hibernate:

* Go to Start menu, type “cmd” open up command prompt
* Type “powercfg.exe -h off” [make sure you are an Administrator]
* Type “exit”

Tuesday, April 27, 2010

Don’t steal software, on the street

Don’t steal software, on the street: "

Apparently students from the University of Technology Sydney and Sydney TAFE are more tempted by street-side packaged software than one could possibly imagine. Microsoft Australia catches them in the act. Of course one can’t assume all of them were trying to “steal” software, at the same time that doesn’t make their reactions any less enjoyable.

Monday, April 19, 2010

Howto Install PHP and Mysql in Ubuntu 10.04

$ sudo apt-get install apache2
$ sudo apt-get install php5

$ sudo apt-get install mysql-server
$ sudo apt-get install php5-mysql

$ sudo /etc/init.d/apache2 restart

Wednesday, March 31, 2010

Windows 7 shortcuts for XP or Vista

Uma da coisas que dá mais geito no windows 7 é a possibilidade de colocar duas janelas lado a lado, com extrema facilidade.
Várias aplicações, de outros sistemas operativos imitam isto.
Apresento uma que gostei por ser  muito simples.
Usar a tecla do window e depois o cursor(direita ou esquerda)
Fica o link em baixo para testar

Thursday, March 18, 2010

Dica: Como somar horas no Excel

Dica: Como somar horas no Excel: "Um dia destes tive a necessidade de somar um conjunto de número de horas, para uma determinada actividade que realizei. Abri o Excel, incluí as horas que pretendia por célula e mandei fazer o SUM (=SOMA) do conjunto das células. O resultado da soma total era simplesmente “estranho”.

Como é habitual, gosto de partilhar estas pequenas [...]"

Wednesday, March 10, 2010

Photo Friday's Monitor Calibration Tool Makes Easy-on-the-Eyes Monitor Tweaks [Monitors]

Photo Friday's Monitor Calibration Tool Makes Easy-on-the-Eyes Monitor Tweaks [Monitors]: "

If you're looking for a quick and easy way to adjust your monitors without a lot of fussing with multi-step processes, the calibration tool at Photo Friday can help you tweak your monitor.

Nothing is a true substitute for hardware calibration, but if you're not working in the print industry or as a professional photographer, you don't need to calibrate your monitor to match the physical world—you need to calibrate it so that the contrast is correct and you can use the monitor without straining your eyes.

Over at photography site Photo Friday, they've created a simple calibration image you can use to adjust the brightness and contrast on your monitor to an optimum level. Visit the link below and follow the simple instructions to tweak your screen.

If you like your calibration tools to have a few more sliders, bells, and whistles, check out previously reviewed Online Monitor Test. Have a favorite software or hardware tool for monitor calibration? Let's hear about it in the comments.


Tuesday, March 09, 2010

How to Kill a Human Being

How to Kill a Human Being: "

How to Kill a Human BeingFormer Conservative MP Michael Portillo pushes his body to the brink of death in an investigation into the science of execution. As the American Supreme Court examines whether the lethal injection is causing prisoners to die in unnecessary pain, Michael sets out to find a solution which is fundamentally humane. Armed with startling new evidence, Michael considers

Watch now...


Saturday, February 06, 2010

Markets in everything

Markets in everything: "

Anti-theft lunch bags. Here is the description:

...a few spots of mold may work wonders to protect your precious sandwich when your custom labels, pleading requests and desperate detective work fail to find your regular at-work lunch thief. Reusable, resealable, one-size-fits-all and ready to go right out of the box (or brown paper bag), these clever little containers from Think of The might seem more like a prank object or gag toy than a functional product but it will almost certainly deter even the hungriest of would-be food hackers.


For the pointer I thank Lawrence Rothfield, author of this excellent book.


Her status for the next month should say, “Grounded for a good cause. DO NOT TXT ME!”

Her status for the next month should say, “Grounded for a good cause. DO NOT TXT ME!”: "

Funny Facebook Fails

Submitted by: dunno source via Submission Page


Flash Vs. HTML5: Google Will Decide

Flash Vs. HTML5: Google Will Decide: "


The future of Adobe Flash is in the hands of Google.

Apple’s reluctance to support Flash on the iPhone and the iPad is putting tremendous pressure on the future of Adobe’s ubiquitous platform, present in 98% of browsers worldwide.

The Adobe Flash Player is the engine behind 99% of Video in the web. Adobe Flash Player 10.1, soon to be released, was supposed to take Flash Player dominance together with online video to mobile handsets. But Google and Apple insistence in an Open Web with HTML5 native video (among other capabilities) that make Flash irrelevant can ruin Adobe’s plans. Apple bet of non supporting Flash even on the iPad shows they are pretty determined to kill Flash.

Abobe is going from being the ‘good guy’ that enabled video on the Web, to the ‘bad guy’ that imposes proprietary technology and that crashes browsers too often. Is Flash doomed to die then? It is up to Google.

Apple and Google close romance is turning to an end as both turn to competitors rather than friends in smartphones, office applications, browsers, OS, and soon in tablets and ebooks.

With Chrome OS now targeting the trendy tablet feast too, the support of Flash Player on Chrome OS and Android can give an edge over Apple’s rivals. Having all video on the web on Google powered smarphones and tablets, that would be a huge advantage to Google.

But Google could also well decide to stick to its principles and go full speed on the HTML5 open web vision, shared with Apple. If Google moves all YouTube content to HTML5, who on Earth is not going to install an HTML5 browser? Even the stubborn IE6 laggards would finally wake up and change. How long would it take for other web video properties to move to HTML5 and drop Flash?

Update: Good ZDNet post on the HTML vs. Flash war.

Update 2: Good explanation on Gizmodo about HTML5 and Flash

Update 3: Great post on TechCrunch on the Future of Web Content


How to get the IP address of the docker host from inside a docker container

/sbin/ip route|awk '/default/ { print $3 }'