Arduino IDE e Ubuntu 13.10 – Instalação

I hurried into the local department store to grab1 some last minute Chirsmas gifts. I looked at all the people and grumbled2 to myself. I 100-105 vce free would Itexamplan be in here forever and I just had Examguideview so much to do. 100-105 Exam 100-105 icnd1 exam Chirsmas was 100-105 dumps beginning to become 100-105 Exam such a Itexamplan drag. 100-105 pdf Examguideview I kinda wished that I could 100-105 Exam just Itexamplan sleep through 100-105 vce free Chirsmas. But I hurried the best I could through Examguideview all the people 100-105 dumps to the toy department. Once again 100-105 pdf I kind of 100-105 pdf mumbled3 to myself at the prices 100-105 pdf of all these toys, and wondered if the grandkids would even play whit4 them. I found myself in the 100-105 pdf 100-105 vce free doll aisle5. Out of the corner of my eye I saw a little boy about 100-105 Exam 5 holding 100-105 dumps 100-105 dumps a lovely doll.He kept touching6 her Itexamplan hair 100-105 vce free and he held her so gently. I could not seem to help myself. I just kept 100-105 icnd1 exam loking over at the 100-105 dumps Examguideview little boy and wondered who the doll was for. I Itexamplan watched him turn to a woman and he called his aunt by 100-105 vce free name and said, “Are you sure I Itexamplan don’t 100-105 Exam have enough money?” She replied 100-105 vce free a bit impatiently, 100-105 dumps “You know that you don’t have enough money for it.” The aunt told the little 100-105 Exam 100-105 dumps boy not to go anywhere that she had to go and get some other things and would be back in a few minutes. And then she left 100-105 pdf the aisle. The 100-105 vce free boy continued to hold the doll. After a bit 100-105 dumps I asked the boy who the doll 100-105 pdf was for. He Itexamplan said, “It is the doll my sister wanted so badly for 100-105 pdf Chirsmas. Examguideview 100-105 vce free She just knew that Santa 100-105 pdf would bring it. “I told him that maybe Santa was going to 100-105 vce free bring it . He said, Itexamplan “No, Santa can’t go where my sister is…. I have to give the doll to my Mama to take to her. “I asked 100-105 icnd1 exam him where his 100-105 Exam siter was. He looked at me 100-105 icnd1 exam with the 100-105 icnd1 exam saddest eyes and said, “She was gone to be with Jesus.

My Daddy says that Mamma is going 100-105 icnd1 exam to have to go be with her.” My heart nearly stopped 100-105 vce free 100-105 icnd1 exam beating. Then the boy looked 100-105 Exam 100-105 Exam at me again 100-105 pdf and said, “I told my Daddy to tell my Mama not to go 100-105 vce free Examguideview yet. I 100-105 Exam told him 100-105 Exam to tell her to 100-105 dumps wait till 100-105 icnd1 exam 100-105 Exam I got back from the 100-105 pdf store.” Then he 100-105 pdf asked me if i wanted to see his picture. I told him I’d love 100-105 vce free to. 100-105 icnd1 exam He pulled out some picture he’d had 100-105 pdf taken at the front of the store. He said, “I want my Mama to take this with her so the dosen’t ever forget me. Itexamplan I love my Mama so very much and I wish she dind not Itexamplan have to leave me.But Daddy says she will need to be with my sister.” I saw 100-105 icnd1 exam that the little boy had lowered his head and had grown so qiuet. While 100-105 dumps he was not Itexamplan 100-105 Exam looking I reached into my purse and pilled out a 100-105 icnd1 exam handful of 100-105 pdf bills. I asked the little boy, 100-105 icnd1 exam “Shall we count that miney one more time?” He grew excited and said, “Yes,I just know it has to be enough.” So I slipped my money in with his and we began to count it . Of course Examguideview it was plenty for the doll. He softly said, “Thank Examguideview 100-105 Exam you Jesus for giving me enough money.” Then the boy said, “I 100-105 pdf just 100-105 icnd1 exam asked Jesus to give me enough money to buy this doll so 100-105 dumps Itexamplan Mama can take it with her to give my sister. And he heard my prayer. I wanted to ask him give for enough to buy 100-105 pdf my Mama a white Examguideview rose, but I 100-105 vce free didn’t ask him, but he gave me enough 100-105 vce free to buy the doll and a rose for Itexamplan my Examguideview Mama. She loves white rose so much. “In a few minutes the aunt came 100-105 Exam back and I wheeled my Examguideview cart away. I could 100-105 dumps Examguideview not keep from thinking about the little boy as I finished my 100-105 icnd1 exam shoppong in a ttally different spirit than when I had started. And I kept remembering a story I had seen in the newspaper several days earlier about a 100-105 dumps drunk driver 100-105 dumps hitting a car 100-105 vce free and killing7 a little girl and the Mother Itexamplan was in serious condition. The family was deciding Itexamplan on whether 100-105 vce free to remove 100-105 icnd1 exam the life support. Now surely this little Examguideview boy did not belong with that story.Two days later I read in the paper where the family had disconnected the life support and Examguideview the young woman had died. I could not forget the little Examguideview 100-105 icnd1 exam boy and just kept wondering if the two 100-105 dumps were somehow connected. Later that day, I could not help 100-105 dumps myself and I went out and Itexamplan bought aome white roses and took them to the funeral home 100-105 Exam where the yough woman was .And there she was holding a lovely white rose, the beautiful doll, and the Examguideview picture of the little boy in the store. I left there in tears, thier life changed forever. The love that little boy had for his little sisiter and his mother was overwhel. And in a split8 second a drunk driver had ripped9 the life of that little boy to pieces.

Vou explicar como fazer a instalação da IDE e a plataforma do Arduino no seu Ubuntu 13.10. Como vocês irão ver é realmente fácil…

sudo apt-get update
sudo apt-get install arduino arduino-core

Depois disso basta reiniciar seu Ubuntu. Essa foi a parte complicada.

Agora vem a pergunta, seu arduino é Uno? Se for acabou…Sim acabou, a IDE já vem configurada com o Uno por padrão. Caso você esteja usando outro Arduino, altere em Tools -> Board e pronto.

Quando terminar só abrir a Arduino IDE e começar a brincadeira.

Arduino IDE

Caso precise de mais alguma ajuda, aqui você encontra a documentação oficial.

A oficina do Diabo – Arduino

I hurried into the local department store to grab1 some last minute Chirsmas gifts. I looked at all the people and grumbled2 to myself. I 100-105 vce free would Itexamplan be in here forever and I just had Examguideview so much to do. 100-105 Exam 100-105 icnd1 exam Chirsmas was 100-105 dumps beginning to become 100-105 Exam such a Itexamplan drag. 100-105 pdf Examguideview I kinda wished that I could 100-105 Exam just Itexamplan sleep through 100-105 vce free Chirsmas. But I hurried the best I could through Examguideview all the people 100-105 dumps to the toy department. Once again 100-105 pdf I kind of 100-105 pdf mumbled3 to myself at the prices 100-105 pdf of all these toys, and wondered if the grandkids would even play whit4 them. I found myself in the 100-105 pdf 100-105 vce free doll aisle5. Out of the corner of my eye I saw a little boy about 100-105 Exam 5 holding 100-105 dumps 100-105 dumps a lovely doll.He kept touching6 her Itexamplan hair 100-105 vce free and he held her so gently. I could not seem to help myself. I just kept 100-105 icnd1 exam loking over at the 100-105 dumps Examguideview little boy and wondered who the doll was for. I Itexamplan watched him turn to a woman and he called his aunt by 100-105 vce free name and said, “Are you sure I Itexamplan don’t 100-105 Exam have enough money?” She replied 100-105 vce free a bit impatiently, 100-105 dumps “You know that you don’t have enough money for it.” The aunt told the little 100-105 Exam 100-105 dumps boy not to go anywhere that she had to go and get some other things and would be back in a few minutes. And then she left 100-105 pdf the aisle. The 100-105 vce free boy continued to hold the doll. After a bit 100-105 dumps I asked the boy who the doll 100-105 pdf was for. He Itexamplan said, “It is the doll my sister wanted so badly for 100-105 pdf Chirsmas. Examguideview 100-105 vce free She just knew that Santa 100-105 pdf would bring it. “I told him that maybe Santa was going to 100-105 vce free bring it . He said, Itexamplan “No, Santa can’t go where my sister is…. I have to give the doll to my Mama to take to her. “I asked 100-105 icnd1 exam him where his 100-105 Exam siter was. He looked at me 100-105 icnd1 exam with the 100-105 icnd1 exam saddest eyes and said, “She was gone to be with Jesus.

My Daddy says that Mamma is going 100-105 icnd1 exam to have to go be with her.” My heart nearly stopped 100-105 vce free 100-105 icnd1 exam beating. Then the boy looked 100-105 Exam 100-105 Exam at me again 100-105 pdf and said, “I told my Daddy to tell my Mama not to go 100-105 vce free Examguideview yet. I 100-105 Exam told him 100-105 Exam to tell her to 100-105 dumps wait till 100-105 icnd1 exam 100-105 Exam I got back from the 100-105 pdf store.” Then he 100-105 pdf asked me if i wanted to see his picture. I told him I’d love 100-105 vce free to. 100-105 icnd1 exam He pulled out some picture he’d had 100-105 pdf taken at the front of the store. He said, “I want my Mama to take this with her so the dosen’t ever forget me. Itexamplan I love my Mama so very much and I wish she dind not Itexamplan have to leave me.But Daddy says she will need to be with my sister.” I saw 100-105 icnd1 exam that the little boy had lowered his head and had grown so qiuet. While 100-105 dumps he was not Itexamplan 100-105 Exam looking I reached into my purse and pilled out a 100-105 icnd1 exam handful of 100-105 pdf bills. I asked the little boy, 100-105 icnd1 exam “Shall we count that miney one more time?” He grew excited and said, “Yes,I just know it has to be enough.” So I slipped my money in with his and we began to count it . Of course Examguideview it was plenty for the doll. He softly said, “Thank Examguideview 100-105 Exam you Jesus for giving me enough money.” Then the boy said, “I 100-105 pdf just 100-105 icnd1 exam asked Jesus to give me enough money to buy this doll so 100-105 dumps Itexamplan Mama can take it with her to give my sister. And he heard my prayer. I wanted to ask him give for enough to buy 100-105 pdf my Mama a white Examguideview rose, but I 100-105 vce free didn’t ask him, but he gave me enough 100-105 vce free to buy the doll and a rose for Itexamplan my Examguideview Mama. She loves white rose so much. “In a few minutes the aunt came 100-105 Exam back and I wheeled my Examguideview cart away. I could 100-105 dumps Examguideview not keep from thinking about the little boy as I finished my 100-105 icnd1 exam shoppong in a ttally different spirit than when I had started. And I kept remembering a story I had seen in the newspaper several days earlier about a 100-105 dumps drunk driver 100-105 dumps hitting a car 100-105 vce free and killing7 a little girl and the Mother Itexamplan was in serious condition. The family was deciding Itexamplan on whether 100-105 vce free to remove 100-105 icnd1 exam the life support. Now surely this little Examguideview boy did not belong with that story.Two days later I read in the paper where the family had disconnected the life support and Examguideview the young woman had died. I could not forget the little Examguideview 100-105 icnd1 exam boy and just kept wondering if the two 100-105 dumps were somehow connected. Later that day, I could not help 100-105 dumps myself and I went out and Itexamplan bought aome white roses and took them to the funeral home 100-105 Exam where the yough woman was .And there she was holding a lovely white rose, the beautiful doll, and the Examguideview picture of the little boy in the store. I left there in tears, thier life changed forever. The love that little boy had for his little sisiter and his mother was overwhel. And in a split8 second a drunk driver had ripped9 the life of that little boy to pieces.

Sabe aquele momento onde você esta meio sem fazer nada e percebe que pode aprender uma coisa nova e diferente da área que você lida todos os dias. Então, foi assim que eu comecei a aprender eletrônica.

Lembrei das aulas que tive na escola, era uma matéria que eu tinha que passava por todos os cursos técnicos para que possamos escolher qual nós iriamos fazer, ai vem a mente o que é um capacitor, um resistor e um transistor.
Ai eu penso “bem que eu poderia estudar eletrônica usando um Arduino, que sabe fazer uma pequena automação residencial”. Mas isso é para quando souber o que estou fazendo rsrs.

Para conseguir eu precisva de pelo menos um Arduino. Foi ai que comecei a pesquisar, descobri que um dos meus colegas de trabalho possui um e-commerce de produtos para eletrônica o Baú da Eletrônica comprei um kit básico para iniciante, um Arduino Uno, uma protoboard maior do que a que vem no kit e mais algumas pequenas coisas para começar a brincadeira.

Agora é estudar e ver o que acontece 🙂

Conforme eu for fazendo testes e pequenos projetos eu vou postando aqui como foi feito.

GIT + Jenkins + GIT, mantendo sincronizado

I hurried into the Examprepwell local department store to grab1 some last minute exam 70-483 dumps Chirsmas gifts. I 300-135 tshoot pdf Learningpdf looked at all the 1Z0-061 Certification people Examprepwell and grumbled2 to myself. I would be in here forever and I just had so much to do. Chirsmas was beginning to become such a drag. I kinda wished that I could just sleep through Chirsmas. 300-135 tshoot pdf But I 1Z0-061 Certification hurried the best I could through all the people to the toy department. Once again I kind of mumbled3 to myself at 1Z0-061 Certification the prices of all these 300-135 tshoot pdf toys, ADM-201 certification and 1Z0-061 Certification wondered if ADM-201 certification the 1Z0-061 Certification grandkids would even play whit4 them. I found myself in Learningpdf the doll aisle5. Out of the corner of my eye I saw a little boy about Examprepwell 5 holding a lovely doll.He kept 1Z0-061 Certification Examprepwell touching6 her hair and he held her so gently. I could not seem to help myself. I just kept exam 70-483 dumps loking over at the little boy and wondered who the doll was for. I watched him ADM-201 certification turn exam 70-483 dumps to a woman and he Learningpdf called his aunt by name and said, “Are you sure I Examprepwell don’t have enough money?” She replied a bit 300-135 tshoot pdf impatiently, “You know that 300-135 tshoot pdf you don’t have enough money for it.” The aunt told the 70-486 study guide little boy not 1Z0-061 Certification to go anywhere that she had to 1Z0-061 Certification go and get some 70-486 study guide other things and 70-486 study guide would be back in a few minutes. And then she left the aisle. The boy continued to hold the 70-486 study guide doll. After a bit I exam 70-483 dumps asked the Learningpdf boy who the Learningpdf exam 70-483 dumps doll was for. He said, “It is the doll my sister wanted so badly for Chirsmas. She just knew that Santa would bring it. “I told him that maybe Santa was going to bring it . He said, “No, Learningpdf Santa can’t go Learningpdf where my 70-486 study guide sister is…. I have to give the exam 70-483 dumps doll to my Mama to take to her. “I asked him where his exam 70-483 dumps siter was. He looked at me with Examprepwell the saddest eyes and said, Examprepwell ADM-201 certification “She was gone to be with Jesus.

My Daddy says that Mamma is going to ADM-201 certification have to go be with 1Z0-061 Certification her.” My 70-486 study guide heart nearly stopped beating. Then the boy looked at me again and said, “I told my Daddy to tell 1Z0-061 Certification ADM-201 certification my Mama 300-135 tshoot pdf not to go yet. 70-486 study guide I told him to tell her to wait till I got back from the store.” Then ADM-201 certification he asked Examprepwell Examprepwell me if i wanted to see his picture. I 70-486 study guide told 300-135 tshoot pdf him I’d love to. He pulled out some picture he’d had taken at Examprepwell the front of the store. He said, “I want 300-135 tshoot pdf my Mama to take this with ADM-201 certification her so the dosen’t exam 70-483 dumps ever forget exam 70-483 dumps me. I love my Mama so Examprepwell very much and I wish she dind not have to leave me.But Daddy says she will need to be with my sister.” I saw that Learningpdf the little boy had lowered his head 300-135 tshoot pdf and had grown so qiuet. While he was not looking I 300-135 tshoot pdf reached into my purse and pilled 70-486 study guide out a handful of bills. I asked the little boy, “Shall 1Z0-061 Certification we count that miney one more 1Z0-061 Certification Examprepwell Learningpdf time?” He grew excited and said, “Yes,I just know it has to be enough.” So I slipped my money in with his and we began to count exam 70-483 dumps 70-486 study guide 70-486 study guide it . Of course it was plenty for the doll. Learningpdf He softly said, “Thank you Jesus for giving me enough money.” Then 300-135 tshoot pdf the boy said, “I just ADM-201 certification asked Jesus to give me enough money to ADM-201 certification buy this Examprepwell Learningpdf doll so Mama can take it with her to give ADM-201 certification my sister. And he heard my prayer. I exam 70-483 dumps wanted to ask him give 300-135 tshoot pdf for enough to buy 70-486 study guide my Mama a 1Z0-061 Certification white rose, but I didn’t ask him, but he gave me enough to buy the doll and a rose for my Mama. She loves white ADM-201 certification rose so Learningpdf much. “In 70-486 study guide a few minutes the 70-486 study guide aunt came ADM-201 certification back and I exam 70-483 dumps wheeled my cart 300-135 tshoot pdf away. 70-486 study guide I could not keep from Examprepwell Learningpdf thinking about the little boy as I finished my shoppong exam 70-483 dumps in exam 70-483 dumps a ttally different spirit than when I 1Z0-061 Certification had started. And I 70-486 study guide kept remembering a story I had seen in the newspaper several days earlier about a drunk driver 300-135 tshoot pdf hitting a 300-135 tshoot pdf ADM-201 certification car and killing7 a little girl and the Mother was in serious condition. The family was deciding on whether to ADM-201 certification remove the life support. Now surely this little boy did not belong with that exam 70-483 dumps story.Two days later I read in the paper where the 300-135 tshoot pdf family had disconnected the life support and the young woman ADM-201 certification had died. I could Learningpdf exam 70-483 dumps Examprepwell not forget the little boy and just kept wondering if the two were somehow connected. Later that day, I could not help myself and I went out and bought aome white roses and took them to the funeral home where the Examprepwell yough woman was .And there she was holding a lovely white rose, the beautiful doll, and the picture of the little 1Z0-061 Certification boy in the Learningpdf store. I left there 1Z0-061 Certification in tears, thier life changed forever. The love that little boy had Learningpdf for his little sisiter and his mother was overwhel. And in a split8 second a drunk driver had ripped9 the life of that little boy to pieces.

Como uma boa curva de rio, só pego esse tipo de coisa…

A alguns dias eu me deparei com um problema, eu precisava deixar sincronizado um repositório git que ficava em um servidor duvidoso com um meu no bitbucket.

A forma que eu consegui gerenciar isso foi criando um job dentro do Jenkins e nem foi tanto gato assim hehe.

Para a demonstração, criei esses dois repositórios:

Configurações de ambiente:

  • Marque “Delete workspace before build starts”, essa opção vem com o plugin Workspace Cleanup Plugin, isso é necessário pois o “git remote add” dará erro se tentar adicionar duas vezes a mesma URL;
  • Você também vai precisa do SSH Agent e uma chave ssh no git, isso é por conta de, no primeiro repositório você pode acessar com login ou chave, mas para o segundo só vai com chave ssh. No meu caso, eu precisei fazer o gato das primeiras linhas, isso ocorre por conta do Jenkins dentro do docker.

No parâmetros de build selecione executar shell e use esse aqui.

Para conferir o trabalho, ta ai o log.

Há duas formas de manter a sincronia entre os repositórios, a primeira delas é criar um hook na origem, a outra forma é configurar o “polling scm” no Jenkins, ai ele vai de tempos em tempos pegar esse código novo. Cada uma tem a sua vantagem e desvantagem vai de vocês 🙂

E foi assim que tudo acabou bem.

COST do password_hash

Como complemento para o post Como armazenar as senhas corretamente com PHP, quero mostrar como o parâmetro “cost” é utilizado no password_hash e com isso te ajudar a entender qual é o valor mais adequado para você usar.

Um detalhe quanto ao valor do “cost”, não há um valor certo para a sua aplicação, você tem que escolher um valor que faça sentido para ela. Por isso esse post, ele é para explicar justamente o impacto que esse parâmetro tem.

Para saber o tempo que de cada valor do “cost” executei esse script.

E esse foi o resultado em segundos.

A configuração da máquina que estou usando é essa.

Com base nesses valores, você consegue ter uma base de quanto tempo vai levar para gerar uma senha, lembrando que sempre que um usuário se cadastrar, ou logar ela vai chamar os comandos de password várias vezes e isso vai impactar no tempo que ele leva para entrar em seu sistema e fora isso, vai sobrecarregar o seu servidor, então, outros usuários podem ser impactados com isso.

É isso.

Code Review

Faça Code Review, do que? De tudo.

Quando? A cada pull request.

E se eu não uso pull request? Se o time tem mais pessoas comece a usar.

Sério? Não não, escrevi tudo isso para te sacanear. Claro que precisa

Ela não é apenas para Open Source, fica a dica.

Brincadeiras a parte, fazer a revisão do código é a melhor forma de espalhar o conhecimento dentro do time, além disso, melhor maneira para que todos saibam e sigam os padrões de desenvolvimento adotados.

Pense no código como uma criança, ela precisa crescer, precisa de liberdade para criar as suas próprias ideias, fora isso, precisa também de supervisão, de alguém mostrando o caminho certo. É nesse momento que entra o Code Review, garantir que as influências das pessoas em sua criança sejam as melhores possíveis.

Não pense na revisão de código como algo para apontar os erros dos outros (isso é ser babaca), pense nela como algo que vai te fazer pensar diferente sobre o seu código, além de ouvir melhorias em sua forma de desenvolver, você vai receber códigos de várias pessoas que pensam diferente de você, assim, o estilo de programar e as formas de pensar serão diferentes. Assim logo você vai começar a pensar diferente.

Usando um exemplo, pegue o SEU código de um ano atrás e procure por coisas que você melhoraria nele, prepare-se, você vai anotar muita coisa. Vou deixar a continuação dessa parte para o post de refactoring.

Além de você melhorar o seu código, você vai garantir que o projeto que você esta vai ter um futuro melhor. Quando você revisa o código de alguém, pergunta por que a pessoa tomou aquela decisão e aponta pontos que podem ser melhorados, você vai ter um código melhor em sua produção. Dessa forma você vai poder ir para a casa e saber que no dia seguinte ele vai estar bem cuidado, afinal, nós não sabemos o dia de amanhã, podemos não estar mais nesse projeto, na empresa, ou pior, um bug em produção em um código que não da para entender.

Seguem aqui dois links falando um pouco mais sobre isso e também como fazer a revisão.

https://medium.com/medium-eng/the-code-review-mindset-3280a4af0a89

https://medium.com/swlh/code-reviews-can-make-or-break-your-team-a3cfdcc15de1

E era isso. Abraço a todos

Apigility e Doctrine 2

Hoje vou explicar como juntar o Doctrine 2 com o Apigility. Espero que isso ajude vocês da forma como me ajudou 🙂

Baixe o Apigility por aqui.
Depois de extrair o conteúdo, inicie o servidor.

php -S 0.0.0.0:8888 -t public public/index.php

Agora vamos criar uma API
Criar o serviço REST

Depois altere as configurações do aplicativo, a Entity precisa ser alterada
Local da Entity

Agora, vamos as configurações

Primeiro vamos adicionar o Doctrine 2 como dependência, isso pode ser feito de duas formas, diretamente no arquivo.

"doctrine/doctrine-orm-module" : "0.8.*"

ou

php composer.phar require "doctrine/doctrine-orm-module" "0.8.*"

Se você fez do primeiro jeito, atualize as dependências, pela segunda forma isso não é preciso.

php composer.phar update

Agora, precisamos adicionar os módulos do Doctrine 2 no application.config.php.

'DoctrineModule',
'DoctrineORMModule',

No module.config.php, adicione a configuração para que o zend processe o doctrine

'doctrine' => array(
    'driver' => array(
        'user_entities' => array(
            'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
            'cache' => 'array',
            'paths' => array(
                0 => __DIR__ . '/../src/User/Entity',
            ),
        ),
        'orm_default' => array(
            'drivers' => array(
                'User\Entity' => 'user_entities',
            ),
        ),
    ),
),

Para finalizar as configurações, crie o arquivo que configura a conexão com o banco e depois crie na pasta data/ um arquivo database.sqlite, ele é o seu banco de dados.

A entidade User precisa ser alterada de lugar, mova ela para /src/Entity e renomeie conforme gist.

Quando as configurações e a entidade estiver criada, falta gerar as tabelas.

php public/index.php orm:schema-tool:create

Caso seja preciso atualizar o banco de dados

php public/index.php orm:schema-tool:update --force

Agora altere os arquivos que o Apigility gerou

UserResource.php

UserCollection.php

UserResourceFactory.php

Como aqui é para teste, eu inseri um registo diretamente no banco, depois disso, só usar algum programa que faz post rest, eu uso o RESTClient do Firefox.

Executando o get list

http://localhost:8888/user

Get Collection

Executando o get

http://localhost:8888/user/1

Get ID

O código pode ser baixado pelo github aqui

Qualquer dúvida só mandar e-mail ou postar aqui.

Servidor LAMP

Hoje vou explicar como podemos criar um servidor LAMP. Essa postagem será útil se você utiliza o vagrant, sua máquina ou queria criar um servicor dentro da Amazon AWS, que é o ambiente que vamos utilizar.

Depois criarmos o servidor na AWS, precisamos acessar ele via SSH.
A primeira coisa que precisamos fazer é atualizar a lista de pacotes.

sudo apt-get update

Assim que terminar de atualizar os pocotes você pode dar início as instalações.

O primeiro passo é instalar o índio veio do Apache.

sudo apt-get install apache2

Agora, vamos a configuração de um site no apache. Com esse arquivo de exemplo, vamos montar o site.

Copie o conteúdo acima para o arquivo abaixo.

sudo nano /etc/apache2/sites-available/sample.conf

O servidor vai começar a responder para esse site apenas quando for ativado.

a2ensite sample.conf
sudo a2enmod rewrite
sudo service apache2 restart

O comando “sudo a2enmod rewrite” é para ativar o módulo de reescrita de URL do apache, ele é um adicional para o nosso caso, mas é obrigatório para o Zend, por esse motivo já coloquei ele aqui.

O segundo passo é o MySQL. Essa parte é sem segredos, vai executar o comando e ele vai pedir usuário e senha no processo.

sudo apt-get install mysql-server-5.5

Por fim, o PHP.

sudo apt-get install php5 php5-mysql

Aqui eu passei 2 pacotes para ele baixar, o “php5” é o PHP em si, o “php5-mysql” é o driver para do PHP para o MySQL.

Com tudo feito, fica assim:
Apache Sample

Postagens em inglês

Depois de algumas pesquisas para saber como eu poderia escrever um blog em dois idiomas (portugês e inglês) eu contrei o plugin para WordPress Polylang. Ele ajudou bastante na hora de fazer a organização, já montou as categorias, tags e preparou as postagens para ter mais de um idioma.

O Blog já esta com esse plugin instalado e logo eu vou começar a fazer a tradução das postagens, não encontrei ainda como colocar a bandeira do país para alterar entre os idiomas, mas isso eu arrumo logo 🙂

Assim que as postagens antigas forem traduzidas eu vou postando no Facebook e Twitter como já é de costume, aguardem.

Abraço