Tuesday, July 12, 2011
Structs2 HelloWorld web Application
1) Eclipse IDE : Eclipse Java EE IDE for Web Developers
2) Add m2eclipse Plugin to your Eclipse instance
3) Maven Automated build environment
4) Apache tomcat server 6
when you have those applications running on your computer you will be able to follow the instructions given below to create java web application using Struct2 framework.
First start eclipse IDE and create Maven Project. To create Maven Project follow following steps.
File -> New -> Other
This will open select a wizard window.
Selce Maven and then selcet Maven Project and then click next.
Then it will ask for project name and project location
From this window tic on default workspace location.
Click next
Now you need to select project archetype.
select maven-archetype-webapp. or type maven-archetype-webapp under filter section.
Click next
Provide Artifact ID. For this project i use Structs2XMLConfigurationExample
provide Group ID. For this project i use com.vaanila.action
Now click finish.
Now you should be able to see the newly created project in the Project Explorer window.
Now , you have to add few plugins to pom.xml file created by maven automated tool for your project.
you need to add following configuration to the build element of the web application
<build>
<finalName>Struts2Example</finalName>
<plugins>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.8</version>
<configuration>
<wtpversion>1.5</wtpversion>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
After adding this configurations run from the command line
mvn clean install
This command will download the required jars for the project to your project location.
then run
mvn eclipse:eclipse
This will import the configuration to eclipse IDE.
Tuesday, May 24, 2011
Maven + Eclipse + JSP How To and How NOT To create web application
Points to observe during this tutorial
mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-webapp -DarchetypeArtifactId=maven-archetype-webapp
You will notice that the generate goal created a directory with the same name given as the artifactId. Change into that directory.cd my-appUnder this directory you will notice the following standard project structure.Now , you have created maven web application, Very important point to notice here is that, web application project structure created by maven is different form project structure created for a web application using eclipse IDE without using Maven. Keep this point in mind, i will later come to this point and explain how this difference could affect development activities.Same project structure can be created if you are using m2eclipse plugin. .
Wednesday, April 27, 2011
How to customize magnolia Standard Templating Kit(STK)
Above figure depicts initial window will be opened after installing magnolia STK. Configuration of demo project templates and paragraphs are done through Templating Kit side menu.Demo project's CSS and java script files are also edited through the features provided under this menu. Now lets try understand how different elements presented under Templating Kit wire up together to build up professional website. At first , organization of different configuration elements of the demo project looks daunting in it's complexity.
Above figure tries to explain how to Home page of demo project is derived from the site prototype. As you can see, Home page has several parts such as Header, Stage , MainArea , Promos Area etc. Site prototype also has those areas define. if you remove header form the site prototype , it will not be displayed on the final output. To demostrateTuesday, April 5, 2011
How to set up Magnolia Author and Magnolia Public instances on eclipse
When i was searching the Google for magnolia + eclipse key words , oh, unfortunately i hit with following page.it is about retrieving magnolia source to our environment. But here what i need is not magnolia source. it is magnoliaAuthor and magnoilaPublic war files. those files should be set up on our eclipse environment as a project with the use of mvn automated build environment.Requirement of such a set up is this. say, you are developing a module for eclipse then each time when you want to test your module you have to build your module jar and upload that in to magniliaAuthor or public applications lib location. But since we are using mvn we can automate this process if we have magnoliaAuthor and public instances running on our workspace as a project. for this propose we don't need magnolia source.
Then i changed key works in to magnolia module development + eclipse. yes! that is what i was looking for. This mail discussion contains the information i was searching for.
This page contains two url's regarding to magnolia module development.
http://www.mail-archive.com/user-list@magnolia.info/msg08267.html
Wednesday, March 9, 2011
Hello World Application Using Magnolia CMS
How to decide whether to use CMS for a new Web Project
First i want to explain that, any static website like web sites implement for school's company profiles can be easily implemented with the use of CMS. But that is not the focus of this post. Main reason of CMS to come in to play in software world is not to support those minor requirement. So lets try to discover this key reason to have those and get the maximum benefit of those to our project.
Sunday, March 6, 2011
Google Code Jam , World finals 2010 - City Tour
At the begining, i have small problem with quection description. Quection description says that How to build the city.
according to my understanding the dicription as follows
Initially there are 3 cities. These 3 cities are connected by 3 bi directional lines. So visual representation of this is as follows.
Following is the discription which gives us an idea like above." the cities started from three points of interest, with each pair being connected by a bidirectional street"
Now , what is next, it says how it evoles from this point onwards.
"then, gradually, new points of interest were added. Any new point of interest was connected by two new bidirectional streets to two different previous points of interest which were already directly connected by a street. "
which means that, if i add new point to above figure , it will looks like as follows.
But when we try to understand the first sample input from this view, it gives nothing.First input says something like follows.
| Input | Output |
2 | Case #1: 4 |
Ok what is this first input set means. it says there are 5 points of interest. Ok, according to our understanding, it says, there are 2 more points of interest than 3 main points of interests. So , we already know how it's connection looks like according to the previous decription. but it gives us 1,2 and 2,1 two streets.
Also here is the dicription about these inputs.
"
The next N-3 lines each contain a pair of space-separated integers A, B, indicating that the corresponding point of interest was connected by streets to points A and B. First of these lines corresponds to point number 4, second to point number 5, etc. "
if there are 5 points, then 5-3 is 2, so we should have give two (x,y) point inputs. yes they have!
it is interesting to look how we missunderstood this problem.
We thought that (x,y) represents cordinates, but they are not corrdinates, why did we think they are cordinates. Since we did not quection basic thing at the biggning of the quection. what it is. if two newly added points are connected to first 3 points by two bi-diractional lines, there are 3 ways in which this can be done, so we should be given correct configuration. if we had quection this at first, then we won't decide those input to be coordinates! :)
Friday, March 4, 2011
JCR Content Repository : Why do i need it for my project
Tuesday, March 1, 2011
Hibernate Simple Web application
Saturday, February 26, 2011
Apache Solr : How can i used Apache Solr to implement search functionaly in my web project
Ok, now we have small idea about it's power. As a first step to get the concepts behind apache solr, lets start by starting it on apache tomcat server.
Since i am following this totorial , i preffere using jetty server to run solr. But running it on apahe tomcat is not a big deal, just copy war file in to web apps directory in your tomcat folder.
To do this you need to download extract solr server then to goto examples folder and run java -jar starup.jar . Thats all you need to do to get it running on jetty server.
Friday, February 25, 2011
How to configure your application on the start up using Constretto
First i sarted following following tutorila to write helloworld time application and then to move towords more advanced topics.
Opps , at the start of the tutorila seems a problems
Totorial is written using MVN automated build system. I am new to MVN as well. But i have little understanding of its behaviour , so it will help me to contitune this tutorial successfully.
Following line at the begining of the tutorial might means something similart to following.
"It allows you to “tag” configuration values, so that Constretto could choose the correct value at runtime."
Constretto gives tag for each and every configuration value. So during hte runtime using the this tag value , it can deside which configuration value to be used. i am wondering why they have mentioned at the begining of the torrorial. Because, we know that, if there is a configuration file with lot of values , then there should be some mechanisum to identify each and every configuration value identically. So this is nothing strange right :\
But next line says something very important for me, it says that , Constretto supports different configuration mechanisums. Hmm, before looking in to tutorial , i didn't know even one configuration mechanisums. So it says development community is already following different configuration mechanisums.
"It also works as a bridge between different configuration formats, and currently Java property files, Ini files, and Java Beans are
supported."
I usually prefere reading introduction when ever i am about to something new. So here no different :)
First step is to crete mvn project. i have used eclipse IDE and m2eclipse plugin installed on it. Alos you can take any other path as you wish.
When you are done with crating project skelton using MVN , you will find System.out.println("Helloworld"); Line at sample class created by you using mvn simple project skelton.
OK, now we are going to have fun with Constretto technique of configuring the project.
OK i added following code in to App.java class
ConstrettoConfiguration config =
new ConstrettoBuilder()
.createPropertiesStore()
.addResource(new DefaultResourceLoader().getResource("classpath:test.properties"))
.addResource(new DefaultResourceLoader().getResource("file:test2.properties"))
.done()
.createIniFileConfigurationStore()
.addResource(new DefaultResourceLoader().getResource("classpath:test.ini"))
.done()
.createObjectConfigurationStore()
.addObject(new Object())
.done()
.createSystemPropertiesStore()
.getConfiguration();
This is not a big deal, just copy this code segment from this tutorial https://github.com/constretto/constretto-core
Now in the above code sample you can see that configuration file is given in so many different ways, So i would like to know how classpath.test.propeties gives the path to property file.
Ok putting classpath.test.properties file in so many different places helped us to resolve this issue. Now comes the most interesting part of this problem. I want to put this file in the location that i am interested reather than in the place it is given still using classpath.test.properties method.
Thursday, February 10, 2011
How to use maven for your project.
In this part of the tutorial , we will be looking at how to use MVN as a build tool for a web project.
Since i am new to MVN , i have many problems with regards to usage of MVN as you would. So
When i was browsing the internet for "MVN totorial" first thing i found was Thils.
Since i have downloaded MVN and started following 5 min guide at here. i was faced with following problems.
When i was followng this tutorila using eclipse , it gave me more visual information about following command if you are using command line to genearate MVN project structure.
mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app
-DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
M2Eclipse plugin provides visual interfaces during project strucutre generation phase to select thise options. Following option took my interest to investigate more since that does not mean any thing to me when i was looking at it for the first time. Following is the screen short for M2Eclipse page.

it asks you to select appropriate archetype plugin. hemm, in my vocabulary there is no such name. That is software engineering. it is full of such strange terms. Lets try to get this term in to our terminology.
Saturday, February 5, 2011
First JSP applicatoin
Now follow the steps given in above figure after creating repository at github.comok , you are done, following above steps is easy. Also make sure that you have added your public key to the github to follow above steps with out problem :)
Now , what is the next problem. it is MVN right. we have decided to use MVN as our build tool. so how to go about integrating MVN in to our project.
Tuesday, December 14, 2010
How to use GIt



git config user.name "Your Name" git config user.email kapila@ntp.org
You can understand this from the following example also. Say you are working on a project which has 100 developers.
So you are the program manager and , what you first do is create git account in github.com, this has nothing to do with
your local machine.
or else , first create new project in remote repo and then make a pull.
here goes how you do it
following window shows how you create new repository.

it will point you to the following window.
it says, what to do next. so you have project that is sync with github and all your source code reside in github nowww!
Sunday, November 21, 2010
Web 2.0 Summit, Eric Schmidt
Q: There has been a lot of talk about a new operating system aligned with a potential hardware device, coming from Google. We’d love to see it if that was possible.
ES: OK. How about instead a demonstration of some software.? So, I happen to have here an unannounced product that I carry around with me. That is an Android device, and we have taped over its origin.
You see, this is a placemark [showing a placemark panel, obviously with a tag in it]. The neat thing you could do with this new technology called NFC (which stands for Near Field Communication), and we think that Android should support that. It’s been around for a while, by the way.What you do is, these are chips that are embedded in things, eventually in clothes to prevent people from stealing. These chips are senders, and we are incorporating support for the reader-writer, so the way it works is you turn this thing on and you basically just tap like that, and it tells you, in the particular case, where you are.
What’s neat about the NFC chip is that the whole notion of location takes an entirely new meaning, because now I can just tap, I don’t have to take a picture, I don’t have to scan a barcode.
Q: So this is basically gonna be in presumably many of the new Android phones.
ES: It’s actually gonna be in the new operating system called Gingerbread that comes out in the next few weeks. So we think that the overall mobile market, which is already extraordinarily excited about these payment systems, will benefit from having those, because it is a secure element, and the secure element really is very hard to steal if you will.
Q: So, the secure element allow you basically to do payment.
ES: One way to think about this is that is that it will replace your credit card. The term of the industry is called tap and pay. The theory of the case is that you will be able to take these mobile devices from everybody, to walk into stores, do commerce, you’ll be able to figure out where you are, again, with your permission, all that kind of stuff.
Q: Effectively, bump for everything.
ES: Yes, bump for everything, and eventually, replace credit cards.
Q: It also turns the phone into a much more powerful form of identification.
ES: It’s an example of what I have talked about for a while, which is “mobile first”. I don’t think that people understood how much more powerful these mobile devices are going to be than the desktops. You think of the desktop machine as having all this power and tremendous network, beautiful screen, but because these things are so highly personal, and because they are location aware, …
Q: They also have network
ES: Yes, with LTE networks coming to the United States, first in the world, for a change, roughly in January-February around the country, it is a really really god day for mobile.
Q: With the theme of points of control, it strikes us that one of the points of control is having tons and tons of credit card numbers; Amazon has tons, Paypal has tons, Apple has a lot. Combined with this kind of technology, it strikes me that it could possibly change the game. Do you agree with that, and where does Google stand with that.
ES: Well, we see ourselves as a technology provider in this, we’re not trying to compete in those spaces, but ultimately this technology is personal, it’s secure, and it’s an aggregating technology. So it makes sense that you put everything in it and carry it around. It has to be secure, because it’s obviously going to be used as money repository.
Q: But still, if you are doing payment, somebody is doing the payment processing.
ES: There are industrial partners for all the initiatives in the industry, with very sophisticated payment processors, and regulations, and all
Q: You expect to be a partner there rather than …
ES: Absolutely.
Q: But you do have Google checkout.
ES: Remember, Google checkout is just a piece of this. Payment processors do something different. They actually deal with the merchants, moving the money around, you know with fraud and so forth. The reason why this NFC dhip is so interesting is because the credit card industry thinks that the loss rate is going to be much better, because they are fundamentally more secure. And ultimately, the money that brings us all to this wonderful venue comes out of commerce in one way or another; advertising in Google’s case. My guessis that there will be 500 new startups in the mobile payment space as these platforms emerge, with all these new and interesting things that we can do.
Q: What I’ve been fascinating by is the idea that this is gonna change is shorten the loop between the search and acquisition of a product. Right now, we see this in buying an app: you search for the app and then you buy it on the phone. But this really makes it possible in the real world. You can search for something, and …
ES: But, forget search. Well, I shouldn’t exactl say that, but that’s a joke. Imagine I am walking down the street, and instead of typing my search, my phone is giving me information all the time, and it happens to know that I need new pants or something. You can imagine all sorts of linkages between autonomous search, and location-based search, where you are, where your favorite stores are, what your preferences are, again if you opt in to these situations. Its likely to drive a very very large mobile commerce business and mobile e-commerce business. And the scale of commerce is 14 trillion dollars, which is the global GDP, so some large amount of money is to be gotten in these new platforms over time.
Q: And you can really how this could be a fabulous tie with groupon, because it tells you that there is a crowdsourced offer.
ES: Again, if you look at groupon as a very good example of a very very successful local merchant, they today use e-mail as their primary acquisition mechanism, but they have competitors which are using other techniques. What we know is that people like a deal.
Q: One last question on Android. What are you dissatisfied about with regard to the platform, and what do you think need to be fixed, if anything.
ES: You score Android against the historically leader in the space, which is the iPhone, and I do this as a proud former board member of the Apple world. There is a set of things that the iPhone really did a brilliant job of bringing out in a closed system. Brilliant design, the app store, the platform and so on. So most people judge Android by how we are doing relative to that. And it’s clear that from a reach, choice, and so forth, we are in great shape. The next real focus is at the applications layer. So I think that if I want to be critical, I would have liked to put more emphasis on the application side earlier. It’s hard, because remember, the application decisions are made based on developers, who do it based on volume. So you have to establish volume first, which is something that I think we have done with Android. And for all of these players at the third-party level, and again I know that we have a lot of developers here in the audience, it’s fundamentally about the math of the platform. So we understand platforms very well, we think that Android will be, if not the leading platform, a leading platform.
Q: That brings up a question that I have been thinking about. As there are more and more applications, it becomes a search problem to figure out which one to choose, and that’s one of your sweet spots. But you don’t have some of the same mechanisms for identifying the best apps. How are you thinking about search as a competitive advantage as the application space grows, where the Android Market is the Google of the app space?
ES: We don’t think of it as a competitive edge, we just try to do it better, and the competitive environment will win. As a comment, I think people are obsessed with the competitive landscape, where what they should really be focusing on is how much bigger the market is getting. And because it’s, including the leadership that you guys did with Web 2.0 so many years ago, this is a very large universe, that is getting much larger very quickly, bringing more and more people into it. So the competition is healthy, what’s really happening is you’re growing the market. So with respect to the applications and application search, there’s all sorts of interesting ways of doing that; Admob, for instance, is doing on the order of a billion ad impressions a day now, and that kind of information, in theory, is useful as part of a search problem, because ads have a real value, and we really believe that. There are many many ways in which the information people are using, usage patterns, can be used to provide better choices. But you’re correct that these markets tend to overcorrect; They have millions of apps, whatever, but then ultimately, the leaders emerge.
Q: One of the things that Steve and Apple did right is the about divorce from the carriers, the ability to pretty much say: I don’t want your stuff on my phone. Do you think that Android is ever going to be truly free of that …
ES: I certainly hope so, in the sense that the Android model is different from the Apple model, very distinctly on pretty much every point. It’s open system vs. Closed system, and closed systems have their advantages, and open systems have their advantages. Google made a bet on open systems. We are willong to let the vendors, the carriers, and so forth, set their pricing, set their distribution terms, and so forth. I think that ’s the right model.
--------------------------------------------------------------------------------------
11.54
Q: Recently there was a big story and a fellow lost job over the story. (understand i was presumed for disclosing it) you are giving raise to everybody at Google.And That is being confirmed. can you talk bit about the environment that we are in right now, for talent. and how you came to this decision.
ES: Well, Origin over the raise were later in the sprint, that was six months ago, when we are looking at our forward revenue, we realized that we still sort of carrying the memories of recession. what we have to do and so forth. So we made series of decision at the time. One of which is to significantly invest in core parts of our business. core advertising core search. As a result of that investment, Google instant came out , which is huge success. advertising products, success in our display business, deal with now, come along to a view which we are called hockey strike.we are looking for hockey strikes -------- and we are just pure resources. Another decision we made to do with the time is to focus on for even more acquisition's. we did review of our acquisition strategy to how well the head works for us, android for example came in as an acquisition. maps came in as a acquisition, i am giving you examples after example , something abut the how crushable about the acquisition is that it produces these Gem which we can --------------- and grow them very quickly. third one we have to do is to shearing the success of the company
Thursday, November 18, 2010
Designing Logic Layer of a web application
- Retrieving Master Data
- Institute Master entries should be loaded to institute drop down box,
- Role Master entries should be loaded without considering the department to the role drop down box.
- Reference tag table need to be searched for the characters that user entering and matching tags should be displayed to the user as drop down list in the text box.
- Adding New Master Data
- New Institute should be allowed to add to the institute table for a given SAASCompany. (because, we can not expect candidates to have there experiences in the companies that we are given. So HR should be able to add new company if it does not exist)
- New Role should be allowed to add for a given SaaSCompany and for a given department. (because, we can not expect candidates to have performed only the roles mentioned by the department. we should be able to add new role if candidate has performed different role that SaaSCompany has not yet identified.
- New Reference Tag should be allowed to add to the database.
- Retrieving Master entries
- Degree data should be loaded
- Institute data should be loaded
- Year Data should be loaded
- Adding New Master Entry
- New Degree should be allowed to add to the table
- New Institute should be allowed to add to the table
- New year should be allowed to add to the table
- Saving Academic Qualifications
- If there are more than one academic qualification instance given, then for each instance check whether relevant master entries are there.
- Retrieving master entries
- Retrieve address type master entries
- Retrieve Country city postal code combinations for a given search text
- Adding New master entry
- User select country and he can add new postal code and new city, or he can add new postal code for existing city. Here postal code and city belongs to a SaaSCompany. If user has selected existing city , i won't get the id of it, bcoz of the implementation difficulty associated with text box. so i have to search the database with the city text to find out whether it is an existing city.
- Saving Address Instance Data
Wednesday, November 17, 2010
Using JQuery with MVC
Sunday, October 24, 2010
JQuery Tabs
" + $(link).attr("title") + "
");" + $(link).attr("title") + "
");" + $(link).attr("title") + "
");" + $(link).attr("title") + "
");" + $(link).attr("title") + "
");" + $(link).attr("title") + "
");" + $(link).attr("title") + "
");" + $(link).attr("title") + "
");" + $(link).attr("title") + "
");Thursday, October 14, 2010
Designing Data Base Layer Using Entity Framework
We can describe how to handle following synario. this means that when there is many to many relation, how do we go about addressing following situation.