Archive for October, 2008

Open Source as fire and water

I come across the word at least 100 times in a day. But when ever i hear the word, i tend to think weather the word is used in the right tense and meaning. It has been around for more than a decade. People who believe in free software are not for the term Open Source. Still they are right in a way. People talk very serious business choose tidy proprietary techniques. But days have changed given that technology requirements have more leverage in terms of choices and cost effectiveness. The java community has taken this word as a powerful sword to win business which i feel is pretty healthy. As far as i am concerned, i believe in healthy business ecosystem and how ever you can it, either as Open Source or open Standard or Open Thoughts etc.., At the end of the day what matters to me is the society and healthy ecosystem.

The world cannot live pure capitalistic (recent markets slide shows that quite well) not deep routed communism too. Both the concepts are quite solid. Agreed. They are pillars. But now there is not so much space left in this world to build pillars which doesn’t helps in easy movement of commodities.  So when we try to stand in between the two concepts, we are called people who don’t have fixed or concrete stand on anything but safety. But what happened to both these giant concepts in recent days. One proved quite revolutionary (nothing much more than that)and the other one brought in competition which has tendency to blow the society when at a saturation mark.

The third concept of socialism comes to rescue when both other parties comes to a halt and become speechless. It’s pretty simple and designed to cater more choices. Live and let live. Competition is good and healthy competition is the way to go. Strong acceptation survives long. Now to the point, do we accept that Open Source has taken some sort of socialistic figure? I would just like to leave this question un-answered for the readers. Little discomfort with the term is the thin line it’s made of.

There are many successful case studies. And this is a very important Era of not only technology development but also the business developments which ultimately generates money to feed the technicians. I feel Open Source caters to both the segments (quite well pinned together) with ease and efficiency.

Add comment October 23, 2008

Simple Dojo Datagrid + JSON Store

Sample Dojo Grid with JSON access below

Works for Dojo 1.2, and not with earlier versions.

And one fabulous improvement with the new grid (dojox.grid.DataGrid) is that when we try to load the data from json, it shows a Loading symbol which i feel is pretty cool compared to the earlier dojox.Grid. And the layout definition is fairly simplified. What i would love to see in future is a framework with which people can work with less scripting knowledge.

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”>
<html>
<head>
<title>Layout Markup Basic</title>
<style type=”text/css”>
@import “dijit/themes/soria/soria.css”;
@import “dijit/themes/tundra/tundra.css”;
@import “dojox/grid/resources/Grid.css”;
@import “dojox/grid/resources/tundraGrid.css”;
@import “general.css”;
</style>
<script type=”text/javascript” src=”dojo/dojo.js” djConfig=”isDebug:false, parseOnLoad: true”></script>
<script type=”text/javascript”>
dojo.require(“dojo.data.ItemFileReadStore”);
dojo.require(“dojox.grid.DataGrid”);
dojo.require(“dojo.parser”);
dojo.require(“dijit.form.Button”);
dojo.require(“dijit.form.TextBox”);
dojo.require(“dijit.form.DateTextBox”);
dojo.require(“dijit.form.ComboBox”);
dojo.require(“dijit.layout.ContentPane”);
dojo.require(“dijit.layout.TabContainer”);
var jsonStore = new dojo.data.ItemFileReadStore({ url: “MyJson.jsp” });
</script>
</head>
<body class=”soria”>
<table id=”gridNode” jsId=”grid” dojoType=”dojox.grid.DataGrid” autowidth=”true”
query=”{ customer_name: ‘*’ }” store=”jsonStore” class=”tundra” style=”height:300px;width:400px”>
<thead>
<tr>
<th field=”customer_name”>Customer Name</th>
<th field=”customer_address” width=”100px”>Customer Address</th>
</tr>
</thead>
</table>
</body>
</html>

MyJson.jsp Sample goes below:

<%@ taglib prefix=”json” uri=”http://www.atg.com/taglibs/json” %>
<json:object>
<json:array name=”items” var=”item” items=”2″>
<json:object>
<json:property name=”customer_name” value=”nancy”/>
<json:property name=”customer_address” value=”LA”/>
</json:object>
<json:object>
<json:property name=”customer_name” value=”ken”/>
<json:property name=”customer_address” value=”CA”/>
</json:object>
</json:array>
</json:object>

If we need a json to be dynamically associated to the grid on any event, simple 3 steps will do:

  • dojo.require(“dojo.data.ItemFileReadStore”);
  • jsonStore = new dojo.data.ItemFileReadStore({ url: “<url for json rendering>”})
  • var grid = dijit.byId(“gridNode”); // our grid div
  • grid.setStore(jsonStore); // no need for a separate refresh call

If you have any comments or corrections, then please leave a comment.

Add comment October 7, 2008


Blogroll

Category Cloud

ajax books Education free software linux Market opensource open standards OSS programming search servers services Uncategorized web

Archives