New website

Launching a new website today. I’m really busy and have no intention to reivent the wheel building a website so I installed WordPress. We have it at work and it is such a nice tool. Yes, the default theme works fine!

baby_seal4Besides working in the office I have been also coding for the Autoresponder. A new minor version is almost ready. There are still some bugs to resolve though.

Since I mentioned bugtracking it is also worth mentioning unfuddle.com. It is a really nice website service for Project Management and I’ve been happy with their services so far.

CPanel, pdo_mysql and Magento

A few days ago I had to install Magento in one of our servers. No luck running the installation for the first time. pdo_mysql missing. The server has Whm/Cpanel installed so our server administrator tried EasyApache and built a new profile with pdo_mysql added. Still no luck.

To fix the problem I just had to open
/usr/local/lib/php.ini
and move the line
extension=”pdo_mysql.so”
to the end of the file.

Restart Apache and that’s it!

Hope it helps if you are dealing with the same problem.

Users and Subdomains

Some months ago the company I work for needed a special feature that I think is very common at web services. The idea is to offer users their own subdomains. It is pretty much like this blog system.

The idea is that all subdomains point to the same location on your server. You can then fetch user data from a database using the subdomain name as a key. We use a lot of PHP here so our key would be something like $_SERVER['DOMAIN_NAME'].

I first thought of building a small script at the server to manage the subdomains. List, add and delete. Boring.

The server for this system had cPanel installed. It is a good tool but it took me a while to find out I could handle all subdomain errands with CPanel’s XML API. The documentation is very poor and lack details. By the time of this writing you don’t even have a complete list of methods for the subdomains:

CPanel API

You can see here that the only method listed is for deleting Subdomains. Too bad. Lost some precious time digging cPanel code.

Anyway, here’s a simple class that you can use to list, add and delete subdomains if you have cPanel installed on your server.

You’ll probably need to adapt the code to your needs and enforce error checking.

cpanel.tar

Improvement Guide

I played guitar in a heavy metal band for almost 7 years. Crazy time. I never achieved the status of a professional musician but trying to learn and write music was one of the best shots I took in my life.

When I thought about that time there are two things that I learned and I still take benefits from it:

1) how to drink like a man
2) how to study

Well, for number one the good thing is that you can hang out on Saturday night and still be productive in the next morning. No extreme hangover as an ol’ friend once told me.

On how to study I took the lesson from real guitar players – then Musicians. You need method. Otherwise you’ll play 10 hours a day and still suck. No matter what skills you want to improve you need method. Otherwise you won’t be able to play that killer arpeggio that make teens to listen to the same lead break a thousand times.

Now, I don’t believe that there’s a perfect or magic method to improve your learning experience. It is up to you to discover and implement what works better for you. Two rules are mandatory though:

Rule #1 – Small steps

It’s like Jack the Ripper. Take it through pieces. It’s better for you to read 30 minutes a day than to spend your whole sunday with your face into that algorithm book you promised yourself to master.


This said, you need a schedule and this bring us to

Rule #2: Routine

Routine is the hard part. At least in the beginning. It’s easy to be distracted and procrastinate. A good way to motivate you to go through is to give you some credits when you achieve goals.

Make small goals. Goals that you can achieve. You can start with something like I’ll read some completely unknown technology to me 30 minutes everyday.

Let’s face it. 30 minutes won’t hurt you. In a week you’ll see that it’s a breeze. You’ll raise your bar for the next week.

My routine at this moment

Before building my schedule I had to couple with the idea that I won’t live forever – at least in this incarnation. So there’s a finite number of subjects and time to spend on them.

At this current stage of my life I have the ability to divide my learning time by

1) the mornings before doing “real” code. I go earlier to the office.
2) night time
3) small breaks during the day. Generally a 10 min break to let your subconscious deal with some problem you’re trying to solve.

For the subjects to learn I have priorities. Some subjects are mandatory and some are fun and new – and they improve your mandatory skills anyway.

I’m working as a software engineer in a startup company for almost 2 years. The language I deal most of the time is PHP. So, PHP is in my priority list. It’s very important for me to have a deep understanding of the language that pays my rent. I try to get better at the PHP world by reading books, magazines and even reading the language source code.

For the fun part I have included Python and Game Programming in my schedule. I mainly use Python at small side projects and use C for some stupid and small games. Games are a fun place for me to learn about algorithms and data structures.

I label everything else as Tools. In this section I have included 5 subjects. Right now they are Apache, Mysql, Emacs, Regular Expressions and SVN.

Ok, with the list of WHAT what to learn I insert it into my WHEN agenda.

1) Mornings – PHP. Here I read regular books, security with the language, what’s being done for version 6 and once in a while I try to read the language C source code.

2) Nights – Python or C Game Programming. Here I try to work on small side projects with Python/Django and sometimes coding small pieces of games.

3) Small breaks during the day – Here I set a subject for each day of the week. Apache on Mondays, Mysql on Tuesdays, Emacs on Wednesdays, Regular Expressions on Thrusdays and finally SVN on Fridays.

There are of course lots of other subjects that I’m interested in. Again, since my time is limited all other subjects are in my list for the future.

Having a schedule like this seems tedious at first. It’s not. In the end it’s all about having fun in what you do. If you’re not up to reading an algorithm book on Wednesday read something else or just go out to drink beer!! Salute.

2 Monitors

I had some problems some days ago setting up 2 monitors to work in Ubuntu. One of my colleagues pointed out that he was using a Nvidia card and it worked out of the box in his machine. So, I took his advice and replaced the ATI hardware here with a Nvidia card. We took the Nvidia from a Windows user and left my old ATI there. Let’s face it. Microsoft scored. Both cards worked by just inserting the hardware and clicking the buttons “Yes” or “Next” in the Windows box.

Now my machine is running with 2 monitors on Ubuntu and with all fancy but cool effects from Compiz. We use 19″ monitors here. Hardware in Brazil is so damn expensive. Let’s say thanks to the government for all taxes and making the acquisition of TOOLS we NEED to WORK this HARD.

Anyway, I was curious on how people work with 2 monitors here. Right now, the best approach for me is to have Emacs on the left. On the right monitor I have the browser and the terminal. I leave the terminal maximized since it has transparency in it and it’s such a nice feature. I can type my bash stuff and still read what’s on the browser. Wohooo!! There’s just one feature missing in GNOME. I can’t set a different wallpaper for each screen. KDE has this option though.

Whenever I need to use another program or do some unusual task I go to a different Desktop. Two Desktops are enough for me. I can only do an unusual task at a time. I guess Rands is right when he says I Don’t Multitask.

After some time working this way I’m changing my mind about two monitors. I’m now willing to work with only one monitor. But it must be HUGE!!

New website section – Game Coding


Devoting some time for casual game programming now. The new section Game Coding (link removed) presents a free TicTactoe game for download.

Note on Mar/22/2009: This section was removed because I no longer have the game or the source code for it. It was just some excuse to learn the Windows C API anyway.