<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>Advogato blog for henrique</title>
    <link>http://www.advogato.org/person/henrique/</link>
    <description>Advogato blog for henrique</description>
    <language>en-us</language>
    <generator>mod_virgule</generator>
    <pubDate>Fri, 10 Feb 2012 18:37:28 GMT</pubDate>
    <item>
      <pubDate>Wed, 25 Feb 2009 01:36:36 GMT</pubDate>
      <title>25 Feb 2009</title>
      <link>http://www.advogato.org/person/henrique/diary.html?start=16</link>
      <guid>http://www.advogato.org/person/henrique/diary.html?start=16</guid>
      <description>&lt;b&gt;Django's &lt;i&gt;loaddata&lt;/i&gt;&lt;/b&gt;&#xD;
&#xD;
&lt;p&gt; &lt;p&gt; &lt;p&gt; &lt;p&gt; So, I've to admit two things: 1) I was a bit accelerated when I &#xD;
needed to &#xD;
import my data using loaddata command, then it obviously was my fault; 2) &#xD;
In fact, I hate with a passion (tm) to use these commands when I change my &#xD;
DB schemas.&#xD;
&#xD;
&lt;p&gt; &lt;p&gt; &lt;p&gt; &lt;p&gt; Well, at least I learned something...&#xD;
&#xD;
&lt;p&gt; &lt;ul&gt;&#xD;
&lt;li&gt;Do not post anything on your blog if you are not with time or if &#xD;
you &#xD;
are &#xD;
having problems with something (that is the subject you are going to post &#xD;
about) that you don't have researched enough.&#xD;
&lt;li&gt;Definitely, using &lt;i&gt;dumpdata&lt;/i&gt; &amp;amp; &lt;i&gt;loaddata&lt;/i&gt; for &#xD;
manually rebuilding your database record is very passive of problems and will &#xD;
guide you through an unknown path, where everything will looks like "I don't &#xD;
know what is going on, but I have to leave this DETAIL apart".&#xD;
&lt;/ul&gt;&#xD;
&#xD;
&lt;p&gt; &lt;p&gt; &lt;p&gt; &lt;p&gt; or, hmm, I could be the man with the unchanged database &#xD;
schema &#xD;
during all &#xD;
the software lifetime... hmm, no, I don't think it will finish well.</description>
    </item>
    <item>
      <pubDate>Mon, 9 Feb 2009 01:30:26 GMT</pubDate>
      <title>9 Feb 2009</title>
      <link>http://www.advogato.org/person/henrique/diary.html?start=15</link>
      <guid>http://www.advogato.org/person/henrique/diary.html?start=15</guid>
      <description>&lt;b&gt;Django's dumpdata&lt;/b&gt;&#xD;
&#xD;
&lt;p&gt; &lt;p&gt; I feel like an idiot every time I need to use dumpdata on my django &#xD;
projects. &#xD;
First, it is very sad to have to run the following set of commands when I &#xD;
change some column definitions on my models:&#xD;
&#xD;
&lt;p&gt; &lt;pre&gt;&#xD;
$ python manage dumpdata &amp;gt; foo-dump.json&#xD;
$ python manage reset app&#xD;
$ python manage loaddata foo-dump&#xD;
&lt;/pre&gt;&#xD;
&#xD;
&lt;p&gt; &lt;p&gt; Second, it drive me nuts after I note that the loaddata command doesn't &#xD;
work &#xD;
like I was expecting, that is "restore my data in this new schema &#xD;
configuration". For some reason, the loaddata doesn't load my app's data, but &#xD;
only the data of "built-in" django applications (like auth and admin, for &#xD;
example). The result you can deduce: the impression is that I lost all my data &#xD;
(luckly, demonstration data) and I'm too bored to check if it is really the truth.&#xD;
&#xD;
&lt;p&gt; &lt;p&gt; Tomorrow I'll check it with more attention and, very likely, I'll be &#xD;
reporting a &#xD;
ticket at django's trac.</description>
    </item>
    <item>
      <pubDate>Tue, 27 Jan 2009 13:16:45 GMT</pubDate>
      <title>27 Jan 2009</title>
      <link>http://www.advogato.org/person/henrique/diary.html?start=14</link>
      <guid>http://www.advogato.org/person/henrique/diary.html?start=14</guid>
      <description>Definitely. I'm the right guy, at the wrong place, in the&#xD;
wrong time.</description>
    </item>
    <item>
      <pubDate>Sat, 10 Jan 2009 22:19:58 GMT</pubDate>
      <title>10 Jan 2009</title>
      <link>http://www.advogato.org/person/henrique/diary.html?start=13</link>
      <guid>http://www.advogato.org/person/henrique/diary.html?start=13</guid>
      <description>I'm moving to S&amp;atilde;o Paulo this monday. The good thing is that I found a house &#xD;
near the office that I started working and it will take only 30 minutes to arrive &#xD;
there, walking.&#xD;
&#xD;
&lt;p&gt; The work is going fine, there were some  initial problems, but finally there are &#xD;
nice people to work with and I got the tasks very easily.&#xD;
&#xD;
</description>
    </item>
    <item>
      <pubDate>Fri, 2 Jan 2009 01:48:00 GMT</pubDate>
      <title>2 Jan 2009</title>
      <link>http://www.advogato.org/person/henrique/diary.html?start=12</link>
      <guid>http://www.advogato.org/person/henrique/diary.html?start=12</guid>
      <description>&lt;b&gt;Happy new year.&lt;/b&gt;&#xD;
&#xD;
&lt;p&gt; Not a good beginning I'd say, but at least I leave SigX. I'm going to work at Sao &#xD;
Paulo, I can't wait to start working there.&#xD;
</description>
    </item>
    <item>
      <pubDate>Sun, 23 Nov 2008 14:50:56 GMT</pubDate>
      <title>23 Nov 2008</title>
      <link>http://www.advogato.org/person/henrique/diary.html?start=11</link>
      <guid>http://www.advogato.org/person/henrique/diary.html?start=11</guid>
      <description>&lt;b&gt;Lazy resource loading on pyglet (was: cocos2d importing too slow?)&lt;/b&gt;&#xD;
&#xD;
&lt;p&gt; As promissed in my last post, I opened the issue &lt;a href="http://code.google.com/p/pyglet/issues/detail?id=367" &gt;#367&lt;/a&gt; &#xD;
at google code to fix the problem reported.&#xD;
&#xD;
&lt;p&gt; My first patch wasn't accepted, but I though that it would take this way, since &#xD;
the patch was very punk (it would introduce undesired backward &#xD;
incompability). The second patch was better, but I was not happy with it... it &#xD;
just relied on environment variables, what is a crappy thing.&#xD;
&#xD;
&lt;p&gt; The final fix by Mr. Holkner implemented lazy loading support... IMHO his &#xD;
implementation was not good, but the idea is very cool. The guys there &#xD;
seemed not so friendly, so I leave this detail apart.&#xD;
&#xD;
&lt;p&gt; By the way, I'm happy to have helped with something in this project.&#xD;
&#xD;
</description>
    </item>
    <item>
      <pubDate>Thu, 20 Nov 2008 01:37:23 GMT</pubDate>
      <title>20 Nov 2008</title>
      <link>http://www.advogato.org/person/henrique/diary.html?start=10</link>
      <guid>http://www.advogato.org/person/henrique/diary.html?start=10</guid>
      <description>&lt;b&gt;cocos2d importing too slow?&lt;/b&gt;&#xD;
&#xD;
&lt;p&gt; &lt;p&gt; &lt;p&gt; &lt;p&gt; &lt;p&gt; &lt;p&gt; So, you find cocos2d and think "man, I need to try &#xD;
it &#xD;
out!". &#xD;
Cool, so &#xD;
you &#xD;
went &#xD;
to your editor, open an usual "foo.py" and start typing some example...&#xD;
&#xD;
&lt;p&gt; &lt;pre&gt;&#xD;
import cocos&#xD;
class HelloWorld(cocos.layer.Layer):&#xD;
    def __init__(self):&#xD;
...&#xD;
&lt;/pre&gt;&#xD;
&#xD;
&lt;p&gt; &lt;p&gt; &lt;p&gt; &lt;p&gt; &lt;p&gt; &lt;p&gt; followed by &lt;i&gt;python foo.py&lt;/i&gt;; after some 2 &#xD;
minutes &#xD;
you &#xD;
got &#xD;
the &#xD;
result &#xD;
on the screen, but why is it too slow to start? The culprit is &lt;b&gt;pyglet&lt;/b&gt;.&#xD;
&#xD;
&lt;p&gt; &lt;p&gt; &lt;p&gt; &lt;p&gt; &lt;p&gt; &lt;p&gt; When cocos is imported, pyglet is imported as well. &#xD;
cocos will &#xD;
then &#xD;
try to &#xD;
append some resource directories to it and then the problem begins... pyglet &#xD;
will start &#xD;
indexing every file in the tree starting at ".", so if you are running this script &#xD;
at your home directory or inside a directory with a lot of files and directory &#xD;
(like a &lt;i&gt;~/dev&lt;/i&gt; directory as it is my case), it will add each file found in &#xD;
a dictionary.&#xD;
&#xD;
&lt;p&gt; &lt;p&gt; &lt;p&gt; &lt;p&gt; &lt;p&gt; &lt;p&gt; &lt;b&gt;The solution:&lt;/b&gt; Create a directory to put &#xD;
your &#xD;
code &#xD;
and run &#xD;
it &#xD;
there or &#xD;
wait for my bug report at code.google (out of time right now, but I will do it &#xD;
soon and let you know).&#xD;
&#xD;
&lt;p&gt; &lt;p&gt; &lt;p&gt; &lt;p&gt; &lt;p&gt; &lt;p&gt; By the way, the homework is: what will happen if &#xD;
your &#xD;
game &#xD;
is at &#xD;
&lt;i&gt;/usr/bin/my-ubergame&lt;/i&gt; and you start it in your home directory with, &#xD;
lets say, 15gb of mp3 and movies?&#xD;
&#xD;
&#xD;
&#xD;
&#xD;
&#xD;
&#xD;
&#xD;
&#xD;
&#xD;
</description>
    </item>
    <item>
      <pubDate>Wed, 29 Oct 2008 22:02:09 GMT</pubDate>
      <title>29 Oct 2008</title>
      <link>http://www.advogato.org/person/henrique/diary.html?start=9</link>
      <guid>http://www.advogato.org/person/henrique/diary.html?start=9</guid>
      <description>&lt;b&gt;SuspiciousOperation on Django with FileField?&lt;/b&gt;&#xD;
&#xD;
&lt;p&gt; Just a quick tip. I was wondering why this error happens, but until I got the &#xD;
time to investigate it I just commented out the column on the model and &#xD;
moved on, but now (after a 5 minutes search at the django's code) I found &#xD;
the reason and I want to share it. The complete error message is:&#xD;
&#xD;
&lt;p&gt; &lt;pre&gt;&#xD;
Exception Type:	SuspiciousOperation&#xD;
Exception Value:	&#xD;
Attempted access to '/Users/henrique/tmp/uploads/half_logo.png' denied.&#xD;
&lt;/pre&gt;&#xD;
&#xD;
&lt;p&gt; Suppose the project directory (where manage.py and its friends are) is: &#xD;
&lt;i&gt;/Users/henrique/dev/someproject/&lt;/i&gt;. The problem is quite &#xD;
simple: &#xD;
since the directory specified for the parameter &lt;b&gt;upload_to&lt;/b&gt; is &#xD;
&lt;i&gt;/Users/henrique/tmp/uploads&lt;/i&gt; and it has a "base path" &#xD;
different of the place where the project is &#xD;
(&lt;i&gt;/Users/henrique/dev/someproject/&lt;/i&gt;), django forbides access to it. It &#xD;
has a bit of reason to be, since django is avoiding you from future headaches &#xD;
(pollutioning directories outside your sandbox, for instance).&#xD;
&#xD;
&lt;p&gt; Of course, to fix it you just need to change the &lt;b&gt;upload_to&lt;/b&gt; &#xD;
parameter to something like &#xD;
&lt;i&gt;/Users/henrique/dev/someproject/uploads&lt;/i&gt;, that is inside the &#xD;
project's sandbox.&#xD;
&#xD;
&#xD;
&#xD;
&#xD;
&#xD;
&#xD;
&#xD;
&#xD;
</description>
    </item>
    <item>
      <pubDate>Sun, 12 Oct 2008 01:42:51 GMT</pubDate>
      <title>12 Oct 2008</title>
      <link>http://www.advogato.org/person/henrique/diary.html?start=8</link>
      <guid>http://www.advogato.org/person/henrique/diary.html?start=8</guid>
      <description>&lt;b&gt;Testing your django app&lt;/b&gt;&#xD;
&#xD;
&lt;p&gt; &lt;p&gt; Today, I found this nice blog post about testing on django:&#xD;
&#xD;
&lt;p&gt; &lt;p&gt; &lt;a href="http://ericholscher.com/blog/2008/jul/26/testmaker-002-&#xD;
even-&#xD;
easier-automated-testing-&#xD;
django/" &gt;http://ericholscher.com/blog/2008/jul/26/testmaker-002-even-&#xD;
easier-automated-testing-django/&lt;/a&gt;&#xD;
&#xD;
&lt;p&gt; &lt;p&gt; It is interesting to see the way the test process is realized,  it makes me &#xD;
remember a  similar problem we had on the stoqdrivers (part of the &lt;a href="http://www.stoq.com.br" &gt;Stoq&lt;/a&gt; project). &#xD;
&#xD;
&lt;p&gt; &lt;p&gt; In that project we needed to  (automatically) test our code against a &#xD;
couple of &#xD;
fiscal printers... teorically we would need to have connected all the printers at &#xD;
the same computer to run the test suite, and even this being possible, the &#xD;
tests would run very slowly and a lot of paper would be needed (apart the &#xD;
risk of putting the printer in a inconsistent state, what would make the &#xD;
printer unusable for a day at least :)&#xD;
&#xD;
&lt;p&gt; &lt;p&gt; The solution was to log all the commands sent to the printer and the &#xD;
output &#xD;
returned. Once this log was saved, we could use it to feed the code, through &#xD;
a virtual printer (or actually through several virtual printers, created on &#xD;
demand based on the list of printers supported).&#xD;
&#xD;
&lt;p&gt; &lt;p&gt; I think this way of testing has a defined name, but it still unknown for &#xD;
me... &#xD;
However, it is nice to see this "pattern" being validated in other areas like &#xD;
web and desktop applications development.&#xD;
&#xD;
&lt;p&gt; By the way, you can check the stoqdrivers test implementation at the: &lt;a href="http://svn.async.com.br/cgi-&#xD;
bin/viewvc.cgi/stoqdrivers/trunk/tests/test_coupon.py?&#xD;
revision=7672&amp;view=markup" &gt;project's source web browser&lt;/a&gt;.&#xD;
&#xD;
&#xD;
</description>
    </item>
    <item>
      <pubDate>Sat, 27 Sep 2008 21:31:12 GMT</pubDate>
      <title>27 Sep 2008</title>
      <link>http://www.advogato.org/person/henrique/diary.html?start=7</link>
      <guid>http://www.advogato.org/person/henrique/diary.html?start=7</guid>
      <description>&lt;b&gt;Pycon Brasil 2008&lt;/b&gt;&#xD;
&#xD;
&lt;p&gt; Last week I went to this amazing event in Rio de Janeiro. Well, I had the &#xD;
opportunity to know many guys that I never met before and to know other &#xD;
interesting guys as well (most of them users of django, community &#xD;
&lt;i&gt;#django-&#xD;
br&lt;/i&gt; on &lt;i&gt;freenode&lt;/i&gt; and the mailing list at google groups).&#xD;
&#xD;
&lt;p&gt; In this event I'd participated of a &lt;i&gt;coding dojo&lt;/i&gt; season, since I never &#xD;
had &#xD;
participated of a season before and I would like to know what is that about.&#xD;
That was cool... nothing like a programming contest or a project sprint, like I &#xD;
was thinking of it. The dojo itself is more like a trainning, where a problem is &#xD;
presented to a group of people and then solved using a &lt;i&gt;baby steps&lt;/i&gt; &#xD;
approach together with pair programming (from extreme programming) and &#xD;
&lt;i&gt;TDD&lt;/i&gt; (test driven development).&#xD;
&#xD;
&lt;p&gt; Once a pair start presenting a solution and then coding it, they have 7 &#xD;
minutes to move it on. A refactory can be done (since all the tests still &#xD;
passing after that) or then continue implementing the last solution proposed &#xD;
(test first, as TDD dictates). After 7 minutes, the pair is changed.&#xD;
&#xD;
&lt;p&gt; The main feature of this dojo I liked most is the fact that nobody (except the &#xD;
pair writing the code) can to communicate, they have to wait for the test &#xD;
implementation finishes and executes (passing or failing) to speak &#xD;
something. This leads the public to think carefully about the code/solution &#xD;
that is being write, what is hard if everybody could speak at same time, &#xD;
proposing new solutions or starting complaining about the current solution &#xD;
(your solution could be accepted, but you need to present the advantages or &#xD;
then go ahead and implement it there).&#xD;
&#xD;
&lt;p&gt; For more information: &lt;a href="http://www.codingdojo.org/" &gt;http://www.codingdojo.org/&lt;/a&gt;&#xD;
&#xD;
&#xD;
</description>
    </item>
  </channel>
</rss>

