Python 3 Object Oriented Programming

Python 3 Object Oriented Programming had been reviewed already by a number of people in the python community and I’m lucky to have been given the occasion to read it as well. As most of the other reviewers I say that the book is pleasant, it’s easy to follow and crystal clear. It gives a good overview of everything you have to expect from python. The book is composed of 12 chapters The first 5 introduce the reader to basic concepts related to object oriented programming like Objects and Classes, Exceptions and Inheritance: Object-oriented Design, Objects in Python, When Objects are Alike, Expecting the Unexpected, When to Use Object-oriented Programming The next 2 delve into more python specific features and […]

Android Motorola phones policy

As a previous HTC Dream owner I have been quite sad with my Motorola Backflip in the past few months. I couldn’t upgrade it to unofficial roms, I couldn’t run root software, my bootloader was constrained to run only specific signed roms probably by using IBM eFuse and last but not least Motorola announced that it didn’t have any intention to provide an upgrade to Android 2.X for the Backflip in Europe. It’s 2010 and I am confined to a device running an Android version older than the version that my 2 years old HTC Dream did run. As I really liked the policy from Samsung to release their complete OS sources for their android phones and I really liked […]

Python Sequence VS Iterable protocols

Recently my colleague Luca got an extracted chapter of Python 3 Object Oriented Programming book to review. As I am a long time Python developer and lover I couldn’t stop myself from taking a look at the chapter so satisfy my curiosity. A little excerpt from the chapter talks about len, reversed and zip functions illuminated me about the fact that usually due to duck typing Python developers tend to consider sequences and iterables quite the same. The author of the books says that “The zip function takes two or more sequences and creates a new sequence of tuples” and also the help(zip) documentation says “Return a list of tuples, where each tuple contains the i-th element from each of […]

Mercurial “git grep” equivalent extension

As we are used to git when working on mercurial we miss a lot the “git grep” command as “hg grep” doesn’t really do the same thing. So we managed to quickly create a mercurial extension to add the hgrep command to hg which behaves a bit like git grep. import itertools, os, os.path   def hgrep(ui, repo, what, **opts): files = [] status = repo.status(clean=True)   for f in itertools.chain(status[0], status[1], status[4], status[6]): files.append(os.path.join(repo.root, f))   os.system("grep %s %s" % (what, ‘ ‘.join(files)))   cmdtable = {"hgrep": (hgrep, [], "[what]")} To have the “hg hgrep” command and make it work just save it as hgrep.py in your python modules path and add it to ~/.hgrc inside the extensions section […]

Redis and MongoDB insertion performance analysis

Recently we had to study a software where reads can be slow, but writes need to be as fast as possible. Starting from this requirement we thought about which one between redis and mongodb would better fit the problem. Redis should be the obvious choice as its simpler data structure should make it light-speed fast, and actually that is true, but we found a we interesting things that we would like to share. This first graph is about MongoDB Insertion vs Redis RPUSH. Up to 2000 entries the two are quite equivalent, then redis starts to get faster, usually twice as fast as mongodb. I expected this, and I have to say that antirez did a good job in thinking […]

Canvas 3D and various modern web technologies reflections

Every ~10 years we face an incredible new technology that looks a lot like an old technology that spent his life in total oblivion. Recently we faced the return of clustered computing under the new brand of cloud computing, we faced the return of time sharing systems under the software as a service paradigm and recently 3D movies have returned to life from 1970. Technology improves and sometimes we recall that something that we already tried can be made better and released under a new less geeky brand. Recently HTML5, which is trying to remove the need for plugins for nowadays common actions (like playing videos online) and to stop the HTML vs XHTML war by permitting to integrate SVG […]

Liskov Substitution Principle Reflection

I have found a quite interesting shakespearean article about Liskov Substitution Principle. It is mainly about C++, but being it the core of Object Oriented paradigm I think that it might be interesting for everyone. Most of the think is nowadays resolved with mixins and Policy Based Design, but they run away a bit from pure Objects Oriented and so is still an interesting reflection So if you are interested take a look at thisĀ  Blog Post

Remember to sync (or what the heck is that RAW C: partition on my Windows on mac?)

Our current computers use MBR to store the table of primary partitions. MBR for convention allows only 4 primary partitions and then uses Logical Partitions inside Extended Boot Records for the successive. Instead Apple computers use the new Extensible Firmware Interface with the GUID Partition Table to describe disk partitions permitting any number of primary partitions to be allocated. MacOSX uses the GPT partition table while Windows expects to find the MBR one (Actually Windows for Itanium can boot from GPT, but that is not what you are usually installing on your desktop). Fortunately the EFI keeps a “fake” MBR table for backward compatibility and that is why we can install Windows on our MacIntel. But what happens when we […]

The misunderstood one

I’m a usual follower of C++ related blogs and newsgroups and still I’m impressed how much this language is misunderstood after 10 years of a precise standard. I’m actually starting to ponder if we are ready for C++0x while a lot of people yet misunderstand C++98 and C++03. I often end up discussing with my colleagues about the fact that they prefer a less powerful, but more reliable and less obscure language like C. I know that C++ isn’t one of the easiest languages to master correctly and I also know that it has some problems about compilers often changing their behaviour and with slow templates compilation time. All things that C++0x is trying to make easier or faster with […]