Python 101: Getting it

This post is part 1 of Get started with Python programming series, in which I do my best to share my experiences in learning python and hope that this becomes some sort of guide to help you become a Python programmer.

In today’s post, I explain how to get and setup Python.

Getting Started with Python
============================

Python is an easy to learn and powerful programming language with elegant syntax and dynamic typing and it is available freely for all major operating systems. This is great news because no one is left out here.

The first thing you need to do is to install the Python interpreter in your system, this is the program that reads Python programs and carries out their instructions. This has to be installed before you can do any programming in Python.

If you have Linux or Mac OSX installed in your computer, happy days for you already have the python interpreter is included with your operating system. If you’re a Windows user, you can visit http://www.python.org/download/ and download a package installer that will install python interpreter for you.

Linux/Mac users: To check if python is installed load the terminal and type python and hit enter. If all is well, you should see a message like this:

Python 2.7.3 (default, Aug 1 2012, 05:16:07)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.

>>>

That is a sign that the interpreter is ready to receive python commands.

Congratulations, you have successfully installed python. The next post will be about how to write your first python program. Thanks for reading.

DOCTEST : An easy testing tool

According to author Daniel Arbuckle, Doctest is the easiest and fastest way to write tests for your python software.Doctest is a program that comes bundled with python that allows you to write down what you expect from your code in a way that’s easy to understand.

Doctests are written in plain text usually in code documentation. The computer reads and runs the tests but ignores the rest of the text that is not part of the test i.e the rest of the documentation. Tests can therefore be embedded in code comments or explanations.

Here is a quick example of a doctest:

def testable(x):
"""
The testable function returns the square root of its parameter, or 3, whichever
is larger.

>>> testable(7)
3.0
>>> testable(16)
4.0
>>> testable(9)
3.0
>>> testable(10) == 10 ** 0.5
True
"""

if x < 9:
return 3.0
return x ** 0.5

Notice that in the code above the first 13 lines are commented out, the comment simply states how the testable function works and gives examples of expected output when different parameters are passed to it. When running doctest, doctest will read through the comments and try out examples in the comment to see if they return the expected results. This is a great feature especially if you want to check if the documentation is accurate.

More information on doctest can be found here:

https://docs.python.org/2/library/doctest.html

Thank you ORAP

Many of you know that I have been working at ORAP for the past three months or so.
As expected, I enjoyed being there and I definitely would encourage you to volunteer there if you can.
I say this because my time at ORAP has come to its end. At this point I doubt very much if I’ll be renewing my contract. I’ll make up my mind over the weekend.

What was my motivation for working for ORAP?
———————————————–

I have worked for ORAP before, as an intern and as an employee. This time around I was a volunteer.ORAP is the kind of organisation where your opinion counts, no matter who you are, where out of the box thinking is encouraged and where crazy is normal (at least in the IT department). The ORAPIANS as they like to call themselves, are super friendly, always eager to offer a helping hand and joke about it in the process.

My real motivation to volunteer lay in the fact that I wanted to learn new skills whatever they may be, and learn I did. I’m happy to say that as a result, some of the systems that are in place now were made by me(I had help of course). This gives me fulfillment you know, knowing that my brain-children(if there is such a thing) are at ORAP.

So what did I learn?
———————–

My knowledge of Linux server administration improved greatly and I now have a few more skills in my skills bag. I don’t have badges to show for it unfortunately. Working on the website taught me one thing: manual testing sucks! Its necessary but still, its slow, painful (yes mentally it hurts) and boring. This just fueled my drive to learn automation. I am making big strides towards that goal too.

Overall experience
——————–

It was good, I learned what I needed to learn and I contributed where could and I’m happy.
Will the orapians miss me? Probably not, many of them didn’t even notice that I was there.
I hope that those who remember me remember me as the person who broke things to fix them, who treated computers equally because they have rights too and generally as the guy who was fun to be around.

I have served my time and it’s time to move on to something else now.
Thank you ORAP

If what I said about ORAP interests you, check out their site:

Another unit conversion app?

I’ve always had a challenge in understanding the meaning of data transfer rates I hear whenever I’m asking about an ISP package. What does 15Mbps even mean? I think better in terms of how many megabytes of data I can download per second, so I’ve always had to use an online converter to convert the Mbps to MB/s. I’ve done it this way until I thought to myself, why don’t I just build my own app to do this for me?

I did it, coded the python app and it works! I also went on to add distance and weight conversions.
Continue reading

A text Based Game that you can’t win

–You really can’t win this one, and no, it’s not a bug, its a feature. Yes I just had to say that.

Here’s a linkĀ  to a game I’ve been working on. This game is command line based and presents you with a series of menus where you choose an outcome. There’s really no point to this game and it cannot be won. Check it out in my github here.

Please review my code and help me in my goal to be a Pythonista!

How Python chose me

Every time i learn something new, I put it up here.
I’m in the (never-ending) process of learning Python, a general purpose language
that is used extensively by Mozilla’s WebQA team.

Why Python
————–

I didn’t choose Python, instead, it chose me.
Unlike java, I didn’t google it to weigh its pros and cons and determine whether its a language worth learning or not. No instead I had to learn it because it is the language that is at the heart of WebQA automation and If I’m serious about being a software tester, this is the language to learn. I’m in good company. because I have a community of experienced developers and testers that I work with who are more than happy to help me along the way.

My journey so far
——————-

To be blatantly honest, I haven’t been disciplined in my study of python, its been on and off,
but I today decided to put an end to this, today I’ve decided that I want to be a GREAT programmer!
Python is the language i’ll master and I will attain guru status after a few years.

What I find most interesting
——————————-

Whitespace matters! Unlike most programming languages, in python, whitespace, tabs really matter.
There are no braces to group together blocks of code but instead they are grouped by indentation blocks? lost? let me use an example:

Python gets straight to the point:
In java, this is what you’d need to type in to get a hello world program:

public class HelloWorld {
public static void main(String[] args) {
System.out.println(“Hello, World”);
}
}

In python:

print (“Hello world”)

Python is easy to read and write and if you’re new to programming I would definitely recommend starting with Python. I would be more than happy to help any newbies begin their journey. If you need any help, throw me a line, my email is terrameijar at google’s mail service. Not only will I get to help you get started, but I’ll also become a better programmer in the process.

Trip to Japan: Day 1

This is the second post in a series of posts about my trip to Japan. In this post, I’ll talk about my experience in Tokyo on Day 1.

This post is a continuation of this one.

The Hotel
I’m staying at the Hotel Okura, a beautiful Hotel. Okura is conveniently located, the Roppongi shopping district and Mozilla offices are close. The service is outstanding, the bed is comfortable and the the curtains open and close at the touch of a button. The Okura offers High Speed wifi free of charge(Did I mention how much I love free wifi?). Most of the employees speak or understand English, so communicating with them isn’t difficult.

The Mozilla Japan Space

The goal of this trip was to get to see the Mozilla Japan space. I got to the Office at around 11AM after Gen Kanai picked me up from the Hotel. I got a warm welcome from everyone at the office and it was good to see Yuka Takagi face to face finally.(Yuka worked really hard to get me all the documentation(Visa support documents) I needed for the trip. The space is quite small, but it has an interesting story behind it. The office has Open Source furniture, which means that the plans can be downloaded , enabling you to build something similar. The workspace can be changed using the polycarbonate panels any time. More about this can be found here.

This slideshow requires JavaScript.

I wish I spoke Japanese, because I could tell that most of the people at the office were happy to see me, but they could not communicate with me. I think all understand English, but are more comfortable speaking in Japanese. I had a good time at the Mozilla Japan space, I made new friends, met new mozillians and got to take a picture with Foxkeh(this was a highlight for me).

The next post will be about everything else I’ve been up to. Stay tuned

Getting there

This is the first post in a series of posts about my trip to Japan. In this post, I’ll talk about the preparations I had to make to get to Tokyo.

I’m Zimbabwean, which means that I need a VISA to go pretty much anywhere outside the country. Getting the Japan Visa proved to be a big challenge for me. Before I go into that, I’ll give a brief background into my trip.

At the Mozilla Summit in Toronto Canada, I was voted person who had the most positive impact on Summit Delegates and for this, I won an all expenses paid trip to visit any Mozilla Space of my choice. I chose Japan. With the help of Luciana Viana, I planned the trip around April/May since its warm in Japan this time of year.

Visa applications are pretty straight forward, submit application and support documents and get the visa right? In a perfect world, yes. I went through the visa application twice because I hadn’t done it right the first time. Unlike other Embassies, the Japanese require you to produce original copies of all your documents,including guarantor letters and any other support documents. The first time I applied, I submitted printed copies of the support documents and they were rejected. I went back home with a heavy heart that day as I had to go back to Bulawayo empty handed(6 hour bus ride on a good day)

After a few back and forth emails, typo’s here and there, waiting for almost two weeks, the original documents from Japan arrived and I applied again the day after. The visa application was successful and I got on a plane 2 days later.

The flight or flights rather, were all OK, on time, no lost luggage, not too much waiting time between flights and not to much jet lag. I landed in Tokyo yesterday (Tuesday May 6) at 7.40pm and immediately went to the Hotel.

I haven’t seen or done much, but if there’s one thing I’ve noticed, its that the Japanese are extremely friendly, polite and helpful.

The next post will be about Day 1.