Why I Like Python Community

My first “5 Reasons Why…” post. Yay!

All the production quality projects I have done were web applications. The two major projects I have worked on are pillinetwork + Sosyomat[1] and Markafoni[2]. Markafoni is written using Python and Django while the others were implemented using Ruby On Rails. I worked on every aspect from DB tuning to writing front end stuff in both projects. One thing I have to say is that, when I was working on pillinetwork I wasn’t an experienced programmer. If I was doing the same project from scratch today, I would probably do a lot of different things. I was faced with original problems (which I claimed to be part of the job I wanted to work at) but failed to come up with original solutions. I was unmotivated and very unproductive which didn’t help with thinking out of the box. I was trapped with generic solutions to then-original scaling problems. This was five years ago (I was an early adopter of RoR, back in 2005). A lot of things changed since back then. One significant change is the fact that I am a Computer Science student now. This guy changed the way I think about and imagine computer programming.

I still love Ruby and I use it in my work everyday. However, I recently started enjoying Python a lot more. I know it’s enough with the background and all but let me tell you one more thing before I go ahead and tell you why I love the Python community: I don’t like it when people talk about their favorite language, tool or technology as if it is the only thing in the universe of computation. From time to time I find myself discussing these issues with people who introduce themselves as Pythonists, Rubyists or <some programming language or tool>ists. I understand the idea of being an expert in a programming language but I don’t understand why people think that there is no alternative to what they use.

I know some self-proclaimed expert programmers who don’t know any terminology for abstracting common techniques which helps communicating ideas between programmers. New languages bring new paradigms and they enlighten us. A smart guy told me once: “Java is great because, simply, it helps people earn a living”. It may help you keep your job for now, but how long will it keep up? Anyway, back to my reasons:

1. PEPs

The quality of these documents are, as Mr. Spock would say, fascinating. Everything that goes into Python (and comes out of it) is critically and devoutly analyzed. This one for example: It discusses the reasons for migrating to a DVCS [3] from Subversion. I like the detail and work put into it. This article is a very good source for deciding which DVCS to pick for your project even if you are not a Python user. Maybe my recent, excessive exposure to academic papers are the reason I like these, but I think it’s because of how good everything is written. Being able to express your ideas (regarding programming) clearly is a good sign that they will work. These articles assure me that the future of Python is safe (we love that, right?) and all the theories that was put into an amazing language during the last 10 years (Correct me if I am wrong here but the first PEP is dated 2000) are there for me to study.

2. Django

I have never contributed anything solid to any open-source software. I use them in every part of my life: at work, at school and for personal things. I also join developer mailing lists to learn from the successful projects I am using. This one is incredible. I am amazed by the open-mindedness of the core developers. I was trying to come up with a proposal for contributing to Django at Google Summer of Code 2010. I didn’t get accepted because I have never sent an application. It was just the wrong time and I had other things to deal with. But I read every single application and responses from developers. The amount and quality of feedback, especially from Russel-Keith Magee, is absolutely brilliant. Alex Gaynor is one person whom I met on django-developers and envy the most. He is very young, talented and very active in the Python world. Following his blog and tweets, I realized that what I saw in django-developers is quite common in the entire Python community. After all, Django is Python.

3. Minimalism

The famous Zen of Python attracts me like the song of a siren. Especially this one:

There should be one-- and preferably only one --obvious way to do it.

I believe that this results in clean, easy to read and easy to remember APIs and architectures. It feels a lot more elegant and precise and I love that. In Ruby for example, everything is an object and objects have utility methods that you call rather than kernel-space utility functions that accept objects. One popular example is the “len” function:

[].size == [].length == 0

In Python however, it is used as:

len([])

Many argue that length is a property of an object and it should be a method of every “measurable” object. I like the Python approach better: Strip as much as possible away from the object and implement private methods that decide how the object responds to utility functions. Basically, you can do whatever you do in Ruby but it is a lot more structured and a bit more limited. But hey, less is more, right?

4. Precision

When you import things in Python, you can be as precise as you want. You can import specific identifiers/variables/functions (and only them, the ones that you didn’t declare will not be imported as long as you don’t “import *“) from a file/module. Python developers love namespaces and they provide means to use them as efficiently as possible. In many languages such as PHP, Ruby or Java, when you include/require/import a file, everything in that file is imported to the calling environment. This might not be a problem at first but as the projects get bigger and bigger it starts to get back at you. I love the fact that when I am reading any Python code and wonder what a variable’s source is, it is very easy to track back since it is almost always clear where it is imported from.

5. Maturity

Python has been around for about 19 years. It has been heavily deployed in massive production applications. The fact that it has been one of the top players for such a long time is a sign that the development process for Python is great. The Python developers keep adding amazing features and state of the art algorithm implementations to the CPython interpreter and they still keep it extremely manageable and clean. Python is one of those projects that you can learn a lot from, simply by studying the source code and reading the archives for discussions regarding the history of development.

If I could have a single wish granted, I probably wouldn’t want to go back to 1991 and join the development when Python was first released but it would definitely be a choice I’d consider.

[1] pillinetwork (including Sosyomat) has 296594 members as of writing this article.

[2] Markafoni is a private shopping site that ships over 1000 items per day.

[3] DVCS stands for Distributed Version Control System (DVCS on Wikipedia)

Posted in Uncategorized | 2 Comments

Updating more stuff

I have created a “Resources” page. I’ll be adding everything I produce on that page. For now there is only this article I have written as an assignment. I also have a tagging plugin for jquery that I am planning to add. TagComplete needs a lot more work to be usable. I’ll write up a readme to briefly explain how to use it. It’s quite easy actually but I want to make it really usable: Include a js file, call a function when DOM is ready and nothing more, no cryptic config options, etc. It also has a Django widget that can be used without much effort. If you’d like to figure it out yourself, be my guest, the code is on github. Or you can poke me to write that readme.

Posted in Uncategorized | Leave a comment

Can’t get Ubuntu 9.10 to boot from EFI.

It’s rather ironic that after a week of research on free software, software compatibility and protocols I was unable to get Ubuntu 9.10 to boot from EFI on my MacBook Pro 5,1 (late 2008). It’s not the fault of Ubuntu or grub2 developers. It’s Apple’s implementation of EFI, they weren’t loyal to the standards. I didn’t give up yet but I am taking a break.

You might want to know what EFI is and why I would like to “efi-boot” my Ubuntu 9.10. EFI is basically a replacement for BIOS. Using EFI, much more complex devices can be handled before the OS is booted, so we can make shiny boot loaders…

But the real reason I want to efi-boot is the fact that MBP 5,1 has two NVIDIA cards. One of them is 9600 GT the other one is 9400 GT. If Ubuntu is booted with older grub, in a special BIOS compatibility mode, it can only detect the 9600 GT. This results in an extremely over-heated system. I suspect, the undetected card is working at full capacity without doing anything. Anyway, If Ubuntu detects both cards, by the way a lot of people had success doing that, you can select one of the cards to be active without frying your system. This also fixes the battery issue, the battery lasts longer because there is no extra device to leech power in the background.

For three days, I tried gazillion different configurations, beta builds, compiled grub from source with several combinations of modules. I joined the grub IRC channel to get some help and ne of the main developers gave me an experimental version and another version that he modified specially for my problem. None of them worked. Grub just freezes after loading the kernel and the initrd image. I don’t have time to learn about EFI, BIOS or grub internals, I’ll have to wait until people figure out the problem and fix this.

Apple, why would you do this to me?

Posted in Uncategorized | Tagged , , , , , , | 2 Comments

New VPS, Nginx and PHP-FPM

I bought a VPS share from GANDI yesterday. They are the cheapest I have found, $16/month (I must admit I haven’t searched much though). Here is a sentence about them from Wikipedia:

They do not pay for publicity, but rely on word-of-mouth only. Since 2008, they also provide virtual servers through Xen technology.

They are France based and I love having a server in France, very handy for proxying through Europe. After setting up fundamental software and services on my shiny Debian 5 OS, I decided to migrate my blog from Blogger to WordPress. I started by installing the classic LAMP stack, Apache, Mysql and PHP.

I bought a single share (means a single slice) which has 256 MB of memory, 5 GB disk (+ another 2.5 GB for system software) and 5 MBit/sec unlimited bandwidth. After setting up Apache with mod_php I was shocked to see that it would cost me 210 MBs of memory to host a single WordPress installation. I’ve used and setup Nginx for RubyOnRails and Python/Django setups before but never for PHP. I decided to give it a try.

After following the instructions on this page to setup Nginx with PHP-FPM (PHP Fastcgi Process Manager) using 2 threads to serve my blog, I was happy to see that the overall memory usage was 66 MB. Well of course I could lower the number of child processes in the Apache config but I don’t think it would lower memory usage this much and I am really fed up with Apache’s way of threading and process management.

Posted in Uncategorized | Tagged , , , , , , , | Leave a comment

A change of development environment.

I have been developing on a Mac for 3 years (give or take). I used to do projects using RubyOnRails and PHP Frameworks. For a year now I have been enjoying Django. Ruby (and Rails), Python and PHP all come built-in latest Mac OS X (Leopard). It may sound good enough but it is really annoying to find your application broken by an interesting software update from Apple.

Or worse, if you want to upgrade the libraries you use to the latest versions, you might end up breaking some of the functionality of your system. I prefer not to modify anything in the system libraries unless it is an official update.

I like lightweight editors like Emacs, TextMate or TextWrangler. But a course in the latest semester made me use Eclipse. I am a long time Java hater. After this course I realized it’s really fun to code in Java and if it’s even more fun if you use a full-blown IDE. Some of you might think those IDEs are just crap, I used to be one of you. Maybe I am getting older, some younger programmers might still want to use Emacs . Don’t get me wrong, I love it. But Eclipse takes a lot of the weight from my shoulders (i.e. boring parts of the programming). Anyway, here is the evolution of my web programming environment:

OS: Windows -> Red Hat -> Debian -> Ubuntu -> Mac OS X -> Ubuntu -> Mac OS X

Editor
: EditPlus -> Gedit -> Vim -> Emacs -> TextMate -> Emacs -> TextMate -> Eclipse

DB Backend: MySQL -> PostgreSQL on Mac -> PostgreSQL on Ubuntu VM -> Postgresql on Mac

Programming language: PHP -> Ruby -> Python
I also use Java, C and Objective-C but they are not really work related.

Frameworks: None -> Drupal (yeah CMS) -> Rails -> Django

Since I hate modifying my system libraries, until recenly, I used to keep my Django, Python and PostgreSQL installation on a virtual machine running Ubuntu, share some folders between the Ubuntu installation and Mac OS X (So my editor running on Mac OS can access those files).

But I am fed up launching virtual machines every time I want to make a small change and I think there is a better solution: MacPorts.

I know there are some people very upset with MacPorts. But if you install the libraries you need without modifying anything in your Mac system, you’ll be fine. For example, if you are installing a new version of Apache, you shouldn’t let it run on port 80. Because there is a built-in Apache server in Mac OS X (according to vigo it may break your mobileMe sync).

Trying a lot of environments I am most comfortable with MacPorts. If you are developing using Python-Django or RubyOnRails, it will be a lot easier for you since you don’t need to modify Apache configuration. One thing to keep in mind when using MacPorts is that, you should add “/opt/local/bin” to the beginning of your PATH variable. When you install, say, a new version of python using MacPorts, the executable file “python2.6″ will be in /opt/local/bin. Just link /opt/local/bin/python2.6 to /opt/local/bin/python. That way, even if you don’t modify the original python executable in /usr/bin, you’ll be able to use the new version when you just type “python”.

Posted in Uncategorized | Tagged , , , , , , , , , , , , , , , , , , , , | Leave a comment

Apple iCal and Google Calendar synchronization

Just like a lot of people out there, I use more than one computer. I have my laptop, my desktop computer at work and various computer terminals at school… So I like to keep my data online as much as possible. The best solution for synchronization between computers is MobileMe. But I find the service expensive when there are a lot of free and really good alternatives and frankly, it is not cross platform. If I had an iPhone, I’d probably buy a MobileMe account to have all my data with me all the time and be able to access it in a very usable way. But I don’t have an iPhone and I am not planning to buy any time soon, not the 3G model.

So I stick with Google Calendar. It is very usable, web based and free. Now the best part is that it can be synchronized with iCal. In fact, it is not synchronization. Any modifications you make on iCal is instantly transferred to your Google Calendar if you are connected to Internet. That is if you are using the CalDAV. You can use Google’s Calaboration tool to easily add your calendars to iCal and keep them in sync via CalDAV.
But I have a terrible problem, the image on the left side shows how it looks when you add multiple calendars. As you can see all the calendars seem to be under different accounts, this is such a waste of space and very annoying. In a perfect world, it should be looking like the one on the right:
Maybe this requires some extension to CalDAV protocol/structure. I don’t really have any information about it. All I know is that this is terribly annoying. If you know how to avoid this mess or Google/Apple is planning to release a fix, please let me know.
Posted in Uncategorized | Tagged , , , , , , , , | Leave a comment

Fixing Low Microphone Volume Problem with PulseAudio/ALSA on Ubuntu 8.10 Intrepid Ibex running on Dell XPS M1330

  1. Open Application -> Sound & Video -> PulseAudio Device Chooser
  2. Click on the “PulseAudio Applet” on the system tray and open “Manager”.
  3. Click on the “Devices” tab, select “alsa_output.pci_8086_284b_sound_card_0_alsa_playback_0.monitor” which is the “Monitor Source of ALSA…”
  4. Click properties and set the volume to maximum (480% on my computer)
  5. Record a song using the gnome-sound-recorder for testing.
Posted in Uncategorized | Tagged , , , , , , , , , , , | 3 Comments

From MySQL to PostgreSQL

If you have been using MySQL for some time now and want/have to try/use PostgreSQL, here is an excellent blog post you should read.

The post goes over the fundamentals and some MySQL-specific details. Personally, I had a hard time when I first tried to install PostgreSQL. I was on a Mac and I didn’t like the fact that I had to add a pgsql user to the system. If you are on a Mac and a first time pgsql user, I suggest you install debian or ubuntu on a virtual machine and do your first installation on a linux environment.

Posted in Uncategorized | Tagged , , , , | Leave a comment

Mobility is a part of life

Because of my work and my studies, I have to carry my laptop with me almost all the time. I need it at work, I need it at school. If I am staying over at a friend’s I have to take it with me because I will need it for work or school the very next day. When you carry it around enough, it becomes a real problem.

I have been trying to find an effective solution for carrying my MacBook. I have been using a few different bags. I used an ordinary laptop bag with my old 15” laptop. And after a while I realized it was way too heavy on one shoulder, so I switched to a huge laptop backpack. It was a lot better than the messenger bag but I couldn’t find a backpack (for laptops) that I really liked. For some reason all of them are lacking flavor. They all have ugly colors and weird designs. So I decided to buy one of those sleeves and carry it in my regular JanSport backpack. And after carrying it around for a while, I came to a conclusion: When it’s summer it’s a lot better to use a messenger bag. Even though it’s too heavy for one shoulder, you shouldn’t be walking around too much when it’s that hot anyway, it’s better than a backpack. Because backpacks makes your back sweat way too much… So messenger bag during summer and backpack for winter is the best for carrying a laptop.

It was working great until I switched to mac and bought a 13.3” MacBook. Now I am still using the same 15” sleeve. The problem is that I noticed some scratches on my MacBook and I think it’s because of the sleeve. I don’t think it’s doing a good job protecting it from pens and other weird stuff I am carrying all the time (I’ll go into detail about this later.). It’s way too big and I think the MacBook is moving in it when I am carrying it in my backpack. And another thing is, an 15” sleeve is way too big to carry with my messenger bag. It barely fits in and there is no space left to put in anything else.

Now I am planning to buy an 13.3” sleeve. But, there are so many different brands and they are talking about a lot of different “shock-emitting technology” and stuff. This is one of those things that shouldn’t be too complicated. So I decided to buy the one that has the best looks. I am considering to buy this one or this one. I think I’ll go for the black/red one.

Leave a comment if you have any suggestions.

Posted in Uncategorized | Tagged , , , , | 1 Comment

Why I should blog

I finally decided to start a blog. Maybe the reason is this blog post. I am a big fan of Steve Yegge (his more recent blog). He is quite famous with his really long blog posts.

The main reason behind me starting this is, I consider myself one of the programmers who know how online communities and social networks work. But I realized I am a lurker. I lurk in mailing lists, I lurk in online forums. I lurk in open-source project wikis. I rarely contribute code and I never talk. So I decided to make my own contribution on this blog and my website naysaying.com. I chose this domain because I am a naysayer. That is it. I always comment about the things that, I think, are wrong and I rarely speak when I like something. I almost never find myself criticizing something when I really like it.

In this blog I am planning to talk about things that I don’t like about software, web development, gadgets, video games, books and other things I am interested in. And I will also try to talk about things that I like and go into detail about them.

After reading a lot of blogs and articles I finally accept the fact that the things we consider obvious may not be so obvious at all. So, in that context, I will be talking about “obvious stuff”. It may be boring for some of the readers and useful for others. I am not here to make everyone happy. If one thinks that this blog is boring, then one can read another blog that suits her. Internet is an ocean of blogs just as it’s a series of tubes. I am also planning naysaying.com to be a site for my portfolio, projects and a place for me to exist online.

I am a Turkish web developer and Turkish is my mother tongue. If you wonder why I want to blog in English, that is because I am a Computer Science student. Most of the people I want to work with and the online communities I am interested in, are not consisting of Turkish speakers. The papers I will be releasing and all my work will be in English because, currently, it is the default language for science (which means I also have to improve my English writing skills.).

I have been avoiding this for years. I didn’t want to join the horde for some reason, but I finally accept that one should have an online presence (Facebook is not enough, belive me.).

And… Well… Here I am.

Posted in Uncategorized | Tagged , , , , , , | 1 Comment
  • Hello, I am Fırat.

    I am a CS student from Turkey. I can't stop learning new things every day and rant about them!