Thursday, March 20, 2014

Anedotas! LOL

Adivinhas e Anedotas


Um dia na sala do Joãozinho a professora pede a toda a turma para fazerem um trabalho com as palavras green, pink e yellow de inglês.
No dia seguinte a professora pergunta ao Joãozinho:
- Então Joãozinho como é que escreves-te o teu trabalho?
-Hoje tocou o telefone green, green. Atendi e disse:
-Yellow, yellow. Como o senhor que estava do outro lado se tinha enganado no número desliguei e o telefone fez:
-Pink, pink.


O Sr. Tacalado e a sua mulher Graça foram andar de mota, mas esqueceram-se do capacete.
De repente um polícia mandou-os parar e disse:
- O seu nome por favor.
- Tacalado.
- Mau... não lhe admito brincadeiras.
- O seu nome por favor.
- Tacalado. Já lhe disse.
- Desculpe lá, mas onde é que está a graça?
- A minha mulher está aqui ao pé de mim.


Uma vez, um jovem foi a um restaurante e resolveu dar tanga ao empregado.
E diz para consigo. – Hoje, vou dizer tudo por F. Vamos começar.
-Faz favor.
- O que é que o Sr. deseja?
- Frango Frito.
- Com quê?
- Feijão frade.
- Há.
- E para beber?
- Fanta.
-Fanta não temos!
- Frisumo fresco.
- Deseja um cafezinho?
- Forte e fervido.
(algum tempo depois)
- O cafezinho estava bom?
- Frio, fraco, filtro furado, formigas flutuando.
- Desculpe lá o seu nome por favor.
- Fernando Faria Fagundes Filho.
- O que é que o Sr. faz?
- Fui ferreiro.
- Porquê? Já não é?
- Fui forçado.
- Porquê?
- Faltou ferro.
- E que é que o Sr. fazia?
- Ferragens, ferraduras e ferramentas.
- O Sr. tem algum clube?
- Fui Felgueiras.
- Porquê já não é?
- Fez fraco!
- Desculpe lá! Se o Sr. me disser 10 palavras começadas por F vai-se embora sem pagar a conta.
- Foi fixe, fixe fazer fiado facilmente fiquei freguês.
- Ei, ei faltam 2.
- Foste falido.


Diz um menino para uma menina:
-Eu consigo estar mais de cem dias sem comer.
-Como é que consegues?
-Como só de noite!


Diz uma formiga a um elefante:
- É pá, já viste a poeirada que nós estamos a fazer?




Anedota seca.
Era uma vez um jovem que andava no 9º ano sem saber o que era uma flor azul, então tiveram de o reprovar.
Ficou na mesma no 9º ano.
E assim sucessivamente.
Um dia foi atropelado.
Moral da história:
Deve-se olhar para todos os lados antes de se atravessar a rua.


Estava o Joãozinho e o Pedrinho na estação de comboios.
De repente, diz o Joãozinho:
- Se aquele comboio fosse de chocolate por onde começarias a comê-lo?
- Pelas rodas para ele não me fugir.


A professora pergunta ao Pedrinho:
- És do reino vegetal, mineral ou animal?
- Vegetal!
- ...?
- É que eu chamo-me José da Horta.




Qual é a primeira coisa que Pedro Álvares Cabral fez depois de pôr um pé no Brasil?
Pôs o outro!


Qual é o cumulo da estupidez?
Dois carecas estarem a discutir por causa dum pente.




Qual é o cumulo da sorte?
Ser atropelado por uma ambulância.




Um gajo foi a um pintor para ele pintar a última ceia de Jesus.
Passado uma semana, foi lá, pega no quadro e começa a contá-los.
Contou 13 pessoas e disse:
- Ó MAS ELES SÃO 12!!!
- MAS ELE ACABA DE COMER E VAI-SE EMBORA!!!
- ESTÁ BEM QUANDO ELE SE FOR EMBORA EU PAGO-LHE!!!

Monday, February 10, 2014

How to make a new Drupal theme.

How to make a new drupal theme:


Make a copy of core theme e.g. Garland, copy Garland direcotry and rename to it mytheme or as you wish. e.g. mytheme.

Now we have /sites/all/mytheme/ with all the templates files.
On this directory are important files, and that is the important part to make a new theme.

Drupal theme files:

.../sites/all/mytheme/

screenshot.png
logo.png
mytheme.info
/css
/images
/color
page.tpl.php
node.tpl.php
template.php
maintenance-page.tpl.php
comment.tpl.php
theme-settings.php


1.screenshot.png:
The screenshot should show the entire page and be about ~960x720 (4:3 ratio) resized to exactly 294x219 (~30% of the original size). Try to show many useful page elements (menu, tabs, title, links). Don't include browser chrome (toolbar, status bar, scrollbar, etc). A screenshot used for display purposes in the admin panel.

2.logo.png:
Your logo, if you are using one.

3.mytheme.info:
A required file that is new to Drupal 6 which provides information about the theme.

4.page.tpl.php
!!!page.tpl.php is the only file which is absolutely required. It overrides the theme('page') function, which outputs the final page contents, along with all the extra decorations like a header, tabs, breadcrumbs, sidebars and a footer.
This template defines the main skeleton for the page.
The main template that defines the content on most of the page.

5.node.tpl.php
This file defines the content of the nodes.
This template controls the display of a node, and a node summary. It can only affect the output of the $content variable.

6.template.php
Any PHP functions in your theme should use the Drupal API and follow best practices for writing secure code. Note that functions should be placed in template.php or a module and not in *.tpl.php.
7.maitenance-page.tpl.php

8.comment.tpl.php
Defines the content of the comments.

9.theme-settings.php
Any PHP functions in your theme should use the Drupal API and follow best practices for writing secure code. Note that functions should be placed in template.php or a module and not in *.tpl.php.

10.html.tpl.php
Default theme implementation to display a single Drupal page.

style.css — The CSS file that sets the CSS rules for the template.
block.tpl.php — Defines the content of the blocks.
box.tpl.php — puts a box around things like comments. See also http://drupal.org/node/11814.
style-rtl.css — this file is new to Drupal 6's Bluemarine. I think it's a CSS for right to left languages and can be ignored if you're using a left-to-right language like English.

#You can create files to override the following functions:
theme('page') (page.tpl.php): theme a page
theme('block') (block.tpl.php): theme a block in sidebar
theme('box') (box.tpl.php): theme a generic container for the main area
theme('comment') (comment.tpl.php): theme a comment
theme('node') (node.tpl.php): theme a node

Useful links for druapl theme information

https://drupal.org/node/341707
https://drupal.org/documentation/theme
https://drupal.org/node/173880

Sunday, February 09, 2014

Quotes - Frases

“Every sale has five basic obstacles: no need, no money, no hurry, no desire, no trust.” - zig ziglar

“BUT WHO PRAYS FOR SATAN? WHO, IN EIGHTEEN CENTURIES, HAS HAD THE COMMON HUMANITY TO PRAY FOR THE ONE SINNER THAT NEEDED IT MOST?” MARK TWAIN

http://blog.logos.com/2013/05/10-more-warren-wiersbe-quotes/ - Warren Wiersbe - Religion!!!

Courage is resistance to fear, mastery of fear, not absence of fear. Mark Twain

Saturday, February 08, 2014

Linux LAMP - Virtual Hosts Configuration

Hello Linuxers this article may be helpful to set-up virtual hosts on a Linux Box.

The purpose of Virtual-hosts is to use different domains or multiple websites being served/hosted from one single web-server e.g. Apache2 and also organize them by directory, this can be done via name-based or IP-based virtual hosts.

In this case I use name-based website on a single ip address.
For example we need one directory on the document root for all files don't mix up in the same folder, so that each host has its own directory to avoid confusion.

Our goal is to make a new host called site1.com - we wish to put all files at /var/www/site1/ and access it via http://www.site1.com or http://site1.com
We know the Document Root is in /var/www/ that is explicit defined in /etc/apache2/sites-enabled/default
Here are the commands to make a virtual-host just repeat to create new ones.

Virtual-host set-up configuration

sudo mkdir -p /var/www/site1/public_html
sudo chown -R $USER:$USER /var/www/site1/public_html
sudo chmod -R 755 /var/www/
sudo nano /var/www/site1/public_html/index.html
1.Inside index.html put this small text, use echo or edit file with nano:
<html>
<head>
<title>www.site1.com</title>
</head>
<body>
<h1>
Success: You Have Set Up a Virtual Host</h1>
</body>
</html>
2.Now we create and add the real virtual-host and directory information entry to Apache2 configuration:
sudo nano /etc/apache2/sites-available/site1
3.inside the file write:
<VirtualHost *:80>
        ServerAdmin webmaster@example.com
        ServerName site1.com
        ServerAlias www.site1.com
        DocumentRoot /var/www/site1/public_html
        <Directory /var/www/site1/public_html>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                Allow from all
        </Directory>
        ErrorLog /var/log/apache2/error_site1
        LogLevel warn
        CustomLog /var/log/apache2/access_site1 combined
        ServerSignature Off
</VirtualHost>
4.now we enable this site using a2ensite utility and reload Apache configuration:
sudo a2ensite site1
sudo service apache2 reload
5.To review we created the directory for the website, we gave permissions to the directory, we created a simple index.html, and created virtual-host configuration file and enabled it with a2ensite.
6.To finish we also need some ip-hostname entry to /etc/hosts to recognize this domain, I call it domain aliased to ip-address because we set *:80 in the config file.
On the sites-available/site1 file as you see are important directives like ServerName, ServerAlias and DocumentRoot which give unique identity to the virtual-host.
nano /etc/hosts
7.Edit the file and add an entry at the last line of the file:
127.0.0.1 site1.com www.site1.com

Useful configuration files location:

/etc/hosts - hosts file to define hostname ips and aliases
/etc/php5/ - php5 configuration file is php.ini
/etc/phpmyadmin/ - phpmyadmin directory
/etc/apache2/ - apache2.conf configuration file
/etc/mysql - my.cnf mysql configuration file

Helpers to enable or disable virtual-hosts, modules

#They are activated by symlinking available configuration files from their
# respective *-available/ counterparts. These should be managed by using our
# helpers a2enmod/a2dismod, a2ensite/a2dissite. See
# their respective man pages for detailed information.

# enable site
sudo a2ensite
# disable site
sudo a2dissite
# enable an apache2 module
sudo a2enmod
# e.g. a2enmod php4 will create the correct symlinks in mods-enabled to allow the module to be used. In this example it will link both php4.conf and php4.load for the user
# disable an apache2 module
sudo a2dismod
# force reload the server configuration
sudo service apache2 reload

# useful links for virtual-host information
http://httpd.apache.org/docs/2.2/vhosts/
http://httpd.apache.org/docs/2.2/vhosts/name-based.html
http://httpd.apache.org/docs/2.2/vhosts/examples.html
http://www.centos.org/docs/2/rhl-rg-en-7.2/s1-apache-config.html