I found this in one of my friend's Orkut profile. I wanted to proudly have it on my blog...
கனியிடை ஏறிய சுளையும் – முற்றல்
கழையிடை ஏறிய சாறும்
பனிமலர் ஏறிய தேனும் – காய்ச்சுப்
பாகிடை ஏறிய சுவையும்
நனிபசு பொழியும் பாலும் – தென்னை
நல்கிய குளிரிள நீரும்
இனிய என்பேன் எனினும் – தமிழை
என்னுயிர் என்பேன் கண்டீர்
Tuesday, December 22, 2009
Saturday, September 12, 2009
Hands on with SimpleFormController and DisplayTag
Recently, I got to work on SimpleFormController (Spring Framework class for handling web Form) with DisplayTag . It took me a while to get used to SimpleFormController. I should also mention that at first look it might seem lot of mess instead of trying to solve your problem, hey won't you get that feeling whenever you are trying to use any new technology??
I had to use debugger to understand the flow of control from various method. But you can follow this cheat sheet for complete flow diagram for SimpleFormController. You can inherit lot of methods based on your requirements, however following methods are the usual ones.
formBackingObject : will be called by createCommand method from SimpleFormController. On form request, if sessionForm is set to true the model object created by formBackingObject is put in session. On form submit, the object is taken from session and not created once again.
Sample code:
onSubmit: All form submit logic have to go into this. I would suggest you to go through javadoc for all onSubmit() variant.
Here, you can also include a check to see if the request is for DisplayTag pagination or actual form submission and you don't have to form submit logic for pagination requests.
isFormSubmission: Default implementation of this method returns true when request method is "POST". You can override this to change its behavior. You would have to do this when you want to use DisplayTag pagination. I have given the sample code below.
referenceData: I didn't have to implement this method for my hands on.
DisplayTag:
DispalyTag provides lot of feature for high-level web presentation patterns like paging, cropping, sorting and exporting etc. The implementation with spring is pretty neat. All you have to do is add below dependency in your pom.xml
Or add displaytag-1.1.jar jar file into WEB-INF/lib. You are all set. For other configuration options, go through DisplayTag documentation.
I found this useful article on http://devx.com on Displaytag.
For my hands on , the JSP looks like the one below with DisplayTag code.
I hope this would be helpful. Please post your comments.
I had to use debugger to understand the flow of control from various method. But you can follow this cheat sheet for complete flow diagram for SimpleFormController. You can inherit lot of methods based on your requirements, however following methods are the usual ones.
protected Object formBackingObject(HttpServletRequest request) throws ServletException;
public ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception;
protected boolean isFormSubmission(HttpServletRequest request);
protected Map referenceData(HttpServletRequest request) throws Exception;
formBackingObject : will be called by createCommand method from SimpleFormController. On form request, if sessionForm is set to true the model object created by formBackingObject is put in session. On form submit, the object is taken from session and not created once again.
Sample code:
@Override
protected Object formBackingObject(HttpServletRequest request) throws ServletException {
SearchForm command = new SearchForm();
command.setName("Default_");
command.setPageSize("10");
return command;
}
onSubmit: All form submit logic have to go into this. I would suggest you to go through javadoc for all onSubmit() variant.
@Override
public ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response,
Object command, BindException errors) throws Exception {
SearchForm searchParam = (SearchForm) command;
System.out.println("your input is ... " + searchParam);
ModelAndView mv = null;
mv = showForm(request, errors, getSuccessView());
String pName = searchParam.getName();
if (pName == null || pName.length() == 0) {
pName = "Default_";
}
ProductSearch st = new ProductSearch();
st.setProducts(Util.getTableData(pName, 50));
HttpSession session = request.getSession();
session.setAttribute("TABLE_DATA", st.getAllProducts());
session.setAttribute("pageSize", searchParam.getPageSize());
System.out.println("done search ..... displaying results");
return mv;
}
Here, you can also include a check to see if the request is for DisplayTag pagination or actual form submission and you don't have to form submit logic for pagination requests.
isFormSubmission: Default implementation of this method returns true when request method is "POST". You can override this to change its behavior. You would have to do this when you want to use DisplayTag pagination. I have given the sample code below.
@Override
protected boolean isFormSubmission(HttpServletRequest request) {
return !request.getParameterMap().isEmpty();
}
referenceData: I didn't have to implement this method for my hands on.
DisplayTag:
DispalyTag provides lot of feature for high-level web presentation patterns like paging, cropping, sorting and exporting etc. The implementation with spring is pretty neat. All you have to do is add below dependency in your pom.xml
<dependency>
<groupId>displaytag</groupId>
<artifactId>displaytag</artifactId>
<version>1.1</version>
</dependency>
Or add displaytag-1.1.jar jar file into WEB-INF/lib. You are all set. For other configuration options, go through DisplayTag documentation.
I found this useful article on http://devx.com on Displaytag.
For my hands on , the JSP looks like the one below with DisplayTag code.
<form name="product_search" action="formpage.html" method="POST">
Name: <spring:bind path="command.name">
<input type="text" name="${status.expression}"
id="name" value="${status.value}" />
</spring:bind>
Type: <spring:bind path="command.type">
<input type="text" name="${status.expression}"
id="address" value="${status.value}" />
</spring:bind>
<input type="submit" value="Submit"/>
<input type="hidden" value="${pageSize}" name="pageSize" />
</form>
<c:set var="searchResultPageSizeOptions" value="10,25,50" />
<c:set var="selectedValue" value="10" />
<spring:bind path="command.pageSize">
<c:if test="${!empty pageSize}">
<c:set var="selectedValue" value="${pageSize}" />
</c:if>
<select name="<c:out value="${status.expression}"/>" id="pageval" onchange="javascript:changePageSize();">
<c:forTokens items="${searchResultPageSizeOptions}" delims=","
var="localPageSize" varStatus="status">
<option value="${localPageSize}" <c:if test="${selectedValue == localPageSize }">
selected="selected"
</c:if> >${localPageSize}
</option>
</c:forTokens>
</select>
</spring:bind>
<display:table name="sessionScope.TABLE_DATA" pagesize="${pageSize}" requestURI="formpage.html" class="results-table">
<display:column property="id" title="ID" sortable="true" />
<display:column property="name" title="Name" sortable="true" />
<display:column property="type" title="Type" sortable="true" />
</display:table>
</div>
I hope this would be helpful. Please post your comments.
Saturday, August 29, 2009
Outlook crashing with "Cannot start microsoft office outlook" msg
My outlook was crashing with "Cannot start Microsoft Office Outlook. Cannot open the Outlook window." error message. I had no clue what went wrong, but I knew why it was barfing on me. I was in a hurry to force shutdown my laptop yesterday. And I forgot to close Outlook (I closed every other running applications) before that.
The solution is ---
Start->run..then type the following -> "Outlook.exe /resetnavpane"
It worked like a charm!
The solution is ---
Start->run..then type the following -> "Outlook.exe /resetnavpane"
It worked like a charm!
Wednesday, August 19, 2009
Git is Awesome!

I got introduced to a distributed version control system called "Git". Git is not like traditional version control systems like SVN or CVS, but which provides much more features a developer can imagine/ would need for those painful code merges.
I had gone through this wonderful presentation by Bart Trojanowski and you can find them here. Bart provides brief intro on how Git works and how the version is tracked in Git ("the close to perfect" SCM). Then he goes on explaining about major features a developer would need to start using Git.
This presentation have been highly helpful for me to get grasp of Git. I want to thank Bart for this wonderful presentation and Ian Ward for making this screen-casts available online.
I installed Git on my PC machine using Cygwin. The stack is pretty awesome and neat. I would recommend the same for any PC users. When installing Git packages for cygwin, make sure you also pull in GUI tools ( gitk and git gui). If you are a tortoiseSVN or tortoiseCVS user, these tools would of great help.
Git uses local repository and does not need a remote (central) repository to get started. However, if you'd like to use some public Git repo servers for your hands-on, you could use either GitHub or repo.or.cz.
Follow the below link for setting up an account in Github. This is a screencast provided by learningrails website.
Version control with git.
As a summary, Git is a great version control system among other systems out there. Which comes with lots and lots of documentation, online tutorials and FREE public Git repositories. All of these could help developers a hassle-free transition towards using Git.
Sunday, November 2, 2008
Great South Indian Recipes, I came across
A syndication of few blogs for south Indian recipes::
http://letzcook.blogspot.com by Deepz
http://veetusamayal.blogspot.com/ by Kribha
http://www.kamalascorner.com/ by Kamala
http://tamilcuisine.blogspot.com/ by Revathi and Crew
http://letzcook.blogspot.com by Deepz
http://veetusamayal.blogspot.com/ by Kribha
http://www.kamalascorner.com/ by Kamala
http://tamilcuisine.blogspot.com/ by Revathi and Crew
Friday, July 25, 2008
: $'\r': command not found in Cygwin
If you happen to have this kind of error for no reason, please make sure you convert your shell script file to UNIX format using any text editor like Notepad++. Initially it seems like a weird error but yet another valid issue with Cygwin + XP editor.
Here is an example, If you create a script in Notepad++
-------------------------------------------------------------------
#!/bin/bash
#
# My Cygwin weird error
#
clear
echo "Knowledge is Power"
-------------------------------------------------------------------
When you run this script directly from Cygwin (by editing it from Notepad) you might forget to set the file format to Unix. This often result in following error.
-------------------------------------------------------------------
./print_a_line.sh: line 1: $'\r': command not found
Knowledge is Power
-------------------------------------------------------------------
Or,
You can convert them to UNIX format using shell utility dos2unix
So, Thats it! You are set!
Here is an example, If you create a script in Notepad++
-------------------------------------------------------------------
#!/bin/bash
#
# My Cygwin weird error
#
clear
echo "Knowledge is Power"
-------------------------------------------------------------------
When you run this script directly from Cygwin (by editing it from Notepad) you might forget to set the file format to Unix. This often result in following error.
-------------------------------------------------------------------
./print_a_line.sh: line 1: $'\r': command not found
Knowledge is Power
-------------------------------------------------------------------
Or,
You can convert them to UNIX format using shell utility dos2unix
So, Thats it! You are set!
Thursday, July 10, 2008
Getting Power of Attorney from Indian Consulate
How to get Power of Attorney from Indian consulate??
You might be thinking "Why is someone creating a blog on how to get POA....??" Well, you are right! there is no big deal with that. But I found it difficult getting this only because "lack of information". So, i thought it would help ppl out there searching for some info on this. After all internet is used for that "Information" Right?!
1. Going personally to Indian Consulate.
Make sure you have the following documents....
i. A Completed Miscellaneous form (download it from consulate website)
ii. POA documents to be signed by Consular.
iii. Photo copy (Xerox) of POA document (you need to hand this over to consulate)
iii. Original passport
iv. Photo copy (Xerox) of passport (you need to hand this over to consulate)
v. 2 passport photo (1 is enough for misc form. but you may want to affix a photo on POA and sign on it. This is not consulate requirement though)
vi. $20 for consulate fee.
The consulate (i went to NY consulate) usually opens at 9.30am. The documents are accepted from 10am to 12.30am. You need to wait until 4.30pm to get the documents signed. The guy who is in information center was quite helpful.
DO NOT SIGN ON ANY DOCUMENT (esp. POA). You should do it in front of consulate official at the counter.
Even if you have not taken your photos, there are few photo centers, you could get it in an hour or so.
2. Getting this document signed through mail
i. Misc form and copy
ii. POA documents duly notarized and copy should also be notarized. This is just attestation that you are signing the document in front of some official trusted parties.
iii. Money order for $20 (fee)
iv. Original Passport and a copy
You need to also include return currier charge for consulate to send them back. Please check your consulate site for more information.
Send all these documents in mail and they are supposed to be delivered back in 5-7 working days.
You might be thinking "Why is someone creating a blog on how to get POA....??" Well, you are right! there is no big deal with that. But I found it difficult getting this only because "lack of information". So, i thought it would help ppl out there searching for some info on this. After all internet is used for that "Information" Right?!
As I said, No big deal, In two options you can get this done.
1. Going personally to Indian Consulate
2. Getting this document signed through mail
1. Going personally to Indian Consulate.
Make sure you have the following documents....
i. A Completed Miscellaneous form (download it from consulate website)
ii. POA documents to be signed by Consular.
iii. Photo copy (Xerox) of POA document (you need to hand this over to consulate)
iii. Original passport
iv. Photo copy (Xerox) of passport (you need to hand this over to consulate)
v. 2 passport photo (1 is enough for misc form. but you may want to affix a photo on POA and sign on it. This is not consulate requirement though)
vi. $20 for consulate fee.
The consulate (i went to NY consulate) usually opens at 9.30am. The documents are accepted from 10am to 12.30am. You need to wait until 4.30pm to get the documents signed. The guy who is in information center was quite helpful.
DO NOT SIGN ON ANY DOCUMENT (esp. POA). You should do it in front of consulate official at the counter.
Even if you have not taken your photos, there are few photo centers, you could get it in an hour or so.
2. Getting this document signed through mail
i. Misc form and copy
ii. POA documents duly notarized and copy should also be notarized. This is just attestation that you are signing the document in front of some official trusted parties.
iii. Money order for $20 (fee)
iv. Original Passport and a copy
You need to also include return currier charge for consulate to send them back. Please check your consulate site for more information.
Send all these documents in mail and they are supposed to be delivered back in 5-7 working days.
Labels:
consulate,
embassy,
indian,
new york indian embassy,
power of attorney
Subscribe to:
Posts (Atom)
