Javascript, the misunderstood saga
I have written reasonably good amount of JavaScript programs to call myself proficient in the language. But i always had a little doubt or uncertainty on how good i can use this beauty. Sometimes rather many times i have felt that i am not fully utilizing the powerful concepts of OO and Modeling in JavaScript. But time/quick to market takes more importance i felt. But that’s no excuse to appreciate this fantastic language that has contributed in many sphere of the evolving Internet age.
I seriously feel that the programming language and more importantly scripting languages like this one become more mature by how it is used by programmers around the world. The model evolves based on their understandings and feedback . As far as i have seen, people have concentrated more on the amazingly utility it gives more than the model that should be followed for better maintainability and cleanliness. This is a very important point considering the very nature of this scripting language. It can get too messy when the scope increases.
I may not be the right person to speak on it. The World’s Most Misunderstood Programming Language would be the right place for further reading and understanding.
Think twice before you plan to get a book on Javascript if you intend to learn deeper and proper concepts. Source for the right Javascript concepts are still a confusion and cluttered one inspite of it’s stupendous usage across the world.
Add comment November 12, 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
Simple Dojo Grid
Hi Friends. I was working on a simple data grid using Dojo. Thanks to SitePen’s blogs. It was quite useful except for the fact that i messed up with the css and took some time to make over.
Dojo makes an intensive use of JSON and it’s really a brilliant idea which is evolving quite firmly. We are there to use JSON more in the future.
Try to deploy in any web server and make sure the Dojo, Digit and Dojox are in the path of this file which we deploy.
<html><head>
<script type=”text/javascript” src=”dojo/dojo.js” djconfig=”parseOnLoad: true, isDebug: false”> </script>
<script type=”text/javascript” src=”dojox/grid/Grid.js”></script>
<style type=”text/css”>
@import “dojox/grid/_grid/tundraGrid.css”;
</style>
<script type=”text/javascript”>
var data = [
[ '4001', 'SB', '19/10/1983', '19/10/1920' ],
[ '4002', 'SB', '20/10/1983', '20/10/1920' ],
[ '4003', 'FD', '21/10/1983', '21/10/1920' ],
[ '4004', 'FD', '22/10/1983', '22/10/1920' ]
];
var cell = { name: ‘Cell Name’ };
var subrow = [ cell ];
var view = { rows: subrow };
var structure = [ view ];
var subrow = [
{ name: 'Account Number' },
{ name: 'Account Type' },
{ name: 'Start Date' },
{ name: 'Expiry Date' }
];
var view = {
rows: [ subrow ]
};
var structure = [
view
];
var model = new dojox.grid.data.Table(null, data);
</script>
</head><body class=”tundra”>
<div id=”grid1″ dojotype=”dojox.Grid” autowidth=”true” model=”model” structure=”structure” class=”grid”/>
</body></html>
PS:- Try the latest Dojo version to avoid any mishaps.
Oho… This is not the way to go. Try dojo toolkit version 1.2 grid like given here
One problem regarding working on DOJO is the lack of documentation and heavy depencendy on search engines. This has been felt/discussed in many places. When i had to find the list of dijit widgets i could not get proper answers. Finally found this link: http://redesign.dojotoolkit.org/jsdoc/dijit/HEAD/dijit.form.
And do write in your comments when you try to populate grid using JSON or any other technique.
2 comments September 30, 2008
What does web 2.0 means to the users ?
This is one question which raises in my mind frequently these days. Every day there is a new startup and everyday the garage filled up with a new idea or a betterment sort. There is a truck load of information we can find across all the street corners of the web.
Has any one took hold of the market or does it need more time to evolve? Are we designing anything which centers society and social welfare? Do we really have time to explore new applications or are we wasting our valuable time before the PC.
One thing i could see is that there are lot of blogs made about many yet another web 2.0. How much the IT majors fund/invest on these startups? Does it open new IT oppurtunities? Does technology and application ideas flow parallel to complement each other?
How much time can we effectively(recommended) spend on a web 2.0 in an average? This question is irrelevant to the geeks or the developers. But it’s most relevant to the average consumer of the services of web 2.0.
There are more serious question waiting to be posted on these web 2.0 companies and service providers.
Add comment September 26, 2008