Free Time Links
December 20, 2011 Leave a Comment
One may walk over the highest mountain one step at a time.
August 28, 2011 Leave a Comment
JMS queues is a staging area that contains messages that have been sent and are waiting to be read. Queue represent PTP domain. A point-to-point (PTP) product or application is built around the concept of message queues, senders, and receivers. Each message is addressed to a specific queue, and receiving clients extract messages from the queue(s) established to hold their messages. Queues retain all messages sent to them until the messages are consumed or until the messages expire.There can be more but the message will be received to one of them. It also guarantees delivery of the message, means message will be there in the queue unless it is consumed by someone.
Topic represent Publish/Subscibe domain. A distribution mechanism for publishing messages that are delivered to multiple subscriber. In a publish/subscribe (pub/sub) product or application, clients address messages to a topic. Publishers and subscribers are generally anonymous and may dynamically publish or subscribe to the content hierarchy. The system takes care of distributing the messages arriving from a topic’s multiple publishers to its multiple subscribers. Topics retain messages only as long as it takes to distribute them to current subscribers.
The publish/subscribe model supports publishing messages to a particular message topic. Subscribers may register interest in receiving messages on a particular message topic. In this model, neither the publisher nor the subscriber knows about each other. A good analogy for this is an anonymous bulletin board.
The following are characteristics of this model:
August 27, 2010 Leave a Comment
http://www.searchengineoptimizationjournal.com/
http://searchengineland.com/
http://www.searchenginejournal.com/
http://googlewebmastercentral.blogspot.com/
http://www.mattcutts.com/blog/
http://www.bing.com/toolbox/blogs/webmaster/default.aspx
June 13, 2010 Leave a Comment
June 7, 2010 3 Comments
<html>
<head><title>Get Authentication Token</title></head>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<body>
<b>Get the Authentication url from the google : </b><a href="token.do">click Here</a>
</body>
</html>
https://www.google.com/accounts/OAuthGetRequestToken. Depending on the type of HTTP request being made, the required oauth_* query parameters can either be in the body of the request, as part of the Authorization header, or in the query part of the URL. In addition to the standard OAuth parameters, you must include a scope query parameter that is appropriate for the Google Data API(s) your application will interact with.https://www.google.com/accounts/OAuthAuthorizeToken, referencing the request token and including the oauth_callback parameter. Google may prompt the user to log into their Google Account. Once authenticated with Google, the user chooses to share their data.oauth_callback query parameter.https://www.google.com/accounts/OAuthGetAccessToken, to exchange the authorized request token for an access token.scope query parameter.</pre> </pre> package com.foo.bar; import java.io.IOException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.google.gdata.client.http.AuthSubUtil; /** * * @author RAJENDRA * GmailToken class is used to create the authentication token for accessing the gmail account. In this class you have * to define your return back action name so after authentication you can return back on your website. */ public class GmailToken extends HttpServlet{ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String gmailAuthKey=getAuth(); request.setAttribute("gmailAuthKey", gmailAuthKey); RequestDispatcher rd = getServletContext().getRequestDispatcher("/gmailToken.jsp"); rd.forward(request, response); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } /** * The method is used to set the action url , so after authentication you can return back on your main website. * getting the token from the gmail * @return gmailAuthenticationToken */ private String getAuth() { String authSubLogin=new String(); String next = "http://localhost:8081/Gmail-Contacts/friends.do"; String scope = "http://www.google.com/m8/feeds/"; boolean secure = false; boolean session = true; authSubLogin = AuthSubUtil.getRequestUrl(next, scope, secure, session); return authSubLogin; } }</pre> <pre> <pre> <pre> <pre>
After a successful authentication request, use theAuthvalue to create anAuthorizationheader for each request to the Google Data API:
Authorization: GoogleLogin auth=yourAuthToken
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <html> <head> <title> Validate-the-email </title> </head> <body> <b>Validate the email id on the google account</b> <a href='<%=request.getAttribute("gmailAuthKey")%> />'>GMAIL</a> </body> </html>
package com.foo.bar; import java.io.IOException; import java.net.URL; import java.security.GeneralSecurityException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.google.gdata.client.contacts.ContactQuery; import com.google.gdata.client.contacts.ContactsService; import com.google.gdata.data.contacts.ContactFeed; import com.google.gdata.util.ServiceException; /** * * @author RAJENDRA * The GetAllContact class is used to validate and get all the contact list from your gmail. */ public class GetAllContact extends HttpServlet { public void doPost(HttpServletRequest req, HttpServletResponse res)throws ServletException, IOException { String token = req.getParameter("token"); try { ContactFeed contactFeed = getContactList(token); req.setAttribute("contactFeed", contactFeed); } catch (GeneralSecurityException e) { e.printStackTrace(); } catch (ServiceException e) { e.printStackTrace(); } RequestDispatcher rd = getServletContext().getRequestDispatcher( "/showAllContacts.jsp"); rd.forward(req, res); } public void doGet(HttpServletRequest req, HttpServletResponse res)throws ServletException, IOException { doPost(req, res); } /** * In this api we are setting the authentication token for the particular * user and calling the google service * @param token * @return * @throws IOException * @throws GeneralSecurityException * @throws ServiceException */ public ContactFeed getContactList(String token) throws IOException,GeneralSecurityException, ServiceException { ContactFeed contactFeed = null; try { ContactsService contactsService = new ContactsService( "GoogleInc-jsguide-1.0"); contactsService.setAuthSubToken(token); contactFeed = getAllContacts(contactsService); } catch (Exception e) { e.printStackTrace(); } catch (Error error) { error.printStackTrace(); } return contactFeed; } /** * Set other information regarding the email list and get the contact * feed list * @param myService * @throws ServiceException * @throws IOException */ public ContactFeed getAllContacts(ContactsService myService) throws ServiceException, IOException { URL feedUrl = new URL( "http://www.google.com/m8/feeds/contacts/default/full"); ContactQuery contactQuery = new ContactQuery(feedUrl); contactQuery.setMaxResults(1000); ContactFeed resultFeed = myService.getFeed(contactQuery, ContactFeed.class); return resultFeed; } }Show All The Contacts On Jsp
<%@page import="com.google.gdata.data.contacts.ContactFeed"%> <html><head><title>Show all the email in my account</title></head><%@page import="com.google.gdata.data.contacts.ContactEntry" %><%@page import="com.google.gdata.data.extensions.Email"%><body><table><h1>ALL THE CONTACT FROM YOUR GMAIL CONTACT LIST<h1><%ContactFeed resultFeed = (ContactFeed)request.getAttribute("contactFeed");for (int i = 0; i < resultFeed.getEntries().size(); i++) {ContactEntry entry = resultFeed.getEntries().get(i);for (Email email : entry.getEmailAddresses()) {%><tr><td><b>Email add:</b></td><td><%=email.getAddress()%></td><%if (email.getRel() != null) { %> <% }if (email.getLabel() != null) {%><td><b>label</b></td><td> <%=email.getLabel()%></td></tr><% }if (email.getPrimary()) {} } }%></table></body></html>Access code from the google svn:
http://gmailcontact.googlecode.com/svn/trunk/
May 25, 2010 Leave a Comment
Many time I faced a problem to install mysql on the linux operating system, So in this blog I mentioned installation step of mysql on linux machine.
Get the mysql installation from http://ftp.jaist.ac.jp/pub/mysql/ site
groupadd mysql useradd -g mysql mysql chown -R mysql . chgrp -R mysql . scripts/mysql_install_db --user=mysql chown -R root . chown -R mysql data bin/mysqld_safe --user=mysql & bin/mysqladmin -u root password 'password'
February 25, 2010 Leave a Comment
Use netstat -na -b to see names of programs along with the port they are using :
Windows command :netstat -na -b
Use netstat -nlp to see PID and names of programs along with the port they are using (note you can only see the PID of process you own, unless running as root)
Linux command :netstat -nl
January 19, 2010 Leave a Comment
Few month before I am searching for free multi-platform Java installer builder. But we didn’t find any free java installer builder then finally we move on to the “Install4j“. We worked on the install4j around 3-4 month. We found that for the basic functionalities(for few screens and for some action) install4j worked fine. But when we are building some complex installer that time install4j have lot of issues. The most common issues with the install4j which I faced is Dynamically bundle of JRE. When I dynamically bundle the jre I am able to bundle the jre, but once the jre bundled with the installer it always extract. There is no way to prevent the extraction of the jre. Even on the completion of the installer if I want to trigger any batch file or sh file for the deletion of the jre, the install4j didn’t allowed to delete the jre. I discussed same thing with the “Install4j” support team but I got straight forward answer that we can’t do that with the “Install4j”.
In this blog I want some support. Please provide me some other “Java install builder tool”.
June 10, 2009 1 Comment
Filter is basically a component that is invoked when a client request a resource that the Filter is mapped to, such as a URL pattern or a Servlet name. Normally, a filter is used to wrap and manipulate Request, Response or header values before or after the execution of the original request target and do not itself return any response to the client.
Filters can be configured to act upon a certain request or upon different requests. Filters can also be put into a chain, where a number of Filters can be invoked after each other. Any Filter taking part of such a chain can at any time give control to the next Filter or redirect the request out of the chain .
Method for creating the filter
public void doFilter(final ServletRequest request, final ServletResponse response, FilterChain chain)
The doFilter method of the Filter is called by the container each time a request/response pair is passed through the chain due to a client request for a resource at the end of the chain. The FilterChain passed in to this method allows the Filter to pass on the request and response to the next entity in the chain.
public void init(FilterConfig filterConfig)
Called by the web container to indicate to a filter that it is being placed into service. The servlet container calls the init method exactly once after instantiating the filter. The init method must complete successfully before the filter is asked to do any filtering work.
public void destroy()
Called by the web container to indicate to a filter that it is being taken out of service. This method is only called once all threads within the filter’s doFilter method have exited or after a timeout period has passed. After the web container calls this method, it will not call the doFilter method again on this instance of the filter.
For creating your own filter you have to map your filter in web.xml
<filter> <!-- controls access for administrators' resources --> <filter-name>AdminAccessFilter</filter-name> <filter class>foo.bar.filter.AccessControlFilter</filter-class> </filter> <filter-mapping <filter-name>AdminAccessFilter</filter-name> <url-pattern>/admin/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>AdminAccessFilter</filter-name> <url-pattern>/admin/</url-pattern> </filter-mapping>
after mapping create a filter class for e.g
package foo.bar.filter;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.log4j.Logger;
import foo.bar.model.Admin;
/**
* Servlet Filter to attach the user under <code>USER_KEY</code> (session) to the current
* execution thread.
*/
public class AccessControlFilter implements Filter {
private static Logger log = Logger.getLogger(AccessControlFilter.class.getName());
private FilterConfig filterConfig;
private static final String LOGIN_PAGE = "/admin/adminlogin.action";
private static final String INTERCEPTION_PREFIX = "/admin/";
public void doFilter(ServletRequest req, ServletResponse res,FilterChain chain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) req;
String servletPath = request.getServletPath();
if (! servletPath.startsWith(INTERCEPTION_PREFIX)) {
HttpSession httpSession = request.getSession();
Admin user = (Admin) httpSession.getAttribute("Adminuser");
if (user == null) {
RequestDispatcher dispatcher = request.getRequestDispatcher(LOGIN_PAGE);
dispatcher.forward(request, (HttpServletResponse) res);
return;
}
}
chain.doFilter(req, res);
return;
}
public void init(FilterConfig config)
{
this.filterConfig = config;
}
public void destroy()
{
this.filterConfig = null;
}
public FilterConfig getFilterConfig()
{
return filterConfig;
}
}
May 4, 2009 4 Comments
I had an issue with thickbox where it would show the image behind a flash video in FireFox.I found really intersenting solution on this .I wanted to blog this information for my own record , plus to help ‘index’ the solution for others.
#flash {
position: relative; /*or absolute*/
z-index: 0;
}
<div id=”flash”>
<object …>
<param name=”wmode” value=”transparent”>
<embed … wmode=”transparent”>
</object>
</div>
Recent Comments