Thursday, April 29, 2010

Resources for Starting with Ruby on Rails 3

Ruby and Rails (that together form the well-known Ruby on Rails -RoR- combination) have become a de-facto standard in the industry in order to develop small and not-so small Web applications rapidly (RAD).

The Rails framework has contributed directly to the increasing popularity of the Ruby programming language. Rails is based on the MVC design pattern and allows the developers to implement efficiently Web applications incorporating many of the recommendations and best practices of agilists. Rails 3 is the result of the fusion of Merb -another famous MVC framework for Ruby- with the previous Rails version.

In this post I include some links to resources related to Rails 3, the forthcoming version of Rails currently in Beta:
  • This post includes a compendium of links to blog posts, tutorials, presentations and conference talks on Rails 3.
  • This tutorial allows the reader to learn how to use the GIT version control system and deploy Rails applications on the Cloud using Heroku at the same time you learn Rails 3.
  • This, this and this resources will teach you how to implement and manage associations between the models of Rails applications.
  • This is a very useful site for learning Rails through screencasts, including lots of examples, tricks and useful libraries/add-ons/pluggins (e.g. Formtastic, RSpec, etc.).
  • Finally, this book on the Pragmatic Programmer series (currently in Beta) will be one of the main references for exploiting all the new features of Rails 3.

Hope you find these resources useful for putting hands on Rails 3 :-)

Thursday, April 22, 2010

Two Upcoming Books on Programming Languages

Recently, I've paid attention to the following books on programming languages that are going to appear in the following months:
The first one is from Bruce A. Tate -a well known author in Java and Ruby communities- and introduces the reader inside the most important features of 7 different programming languages that are nowadays relevant or will be relevant in the next few years: Ruby, Io, Prolog, Scala, Erlang, Clojure and Haskell. The second one is being written by the omnipresent Martin Fowler and talks about DSLs, that are gaining a lot of attention in the development communities.

Tuesday, April 20, 2010

Useful Commands for PostgreSQL DBMS

The following commands are very useful to get some meta-information about the data repository in PostgreSQL. In the psql command line put...

# select datname from pg_database;

to get a list of databases in Postgres in the current repository (e.g. the one pointed by $PGDATA env. variable), ...

#\dt

to get a list of the tables of the current database, and...

#select pg_size_pretty(pg_database_size('DBNAME'));

in order to get the size of the database in user readable format.

Wednesday, April 7, 2010

Technical Bookshops on Computer Science

Today I want to write a post about technical bookshops (both physical and online) and book sites on the web.

Despite everyone knows about Amazon as a very good bookshop and source of information about computer science books, there is another online bookshop that looks very interesting:
With regard online free technical books, FreeTechBooks.com is a very good option.

Moreover, I like to touch the physical books (I like their format and appearance), so from time to time I use to visit (some of the few) physical libraries in Madrid. These are the ones I like to go:
  • Cocodrilo Libros (Madrid): This is my favorite bookshop. They have a good and extensive catalogue of technical books in english in their bookshop and, the most important thing, they offer you a very good personal treatment.
  • Librería Diaz de Santos (Madrid): They also have a good catalogue of english books, but it is not close to the city center.
  • Casa del Libro (Madrid): They used to have books in english but since three years ago, they just have books in spanish.
  • FNAC (Madrid): Just books in spanish, mainly for beginners.
Can you recomend any other library/resource you known in your town or in the web?

Tuesday, March 23, 2010

To Err is Human

To err is inherent to human beings. Even the human being may be considered an error in itself.  Unfortunately, in these days nobody wants to recognize his/her errors. We just have to take a look at politicians making wrong decisions in government, managers loosing money due to bad strategical policies, referees in sports, our relatives and friends in their personal decissions, etc. And of course, ourselves in our daily context. The reason is that errors are usually perceived by a majority of people as a weak point of the person that caused the error, and... everybody wants to be/appear flawless.

But, IMHO, that attitude is also an error, because in every role we play in our lives (as managers, students, engineers, doctors, programmers, architects, etc.) we are supposed to err sometimes. No exceptions. So, to me it is very important to recognize the errors we make. So, in this post I'm going to post some references to resources that are related to errors in software.

First of all, it is good to know what are the most frequent errors we can make when developing software. This web page describes a catalogue of software weaknesses in source code and operational systems. It also offers the current list of the 25 most common errors in software that lead to most part of vulnerabilities in programs.

Once we are aware about what are the errors we can make, the next step is try to avoid them when developing. Test Driven Development (TDD) is a well-known technique to follow when reaching the development phase in software construction. It is encouraged by agilists, but of course it can be applied to any software development process. Basically, it consist on repeating the following development cycle:
  1. Write the necessary test cases that define a new functionality that is going to be added to the software in development;
  2. Implement the required functionality;
  3. Pass the test cases developed in the first step;
  4. Refactor the code to make it adequate with regard to code quality standards.

As we have seen in the fourth step of TDD, when trying to avoid errors in the development phase, it is a requirement to program in a professional way. Books such as Code Complete, The Pragmatic Programmer or Clean Code can teach you about how to program properly to produce quality code.

OK, after a lot of efforts, our program code compiles well and all the test cases are passed. So, it is ready to be deployed in (pre)production environments... However, after some use of the program, several anomalies use to arise in the form of unknown/unpredictable behaviors. Of course, these are our well-known "bugs". This book, guides the practitioner in the art of debugging code introducing techniques and tools used in the academia and the industry.

Finally, even when we think that we have smashed all the bugs in our programs, we have to deal with other kind of errors (e.g. in the form of hardware failures, such as power outages, hard disk failures etc.) That's the reason why we design fault-tolerant systems. However, I'll talk about them in other posts. In the meantime, I'll try to not make so many errors... But, you know... that's life!

P.S. How many errors are in this post?

Friday, March 19, 2010

"We don't know how to program anymore"

Some weeks ago a co-worker was telling us that we (including himself) don't know how to program anymore. We have got used to having plenty of memory, hard disk space... we don't think about the resources anymore. He was saying how in the old good times, people like Brian Kernighan, Ken Thompson, Dennis Ritchie really had to care about these issues. This made them think of efficient algorithms to handle the data to be processed.

I think my colleague was right. The hardware gets faster and faster but the programs eat more and more resources, giving the users always the same feeling: frustration. Imagine you want to edit a huge text file with your favorite text editor, it is very likely that it will become unresponsive.

We don't normally develop having performance in mind, we might not think what if the data to be processed gets 1000 times bigger. We will think that our program works pretty smooth until the data to be processed exceeds what we had initially thought, our program will sweat and we will have a frustrated user.

We have to think of scalability and of resource usage. These things are pretty difficult nowadays as most of the times we are developing on top of many software layers, giving us the feeling we are working on an abstract machine with unlimited resources.

Hardware is more powerful than yesterday but, the volume of data to be processed also increases, so it is always a good thing to think twice which data structures and algorithms to use.

P.S. [by Francisco Perez-Sorrosal] I've just found a recent blog entry that is somehow related to this one.

Monday, March 15, 2010

How To Apply for Research Internships

The following are some key steps while applying for Research Internships, answering the pattern formed by the what, why, how and where questions.

What is a Research Internship (RI)?
A RI is an opportunity to get your hands dirty by being involved in academic/industrial research projects. Typically a RI can last from a minimum of 3 months to one year long periods. It is a chance for students to investigate critical research problems arising in academia and the industry (Mechanical Eng., Computer Science, etc.) A RI in Computer Science offers a variety of things, which depends on the level of experience and expertise in a particular area. Literature survey, research paper reviews, programming, analysis and design of software architecture & algorithms, writing a research paper are the few things a candidate would end up doing during a RI. A research intern would typically work in a team or individually depending on the research assignment. In case of industrial research the intern may collaborate with other researchers, as opposed to academic research in which he may just work with the advisor.

Why do a RI?
A RI gives you a chance to get involved in research activities early in the academic career. It introduces you to the world of research and broadens the horizon in terms of understanding research methodologies, being updated with the latest techniques and trends in science and by exposing students to a new world other than a stereotypical bookish world. Doing research during undergrad or immediately after finishing the UG program lays a solid foundation for getting a Master's/PhD degree. Prior research experience is always beneficial before starting a Master's or a PhD programme since it helps the student in exploring a particular area and identifying his/her research interests along the way. It's a wonderful opportunity to work with industrial research labs, and work closely with advisors (professors) in Universities. Working with eminent professors helps in defining a certain way of thinking and attacking problems. Research work creates a whole new perspective and allows in-depth study in a particular area. Getting SOLID recommendations highlighting research experience from researchers is a boon while applying for advanced degrees.

How to apply for one?
Such applications are usually done via e-mail. Applying for RI's can get tricky at times. Tricky in the sense, it is very important to be precise while applying. While applying keep the body of the email short and simple, highlighting your research interests, any prior work / assignments done in that particular area, your long term plans (next 2-3 years), a list of technical reports. An effective strategy while applying for internships is to ensure bulk e-mailing to Professors in different Universities at the same time applying very carefully (A particular email which is meant to be addressed to Prof.ABC may be sent to Prof.XYZ, haha). Getting admitted for internships can be a long shot in the dark, but if you get it right, it is one of the best thing that can happen to your career. Especially foreign internships are fascinating in a way that it allows you to study (work) abroad and meet with people from different cultures and collaborate with smart academicians. It is very important to follow up with Professors at the time of application. If they do not reply to your email (that happens most of the times, do not get disheartened though), feel free to call them on their office telephone after a week and enquire about your application. Shortlisting professors is one of the most important thing while applying. You have to take a look at their web pages which can be found on the University listings. Study their webpages really well since many professors have their own "rules" defined for prospective students. Keep in mind that your research interests match with the professors interests and apply accordingly. Also make use of your current undergrad professor's contacts to find a suitable place for doing an internship.

Where to apply ?
Since I am a Computer Science professional, I would list a few places which look at hiring Computer Science students. Some places to look at in Europe and India include:
- IITs (Bombay, Delhi, Madras, KGP, etc.)
- IISc Bangalore
- EPFL Switzerland
- ETH Zurich
- TU Dresden
- Karlsruhe University
- RWTH Aachen
- TU Darmstadt
- DERI Ireland
- INRIA France
- TU Madrid
- TU Delft / Eindhoven

I hope this information has been useful in some way for your application. Feel free to ask any questions. Thank you.