<?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>coding &#187; blog</title>
	<atom:link href="http://www.coding.com.br/category/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.coding.com.br</link>
	<description>have you coded today?</description>
	<lastBuildDate>Fri, 23 Jul 2010 02:37:02 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Shortening URL</title>
		<link>http://www.coding.com.br/blog/shortening-url/</link>
		<comments>http://www.coding.com.br/blog/shortening-url/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 16:44:40 +0000</pubDate>
		<dc:creator>Tiago Maluta</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[python web]]></category>

		<guid isPermaLink="false">http://www.coding.com.br/?p=1177</guid>
		<description><![CDATA[There are many URL shortening services. I just picked one (u.nu) to use from command line interface and chose something really quick and simple. Here&#8217;s the code:
# -*- coding: utf-8 -*-
from urllib import urlencode
import httplib
import sys

api_url="u.nu"
var = urlencode({'url':sys.argv[1]})
args = "/unu-api-simple?%s" % (var)
conn = httplib.HTTPConnection(api_url)
conn.request("GET",args)
ret = conn.getresponse()
print ret.read()
Download the script here.
Just run passing the URL, for example:
$ [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">There are <a title="List of URL shortening services" href="http://mashable.com/2008/01/08/url-shortening-services/" target="_blank">many</a> URL shortening services. I just picked one (<a href="http://u.nu" target="_blank">u.nu</a>) to use from <em>command line interface </em>and chose something really quick and simple. Here&#8217;s the code:</p>
<pre><span style="color: #444444;"># -*- coding: utf-8 -*-</span>
<strong>from</strong> <span style="color: #2040a0;">urllib</span> <strong>import</strong> <span style="color: #2040a0;">urlencode</span>
<strong>import</strong> <span style="color: #2040a0;">httplib</span>
<strong>import</strong> <span style="color: #2040a0;">sys</span>

<span style="color: #2040a0;">api_url</span><span style="color: #4444ff;">=</span><span style="color: #008000;">"u.nu"</span>
<span style="color: #2040a0;">var</span> <span style="color: #4444ff;">=</span> <span style="color: #2040a0;">urlencode</span><span style="color: #4444ff;">(</span><span style="color: #4444ff;"><strong>{</strong></span><span style="color: #008000;">'url'</span><span style="color: #4444ff;">:</span><span style="color: #2040a0;">sys</span>.<span style="color: #2040a0;">argv</span><span style="color: #4444ff;">[</span><span style="color: #ff0000;">1</span><span style="color: #4444ff;">]</span><span style="color: #4444ff;"><strong>}</strong></span><span style="color: #4444ff;">)</span>
<span style="color: #2040a0;">args</span> <span style="color: #4444ff;">=</span> <span style="color: #008000;">"/unu-api-simple?%s"</span> <span style="color: #4444ff;">%</span> <span style="color: #4444ff;">(</span><span style="color: #2040a0;">var</span><span style="color: #4444ff;">)</span>
<span style="color: #2040a0;">conn</span> <span style="color: #4444ff;">=</span> <span style="color: #2040a0;">httplib</span>.<span style="color: #2040a0;">HTTPConnection</span><span style="color: #4444ff;">(</span><span style="color: #2040a0;">api_url</span><span style="color: #4444ff;">)</span>
<span style="color: #2040a0;">conn</span>.<span style="color: #2040a0;">request</span><span style="color: #4444ff;">(</span><span style="color: #008000;">"GET"</span>,<span style="color: #2040a0;">args</span><span style="color: #4444ff;">)</span>
<span style="color: #2040a0;">ret</span> <span style="color: #4444ff;">=</span> <span style="color: #2040a0;">conn</span>.<span style="color: #2040a0;">getresponse</span><span style="color: #4444ff;">(</span><span style="color: #4444ff;">)</span>
<strong>print</strong> <span style="color: #2040a0;">ret</span>.<span style="color: #2040a0;">read</span><span style="color: #4444ff;">(</span><span style="color: #4444ff;">)</span></pre>
<h5 style="text-align: center;">Download the script <a href="http://gist.github.com/486190" target="_blank">here</a>.</h5>
<p>Just run passing the URL, for example:</p>
<p style="padding-left: 30px;">$ python u.py www.coding.com.br</p>
<p style="padding-left: 30px;">http://u.nu/72mpd</p>
<p style="text-align: justify;">Easy your life by putting the script on your $PATH and execution (+x) file mode. Worth check the API from other services:</p>
<ul>
<li><a title="Documentation of bit.ly API" href="http://code.google.com/p/bitly-api/wiki/ApiDocumentation" target="_blank">bit.ly</a></li>
<li><a title="Documentation of migre.me API" href="http://migre.me/api-migreme/" target="_blank">migre.me</a> (brazilian company)</li>
<li><a title="Documentation of is.gd API" href="http://is.gd/api_info.php" target="_blank">is.gd</a></li>
<li><a href="http://tiny.cc/api-docs" target="_blank">tiny.cc</a></li>
<li><a href="http://www.scripting.com/stories/2007/06/27/tinyurlHasAnApi.html" target="_blank">tinyurl</a></li>
</ul>
<p style="padding-left: 30px;">
]]></content:encoded>
			<wfw:commentRss>http://www.coding.com.br/blog/shortening-url/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A brief on &#8220;designated initializers&#8221;</title>
		<link>http://www.coding.com.br/blog/a-brief-on-designated-initializers/</link>
		<comments>http://www.coding.com.br/blog/a-brief-on-designated-initializers/#comments</comments>
		<pubDate>Tue, 13 Jul 2010 06:01:27 +0000</pubDate>
		<dc:creator>Tiago Maluta</dc:creator>
				<category><![CDATA[blog]]></category>

		<guid isPermaLink="false">http://www.coding.com.br/?p=1155</guid>
		<description><![CDATA[The GNU Compiler Collection (GCC) for C language doesn&#8217;t initialize variables zeroed. For simple variables types like int or float is just equal to 0 or 0.0 respectively. Now, suppose that you have a &#8220;large&#8221; struct and doesn&#8217;t want to set each member  individually&#8230; you could just type &#8220;={0}&#8221; which means that the first member [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">The GNU Compiler Collection (GCC) for C language doesn&#8217;t initialize variables <em>zeroed.</em> For simple variables types like <em>int</em> or <em>float</em> is just equal to 0 or 0.0 respectively. Now, suppose that you have a &#8220;large&#8221; <em>struct</em> and doesn&#8217;t want to set each member  individually&#8230; you could just type &#8220;={0}&#8221; which means that the first member is explicitly initialized to zero and  the remaining members are implicitly initialized, also zero. Let&#8217;s see an example:</p>
<p><strong>typedef</strong> <strong>struct</strong><br />
<span style="color: #4444ff;"><strong>{</strong></span><br />
<strong> int</strong> <span style="color: #2040a0;">a</span><span style="color: #4444ff;">;</span><br />
<strong> char</strong> <span style="color: #2040a0;">c</span><span style="color: #4444ff;">;</span><br />
<strong> char</strong> <span style="color: #2040a0;">s</span><span style="color: #4444ff;">[</span><span style="color: #ff0000;">10</span><span style="color: #4444ff;">]</span><span style="color: #4444ff;">;</span><br />
<strong> int</strong> <span style="color: #4444ff;">*</span><span style="color: #2040a0;">ptr</span><span style="color: #4444ff;">;</span><br />
<span style="color: #4444ff;"><strong>}</strong></span> <span style="color: #2040a0;">data</span><span style="color: #4444ff;">;</span></p>
<p>When you initialize with:</p>
<p><span style="color: #2040a0;">data</span> <span style="color: #2040a0;">d</span><span style="color: #4444ff;"><strong></strong></span><span style="color: #4444ff;"><strong></strong></span><span style="color: #4444ff;">;</span></p>
<p>You got some random value like:</p>
<p>{a = -1208298748, c = -12 &#8216;\364&#8242;, s = &#8220;\317\372\267\230\353\377\277\351\203\004&#8243;, ptr = 0xb7e94cc5}</p>
<p>When you type:</p>
<p><span style="color: #2040a0;">data</span> <span style="color: #2040a0;">d</span> <span style="color: #4444ff;">=</span> <span style="color: #4444ff;"><strong>{</strong></span><span style="color: #ff0000;">0</span><span style="color: #4444ff;"><strong>}</strong></span><span style="color: #4444ff;">;</span></p>
<p>You&#8217;ll have each struct member initialized to <em>zero</em>.</p>
<p>{a = 0, c = 0 &#8216;\000&#8242;, s = &#8220;\000\000\000\000\000\000\000\000\000&#8243;, ptr = 0&#215;0}</p>
<p>You can learn much more about <a href="http://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html" target="_blank">designated inits</a> [section 6.26] on GCC docs.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.coding.com.br/blog/a-brief-on-designated-initializers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nginx rewrite for Wikka Wiki</title>
		<link>http://www.coding.com.br/blog/nginx-rewrite-for-wikka-wiki/</link>
		<comments>http://www.coding.com.br/blog/nginx-rewrite-for-wikka-wiki/#comments</comments>
		<pubDate>Mon, 21 Jun 2010 17:24:37 +0000</pubDate>
		<dc:creator>Celso Fernandes</dc:creator>
				<category><![CDATA[blog]]></category>

		<guid isPermaLink="false">http://www.coding.com.br/?p=1104</guid>
		<description><![CDATA[I&#8217;m posting it here, because I started a few weeks ago working with Nginx (if you don&#8217;t know that, you really should), a very powerful and fast webserver (lets leave it for another post), but I faced a problem with redirects for Wikka Wiki, I&#8217;m not a beginner on regular expressions or mod_rewrite, but sometimes [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m posting it here, because I started a few weeks ago working with <a title="Nginx" href="http://nginx.org/" target="_blank">Nginx</a> (if you don&#8217;t know that, you really should), a very powerful and <strong>fast</strong> webserver (lets leave it for another post), but I faced a problem with redirects for Wikka Wiki, I&#8217;m not a beginner on regular expressions or mod_rewrite, but sometimes we get in trouble working on something new.</p>
<p>I haven&#8217;t found the solution for my problem (for wordpress, drupal and joomla there are so many) so I resolved it and now I&#8217;m posting if somebody can&#8217;t do it or just wanna some copy/paste <img src='http://www.coding.com.br/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"> location ~ <span style="color: #339933;">^/</span>wiki <span style="color: #009900;">&#123;</span>
 	root <span style="color: #339933;">/</span>path<span style="color: #339933;">/</span>to<span style="color: #339933;">/</span>wiki<span style="color: #339933;">;</span>
 	index wikka.<span style="color: #202020;">php</span><span style="color: #339933;">;</span>
&nbsp;
 	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!-</span>e $request_filename<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
 		rewrite <span style="color: #339933;">^/</span>wiki<span style="color: #339933;">/</span>images<span style="color: #339933;">/</span><span style="color: #009900;">&#40;</span>.<span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span>$ <span style="color: #339933;">/</span>images<span style="color: #339933;">/</span>$<span style="color: #0000dd;">1</span> <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
		rewrite <span style="color: #339933;">^/</span>wiki<span style="color: #339933;">/</span>templates<span style="color: #339933;">/</span><span style="color: #009900;">&#40;</span>.<span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span>$ <span style="color: #339933;">/</span>templates<span style="color: #339933;">/</span>$<span style="color: #0000dd;">1</span> <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
 		rewrite <span style="color: #339933;">^/</span>wiki<span style="color: #339933;">/</span>3rdparty<span style="color: #339933;">/</span>plugins<span style="color: #339933;">/</span>freemind<span style="color: #339933;">/</span><span style="color: #009900;">&#40;</span>.<span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span>$ <span style="color: #339933;">/</span>3rdparty<span style="color: #339933;">/</span>plugins<span style="color: #339933;">/</span>freemind<span style="color: #339933;">/</span>$<span style="color: #0000dd;">1</span> <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
 		rewrite <span style="color: #339933;">^/</span>wiki<span style="color: #339933;">/</span>3rdparty<span style="color: #339933;">/</span>plugins<span style="color: #339933;">/</span>wikkaedit<span style="color: #339933;">/</span><span style="color: #009900;">&#40;</span>.<span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span>$ <span style="color: #339933;">/</span>3rdparty<span style="color: #339933;">/</span>plugins<span style="color: #339933;">/</span>wikkaedit<span style="color: #339933;">/</span>$<span style="color: #0000dd;">1</span> <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
 		rewrite <span style="color: #339933;">^/</span>wiki<span style="color: #339933;">/</span><span style="color: #009900;">&#40;</span>.<span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span>$ <span style="color: #339933;">/</span>wiki<span style="color: #339933;">/</span>wikka.<span style="color: #202020;">php</span><span style="color: #339933;">?</span>wakka<span style="color: #339933;">=</span>$<span style="color: #0000dd;">1</span> <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
 		<span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
 	<span style="color: #009900;">&#125;</span>
 <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>A brief explanation:</p>
<p>on line 1 we setup where our wiki is located, on our case /wiki, so in line 2 we give full path to where the wiki&#8217;s file are located on the filesystem and line 3 we says our index will be wikka.php once Wikka Wiki just redirect index.php to wikka.php (ok I don&#8217;t mind why they don&#8217;t put the contents of wikka.php on index.php and its over <img src='http://www.coding.com.br/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  ).</p>
<p>line 5-12 we configure the rewrite rules, on line 5 is the condition what to do when there is no file or symbolic link when a URL is acessed, if its matched the following rules are processed:<br />
line 6-10: rules to ensure that static content like css, js and images won&#8217;t be redirected to wikka.php.<br />
line 11: the main rule, that will redirect all URLs to wikka.php so it process and show the output for each wiki page.</p>
<p>I don&#8217;t why (I&#8217;m new to Nginx) even using the condition <strong>if(!-e $request_filename)</strong> I need to put the rules to ensure that static content will be reached, if I discover, I update this post, but these rules are working for me under Nginx 0.7.67 and Wikka 1.2-p1 </p>
]]></content:encoded>
			<wfw:commentRss>http://www.coding.com.br/blog/nginx-rewrite-for-wikka-wiki/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>latex + abntex</title>
		<link>http://www.coding.com.br/blog/latex-abntex/</link>
		<comments>http://www.coding.com.br/blog/latex-abntex/#comments</comments>
		<pubDate>Thu, 29 Apr 2010 11:40:26 +0000</pubDate>
		<dc:creator>Tiago Maluta</dc:creator>
				<category><![CDATA[blog]]></category>

		<guid isPermaLink="false">http://www.coding.com.br/?p=970</guid>
		<description><![CDATA[Estou fazendo uma série de experimentos com um conceito novo para apresentações, já refiz uma palestra apresentada no Calourada Livre e agora um teste em forma de tutorial. Penso que boa parte do sucesso deste tipo de abordagem é a busca contemporânea por informação rápida. Note, tudo que fiz está disponível na documentação. Entretanto, a [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Estou fazendo uma série de experimentos com um conceito novo para apresentações, já <a href="http://twitter.com/maluta/status/12789908440" target="_blank">refiz</a> uma palestra apresentada no Calourada Livre e agora um teste em forma de <em>tutorial</em>. Penso que boa parte do sucesso deste tipo de abordagem é a busca contemporânea por informação rápida. Note, tudo que fiz está disponível na documentação. Entretanto, a estética como é apresentado facilita a compreensão. Esta apresentação mostra uma maneira independente de instalar o pacote abntex utilizado para contruir documentos em conformidade com o padrão definido pela ABNT.</p>
<p style="text-align: center;"><a href="http://prezi.com/aum-fzbgnkyl/latex-abntex/" target="_blank">http://prezi.com/aum-fzbgnkyl/latex-abntex/</a></p>
<p style="text-align: center;">
<p style="text-align: center;">
]]></content:encoded>
			<wfw:commentRss>http://www.coding.com.br/blog/latex-abntex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Salvando o ensino de engenharia</title>
		<link>http://www.coding.com.br/blog/salvando-o-ensino-de-engenharia/</link>
		<comments>http://www.coding.com.br/blog/salvando-o-ensino-de-engenharia/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 18:10:05 +0000</pubDate>
		<dc:creator>Tiago Maluta</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[unifei]]></category>

		<guid isPermaLink="false">http://www.coding.com.br/?p=64</guid>
		<description><![CDATA[
Fiz a tradução do artigo Climbing the Pyramid &#8211; Saving Engineering Education publicado no FPGA and Structured ASIC Journal. Que faz uma breve análise da engenharia destes &#8220;novos tempos&#8221;.
download (pdf)
]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;"><img class="aligncenter size-full wp-image-65" title="Engenharia" src="http://www.coding.com.br/wp-content/uploads/2009/07/engenharia.png" alt="Engenharia" width="475" height="336" /><a title="Salvando o ensino de engenharia" href="http://www.coding.com.br/wp-content/uploads/2009/07/salvando_o_ensino_de_engenharia.pdf" target="_blank"></a></p>
<p style="text-align: justify;">Fiz a tradução do artigo <em><a title="Climbing the Pyramid " href="http://www.fpgajournal.com/articles_2009/20090616_pyramid.htm" target="_blank">Climbing the Pyramid</a> &#8211; <span>Saving Engineering Education </span></em><span>publicado no <em>FPGA and Structured ASIC Journal. </em></span>Que faz uma breve análise da engenharia destes &#8220;novos tempos&#8221;.</p>
<p style="text-align: center;"><a title="Salvando o ensino de engenharia" href="http://www.coding.com.br/wp-content/uploads/2009/07/salvando_o_ensino_de_engenharia.pdf" target="_blank">download</a> (pdf)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.coding.com.br/blog/salvando-o-ensino-de-engenharia/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>começo..</title>
		<link>http://www.coding.com.br/blog/boas-vindas/</link>
		<comments>http://www.coding.com.br/blog/boas-vindas/#comments</comments>
		<pubDate>Thu, 14 May 2009 01:30:38 +0000</pubDate>
		<dc:creator>Celso Fernandes</dc:creator>
				<category><![CDATA[blog]]></category>

		<guid isPermaLink="false">http://www.coding.com.br/?p=1</guid>
		<description><![CDATA[A faculdade como sempre atrapalhando, mas agora com novas idéias e novos conceitos, e a esperança de dar certo..
]]></description>
			<content:encoded><![CDATA[<p>A faculdade como sempre atrapalhando, mas agora com novas idéias e novos conceitos, e a esperança de dar certo..</p>
]]></content:encoded>
			<wfw:commentRss>http://www.coding.com.br/blog/boas-vindas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
