August 9th, 2008
This year’s PyConBrasil will be held at Universidade Veiga de Almeida, Rio de Janeiro - RJ. I’m definitely going! Last year’s PyConBrasil was great.
So, if you are in Brazil or planning come near September 18th, 19th and 20th, don’t miss the chance to meet the awesome guys from Python Brasil community 
Tags: pyconbrasil, python, pythonbrasil, rio, uva
Posted in coding, computer science, free software, python | 1 Comment »
August 6th, 2008
A little late I know.
This week I finished to fix all the failing tests and to implement PEP 328 (Absolute/Relative import).
Now it’s the final step for supporting Python2.5 on PyPy, to port the standard library.
I’m starting with it today and I really hope I can finish it all (including tests and everything else) until the end of next week.
Well, one more time, if anyone want to help me, test your python programs (specially the ones that use python2.5 specific features, like with statement, conditional expressions and new generator stuff) in PyPy-2.5-features (svn co http://codespeak.net/svn/pypy/2.5-features pypy-2.5-features).
How to test? Simple:
$ cd pypy-2.5-features
$ ./bin/py.py your_python_program.py
Be careful and patient, it may take a little bit to things start happening
Of course you can translate PyPy using the translator if you want. Take a look at PyPy’s website for more information.
Tags: 2.5-features, gsoc, import, pep, pep328, pypy, status report, stdlib
Posted in coding, computer science, free software, pypy, python | No Comments »
July 30th, 2008
Just to update my blog, let’s get ready to GCJ Round 2
Saturday 4pm UTC (it’s 1pm here in Brazil, right?!)!
Coming Soon: GSoC Status Update (I promise!!!) 
Tags: gcj, gsoc
Posted in coding, computer science | No Comments »
July 18th, 2008
Continuing the caches hunting reports
This week me and Yuri went to Ibirapuera Garden, the main idea was to talk and to take the dust out of our skateboards, BUT I remembered that there were at least two caches there
We found both, actually it was very easy to find them. It was Yuri’s first geocaching experience and we decided to search another one near, but outside Ibirapuera. The chosen one was Cedro do Líbano, near enough to go with our vehicles (a skateboard and a long skateboard :P). It was getting dark and the place where the cache is hidden did not help us. The cache must be very well hidden or it is not there anymore, we looked thought the place for 30 minutes and did not found it
‘ll probably be back to search it again
Urban geocaching is very nice because of the curious people asking what you are doing with a GPS device looking for something
They seem like the idea when you explain what geocaching is!
Tags: geocaching, ibirapuera
Posted in geocaching, personal | No Comments »
July 18th, 2008
As some of my friends seemed to like Geocaching I decided to keep they (and you reading this post) updated with my searches for treasures
Last Saturday, July 12th (right?? :P), I was iin Ubatuba (as I’ve already said in my last post about my GSoC project status). Looking Geocaching.com I’ve found a Multi-cache there (ok, I didn’t found it myself but someone pointed me two caches in Ubatuba). It’s the Capricorni Tropicus cache. What’s the difference between a normal cache and a multi-cache? Well, the multi-cache is a cache with multiple coordinates. The first one (the one you will find looking Geocaching.com) will point to a place where you will find tips and steps to find the new coordinates and so on.
To make it short, the coordinates pointed to Ubatuba’s downtown, there I’ve found the next steps and solved the “puzzle” to find the new coordinates. They pointed to a place that I’ve already knew (a bit), near to a beach called (should I mention the name here? :P). If you visit Ubatuba someday you MUST go to that beach… and bring your dive equipment :P! Well, to reach that beach you go through a road (in very bad conditions) and stop your car near to a trail. The road goes on and I never had the chance (and the curiosity) to continue on it to see where it would take. But the coordinates pointed to the end of this road
Well, after reaching the end of the road and following the hints I started to follow a trail that took me to some rocks near the sea. The place is very beautiful! You have a scenic view from Ubatuba
My GPS was telling that the cache was near, about 40 meters on the rocks. I left my stuff with my grandfather (yes, he was hunting with me) and started to “walk” on the rocks. After reaching the right spot i started looking through the fences, rocks and everything.
Sadly I did not found it
I’m not sure if it is still there ’cause since last September no one found it. Anyway, the place worths the visit. It’s very calm and peaceful!
Tags: beach, geocaching, multi-cache, ubatuba
Posted in geocaching, personal | No Comments »
July 18th, 2008
Here comes another GSoC status update
Some finished tasks:
- throw() method on generators
- close() method…
- faking 2.5 behavior for IMPORT_NAME and IMPORT_FROM opcodes
- changing the default value for magic attribute of PyCode objects
- changing the magic number that goes in .pyc files compiled by PyPy
- fixing tests and more tests…
From those changes the only one I would like to comment is the change of both magic numbers.
First, they have different values and meanings in PyPy. The magic number for .pyc files (defined in pypy/modules/__builtin__/importing.py) is the number that identifies the bytecode “version”. It’s used to know if the interpreter should use the .pyc file or should recompile the .py. PyPy’s value is different from CPython’s one. As we are changing some opcodes (as IMPORT_NAME, mentioned before) this number had to be changed. The old value in PyPy was 1024 (or 1024 + 2 or 1024 + 4 or 1024 + 2 + 4, depending on some command line options), the new value is 1034 (or ….). We are just using the same policy CPython uses to change the value, add 10 to the old value.
Now the PyCode magic attribute. This value is the CPython magic number (the one explained above)., the old default value was the value from CPython 2.4 (62021). Some checks against this value are made through the code to decide if the bytecode should be interpreted one way or another. One example is the IMPORT_NAME opcode. In Python 2.4 IMPORT_NAME did not have the level parameter, this parameter is new in 2.5 because of the absolute import feature. So if the bytecode represented by a PyCode object is 2.4, when we visit a import statement we should not try to pop the level value from the stack (because it’s not there), but if it is 2.5 we should! So we check the magic value. The problem is, the default value was 2.4 but we changed the opcodes to behave like 2.5, so those checks were not working. The solution was to change the magic default value to 63231 (2.5c2 value I think), so now our bytecode interpreter is (almost?) compatible with 2.5 bytecode. And our compiler is generating 2.5 compatible bytecode as well.
Tags: gsoc, import, magic number, opcodes, pyc, pycode, pypy, python, status update
Posted in coding, computer science, free software, pypy, python | No Comments »
July 17th, 2008
Most of you probably know that yesterday started the Qualification Round for the Google Code Jam competition. In 24 hours there were 3 problems to be solved using you preferred method (or language).
To go to the Round 1 the coder just needed to achieve 25 points. For each problem there were two kinds of input, a Small and a Large one, the correct answer for the small input counts 5 points and the correct answer for the large input counts 20 points, so the only way to go to Round 1 was solving at least one problem for both inputs. I did it for problems A and B. Of course I’ve solved them using Python
Problems.
The first problem was to minimize the number of switches a central engine should make between multiple search engines. You receive a list of search engine names and a list of query, each query is the name of a search engine. The search engine shouldn’t search for itself or the universe will “implode” (or something like that :P). Well, the basic way to solve this is to always switch to the last next engine in the queries list.
The second problem was to optimize the number of trains that should be in station A and in station B at the start of the day. This given the time that each train leave A and reaches B (and vice-versa). My solution here was to create a list of coming trains (actually of time that the train would be prepared to leave) for each station and then popping out them when a train that should the station leaves after one came (so you reuse the train).
Well, that’s it. Now let’s get ready for Round 1 
Tags: gcj, python
Posted in coding, computer science, python | 3 Comments »
July 10th, 2008
Last Thursday, July 7th 8th (thanks Rodrigo), I was looking for some new apps that uses the GPS feature of my Nokia N95 phone and found something more interesting than a software, a treasure hunting game played by lots of people using GPS devices around the world!
The game is called Geocaching and exists since 2000 when David Ulmer decided to hide a “treasure” and made public it’s exact coordinates in an internet forum for GPS users. After three days someone found the treasure and then another one and the Geocaching was created
Basically you choose a “cache” (there are many sites with lists of caches around the world, the biggest one is www.geocaching.com), set up you GPS and start the hunt!
Well, as July 9th is holiday here in São Paulo I decided to search for a cache. Me and three friends (Thiago, Ricardo and Pessoal :P) went to Serra da Cantareira to find the Pedra Grande cache
After some walk (approximately 3.5 km) we were at an altitude of 1010m, what a view from São Paulo!
The cache was well hidden and we took some minutes to find it. The Geocaching rules are simple, if you find the cache you should take a gift from it and leave another for the next geocacher. You also should sign the logbook (if any)
We took a plastic dinosaur and an euro coin and left a Firefox tattoo (free software for geocachers, yeah!), a São Paulo train ticker, a public phone card and a card from Ricardo’s music group.
After finding the cache you should also make an entry in the site (geocaching.com for example) talking about you experience.
It was great and a really different activity. I will try to find more caches next weekends!
If you have a GPS unit, go find some caches!
Tags: friends, geocaching, gps, n95, pedra grande
Posted in Uncategorized, personal | 4 Comments »
July 7th, 2008
After two weeks without any writing, here comes another status update of my GSoC (and I promise I’ll do it more frequently).
Today I’m working on PEP 342 - “Coroutines via Enhanced Generators”. I’ve finished to implement the .send() method and all the stuff it should do “behind the scenes” (e.g. push the value into the frame stack).
Last week some other PEPs and small changes were supported as well.
PEPs 308 (conditional expressions) and 343 (with statement) were already supported, I just needed to write tests and remove a SyntaxWarning for conditional expressions. PEP 352 (BaseException and raise “string”) is now supported as well.
Some changes were made to Grammar2.5 because pyparser could not read it the right way. Those changes were already present to Grammar2.4. The main problem is that when the parser finds a rule that has alternatives (like, ‘is’ | ‘is’ ‘not’ ) and the first alternative matches (imagine it trying to match ‘is not’, it will match ‘is’) it doesn’t look for the other alternatives and then fails (because there is no rule that matches a ‘not’ after an ‘is’). The solution in that case is to change the order (which doesn’t make much sense, before looking the parser’s code), so the rule should be ‘is’ ‘not’ | ‘is’.
Next steps: check PyCode magic number and finish PEP 342
Tags: gsoc, peps, pypy, python
Posted in coding, free software, pypy, python | No Comments »
June 19th, 2008
This weekend (Jun 21st and 22nd) will happen (again) the Global Python Sprint Weekend and one more time our Python User Group (GruPy-SP) will meet to work together.
Our meeting will be held at Google’s São Paulo Office. Thanks Rodolpho and Google
If you are in São Paulo you can take a look at our wiki (portuguese only) to see how you can join us. If you are not in São Paulo but in Brazil visit the PythonBugDay page to see if anyone in your town is organizing a meet too 
Tags: google office, grupy-sp, grupysp, python, pythonbrasil, pythonbugday, são paulo, sprint
Posted in coding, free software, python | 1 Comment »