Posted: February 16th, 2011 | Author: Adam | Filed under: Javascript, programming | 1 Comment »
&yet has a great post today which is beginning to outline the the framework of a “Javascript” ecosystem for a complete web application written all the way through the stack with Javascript. The server-side models and DB structure usually have strong relations to the content being displayed in the browser. For a web store the item has a title, description, price, related items, etc. You have one application model written in one language, displayed in the browser in HTML with some fancy JavaScript to model the object again and handle all the changes. Why duplicate all this code over and over, in different languages? Write it once in backbone and be done.
&yet has taken the stack of
If you are looking at a seamless JavaScript stack, and already are using CouchDB you should also take a look at backbone-couchdb which is taking a different approach to the same complete JavaScript stack concept.
Posted: February 14th, 2011 | Author: Adam | Filed under: CoffeeScript, Javascript, programming | 17 Comments »
If you program in Javascript and haven’t heard of CoffeeScript yet, you are missing out. I’m not going to talk about installing it or the basic usage of it as the original documentation and a few blogs already have talked about it.
What I want to talk about is why it’s so amazing and why I can never write Javascript again. I’ve been programming Python for quite a while now and when you do work on the web (like with Django) you will eventually have to deal with the browser and if you want to do anything beyond basic form processing you’ll need to deal with Javascript.
The maturation of libraries like jQuery has made life, infinitely easier but, Javascript itself is still a strange little language. It’s actually deceptively simple, it that any decent programmer can probably trial and error his/her way through a simple Javascript feature pretty quickly. This is actually one of the strongest features of the language, most people can write Javascript without actually knowing Javascript but, this lack of structure and ease of use is apart of it’s tricky nature. Once you begin to do complicated things the quirks of the language start to arise: undefined oddities, antiquated array manipulation, limited standard library, strange object models, and for me personally as a Python programmer the mess of braces and semi-colons peppering my code with distracting syntax.
CoffeeScript is essentially a combination of a Ruby-esque syntax and a healthy dose of just the good parts from Javascript. What you get is a fairly clean language that always “compiles” into very readable and workable Javascript. Which means anywhere you need to use Javascript: in the browser, in node.js, on the iPhone; you can use CoffeeScript.
I’m going to be writing a few posts playing with CoffeeScript in the future but, right now I’ll give you a few “out-of-the-box” examples of CoffeScript that isn’t just a basic example
Node.js chat server in CoffeeScript
Appcelerator iPhone Application in CoffeeScript
Posted: April 26th, 2010 | Author: Adam | Filed under: Database, NoSQL, Redis | No Comments »
Simon Willison had a great presentation at NoSQL EU recently and published his slides and notes. It’s quite a comprehensive presentation that’s a good read for both beginners and advanced users. He presents some great use cases based off of real world examples and utilization.
http://simonwillison.net/2010/Apr/25/redis/

Posted: March 25th, 2010 | Author: Adam | Filed under: Django, Python, web development | No Comments »
There’s a great reddit thread going with the Onion’s Tech team on their recent transition to Django and this gem is buried in the conversation
Deep link to post
And the biggest performance boost of all: caching 404s and sending Cache-Control headers to the CDN on 404. Upwards of 66% of our server time is spent on serving 404s from spiders crawling invalid urls and from urls that exist out in the wild from 6-10 years ago. [Edit: We dropped our outgoing bandwidth by about 66% and our load average on our web server cluster by about 50% after implementing that change]
Amazing result for such a simple change. Bang for your buck optimizations are always the best ones.
Posted: March 25th, 2010 | Author: Adam | Filed under: Database, NoSQL, Redis | 2 Comments »
Salvatore has posted “part 1″ of the internals of Redis’ Virtual Memory subsystem today. Below is the intro with the link to full documentation on Google Code below.
This document details the internals of the Redis Virtual Memory subsystem. The intended audience is not the final user but programmers willing to understand or modify the Virtual Memory implementation.
Keys vs Values: what is swapped out?
The goal of the VM subsystem is to free memory transferring Redis Objects from memory to disk. This is a very generic command, but specifically, Redis transfers only objects associated with values. In order to understand better this concept we’ll show, using the DEBUG command, how a key holding a value looks from the point of view of the Redis internals.
Read more
Posted: March 24th, 2010 | Author: Adam | Filed under: Database, NoSQL, programming, Python, Redis | 9 Comments »
So just yesterday we posted a tutorial on how to use redis to store relational despite relations not being supported. Soon after we published the documentation on the new redis hash type went online. Now hashes by themselves aren’t exactly relations but, more so an object field store. Extending the same concepts from our first article in namespace utilization and using hashes we can accomplish the same thing in a more formal fashion.
We will repeat the same exercise from the first article, creating a username password store, using hashes.
Read the rest of this entry »
Posted: March 23rd, 2010 | Author: Adam | Filed under: NoSQL, programming, Python, Redis | 5 Comments »
In the first article in our series on Redis we talked about how to get started and the basics of the simple data structures that are available in redis. The simple structures are good for basic operations like storing strings and keeping counters but, using it for anything more complex requires relating one set of data to another. At first glance this is a bit of a problem since redis by design is a flat dictionary with no relations but, with a bit of application code and adherence to some mental programming standards you can build some quite complex applications using redis.
Read the rest of this entry »
Posted: March 22nd, 2010 | Author: Adam | Filed under: NoSQL, programming, Python, Redis | 18 Comments »
So if you have been following NoSQL movement, the migration of some types of data to non-relational datastores has recently picked up speed. For web (and other developers) this has lead to some impressive engineering resources developing some amazing tools being open sourced for the world to use. One that caught my eye recently has been Salvatore Sanfilippo’s redis which has been taken under the wing of VMWare, solidifying and validating the great work that Salavatore has done making redis an amazing tool in any developers arsenal.
A very simplified explanation of redis is that it is an in memory key-value store like memcached but, it is persistent on disk, unlike memcached which is volatile. Along with being disk-persistent redis also supports some basic data structures like lists, sets, ordered sets, hashes, and of course basic key-value string storage like memcached. Redis, with disk-persistence and basic data structures, remains blazing fast with published benchmarks of 110,000 SETs per second, about 81,000 GETs per second.
This post is the start of a series of articles on redis for Python programmers. A prerequisite for this is going to be some basic Python knowledge, which if you haven’t used before I highly recommend the free web book Dive Into Python. This is going to be a simple overview of the basic data types and usage for Python programmers and we will slowly progress into more complex usages, so if you haven’t done anything with redis before this is a perfect start.
Read the rest of this entry »
Posted: March 21st, 2010 | Author: Adam | Filed under: Django, programming, Python | 1 Comment »
So far in the tutorial we’ve started our project, setup the database, enabled the admin interface, created models for our blog, and we just did a brief tutorial on Django’s ORM and DB-API. Now let’s look at getting data out of our database and onto the web page using views.
This section will be a bit short because we won’t really be using templates, which we’ll cover in the next section. We will just be looking at how the urls.py file and the views.py file interact and how we can use what we learned in our ORM tutorial not in the shell but, in our application.
Read the rest of this entry »
Posted: March 20th, 2010 | Author: Adam | Filed under: Django, programming, Python | 58 Comments »
So far in the tutorial we’ve started our project, setup the database, enabled the admin interface, created models for our blog. We’re going to slow down on actually developing our blog and talk about exactly how we get to the data we’ve stored in the database so far. The Admin Interface is great but, it doesn’t provide good programtic access to the data. Let’s open up a python shell but, we’re going to do it a special way when working with Django. From the command line in our root project directory (blog/)
$ python manage.py shell
Python 2.5 (r25:51918, Sep 19 2006, 08:49:13)
[GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>>
Now this might look like a normal Python shell because, well it is. We’ve just loaded up some stuff in the background like path information to make our lives a bit easier. Now we have two models that we created in the application “main”. Let’s load those up in the shell.
Read the rest of this entry »
Recent Comments