We are now releasing Tell-A-Friend widget for public use.
One of the features that makes this widget stand apart from rest of the widgets is that, if you wish to change the design of the buttons (be it the color, size or appearance), you don't have to embed a new or modified code in your webpage/blog. This helps save a lot of copy-paste exercise, which is kinda a welcome feature for lazy bums like me. All one has to do it to go to the accounts page, choose the kinda button they like, save the changes and then its all Eureka. All the changes are instantly reflected in the blogsite/webpage where TaF is embedded. Now, isn't this something cool ??
Apart from wiring a few connectors in the TaF widget, I worked on the analytics collection module. This was a pretty good learning exercise. I got to know more about the Apache log4j utility. These Apache guys are real bonds. They write some pretty good stuff.
For analytics collections, I wrote a custom JDBC appender to log all data. This has many advantages.
1) It consumes only a limited database connections.
2) Requests are served on first-come-first-serve basis. So, everything is sequential in nature in accordance to time. (log4j uses a queue)
But then, there are possible pitfalls too !!
Imagine that there are many requests, this will increase the queue size, thus increasing the response time. As of now, we have tested our infrastructure for traffics much more than we are expecting. If anyhow, response time does gets a beating, switching to a distributed system would be a possible solution which I suppose would require a bit of tweaking.
May be I will soon write another post on how to write custom JDBC appender and on analytics collection framework of works.
Showing posts with label web development. Show all posts
Showing posts with label web development. Show all posts
Thursday, July 31, 2008
Monday, January 21, 2008
JSON and HashMap
DWR is used for easy 'AJAX for JAVA' and is employed to call Java methods from Javascript (version 2.0 + supports reverse-AJAX too).
Working on the ShopprStream(earlier known as WEB122) has helped me get acquainted with many facets of web-development.
Now I have a Java method that returns a generic HashMap object ;
For this example lets consider that the key is of type String
And the elements are instances of the class CustomClass with name (of type String) as instance variable
The DWR call will return a JSON object. This is how we can access the dat a
If the HashMap contains custom objects, make sure it has a corresponding converter entry in the dwr.xml file
for example, if my class is called CustomClass, then write as
<convert converter="bean" match="com.pramati.web122.imsupport.ContactDetail"/>
Here, abc.xyz is the package structure
If object returned is hashmap, then values can be accessed as:
hasMap[key]
If object returned is hashmap, then values can be accessed as:
hasMap[key][0], hasMap[key][1], hasMap[key][2] . . . . .
Working on the ShopprStream(earlier known as WEB122) has helped me get acquainted with many facets of web-development.
Now I have a Java method that returns a generic HashMap object ;
For this example lets consider that the key is of type String
The DWR call will return a JSON object. This is how we can access the dat
for (var key in hashMap)
{
//if not using Firebug, comment out console.log statements
//'key' is the key in the HashMap
console.log("key : "+ key);
//this will give the no. of elements stored corresponding to the 'key'
console.log("hashMap[key].length: "+ hashMap[key].length);
//Access individual elements corresponding to the 'key'
for(var i=0; i<hashMap[key].length; i++)
{
console.log("hashMap[key][i].name: " + hashMap[key][i].name);
}
}
If the HashMap contains custom objects, make sure it has a corresponding converter entry in the dwr.xml file
Here, abc.xyz is the package structure
If object returned is hashmap
hasMap[key]
hasMap[key][0],
Labels:
AJAX,
HTML,
Java,
JavaScript,
newbie blues,
programming,
web development
Thursday, January 17, 2008
Helpful JavaScripts
To bring focus to a text box / button or any other element
just add this javascript in the HTML code:
for example, the following code will bring focus to the textbox that has the id email
just add this javascript in the HTML code:
where elementId the id of the element on which the focus is to be set
<script type="text/javascript">
document.getElementById("elementId").focus();
</script>
for example, the following code will bring focus to the textbox that has the id email
<input type="text" id="email" />
<script type="text/javascript">
document.getElementById("email").focus();
</script>
Subscribe to:
Posts (Atom)