<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Linha de comando.com - Tecnologia, Informação, Dicas e muito mais.</title>
	<atom:link href="http://www.linhadecomando.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.linhadecomando.com</link>
	<description>quem sabe eu possa te ajudar!</description>
	<lastBuildDate>Mon, 14 May 2012 16:35:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>PHP-MySQL-PDO: Trabalhando o resultado de uma consulta (foreach/while)</title>
		<link>http://www.linhadecomando.com/php/php-mysql-pdo-trabalhando-o-resultado-de-uma-consulta-foreachwhile</link>
		<comments>http://www.linhadecomando.com/php/php-mysql-pdo-trabalhando-o-resultado-de-uma-consulta-foreachwhile#comments</comments>
		<pubDate>Mon, 14 May 2012 16:35:56 +0000</pubDate>
		<dc:creator>Tiago</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[fetchAll]]></category>
		<category><![CDATA[foreach]]></category>
		<category><![CDATA[while]]></category>

		<guid isPermaLink="false">http://www.linhadecomando.com/?p=2464</guid>
		<description><![CDATA[Para trabalhar em loop os resultados de uma consulta, você pode utilizar a instrução foreach ou while. PDOStatement::fetchAll &#60;? // forma 1 $select = $pdo-&#62;query&#40;&#34; SELECT id, titulo, descricao FROM produtos&#34;&#41;; &#160; $result = $select-&#62;fetchAll; &#160; foreach&#40;$result as $row&#41; &#123; echo $row&#91;'titulo'&#93;.'&#60;br /&#62;'; echo $row&#91;'descricao'&#93;.'&#60;br /&#62;'; &#125; &#160; // forma 2 $select = $pdo-&#62;query&#40;&#34; SELECT [...]]]></description>
			<content:encoded><![CDATA[<p>Para trabalhar em loop os resultados de uma consulta, você pode utilizar a instrução <a href="http://br2.php.net/manual/pt_BR/control-structures.foreach.php" title="foreach" target="_blank">foreach</a> ou <a href="http://br2.php.net/manual/pt_BR/control-structures.while.php" title="while" target="_blank">while</a>.</p>
<p><a href="http://php.net/manual/pt_BR/pdostatement.fetchall.php" title="PDO MySQL" target="_blank">PDOStatement::fetchAll</a></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>
<span style="color: #666666; font-style: italic;">// forma 1</span>
<span style="color: #000088;">$select</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$pdo</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;
SELECT id, titulo, descricao
FROM produtos&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$select</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fetchAll</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'titulo'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;br /&gt;'</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'descricao'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;br /&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// forma 2</span>
<span style="color: #000088;">$select</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$pdo</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;
SELECT id, titulo, descricao
FROM produtos&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$select</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fetch</span><span style="color: #009900;">&#40;</span>PDO<span style="color: #339933;">::</span><span style="color: #004000;">FETCH_OBJ</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">'-'</span><span style="color: #339933;">.</span> <span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">titulo</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;br /&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.linhadecomando.com/php/php-mysql-pdo-trabalhando-o-resultado-de-uma-consulta-foreachwhile/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP-PDO: Apresentando o resultado de uma consulta ao banco MySQL (select)</title>
		<link>http://www.linhadecomando.com/php/php-pdo-apresentando-o-resultado-de-uma-consulta-ao-banco-mysql-select</link>
		<comments>http://www.linhadecomando.com/php/php-pdo-apresentando-o-resultado-de-uma-consulta-ao-banco-mysql-select#comments</comments>
		<pubDate>Mon, 14 May 2012 10:10:08 +0000</pubDate>
		<dc:creator>Tiago</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[FETCH_ASSOC]]></category>
		<category><![CDATA[FETCH_OBJ]]></category>

		<guid isPermaLink="false">http://www.linhadecomando.com/?p=2462</guid>
		<description><![CDATA[Segue algumas formas de apresentar o resultado de uma consulta ao banco MySQL, utilizando conexão PDO. &#60;? $id = &#40;int&#41; $_GET&#91;'id'&#93;; &#160; $select = $pdo-&#62;query&#40;&#34; SELECT id, titulo, descricao FROM produtos WHERE id = '&#34;.$id.&#34;'&#34;&#41;; &#160; // primeira forma $result = $select-&#62;fetch&#40;PDO::FETCH_ASSOC&#41;; echo $result&#91;'titulo'&#93;.'&#60;br /&#62;'; &#160; // segunda forma $result = $select-&#62;fetchAll&#40;PDO::FETCH_ASSOC&#41;; print_r&#40;$result&#41;; &#160; // [...]]]></description>
			<content:encoded><![CDATA[<p>Segue algumas formas de apresentar o resultado de uma consulta ao banco MySQL, utilizando conexão PDO.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>
<span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$select</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$pdo</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;
SELECT id, titulo, descricao
FROM produtos
WHERE id = '&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$id</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;'&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// primeira forma	</span>
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$select</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fetch</span><span style="color: #009900;">&#40;</span>PDO<span style="color: #339933;">::</span><span style="color: #004000;">FETCH_ASSOC</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$result</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'titulo'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;br /&gt;'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// segunda forma</span>
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$select</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fetchAll</span><span style="color: #009900;">&#40;</span>PDO<span style="color: #339933;">::</span><span style="color: #004000;">FETCH_ASSOC</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">print_r</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// terceira forma</span>
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$select</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fetch</span><span style="color: #009900;">&#40;</span>PDO<span style="color: #339933;">::</span><span style="color: #004000;">FETCH_OBJ</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">titulo</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">descricao</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.linhadecomando.com/php/php-pdo-apresentando-o-resultado-de-uma-consulta-ao-banco-mysql-select/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP-PDO: Como usar UTF-8 com MySQL e PDO</title>
		<link>http://www.linhadecomando.com/php/php-pdo-como-usar-utf-8-com-mysql-e-pdo</link>
		<comments>http://www.linhadecomando.com/php/php-pdo-como-usar-utf-8-com-mysql-e-pdo#comments</comments>
		<pubDate>Fri, 11 May 2012 16:17:31 +0000</pubDate>
		<dc:creator>Tiago</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[utf8]]></category>

		<guid isPermaLink="false">http://www.linhadecomando.com/?p=2458</guid>
		<description><![CDATA[&#60;? $hostname = 'nome_servidor'; $username = 'nome_usuario'; $password = 'senha'; $database = 'nome_banco'; &#160; try &#123; $pdo = new PDO&#40;&#34;mysql:host=$hostname;dbname=$database&#34;, $username, $password, array&#40;PDO::MYSQL_ATTR_INIT_COMMAND =&#62; &#34;SET NAMES utf8&#34;&#41;&#41;; echo 'Conexao efetuada com sucesso!'; &#125; catch&#40;PDOException $e&#41;&#123; echo $e-&#62;getMessage&#40;&#41;; &#125; ?&#62;]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>
<span style="color: #000088;">$hostname</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'nome_servidor'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$username</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'nome_usuario'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$password</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'senha'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$database</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'nome_banco'</span><span style="color: #339933;">;</span>
&nbsp;
try <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$pdo</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> PDO<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;mysql:host=<span style="color: #006699; font-weight: bold;">$hostname</span>;dbname=<span style="color: #006699; font-weight: bold;">$database</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$username</span><span style="color: #339933;">,</span> <span style="color: #000088;">$password</span><span style="color: #339933;">,</span>
    <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>PDO<span style="color: #339933;">::</span><span style="color: #004000;">MYSQL_ATTR_INIT_COMMAND</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;SET NAMES utf8&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'Conexao efetuada com sucesso!'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
catch<span style="color: #009900;">&#40;</span>PDOException <span style="color: #000088;">$e</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
   <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$e</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>					
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.linhadecomando.com/php/php-pdo-como-usar-utf-8-com-mysql-e-pdo/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JQuery: Validação de inputs</title>
		<link>http://www.linhadecomando.com/jquery/jquery-validacao-de-inputs</link>
		<comments>http://www.linhadecomando.com/jquery/jquery-validacao-de-inputs#comments</comments>
		<pubDate>Wed, 18 Apr 2012 11:11:54 +0000</pubDate>
		<dc:creator>Tiago</dc:creator>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[$.each]]></category>
		<category><![CDATA[addClass]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[find()]]></category>
		<category><![CDATA[removeClass]]></category>

		<guid isPermaLink="false">http://www.linhadecomando.com/?p=2448</guid>
		<description><![CDATA[Aprenda neste post, como validar os campos de texto (type=text) de um formulário, antes de submeter. - html &#60;form id=&#34;form&#34; action=&#34;&#34; method=&#34;post&#34; name=&#34;form&#34;&#62; &#60;input type=&#34;text&#34; id=&#34;nome&#34; name=&#34;nome&#34; class=&#34;verificar&#34; /&#62; &#60;br /&#62;&#60;br /&#62; &#60;input type=&#34;text&#34; id=&#34;sobrenome&#34; name=&#34;sobrenome&#34; class=&#34;verificar&#34; /&#62; &#60;br /&#62;&#60;br /&#62; &#60;input type=&#34;submit&#34; id=&#34;salvar&#34; value=&#34;Enviar&#34; /&#62; &#60;/form&#62; - css .erro&#123; border:2px solid #bf1e2c; &#125;​ - [...]]]></description>
			<content:encoded><![CDATA[<p>Aprenda neste post, como validar os campos de texto (type=text) de um formulário, antes de submeter.</p>
<p>- html</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">form</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;form&quot;</span> <span style="color: #000066;">action</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">method</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;post&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;form&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;nome&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;nome&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;verificar&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;sobrenome&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;sobrenome&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;verificar&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;salvar&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Enviar&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">form</span>&gt;</span></pre></div></div>

<p>- css</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">.erro<span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span><span style="color: #933;">2px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#bf1e2c</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>​</pre></div></div>

<p>- jquery</p>

<div class="wp_syntax"><div class="code"><pre class="jquery" style="font-family:monospace;"><span style="color: #000066;">$</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#salvar&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
e.<span style="color: #660066;">preventDefault</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> nm_class <span style="color: #339933;">=</span> <span style="color: #3366CC;">'verificar'</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> <span style="color: #000066;">error</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
inputs <span style="color: #339933;">=</span> <span style="color: #000066;">$</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;form&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'INPUT[class*=&quot;'</span> <span style="color: #339933;">+</span> nm_class <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&quot;]'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000066;">$</span>.<span style="color: #000066;">each</span><span style="color: #009900;">&#40;</span>inputs<span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">,</span> value<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>inputs<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
       <span style="color: #000066;">$</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">addClass</span><span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">&quot;erro&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
           <span style="color: #000066;">error</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>         
     <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000066;">error</span><span style="color: #009900;">&#41;</span>
    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">else</span><span style="color: #009900;">&#123;</span>    
   <span style="color: #006600; font-style: italic;">//$.ajax</span>
   <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;funcionou&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>    
<span style="color: #009900;">&#125;</span>    
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000066;">$</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'input[type=&quot;text&quot;]'</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">focus</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #006600; font-style: italic;">// Verifica se tem a classe erro e não continua se não houver</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066;">$</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">hasClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'erro'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066;">$</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">removeClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'erro'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// Verifica se o input tem valor e se houver remove a class erro</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066;">$</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066;">$</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">removeClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'erro'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>   
&nbsp;
<span style="color: #000066;">$</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'input[type=&quot;text&quot;]'</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">blur</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #006600; font-style: italic;">// Verifica se o input tem valor e se houver remove a class erro</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000066;">$</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066;">$</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'erro'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>Veja o funcionamento, clicando aqui: <a href="http://jsfiddle.net/X5K7c/8/" title="Validação de inputs" target="_blank">http://jsfiddle.net/X5K7c/8/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linhadecomando.com/jquery/jquery-validacao-de-inputs/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JQuery: Aplicar efeito de opacidade em uma imagem</title>
		<link>http://www.linhadecomando.com/jquery/jquery-aplicar-efeito-de-opacidade-em-uma-imagem</link>
		<comments>http://www.linhadecomando.com/jquery/jquery-aplicar-efeito-de-opacidade-em-uma-imagem#comments</comments>
		<pubDate>Tue, 17 Apr 2012 17:52:54 +0000</pubDate>
		<dc:creator>Tiago</dc:creator>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[animate]]></category>
		<category><![CDATA[fadeTo]]></category>
		<category><![CDATA[mouseout]]></category>
		<category><![CDATA[mouseover]]></category>
		<category><![CDATA[prev()]]></category>

		<guid isPermaLink="false">http://www.linhadecomando.com/?p=2444</guid>
		<description><![CDATA[Idéia: Ao passar o mouse sobre o link, uma imagem será exibida alterando a sua opacidade Jquery fadeTo &#60;html&#62; &#60;head&#62; &#60;style type=&#34;text/css&#34;&#62; img { opacity: 0; display:block;} &#60;/style&#62; &#60;script type=&#34;text/javascript&#34; src=&#34;https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js&#34;&#62;&#60;/script&#62; &#60;script type=&#34;text/javascript&#34;&#62; $&#40;document&#41;.ready&#40;function&#40;&#41; &#123; $&#40;&#34;a.efeito&#34;&#41;.mouseover&#40;function&#40;&#41;&#123; $&#40;this&#41;.prev&#40;&#41;.fadeTo&#40;&#34;slow&#34;, 4&#41;; &#125;&#41;.mouseout&#40;function&#40;&#41;&#123; $&#40;this&#41;.prev&#40;&#41;.fadeTo&#40;&#34;slow&#34;, 0&#41;; &#125;&#41;; &#160; // outra forma $&#40;&#34;a.efeito&#34;&#41;.hover&#40;function&#40;&#41; &#123; $&#40;this&#41;.prev&#40;&#41;.animate&#40;&#123;&#34;opacity&#34;: &#34;1&#34;&#125;, &#34;slow&#34;&#41;; &#125;,function&#40;&#41; &#123; $&#40;this&#41;.prev&#40;&#41;.animate&#40;&#123;&#34;opacity&#34;: &#34;0&#34;&#125;, [...]]]></description>
			<content:encoded><![CDATA[<p>Idéia: Ao passar o mouse sobre o link, uma imagem será exibida alterando a sua opacidade</p>
<p><a href="http://api.jquery.com/fadeTo/" target="_blank">Jquery fadeTo</a></p>

<div class="wp_syntax"><div class="code"><pre class="jquery" style="font-family:monospace;">&lt;html&gt;
&lt;head&gt;
&lt;style type=&quot;text/css&quot;&gt;
  img { opacity: 0; display:block;}
&lt;/style&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js&quot;&gt;&lt;/script&gt;
<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #000066;">$</span><span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #000066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066;">$</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;a.efeito&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">mouseover</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000066;">$</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">prev</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">fadeTo</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;slow&quot;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">4</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">mouseout</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000066;">$</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">prev</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">fadeTo</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;slow&quot;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #006600; font-style: italic;">// outra forma</span>
  <span style="color: #000066;">$</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;a.efeito&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">hover</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066;">$</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">prev</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">animate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><span style="color: #3366CC;">&quot;opacity&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;1&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;slow&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066;">$</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">prev</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">animate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><span style="color: #3366CC;">&quot;opacity&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;0&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;slow&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span>	
&lt;/head&gt;
&lt;body&gt;
&lt;div&gt;
    &lt;img class=&quot;&quot; src=&quot;http://www.linhadecomando.com/wp-content/uploads/logo-linhadecomando.png&quot; /&gt;
    &lt;a href=&quot;#&quot; class=&quot;efeito&quot;&gt;aplicar efeito&lt;/a&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.linhadecomando.com/jquery/jquery-aplicar-efeito-de-opacidade-em-uma-imagem/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux: Apagando todos arquivos e subdiretórios</title>
		<link>http://www.linhadecomando.com/so-linux/linux-apagando-todos-arquivos-e-subdiretorios</link>
		<comments>http://www.linhadecomando.com/so-linux/linux-apagando-todos-arquivos-e-subdiretorios#comments</comments>
		<pubDate>Mon, 02 Apr 2012 18:43:00 +0000</pubDate>
		<dc:creator>Tiago</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.linhadecomando.com/?p=2440</guid>
		<description><![CDATA[Comando bem simples para remoção de arquivos e subdiretórios. Comando RM. # cd home /home # rm -rf * -f, &#8211;force ignore nonexistent files, never prompt -r, -R, &#8211;recursive remove the contents of directories recursively]]></description>
			<content:encoded><![CDATA[<p>Comando bem simples para remoção de arquivos e subdiretórios.</p>
<p>Comando <a href="http://linux.about.com/od/commands/l/blcmdl1_rm.htm" target="_blank">RM</a>.</p>
<p># cd home<br />
/home # <strong>rm -rf *</strong></p>
<p>-f, &#8211;force<br />
ignore nonexistent files, never prompt</p>
<p>-r, -R, &#8211;recursive<br />
remove the contents of directories recursively</p>
]]></content:encoded>
			<wfw:commentRss>http://www.linhadecomando.com/so-linux/linux-apagando-todos-arquivos-e-subdiretorios/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Sprites: Menu</title>
		<link>http://www.linhadecomando.com/css/css-sprites-criando-menu</link>
		<comments>http://www.linhadecomando.com/css/css-sprites-criando-menu#comments</comments>
		<pubDate>Fri, 30 Mar 2012 17:29:12 +0000</pubDate>
		<dc:creator>Tiago</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[background-position]]></category>
		<category><![CDATA[css sprites]]></category>

		<guid isPermaLink="false">http://www.linhadecomando.com/?p=2423</guid>
		<description><![CDATA[CSS Sprites: é uma técnica muito utilizada na diminuição de requisições ao servidor. Esta técnica é muito utilizada em menus, aonde uma única imagem agrupa as demais, possibilitando a troca de imagens no evento de passar o mouse sobre, sem ter que recarregar uma nova imagem. Todo o processo de identificação das partes acontece através [...]]]></description>
			<content:encoded><![CDATA[<p>CSS Sprites: é uma técnica muito utilizada na diminuição de requisições ao servidor.</p>
<p>Esta técnica é muito utilizada em menus, aonde uma única imagem agrupa as demais, possibilitando a troca de imagens no evento de passar o mouse sobre, sem ter que recarregar uma nova imagem.</p>
<p>Todo o processo de identificação das partes acontece através da propriedade <a href="http://www.w3.org/TR/CSS21/colors.html#propdef-background-position" title="background-position CSS" target="_blank">background-position</a> do CSS, bastando definir as posições x e y, respectivamente, horizontal e vertical.</p>
<p>A imagem abaixo mostra exatamente o que se trata o CSS Sprites.</p>
<p><img src="http://www.linhadecomando.com/wp-content/uploads/css-sprites.png" alt="CSS Sprites" /></p>
<p>Você deve criar a imagem em um programa que permita delimitar e identificar as posições em pixel.<br />
Imagem criada no Adobe Fireworks.</p>
<p><img src="http://www.linhadecomando.com/wp-content/uploads/css-sprites-fireworks.png" alt="CSS Sprites" /></p>
<p>Dimensões da imagem: <strong>580 x 290px</strong>.</p>
<p>O primeiro passo é esconder as imagens que aparecerão somente quando o cursor estiver sobre o item do menu. Para isso, devemos definir a altura da imagem, que no nosso caso, será a metade da largura total.<br />
Sendo assim, o valor de height será 145px.</p>
<p><strong>Dica</strong>:<br />
posição x: <em>valor positivo</em>: desloca a imagem a direita / <em>valor negativo</em>: a esquerda<br />
posição y: <em>valor positivo</em>: desloca a imagem para baixo / <em>valor negativo</em>: para cima.</p>
<p>Vamos aos códigos:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu&quot;</span>&gt;</span>
   <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;home&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>INÍCIO<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;sobre&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>SOBRE<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;fotos&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>FOTOS<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;contato&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>CONTATO<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
   <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">ul<span style="color: #6666ff;">.menu</span> <span style="color: #00AA00;">&#123;</span> 
<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">580px</span><span style="color: #00AA00;">;</span> // largura total da imagem
<span style="color: #00AA00;">&#125;</span>
ul<span style="color: #6666ff;">.menu</span> li <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">inline</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
&nbsp;
ul<span style="color: #6666ff;">.menu</span> li a <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">145px</span><span style="color: #00AA00;">;</span> // metade da largura total
  <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#FFF</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">:</span><span style="color: #933;">145px</span><span style="color: #00AA00;">;</span> // altura da linha - centraliza o texto na vertical
  <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span><span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span><span style="color: #993333;">bold</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span><span style="color: #993333;">center</span><span style="color: #00AA00;">;</span> // centraliza o texto na horizontal
  <span style="color: #000000; font-weight: bold;">background-image</span><span style="color: #00AA00;">:</span><span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">../images/bgMenu.png</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> // imagem de fundo
<span style="color: #00AA00;">&#125;</span>
// primeiro botão
ul<span style="color: #6666ff;">.menu</span> li a<span style="color: #6666ff;">.home</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">145px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">background-position</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
ul<span style="color: #6666ff;">.menu</span> li a<span style="color: #6666ff;">.home</span><span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">145px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">background-position</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">-145px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
// segundo botão
ul<span style="color: #6666ff;">.menu</span> li a<span style="color: #6666ff;">.sobre</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">145px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">background-position</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-145px</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
ul<span style="color: #6666ff;">.menu</span> li a<span style="color: #6666ff;">.sobre</span><span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">145px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">background-position</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-145px</span> <span style="color: #933;">-145px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
// terceiro botão	
ul<span style="color: #6666ff;">.menu</span> li a<span style="color: #6666ff;">.fotos</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">145px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">background-position</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-290px</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
ul<span style="color: #6666ff;">.menu</span> li a<span style="color: #6666ff;">.fotos</span><span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">145px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">background-position</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-290px</span> <span style="color: #933;">-145px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
// quarto botão	
ul<span style="color: #6666ff;">.menu</span> li a<span style="color: #6666ff;">.contato</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">145px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">background-position</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-435px</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
ul<span style="color: #6666ff;">.menu</span> li a<span style="color: #6666ff;">.contato</span><span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">145px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">background-position</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-435px</span> <span style="color: #933;">-145px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Como entender esta técnica:</p>
<p>Para pegar o primeiro botão: deve-se definir tamanho do botão (145px) e as posições de x e y (0px/0px).<br />
ex: {width: 145px; background-position: 0 0;}</p>
<p>Confira a imagem abaixo:<br />
<img src="http://www.linhadecomando.com/wp-content/uploads/css-sprites-1btn.png" alt="CSS Sprites" /></p>
<p>Esta imagem mostra como obter as demais posições dos botões.<br />
<img src="http://www.linhadecomando.com/wp-content/uploads/css-sprites-botoes.png" alt="CSS Sprites" /></p>
<p>{width: 145px; background-position: -145px 0;}<br />
{width: 145px; background-position: -290px 0;}<br />
{width: 145px; background-position: -435px 0;}</p>
<p>Posicionamento das imagens quando o cursor está sobre o botão<br />
<img src="http://www.linhadecomando.com/wp-content/uploads/css-sprites-botoes-hover.png" alt="CSS Sprites" /></p>
<p>{width: 145px; background-position: 0 -145px;}<br />
{width: 145px; background-position: -145px -145px;}<br />
{width: 145px; background-position: -290px -145px;}<br />
{width: 145px; background-position: -435px -145px;}</p>
<p>Até +</p>
]]></content:encoded>
			<wfw:commentRss>http://www.linhadecomando.com/css/css-sprites-criando-menu/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP: Obtendo a url completa do site acessado</title>
		<link>http://www.linhadecomando.com/php/php-obtendo-a-url-completa-do-site-acessado</link>
		<comments>http://www.linhadecomando.com/php/php-obtendo-a-url-completa-do-site-acessado#comments</comments>
		<pubDate>Fri, 30 Mar 2012 13:55:21 +0000</pubDate>
		<dc:creator>Tiago</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[HTTP_HOST]]></category>
		<category><![CDATA[REQUEST_URI]]></category>

		<guid isPermaLink="false">http://www.linhadecomando.com/?p=2420</guid>
		<description><![CDATA[&#60;? $url_cpl = 'http://' . $_SERVER&#91;'HTTP_HOST'&#93; . $_SERVER&#91;'REQUEST_URI'&#93;; ?&#62;]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>
  <span style="color: #000088;">$url_cpl</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'http://'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_HOST'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REQUEST_URI'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.linhadecomando.com/php/php-obtendo-a-url-completa-do-site-acessado/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>WordPress-Dicas: Alterando formatação de data nos comentários</title>
		<link>http://www.linhadecomando.com/wordpress-dicas/wordpress-dicas-alterando-formatacao-de-data-nos-comentarios</link>
		<comments>http://www.linhadecomando.com/wordpress-dicas/wordpress-dicas-alterando-formatacao-de-data-nos-comentarios#comments</comments>
		<pubDate>Wed, 21 Mar 2012 17:33:51 +0000</pubDate>
		<dc:creator>Tiago</dc:creator>
				<category><![CDATA[Wordpress - Dicas]]></category>
		<category><![CDATA[Arras Theme]]></category>
		<category><![CDATA[get_comment_time]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.linhadecomando.com/?p=2407</guid>
		<description><![CDATA[Me deparei com a necessidade de alterar a formatação da data nos comentários desse blog e após várias buscas, consegui a solução. Este blog usa o tema Arras Theme. Passo-a-passo: - localize o arquivo template.php em wp-content/themes/arras-theme/library/ Com o arquivo aberto, localize as linhas: &#60;div class=&#34;comment-meta commentmetadata&#34;&#62; &#60;?php printf&#40; __&#40;'Posted %1$s at %2$s', 'arras'&#41;, '&#60;abbr [...]]]></description>
			<content:encoded><![CDATA[<p>Me deparei com a necessidade de alterar a formatação da data nos comentários desse blog e após várias buscas, consegui a solução.</p>
<p>Este blog usa o tema <a href="http://www.arrastheme.com/" title="Tema para wordpress" target="_blank">Arras Theme</a>.</p>
<p><strong>Passo-a-passo</strong>:<br />
- localize o arquivo <strong>template.php</strong> em <strong>wp-content/themes/arras-theme/library/</strong></p>
<p>Com o arquivo aberto, localize as linhas:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;div class=&quot;comment-meta commentmetadata&quot;&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Posted %1$s at %2$s'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'arras'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;abbr class=&quot;comment-datetime&quot; title=&quot;'</span> <span style="color: #339933;">.</span> get_comment_time<span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'c'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'arras'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot;&gt;'</span> <span style="color: #339933;">.</span> get_comment_time<span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'F j, Y'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'arras'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> get_comment_time<span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'g:i A'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'arras'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/abbr&gt;'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/div&gt;</pre></div></div>

<p>Resultado:<br />
Posted março 21, 2012 at 10:05 AM</p>
<p>Linhas alteradas:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;div class=&quot;comment-meta commentmetadata&quot;&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'EM: %1$s as %2$s'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'arras'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;abbr class=&quot;comment-datetime&quot; title=&quot;'</span> <span style="color: #339933;">.</span> get_comment_time<span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'c'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'arras'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot;&gt;'</span> <span style="color: #339933;">.</span> get_comment_time<span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'j \d\e F \d\e Y'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'arras'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> get_comment_time<span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'g:i'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'arras'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/abbr&gt;'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/div&gt;</pre></div></div>

<p>Resultado:<br />
EM: 21 de março de 2012 as 10:05</p>
]]></content:encoded>
			<wfw:commentRss>http://www.linhadecomando.com/wordpress-dicas/wordpress-dicas-alterando-formatacao-de-data-nos-comentarios/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP: Calculando datas para um intervalo específico</title>
		<link>http://www.linhadecomando.com/php/php-calculando-datas-para-um-intervalo-especifico</link>
		<comments>http://www.linhadecomando.com/php/php-calculando-datas-para-um-intervalo-especifico#comments</comments>
		<pubDate>Thu, 09 Feb 2012 17:34:23 +0000</pubDate>
		<dc:creator>Tiago</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.linhadecomando.com/?p=2397</guid>
		<description><![CDATA[Olá pessoa, beleza! Imagine você, que seu sistema de anúncio vai possuir um campo de seleção que vai controlar quando tal anúncio vai expirar. html &#60;select name=&#34;data_termino&#34;&#62; &#60;option value='' selected='selected'&#62;selecione um plano&#60;/option&#62; &#60;option value='3'&#62;3 meses&#60;/option&#62; &#60;option value='6'&#62;6 meses&#60;/option&#62; &#60;/select&#62; Vamos utilizar a função strtotime(). &#60;? // data no formato americano $data_publicacao = &#34;2012-02-09&#34;; $meses = [...]]]></description>
			<content:encoded><![CDATA[<p>Olá pessoa, beleza!</p>
<p>Imagine você, que seu sistema de anúncio vai possuir um campo de seleção que vai controlar quando tal anúncio vai expirar. </p>
<p>html</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">select</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;data_termino&quot;</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">option</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">''</span> <span style="color: #000066;">selected</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'selected'</span>&gt;</span>selecione um plano<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">option</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">option</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'3'</span>&gt;</span>3 meses<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">option</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">option</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'6'</span>&gt;</span>6 meses<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">option</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">select</span>&gt;</span></pre></div></div>

<p>Vamos utilizar a função <a href="http://www.w3schools.com/php/func_date_strtotime.asp" title="strtotime" target="_blank">strtotime()</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>
<span style="color: #666666; font-style: italic;">// data no formato americano</span>
<span style="color: #000088;">$data_publicacao</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;2012-02-09&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$meses</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$format_meses</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;+&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$meses</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; month&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// +3 meses</span>
&nbsp;
<span style="color: #000088;">$data_termino</span> <span style="color: #339933;">=</span> <span style="color: #990000;">strtotime</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data_publicacao</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$format_meses</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;d/m/Y&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$data_termino</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p><strong>Resultado</strong>: 09/05/2012</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//adiciona um dia</span>
<span style="color: #b1b100;">echo</span> <span style="color: #990000;">strtotime</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;+1 day&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//adiciona uma semana</span>
<span style="color: #b1b100;">echo</span> <span style="color: #990000;">strtotime</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;+1 week&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//adiciona um mês</span>
<span style="color: #b1b100;">echo</span> <span style="color: #990000;">strtotime</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;+1 month&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//adiciona um ano</span>
<span style="color: #b1b100;">echo</span> <span style="color: #990000;">strtotime</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;+1 year&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.linhadecomando.com/php/php-calculando-datas-para-um-intervalo-especifico/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

