Posts

Showing posts from February, 2012

Adventures in Javascript MVC

I'm working on a project now which uses javascript mvc(jsmvc). I was tasked with enhancing site search to add functionality, but it morphed into also converting existing search to mvc pattern using jsmvc. Having used backbone.js last October to build an mvc front end, this would be a useful opportunity to learn jsmvc and also compare and contrast to backbone.js The existing search was not badly written by any means and followed the javascript module pattern . But with jsmvc I could separate the code into the model(s), views(s) and controller(s) and decompose the problem rather than use 1 big module. The resulting refactored code is 5 view templates, 2 controllers and 3 models. Such breakup of the code is making the code more reusable and more flexible. Very good net effect. The Javascript MVC documentatio n is real good, the jsmvc wiki is also helpful if a little outdated. There are tutorials and examples , but searching on google, I see alot more Backbone.js tutorials on

Javascript MVC automatically supports hierarchy of model objects

This is pretty cool...checkout the Associations section in this link and expand the Demo example source code to see an example    http://javascriptmvc.com/ docs.html#!jQuery.Model. static.attributes   Each Contact has a list of Tasks and they defined tasks in attributes of the Contact Model. Because the json data comes back as an json array with property name "tasks" then jsmvc will automatically hydrate Task objects within each Contact into a "tasks" attribute   ....then to get tasks for a contact object you say:  var   tasks = contact.attr( 'tasks' ); { 'id' : 2 , 'name' : 'Brian Moschel' , 'birthday' : '1983-11-10' , tasks : [{id: 2 , title: "write up funcunit" , due: "2009-5-1" }, {id: 3 , title: "test funcunit" , due: ...... That some pretty "strick   slick " and is powerful OO support. If you have such an object hierarchy I'd recommend you follow

Photoshop tips and how-tos incl image slicing for Web and using sprites

I had some great how-tos on Photoshop and lost them :-( So here's the rebuild. Tool Pallet Slice tool: on pallet is one of 3 of crop, slide and slide select  Move tool: dashed box in pallet, then draw round the item, then click and hold mouse and drag the item Line tool: 8th from bottom, used to draw lines Layers - you can temporarily turn off every other layer in the Layers palette   except   for that one layer by holding down your   Alt   (Win) /   Option   (Mac) key and clicking on the   Layer Visibility   icon. To turn all the layers back on again, hold down   Alt   (Win) /   Option   (Mac) and click again on the same   Layer Visibility   icon. More Slice for web Useful links on how to here and here Clear Slices : View -> Clear Slices (when slice tool is selected from pallet) Pixel Perfect to the PSD To compare your work to the PSD image do the following - Open Mac Grab tool (Cmd - Space) - Choose window button and then click the window to grab - when

Amazon NoSQL DynamoDB

Having used Amazons SimpleDB NoSQL Cloud database on a customer project I was interested in Amazons newly released cloud nosql db offering called DynamoDB. Here's my notes from a webcast about DynamoDB. For massive scale, simple queries and little need for transactions the cost is amazing (see case study below). Includes comparison to SimpleDB at bottom. Amazon DynamoDB In market approx 1 month since Jan 2012 DynamoDB is a NoSQL db, hosted by Amazon, access via Rest Apis Goals: massive scalability, low latency, easy to use. Easy to create the table (use their ui wizard to define a table and adjust scale as needs changes). Amazon provide a calculator to help you calculate out your needs, you tell them Amazon the capacity you need and they handle it. When you provision capacity is reserved. Integrated with CloudWatch, You can setup alarms to alert if pass certain thresholds. Integrated with Elastic MapReduce to perform complex analytics, can export data out to sources lin