April 8, 2008

How to learn a programming language

Filed under: programming, python — Tags: , , — Bart @ 2:15 pm

LEARN JAVA IN 24 HOURS!!! Sadly, it won’t be this fast but there are some ways you can speed up the process of learning a programming language.

Just like with anything, learning something new is best done when it’s not crammed, you interact, and you basically dwelve yourself into it. Without further ado, here are 3 ways you can promote the speed and depth of your learning. For my post, I will be using Python as an example as it was my most recent learning.

Read. Read. Read

Do you like reading books? Well that’s great, because for the next while you’re going to be reading about list comprehensions, variable casting, and data control and not about wizards and dragons. Reading online documentation is great, but sometime it just doesn’t do it. I LOVE getting a well written book on a language/system and getting into it. Reading “Python in a Nutshell” was a great experience because the book was well written and I was able to learn a lot. Plus I now have a bookmarked and tagged (old school sticky note tagging!) book for reference. It is of course important, to find the right book or it may become a mind numbing experience.

Get Involved.

Python has an IRC channel, Google news group, and much more. In these, you and others are free to ask and answer questions. One of the best ways I’ve found to learn was to sit in these channels and simply watch as the questions and answers come in. Sometimes I will have my own, and sometimes as I become more informed in the language I too can answer my own questions. It is a great feeling to go from being a totally novice to answering a question for someone, and I find it to be one of my greatest motivators to keep pushing and learning.

irc.freenode.net is a great IRC network filled with various channels for open source platforms and projects. Google Groups is also a great reference and has groups for nearly everything. You are also very likely to find Googlers and the guys who are part of the core on their posting :)

Just code already!

Reading is nice and all, but it makes me feel like a university student sitting in a lecture. Every time you have gained new knowledge of something, apply it! Write a small app, or extend your current one with your new findings. A good example of this is I learned Python list comprehensions and I was able to modify a lot of my code to make it more readable and smaller.

There is no point in learning a new language and then not updating your application(s) with your new findings, it may seem like more work, to have to re-write things now and then, but it allows you to look back at your code, make it cleaner, faster, find oddities that you didn’t notice before, and ship a better product in the end.

And that about wraps it up. Most of it this is common knowledge, but sometimes it needs to be drilled into your head. Hopefully it has helped!

February 8, 2008

Why Django and Python just won my heart

Filed under: programming, python — Tags: , , , — Bart @ 9:21 pm

As of yesterday, I completed my first Django app. Django is a high-level Python web framework designed for rapid development and quick deployment. Did it deliver? Oh god yes.

Coming into this project, my Python skill was hurting. I had not written a real Python application in a few months and before that, I never had a solid grasp of Python to begin with.

So why did Django make me so happy? First off, in a weeks time, a few hours here and there throughout the week, I managed to: Create a fully functional website with ability to add new posts (Along with card specials, release schedules), polls, a simple member registration, and of course a fully functional admin panel that made it easy for my client to add content to their site. I did this all, with no knowledge of Django before hand!

Some highlights of the Django framework:

  • Installing and configuring Django takes about 15 minutes for a newbie. Download the project from SVN (At this point in its development, this is a good idea), untar it, modify some settings and you’re golden
  • Setting up a project is simple with manage.py, the core of Django’s management capabilities. Setup the project, then setup your first app, and within a minute you are ready to fly.
  • For each application, Django creates a views.py, models.py and urls.py. These three files are the core of your program and it makes it super easy. Define your table and any core functions in models.py for that application (Ie: News Posts app), setup the templates you will pump out in views.py, and urls.py is if you want to get down and dirty with url structures.
  • syncdb and django admin are amazing. I cannot stress this enough. Define your models in models.py, run syncdb and all your tables (including multi-relational ones!), primary keys, etc are ALL CREATED! I love it!
  • Once all your tables are created, login to Django admin and you have full functionality to play with all your data. If you setup a DateTime variable in your model, the admin displays that field with a nice Javascript calendar popup.
  • Python is a sexy language that you will love the more you use it. When I first began playing with Python it was ok, kind of cool, but nothing amazing. The more I learn about Python, the more I love it. I’ve used PHP for years and I honestly can’t bare to look at it after working with Python in the past few months.

There’s a reason why companies like Google and NASA have adopted some of their technologies around Python, because it is code sex. Yes, I like that term.

To try out Django, check out these resources:

  • The official Django project site has a great documentation and beginners tutorial.
  • The B-List has some good code example and tutorials for Python/Django.
  • #django on irc.freenode.net has some great people. Magus- is a total dick, but very helpful ;)

December 30, 2007

Someone create this deal/savings mobile service

Filed under: php, programming, python, social, theweb — Tags: , , , — Bart @ 8:46 pm

As I was walking to the grocery store two days ago I had an idea for a simple service that would allow for anyone with a simple internet-enabled cellphone to get deals and special offers at the store(s) you’re going to.  Here is how it would work:

Deal Database (and website)

Create a database of deals. You can do this one of two ways, either create a community-driven site where people would submit special offers and savings from the stores in their area, or create a mash-up of all the current deal sites out there. Only problem is, there are not that many (If at all?) sites that display deals for brick-and-mortar stores, and most focus on online shopping. Each deal would be tagged with the store name, as well as GPS (Or Street address) location.

Using the service

The service would be very simple to use and have two ways you could use it.

  • Simple search: With this method, I could be heading to my local Walmart and go to the services website and type in “Walmart Waterloo”, or “Walmart N2V1K7″ (Postal code search) or any other variety of searches to narrow down your location so you can see the deals for that specified store.
  • Multiple deal search: Similar to the simple search, this one would allow you to search via city, postal code, street, etc and display all the deals from stores in the given area. This way, I could be heading to the mall and get all the deals from the 50+ stores within the mall.
  • GPS/Location search: This one could work for GPS-enabled phones as well as any phone that can access Google Maps as it can now track your location as well. With this, I could simply log into the site and see all the deals within my area via a Google maps mash-up, or maybe a simple text feed depending on the power of my phone. Additionally, you could also simply search for “Walmart” and it will know your location via GPS and show deals for the Walmart near you.

With user settings, the user could simply setup what they would like to always use, but the initial setup would promote a more simple search, unless we can check and identify if the phone is GPS-enabled (Can you do that?)

That’s my idea in a nutshell, obviously there is a bit more to it but this is just a simple blurb on it. As for making money, programming it and publishing it, that’s another story.

If anyone is interested on working with me on something like this, let me know, otherwise tell me how silly my idea is.

October 5, 2007

Programming IDE’s: Like finding the perfect mate

Filed under: javascript, php, programming, python — Tags: , , , — Bart @ 3:17 pm

(more…)

October 2, 2007

Refactor my code, your code, everyones code!

Filed under: php, programming, python — Tags: , — Bart @ 5:32 pm

(more…)

Powered By WordPress