Showing posts with label dev. Show all posts
Showing posts with label dev. Show all posts

Sunday, October 11, 2009

Uploading Data to App Engine

Pre-requisite:
  1. You know some Django
  2. Your Django App Engine app is working properly on your dev server
Here are the relevant lines in the app.yaml file that will ensure data upload to the live server:

handlers:
- url: /load
script: $PYTHON_LIB/google/appengine/ext/remote_api/handler.py
login: admin
Make sure the above is the very first item in the handlers section because yaml file is parsed top to bottom.
  • Upload your latest source file to your app engine account
  • Test to see if the following url is accessible:
    http://yourapp.appspot.com/load
    Your should either be prompted to authenticate into your Google Account or get the following message if you are already authenticated:
    This request does not contain a necessary header
The above confirms that the upload can take place. The app.yaml in some ways behave as a Django's urls.py or Routes in Rails. Proceed with the usual data upload command:


appcfg.py upload_data --config_file=yourapp/module/module_loader.py --filename=yourapp/fixtures/data.csv --kind=Module yourapp

Monday, September 14, 2009

My first Rails App!

After a few days of pouring my mind over Ruby and Rails, I have finally completed my very first web application in an afternoon. It is called Podcast Lookup which aggregates the podcasts I listen to on a regular basis. The web application simply shows the publish date of the latest episodes. It is quite useful if you listen to a large number of podcasts and need a way to view them all when jumping across different OS. The project still needs a lot of improvements which I can iterate on from now on, isn't that what the whole agile development hotness is these days?

Some thoughts on Rails

Functionality drop out of the sky into your lap. This is mostly how the Rails framework is implemented, it tries to make the developer life easy and lazy by achieving a lot with the least amount of code and without having to know where methods or variables come from. Not that it's a bad thing for someone coming from C++, Java or Python but I'll be very worried on how someone who only knows Ruby and Rails can move outside their comfort zone.

Ruby on Rails will hold both your hands and spoon feed you to make your life as a Web Developer easy and productive. In some ways, it feels like Perl because I am not sure what some of the minimal code is trying to do. Having a reference manual nearby seems invaluable. Maybe it's too early for me to judge the framework after only playing with it over the last 3 weeks. I'll be working on it a bit more over the next few months to get a better feel of it.

Rails for newbies

If you want to learn Ruby on Rails, DO NOT DEVELOP ON WINDOWS. Do yourself a favour and save some time by writing codes on Linux or Mac. You will avoid a lot of Yak shaving that way. Ruby 1.9.1 and Rails 2.3.3 simply do not play well with Windows when you go beyond the out of the box features. Some gems will just refuse to install on Windows unless you do some configure and build gymnastics on them. You are here to learn the language and framework, not building source code unless that is your motivation, I have done enough of that for the last 4 years.

The Rails Guide is a stepping stone to get yourself familiar with the technology. Once you have exhausted this resource, borrow Simply Rails 2 from your local library if it is available and do the example project. It will really help you develop your pet project if you have one. Other necessary tools:
  • Optional - Balsamiq Mockup for fast prototyping on how your web app will look like.
  • Github for SCM and to show off your source code. It is free for public repositories. Git is also the revision control of choice if you want to become a Ruby on Rails acolyte.
  • Heroku provides free Ruby on Rails web hosting. Their web site doesn't say it explicitly but you can host multiple small Rails web app over there. However, your application won't be able to write to disk when hosted on their server, at least for the free plan. This may or may not be an issue depending on the nature of your project.

    Advanced developer: Pushing data from your local machine to the Heroku server can be tricky because the schema_migrations table has already been created and populated by the time you call:
    rake db:push
    The stupid way to handle this at the moment is to quickly prefix your local schema_migrations with z to become zschema_migrations and invoke the above command. It will fail when it reaches zschema_migrations turn but data from other tables will be uploaded.
This is my opinion on Ruby and Rails and I think developers who are interested of the current buzzword should consider giving it a try. Even if you don't like the Ruby language or Rails framework, you might learn some new approach from the experience. It's the journey that makes it exciting, not the end goal.

Wednesday, August 26, 2009

Learning a new programming language or web framework

Learning at least 1 new programming language, web framework or library per year is imperative these days for any developers to be highly marketable in today's economy. Some might be comfortable to use the same programming language for a decade but the moment you get back on the job market, the demand for that specific technology might have gone down. You might argue that learning the latest cutting edge technology is like hitting a moving target because of their frequent updates but that is what make the developer's life exciting.

Tinkering with a different programming language or web framework can expand your mind on how problems are solved in a different environment. You then gain additional knowledge and have a novel way of thinking when you get back to your day job. Picking what to learn next can be quite overwhelming with the ridiculous number of languages, frameworks and libraries out there. I tend to pick my next new technology by its similarity to what I know best.

In Q1 of 2009, I was looking for a web framework to learn. My choices were numerous at that time between the many PHP frameworks, Django, Turbogears, Rails, Java frameworks and Microsoft's web stack ASP.net. After using Python for nearly 5 years, it was logical for me to gravitate towards a Python web framework like Django or Turbogears. However, given the difficulties I have experienced with TG back in 2007, I have decided to go with Django which has one of the most comprehensive documentation out there in the wild web. From there, I start doing the tutorial and subsequently a personal project which help me a lot to learn some of the intricacies of the framework, web development problems and more Python.

Fast forward to Q3 2009, I am now eating and breathing Python/Django professionally for 40 hours/week for the last month and a half. I now have a new technology itch to scratch, I have messed around with Pylons for the last few weeks, it is another Python web framework which is more modular than the competition. That aside, I find the underlying concept similar to Django but with more freedom.

2 weeks ago, I realized I needed to expand my language portfolio. Having heard a lot of Ruby on Rails chatter through various technology podcasts, I decided to check it out to find out for myself what the fuss was all about. It takes a while to get into it with its various shortcuts. Ruby is the next logical step for me because of some similarity to Python and Rails because of its MVC pattern which is similar to Django and Pylons. On top of making my language library more diverse, I am also trying to see how these other frameworks can solve some of the challenges I am experiencing with Django.

This is not a post on which technology is the best but more of a smooth workflow for anyone who desires to learn a new language or new framework. Here's the summary:
  1. Pick a framework or language which is similar to what you know best.
  2. Start a personal project with it.
  3. Try to work with this new technology at work, school or at home to get a better appreciation of its capabilities.
  4. Once you feel you have gained enough exposure at it, go back to step 1.

Saturday, August 15, 2009

Why you should learn Ruby: there are Ruby branded Thongs and Boxers


No, I was not googling the keywords ruby thong. I have come across those undies on the ruby doc home page while looking for some specific Ruby module. Clicking on the link redirects you to the Ruby undies page. After some further researching on cafepress, I have noticed that they also have Python and Django branded apparels.

The terms eating and breathing a specific technology can now be extended with getting up close and personal with it. I hope the Python and Django sites add a link to those products, it will make them more marketable. Enough writing, I have to order myself one of those boxers.

Sunday, August 9, 2009

Questions to ask potential employers

This year, I have come across The Joel Test which is a list of questions to ask potential employers in the tech industry. Here is my slightly modified list of questions with a focus in Web Application development that I have been asking during my interviews in 2009:
  1. Which revision control system are you using?
  2. Any bug tracking system and internal wiki?
  3. Is the site using any specific web framework?
  4. How many databases does your main web app connect to?
  5. How do developers integrate the latest database changes in their local environment(something similar to Rails' migrate or Django's South)?
  6. Does the web team have a Graphics Designer and a Front End Developer?
  7. Do you use Balsamiq for mockups?
  8. What does the organization hiearchy look like?
  9. Why are you hiring for this opening?
Getting responses for the above questions is necessary for me before I can ask even more questions pertaining to the position and the company itself.