Example usage of Zend Mail in ZF2 for sending e-mail by gmail.


<?php
require_once './Zend/Loader/StandardAutoloader.php';

$loader = new Zend\Loader\StandardAutoloader( array( 'autoregister_zf' => true));
$loader->register( );

use Zend\Mail;
use Zend\Mail\Transport\Smtp as SmtpTransport;
use Zend\Mail\Transport\SmtpOptions;

$options = new SmtpOptions( array(
"name" => "gmail",
"host" => "smtp.gmail.com",
"port" => 587,
"connection_class" => "plain",
"connection_config" => array( "username" => "mail1@gmail.com",
"password" => "oleaodeSodor","ssl" => "tls" )
) );

$mail = new Mail\Message();
$mail->setBody('Hello there!');
$mail->setFrom('mail1@gmail.com', 'Pat');
$mail->addTo('mail2@gmail.com', 'Andre');
$mail->addCC( 'ao@gmail.com' );

$mail->setSubject('Hello today ' . date( "d-m-Y" ));

$transport = new SmtpTransport();
$transport->setOptions( $options );
$transport->send($mail);

I’m writting about this now, because only now I was questioned about it.

I was tyred of when coding and doing commits I always required a connection to the repositor, I sometimes coded without a internet connection and that left me outside of the version control.

With git I can keep local commits, go back in my revisions and when I get online I can commit if I want
there is no central part of a repository. I can work online and offline and do all crasy changes knowing I have a revision.

For me this was the “seller”!

I was using classmap style autoloading before Zend Framework… Awsome. :-D

Got a group of friends leaving for the .uk one of them changing PHP for Python…

Money a better life and work challenges… I understand them not having a problem or a challenge and having employers that don’t have a bit of entrepreneurship, don’t have a bit of courage or leverage for taking chances when the time was wright, know leaves them looking at the walls and also my friends thinking… “What the heck was I doing during my life for this guy…”.
So they take their know how and their will and they leave… Leaving the country a bit more poor… The problem is that this also happens in big company’s the ones that have the money to invest and look for new markets!

Other friends now doing a same routine job for a few big company’s, at this time we all can say “At least they have a job.” but does it make sense to keep working on the same thing and not evolving in some direction if they a opportunity? You have always to try and learn something new.
So improving your skills can be of a great way to grow or at least stopping you from going mad.

Having said that, have to say thanks to PHP classes for a new book I’m about to get for a competition I did in last February the result wasn’t a good result at least in terms of classification but the code I would say was very good. This book will be put to a good reading time and testing the new web browser abilities.

PS: This web page may still be trying to transfer data from google analytics…

Been wanting to write this for a while only got time to do it now…

Frameworks are does kind of things that are supposed to help you do your work, eventually you will realize something during their use… They usually take time to learn and understand how to get around their “problems”. Frameworks bring concepts that usually you already know like Design Patterns, Modularity etc…
Don’t have a problem with this, it’s all good, but I hate when their developers go on releasing code saying,
“we have now some new great feature and code re-design”, sure they do, probably so do you!
Stick to a project for a great deal of time or take a lot of time thinking about it (the application you want to build) and you will place all of those framework ideas into your project.

Basically what I’m saying is… What are we really watching/using frameworks for?
1 – We want them to make our lives easy
2 – Don’t want to have to take much time learning them and all their quirks
3 – Build something in seconds
4 – Great debug capabilities
5 – Develop code that can be reusable by others and by yourself
6 – Integrate a new team/developer into the project without much of a problem just by asking someone
who knows framework (x, y or z )

The rest of the framework if you want to improve increase the capabilities of the project you go into the framework and see what you can get from it.

(then version 3.x or 2.0 of the framework comes out and they say, “your old code isn’t supported anymore”)
HO FUDGE…

And to make it worst you have n² of frameworks in the market to learn and use… Witch framework is best?
You are!

Num mundo em mudança e os Portugueses no meio de uma publicidade constante para emigrarem, nos últimos 3 meses uma média de 2 artigos por mês referentes ao Brasil e portugueses a viver lá…
No entanto é interessante que os Brasileiros também emigram os que tem mais conhecimentos tem como destino o Canadá, Holanda, EUA e a Alemanha reclamam o custo de vida no próprio país e a dificuldade de importar bens.
Face a esta mobilização global a coisa mais óbvia que me ocorre é que no futuro não teremos um passaporte para um país mas sim um passaporte para o planeta(global).

 

PS: Falta o PPC se lembrar de dar descontos em bilhetes de avião para bilhetes comprados só de ida. #sarcasmo

Analyzing database SQL query’s within Zend Framework Front Controllers isn’t difficult here’s an example:

$bootstrap = $this->getFrontController()->getParam(“bootstrap”);

if ($bootstrap->hasPluginResource(“db”)) {
      $dbResource = $bootstrap->getPluginResource(“db”);
      $db = $dbResource->getDbAdapter();

$profiler = $db->getProfiler();
$profiler->setEnabled(true);

}
            foreach ($devs->getDevices($cliente->idcliente) as $equip) {

                $equip->findDependentRowset(“DM_Model_Services”, “equipment”);
    $query = $profiler->getLastQueryProfile();

    echo $query->getQuery();      

          }

My database config in application.ini:

resources.db.adapter         = pdo_mysql
resources.db.params.host     = 127.0.0.1
resources.db.params.username = user
resources.db.params.password = pass
resources.db.params.dbname   = sal_db

This will give an output like:

SELECT `service`.* FROM `service` WHERE (`idequipment` = 70)

 

Neste conceito existente de offshores esconder movimentos e montantes de dinheiro sendo um dos propósitos a evasão fiscal e também para reduzir impostos pagos questiono-me sobre o uso de métodos de transferências como paypall, bitcoin, facebook credits entre outros para esse efeito.

Do artigo que escrevi aqui fica apenas a memória, não sei se já referi mas a serviu o seu propósito e ainda me desenrascou umas vezes mas não à nada melhor que cablar a casa com RJ45 porque a power line não demorou muito a deixar de funcionar.
Mesmo para aumentar a rede foi melhor descobrir por onde passar os cabos RJ45 do que usar a powerline.

Primeira colocação do uso de selenium no meu projecto de trabalho.

16:52:56.775 INFO – Started org.openqa.jetty.jetty.servlet.ServletHandler@7ad81784
16:52:56.775 INFO – Started HttpContext[/wd,/wd]
16:52:56.779 INFO – Started SocketListener on 0.0.0.0:4444
16:52:56.779 INFO – Started org.openqa.jetty.jetty.Server@6f507fb2
16:54:27.227 INFO – Checking Resource aliases
16:54:27.245 INFO – Command request: getNewBrowserSession[*chrome, http://cableweb/%5D on session null
16:54:27.257 INFO – creating new remote session
16:54:27.430 WARN – Caution: ‘/usr/bin/firefox’: file is a script file, not a real executable.  The browser environment is no longer fully under RC control
16:54:27.432 INFO – Allocated session ad8fbaba3c6a4caba2aaa62f118253b8 for http://cableweb/, launching…
16:54:27.516 INFO – Preparing Firefox profile…
16:54:32.489 INFO – Launching Firefox…
16:54:35.965 INFO – Got result: OK,ad8fbaba3c6a4caba2aaa62f118253b8 on session ad8fbaba3c6a4caba2aaa62f118253b8
16:54:36.028 INFO – Command request: setTimeout[30000, ] on session ad8fbaba3c6a4caba2aaa62f118253b8
16:54:36.052 INFO – Got result: OK on session ad8fbaba3c6a4caba2aaa62f118253b8
16:54:36.104 INFO – Command request: open[/index.php, ] on session ad8fbaba3c6a4caba2aaa62f118253b8
16:54:36.356 INFO – Got result: OK on session ad8fbaba3c6a4caba2aaa62f118253b8
16:54:36.407 INFO – Command request: click[link=Aquisições, ] on session ad8fbaba3c6a4caba2aaa62f118253b8
16:54:36.426 INFO – Got result: ERROR: Element link=Aquisições not found on session ad8fbaba3c6a4caba2aaa62f118253b8
16:54:36.477 INFO – Command request: testComplete[, ] on session ad8fbaba3c6a4caba2aaa62f118253b8
16:54:36.477 INFO – Killing Firefox…
16:54:36.513 INFO – Got result: OK on session ad8fbaba3c6a4caba2aaa62f118253b8
16:55:30.999 INFO – Command request: getNewBrowserSession[*chrome, http://cableweb/%5D on session null
16:55:30.999 INFO – creating new remote session
16:55:31.000 INFO – Allocated session 38cbb4859dcf4cdfb8c33f7f160c56f7 for http://cableweb/, launching…
16:55:31.060 INFO – Preparing Firefox profile…
16:55:33.334 INFO – Launching Firefox…
16:55:35.379 INFO – Got result: OK,38cbb4859dcf4cdfb8c33f7f160c56f7 on session 38cbb4859dcf4cdfb8c33f7f160c56f7
16:55:35.427 INFO – Command request: setTimeout[30000, ] on session 38cbb4859dcf4cdfb8c33f7f160c56f7
16:55:35.438 INFO – Got result: OK on session 38cbb4859dcf4cdfb8c33f7f160c56f7
16:55:35.490 INFO – Command request: open[/index.php, ] on session 38cbb4859dcf4cdfb8c33f7f160c56f7
16:55:35.691 INFO – Got result: OK on session 38cbb4859dcf4cdfb8c33f7f160c56f7
16:55:35.742 INFO – Command request: click[link=Aquisições, ] on session 38cbb4859dcf4cdfb8c33f7f160c56f7
16:55:35.759 INFO – Got result: ERROR: Element link=Aquisições not found on session 38cbb4859dcf4cdfb8c33f7f160c56f7
16:55:35.810 INFO – Command request: testComplete[, ] on session 38cbb4859dcf4cdfb8c33f7f160c56f7
16:55:35.811 INFO – Killing Firefox…

Houston we have a #FAIL

Apesar do fail isto é apenas o principio, os testes ficaram relativamente bem feitos com o selenium IDE, agora em codigo tenho de resolver situações, que não consigo cobrir com o selenium IDE.

http://seleniumhq.org/docs/appendix_locating_techniques.html

Fotos do Flickr

Luz da Lua

Clima tropical, Chuva Tropical

Portão de madeira, Luz lunar encoberta

Paty do alferes, Rio de Janeiro

Rua perto de Notre Dame

Trocadero garden

Mais fotos

MyBookmarks

My Amazon.com Wish List
Seguir

Get every new post delivered to your Inbox.