Great old Emacs Manual in Info mode

I realized this morning that I read all of the emacs manual in Info mode. I read a small section every morning for a few weeks. Info mode is a really neat format and it solves the problems I have reading digital books. In fact, I gave up reading digital books a long time ago.

The main problem with reading a PDF book is navigation. It’s just plain hard to read a paragraph mentioning a table in Appendix A which is located in the end of the book. Now, in Info mode it’s not only easy but you have all emacsy ways to help you ‘walk’ around the text.

A PDF is also inconvenient helping my brain to map subjects to a particular physical area in a book. I know that what I’m looking for is in the middle of the red hard cover book in my shelf. The author mentions what a register RAX is right below the figure showing a leprechaun in the right top of the page.

I wish I could read more books in Info mode like the emacs manual and now the Elisp reference, CC-Mode, Org-Mode and alike. Ipads and Kindles just don’t work for me. They are a good fit for novels though. I’ll keep buying dead trees.

Ubuntu 10.04

I’ve been running Ubuntu 10.04 on my laptop (VAIO VPCCW) since its release. I had some problems before with a release but this time things were a little more difficult.

I don’t know what I was thinking but I tried to use the Update Manager and give it another chance since it never worked before for me. After the download was complete the system rebooted but nothing happened. Black screen of death?! Bummer, didn’t work. Fresh new install and the problem persisted.

Turns out Nvidia graphics and the resolution of 1366×768 don’t work out the box. The solution was the alternate installer. After the installation I manually included the edid file from the laptop’s monitor into xorg.conf before I could see any graphics. I mentioned something related to that here and here.

Another annoying video related problem is the brightness control. It’s broken since 9.10. Well, truth must be told, now at least the animation works when you increase or decrease the brightness using the keyboard. Still, no effect. I have to use nvidia x server settings to avoid burning my retinas.

Other than that I just had to tweak xorg.conf to decrease the sensibility of the mouse tracking pad. You could double click by just raising your voice next to the keyboard.

Section "InputDevice"
    ...
    Option "MaxTapTime" "230"
    Option "MaxTapMove" "230"
EndSection

I want my money back :)

gnu make

Whenever I can I try to read Chromium‘s source code. Even if all I have are 40 minutes between Sunnyvale and Millbrae. Poking Chromium’s source code is an educational hobby of mine so I am in no rush and I take a lot of detours diving into subjects related to the project.

The most recent example was GNU Make. When I first started reading the Makefile generated by gclient I got stuck. The Makefile dumps almost 30MB of instructions to compile the project and some lines of code were a complete mystery to me.

The usual approach. Order a used (if possible) book from Amazon. Managing Projects with GNU Make (Nutshell Handbooks) by Robert Mecklenburg is a really good book. I just skipped the Java chapter.

I kept switching between reading the book and Chromium’s Makefile. Being confronted by a real (and big) working example of a Makefile pushed me harder to go through the entire book.

I’ve been writing quite a few Makefiles since then. Even for situations were GNU Make is not appropriate. After all, when you are a hammer everything looks like a nail.

Coders at Work

Sometimes I need to re-charge the batteries and let my brain rest. I guess. I was receiving messages from my body (brain, soul and who knows what else) to take some rest. By rest I mean taking a break after regular work time. No side projects or books/manuals that need focus and extra attention.

Signing up for the 24 hour gym was the first step. The old stuff, get back to gym and deal with muscular pain for a week. It’s interesting that you can exercise in the gym without an instructor here in the US. You see a lot of folks that will most likely hurt themselves. I’m not into sports at all but you have to know at least the basics to lift weight.

I digress. I was looking for a tech novel to entertain myself during the approximately 40 minutes between Sunnyvale and Millbrae and found Coders At Work by Peter Seibel. The book advertises itself as “interviews with some of the top programmers of our times“.

Informative, entertaining and inspiring! Highly recommended.

Restful web services

This one has been laying on my desk for quite too long. Time to make a post about it and get it back to the shelf.

I first started reading Restful Web Services by Leonard Richardson & Sam Ruby one year ago. April 2009. I know that because of the Amazon receipt.

I read the first chapters and wondered why I didn’t learn about Restful Web Services before. Simplicity is the key. Suddenly all XML-RPC code that I wrote in the past started to smell really bad.

The problem is that after the first chapters I probably got bored or the book could have been shorter. In any case, I just finished reading it this past April. A year later! It is a good book though, even if you just read the first few chapters.

Working for cupid

These past months have been crazy and brought lots of changes to my life. Proof of this is that I let more than a month go by without a single post. Let me try to fix this with this short entry.

I left my day job in Brazil and joined a talented team in Millbrae.

I thought this job transition was going to be smoother since I’ve been planning this for a while. Heck, I just needed to finish a few side projects. Turns out 2 members of the team in Brazil quit with a short notice and we even had a hard disk failure in one of the servers. A few thousand clients went nuts while we restored the services. The universe has sense of humor.

Well, routine is now settling in and I noticed that I actually missed commuting. I should have counted how many books I read in the bus/subway when I was living in São Paulo. Ha! Now I have this odd habit of adding a post whenever I finish reading a book. Anyways, I’m taking the train to Millbrae and I can calmly read not only technical books but my zen stuff too. Rhythm is important.

I’m having a blast. The team is friendly and culturally diverse and I’m switching between implementing new features and reading the code base. I should also mention that I’m ingesting a significant amount of caffeine because I just can’t resist the fridge.

Mailserver and Postfix

In order to keep this diary blog updated I should add a small note about mail servers. I’m still doing some sys admin work for about 2 hours a day.

After a lot of experimentation I finally have one mail server up and running with Postfix and Dovecot.

Besides the official documentation I usually try to read at least one book about the tools I’m working with. Safari led me to Postfix: The Definitive Guide by Kyle D. Dent. The book gives a good overview on how Postfix works and goes through several different configurations that you may be interested in implementing. The only problem is that the book is outdated (December 2003) – that’s last decade!

Everything seems to be running ok but running and maintaining a mail server is a lot of work. There are just so many details and configurations that can go wrong. Performance, Security, Authentication, Disk space, Spam, Anti-viruses… The list is huge. I’m looking forward to meeting the next sys admin to join our team.

I’m working on a project that offers domains and email accounts to the final client so it’s been a good experience to understand how mail and dns servers work. We have a lot work ahead!

Masters of Doom

I have just a few posts per month but also have a lot of drafts waiting to be completed. A few of these drafts are almost complete and most are just short notes about subjects I want to write about in the future. I wish I could post more often, but not only is my schedule too tight, also writing clearly is just plain hard for me. It takes me precious time. Not to mention that English is not my mother tongue.

However, I have one more motivation to keep writing. Besides my beloved wife who has the burden of proof reading my posts I have a reader. Yes, that is right. One reader. Hallo Rafa! Thanks for all the support buddy.

Now, back to the topic of this post. I was checking the draft list and noticed that I didn’t add Masters of Doom to the Books category on this blog. I read this book many years ago but ended up reading it again this past December. Great source of inspiration.

In case you’ve been living under a rock, Masters of Doom is about John Carmack, John Romero, Id Software, Commander Keen, Wolfeinstein, Doom…

If you didn’t read it just do yourself a favor and order a copy of it!

A matter of guidance

LasVegas Cloudy days are perfect for productive leisure, so in March before moving to the US I spent a lazy-cloudy-Sunday afternoon packing. Moving is always exciting and a good chance to get rid of everything that is not necessary in your life anymore. You can even leave bad vibes behind if you are spiritual. We tend to gather too much junk. Keep it simple.

The cleanup included my bookshelf. My mission was to dispose of as many books as possible. Boy, books are heavy to carry and physics does not apply when it is part of your luggage.

While running through the titles I started to compare dates of purchase against subjects. I have had this habit since I was a teen, every time I buy a book I sign and date it.

Anyway, my small library was another lead to an obvious issue: my quest to become a programmer is a mess.

Here’s one good example. I wanted to code games when I was a teen. After some research I concluded that C++ and DirectX were the right tools for the job. I decided to start with C++ and ordered “C++ How to Program” by Deitel. Back then, a small number of web pages would advise: “You have to learn C”. My mind discarded that advice as fast as I could read it. Why would I learn C? Isn’t C++ not only C but PLUS PLUS! It is the future. Yeah, I know you are laughing at me.

I read and tried all the examples from “C++ How to Program” before reading or writing any line of pure C code and felt ready to dive into some DirectX books and code the best tic-tac-toe ever!

Turns out my ambitious plan needed a detour. You have to go through some Windows programming before you can dive into DirectX (I don’t know how it works now a days). Gosh, 70 lines of C code just to print Hello World in the Win32 API world.

I can’t just copy and paste code so I ordered “Programming Windows” by Petzold to become familiar with Windows programming. BTW, Programming Windows is a great book — and I found a minor mistake in the text! (Erratum #5).

I read the book, tried the examples and the fact is: Win32 API is C Code.

Because of that I finally ordered the classic “The C programming language” book to fill this awful gap in my skill set. Comparing the dates of purchase I realized that I bought the C book 2 years after the C++ one. Sad.

I now remember that after going back and forth I finally achieved my goal. The best tic-tac-toe game ever written did compile and run without crashing. The euphoria lasted for almost 5 seconds!

Before writing my first line of code I was already humble and comfortable with the idea that it takes a lifetime to be a great developer. BUT, it took me a long time to have a better overview of the skills set you need to build in order to be a software developer.

It’s a matter of proper guidance.

It doesn’t matter if it’s a CS degree or guru souls willing to show you the way.

Ubuntu 9.10

Sony Vaio VPCCWI was planning to skip Karmic Koala. Jaunty was running just fine but since I replaced my notebook I had an opportunity to try it.

I bought another Sony Vaio but this time without a stupid keyboard. I opted for the VPCCW model because it offered an NVIDIA (GEFORCE 230M) graphics card. I was interested in the SR series but because of my bad experience in the past I didn’t want to deal with ATI.

And that is the irony. Installed Karmic and even wireless worked out of the box. Surprise! After enabling NVIDIA proprietary drivers (190.42) and rebooting my screen was black. Frustration.

After some time googling and reading NVIDIA documents I found out that I had to set xorg.conf to use a custom EDID.

Option "ConnectedMonitor" "DFP-0"
Option "CustomEDID" "DFP-0:/path/to/bin/edid/SNY05FA.bin"

Everything is running smoothly now but I can’t stop thinking that this kind of problem is what makes linux desktop adoption harder. It’s just a matter of time though.

Meanwhile, at the PHP world

fireplaceIn order to accomplish my goal of keeping this blog updated and grant me some good memories in the future, let me write down about what is going on in my small PHP world:

CakePHP

In my daily job we deal with tons of code written in the pre-framework era but I had a chance to experiment with CakePHP in the past months. I had a good time being involved in three side projects using the framework.

The documentation is good and written like a tutorial but some times you still need need to dive into the framework’s source code to get specific details about classes and methods.

Emacs PHP mode improved

I replaced php-mode for php-mode-improved. The improved version has fixed some bugs in from the previous version but it is sad to read:

;; This has been submitted to the php-mode maintainer, but I've not yet had a
;; response.

The (probably) most popular php-mode is abandoned.

Xdebug

I occasionally read Chromium’s tools written in Python and - as the newbie for life that I am  - I wasted a significant amount of time adding print and exit statements to the code.

It was time to learn how to use a Python debugger and make life easier. Enters pdb.

It didn’t take long to look for a similar tool for PHP: xdebug.

I just wonder why I didn’t try to learn these tools earlier.

PHPUnit

This was something I was excited to do. To move all the crude test scripts to a test framework as dictates industry’s best practices.

Some tests were written using SimpleTest but after a few grep and sed commands they all work with PHPUnit now.

PHPUnit’s documentation is better and development is active. SimpleTest is stuck in version 1.0.1 since April 2008.

Apprenticeship Patterns

I was randomly checking the titles available from Safari’s web site when I found Apprenticeship Patterns by Dave Hoover and Adewale Oshineye. The book presents several patterns to improve your learning experience as a software developer apprentice.

Evaluating how you you learn is key to excel and achieve mastery in any form of art. Yes, I’m including software in the art category.

A good example to follow are musicians as they have in their curriculum a solid base on the matter. They learn not only how to play but how to study and practice. They have method.

Aprenticeship Patterns is a good book and the subject is fascinating. Probably most of the patterns are already part of your daily schedule, but reading the book is still a good opportunity to reflect on the process to hone in on your skills.

Windows Day Experience

vegasI always try to have at least one small toy project that I can play with at night. Sometimes it consists of only reading the source code and mailing list from a big project and sometimes my toy project involves writing code and playing with different tools than the ones required by my daily job.

A few months ago I added to my schedule a Windows Day. Brand new world. I dove into Vista, ASP.NET, C#, IIS, MSSQL and Visual Studio one day per week (and occasionally weekends) for a few months.

I was excited because of the novelty. I read a few books on the subject and had  to play with it.

Here are some random thoughts about my experience.

Right on the first day I got frustrated using the mouse for simple tasks like moving and copying files around so I installed cygwinA difference between two worlds.

I learned later that there is a Windows option for the command line: Powershell. Although I didn’t try it the Wikipedia article gives me the impression that learning Powershell is probably a good investment for Windows developers.

Back to random thoughts.

I was then ready to try Visual Studio. It is amazing to try examples from books just dragging and dropping icons that build some correctly written snippet of code. I just doubt that experienced developers would follow that approach.

One problem I had with Visual Studio was trying to set the Emacs key bindings. Leaving the keyboard home row to reach keys like arrows, page down and page up is disturbing. I followed this post advice and installed Emacs Everywhere.

P1050196

The next step was the database. Oh boy, choosing a MSSQL version is so damn confusing! I’m probably getting older and dumber but I couldn’t understand which option to download from the MS website. Installing MSSQL in Vista was quite painful, too. Had to follow some MS black magic recipes to get it running. Installation on Windows 7 Beta was a breeze though.

After setting up the database I went to the HTTP server. IIS is pretty straightforward. You can setup a working environment with just a few clicks.

Working environment ready and I started to follow the books’ examples. A few ASP.NET web forms later and I was ready to start learning C#.

Talking about computer languages is somehow a taboo so it should suffice to say that C# is verbose.

Well, a few months after my first Windows I’m back to a Linux side project but I’m glad that I took some time to get an overall idea about the ASP.NET world. It’s not for me. Once you go open source you never go back.

If you are only interested in building your client project it doesn’t really matter the platform you pick but it’s a disturbing feeling that you can’t build IIS or poke Visual Studio’s source code. There is this sense of being a powerless and passive consumer always trying to catch up every .NET update.

Learning MySQL

I’m trying to keep track of the books I read on this blog. It will be fun to check the posts a few years from now.

I just finished reading one more book from the O’Reilly learning series. Learning MySQL by Seyed M.M. (Saied) Tahaghoghi and Hugh Williams.

I picked this book up for two reasons:

1) I had never read an entire MySQL book until now and there is just no excuse for that.

2) It is easy to read and digest. Productive leisure.

I think I’m now ready for an advanced book on the topic :)

Ancient bank institution file formats will make you bald

computer museumThis past week I was documenting part of the system from the company I work for in Brazil, and while running through the payment options code I was again confronted by the ancient file format that bank institutions still use today. You’ll never complain about XML files again if you have to deal with a bank file format in your life.

I don’t know how it works here in the US but years ago banks in Brazil came up with a file format dubbed CNAB to exchange financial transactions. It’s basically a layout where data fields are delimited by their byte positions. Seems pretty straight forward, right? So try implementing one and you will feel the pain.

The first problem is bureaucracy. You need a business account, lots of papers, signatures, phones calls and of course talking to Elaine. She is your bank account manager, really polite and willing to help but obviously completely clueless regarding any technical question. Most of the time she is not allowed to put you in contact with someone who works all day writing Cobol and has all the answers to your questions (I actually empathize with the Cobol guy and pity him whenever he needs to answer the phone).

After everything is set and you are allowed to interact with the bank system via their file format they email you the technical instructions. It’s a word document detailing the layout. Prepare yourself to learn how it works through trial and error and a lucky chance to talk to someone on the phone (yes, a real human being) who actually knows what is the default char for the field delimited between bytes 116 and 118. Is it a blank space or just a zero? Can the file be encoded in UTF-8?

You just need a second bank to send you their layout documentation to prove your inner fear. Each bank implements its own CNAB layout version. This is the time you start praying for a framework to deal with all layout inconsistencies across bank institutions.

All is not lost though. After going through all this you have a new skill set. You are ready to work at any bank institution because you did your homework. You have grasped an understanding of all kinds of bank transactions. You have to do this even if you only want to automate monthly invoices for your customers. It’s a hell of a ride my friend.

Now, I’m not trying to undervalue the CNAB file format. It was probably a good solution 20 years ago. It still works. The problem I see is how banks are outdated compared to companies like Paypal and alike. What are they thinking? Can’t you just build a web interface to deal with your internal file formats? Just give me a Restful Web Service in XML or JSON so I can send monthly invoices or pay the employees.

Learning Python

Write, run and throw away scripts are the excuse I need at my job to try different languages.

One of the first languages I tried some years ago was Python. I really like the language but never had a proper introduction to it until now.

I just finished reading Learning Python by Mark Lutz. It’s a really good book especially if you are learning your first language. If it’s not the case the text can sometimes be too repetitive.

Anyhow, to make better use of my new and improved Python skills I devoted a few hours at night to understand what the heck is going on when I setup and sync Chromium‘ s source code.

I can finally rest when I type

gclient config http://src.chromium.org/svn/trunk/src
gclient sync