Old-school coder living in a 2.0 development world.

Menu

Tag Archives: imports

The second day of OSDC started with Larry Wall, the creator of Perl. At first I thought he would ignore the elephant in the room, but all his talk was about Perl 6. He shown the parser and the weird new operators (like “»+«” and no, this is not a mistyping) which means I’ll have a harder time trying to understand Perl code. But, on the other hand, their changes on the regular expressions make them a lot easier to use and a lot more logical (well, once you understand the basics of regular expressions.)

After the opening talk, I went to see Joshua May talking about “Going mobile – tips, tricks and tools for building mobile web-apps”. He basically summarized all the things I heard the mobile developers talking in the office: It’s freaking hard to make something that would work on every mobile. WURFL is here to help with descriptions of capabilities on mobiles. Another very interesting point was the Facebook mobile application which have a special “Call” link on it, ’cause it is easier to call someone than leaving a message and he also suggested that, instead of a “Contact us” form, business should have a “Call us for suggestions” or something around those lines, ’cause, again, it’s easier to call someone and tell them about something than typing a message on a phone.

Then it was Ben Balbo with a quick demonstration of how to stream video with a talk about “Streaming the world for free”. Basically, only using free software, you have DVgrab to capture video; FFmpeg, VLC and Mencoder to encode the video; HTTP, RTSP, RTMP as streaming protocol; Darwin Streaming Server, VLC, LScube, Red5 and Helix Server as streaming server and VLC, MPlayer and Helix Player as, well, players. On a quick demonstration, he showed the stack of DVgrab, VLC, HTTP, Darwin and QuickTime Player playing a real time video using his laptop. He also demonstrated Kyte.Tv played a video capture from his mobile phone.

The third talk was Silvia Pfeiffer talking about “An open source ‘YouTube'”. The system they build for the University of Queensland uses the FedoraCommons (not to be confused with the distribution) as the archiver/storage (FedoraCommons can store a lot of stuff, like documents) and they use Fez as a front-end to retrieve that information and display it.

Following her talk, John Ferlito joined Silvia to talk about “MetaVidWiki: When you need a web video solution”, which mixes MediaWiki (Wikipedia) with video playing. They also menioned the failed attempt of the W3 Consortium of making Ogg Theora (the free media codec) the default media format for the new <video> tag in HTML 5. As a solution they presented Mv_Embed, which is a Theora-capable player that can work with MetaVidWiki to stream the videos.

After lunch, I went to see Andrew Bennetts talking about “How to make a FAST command line tool in Python” and his experiences with Bazaar. Just to demonstrate where the basic problem is, he run two commands: time python -c "", which basically runs nothing, taking 0.013ms and time python -S -c "import os; os._exit(0)", which doesn’t load the site module and forces an “unclean” exit, before the garbage collector can do anything, reducing the run time to 0.008ms. So, basically, the big culprits are imports. For that, both Bazaar and Mercurial have a “lazy import”, which is capable of doing the proper imports only when requested. Also, a lot of imports are bad right now, like String module, which imports the regular expression module, which is slow. Also, same goes to urllib, even when you just want to use the encoding stuff there (it loads the socket module, which loads the _ssl modules, which is incredible slow and large to load.) Some suggestions he gave was use PyFlakes to find unused imported modules. Later, in the questions part, I got the sad news that locally importing modules (e.g., doing import inside a function) does not improve the load speed, which means most of my new code in Mitter is bad.

Then I went to see “Managing category structures in relational databases” by Antonie Osanz. He basically explained how to use nested sets in a relational database. I saw nested trees in Uni, but I couldn’t understand how that works properly and it seems I stil can’t. But basically you keep a left and right information pointing where the element belongs in the set. It makes insert and delete slower (’cause there are more records to be updated than just one) but search is way faster (and the query is incredible simple.)

In the same database line, I went to see Jonathan Oxer talking about “Self-Healing Databases: Managing Schema Updates in the field”. His suggestion is basically never run a schema upgrade script, but you code your ORM layer to, in case of error running a query, check for probably upgrades (e.g., table creation script, column creation script), run it and then re-execute the query. Yes, you can have problems of two users trying to access your site just after an upgrade and two scripts running at the same time, but things could probably go fine if you don’t capture the error of the upgrade procedure (I’m not sure about data convertion.)

The last talk in the day was “MySQL Optimisation by design” by Arjen Lentz. He mostly talked about the good practices we usually apply. The good stuff, though, came in the little tips. For example, you can add a small C comment inside your SQL query and that comment will appear in your logs. He also suggested that you should worry about replication and write your code thinking about doing requests in a group of servers and updates in another group, so your application is ready to work in a master-slave environment (updates in the server, requests in the slaves.)

And this day I decided to stay around and see the Lightning talks. Honestly, I have a problem with 30 minutes presentations (it’s too short) and I was kinda worried about presentations in only 5 minutes. But it was, nonetheless (and yes, I love that word.) Unfortunately, I wrote the name of the presentation but forgot to write down the presenter name. Shame on me. So we had:

Golly, a Corwin’s Game of Life with an impressive size;

That joke about “if languages where cars”;

Faster Beer, where the presenter make use of Corepy to speed up his Pythton application (I think it was Michael Hudson, but my memory fails me here);

“So you’re a kick ass coder”, which pointed how we, as developers, should get more involved in the community;

“Ladies Get In Free” by Pamela Fox about a suggestion to bring more girls to this kind of conference;

“SiliconBeachAustralia.org”, a developer community;

“Freeway 2.0 on Zend Framework”, which I completely lost ’cause I decided to check something different (sorry about that);

“Counting Your Users Without Download Statistics”, which explains some tactics used to count users using surveys;

“SQL vs NP”, which was a really crazy talk with SQL, first making a text/ASCII-code fractal and then solving the traveler problem using just SQL and PL/SQL;

“Geek my ride”, presented by Jonathan Oxer showing how he did add a computer in the trunk of his car, with power source, Wi-Fi and G3;

“OSDcLang for Mobile Devices”, also by Jonathan Oxer, with a simple, Turin-complete, Brainf**k-like language running on mobile devices — HIS CAR! (see above)