MeuMySQL Blog is now at http://blog.mdnsolutions.com/.

Monday, April 29, 2013

MDN Solutions Blog

Hi everybody! Meu MySQL Blog now is http://blog.mdnsolutions.com/.

Please click below to be redirected!

http://blog.mdnsolutions.com/


Thanks!

Wednesday, January 9, 2013

PHP: Date Default Timezone

Hi Folks! This is a short article about a common warning we can get when using php without be careful with the settings.  It's quite importante in your application to determine the time zone you are in. If you don't do so, you can get warnings such the one below:


Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. 

To sort it out just add into your application the function  date_default_timezone_set('value');
As value you can use any of the supported timezones by PHP, they can be found here.

Enjoy!

References:
http://php.net/manual/en/function.date-default-timezone-set.php
http://php.net/manual/en/timezones.php

Friday, January 4, 2013

Creating your own Composer Package

Hi folks! I'd like to talk about to create your own dependency for Composer in this article. It's been one of the best invented tools for PHP ever in my humble opinion. Basically, you can manager your application's dependencies in a really easy way. If you haven't heard about it please check out the Compose website.

In this article I shall you show to create your own dependency using Github, deploy and maintain using Packagist.

Sunday, December 16, 2012

Installing Ruby on Rails on MAC OS X


Hi fellas! Today I felt to get started with Ruby on Rails and with those steps below I've set up my environment. So, I'm on a MAC OS X 10.7.5 64 bits and it worked pretty well for me.




Installing 

First of all I did the download of the RVM and run it on my machine.

$ \curl -L https://get.rvm.io | bash -s stable --ruby

Tuesday, December 4, 2012

Troubles with multiple hosts on Apache Mac OS X

Hi folks! I was running Apache on my Mac OS X, and in some point I needed to set up other virtual host for one of my projects. However everytime I've tried to access the new virtual host I was getting only the first one I had on my /etc/apache2/httpd.config. 

I sorted it out doing the steps below:


Edit  /etc/apache2/httpd.conf uncomment the vhost file like:
# Virtual hosts
Include /private/etc/apache2/extra/httpd-vhosts.conf

Then edit the file /private/etc/apache2/extra/httpd-vhosts.conf  adding your virtual hosts:
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80

<VirtualHost *:80>
    DocumentRoot "/Library/WebServer/Documents"
    ServerName localhost
</VirtualHost>


<VirtualHost *:80> 
  <Directory /Users/<youruser>/Sites/vhOne>
      AllowOverride All 
  </Directory> 
     DocumentRoot "/Users/<youruser>/Sites/vhOne"
     ServerName vhOne.local
</VirtualHost>

and be sure that you add to your /etc/hosts file as below:
127.0.0.1   vhOne.local
I hope it is userful. See ya around!

Friday, November 30, 2012

F5 button to refresh on Mac OS X Google Chrome

Hi folks! I've moved to MAC OS, and as everything else in this life we take some time to adapter. So, I'm so used of press F5 to refresh my pages and with MAC we have to use the CTRL+R. NOT DEAL. 

I found a workaround for that. Under the System Preferences, you can set your own keyboard shortcuts specific to an application. I managed to get F5 working this way in Safari and now in Chrome: 

1. Launch "System Preferences" 
2. Click the "Keyboard & Mouse" icon 
3. Select "Keyboard Shortcuts" tab 
4. Hit the little "+" button under the main white area 
5. In the little pup-up window select "Google Chrome" as the Application 
6. Type in "Reload This Page" in the "Menu Title" field exactly as it appears in the Chrome's View menu (no quotes of course) 
7. Click inside the "Keyboard Shortcut" field and hit F5 key (or any desired combination) 
8. Restart Chrome to make it work 

Hope this helps! Let me know if worked for you guys. 

Cheers!

Thursday, October 25, 2012

XGH - eXtreme Go Horse Process

Salve Galera! Este tópico é apenas para descontrair, encontrei eles na internet e acho que se identifica bem com vários modelos de desenvolvimento adotados por empresas "wide world".


1. Pensou, não é XGH.
XGH não pensa, faz a primeira coisa que vem à mente. Não existe segunda opção, a única opção é a mais rápida.

2. Existem 3 formas de se resolver um problema, a correta, a errada e a XGH, que é igual à errada, só que mais rápida.
XGH é mais rápido que qualquer metodologia de desenvolvimento de software que você conhece (Vide Axioma 14).

3. Quanto mais XGH você faz, mais precisará fazer.
Para cada problema resolvido usando XGH, mais uns 7 são criados. Mas todos eles serão resolvidos da forma XGH. XGH tende ao infinito.

Saturday, October 20, 2012

FAQ Symfony - Dicas Quentes

Salve galera! Venho fazendo teste e projetos em Symfony e gostaria de compartilhar algumas, dicas, curiosidades e dúvidas que tenho tido. Bem, este tópico é 'endless' e vou incrementando ele conforme descubra mais novidades, espero que sejam úteis para vocês também. E qualquer outra dúvida, por favor comentar.


Thursday, October 18, 2012

Instalando o mod_pagespeed do Google

Salve Galera! Após ver a matéria (aqui), indicada pelo meu colega @augustosvm, que fala sobre o novo módulo para servidores que o Google lançou, resolvi testar e fazer alguns benchmarks. Ele é gratuito, simples e rápido de instalar e segundo a própria Google promente acelerar sensivelmente o acesso dos website que estejam no servidor com o módulo em questão.


Download e Instalação

Estou usando Ubuntu 12.04 de 32 bits, ok. Antes de mais nada devemos fazer o download do módulo aqui.  É recomendado que esteja como usuario root, eu optei por usar o wget para fazer isso:

$ wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-beta_current_i386.deb

Após obter o pacote faça a instalação com os comando abaixo:
Instalando o mod_pagespeed desta forma um repositório do google será adicionado ao seu sistema automanticamente mantendo assim o módulo sempre atualizado. Caso você não deseje esse recurso basta apenas digitar o comando "touch /etc/default/mod-pagespeed" antes de instalar o pacote. 
$ dpkg -i mod-pagespeed-*.deb
$ apt-get -f install

Caso esteja usando CentOS/Fedora você pode usar os comandos abaixo:

$ yum install at  # if you do not already have 'at' installed
$ rpm -U mod-pagespeed-*.rpm

Feito isso reinicie seu servidor e pronto, ele já está otimizado.


Avaliação

Em meus testes realmente verifiquei ganhos em tempos de execução. Você pode fazer os seus medindo tempos de executação antes e depois de instalado o módulo. O google ainda disponibiliza aqui (Leia o README) uma gama de testes de quais e como se dá os ganhos de performance.


Bom proveito!



Referências:
http://idgnow.uol.com.br/internet/2012/10/16/google-libera-versao-final-de-sua-tecnologia-para-acelerar-sites/
https://developers.google.com/speed/pagespeed/mod

Tuesday, October 9, 2012

[en] Doctrine, specifying Null values


Hi guys! I'd like to share a doubt I had other day here about using Doctrine queries. I was trying to write a query to return only records with a certain null value column, to do so all you need to do is something like below:
$query = Doctrine_Query::create()
  ->select('t1.*')
  ->from('entityName t1')
  ->where('t1.columnName is NULL');

$resultSet = $query->execute(array(), Doctrine::HYDRATE_ARRAY);

Easy and simple. Works the same way for both DQLs and queries in Doctrine.

$dql = $entityManager->createQueryBuilder()
           ->select('t')
           ->from('ns:Entity', 't')
           ->where('t.columnName is NULL ');

$arrayOfData = $dql->getQuery()->execute();

Enjoy!