Archive for the ‘JSON’ category

Setting Input and Selects via JQuery

May 4th, 2012

I thought I would post this quick little blurb about setting your HTML controls from JQuery. Here are the 2 lines that set those property types:

$("#id1").val("Your_String");
$('#id2').append($('<option>', { value: "Your_Value" }).text("Your_String");

And here is the complete Ajax call where I am setting those properties off the returned JSON:

function() {
            $.ajax({
                url: "http://www.yourdomain.com/data.json",
		        dataType: "jsonp",
		        success: function(parsed_json) {
			        var location = parsed_json['location']['city'];
                                $("#id1").val("Your_String");
                                $('#id2').append($('<option>', { value: "Your_Value" }).text("Your_String");
			      		        }
	        });
        }

Database Replication vs. Message-Based system

January 9th, 2012

Replication is a topic I have been keenly interested in the past month or so.  I have been studying various NoSQL database engines including RavenDB, MongoDB, CouchDB to name them in particular.  Each one of the technologies have their strengths and weaknesses but when it comes to replication in particular, CouchDB seems to be way ahead of the game with their implementation of selective, or filtered replication.  I wonder what are the benefits of using a message-based system to get your json documents to your database vs just letting the database handle them via replication.  Any thoughts or comments are welcome.