<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>json &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://en.wordpress.com/tag/json/</link>
	<description>Feed of posts on WordPress.com tagged "json"</description>
	<pubDate>Tue, 21 May 2013 04:57:11 +0000</pubDate>

	<generator>http://en.wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[Part 2 of Finally a SharePoint Designer that Developer and BAs will Love]]></title>
<link>http://fabiangwilliams.wordpress.com/2013/04/29/part-2-of-finally-a-sharepoint-designer-that-developer-and-bas-will-love/</link>
<pubDate>Mon, 29 Apr 2013 23:36:00 +0000</pubDate>
<dc:creator>fabiangwilliams</dc:creator>
<guid>http://fabiangwilliams.wordpress.com/2013/04/29/part-2-of-finally-a-sharepoint-designer-that-developer-and-bas-will-love/</guid>
<description><![CDATA[Purpose of this Blog Post &amp; Primer for this Post This post follows up on a previous post below w]]></description>
<content:encoded><![CDATA[<h2>Purpose of this Blog Post &#38; Primer for this Post</h2>
<p>This post follows up on a previous post below where we discussed Workflows in SharePoint 2013 through the eyes of SharePoint Designer 2013 and Visio Professional 2013. Part 1 is linked below, this is Part 2</p>
<p><strong><a href="http://fabiangwilliams.wordpress.com/2013/04/24/finally-a-sharepoint-designer-that-developers-and-bas-will-love/" target="_blank">Part 1 – Stages, Steps, Loops, and Visio Professional 2013</a></strong></p>
<p>In the above post (this one) I will go about showing you the tooling and various simplistic but apropos examples designed solely to drive the usage home, in Part 2 we will use everything in a practical REAL WORLD sense </p>
<p><strong>Part 2 – Put it all together with HTTP Service Calls via REST and the Dictionary Object/ Variable</strong></p>
<p>In this post I will take a Publicly Available REST API probably the Weather API or Twitter API and use the HTTP Web Request along with the Dictionary Variable in SPD 2013 to surface it in a SharePoint Promoted Links App (List)</p>
<h2>What is the Dictionary Object/ Variable</h2>
<p>Simply put a Dictionary Variable is an Array i.e. a collection of related items that is indexed/indexable but in more detail it is a container designed to hold a collection of other variables which can be of a different data types. Specifically we have the following actions out of Dictionary</p>
<ul>
<li>Build Dictionary </li>
<li>Count Items in a Dictionary </li>
<li>Get an Item from a Dictionary </li>
</ul>
<p><a href="http://fabiangwilliams.files.wordpress.com/2013/04/image20.png"><img title="image" style="display:inline;border-width:0;" border="0" alt="image" src="http://fabiangwilliams.files.wordpress.com/2013/04/image_thumb20.png?w=324&#038;h=500" width="324" height="500" /></a></p>
<p>Now before we get too deep into The Dictionary Variable/Object, lets take each of these actions one at a time in a simple scheme and see what they do exactly; kick the tires so to speak, in our real world example we will NOT be creating the Dictionary Object as much as consuming JSON data and dumping the JSON data inside a dictionary object. You get it right? JSON data usually comes across as a JSON Array or JSON object, in our case we want that JSON array, even if it is one item, the Dictionary Object/Variable EXPECTS to see an array, I actually wrote a blog post <a href="http://fabiangwilliams.wordpress.com/2012/12/31/limitations-when-using-sharepoint-2013-workflows-to-return-json-data/">http://fabiangwilliams.wordpress.com/2012/12/31/limitations-when-using-sharepoint-2013-workflows-to-return-json-data/</a> explaining that issue, which i think is a <font color="#ff0000"><strong>BUG</strong></font> that should be handled by the SharePoint Team.&#160; But lets leave that on one side for the moment and get back into our intended post. </p>
<h2>It is ALL explained Here</h2>
<p>As mentioned earlier, a Dictionary Object may be considered a collection of related items. Now to drive this point home lets use what we have at our disposal, in fact we will use two (2) examples, the first of which is to simply build on what we did in Part 1 using the Bank of Fabian Example.&#160; You see, there are ALOT of post out there that do a good job of explaining to you how to get Weather Data, Twitter Data, ITunes Data, you know all the public REST JSON available stuff, and granted I will do one here as well in example number two in the spirit of being complete. However, what you don&#8217;t often see is showing how to use SharePoint own REST OData examples, so I will do one here. Lets set it up for you.</p>
<h3>Our Use Case</h3>
<p>Now I&#8217;m a big believer in Use/Business cases when doing Demos’ and not doing parlor tricks for the sake of “Hey! Look at this cool new stuff I can do”, so The idea here is that</p>
<p>1. You can consume data from ANY SharePoint List as long as you have an account that has permission or an App that does, and then act on or manipulate data from inside your Site Collection [assuming a Site Workflow here]</p>
<p>2. You want to expose data/information to an audience that doesn&#8217;t have access to certain data or hosted elsewhere</p>
<p>Web Site:&#160; <a href="http://adotob.sharepoint.com">http://adotob.sharepoint.com</a> (this is my Office 365 Dev Site)    <br />List Instance: <a title="https://adotob.sharepoint.com/_layouts/15/start.aspx#/Bank%20of%20Fabian" href="https://adotob.sharepoint.com/_layouts/15/start.aspx#/Bank%20of%20Fabian">https://adotob.sharepoint.com/_layouts/15/start.aspx#/Bank%20of%20Fabian</a></p>
<p><a href="http://fabiangwilliams.files.wordpress.com/2013/04/image21.png"><img title="image" style="border-top:0;border-right:0;border-bottom:0;border-left:0;display:inline;" border="0" alt="image" src="http://fabiangwilliams.files.wordpress.com/2013/04/image_thumb21.png?w=631&#038;h=302" width="631" height="302" /></a> </p>
<p>So from the above we can tell that we have a list called …/bank%20of%20fabian and it has currently 5 items inside it yes? Ok, good. Now in order for us to get to that data we can call on our SharePoint oData service located here</p>
<p><a href="https://adotob.sharepoint.com/_api/web/lists/getbytitle('Bank%20of%20Fabian')/items">https://adotob.sharepoint.com/_api/web/lists/getbytitle(&#8216;Bank%20of%20Fabian&#8217;)/items</a></p>
<p>Now you should understand that SharePoint 2013 REST APS doesn&#8217;t understand the $json options so, it will render its result in XML, however there are quite a few tools out there that can convert your XML to JSON. In fact if you adjust your request header on your call yourself in Fiddler or in browser extension such as Chrome or FireFox, you can get the visual effect you are looking for as well.&#160; So lets see what happens when you click on the link here for the REST API call</p>
<p><a href="http://fabiangwilliams.files.wordpress.com/2013/04/image22.png"><img title="image" style="border-top:0;border-right:0;border-bottom:0;border-left:0;display:inline;" border="0" alt="image" src="http://fabiangwilliams.files.wordpress.com/2013/04/image_thumb22.png?w=585&#038;h=416" width="585" height="416" /></a> </p>
<p>Now that is NOT going to be useful to us, so I will use this Chrome extension called ChangeHTTPRequest and after putting in my header i need which is</p>
<p><strong>Accept: application/json;odata=verbose</strong></p>
<p>I get the below</p>
<p><a href="http://fabiangwilliams.files.wordpress.com/2013/04/image23.png"><img title="image" style="border-top:0;border-right:0;border-bottom:0;border-left:0;display:inline;" border="0" alt="image" src="http://fabiangwilliams.files.wordpress.com/2013/04/image_thumb23.png?w=577&#038;h=455" width="577" height="455" /></a> </p>
<p>Now admittedly that is also difficult to read, so you should invest in the FREE JSON Viewer I always use and its Waaayyy cleaner, just cut and past the entire content and you can see what I mean.</p>
<p><a href="http://fabiangwilliams.files.wordpress.com/2013/04/image24.png"><img title="image" style="border-top:0;border-right:0;border-bottom:0;border-left:0;display:inline;" border="0" alt="image" src="http://fabiangwilliams.files.wordpress.com/2013/04/image_thumb24.png?w=573&#038;h=651" width="573" height="651" /></a> </p>
<p>So now that we have established some “Trust but Verify” credibility, next lets look at what we need to do in SharePoint Designer 2013 (SPD2013) to move this forward. We will be Demonstrating the following Capabilities in this Example</p>
<ol>
<li>How to use Dictionary Variable/Object</li>
<ol>
<li>We will build a Dictionary Variable to hold our HTTP Header information so we can get JSON Data</li>
<li>We will Count Items in a Dictionary Variable so we can get the “Count” value of all items in there to assist us in our “Loop” that we may iterate through all the items in the Dictionary</li>
<li>Get Items from the Dictionary that we may use to (as in our case) Write to the Log History so we can see what we are consuming, but in our Part 2 Example coming up using PUBLIC REST JSON data we will use that data to load into a ListItem</li>
</ol>
<li>Call a HTTP Web Service</li>
<ol>
<li>We will call that webservice we discussed above to get oData back</li>
<li>We will discuss the other Dictionary Variables we will need in Support of this Call such as our ResponseContent and our subset of Data we want to inspect</li>
</ol>
<li>Do a Loop</li>
<ol>
<li>We will use the total items count that we got from our “Count Items in a Dictionary” Action as our loop counter max value in our Loop construct</li>
</ol>
</ol>
<h2>Lets Build out our Workflow</h2>
<p>The first thing we will do is create a Site Workflow</p>
<p><a href="http://fabiangwilliams.files.wordpress.com/2013/04/snaghtml1c311bfc.png"><img title="SNAGHTML1c311bfc" style="border-top:0;border-right:0;border-bottom:0;border-left:0;display:inline;" border="0" alt="SNAGHTML1c311bfc" src="http://fabiangwilliams.files.wordpress.com/2013/04/snaghtml1c311bfc_thumb.png?w=421&#038;h=282" width="421" height="282" /></a></p>
<p>So in keeping with “Fabian’s <strike>Best </strike>Better Practice” we will stub out our Stages and Get some basic Logic out of the way</p>
<p><a href="http://fabiangwilliams.files.wordpress.com/2013/04/image25.png"><img title="image" style="border-top:0;border-right:0;border-bottom:0;border-left:0;display:inline;" border="0" alt="image" src="http://fabiangwilliams.files.wordpress.com/2013/04/image_thumb25.png?w=452&#038;h=396" width="452" height="396" /></a> </p>
<p>Once that is done the first thing we will do is build a Dictionary Variable to hold two items we need in order to get JSON data to be returned; we need to set the <strong><u>Accept</u></strong> and <strong><u>Content-Type</u></strong> HTTP header so the browser knows what we expect. We click Action then under Core Actions you will find Build Dictionary, because I use it a lot it is in my Recent Actions also</p>
<p><a href="http://fabiangwilliams.files.wordpress.com/2013/04/image26.png"><img title="image" style="border-top:0;border-right:0;border-bottom:0;border-left:0;display:inline;" border="0" alt="image" src="http://fabiangwilliams.files.wordpress.com/2013/04/image_thumb26.png?w=356&#038;h=302" width="356" height="302" /></a> </p>
<p>Once you click on ‘Build Dictionary’ you will get…</p>
<p><a href="http://fabiangwilliams.files.wordpress.com/2013/04/image27.png"><img title="image" style="border-top:0;border-right:0;border-bottom:0;border-left:0;display:inline;" border="0" alt="image" src="http://fabiangwilliams.files.wordpress.com/2013/04/image_thumb27.png?w=442&#038;h=305" width="442" height="305" /></a> </p>
<p>1 – You will then click on ‘this’ which will open up the dialog in [2] and in turn you will click the Add button. In doing so you will enter two Variables into this Dictionary Variable of String Data Type as aforementioned, in [3] I am showing you how i do it for the Accept header attribute.</p>
<p><a href="http://fabiangwilliams.files.wordpress.com/2013/04/image28.png"><img title="image" style="border-top:0;border-right:0;border-bottom:0;border-left:0;display:inline;" border="0" alt="image" src="http://fabiangwilliams.files.wordpress.com/2013/04/image_thumb28.png?w=348&#038;h=223" width="348" height="223" /></a> </p>
<p>When you are done, click the Ok Button. <strong>AND NOW YOU HAVE SEEN HOW TO CREATE A DICTIONARY VARIABLE</strong> and an acceptable use of it.</p>
<p>Next we will “Call the HTTP Service” by again clicking Actions in the Ribbon and then…</p>
<p><a href="http://fabiangwilliams.files.wordpress.com/2013/04/image29.png"><img title="image" style="border-top:0;border-right:0;border-bottom:0;border-left:0;display:inline;" border="0" alt="image" src="http://fabiangwilliams.files.wordpress.com/2013/04/image_thumb29.png?w=545&#038;h=365" width="545" height="365" /></a> </p>
<p>So again by clicking [1] ‘this’ we get the dialog box to enter the information about our HTTP REST Service which in this case we click on the ellipse [2] and put our workflow variable we created earlier that holds our URI, then we click [3] the OK Button.</p>
<p>Oh… i forgot something, but we can do that now… so you see in the above figure the second line has the (Output to Variable:dictionary) right? so I like to tidy up my Variable name, so what I do is click on the word ‘dictionary’[1] and create a NEW variable called RequestHeaders [2]</p>
<p><a href="http://fabiangwilliams.files.wordpress.com/2013/04/image30.png"><img title="image" style="border-top:0;border-right:0;border-bottom:0;border-left:0;display:inline;" border="0" alt="image" src="http://fabiangwilliams.files.wordpress.com/2013/04/image_thumb30.png?w=394&#038;h=222" width="394" height="222" /></a> </p>
<p>Now that that is done, we want to further configure the Service Request Call so we will ‘Right Click’ on our ‘Call’ and then Click on Properties..</p>
<p><a href="http://fabiangwilliams.files.wordpress.com/2013/04/image31.png"><img title="image" style="border-top:0;border-right:0;border-bottom:0;border-left:0;display:inline;" border="0" alt="image" src="http://fabiangwilliams.files.wordpress.com/2013/04/image_thumb31.png?w=530&#038;h=129" width="530" height="129" /></a> </p>
<p>Then I want to set the “RequestHeaders” Property to my Dictionary Variable “RequestHeaders”</p>
<p><a href="http://fabiangwilliams.files.wordpress.com/2013/04/image32.png"><img title="image" style="border-top:0;border-right:0;border-bottom:0;border-left:0;display:inline;" border="0" alt="image" src="http://fabiangwilliams.files.wordpress.com/2013/04/image_thumb32.png?w=244&#038;h=215" width="244" height="215" /></a> </p>
<p>and then click the OK Button.</p>
<p>Next we will need to ALSO create another Dictionary Variable to actually HOLD the data that&#8217;s coming back, if I haven&#8217;t said it before, that data comes back in the form of a JSON Array and the Dictionary Variable is the only object suitable to accept that data. So </p>
<p><a href="http://fabiangwilliams.files.wordpress.com/2013/04/image33.png"><img title="image" style="border-top:0;border-right:0;border-bottom:0;border-left:0;display:inline;" border="0" alt="image" src="http://fabiangwilliams.files.wordpress.com/2013/04/image_thumb33.png?w=562&#038;h=169" width="562" height="169" /></a> </p>
<p>and we name it ‘JSONResults’ so if we inspect the properties again you will see that we have everything we need now to call out to our HTTP Service and get meaningful results back</p>
<p><a href="http://fabiangwilliams.files.wordpress.com/2013/04/image34.png"><img title="image" style="border-top:0;border-right:0;border-bottom:0;border-left:0;display:inline;" border="0" alt="image" src="http://fabiangwilliams.files.wordpress.com/2013/04/image_thumb34.png?w=517&#038;h=353" width="517" height="353" /></a> </p>
<p>So now we can actually got GET the DATA now, by using yet another Action in the SPD2013 Ribbon, this time its the ‘Get Item from Dictionary’ Action</p>
<p><a href="http://fabiangwilliams.files.wordpress.com/2013/04/image35.png"><img title="image" style="border-top:0;border-right:0;border-bottom:0;border-left:0;display:inline;" border="0" alt="image" src="http://fabiangwilliams.files.wordpress.com/2013/04/image_thumb35.png?w=383&#038;h=195" width="383" height="195" /></a> </p>
<p>Once we do that we will want to click the ‘item by name or path’ link and give it the SUBSET or WHOLE path to the data we inspected in our JSON Viewer or whatever tooling you have to determine what you need. In our case we want the “d/results” subset then we will use the Index variable to get each line item. Furthermore we will want to store this information AS WELL into another Dictionary Variable. </p>
<p><a href="http://fabiangwilliams.files.wordpress.com/2013/04/snaghtml1c5cf00d.png"><img title="SNAGHTML1c5cf00d" style="border-top:0;border-right:0;border-bottom:0;border-left:0;display:inline;" border="0" alt="SNAGHTML1c5cf00d" src="http://fabiangwilliams.files.wordpress.com/2013/04/snaghtml1c5cf00d_thumb.png?w=569&#038;h=181" width="569" height="181" /></a></p>
<p>So in [1] you have me setting the path based on what i want from evidence in the JSON Viewer, then in [2] I am showing you the relationship of use getting the values from the HTTP Call made earlier and finally [3] I&#8217;m dumping that data into another Dictionary Object. </p>
<p><a href="http://fabiangwilliams.files.wordpress.com/2013/04/snaghtml1c5eb07e.png"><img title="SNAGHTML1c5eb07e" style="border-top:0;border-right:0;border-bottom:0;border-left:0;display:inline;" border="0" alt="SNAGHTML1c5eb07e" src="http://fabiangwilliams.files.wordpress.com/2013/04/snaghtml1c5eb07e_thumb.png?w=215&#038;h=200" width="215" height="200" /></a></p>
<p>if you forgot here is what i need to build that path take a look above at [1], then [2] to get my Array. In [3] I will use that below using the Index Variable inside a Loop Construct.</p>
<p>So that brings us to the last unique item we will be doing in our Dictionary Item and that is to get a COUNT of all the items in the Dictionary We Need. So again we go to the SPD2013 ribbon</p>
<p><a href="http://fabiangwilliams.files.wordpress.com/2013/04/snaghtml1c6355f1.png"><img title="SNAGHTML1c6355f1" style="border-top:0;border-right:0;border-bottom:0;border-left:0;display:inline;" border="0" alt="SNAGHTML1c6355f1" src="http://fabiangwilliams.files.wordpress.com/2013/04/snaghtml1c6355f1_thumb.png?w=429&#038;h=264" width="429" height="264" /></a></p>
<p>and we now need to tell the action which Dictionary Item to count, REMEMBER we want the one that we did the Subset of, not the one returned from the Service Call.</p>
<p><a href="http://fabiangwilliams.files.wordpress.com/2013/04/snaghtml1c65a1a0.png"><img title="SNAGHTML1c65a1a0" style="border-top:0;border-right:0;border-bottom:0;border-left:0;display:inline;" border="0" alt="SNAGHTML1c65a1a0" src="http://fabiangwilliams.files.wordpress.com/2013/04/snaghtml1c65a1a0_thumb.png?w=438&#038;h=255" width="438" height="255" /></a></p>
<p>Above [1] we are referencing our Subset Data and we are creating a new Variable of Integer type [2] to put that Number in. NOW this is an important distinction as well because what we have here is our UPPERBOUND number in the Array for out Loop Counter <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  smart huh LOL</p>
<p>Next we will enter the Stage “Loop and Write out our Data we Need” and put a Conditional Loop inside there that will use the Index value of 0 to start and STOP when we have reached the UPPERBOUND value of items in the array</p>
<p><a href="http://fabiangwilliams.files.wordpress.com/2013/04/image36.png"><img title="image" style="border-top:0;border-right:0;border-bottom:0;border-left:0;display:inline;" border="0" alt="image" src="http://fabiangwilliams.files.wordpress.com/2013/04/image_thumb36.png?w=362&#038;h=211" width="362" height="211" /></a> </p>
<p>Now when that&#8217;s all done, WE are done, one more Screen Shot and some guidance and you can take a mental break..</p>
<p><a href="http://fabiangwilliams.files.wordpress.com/2013/04/image37.png"><img title="image" style="border-top:0;border-right:0;border-bottom:0;border-left:0;display:inline;" border="0" alt="image" src="http://fabiangwilliams.files.wordpress.com/2013/04/image_thumb37.png?w=607&#038;h=391" width="607" height="391" /></a> </p>
<p>Now admittedly its a bit busy, and yes, its been hours now since I started on this blog and fatigue is setting in <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  but I think i can capture everything I need to say here, and I will wrap up as usual with a video. So we are setting the Initialize and Upper bound of our Loop counter in [1] and [2] respectively. In [3] we are actually going to WRITE OUT TO THE LOG the information garnered from the above two lines and the remainder is the Loop Counter which you saw in Part 1, so now time for the video of it all.</p>
<div id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:0ba6b341-08e1-4825-9e04-c67fefbaf093" class="wlWriterEditableSmartContent" style="float:none;margin:0;display:inline;padding:0;">
<div><span class='embed-youtube' style='text-align:center; display: block;'><iframe class='youtube-player' type='text/html' width='640' height='390' src='http://www.youtube.com/embed/K4ey6vt41Ko?version=3&#038;rel=1&#038;fs=1&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' frameborder='0'></iframe></span></div>
</div>
<p>So this blog post is long enough, what I will do for the External Data Call is do it in another Post and I will Link to it here. Hope you learned something new. </p>
<div id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:081ace9a-9606-40e5-950f-61f6c69d0fec" class="wlWriterEditableSmartContent" style="float:none;margin:0;display:inline;padding:0;">del.icio.us Tags: <a href="http://del.icio.us/popular/SharePointFabian" rel="tag">SharePointFabian</a>,<a href="http://del.icio.us/popular/SharePoint+Designer" rel="tag">SharePoint Designer</a>,<a href="http://del.icio.us/popular/Workflows" rel="tag">Workflows</a>,<a href="http://del.icio.us/popular/SharePoint+2013" rel="tag">SharePoint 2013</a>,<a href="http://del.icio.us/popular/Fabian+Williams" rel="tag">Fabian Williams</a></div>
<p>Cheers</p>
<p><em><u>Up Next – Addendum to Part 2 showing an External HTTP Service Call using REST/JSON [Hyperlink forthcoming]</u></em></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Run Example in Giraph: Shortest Paths]]></title>
<link>http://marsty5.wordpress.com/2013/04/29/run-example-in-giraph-shortest-paths/</link>
<pubDate>Mon, 29 Apr 2013 19:47:26 +0000</pubDate>
<dc:creator>marsty5</dc:creator>
<guid>http://marsty5.wordpress.com/2013/04/29/run-example-in-giraph-shortest-paths/</guid>
<description><![CDATA[When planning to run a code in Giraph, I ask myself some questions. When I answer to all my question]]></description>
<content:encoded><![CDATA[<p>When planning to run a code in Giraph, I ask myself some questions. When I answer to all my questions, I move to actually implement and run the code. (so I kinda discuss a lot with myself :p). Let&#8217;s have a look to this inner discussion &#8211; while running the Shortest Paths problem.</p>
<p>~~~~~ Q#<strong>1</strong>: What&#8217;s the Shortest Path problem?</p>
<p><strong>Problem Description</strong>: Find the shortest path between 2 vertices in a graph, so that the sum of weights of the edges in the path is minimized. The example given in Giraph finds the shortest path from each vertex to the source-vertex.</p>
<p>~~~~~ Q#<strong>2</strong>: How can this be implemented in Giraph?</p>
<p><strong>Think &#8220;<em>Pregely&#8221;</em></strong>: Since in Pregel the same code is executed in all vertices at the same time, we need to think as we are a vertex.<!--more--></p>
<p>So, I am a vertex. I should receive messages, make some computation and send messages. If I am the source-vertex, then no edges are needed to reach myself and therefore the shortest path to myself is weighted to zero. Otherwise, I want to find the shortest path to the given source vertex. I do not know any information other than: (i) my Id (not so useful in this example), (ii) my value (which is initialized to a maximum constant at the beginning), (iii) the values on the edges going out from me (read from input file) and (iv) the messages I receive from neighbors (computed during this phase). Since <strong>I do not know what&#8217;s going on between me and the source</strong> (how many other vertices exist, how much they weight), <strong>I should receive messages with the sum of edges-weights from the source up to me</strong>. From all the messages I receive, I choose the minimum sum (this is the shortest path) and make it my value <strong>only if</strong> it&#8217;s smaller than my current value. Then I prepare the messages to be sent to my neighbors; for each of my edges, I add  the edge weight to my value and send the new sum to the destination vertex of this edge.</p>
<p>~~~~~ Q#<strong>3</strong>: How should the main code of Shortest Paths be?</p>
<p>The above computation of the vertex is the compute() method of the algorithm. This algorithm is one of the Giraph examples. <strong>Directory</strong>: giraph-examples/scr/main/java/. <strong>Package</strong>: org.apache.giraph.examples. <strong>Name</strong>: SimpleShortestPathsVertex.java</p>
<p>~~~~~ Q#<strong>4</strong>: What is the <strong>input file</strong>? What information do I need in order to run the algorithm and in what format am I gonna receive this information? Is any of the existing java files for I/O capable to read my input file?</p>
<ul>
<li>The Input File should contain vertices and edges between them with weights on the edges. Let&#8217;s say, each line should have the SourceVertexId, and tubles of DestinationVertexId and EdgeWeight.</li>
<li>The VertexId and EdgeWeight should be of some type: int, double, whatever.</li>
<li>Yes, there is an existing input format, i.e. <strong>JsonLongDoubleFloatDoubleVertexInputFormat</strong>. This file is a Vertex Reader. It expects to receive information for a vertex; a Long Vertex Id, a Double Vertex Value, a Float Edge Value and expects the messages sent/received to transfer Double values. This takes lines in <a href="http://www.json.org/">Json format</a>. A very good explanation of the Json format is given in the comments of the file: &#8220;The files should be in the following JSON format:<br />
<strong>JSONArray(, , JSONArray(JSONArray(, ), &#8230;))</strong>.&#8221;<br />
Here is a simple input file I have created. I give 0 to all vertices values, because anyway the code does not take them into consideration, it initializes them to a MAX constant.</li>
</ul>
<pre>[0,0,[[1,1],[3,3]]]
[1,0,[[0,1],[2,2],[3,1]]]
[2,0,[[1,2],[4,4]]]
[3,0,[[0,3],[1,1],[4,4]]]
[4,0,[[3,4],[2,4]]]</pre>
<p>~~~~~ Q#5: What is the <strong>output file</strong>? What do I want to print in the output file? Is any of the existing java files for I/O capable to generate the desired output file?</p>
<ul>
<li><span style="line-height:13px;">The Output File should contain all vertices with the value of their shortest path to the source-vertex. Let&#8217;s say, each line should have the VertexId and the the Sum of the weights for its shortest path.</span></li>
<li>The VertexId and the Sum should be of some type, int, double, whatever.</li>
<li>Yes, there is an existing output format, i.e. <strong>IdWithValueTextOutputFormat</strong>. This writes out vertices&#8217; IDs and values.</li>
</ul>
<p>~~~~~ Q#6: How do I run the algorithm?</p>
<p>Start the MapReduce and run the Giraph command line.</p>
<p>1. In the hadoop directory run:</p>
<pre>bin/start-dfs.sh
bin/start-mapred.sh</pre>
<p>2. Create the input folder in the HDFS and move the input file there.</p>
<pre>hadoop fs -mkdir /in
hadoop fs -put /local-directory-to-input-file/input_file /in/</pre>
<p><span style="line-height:13px;">3. Run the command, in which you should include: (i) the jar file generated when installing giraph, (ii) the path to the main code, (iii) the path to the code for reading the input file and the path to the input file, (iv) the path to the code for generating the output file and the path to the output file, (v) the number of workers. Below I give all these parameters in the same order.</span></p>
<p>hadoop jar /directory-to-giraph/giraph-core/target/<strong>giraph-0.2-SNAPSHOT-for-hadoop-0.20.203.0-jar-with-dependencies.jar</strong> org.apache.giraph.GiraphRunner org.apache.giraph.examples.<strong>SimpleShortestPathsVertex</strong> -vif org.apache.giraph.io.formats.<strong>JsonLongDoubleFloatDoubleVertexInputFormat</strong> -vip /in/input-json -of org.apache.giraph.io.formats.<strong>IdWithValueTextOutputFormat</strong> -op /outShortest -w 1</p>
<p>If it runs successfully, then an output folder named outShortest is created with the output file. Open the file:</p>
<pre>hadoop fs -cat /outShortest/*</pre>
<p>The result should be this:</p>
<pre>0 1.0
2 2.0
1 0.0
3 1.0
4 5.0</pre>
<p>Here the source vertex was the Vertex Id 1. This was given as a constant at the beginning of the code and can be of course changed.</p>
<p><strong>Observation &#8211; Bug:</strong> I have noticed that this algorithm works only when the input file gives an undirected graph, i.e. when both edges a <b id="docs-internal-guid-77802fc4-552f-2d8f-38b1-60e9c338f0c6">→</b> b and b <b id="docs-internal-guid-77802fc4-552f-2d8f-38b1-60e9c338f0c6">→</b> a are included in the input file.<br />
<strong>Why?</strong> At Superstep 0, the vertices get initialized with a MAX value. If a vertex does not exist at superstep 0, when it gets created because of receiving a message, its value will not be initialized to MAX like the others (since we are not at superstep 0 anymore). Therefore, its behavior get a bit random with no value initialization.<br />
<strong>What should we do?</strong> I submitted <a href="https://issues.apache.org/jira/browse/GIRAPH-644">my first patch</a>!<br />
<strong>And the conclusion is&#8230;? </strong>I am learning new stuff! One of the Giraph members suggested to use the VertexValueFactory.java<strong>*</strong> to fix the problem. We are in the process of fixing it and in the meanwhile I&#8217;m learning more cool stuff <img src='http://s0.wp.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p><strong>* The VertexValueFactory</strong> is responsible to initialize the vertex value when it is created either by reading the input file or by receiving a message.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[[tekwalk] console and json]]></title>
<link>http://abhishekkr.wordpress.com/2013/04/30/tekwalk-console-and-json/</link>
<pubDate>Mon, 29 Apr 2013 19:36:25 +0000</pubDate>
<dc:creator>abhishekkr</dc:creator>
<guid>http://abhishekkr.wordpress.com/2013/04/30/tekwalk-console-and-json/</guid>
<description><![CDATA[@ tekwalk.blogspot.com [12/Apr/2013] http://tekwalk.blogspot.in/2013/04/console-and-json.html recent]]></description>
<content:encoded><![CDATA[<p>@ <strong><a href="http://tekwalk.blogspot.in/2013/04/console-and-json.html">tekwalk.blogspot.com</a></strong> [12/Apr/2013]</p>
<p><a href="http://tekwalk.blogspot.in/2013/04/console-and-json.html">http://tekwalk.blogspot.in/2013/04/console-and-json.html</a></p>
<p>recently<b><i> <a href="http://www.skorks.com/2013/04/the-best-way-to-pretty-print-json-on-the-command-line/" target="_blank">Alan posted a very nice aticle around prettifying json</a></i></b>, reminded me of &#60;this draft&#62;&#8230; he posted 2 out of 3 utilities I was gonna mention&#8230; so here is 3rd and the shell profile way to use first 2</p>
<blockquote><p>$ sudo wget -c -O /etc/profile.d/a.json.sh <a href="https://raw.github.com/abhishekkr/tux-svc-mux/master/shell_profile/a.json.sh">https://raw.github.com/abhishekkr/tux-svc-mux/master/shell_profile/a.json.sh</a></p></blockquote>
<p>it contains 2 functions available at shell</p>
<blockquote><p># usage example:<br />
# $ json_me &#8216;echo {&#8220;a&#8221;: 1, &#8220;b&#8221;: 2}&#8217;<br />
# $ json_me &#8216;curl <a href="http://127.0.0.1/my.json&#038;#8217" rel="nofollow">http://127.0.0.1/my.json&#038;#8217</a>;<br />
json_me(){<br />
bash -c $@ &#124; python -mjson.tool<br />
}</p></blockquote>
<blockquote><p># requirement: $ pip install pjson<br />
# usage example:<br />
# $ pjson_me &#8216;echo {&#8220;a&#8221;: 1, &#8220;b&#8221;: 2}&#8217;<br />
# $ pjson_me &#8216;curl <a href="http://127.0.0.1/my.json&#038;#8217" rel="nofollow">http://127.0.0.1/my.json&#038;#8217</a>;<br />
pjson_me(){<br />
bash -c $@ &#124; pjson<br />
}</p></blockquote>
<p><a href="http://tekwalk.blogspot.in/2013/04/console-and-json.html" target="_blank"><em><strong>&#8230;click here to read full post</strong></em></a></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[[XML] Slicube - Saher Team]]></title>
<link>http://saherteam.wordpress.com/2013/04/29/xml-slicube-saher-team/</link>
<pubDate>Mon, 29 Apr 2013 14:03:52 +0000</pubDate>
<dc:creator>saherteam</dc:creator>
<guid>http://saherteam.wordpress.com/2013/04/29/xml-slicube-saher-team/</guid>
<description><![CDATA[[XML] Slicube &#8211; Saher Team.]]></description>
<content:encoded><![CDATA[<p><a href="http://www.saher-team.com/ultrasoft/ultrasoft.php?id=329#.UX59jwhXir4.wordpress">[XML] Slicube &#8211; Saher Team</a>.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[[CSS3] 3D Image Transitions - Saher Team]]></title>
<link>http://saherteam.wordpress.com/2013/04/29/css3-3d-image-transitions-saher-team/</link>
<pubDate>Mon, 29 Apr 2013 13:49:49 +0000</pubDate>
<dc:creator>saherteam</dc:creator>
<guid>http://saherteam.wordpress.com/2013/04/29/css3-3d-image-transitions-saher-team/</guid>
<description><![CDATA[[CSS3] 3D Image Transitions &#8211; Saher Team.]]></description>
<content:encoded><![CDATA[<p><a href="http://www.saher-team.com/ultrasoft/ultrasoft.php?id=328#.UX56LmlnnOQ.wordpress">[CSS3] 3D Image Transitions &#8211; Saher Team</a>.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[[CSS3] The Box - Saher Team]]></title>
<link>http://saherteam.wordpress.com/2013/04/29/css3-the-box-saher-team/</link>
<pubDate>Mon, 29 Apr 2013 13:30:16 +0000</pubDate>
<dc:creator>saherteam</dc:creator>
<guid>http://saherteam.wordpress.com/2013/04/29/css3-the-box-saher-team/</guid>
<description><![CDATA[[CSS3] The Box &#8211; Saher Team.]]></description>
<content:encoded><![CDATA[<p><a href="http://www.saher-team.com/ultrasoft/ultrasoft.php?id=327#.UX51nYBl4R4.wordpress">[CSS3] The Box &#8211; Saher Team</a>.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[[CSS3] 3-D Gallery - Saher Team]]></title>
<link>http://saherteam.wordpress.com/2013/04/29/css3-3-d-gallery-saher-team/</link>
<pubDate>Mon, 29 Apr 2013 13:17:08 +0000</pubDate>
<dc:creator>saherteam</dc:creator>
<guid>http://saherteam.wordpress.com/2013/04/29/css3-3-d-gallery-saher-team/</guid>
<description><![CDATA[[CSS3] 3-D Gallery &#8211; Saher Team.]]></description>
<content:encoded><![CDATA[<p><a href="http://www.saher-team.com/ultrasoft/ultrasoft.php?id=326#.UX5yh26ZDsM.wordpress">[CSS3] 3-D Gallery &#8211; Saher Team</a>.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[EXPORT JSON ]]></title>
<link>http://obaidullahnaqvi.wordpress.com/2013/04/28/export-json/</link>
<pubDate>Sun, 28 Apr 2013 22:33:25 +0000</pubDate>
<dc:creator>obaidullah91</dc:creator>
<guid>http://obaidullahnaqvi.wordpress.com/2013/04/28/export-json/</guid>
<description><![CDATA[I am a making a new plugin Export JSON which will export WordPress Database in JSON All updates rega]]></description>
<content:encoded><![CDATA[<p>I am a making a new plugin Export JSON which will export WordPress Database in JSON</p>
<p>All updates regarding plugin will be posted here</p>
<p>Update</p>
<p>Plugin can be dwnloaded here :</p>
<p><a href="http://ojest.com/exportjson.zip" rel="nofollow">http://ojest.com/exportjson.zip</a></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[[CSS3] Space Screen Saver - Saher Team]]></title>
<link>http://saherteam.wordpress.com/2013/04/28/css3-space-screen-saver-saher-team/</link>
<pubDate>Sun, 28 Apr 2013 20:53:23 +0000</pubDate>
<dc:creator>saherteam</dc:creator>
<guid>http://saherteam.wordpress.com/2013/04/28/css3-space-screen-saver-saher-team/</guid>
<description><![CDATA[[CSS3] Space Screen Saver &#8211; Saher Team.]]></description>
<content:encoded><![CDATA[<p><a href="http://www.saher-team.com/ultrasoft/ultrasoft.php?id=323#.UX2MAvnn9i0.wordpress">[CSS3] Space Screen Saver &#8211; Saher Team</a>.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[[CSS3] 3D Carousel Gallery - Saher Team]]></title>
<link>http://saherteam.wordpress.com/2013/04/28/css3-3d-carousel-gallery-saher-team/</link>
<pubDate>Sun, 28 Apr 2013 20:40:44 +0000</pubDate>
<dc:creator>saherteam</dc:creator>
<guid>http://saherteam.wordpress.com/2013/04/28/css3-3d-carousel-gallery-saher-team/</guid>
<description><![CDATA[[CSS3] 3D Carousel Gallery &#8211; Saher Team.]]></description>
<content:encoded><![CDATA[<p><a href="http://www.saher-team.com/ultrasoft/ultrasoft.php?id=322#.UX2IxiAP3MI.wordpress">[CSS3] 3D Carousel Gallery &#8211; Saher Team</a>.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[[CSS3] 3D Flip List Menu - Saher Team]]></title>
<link>http://saherteam.wordpress.com/2013/04/28/css3-3d-flip-list-menu-saher-team/</link>
<pubDate>Sun, 28 Apr 2013 20:14:17 +0000</pubDate>
<dc:creator>saherteam</dc:creator>
<guid>http://saherteam.wordpress.com/2013/04/28/css3-3d-flip-list-menu-saher-team/</guid>
<description><![CDATA[[CSS3] 3D Flip List Menu &#8211; Saher Team.]]></description>
<content:encoded><![CDATA[<p><a href="http://www.saher-team.com/ultrasoft/ultrasoft.php?id=321#.UX2CzWm9fuw.wordpress">[CSS3] 3D Flip List Menu &#8211; Saher Team</a>.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[CRUD with PHP MVC, PDO, JSON and Twitter Bootstrap]]></title>
<link>http://foysalmamun.wordpress.com/2013/04/29/crud-with-php-mvc-pdo-json-and-twitter-bootstrap/</link>
<pubDate>Sun, 28 Apr 2013 18:48:23 +0000</pubDate>
<dc:creator>lifo</dc:creator>
<guid>http://foysalmamun.wordpress.com/2013/04/29/crud-with-php-mvc-pdo-json-and-twitter-bootstrap/</guid>
<description><![CDATA[We will create a CRUD application by using MVC design pattern,  PDO extension, Jquery and Twitter Bo]]></description>
<content:encoded><![CDATA[<p>We will create a CRUD application by using MVC design pattern,  PDO extension, Jquery and Twitter Bootstrap.<br />
We will use JSON as data-interchange format for HTTP request and response.</p>
<p>To learn about::<br />
MVC Design Pattern -&#62; <a title="MVC, PDO, JSON, Bootstrap" href="http://www.w3programmers.com/introduction-to-php-design-patterns/" target="_blank">link1</a>, <a title="MVC, PDO, JSON, Bootstrap" href="http://www.w3programmers.com/crud-with-php-oop-and-mvc-design-pattern/" target="_blank">link2</a><br />
PDO -&#62; <a title="MVC, PDO, JSON, Bootstrap" href="http://www.w3programmers.com/php-data-object-pdo-basic/" target="_blank">link1</a>, <a title="MVC, PDO, JSON, Bootstrap" href="http://www.w3programmers.com/crud-with-pdo-oop-php/" target="_blank">link2</a><br />
JSON -&#62; <a title="MVC, PDO, JSON, Bootstrap" href="http://www.w3programmers.com/introduction-to-json-with-php/" target="_blank">link</a><br />
Twitter Bootstrap -&#62; <a title="MVC, PDO, JSON, Bootstrap" href="http://twitter.github.com/bootstrap/" target="_blank">link</a></p>
<p>Before start coding you can take a look on the demo:: <a title="MVC, PDO, JSON, Bootstrap" href="http://json-crud.pagodabox.com/" target="_blank">Demo</a></p>
<p>First of all we create a table and populate it, use below script::</p>
<pre><code>
CREATE TABLE IF NOT EXISTS `users` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(50) CHARACTER SET latin1 NOT NULL,
  `email` varchar(150) CHARACTER SET latin1 NOT NULL,
  `mobile` varchar(20) CHARACTER SET latin1 NOT NULL,
  `address` varchar(255) CHARACTER SET latin1 NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=56 ;

INSERT INTO `users` (`id`, `name`, `email`, `mobile`, `address`) VALUES
(1, 'Al-Amin Khan', 'al@min.com', '6546464', 'Dhaka,Bangladesh'),
(2, 'Sahed Bhuiyan', 's@hed.com', '987979', 'Khulna, Bangladesh'),
(3, 'Mamun', 'm@mun.com', '1234', 'Dhaka, Bangladesh'),
(9, 'foysal', 'foysal@yahoo.com', '1234556', 'Dhaka, Bangladesh.');
</pre>
<p></code></p>
<p>Directory Structure::<br />
We have only two parent directory "models" and "ui". So create these two directory in your app location.<br />
Download Twitter Bootstrap from "<a title="MVC, PDO, JSON, Bootstrap" href="http://twitter.github.com/bootstrap/" target="_blank">Bootstrap</a>". and put it just under "ui" directory.</p>
<p>Now we will create all our views related files. So create "index.php" in app directory and put below code::</p>
<pre><code>
&#60;?php include("ui/header.htm"); ?&#62;
&#60;?php include("ui/nav.htm"); ?&#62;
&#60;div id="content"&#62;&#60;/div&#62;
&#60;?php include("ui/deleteconfirmmodal.htm"); ?&#62;
&#60;?php include("ui/footer.htm"); ?&#62;
</pre>
<p></code></p>
<p>In this "index.php" file we included all our static content as files. We will load our dynamic content in "content" div.<br />
Next in "ui" directory create four new files "header.htm", "footer.htm", "nav.htm" and "deleteconfirmmodal.htm" which we already included in "index.php". Now put content of each file from below::</p>
<p>header.htm</p>
<pre><code>
&#60;!DOCTYPE html&#62;
&#60;html xmlns="http://www.w3.org/1999/xhtml"&#62;
    &#60;head&#62;
		&#60;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&#62;
		&#60;title&#62;JSON CRUD&#60;/title&#62;
		&#60;meta name="viewport" content="width=device-width, initial-scale=1.0"&#62;
		&#60;!-- Bootstrap --&#62;
		&#60;link href="ui/css/bootstrap.min.css" rel="stylesheet" media="screen"&#62;
		&#60;link href="ui/css/crud.css" rel="stylesheet" media="screen"&#62;
    &#60;/head&#62;

    &#60;body&#62;
		&#60;div class="container"&#62;

			&#60;div class="jumbotron"&#62;
				&#60;h1&#62;JSON CRUD&#60;/h1&#62;
			&#60;/div&#62;
</pre>
<p></code></p>
<p>footer.htm</p>
<pre><code>
        &#60;/div&#62;

        &#60;script src="http://code.jquery.com/jquery.js"&#62;&#60;/script&#62;
        &#60;script src="ui/js/bootstrap.min.js"&#62;&#60;/script&#62;
        &#60;script src="ui/js/custom.js"&#62;&#60;/script&#62;
    &#60;/body&#62;
&#60;/html&#62;
</pre>
<p></code></p>
<p>You can see in footer we are including "jquery" from online, if you dont have internet at your working machine then collect the latest "jquery" and load it from your local in this footer section.</p>
<p>nav.htm</p>
<pre><code>
&#60;div class="navbar"&#62;
    &#60;div class="navbar-inner"&#62;    
	&#60;ul class="nav"&#62;
	    &#60;li&#62;&#60;a href="javascript:void(0);" id="user_list"&#62;&#60;i class="icon-th icon-black"&#62;&#60;/i&#62; Read&#60;/a&#62;&#60;/li&#62;
	    &#60;li&#62;&#60;a href="javascript:void(0);" id="create_user_form"&#62;&#60;i class="icon-plus-sign icon-black"&#62;&#60;/i&#62; Create&#60;/a&#62;&#60;/li&#62;		  
	&#60;/ul&#62;
    &#60;/div&#62;
&#60;/div&#62;

&#60;div id="indicator" style="display: none; text-align: center;" class="loading_img"&#62;
    &#60;img src="ui/img/indicator.gif"/&#62;
&#60;/div&#62;
</pre>
<p></code></p>
<p>deleteconfirmmodal.htm</p>
<pre><code>
&#60;div id="delete_confirm_modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"&#62;
    &#60;div class="modal-header"&#62;		
	&#60;h3 id="myModalLabel"&#62;Delete User&#60;/h3&#62;
    &#60;/div&#62;
	
    &#60;div class="modal-body"&#62;
 	&#60;p&#62;Are you sure to delete this user?&#60;/p&#62;
    &#60;/div&#62;
    &#60;div class="modal-footer"&#62;
	&#60;input type="hidden" id="user_id" value="" /&#62;
	&#60;button class="btn" data-dismiss="modal" aria-hidden="true"&#62;No&#60;/button&#62;
	&#60;button class="btn btn-primary delete"&#62;Yes&#60;/button&#62;
    &#60;/div&#62;
&#60;/div&#62;
</pre>
<p></code></p>
<p>You will need one css file and one image, you will get it "ui -&#62; css -&#62; crud.css" and "ui -&#62; img -&#62; indicator.gif" from downloaded package of this example, and put this files in proper directory.</p>
<p>Create a controller "Controller.php" in app location. and put below code in it::</p>
<pre><code>
&#60;?php
function __autoload($className){
    include_once(&#34;models/$className.php&#34;);
}

$users=new User(&#34;your_host&#34;,&#34;your_user&#34;,&#34;your_password&#34;,&#34;your_database&#34;);

if(!isset($_POST[&#039;action&#039;])) {
    print json_encode(0);
    return;
}

switch($_POST[&#039;action&#039;]) {
}

exit();
</pre>
<p></code></p>
<p>Create "User.php" in "models" directory, this is our user model class. put below code in it::</p>
<pre><code>
&#60;?php

class User {

    private $dbh;

    public function __construct($host,$user,$pass,$db)	{
	$this-&#62;dbh = new PDO("mysql:host=".$host.";dbname=".$db,$user,$pass);
    }
}
</pre>
<p></code></p>
<p>For our custom javascript create a "custom.js" file in "ui -&#62; js" directory. and put below code::</p>
<pre><code>
$(function() {
});
</pre>
<p></code></p>
<p>At this point if you access your this application you will get a page like below::<br />
<a href="http://foysalmamun.files.wordpress.com/2013/03/first.png"><img src="http://foysalmamun.files.wordpress.com/2013/03/first.png?w=300&#038;h=75" alt="MVC, PDO, JSON, Bootstrap" width="300" height="75" class="alignnone size-medium wp-image-190" /></a></p>
<p>Now we will functionality one by one.<br />
First of all we will add "Read" functionality. On "Read" button click we will display all user list from database in our "content" div by Ajax call.</p>
<p>So add a line in "custom.js" file's "$(function()" block like below::</p>
<pre><code>
$(function() {
    $(document).on("click", "a#user_list", function(){ getUserList(this); });
});
</pre>
<p></code></p>
<p>Here we are adding a click listener on "user_list" link click.<br />
After that block add below functions "getUserList" and "renderUserList"::</p>
<pre><code>
function getUserList(element) {

    $('#indicator').show();

    $.post('controller.php',
        {
            action: 'get_users'
        },
        function(data, textStatus) {
	    renderUserList(data);
	    $('#indicator').hide();
        },
        "json"
    );
}

function renderUserList(jsonData) {

    var table = '&#60;table width="600" cellpadding="5" class="table table-hover table-bordered"&#62;&#60;thead&#62;&#60;tr&#62;&#60;th scope="col"&#62;Name&#60;/th&#62;&#60;th scope="col"&#62;Email&#60;/th&#62;&#60;th scope="col"&#62;Mobile&#60;/th&#62;&#60;th scope="col"&#62;Address&#60;/th&#62;&#60;th scope="col"&#62;&#60;/th&#62;&#60;/tr&#62;&#60;/thead&#62;&#60;tbody&#62;';

    $.each( jsonData, function( index, user){
	table += '&#60;tr&#62;';
	table += '&#60;td class="edit" field="name" user_id="'+user.id+'"&#62;'+user.name+'&#60;/td&#62;';
	table += '&#60;td class="edit" field="email" user_id="'+user.id+'"&#62;'+user.email+'&#60;/td&#62;';
	table += '&#60;td class="edit" field="mobile" user_id="'+user.id+'"&#62;'+user.mobile+'&#60;/td&#62;';
	table += '&#60;td class="edit" field="address" user_id="'+user.id+'"&#62;'+user.address+'&#60;/td&#62;';
	table += '&#60;td&#62;&#60;a href="javascript:void(0);" user_id="'+user.id+'" class="delete_confirm btn btn-danger"&#62;&#60;i class="icon-remove icon-white"&#62;&#60;/i&#62;&#60;/a&#62;&#60;/td&#62;';
	table += '&#60;/tr&#62;';
    });

    table += '&#60;/tbody&#62;&#60;/table&#62;';

    $('div#content').html(table);
}
</pre>
<p></code></p>
<p>By above function "getUserList" we are sending a "get_users" POST request to collect all users as JSON data and with these JSON data function "renderUserList" is rendering user list in a table.</p>
<p>Open "Controller.php" and add below "case" block in "switch" ::</p>
<pre><code>
case 'get_users':
    print $users-&#62;getUsers();
break;
</pre>
<p></code></p>
<p>Now we have to add "getUsers" mathod to "User" model class. so open "User.php" file and add this below method::</p>
<pre><code>
public function getUsers(){
    $sth = $this-&#62;dbh-&#62;prepare("SELECT * FROM users");
    $sth-&#62;execute();
    return json_encode($sth-&#62;fetchAll());
}
</pre>
<p></code></p>
<p>Now if you click on "Read" button you can see a nice table with all users like below without whole page load::<br />
<a href="http://foysalmamun.files.wordpress.com/2013/03/read.png"><img src="http://foysalmamun.files.wordpress.com/2013/03/read.png?w=300&#038;h=92" alt="MVC, PDO, JSON, Bootstrap" width="300" height="92" class="alignnone size-medium wp-image-191" /></a></p>
<p>To create functionality, open "custom.js" and add two new listeners to get create user FORM and save this new user. so modify your "$(function()" block like below::</p>
<pre><code>
$(function() {
    $(document).on("click", "a#user_list", function(){ getUserList(this); });
    $(document).on("click", "a#create_user_form", function(){ getCreateForm(this); });
    $(document).on("click", "button#add_user", function(){ addUser(this); });
});
</pre>
<p></code></p>
<p>After this "$(function()" block add these two functions from below::</p>
<pre><code>
function addUser(element) {

    $('#indicator').show();

    var User = new Object();
    User.name = $('input#name').val();
    User.email = $('input#email').val();
    User.mobile = $('input#mobile').val();
    User.address = $('textarea#address').val();

    var userJson = JSON.stringify(User);

    $.post('controller.php',
        {
	    action: 'add_user',
	    user: userJson
	},
	function(data, textStatus) {
	    getUserList(element);
	    $('#indicator').hide();
	},
	"json"
    );
}

function getCreateForm(element) {
    var form = '&#60;div class="input-prepend"&#62;';
	form +=	'&#60;span class="add-on"&#62;&#60;i class="icon-user icon-black"&#62;&#60;/i&#62; Name&#60;/span&#62;';
	form +=	'&#60;input type="text" id="name" name="name" value="" class="input-xlarge" /&#62;';
	form +=	'&#60;/div&#62;&#60;br/&#62;&#60;br/&#62;';

        form +=	'&#60;div class="input-prepend"&#62;';
	form +=	'&#60;span class="add-on"&#62;&#60;i class="icon-envelope icon-black"&#62;&#60;/i&#62; Email&#60;/span&#62;';
	form +=	'&#60;input type="text" id="email" name="email" value="" class="input-xlarge" /&#62;';
	form +=	'&#60;/div&#62;&#60;br/&#62;&#60;br/&#62;';

	form +=	'&#60;div class="input-prepend"&#62;';
	form +=	'&#60;span class="add-on"&#62;&#60;i class="icon-headphones icon-black"&#62;&#60;/i&#62; Mobile&#60;/span&#62;';
	form +=	'&#60;input type="text" id="mobile" name="mobile" value="" class="input-xlarge" /&#62;';
	form +=	'&#60;/div&#62;&#60;br/&#62;&#60;br/&#62;';

	form +=	'&#60;div class="input-prepend"&#62;';
	form +=	'&#60;span class="add-on add-on-area "&#62;&#60;i class="icon-home icon-black"&#62;&#60;/i&#62; Address&#60;/span&#62;';
	form +=	'&#60;textarea row="5" id="address" name="address" class="input-xlarge"&#62;&#60;/textarea&#62;';
	form +=	'&#60;/div&#62;&#60;br/&#62;&#60;br/&#62;';

	form +=	'&#60;div class="control-group"&#62;';
	form +=	'&#60;div class=""&#62;';
	form +=	'&#60;button type="button" id="add_user" class="btn btn-primary"&#62;&#60;i class="icon-ok icon-white"&#62;&#60;/i&#62; Add User&#60;/button&#62;';
	form +=	'&#60;/div&#62;';
	form +=	'&#60;/div&#62;';

	$('div#content').html(form);
}
</pre>
<p></code></p>
<p>By function "getCreateForm" we are rendering a FORM for create new user. and function "addUser" send a "add_user" POST request with all given data in create FORM as JSON.</p>
<p>Open "Controller.php" and add below "case" block in "switch" ::</p>
<pre><code>
case 'add_user':
    $user = new stdClass;
    $user = json_decode($_POST['user']);
    print $users-&#62;add($user);
break;
</pre>
<p></code></p>
<p>Here we are decoding "user" POST variable and passing this to "add" method of "User" class.</p>
<p>Now we have to add "add" mathod to "User" model class. so open "User.php" file and add this below method::</p>
<pre><code>
public function add($user){
    $sth = $this-&#62;dbh-&#62;prepare("INSERT INTO users(name, email, mobile, address) VALUES (?, ?, ?, ?)");
    $sth-&#62;execute(array($user-&#62;name, $user-&#62;email, $user-&#62;mobile, $user-&#62;address));
    return json_encode($this-&#62;dbh-&#62;lastInsertId());
}
</pre>
<p></code></p>
<p>Clicking on "Create" button you will get a nice looking FORM like below::<br />
<a href="http://foysalmamun.files.wordpress.com/2013/03/create1.png"><img src="http://foysalmamun.files.wordpress.com/2013/03/create1.png?w=300&#038;h=122" alt="MVC, PDO, JSON, Bootstrap" width="300" height="122" class="alignnone size-medium wp-image-192" /></a></p>
<p>Fill up this FORM and click "Add User" button, all data will save and without page load you can see the updated user list.</p>
<p>Hope you already see a "red" button on user list table, it is for delete user which is in current row. So now we want to delete recently added user. Let implement the "Delete" functionality.</p>
<p>Open "custom.js" file and add another new two listener to it, so your "$(function()" block will look like below::</p>
<pre><code>
$(function() {
    $(document).on("click", "a#user_list", function(){ getUserList(this); });
    $(document).on("click", "a#create_user_form", function(){ getCreateForm(this); });
    $(document).on("click", "button#add_user", function(){ addUser(this); });
    $(document).on("click", "a.delete_confirm", function(){ deleteConfirmation(this); });
    $(document).on("click", "button.delete", function(){ deleteUser(this); });
});
</pre>
<p></code></p>
<p>After this "$(function()" block add these two functions from below::</p>
<pre><code>
function deleteConfirmation(element) {
    $("#delete_confirm_modal").modal("show");
    $("#delete_confirm_modal input#user_id").val($(element).attr('user_id'));
}

function deleteUser(element) {

    var User = new Object();
    User.id = $("#delete_confirm_modal input#user_id").val();

    var userJson = JSON.stringify(User);

    $.post('controller.php',
    {
	action: 'delete_user',
	user: userJson
    },
    function(data, textStatus) {
	getUserList(element);
	$("#delete_confirm_modal").modal("hide");
    },
    "json"
    );
}
</pre>
<p></code></p>
<p>Function "deleteConfirmation" will display a confirmation modal which will ask about delete user. and function "deleteUser" will delete user with given user id.</p>
<p>Open "Controller.php" and add below "case" block in "switch" ::</p>
<pre><code>
case 'delete_user':
    $user = new stdClass;
    $user = json_decode($_POST['user']);
    print $users-&#62;delete($user);
break;
</pre>
<p></code></p>
<p>Here we are decoding "user" POST variable and passing this to "delete" method of "User" class.</p>
<p>Now we have to add "delete" mathod to "User" model class. so open "User.php" file and add this below method::</p>
<pre><code>
public function delete($user){
    $sth = $this-&#62;dbh-&#62;prepare("DELETE FROM users WHERE id=?");
    $sth-&#62;execute(array($user-&#62;id));
    return json_encode(1);
}
</pre>
<p></code></p>
<p>Clicking on any "Red Cross" button it will display a nice modal to get confirmation from you like below::<br />
<a href="http://foysalmamun.files.wordpress.com/2013/03/delete.png"><img src="http://foysalmamun.files.wordpress.com/2013/03/delete.png?w=300&#038;h=100" alt="MVC, PDO, JSON, Bootstrap" width="300" height="100" class="alignnone size-medium wp-image-193" /></a></p>
<p>If you click on "No" button then modal will disappear and no server action but if you click on "Yes" button then the user will delete and you can see your updated user list.</p>
<p>And at last the special thing "Edition", why special? because we will implement a inline edition now. we only use jquery but no any additional js plugin for this easy and simple and few code. So open your "custom.js" and update like below::</p>
<pre><code>
$(function() {
    $(document).on("click", "a#user_list", function(){ getUserList(this); });
    $(document).on("click", "a#create_user_form", function(){ getCreateForm(this); });
    $(document).on("click", "button#add_user", function(){ addUser(this); });
    $(document).on("click", "a.delete_confirm", function(){ deleteConfirmation(this); });
    $(document).on("click", "button.delete", function(){ deleteUser(this); });
    $(document).on("dblclick", "td.edit", function(){ makeEditable(this); });
    $(document).on("blur", "input#editbox", function(){ removeEditable(this) });
});
</pre>
<p></code></p>
<p>You can see we added new two listener, one on double click and another one on blur. so when we double click on any data, a editable input box will appear and after necessary change when we move the focus from this input field then it will disappear and return to as before.</p>
<p>So after this block now add two new functions from below::</p>
<pre><code>
function removeEditable(element) {

    $('#indicator').show();

    var User = new Object();
    User.id = $('.current').attr('user_id');
    User.field = $('.current').attr('field');
    User.newvalue = $(element).val();

    var userJson = JSON.stringify(User);

    $.post('controller.php',
    {
	action: 'update_field_data',
	user: userJson
    },
    function(data, textStatus) {
	$('td.current').html($(element).val());
	$('.current').removeClass('current');
	$('#indicator').hide();
    },
    "json"
    );
}

function makeEditable(element) {
    $(element).html('&#60;input id="editbox" size="'+  $(element).text().length +'" type="text" value="'+ $(element).text() +'"&#62;');
    $('#editbox').focus();
    $(element).addClass('current');
}
</pre>
<p></code></p>
<p>Open "Controller.php" and add below "case" block in "switch" ::</p>
<pre><code>
case 'update_field_data':
    $user = new stdClass;
    $user = json_decode($_POST['user']);
    print $users-&#62;updateValue($user);
break;
</pre>
<p></code></p>
<p>Now we have to add "updateValue" mathod to "User" model class. so open "User.php" file and add this below method::</p>
<pre><code>
public function updateValue($user){
    $sth = $this-&#62;dbh-&#62;prepare("UPDATE users SET ". $user-&#62;field ."=? WHERE id=?");
    $sth-&#62;execute(array($user-&#62;newvalue, $user-&#62;id));
    return json_encode(1);
}
</pre>
<p></code></p>
<p>Here "updateValue" method updating data of given field.</p>
<p>Now if you double click on any data you will get a input field to edit this data like below::<br />
<a href="http://foysalmamun.files.wordpress.com/2013/03/update.png"><img src="http://foysalmamun.files.wordpress.com/2013/03/update.png?w=300&#038;h=76" alt="MVC, PDO, JSON, Bootstrap" width="300" height="76" class="alignnone size-medium wp-image-194" /></a></p>
<p>After change when this field get lost the focus then the new data will save and it will become like before as non editable.</p>
<p>So those are all for this article. Thanks.</p>
<p align="center"><a title="MVC, PDO, JSON, Bootstrap" href="https://github.com/foysal-mamun/json-crud.git" target="_blank">Download Source</a></p>
		<div id="geo-post-177" class="geo geo-post" style="display: none">
			<span class="latitude">23.764730</span>
			<span class="longitude">90.358066</span>
		</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[[CSS3] 3D Cube - Saher Team]]></title>
<link>http://saherteam.wordpress.com/2013/04/28/css3-3d-cube-saher-team/</link>
<pubDate>Sun, 28 Apr 2013 18:26:22 +0000</pubDate>
<dc:creator>saherteam</dc:creator>
<guid>http://saherteam.wordpress.com/2013/04/28/css3-3d-cube-saher-team/</guid>
<description><![CDATA[[CSS3] 3D Cube &#8211; Saher Team.]]></description>
<content:encoded><![CDATA[<p><a href="http://www.saher-team.com/ultrasoft/ultrasoft.php?id=319#.UX1pnpUidug.wordpress">[CSS3] 3D Cube &#8211; Saher Team</a>.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Handling Larger JSON String Values in .NET and Avoiding Exceptions]]></title>
<link>http://rionscode.wordpress.com/2013/04/28/handling-larger-json-string-values-in-net-and-avoiding-exceptions/</link>
<pubDate>Sun, 28 Apr 2013 15:00:55 +0000</pubDate>
<dc:creator>Rion Williams</dc:creator>
<guid>http://rionscode.wordpress.com/2013/04/28/handling-larger-json-string-values-in-net-and-avoiding-exceptions/</guid>
<description><![CDATA[Working with JSON within Web Services recently has become the latest and greatest simply because it]]></description>
<content:encoded><![CDATA[<p>Working with JSON within Web Services recently has become the latest and greatest simply because it plays so nicely with others and can often be very easily serialized and de-serialized to fit your needs (<em>plus AJAX and it are basically BFFs</em>).</p>
<p>There is just something rewarding about having a massive collection of complex objects that can be throw into a simple string and passed across however you see fit and then completely regenerated in its original collection in just a handful of code.</p>
<p>However sometimes these strings can get big and I mean really big, like exceeding default values big and when this happens, exceptions happen. This post will cover a few ways that you can prevent nasty <a href="http://msdn.microsoft.com/en-us/library/system.invalidoperationexception.aspx">InvalidOperationExceptions </a>that may look something like this with ease :</p>
<div id="attachment_299" class="wp-caption alignnone" style="width: 662px"><a href="http://rionscode.files.wordpress.com/2013/05/jsonmaxlength-error.png"><img class="size-large wp-image-299" alt="JsonMaxLength Error" src="http://rionscode.files.wordpress.com/2013/05/jsonmaxlength-error.png?w=652&#038;h=84" width="652" height="84" /></a><p class="wp-caption-text">You may encounter this error when attempt to pass large JSON Objects around.</p></div>
<p><strong>The Problem</strong></p>
<p>You decide that paging data is for losers (<em>it&#8217;s not</em>) and decide to pull a graph of all of the data within your database, which will hypothetically contains thousands of complex objects, each with additional properties of their own (<em>basically a ton of data</em>). If your dataset is large enough (<em>which it is</em>) you&#8217;ll find yourself quickly exceeding the bounds that your Serializer can handle and you&#8217;ll be met with an exception and no data.</p>
<p><strong>The Solution</strong></p>
<p>There are three basic methods of handling this depending on your current environment :</p>
<ol>
<li>Setting the <a href="http://msdn.microsoft.com/en-us/library/system.web.script.serialization.javascriptserializer.maxjsonlength.aspx">MaxJsonLength</a> property default value within your web.config. (<em>This will only apply to web-services that handle JSON</em>)</li>
<li>Setting the MaxJsonLength property of a <a href="http://msdn.microsoft.com/en-us/library/system.web.script.serialization.javascriptserializer.aspx">JavascriptSerializer </a>object to perform your serialization.</li>
<li>If you are using MVC4 to handle returning your <em>JSON </em>values, you may want to override the default JsonResult() ActionResult and change the maximum size manually.</li>
</ol>
<p>Either of these changes will help you avoid any bumps in the road when passing across your large JSON values.</p>
<p><strong>Option I : The MaxJsonLength Property for handling JSON in Web Services</strong></p>
<p>The MaxJsonLength property which can be set within the web.config of your application controls the maximum size of the JSON strings that are accepted by the JsonSerializer class. The default value is  102400 characters.</p>
<p>In order to increase the size of this value &#8211; you can just add the following code to your web.config file and set it to the value that you desire :</p>
<pre><code>&#60;configuration&#62; 
   &#60;system.web.extensions&#62;
       &#60;scripting&#62;
           &#60;webServices&#62;
               &#60;!-- Update this value to change the value to a larger value that can accommodate your JSON Strings --&#62;
               &#60;jsonSerialization maxJsonLength="86753090" /&#62;
           &#60;/webServices&#62;
       &#60;/scripting&#62;
   &#60;/system.web.extensions&#62;
&#60;/configuration&#62; </code></pre>
<p>It is important to know that this setting within the web.config will only apply to actual Web Services that handle your JSON strings using the internal JsonSerializer. If you are still encountering issues after applying this change, you will likely want to continue reading and consider using an instance of the JsonSerializer class to handle setting this value.</p>
<p><strong>Option II : Using the JavaScriptSerialzier and the MaxJsonLength Property to Handle Serializing JSON Values</strong></p>
<p>Using an instance of a <a href="http://msdn.microsoft.com/en-us/library/system.web.script.serialization.javascriptserializer.aspx">JavascriptSerializer </a>will not actually inherit the previously defined within the web.config (<em>as the web.config only applies to Web Services that handle the JSON</em>) so you can easily just create an instance of the serializer and set the property accordingly :</p>
<pre>//Creates an instance of your JavaScriptSerializer and Setting the MaxJsonLength
var serializer = new JavaScriptSerializer() { MaxJsonLength = 86753090 };

//Perform your serialization
serializer.Serialize("Your JSON Contents");</pre>
<p>This will allow you to easily your larger data and adjust your maximum size easily.</p>
<p><strong>Option III : Overiding the MVC4 JsonResult Action Result to Handle the Maximum Size</strong></p>
<p>Much like the previously examples,  every time that you are going to return a JsonResult you can simply add the MaxJsonLength property to a specific value depending on the context of your specific action :</p>
<pre>return new JsonResult() { Data = "Your Data", MaxJsonLength = 86753090 };</pre>
<p>or using the Json() method :</p>
<pre>JsonResult result = Json("Your Data");
 result.MaxJsonLength = 8675309;</pre>
<p>However, if you want a more widespread solution that you could use within a single area of your application, you may want to consider overriding the <a href="http://msdn.microsoft.com/en-us/library/system.web.mvc.jsonresult(v=vs.108).aspx">JsonResult </a>class and set your value within this newer class :</p>
<pre><code>//This ActionResult will override the existing JsonResult and will automatically set the 
protected override JsonResult Json(object data, string contentType, System.Text.Encoding contentEncoding, JsonRequestBehavior behavior)
{
    return new JsonResult()
    {
        Data = data,
        ContentType = contentType,
        ContentEncoding = contentEncoding,
        JsonRequestBehavior = behavior,
        MaxJsonLength = Int32.MaxValue //Use this value to set your maximum size for all of your Requests
    };
}</code></pre>
<p><strong>From a JSON to a JMAN</strong></p>
<p>Those are a just a few methods that you should be able to use if you ever encounter an issue when passing larger JSON strings across your Controllers or through the use of Web Services. I am sure that there are likely several other ways to handle these same problems, but hopefully one of these will help you out if you are in a tight spot.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[New Music: Json ft SPEC - Work ]]></title>
<link>http://theteamwitness3.com/2013/04/26/new-music-json-ft-spec-work/</link>
<pubDate>Fri, 26 Apr 2013 16:45:42 +0000</pubDate>
<dc:creator>harlemwitness</dc:creator>
<guid>http://theteamwitness3.com/2013/04/26/new-music-json-ft-spec-work/</guid>
<description><![CDATA[]]></description>
<content:encoded><![CDATA[<iframe width="100%" height="166" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F89027580"></iframe>
]]></content:encoded>
</item>
<item>
<title><![CDATA[You used Thunder Stone! JSON evolved into GeoJSON!]]></title>
<link>http://scitasy.wordpress.com/2013/04/26/you-used-thunder-stone-json-evolved-into-geojson/</link>
<pubDate>Fri, 26 Apr 2013 15:53:45 +0000</pubDate>
<dc:creator>scitasy</dc:creator>
<guid>http://scitasy.wordpress.com/2013/04/26/you-used-thunder-stone-json-evolved-into-geojson/</guid>
<description><![CDATA[I do miss Pokemon. ANYWAYS, onto the meat of the post. Last time, I spoke about organising data into]]></description>
<content:encoded><![CDATA[<p>I do miss Pokemon. ANYWAYS, onto the meat of the post. Last time, I spoke about organising data into JSON objects that I could work with. I also told you I was only doing that so I could understand JSON before moving onto GeoJSON. Well. Guess what. GeoJSON IS JUST A JSON OBJECT WITH A PARTICULAR STRUCTURE. Talk about an anticlimax.</p>
<p><a title="HTMLtoJSON.java" href="https://gist.github.com/scitasy/5468133">HERE</a> is the final code for scraping HTML and storing it as JSON objects. And <a title="HTMLtoGeoJSON.java" href="https://gist.github.com/scitasy/5468175">HERE</a> is the new code for doing the same thing but storing it as a GeoJSON object. For a detailed breakdown of what a GeoJSON object looks like, go <a title="GeoJSON Spec" href="http://www.geojson.org/geojson-spec.html#examples">HERE</a>. If you can&#8217;t be bothered to read through it and figure it out, usually I would tell you to leave me alone. But I&#8217;m in a giving mood so I&#8217;m gonna explain it.</p>
<ul>
<li><span style="line-height:1.5;font-style:inherit;">A GeoJSON object is ONE JSON object.</span></li>
<li>It is made up of TWO properties:
<ul>
<li>A &#8220;features&#8221; property</li>
<li>A &#8220;type&#8221; property</li>
</ul>
</li>
<li>The &#8220;type&#8221; property is always set to &#8220;FeatureCollection&#8221; (side not: I&#8217;m not sure how important capitalisation is in JSON, but err on the side of caution until you find out)</li>
<li>The &#8220;features&#8221; property is always an array containing objects that represent your geographical data</li>
<li>Each object representing your geographical data contains three properties:
<ul>
<li>A &#8220;type&#8221; property</li>
<li>A &#8220;geometry&#8221; property</li>
<li>A &#8220;properties&#8221; property</li>
</ul>
</li>
<li>The &#8220;type&#8221; property is always set to &#8220;Feature&#8221; as that is what each geographical object is called</li>
<li>The &#8220;geometry&#8221; property always contains an object that represents your exact geographical data and has two properties:
<ul>
<li>A &#8220;type&#8221; property that defines the type of data (point, multipoint, coordinates, etc.)</li>
<li>A &#8220;coordinates&#8221; property that contains the numbers representing your geographical data. It is either an array of numbers or an array of arrays of numbers. Easy on the brain and tongue, right?</li>
</ul>
</li>
<li>The &#8220;properties&#8221; property represents an object that contains any properties you want this specific feature to have a la typical JSON fashion</li>
</ul>
<p>DAS IT. Again, look at the spec page I linked to for more detailed information. If you look at my code, all I&#8217;m doing is translating the above into computer speak. It feels awkward at first because you&#8217;re creating an object that represents a property and an array, and the array represents objects that represent a property, an object that represents more properties and arrays, and an object that represents even more properties.</p>
<p>Please go away.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[]]></title>
<link>http://blog.chrisrussell.net/2013/04/25/1183/</link>
<pubDate>Fri, 26 Apr 2013 04:10:11 +0000</pubDate>
<dc:creator>Chris Russell</dc:creator>
<guid>http://blog.chrisrussell.net/2013/04/25/1183/</guid>
<description><![CDATA[Reposting from Encapsule Project Blog: Object Models and Encapsule Project Schema 0.869 (Screenshot/]]></description>
<content:encoded><![CDATA[<p>Reposting from Encapsule Project Blog:<br />
<a href="http://blog.encapsule.org/2013/04/25/schema-v0-869-screenshot/">Object Models and Encapsule Project Schema 0.869 (Screenshot/HTML 5 Demo Link)</a></p>
<p><strong>demo:<br />
</strong><strong><a title="Encapsule Project Schema 0.869 (archived build)" href="http://www.chrisrussell.net/html5/schema-8/#/" target="_blank">stable demo link</a></strong> (switch to &#8220;Advanced View&#8221; via UI button)<strong><a title="Encapsule Project Schema 0.869 (archived build)" href="http://www.chrisrussell.net/html5/schema-8/#/" target="_blank"><br />
</a></strong><strong><a title="Encapsule Project Schema (latest test build)" href="http://schema.encapsule.org/" target="_blank">latest development build</a> </strong>(i.e. something radically different a week from post date)</p>
<p><strong>screenshot:</strong></p>
<div id="attachment_1186" class="wp-caption alignleft" style="width: 810px"><a href="http://cedar64.files.wordpress.com/2013/04/schema-0-869-screenshot.jpg"><img class="size-full wp-image-1186 " alt="Encapsule Project Schema 0.869" src="http://cedar64.files.wordpress.com/2013/04/schema-0-869-screenshot.jpg?w=800&#038;h=495" width="800" height="495" /></a><p class="wp-caption-text">Encapsule Project Schema 0.869</p></div>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Somebody Tweeted "Republican Mitt Romney Your Hair Smell Like Feet &amp; "Big Thick Midget Butt." I Said "Hell Naw." Then Somebody Said...  ]]></title>
<link>http://tylershemwell.wordpress.com/2013/04/26/somebody-tweeted-republican-mitt-romney-your-hair-smell-like-feet-big-thick-midget-butt-i-said-hell-naw-then-somebody-said/</link>
<pubDate>Fri, 26 Apr 2013 02:35:45 +0000</pubDate>
<dc:creator>Tyler Shemwell G-esteem "The game is in belief"</dc:creator>
<guid>http://tylershemwell.wordpress.com/2013/04/26/somebody-tweeted-republican-mitt-romney-your-hair-smell-like-feet-big-thick-midget-butt-i-said-hell-naw-then-somebody-said/</guid>
<description><![CDATA[Somebody Tweeted &#8220;Republican Mitt Romney Your Hair Smell Like Feet &amp; &#8220;Big Thick Midg]]></description>
<content:encoded><![CDATA[<p><strong>Somebody Tweeted &#8220;Republican Mitt Romney Your Hair Smell Like Feet &#38; &#8220;Big Thick Midget Butt.&#8221; I Said &#8220;Hell Naw.&#8221; Then Somebody Said&#8230;</strong></p>
<div>
<div>
<div>
<div>
<div><span style="font-family:'Monotype Corsiva';">(Article on Blogger)</span></div>
</div>
<div></div>
</div>
<div><a href="http://domegetta.blogspot.com/" target="_blank">http://domegetta.blogspot.com/</a></div>
</div>
</div>
]]></content:encoded>
</item>
<item>
<title><![CDATA[XML vs JSON]]></title>
<link>http://reinnovando.wordpress.com/2013/04/25/xml-vs-json/</link>
<pubDate>Thu, 25 Apr 2013 22:08:15 +0000</pubDate>
<dc:creator>albearendil</dc:creator>
<guid>http://reinnovando.wordpress.com/2013/04/25/xml-vs-json/</guid>
<description><![CDATA[Hoy en día está muy de moda el uso de JSON (JavaScript Object Notation) sobre todo por su relación c]]></description>
<content:encoded><![CDATA[<p>Hoy en día está muy de moda el uso de JSON (JavaScript Object Notation) sobre todo por su relación con bases de datos no relacionales como MongoDB o CouchDB. Sin embargo, ¿hasta qué punto es mejor que XML (Extensible Markup Language)? ¿Sustituirá en un futuro cercano JSON a XML?</p>
<p><a href="http://stackoverflow.com/questions/4862310/json-and-xml-comparison" rel="nofollow">http://stackoverflow.com/questions/4862310/json-and-xml-comparison</a></p>
<p><a href="http://blog.technologyofcontent.com/2010/01/json-vs-xml/" rel="nofollow">http://blog.technologyofcontent.com/2010/01/json-vs-xml/</a></p>
<p><a href="http://techcommunity.softwareag.com/ecosystem/communities/public/Developer/webmethods/products/tamino/faq/XMLStarter/WHYXML.html" rel="nofollow">http://techcommunity.softwareag.com/ecosystem/communities/public/Developer/webmethods/products/tamino/faq/XMLStarter/WHYXML.html</a></p>
<p><a href="http://www.json.org/xml.html" rel="nofollow">http://www.json.org/xml.html</a></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[back to coding]]></title>
<link>http://dittmaraz.wordpress.com/2013/04/25/back-to-coding/</link>
<pubDate>Thu, 25 Apr 2013 19:14:35 +0000</pubDate>
<dc:creator>dittmaraz</dc:creator>
<guid>http://dittmaraz.wordpress.com/2013/04/25/back-to-coding/</guid>
<description><![CDATA[Cloud9 dittmaraz.c9.io Gravatar gravatar.com https://c9.io/dittmaraz/gravatar http://gravatar.com/di]]></description>
<content:encoded><![CDATA[<p>Cloud9 <a href="https://c9.io/dittmaraz/gravatar">dittmaraz.c9.io</a></p>
<p>Gravatar <a href="http://en.gravatar.com/">gravatar.com</a></p>
<p><a href="https://c9.io/dittmaraz/gravatar" rel="nofollow">https://c9.io/dittmaraz/gravatar</a></p>
<p><a href="http://gravatar.com/dittmaraz" rel="nofollow">http://gravatar.com/dittmaraz</a></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[JSON for all (almost!)]]></title>
<link>http://mycodepad.wordpress.com/2013/04/25/json-for-all-almost/</link>
<pubDate>Thu, 25 Apr 2013 10:32:49 +0000</pubDate>
<dc:creator>George Kosmidis</dc:creator>
<guid>http://mycodepad.wordpress.com/2013/04/25/json-for-all-almost/</guid>
<description><![CDATA[Read this post to learn how you can support JSON in the following: JavaScript jQuery .NET (C#) PHP D]]></description>
<content:encoded><![CDATA[<p>Read this post to learn how you can support <a href="http://json.org/" target="_blank">JSON</a> in the following:</p>
<ul>
<li>JavaScript</li>
<li>jQuery</li>
<li>.NET (C#)</li>
<li>PHP</li>
<li>Delphi</li>
</ul>
<p><!--more--></p>
<p><strong>JavaScript:</strong> (<a href="http://en.wikipedia.org/wiki/JSON" target="_blank">http://en.wikipedia.org/wiki/JSON</a>)</p>
<pre class="brush: jscript; title: ; notranslate" title="">
JSON.parse(...);     //String to Object
JSON.stringify(...); //Object to String
</pre>
<p><em>* Native JSON support for Mozilla Firefox 3.5+, Microsoft Internet Explorer 8+, Opera 10.5+, WebKit-based browsers (Apple Safari), Blink &#8211; based browsers (e.g. Google Chrome, Opera). For older browsers use this: <a href="https://github.com/douglascrockford/JSON-js" target="_blank">https://github.com/douglascrockford/JSON-js</a></em></p>
<p><strong>jQuery:</strong> (<a href="http://api.jquery.com/jQuery.parseJSON/" target="_blank">http://api.jquery.com/jQuery.parseJSON/</a>)</p>
<pre class="brush: jscript; title: ; notranslate" title="">
jQuery.parseJSON(...); //String to Object
</pre>
<p><em>* Object to String not supported, use JSON.stringify(). Infact, you should always use JSON.parse and JSON.stringify</em></p>
<p><strong>.NET (C#):</strong></p>
<pre class="brush: csharp; title: ; notranslate" title="">
using System.Web.Script.Serialization;
var json = new JavaScriptSerializer().Serialize(...);//Object to String
var obj = new JavaScriptSerializer().Deserialize(...);//String to Object
</pre>
<p><em>* Native support for .NET Framework 3.5+. More reading here: <a href="http://msdn.microsoft.com/en-us/library/system.web.script.serialization.javascriptserializer.aspx" target="_blank">http://msdn.microsoft&#8230;javascriptserializer.aspx</a>. A more complete library for JSON, supporting all .NET versions can be found here <a href="http://json.codeplex.com/" target="_blank">http://json.codeplex.com/</a></em></p>
<p><strong>PHP:</strong>(<a href="http://php.net/manual/en/book.json.php" target="_blank">http://php.net/manual/en/book.json.php</a>)</p>
<pre class="brush: php; title: ; notranslate" title="">
$json = json_encode(...); //Object to String
$obj = json_decode(...);  //String to Object
</pre>
<p><strong>Delphi</strong><br />
There is no native support for JSON but you can use this: <a href="http://sourceforge.net/projects/lkjson/" target="_blank">http://sourceforge.net/projects/lkjson/</a></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Event Verdict: Couchbase Munich Developer Day 2013]]></title>
<link>http://swarchitecture.org/2013/04/24/event-verdict-couchbase-munich-developer-day-2013/</link>
<pubDate>Wed, 24 Apr 2013 09:52:41 +0000</pubDate>
<dc:creator>swarchitect</dc:creator>
<guid>http://swarchitecture.org/2013/04/24/event-verdict-couchbase-munich-developer-day-2013/</guid>
<description><![CDATA[I recently attended an event called Couchbase Munich Developer Day 2013 which I found absolutely thr]]></description>
<content:encoded><![CDATA[<p>I recently attended an event called <a href="http://www.eventbrite.com/event/5870136737">Couchbase Munich Developer Day 2013</a> which I found absolutely thrilling. Here&#8217;s a quick brain-dump&#8230;and a photo of a sticker they gave&#8230; <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://swarchitecturedotorg.files.wordpress.com/2013/04/img_3253.jpg"><img class="alignnone size-medium wp-image-124" alt="IMG_3253" src="http://swarchitecturedotorg.files.wordpress.com/2013/04/img_3253.jpg?w=225&#038;h=300" width="225" height="300" /></a></p>
<p><strong style="line-height:1.714285714;font-size:1rem;">Description</strong><span style="line-height:1.714285714;font-size:1rem;">: The goal of Couchbase Developer Days was to a basic understanding of </span><strong style="line-height:1.714285714;font-size:1rem;">Couchbase Server 2.0</strong><span style="line-height:1.714285714;font-size:1rem;"> and how to use it.</span></p>
<p><strong>Setup</strong>: Three presenters from Couchbase, full day program.</p>
<p><strong>Price</strong>: $50 (value for money was really good)</p>
<p><strong>Techniques covered</strong>:</p>
<ul>
<li><span style="line-height:1.714285714;font-size:1rem;">No-SQL or document-based databases</span></li>
<li><span style="line-height:1.714285714;font-size:1rem;">Couchbase 2.0 vs CouchBD (they are very different)</span></li>
<li><span style="line-height:1.714285714;font-size:1rem;">Document structure </span></li>
<li><span style="line-height:1.714285714;font-size:1rem;">Basic Architecture</span></li>
<li><span style="line-height:1.714285714;font-size:1rem;">Couchbase Console (Web management interface)</span></li>
<li><span style="line-height:1.714285714;font-size:1rem;">Atomic counters</span></li>
<li><span style="line-height:1.714285714;font-size:1rem;">Views and Indices </span></li>
<li><span style="line-height:1.714285714;font-size:1rem;">Filtering</span></li>
<li><span style="line-height:1.714285714;font-size:1rem;">Map/Reduce</span></li>
<li><span style="line-height:1.714285714;font-size:1rem;">Elastic Search</span></li>
<li><span style="line-height:1.714285714;font-size:1rem;">XDCR (replication)</span></li>
<li><span style="line-height:1.714285714;font-size:1rem;">Graphs</span></li>
<li><span style="line-height:1.714285714;font-size:1rem;">Client SDKs for .NET, Java, PHP, Node, etc.</span></li>
<li><span style="line-height:1.714285714;font-size:1rem;">plus much more&#8230;</span></li>
</ul>
<p><strong>Key Takeaways</strong>:</p>
<ul>
<li><span style="line-height:1.714285714;font-size:1rem;">The era of RDBMS&#8217;s might be at its end-phase</span></li>
<li><span style="line-height:1.714285714;font-size:1rem;">Real life scalability with Couchbase: OMGPOP&#8217;s DrawSomething, Concur, TubeMogul and AOL</span></li>
<li><span style="line-height:1.714285714;font-size:1rem;">No-SQL requires a complete phase-shift in brainwave activity &#8211; almost everything is backwards in regards to SQL databases</span></li>
<li><span style="line-height:1.714285714;font-size:1rem;">One way to think is that <strong>Couchbase</strong> = <strong>memcached+ disk</strong></span></li>
<li><span style="line-height:1.714285714;font-size:1rem;">You can store JSON documents (they are called design documents) or practically anything (images, binaries). Restriction is 20MB size limit.</span></li>
<li><span style="line-height:1.714285714;font-size:1rem;">There is still some work in designing JSON document for your business entities. Good starting point is for example one document per screen.</span></li>
<li><span style="line-height:1.714285714;font-size:1rem;">Schemaless data poses also problems for index generation</span></li>
<li><span style="line-height:1.714285714;font-size:1rem;">Developers own the data, true agility (or a sign of catastrophy?). It is developer&#8217;s job is to serialize objects to JSON and back (in .NET for example using DataContractSerializer or Newtonsoft&#8217;s JsonSerializer)</span></li>
<li><span style="line-height:1.714285714;font-size:1rem;">Views are really important for querying&#8230;actually they are the only way to run queries over data!</span></li>
<li><span style="line-height:1.714285714;font-size:1rem;">View Architecture: so called &#8216;buckets&#8217; contain design documents &#8211;&#62; design documents are JSON files &#8211;&#62; bucket has multiple views &#8211;&#62; views are indices &#8211;&#62; indexes are allocated per design doc, meaning that if view is updated that will update the related design document</span></li>
<li><span style="line-height:1.714285714;font-size:1rem;">There are no transactions</span></li>
<li><span style="line-height:1.714285714;font-size:1rem;">Ability to manage your db and its contents via web interface is a killer feature</span></li>
<li><span style="line-height:1.714285714;font-size:1rem;">Documentation actually is on par</span></li>
<li><span style="line-height:1.714285714;font-size:1rem;">Much more&#8230;about clusters and graphs&#8230;</span></li>
</ul>
<p><strong>Documentation</strong>: All documentation is available via <a href="http://www.couchbase.com/learn">Couchbase </a>website.</p>
<p><strong>Verdict</strong>:</p>
<ul>
<li><span style="line-height:1.714285714;font-size:1rem;">Good value for money, knowledgeable presenters</span></li>
<li><span style="line-height:1.714285714;font-size:1rem;">This was by far the best database related presentation I&#8217;ve seen yet, reality based, collaborative and entertaining <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </span></li>
<li><span style="line-height:1.714285714;font-size:1rem;">Couchbase has a really convincing package together for companies striving for scalability and data velocity</span></li>
</ul>
]]></content:encoded>
</item>

</channel>
</rss>
