Python Sequences - Part 2

This post is a continuation of Python Sequences.

Concatenating Sequences

You can concatenate sequences using the plus (+) operator:

>>> [1, 2] + [3, 4]
[1, 2, 3, 4]

Multiplying Sequences

You can multiply a sequence by an integer number to repeat it the specified number of times:

>>> [1, 2] * 3
[1, 2, 1, 2, 1, 2]
Read More

Python Sequences

Sequences is the name that python gives to a data structure that contains a “sequence” of elements, each with a numeric consecutive index. The sequence is very similar to an array in other programming languages. The first index number is 0 and they increment by one as elements are added.

Sequences can contain numbers, strings, other sequences, etc…

Creating a sequence

You can define a sequence like a list of elements separated by commas and listed inside square brackets ([]):

ages = [13, 15, 22, 23, 56, 12, 33]
Read More

Python strings

Python has a lot of ways to represent strings, so it is useful to be familiar with them in case you ever find them in any python program.

Ordinary Strings

These are probably the most commonly used strings on python. You can enclose them using single or double quotes (‘ or “) and you can use a backslash to escape characters or to print special characters like a line break:

print "Hello\nWorld"

print 'Hello\nWorld'

print 'This is a backslash: \\'
This is a backslash: \
Read More

FileSync: File Synchronization plugin for notepad++

I want to start by thanking Mike Foster ( because with out his well written notepad++ plug-in and his instructions to compile it I wouldn’t have been able to develop this plug-in. I thank also François-R Boyer for helping me when I was stuck(

What the plug-in does

This is a really simple plug-in that copies a file to another location at the moment you save it. The reason I needed this extension is because I need to deploy my PHP applications using maven to download dependencies so the folder where my version controlled application lives is different than the folder where my executable application lives. Having this extension allows me to work always on my version controlled folder and having the changes immediately applied on the executable application folder.

Read More

Running Selenium 2.0 / Webdriver tests

Selenium is probably the most popular web functional testing automation tool out there. Functional testing means testing your application as if you were a user (clicking links, entering information in fields, etc…). And thanks to selenium this can be automated.

Recently selenium released a new version (2) that is basically a merge with another project called WebDriver. This merge provides developers and testers with a very neat Object Oriented interface to interact with browsers easily from Java.

In this post I am going to explain my first successful experience with Selenium 2 / Webdriver (I had some unsuccessful experiences in the past). I couldn’t have made this post without the great help of, so thanks a lot to for their awesome post.

Read More

Python lesson: Getting user input through the console. Bonus: handling an exception.

This is my second article about the Python programming language. And what we are going to learn today is handling user input from the console.

Python makes getting user input from the console very easy. For this purpose we can use the input function, which has this structure:


This function only takes the prompt as an argument, which would be the text that the user would see before the console goes into input mode.

To store input from a user into a variable you can simply assign the return value of the function to a variable like this:

userInput = input('Give me a value');

With that little information we can make a little program that will get a number from the user and print it’s square.

Read More

Introduction to Python

I have been wanting to learn python for some time, mostly because a lot of my favority open source projects use it and seek people with that expertise, so finally here I am taking my first steps with python.

There are two things that really catch my eye about python:

– Doesn’t use brackets to group statement

– Doesn’t use semicolons to end lines

These two semantic rules of python freak me out a little, maybe because I am so used to brackets and semicolons that I can’t imagine a programming language that doesn’t use them. But they claim this makes programming easier, so I hope they are right.

Read More

Configuring a quick and ugly local email server on Ubuntu

Configuring an e-mail server for local testing on ubuntu is a really fast an easy task. You just need to install and configure sendmail with these commands:

sudo apt-get install sendmail
sudo sendmailconfig

The first command gets and installs sendmail from ubuntu repositories. The second command will run a configuration script that will ask you some questions about your configuration.

After you do this you have to add a fully qualified domain name to your hosts file or your server will not work.

Your hosts file should have something like this:


You can really write the domain name you want but it needs to be fully qualified, that means it should contain a top level domain, in my example dev.

Read More

Using Table Data Gateway and Row Data Gateway design patterns in Zend Framework

Table Data Gateway and Row Data Gateway are two design patterns that are very closely related. The former specifies an object that acts as a gateway from our system to a table in a database. This means that it will give us the functionality necessary to execute all common operation to that table easily by providing methods to all the CRUD (Create, Read, Update, Delete) operations.

Row Data Gateway provides very similar functionality, but it lets you execute those operations in a single record of a table.

The Zend implementation

Zend Framework provides us with Zend_Db_Table as an implementation of the Table Data Gateway pattern and Zend_Db_Table_Row as an implementation of the Row Data Gateway pattern. The best way to use these implementations is by extending Zend_Db_Table_Abstract and Zend_Db_Table_Row_Abstract respectively.

Read More