For awhile I have wanted to start doing more with my Raspberry Pi than just XBMC. So I decided to build a wireless temperature sensor to monitor the temperature in my kids' rooms.
Part 1 Continued - Saving to mongodb
I decided to build an online course aggregator and introduced the project in this post, and last week I started part 1 explaining the backend and creating the first provider class for coursera. This post I will dive into the storage engines, initially I created two storage engines; mongodb and postgres using sql alchemy.
Part 1 - Creating a python based backend
I decided to build an online course aggregator and introduced the project in this post. This post is part 1 of the series and I will break down how I build the backend aggregation framework. The whole point of this project is to build a full stack application as both a learning exercise and an in-depth blogging topic.
MOOCs are Massive Open Online Courses, and I have had the time to take a few of them. These courses have probably been the best college courses I have taken of any kind, in terms of how much I learned and have been able to apply to my day to day work. This makes sense as I have been able to pick courses that interest me or apply specifically to my job versus my normal course work where the college decides what I need. The other reason they have been great is because they are provided by some of the best universities or professors in that topic.
A few months back I posted that I wanted to away from PHP for web development and started learning some of the major MVC web development frameworks. The first one I tried was Pyramid, and I wrote about creating a blog engine with Pyramid and MongoDB. This was an awesome experience and I loved using it, so next I wanted to try using Django.
You can find many good comparisons on the web. So these are my thoughts after build a blog engine in both systems. Getting started with Django was quicker and easier than with Pyramid because it had everything built in and had much better documentation and tutorials. I loved the kitchen sink manage.py utility vs several Pyramid commands like pserve and pcreate. Also the settings.py was easier and had a better structure than Pyramid's ini files.
In my previous post about creating a blog with Pyramid, I mentioned that I really didn't like Chameleon or Mako (To be fair I never really tried Mako; I just read through the documentation trying to understand how to perform inheritance) templates. A commenter(thanks Matt) suggested I give Jinja2 a try. Some of my gripes (or my lack of understanding) about the those template engines were:
- I couldn't find an easy way to break my templates into various pieces like header, footer, sidebar etc. Then have a layout template that pulls them in, and lastly inserts my individual view on top of that portion of the template.
- The syntax should be easy and I believe template portions of your markup should stand out from the static markup.
- I don't have any concern over speed or jython compatibility and this seems to be a major focus for chameleon.
Chameleon uses a macro language called METAL and it adds a bunch of extra markup to your document and making it less clear over which parts were part of the template and which were static. This became apparent when I was retrofitting my templates to Jinja2 and ripping out the chameleon parts, I kept finding remains of the chameleon templates after I had made the switch.
In my previous post I explained that I wanted to explore new non-php web development frameworks like Rails and Django. So I decided to build a blog engine with each of them and see which framework felt the best. I also decided that if I am going to embark on a relatively time consuming learning project, that I wanted to expand my scope and experiment with Twitter Bootstrap and MongoDB as well.
I have used Python several times in the past, and have never touched Ruby outside of a Hello World rails tutorial. I also have some peers that hate rails (even though they like Ruby), so I decided to start on the Python side of the fence. After some research and discussion with peers I decided to start with Pyramid rather than Django.
Pyramid seems to provide more flexibility when break ingaway from the convention, and considering I wanted to use Mongo instead of SQL this felt like a great place to start. After completing this exercise I found that I really enjoyed working with Pyramid(and Mongo), so much so that I pushed my code to my VPS and went public with my blog. This also delayed my Django and Rails trails as I had to prepare to deploy a production version of my Pyramid site. I will start the Rails version soon, but for now here are the steps I took to create the Pyramid version.
For years I have been hearing about the death of PHP, and I have ignored it. I bought a Rails cookbook a few years ago, but never even opened it. Now, as I write more code in other languages, I see how PHP enables my bad habits. My code get's uglier and uglier as a script ages. I have used MVC frameworks with PHP like Code Ignitor and Zend and they do force better habits, but I really hate singletons. I also just want to learn something new. So I can't ignore it anymore, people and startups are moving away from PHP and are using newer, sexier frameworks.