tag:blogger.com,1999:blog-90181734690366764022024-03-04T20:21:24.803-08:00TECH.BLOGShreehttp://www.blogger.com/profile/08761061007954529368noreply@blogger.comBlogger24125tag:blogger.com,1999:blog-9018173469036676402.post-19599892907089293562012-05-08T04:32:00.000-07:002012-05-08T04:32:16.065-07:00Jquery is not defined<div dir="ltr" style="text-align: left;" trbidi="on">
<p>You might get this error while integrating jquery in your appplication.Scripts will not get invoked.</p>
<p>I have to include Datepicker for a field in a page.</p>
<p>var $j = jQuery.noConflict();</br>
$j(document).ready(function($) {</br>
});</p>
<p><b><i>Got the error "jQuery is not defined"</i></b></p>
<p>Just changed order of the script which i included in the application. The error got resolved :)-</p>
<p><%= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" %></p>
<p><%= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/jquery-ui.min.js" %></p>
<p><%= stylesheet_link_tag "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/themes/base/jquery-ui.css" %></p>
<p><b>The order in which you load your scripts is important</b></p>
<br /></div>Shreehttp://www.blogger.com/profile/08761061007954529368noreply@blogger.com2tag:blogger.com,1999:blog-9018173469036676402.post-4531136333625818472011-05-31T04:22:00.000-07:002011-06-03T04:51:34.167-07:00Company and Jobs - LinkedIn API Now we can get company & job information available in LinkedIn using its API.This might help to show up the company & job deatils in applications.<a href="http://developer.linkedin.com/community/overview" target="_blank">View</a> .
<br />
<br /> You can check the below URL's by using a <a href="http://sundarishree.blogspot.com/2011/05/simple-java-program-using-linkedin-api.html" target="_blank">simple java program</a>
<br />
<br />Links to get company information in combination with LinkedIn data
<br />1. <strong>To get the company information by giving the company domain</strong><em><strong>http://api.linkedin.com/v1/companies?email-domain=kyyba.com</strong></em>
<br />Output :
<br /><pre name="code" class="xml">
<br /><?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<br /><company>
<br /> <id>586336</id>
<br /> <name>Kyyba Inc</name>
<br /></company>
<br /></pre>
<br />2. <strong>To get the company information by giving the company id</strong>
<br /><em><strong>http://api.linkedin.com/v1/companies/586336:(id,name,description,industry,logo-url)</strong></em>
<br />
<br />output :
<br /><pre name="code" class="xml">
<br /> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<br /><company>
<br /> <id>586336</id>
<br /> <name>KYYBA Inc</name>
<br /> <description>Kyyba, Inc. is a Global provider of strategic staffing and managed services for the Information Technology and Engineering Clients
<br />Kyyba service lines provide customers the following services:
<br /> Product and Software Development Services
<br /> Engineering and Design Services
<br /> Staff Augmentation Services
<br /> Outsourcing Services</description>
<br /> <industry>Staffing and Recruiting</industry>
<br /> <logo-url>http://media.linkedin.com/mpr/mpr/p/2/000/050/2e0/322206a.png</logo-url>
<br /></company>
<br /></pre>
<br />3.<strong> To get the companies around the given area [us:84]</strong> <em><strong>http://api.linkedin.com/v1/company-search:(companies,facets)?facet=location,us:84 </strong></em>Output :
<br /><pre name="code" class="xml">
<br />
<br /><?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<br /><company-search>
<br /> <companies total="33196" count="10" start="0">
<br /> <company>
<br /> <id>1028</id>
<br /> <name>Oracle</name>
<br /> </company>
<br />.
<br />.
<br />.
<br /></companies>
<br /> <facets total="1">
<br /> <facet>
<br /> <code>location</code>
<br /> <name>Location</name>
<br /> <buckets total="10">
<br /> <bucket>
<br /> <code>us:0</code>
<br /> <name>United States</name>
<br /> <count>596338</count>
<br /> <selected>false</selected>
<br /> </bucket>
<br />.
<br />.
<br />.
<br />
<br /> </buckets>
<br /> </facet>
<br /> </facets>
<br /></company-search></pre>
<br />4. <strong>To get company in which the token is created</strong><em><strong>http://api.linkedin.com/v1/people/~/following/companies</strong></em>
<br />
<br />Output :
<br /><pre name="code" class="xml">
<br />
<br /><?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<br /><companies total="1">
<br /> <company>
<br /> <id>96307</id>
<br /> <name>Vision Tech Solutions</name>
<br /> </company>
<br /></companies></pre>
<br />5. <strong>To get company to follow by the current user</strong><em><strong>http://api.linkedin.com/v1/people/~/suggestions/to-follow/companies</strong></em>
<br />I didn’t get any output data .
<br />
<br />Links to get LinkedIn's jobs by company, industry and more to display relevant jobs to the users.
<br /><strong>1. To get some job information in LinkedIn for the user</strong>
<br /><em><strong>http://api.linkedin.com/v1/people/~/suggestions/job-suggestions</strong></em>
<br />Output :
<br /><pre name="code" class="xml">
<br />
<br /><?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<br /><job-suggestions>
<br /> <jobs total="50" count="10" start="0">
<br /> <job>
<br /> <id>1641017</id>
<br /> <job>
<br /> <id>1333802</id>
<br /> <company>
<br /> <id>1441</id>
<br /> <name>Google</name>
<br /> </company>
<br /> <job-poster>
<br /> <id>5EyneQPD-C</id>
<br /> <first-name>David</first-name>
<br /> <last-name>S.</last-name>
<br /> <headline>test at Test Advantage</headline>
<br /> </job-poster>
<br /> <description-snippet>This position is based in Bangalore, India.
<br />The area: Google.com EngineeringGoogle.com Engineering makes Google's services fast and reliable for hundreds of millions of users. Described as "software engineering for adrenaline junkies", the team combines software development, networking, and systems administration expertise to build and run massively distributed, fault-tolerant software system</description-snippet>
<br /> <location-description>Bangalore</location-description>
<br /> </job>
<br />.
<br />.
<br /> </jobs>
<br /> <num-results>50</num-results>
<br /> <facets total="0" />
<br /></job-suggestions></pre>
<br />2. <strong>To get some job information exsisiting in given area [US:84]</strong><em><strong>http://api.linkedin.com/v1/job-search:(jobs,facets)?facet=location,us:84</strong></em>
<br />Output :
<br /><pre name="code" class="xml">
<br />
<br /><?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<br /><job-search>
<br /> <jobs total="1146" count="10" start="0">
<br /> <job>
<br /> <id>1653582</id>
<br /> <company>
<br /> <id>1231</id>
<br /> <name>Symantec</name>
<br /> </company>
<br /> <salary>Best in Industry</salary>
<br /> <job-poster>
<br /> <id>YRNg4JA8HX</id>
<br /> <first-name>Shyam Sundar</first-name>
<br /> <last-name>V.</last-name>
<br /> <headline>Principal Recruiter at Symantec</headline>
<br /> </job-poster>
<br /> <description-snippet> Symantec R&amp;D in Pune has Senior Principal Software Engineer positions open. Interested and suitable candidates can apply. Role Details: Research and drive the adoption of new technologies to enhance existing product functionality • Provide technical vision and leadership necessary to grow the technical proficiency of the development teams• Mentor development teams in good architecture and des</description-snippet>
<br /> <location-description>Pune, Maharashtra</location-description>
<br /> </job>
<br />.
<br />.
<br /> </pre>
<br />3. <strong>To get the particular job information by giving the JobId [jobid=1653560]</strong>
<br /><em><strong>http://api.linkedin.com/v1/jobs/1452577:(id,company:(name),position:(title))</strong></em>
<br />Output :
<br /><pre name="code" class="xml">
<br />
<br /><?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<br /><job>
<br /> <id>1653560</id>
<br /> <company>
<br /> <name>Tata Consultancy Services</name>
<br /> </company>
<br /> <position>
<br /> <title>Siebel Architect- Performance Management</title>
<br /> </position>
<br /></job></pre>
<br />4. <strong>To get some job bookmarcks </strong>
<br /><strong><em>http://api.linkedin.com/v1/people/~/job-bookmarks</em></strong>
<br />
<br />I didn’t get any output data .
<br />Shreehttp://www.blogger.com/profile/08761061007954529368noreply@blogger.com2tag:blogger.com,1999:blog-9018173469036676402.post-69278411937955136992011-05-31T04:15:00.000-07:002011-05-31T04:22:03.017-07:00Simple Java Program using LinkedIn APIThe below program will helps you to fetch & view linkedIn data in a short time. <br /><br /><em>Follow this link to download the jars & to get token, secret to work with </em><a href="http://sundarishree.blogspot.com/2010/06/linkedin-api-professional-social-media.html" target=_blank"><strong>LinkedIn API</strong></a><br /><br /><strong>Simple Java Program. To get the LinkedIn details about the current user [Who created the token & secret key]</strong><br /><br /><pre name="code" class="java"><br />public static void main(String[] args) {<br /><br />String linkedinKey = "C2E7PG.."; //Your LinkedIn key<br />String linkedinSecret = "9hyC6.. ";//Your LinkedIn Secret<br />OAuthConsumer consumer = new DefaultOAuthConsumer( linkedinKey,linkedinSecret);<br /> <br />OAuthProvider provider = new DefaultOAuthProvider("https://api.linkedin.com/uas/oauth/requestToken",<br /> "https://api.linkedin.com/uas/oauth/accessToken",<br /> "https://api.linkedin.com/uas/oauth/authorize");<br /> <br />System.out.println("Fetching request token from LinkedIn..."); <br />String authUrl;<br />try {<br />authUrl = provider.retrieveRequestToken(consumer, OAuth.OUT_OF_BAND);<br />System.out.println("Check the below link and grant this app authorization -You will get Pin Number.Copy it\n" + authUrl );<br />System.out.println("Enter the PIN code and hit ENTER when you're done:");<br />} catch (OAuthMessageSignerException e1) {<br /> e1.printStackTrace();<br />} catch (OAuthNotAuthorizedException e1) {<br /> e1.printStackTrace();<br />} catch (OAuthExpectationFailedException e1) {<br /> e1.printStackTrace();<br />} catch (OAuthCommunicationException e1) {<br /> e1.printStackTrace();<br />}<br />BufferedReader br = new BufferedReader(new InputStreamReader(System.in));<br />String pin;<br />try {<br />pin = br.readLine(); <br />System.out.println("Fetching access token from LinkedIn...");<br />provider.retrieveAccessToken(consumer, pin);<br />System.out.println("Access token: " + consumer.getToken());<br />System.out.println("Token secret: " + consumer.getTokenSecret());<br />URL url = new URL("http://api.linkedin.com/v1/people/~:(id,first-name,last-name,picture-url,headline)");<br /> <br />HttpURLConnection request = (HttpURLConnection) url.openConnection();<br /> consumer.sign(request);<br /> request.connect();<br />System.out.println("Sending request to LinkedIn...");<br />String responseBody = convertStreamToString(request.getInputStream());<br />System.out.println("Response: " + request.getResponseCode() + " "<br /> + request.getResponseMessage() + "\n" + responseBody);<br /><br />} catch (OAuthMessageSignerException e) { <br /> e.printStackTrace();<br />} catch (OAuthNotAuthorizedException e) { <br /> e.printStackTrace();<br />} catch (OAuthExpectationFailedException e) {<br />e.printStackTrace();<br />} catch (OAuthCommunicationException e) { <br /> e.printStackTrace();<br />} catch (IOException e) {<br />e.printStackTrace();<br />}<br />}<br /> public static String convertStreamToString(InputStream is) {<br /> <br /> BufferedReader reader = new BufferedReader(new InputStreamReader(is));<br /> StringBuilder sb = new StringBuilder();<br /> String line = null;<br /> try {<br />while ((line = reader.readLine()) != null) {<br /> sb.append(line + "\n");<br /> }<br /> } catch (IOException e) {<br /> e.printStackTrace();<br /> } finally {<br /> try {<br /> is.close();<br /> } catch (IOException e) {<br /> e.printStackTrace();<br /> }<br />}<br /> return sb.toString();<br />}<br />}<br /><br /> </pre><br /><strong>Output</strong><br /><br />Fetching request token from LinkedIn...<br />Check the below link and grant this app authorization -You will get Pin Number.Copy it<br />https://api.linkedin.com/uas/oauth/authorize?oauth_token=dcb835667-a5d7-4e95-91f9-fde4b9b47e3a<br />Enter the PIN code and hit ENTER when you're done:<br />59278<br />Fetching access token from LinkedIn...<br />Access token: f0f94b3d-50b9-4549-bd96-5d1ea3ba7a9c<br />Token secret: f2b13c99-f206-4612-bf9e-2afc1387bc1a<br />Sending request to LinkedIn...<br />Response: 200 OK<br /><pre name="code" class="xml"><br /><?xml version="1.0" encoding="UTF-8" standalone="yes"?><br /><person><br /> <id>GtYKzPiNkX</id><br /> <first-name>Sundari Shree</first-name><br /> <last-name>Gunasekaran</last-name><br /> <headline>Software Engineer at Vision Tech Solutions</headline><br /></person><br /></pre><br /><em><strong>Note:</strong></em> By passing the different URL’s as parameter You can check all the available information in LinkedIn .<br /><br />URL url = new URL<strong>("http://api.linkedin.com/v1/people/~:(id,first-name,last-name,picture-url,headline)"</strong>);<br /><br />This URL is to get about the people information.Shreehttp://www.blogger.com/profile/08761061007954529368noreply@blogger.com5tag:blogger.com,1999:blog-9018173469036676402.post-65818859502948946212011-04-11T03:34:00.000-07:002011-04-11T03:45:29.767-07:00GoogleMap - Latitude and LongitudeI have to display the map with respect to the place given.<br /><br />In that tags the longitude and latitude of the location to be passed as parameters to get the exact location in Map.<br /><br />I got many examples for displaying the Google map in different way & special effects. But not able to find how get the longitude and latitude of a location/place. At last found the way. Might help someone who searches like me.<br /><br />Code: To get the Longitude & Latitude of the location<br /><br />To have Google map in an application. We have to get a key from this link <br /><a href="http://code.google.com/apis/maps/signup.html" target="_blank">http://code.google.com/apis/maps/signup.html</a><br /><br /><br /><pre name="code" class="java"><br />import java.io.BufferedReader;<br />import java.io.IOException;<br />import java.io.InputStreamReader;<br />import java.net.URL;<br />import java.net.URLConnection;<br /><br /> <br /> try {<br /><br />String locationName="johannesburg"; \\Give any location\place name<br />String gmapKey="ABQIAAAAiqblAQNWNoua1VYnGtU1dBRdtL7gCpXlU8FuabFvwIMVSlhRL4gzsM_7WZ6hbScCw1YuLXHNjwA"; \\Give your google map key<br /> URL url = new URL("http://maps.google.com/maps/geo?q="+locationName+"&output=csv&key="+gmapKey);<br /> URLConnection urlConnection = url.openConnection();<br /> BufferedReader in;<br /> String inputLine;<br /> String data =null;<br /> <br /> in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));<br /> while ((inputLine = in.readLine()) != null){ <br /> data =inputLine; <br /> System.out.println("Accuracy,Status,Latitude,Longitutude of " +locationName+" >> "+data); <br /> }<br /> in.close();<br /> <br /> } <br /> } catch (IOException e) {<br /> e.printStackTrace();<br /> }<br /> </pre><br /> <br /><em>output:</em><br /><br />Accuracy,Status,<strong>Latitude,Longitutude of johannesburg </strong>>> 200,4<strong>,-26.2041028,28.0473051</strong>Shreehttp://www.blogger.com/profile/08761061007954529368noreply@blogger.com1tag:blogger.com,1999:blog-9018173469036676402.post-35090320611632589362011-02-21T22:43:00.000-08:002011-02-21T23:05:03.934-08:00Bitly using Mashape<strong><a href="http://www.mashape.com" target="_blank">Mashape</a></strong> is an API marketplace where service providers and individual developers can instantly make available an API.Its <strong>FREE</strong> to use.<br /><br /><em>Mashape can used in 2 ways</em><br /><br />1. Making use of the featured API’s available in Mashape<br />2. To generate our own API using Mashape.We can upload our API in Mashape & push it into cloud.They are providing the infrastructure for generating the API.<br /><br />I tried out the first way, which I need currently to work on<br />Check the featured services provided by <a href="http://www.mashape.com/explore/" target="_blank">Mashape -Explore</a>.<br />They are in ready to use state.Avaiable in Ruby, Java, Python, PHP Obj-C, and JSON<br /><br />I tried out with SimpleGeo and Bitly.<br /><br /><strong>Steps to work on Bitly using Mashape </strong>:<br /><br /><strong>Step1:</strong> SignIn Mashape.Get the API key.It's an automatically generated key which allows you to use the Mashape API from an application. [Ex:API key will be like this APP Key : sgFFDCfgEOKsLMsO9X7l75gCI]<br /><br /><br /><strong>Step2:</strong> Download the featured <a href="http://www.mashape.com/component/bitly" target="_blank">Bitly API from Mashape </a>.<br />The Jar will contain Bitly component's Java client library will contain the following files:<br /><br /> - <strong>mashapeClient.jar </strong>- This file to be include in the project, that contains the core <br /> functionalities of every Java client library and that is <br /> immutable for every component. <br /> - <strong>Bitly.java </strong>- The auto-generated *.java file for the component, that <br /> declares a Bitly class.<br /> - <strong>LICENSE</strong> - <strong>README</strong><br /><br /><strong>Step3</strong> Download the following jars to work on all the above API's using Mashape.<br /><br /> - <strong>httpclient-4.0.jar</strong> <br /> -<strong> httpcore-4.0-beta3.jar</strong><br /> - <strong>json-rpc-1.0.jar</strong><br /> - <strong>json-20080701.jar</strong><br /><br /><strong>Step4</strong> <a href="http://bit.ly/a/sign_in?rd=%2Fa%2Faccount"><strong>Signup in Bitly </strong></a>& get the bitly-login and bitly-Api-key.<br /><br /><strong>Step5</strong> Code:<br /><pre class="java" name="code"><br />//Enter Mashape API key <br />Bitly bitly=new Bitly("sgFFDCfgEOKsLMsO9X7l75gCI ");<br /><br />//Pass the url to be shortened, bitly-login and bitly-Api-key &it returens the JSONObject<br /><br />JSONObject bitlyResponse = bitly.getShortenedUrl("http://sundarishree.blogspot.com/","shree","R_08de4b3475dd5655818230c15c4966471");<br /></pre><br /><br />Advantage of this Mashape is no need to download the API jar from different sites. We can get in one point.Shreehttp://www.blogger.com/profile/08761061007954529368noreply@blogger.com1tag:blogger.com,1999:blog-9018173469036676402.post-44706394479195911592011-02-07T22:07:00.000-08:002011-02-08T00:35:50.191-08:00Session in PHPThis post might help the newbie to work on session in php.
<br />
<br />1. <strong>Start up the session</strong>
<br />
<br /> <em><strong>session_start() </strong></em>
<br /> Function must appear before the html tag.Its initialize session data
<br /> <em>Example :</em>
<br /> <pre name="code" class="php">
<br /> <?php session_start(); ?>
<br /> .
<br /> .
<br /> </pre>
<br />
<br />2. <strong>Store a session variable</strong>
<br /> <em>Example:</em>
<br /> <pre name="code" class="php">
<br /> <?php
<br /> session_start();
<br /> $_SESSION['username']="Misty"; // store session data
<br /> ?>
<br /> <body>
<br /> <?php
<br /> echo "Name =". $_SESSION['username']; //retrieve session data
<br /> ?>
<br /> </body>
<br /> </pre>
<br /> Where ever we try to access[Store or Retirve] the session variable the
<br /> <em>session_start() </em>function has to be called once before accessing the
<br /> session variable.
<br />
<br />3. <strong>To delete the session data</strong>
<br />
<br /> The <em>unset()</em> function is used to free the specified session variable:
<br /> <em>Example:</em>
<br /> <pre name="code" class="php">
<br /> <?php
<br /> unset($_SESSION['username']);
<br /> ?></pre>
<br />
<br />4. <em><strong>To destroy the session</strong></em>
<br /> We can completely destroy the session by calling the <em>session_destroy()</em>
<br /> function
<br /> <em>Example:</em>
<br /> <pre name="code" class="php">
<br /> <?php
<br /> session_destroy();
<br /> ?>
<br /> </pre>
<br /> session_destroy() will reset the session and We will lose all the stored session
<br /> data.
<br />
<br />5. <em>To check whether the session variable</em> <strong>is null</strong>
<br /> <em>Example:</em>
<br /> <pre name="code" class="php">
<br /> is_null($_SESSION['username'])==true
<br /> </pre>
<br />
<br />6. <strong>Some of the Session Functions</strong>
<br /> <em>session_cache_expire </em> — Return current cache expire
<br /> <em>session_cache_limiter</em> — Get and/or set the current cache limiter
<br /> <em>session_commit</em> — Alias of session_write_close
<br /> <em>session_decode</em> — Decodes session data from a string
<br />
<br /> <em>session_encode</em> — Encodes the current session data as a string
<br /> <em>session_get_cookie_params</em> — Get the session cookie parameters
<br /> <em>session_id</em> — Get and/or set the current session id
<br /> <em>session_is_registered</em> — Find out whether a global variable is
<br /> registered in a session
<br /> <em>session_module_name</em> — Get and/or set the current session module
<br /> <em>session_name</em> — Get and/or set the current session name
<br /> <em>session_regenerate_id</em> — Update the current session id with a newly
<br /> generated one
<br /> <em>session_register </em> — Register one or more global variables with
<br /> the current session
<br /> <em>session_save_path</em> — Get and/or set the current session save path
<br /> <em>session_set_cookie_params</em> — Set the session cookie parameters
<br /> <em>session_set_save_handler </em> — Sets user-level session storage functions
<br /> <em>session_unregister</em> — Unregister a global variable from the
<br /> current session
<br /> <em>session_write_close</em> — Write session data and end session
<br />7. <em><strong>To check the page expiry using session</strong></em>
<br /> <em>Example:</em>
<br /> <pre name="code" class="php">
<br /> <?php
<br /> session_start();
<br /> ini_set('display_errors', true);
<br /> ini_set('display_startup_errors', true);
<br /> error_reporting (E_ALL);
<br /> session_cache_expire( 20 );
<br /> $inactive =250;
<br /> if(isset($_SESSION['start']) ) {
<br /> $session_life = time() - $_SESSION['start'];
<br /> if($session_life > $inactive){header("Location:login.php?errorMsg=Your session
<br /> has expired.Please login again.");
<br /> }
<br /> }
<br /> $_SESSION['start'] = time();
<br /> ?>
<br /> </pre>
<br /> This code has to placed in the pages in which we need to check for session
<br /> expiry [Session expires beyond 4 mins].
<br />
<br />
<br />8. <strong>ERRORS -></strong> While working on sessions in <strong>PHP you might
<br /> come across </strong>the following <strong>errors</strong>. I got these 2 errors.
<br />
<br /> 8.1 <em><strong> Warning: session_start() [function. session-start]: Node no
<br /> longer exists in C:\wamp\home.php on line 3</strong></em>
<br /> occurs if a object is taken from a xml file or format.
<br />
<br /> Cannot serialize object wrapping 3rd party library structs. Must serialize
<br /> the xml (to a string) and store that to session and reload the xml when
<br /> restoring from session
<br /> <em>Example</em>
<br /> <pre name="code" class="php">
<br /> session_start();
<br /> /*To get from the mail.xml */
<br /> $xml = simplexml_load_file("../mail.xml");
<br /> foreach($xml->children() as $child){
<br /> if($child->getName()=='servername'){
<br /> $servername=$child;
<br /> }else if($child->getName()=='dbname'){
<br /> $dbname=$child;
<br /> }else if ($child->getName()=='username'){
<br /> $username=$child;
<br /> }else if ($child->getName()=='password'){
<br /> $password=$child;
<br /> }else if ($child->getName()=='url'){
<br /> $url=$child;
<br /> }
<br /> }
<br /> $_SESSION['url']=(string)$Url; // Casting is required
<br /> </pre>
<br />
<br /> 8.2. The following error might occur when we try to re-direct the page from one
<br /> page to another.
<br />
<br /> <em><strong> Warning: Cannot modify header information – headers already
<br /> sent by (output
<br /> started /home/kvel/kyybaventures.com/laton_v/views/leftnav.php:28) in
<br /> /home/kvel/kyybaventures.com/laton_v/views/welcome.php on line 10
<br /> </strong></em>
<br />
<br /> The problem is mainly due to the header start writing the output and again
<br /> trying to resent the header information. Normally when we use echo statement
<br /> before the header, this type of problem will come. It will not reflect in
<br /> the development environment and if try to deploy the code in the remote
<br /> server, this problem used to occur. Even if you remove the echo statement
<br /> and still the problem persist, follow the below solution.
<br />
<br /> To get rid of this error use these two lines
<br />
<br /> <pre name="code" class="php"> <? ob_start(); ?> </pre>
<br /> at the start of the php file and
<br />
<br /> <pre name="code" class="php"><? ob_flush(); ?> </pre>
<br /> at the bottom of the php file where you got the above error.
<br />
<br />Shreehttp://www.blogger.com/profile/08761061007954529368noreply@blogger.com0tag:blogger.com,1999:blog-9018173469036676402.post-81392562964691413822011-01-12T23:19:00.000-08:002011-01-13T00:30:20.184-08:00Searching for PAAS providersIn near future I think everything in the IT going to be virtual. Its going to play a main role in transforming IT infrastructure toward cloud computing. <br /><br />In 2011 many more enterprises virtualized and get onto private cloud journey as next step.<br />Surely will be great competitions between the Cloud Service providers.<br /><br /> We too trying to get into cloud service .As a first step our team is searching for PAAS providers which suits to develop our social media based application. We are trying for a provider which supports java.<br /><br />Did some analysis on Bungee connect, Joyent & WSO2.<br /><br />Regarding,<br /><strong><a href="http://www.bungeeconnect.com/" target="_blank">Bungee Connect</a></strong> – They have given as they collects no fees during the entire development process developers can freely access, develop, test, and even conduct on-line focus groups and beta programs for Bungee-powered applications. <br />After surfing a day, we felt this is best for us. Tried to work with beta .They have not yet released their beta work.<br />Might be in near future they might release the beta but we can’t wait for it.<br /> <br /><a href="http://www.joyent.com/" target="_blank"><strong>Joyent</strong></a> -Fully java script based application can be build. Mainly games are developed using joyent.Having big clients. We can use any sort of editors.Price differs based on the platform .Starting from 1/4GB Standard platform $25 /month to 32GB- $4000/ month. Not having clear view for making the development environment.<br />Also don’t know whether it suits to build our application.<br /> <br /><a href="http://www.wso2.com/" target="_blank"><strong>WSO2</strong></a> –Specified they offer a complete lean enterprise middleware platform, available as open source.Provided all sorts of download for services like mashups,data service,gadges etc.,.Provided many video files ,tutorials to work WSO2 services.<br /><br />When we go through the video, tutorial & definifiton it seems like “Spoon <br />Feeding”.But when tried practically something is missing. Some notch in the flow of integration.<br />There comes the check they have kept all sort of pricing in the name of support.Showing the great business.<br /><br />We are trying this as a first application in cloud so we are not ready to afford much on this trial.<br /><br />Still searching is not completed.Shreehttp://www.blogger.com/profile/08761061007954529368noreply@blogger.com0tag:blogger.com,1999:blog-9018173469036676402.post-17738293534678253812011-01-02T22:28:00.000-08:002011-01-04T04:33:18.073-08:00About CLOUD COMPUTING from a TenderfootI can't say its an IN and OUT about CLOUD COMPUTING.This post might give a light idea for you before start flying into CLOUD.<br /><br />Cloud computing is making a new trend and revolution for the next generation IT engineers.So many views and definitions are there on internet.This one gives a simple understanding definition for cloud computing <br /><br /><strong>"A pool of abstracted, highly scalable, and managed compute infrastructure capable of hosting end-customer applications and billed by consumption"</strong><br /><br />Already We are using some kind of cloud service, such as Web email (Gmail, Yahoo! Mail or Hotmail),online data storage (IDrive, Mozy) or online software. <br /><br />Cloud Environment is divided in three segment<br /> <strong>SAAS<br /> PAAS<br /> IAAS</strong><br /><br /><strong>SAAS </strong>- <em>Software As A Service</em><br /> <br />Provides software applications to end users without requiring the end user to run the application on their own computer.<br />Increasingly popular with Small and medium enterprises(SMEs).<br />No hardware or software to manage .<br />Service delivered through browser.<br /><br /><em>Examples of SAAS</em><br /><br />CRM<br />ERP<br />Project Management<br />Banking<br />Spreadsheet <br /><br /><strong>PAAS</strong> - <em>Platform As A Service</em> <br />Is an environment for running custom applications that provides operating-system level services for accessing the hosting and hardware resources needed in a cloud.<br />Some PaaS have their own dedicated SaaS architecture (For example : Salesforce's Force.com). <br />Most platforms anyway allow the consumer to choose their own SaaS tools.<br /><br /><em>Example of PAAS</em><br /> <br />Google App Engine <br />Mosso (Hosting cloud service)<br />AWS: S3(A Ruby Library for Amazon's Simple Storage Service's (S3) REST API)<br /><br /><strong>IAAS</strong> - <em>Infrastructure as a service</em> <br />Is a form of hosting. <br />It includes network access, routing services and storage. <br />The IaaS providers will usualy provides the hardware and administrative services needed to store applications and a platform for running applications. <br /><br /><em><br />The cloud has become </em><br /><br />1.<strong>our entertainment network</strong> we are spending hundreds of millions of hours on sites like YouTube , Flickr and so on. <br /><br />2.<strong>our social network</strong> Facebook,Bebo, hi5 ,MySpace and similar sites now claim hundreds of millions of members.<br /><br />3.<strong>our workbench</strong> we manage projects in Basecamp, share large files with Pando,tweak photos in online photo editors like Adobe Photoshop Express and Picnik. <br /><br />4.<strong>our development network</strong> open source programmers trade code on sites like SourceForge.net and Drupal.org.<br /><br />Still not started to fly in CLOUD.While I do,surely i will post the next.Shreehttp://www.blogger.com/profile/08761061007954529368noreply@blogger.com1tag:blogger.com,1999:blog-9018173469036676402.post-73291731982089091412010-12-18T00:40:00.000-08:002011-01-13T01:02:07.654-08:00Links for Twitpals<strong>To Tweet more than 140 charcters</strong><br /><a href="http://www.twitlonger.com" target="_blank">http://www.twitlonger.com</a><br /><br /><strong>To Tweet URL </strong><br /><a href="http://bit.ly/" target="_blank">http://bit.ly/</a><br /><br /><a href="http://tinyurl.com/" target="_blank">http://tinyurl.com/</a><br /><br /><a href="http://twitpwr.com/" target="_blank">http://twitpwr.com/</a><br /><br /><a href="http://www.urltwit.com/" target="_blank">http://www.urltwit.com/</a><br /><br /><br /><strong>To Tweet Image/Video </strong><br /><br /><a href="http://twitpic.com/" target="_blank">http://twitpic.com/</a><br /><br /><a href="http://yfrog.com/" target="_blank">http://yfrog.com/</a><br /><br /><a href="http://plixi.com" target="_blank">http://plixi.com</a><br /><br /><a href="http://www.twitvid.com/" target="_blank">http://www.twitvid.com/</a><br /><br /><a href="http://twitgoo.com/" target="_blank">http://twitgoo.com/</a><br /><br /><strong>To Tweet Audio[Songs...] </strong><br /><a href="http://twitlens.com/" target="_blank">http://twitlens.com/</a><br /><br /><a href="http://tweetmic.com/" target="_blank">http://tweetmic.com/</a><br /><br /><a href="http://twt.fm/" target="_blank">http://twt.fm/</a><br /><br /><br /><strong>To Update the Background of Tweet Page</strong><br /><a href="http://twitrounds.com/" target="_blank">http://twitrounds.com/</a><br /><br /><a href="http://www.twitrbackgrounds.com/" target="_blank">http://www.twitrbackgrounds.com/</a><br /><br /><br /><strong>To Increase the Twitter Followers </strong><br /><a href="http://www.tweetwhistle.com/" target="_blank">http://www.tweetwhistle.com/</a>Shreehttp://www.blogger.com/profile/08761061007954529368noreply@blogger.com0tag:blogger.com,1999:blog-9018173469036676402.post-69108827883673577312010-09-07T03:53:00.000-07:002011-01-13T00:37:09.393-08:00Create Android Applications in Eclipse<span style="font-weight:bold;">Small intro about Android<span style="font-style:italic;"></span></span><br />Android is one of the most useful, innovative mobile platform.<br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2iKw5jauipFhnAyTEBoEj98DrU2tWQfBzx94cFV1wdHQcS4zVLRh5zypOwUVOh0G_qTvMB4lRc8eRuhBD90lit0qt6YFyinW45jh2WTYovCKRFn83LFUH2MemJ46LC2RD18w8go-Fi4w/s1600/Android2.2.jpg"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 173px; height: 161px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2iKw5jauipFhnAyTEBoEj98DrU2tWQfBzx94cFV1wdHQcS4zVLRh5zypOwUVOh0G_qTvMB4lRc8eRuhBD90lit0qt6YFyinW45jh2WTYovCKRFn83LFUH2MemJ46LC2RD18w8go-Fi4w/s320/Android2.2.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5514123368262201842" /></a><br /><strong>Android 2.2.</strong> Codenamed <strong>Froyo</strong> (for frozen yogurt), this is the seventh update to the Android platform brings some great new functionality to users (things like making your handset a portable hotspot and support for Adobe Flash within the browser)<br />, along with new tools for developers.<br /><em><strong><br />To know more about Android check out this links</strong></em><br /><a href="www.android.com/" target="_blank">www.android.com/</a><br /><a href="http://android-developers.blogspot.com" target="_blank">http://android-developers.blogspot.com</a><br /><br /><em><strong>Steps to set the environment for creating Android applications with Eclipse</strong></em><br /><br />It is based on <strong>Eclipse 3.5</strong> & above, <strong>Java 1.6</strong> and <strong>Android 2.2</strong> (Froyo). <br /><br /><strong>Step- 1</strong> Install Eclipse Galileo (3.5) <br /><br /><strong>Step- 2</strong> Download the Android SDK from the Android homepage under <a href="http://developer.android.com/sdk/index.html" target="_blank">Android SDK download</a> .The download contains a zip file which you can extract to any place in your file system.<br /> <strong>e.g.</strong> place it under "<em>c:\android-sdk-windows</em>"<br /><br /><strong>Step-3</strong> Open the Help -> Install new software .To install all available plugins for the Android Development Tools (ADT) from the URL <a href="https://dl-ssl.google.com/android/eclipse/" target="_blank">https://dl-ssl.google.com/android/eclipse/</a><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8XvJM_0NcCsVSFxxrRVrBj0kJeurKU_IycX57rOt-R5XJB7N1KRQ1MklUt-j5lINtEb36y-5FOokbPDpc4jp6R7v-3c6PCbCQZsSRykurv78OThE9TIpZXNsl6hOYaoOkci3qrwaPN74/s1600/newSwInstall.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 284px; height: 265px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8XvJM_0NcCsVSFxxrRVrBj0kJeurKU_IycX57rOt-R5XJB7N1KRQ1MklUt-j5lINtEb36y-5FOokbPDpc4jp6R7v-3c6PCbCQZsSRykurv78OThE9TIpZXNsl6hOYaoOkci3qrwaPN74/s320/newSwInstall.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5514131964676373170" /></a><br /><strong>Step-3.1 </strong> Add the Name as Android & Location of the site as <a href="https://dl-ssl.google.com/android/eclipse/" target="_blank">https://dl-ssl.google.com/android/eclipse/</a><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixXEsZpnBKn2RDNbuqM77V5m9XmVat_a4QZLHZfGOEhK8DtccxInZR6Fqk4p05BH-EVL3WV6CP37WOOr4LRc6k6u0bxhx3TJytwR2iFZvpbp3PHVWsmHz5TL4GLoBKBZtLmzHxVKvsHb8/s1600/t1.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 255px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixXEsZpnBKn2RDNbuqM77V5m9XmVat_a4QZLHZfGOEhK8DtccxInZR6Fqk4p05BH-EVL3WV6CP37WOOr4LRc6k6u0bxhx3TJytwR2iFZvpbp3PHVWsmHz5TL4GLoBKBZtLmzHxVKvsHb8/s320/t1.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5514132730606150594" /></a><br /><strong>Step-3.2 </strong> Select the packages & click Next<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6S2p8lE4oncMyhyphenhyphenx0dmLZwk9sFxG_SBs1G68W0c-_GMea7M3EoY855aE52Ve5yLIu2_E1YgmhgZb9Zf4-A1pVzWDOKArK3F-Vr59CKGfZPUsEte0fhrIfVytyKATnuiNxS6-iNpa01ac/s1600/t2.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 280px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6S2p8lE4oncMyhyphenhyphenx0dmLZwk9sFxG_SBs1G68W0c-_GMea7M3EoY855aE52Ve5yLIu2_E1YgmhgZb9Zf4-A1pVzWDOKArK3F-Vr59CKGfZPUsEte0fhrIfVytyKATnuiNxS6-iNpa01ac/s320/t2.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5514132829760366770" /></a><br /><strong>Step-3.3</strong> Select the agree option & click finish<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxvTeNGcJUTwKLwGVCd7VHRAJTECsKurhQ1C_QQkvaSUEcoAfvBOk0oLcq7-Pn6XJq02MPRqgs7bUoHM7CirBQJxmghCpUnDWSg-uxK7j7pjNiSeuAUijsCA2DeKkLHgvBNJokouiNgOs/s1600/t3.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 222px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxvTeNGcJUTwKLwGVCd7VHRAJTECsKurhQ1C_QQkvaSUEcoAfvBOk0oLcq7-Pn6XJq02MPRqgs7bUoHM7CirBQJxmghCpUnDWSg-uxK7j7pjNiSeuAUijsCA2DeKkLHgvBNJokouiNgOs/s320/t3.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5514132921503155410" /></a><br /><strong>Step-4 </strong> To <strong>Configure </strong>in Eclipse - Open the Preferences dialog via Windows -> Preferences.Select Android and maintain the installation path of the Android SDK. <br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2JS7nul2K2lNrZtzb5Xd2DG0s9MjF9WQ5cHErX5yYZjjigXR69Nw1wKXM5-z0qZjfxpIXJFKhbRPZ6Ew9iVoD0G37h5PmcHbo7-FR_nc69qAIJG-XX8382JLLi9srMay0ArZQ2E7ha3A/s1600/t4.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 214px; height: 306px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2JS7nul2K2lNrZtzb5Xd2DG0s9MjF9WQ5cHErX5yYZjjigXR69Nw1wKXM5-z0qZjfxpIXJFKhbRPZ6Ew9iVoD0G37h5PmcHbo7-FR_nc69qAIJG-XX8382JLLi9srMay0ArZQ2E7ha3A/s320/t4.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5514133227722836210" /></a><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVpDzJbnCFGHrI1HUBHmhq2RHyAyJYp5h1SkjJ1J82pMhts0segmh1OdKuXsg47f59wtEYWXhpA6IzFpKHpNHEzR-whmF2fq-c-TuPm7WBG9tu1TiZGBpviG-VqauFbi7eRU5mq_2eFXI/s1600/t5.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 172px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVpDzJbnCFGHrI1HUBHmhq2RHyAyJYp5h1SkjJ1J82pMhts0segmh1OdKuXsg47f59wtEYWXhpA6IzFpKHpNHEzR-whmF2fq-c-TuPm7WBG9tu1TiZGBpviG-VqauFbi7eRU5mq_2eFXI/s320/t5.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5514133890627237714" /></a><br /><br /><strong>Step-4.1 </strong> Select now Window -> Android SDK and AVD Manager from the menu. <br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKQkjcUh-ARvy9DGErYSGDnArQKy5RWpWmm4porF9LU3-EyVWQjTxX1g3tGSKm_Td5nssO80Xh6P_m0eudzJhhRc1ENC2U6PtLAGxyBfX2fWvlTk2s2sWJHazRr7TzwX6xjjodV5Z7-rA/s1600/t6.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 220px; height: 310px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKQkjcUh-ARvy9DGErYSGDnArQKy5RWpWmm4porF9LU3-EyVWQjTxX1g3tGSKm_Td5nssO80Xh6P_m0eudzJhhRc1ENC2U6PtLAGxyBfX2fWvlTk2s2sWJHazRr7TzwX6xjjodV5Z7-rA/s320/t6.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5514134085447257282" /></a><br /><br /><strong>Step-4.2</strong> Select the following available packages and select the latest version of the SDK. <br /><br /> -Documentation for Android SDK,API8 ,revision 1<br /><br /> -SDK Platform Android2.2,API8,revision 2<br /><br /> -Samples for SDK API8 ,revision 1h<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiI5DuCAiXmGDsSkQfMEBkh6L7nmVuWhSDnxHH18_YyPK_-kZ1tFkxtE1r_sxpoRGOY12RUpiIho4C4I5HrV1ftgYPyS_97wirY08L6mf7sri98XuqiCURl_zW_sfI6BnctLRUszx0zDBw/s1600/t7.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 140px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiI5DuCAiXmGDsSkQfMEBkh6L7nmVuWhSDnxHH18_YyPK_-kZ1tFkxtE1r_sxpoRGOY12RUpiIho4C4I5HrV1ftgYPyS_97wirY08L6mf7sri98XuqiCURl_zW_sfI6BnctLRUszx0zDBw/s320/t7.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5514134217056678578" /></a><br /><strong>Step-4.3</strong> Press "<strong>Install selected</strong>" and confirm the license for all package.Installation will be started.After the installation restart Eclipse. <br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiz_UoL18Q-ddGxtd4Lg2BNBR7nw-ItvkbdFPjXFc9JWgPrMDuixC_Wwp1skSEu-RxOZUwRcvsV2-nEhPCsHO8lssLt6gkWhBj3Cmo1m6_05DDyQ5fCiPDb1HJ5GGGwPLloyy6s-Acta-0/s1600/t8.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 146px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiz_UoL18Q-ddGxtd4Lg2BNBR7nw-ItvkbdFPjXFc9JWgPrMDuixC_Wwp1skSEu-RxOZUwRcvsV2-nEhPCsHO8lssLt6gkWhBj3Cmo1m6_05DDyQ5fCiPDb1HJ5GGGwPLloyy6s-Acta-0/s320/t8.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5514134420116178258" /></a><br /><strong>Step-5</strong> We need to define a <strong>device</strong> which can be used for emulation.Select now Window -> Android SDK and AVD Manager from the menu -> Select Virtual Devices .Press "<strong>New</strong>" and maintain the following. <br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirgbgKnnqhrUStGf1icaf1ujLCLFO6A5zmChyphenhyphengY5QCnyldaOEs42Yl1i6SQoSXF4yZzH1-SeobBUb16TGt8Eb_ZbNk6rkDtWGPdsZaBck33GL0HeqSRzxD60CIQvH8KUh6Ez0KsMLdMwY/s1600/t9.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 56px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirgbgKnnqhrUStGf1icaf1ujLCLFO6A5zmChyphenhyphengY5QCnyldaOEs42Yl1i6SQoSXF4yZzH1-SeobBUb16TGt8Eb_ZbNk6rkDtWGPdsZaBck33GL0HeqSRzxD60CIQvH8KUh6Ez0KsMLdMwY/s320/t9.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5514134669777558418" /></a><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiO2-EFjuPRjA1HThtGPXNL8y-guw8UyewBTfCzVN8F2c7yHyTyAWBZNGBkHsEjCWaDuytLvNM6sVfmUZOLE9PCZpdZK3td8ycbjNYbF7OXvTlZUzK_dLcsB-mN5rjQAuIyeslh6KuO_w8/s1600/t10.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 141px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiO2-EFjuPRjA1HThtGPXNL8y-guw8UyewBTfCzVN8F2c7yHyTyAWBZNGBkHsEjCWaDuytLvNM6sVfmUZOLE9PCZpdZK3td8ycbjNYbF7OXvTlZUzK_dLcsB-mN5rjQAuIyeslh6KuO_w8/s320/t10.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5514134794185860770" /></a><br /><strong>Step-5.1</strong> Press "<strong>Create AVD</strong>".This will create the device. To test if you setup is correct, select your device and press "<strong>Start</strong>". <br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5-YCifbqhZXltp1oJItETdwMD6G-YY-aN8jQyJiQVTuUF2IFscBSF7VHit69Q00hhGxPDynPqCdrViqCDZoGjZnRfTSUbFSrqOGPBYOSzC3Na0obCO2t96cbrRQAyySQ8FrelkY5JqYw/s1600/untitledt11.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 249px; height: 320px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5-YCifbqhZXltp1oJItETdwMD6G-YY-aN8jQyJiQVTuUF2IFscBSF7VHit69Q00hhGxPDynPqCdrViqCDZoGjZnRfTSUbFSrqOGPBYOSzC3Na0obCO2t96cbrRQAyySQ8FrelkY5JqYw/s320/untitledt11.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5514135119387569394" /></a><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitQpxweQS29_DUPXhnHO7a9bBvizoD9N4QA7ZN1BVOnQpPYmn3QVRfqk6nBuMpAu-XQTvhqE8OVkeYBsIGHglJazXTIPHG_tt7FeIdWbqwoMJx0ewO7ru2ZKyTtkiCwEfT2bLKCEAg3PA/s1600/t12.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 141px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitQpxweQS29_DUPXhnHO7a9bBvizoD9N4QA7ZN1BVOnQpPYmn3QVRfqk6nBuMpAu-XQTvhqE8OVkeYBsIGHglJazXTIPHG_tt7FeIdWbqwoMJx0ewO7ru2ZKyTtkiCwEfT2bLKCEAg3PA/s320/t12.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5514136338599904786" /></a><br /><strong>Step-5.2</strong>Device is ready .<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMjgjkmwy5cz5PK9QGvTVU_9pUeISJ7CQdi5Ce-2hqRbEchA2iTIOZJb-8_Scy6MmRhUl88gEbYTE69bxQld0-nixVzjwaXE_XVqg7O49ouHKQ3Efsqruhuh38p66ONRaEGePN9dxJvcU/s1600/andDevice.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 226px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMjgjkmwy5cz5PK9QGvTVU_9pUeISJ7CQdi5Ce-2hqRbEchA2iTIOZJb-8_Scy6MmRhUl88gEbYTE69bxQld0-nixVzjwaXE_XVqg7O49ouHKQ3Efsqruhuh38p66ONRaEGePN9dxJvcU/s320/andDevice.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5514136885006508066" /></a><br /><span style="font-weight:bold;">Now the environment is ready for developing android application.<span style="font-style:italic;"></span></span>Shreehttp://www.blogger.com/profile/08761061007954529368noreply@blogger.com0tag:blogger.com,1999:blog-9018173469036676402.post-18708974358784399022010-08-26T05:02:00.000-07:002011-01-13T00:38:46.800-08:00Shortening URL in Java using Bitly<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMW5tqe0pOmbGoNw5hOHpLz2SgQtNlBuI7pbhNyF83ErVEIh21YBWwq9upTyzRlbHAeZ-fp8s2Spkj9MGgUHHjfKLcp8Kd8iHK9Q8HZOrq8q-aMWvC8BbN-vzq27EUyEBtyJidJgk7GxU/s1600/pfish_top.png"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 161px; height: 60px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMW5tqe0pOmbGoNw5hOHpLz2SgQtNlBuI7pbhNyF83ErVEIh21YBWwq9upTyzRlbHAeZ-fp8s2Spkj9MGgUHHjfKLcp8Kd8iHK9Q8HZOrq8q-aMWvC8BbN-vzq27EUyEBtyJidJgk7GxU/s320/pfish_top.png" border="0" alt="Bitly"id="BLOGGER_PHOTO_ID_5510391787180445762" /></a><br />Shortening any url in Java using bitly API .<br />We need to get API key first using <a href="http://bit.ly/a/sign_in?rd=%2Fa%2Faccount" target="_blank">bit.ly account</a><br /><br />In two ways we can do <br />1. By calling the bit.ly's REST API.<br />2. By using bitly core methods.<br /><br />1. <strong>By calling the bit.ly's REST API</strong><br /><br /> We need the following jars to work on<br /><br /> <em> bitlyj-2[1].0.0</em> <br /> <em>commons-httpclient-3.1</em><br /> <em>commons-codec-1.2</em><br /> <em>logging-1.0.4</em><br /><br /><em><strong>Code to shorten the url</strong></em><br /><pre class="java" name="code"><br /> HttpClient httpclient = new HttpClient();<br /> HttpMethod method = new GetMethod("http://api.bit.ly/shorten");<br /> NameValuePair[] valuePair=new NameValuePair[]{new NameValuePair("longUrl","http://www.sundarishree.blogspot.com/"),<br /> new NameValuePair("version","2.0.1"),<br /> new NameValuePair("login","YourUsername"),<br /> new NameValuePair("apiKey","YourApikey"),<br /> new NameValuePair("format","xml"),<br /> new NameValuePair("history","1")<br /> };<br /> method.setQueryString(valuePair); <br /> try {<br /> httpclient.executeMethod(method);<br /> } catch (HttpException e) { <br /> e.printStackTrace();<br /> } catch (IOException e) { <br /> e.printStackTrace();<br /> }<br /> String responseXml =null;<br /> try {<br /> responseXml = method.getResponseBodyAsString();<br /> } catch (IOException e) { <br /> e.printStackTrace();<br /> }<br /> System.out.println(responseXml);<br /></pre><br /><br />When the above code is excuted we will get the <em><strong>output</strong></em> in following <em><strong>XML format</strong></em><br /><br /><br /><bitly><br /> <errorCode>0</errorCode><br /> <errorMessage></errorMessage><br /> <results><br /> <nodeKeyVal><br /> <shortKeywordUrl></shortKeywordUrl><br /> <hash>bzXiN2</hash><br /> <userHash>ceCaRl</userHash><br /> <nodeKey><![CDATA[http://www.sundarishree.blogspot.com/]]></nodeKey><br /> <shortUrl>http://bit.ly/ceCaRl</shortUrl><br /> <shortCNAMEUrl>http://bit.ly/ceCaRl</shortCNAMEUrl><br /> </nodeKeyVal><br /> </results><br /> <statusCode>OK</statusCode><br /></bitly><br /><br /><br /><em><strong>Code to get the short url from XML output</strong></em><br /><pre class="java" name="code"><br /> if(responseXml != null) {<br /> // parse the XML<br /> DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();<br /> DocumentBuilder db = null;<br /> try {<br /> db = dbf.newDocumentBuilder();<br /> } catch (ParserConfigurationException e) {<br /> e.printStackTrace();<br /> }<br /> StringReader st = new StringReader(responseXml);<br /> Document d = null;<br /> String retVal=null;<br /> try {<br /> d = db.parse(new InputSource(st));<br /> } catch (SAXException e) {<br /> e.printStackTrace();<br /> } catch (IOException e) {<br /> e.printStackTrace();<br /> }<br /> NodeList nl = d.getElementsByTagName("shortUrl"); <br /> if(nl != null) {<br /> Node n = nl.item(0);<br /> retVal = n.getTextContent();<br /> System.out.println("Short URL >> "+retVal);<br /> }<br /> }<br /></pre><br /><br />We can get the<em><strong> output</strong></em> as Short URL >>http://bit.ly/ceCaRl<br /><br />2. <strong>By using bitly core methods</strong><br /><br /><em> bitlyj-2[1].0.0 </em>and <em>commons-httpclient-3.1</em> jars are enough to use bitly core methods<br /><em><strong><br />Code to shorten the url</strong></em><br /><br />While importing Bitly mention as static <br /><pre class="java" name="code"><br />import static com.rosaloves.bitlyj.Bitly.*;<br />....<br />Provider bitly = Bitly.as("YourUserName", "YourApiKey");<br />ShortenedUrl info =bitly.call(shorten("http://www.visiontss.com/")); <br />System.out.println("Shorten URL "+info.getShortUrl());<br /></pre><br /><strong><em>output : </em></strong> Shorten URL http://bit.ly/ahyvK0<br /><br /><strong>Bulk Methods</strong><br />Some bitly methods support multiple arguments.info and clicks for example can take an arbitrary number of hash <br />or shortUrl arguments. You can do this in bitlyj just like you'd expect: <br /><pre class="java" name="code"><br /> for(UrlInfo info1 : bitly.call(info("http://bit.ly/ceCaRl","http://bit.ly/ahyvK0"))) { <br /> System.out.println("Created by :"<br /> +info1.getCreatedBy());<br /> System.out.println("ShortUrl :"<br /> +info1.getUrl());<br /> System.out.println("Title of the page :"<br /> +info1.getTitle());<br />}<br /></pre><br /><em><strong>output : </strong></em> <br />Created by :sundarishree<br />ShortUrl :Url [shortBase=http://bit.ly/, globalHash=7haiBr, longUrl=, shortUrl=http://bit.ly/ahyvK0, userHash=ahyvK0]<br />Title of the page :Vision Tech Solutions - Software Product Development Company<br />Created by :sundarishree<br />ShortUrl :Url [shortBase=http://bit.ly/, globalHash=bzXiN2, longUrl=, shortUrl=http://bit.ly/ceCaRl, userHash=ceCaRl]<br />Title of the page :TECH.BLOG<br /><br />You can know more in <a href="http://code.google.com/p/bitlyj/wiki/QuickStart" target="_blank">QuickStart </a><strong></strong>Shreehttp://www.blogger.com/profile/08761061007954529368noreply@blogger.com5tag:blogger.com,1999:blog-9018173469036676402.post-33391012232834341722010-08-11T00:23:00.000-07:002010-08-11T00:24:33.538-07:00A Comfortable Online HTML Editor<p>A powerful Web-based <span style="COLOR: #000000"><strong>WYSIWYG</strong> <span style="COLOR: #000000"><strong>HTML editor </strong></span></span>that is designed for easy integration into our custom web applications</p><br /><p>We can use this link for designing blog content <span style="COLOR: #c71585"><a href="http://www.online-html-editor.org/index.php" target="_blank">HTML editor </a></span></p>Shreehttp://www.blogger.com/profile/08761061007954529368noreply@blogger.com3tag:blogger.com,1999:blog-9018173469036676402.post-30450404641047425922010-08-06T22:54:00.000-07:002011-01-13T00:41:09.223-08:00rake aborted! Mysql::Error<table width="492" height="100%" border="0"><tr><td width="96%" valign="top"><table width="100%" height="100%" border="0"><tr><td colspan="2"><table width="492" border="0"><tr><td width="15"></td><td width="461">When i tried to setup and migrate some objects in the MySQL DB </td></tr><br /><tr><td></td><td>with Ruby on Rails. </td></tr><br /><tr><td></td><td> While executing the command <strong>rake db:migrate</strong> ,i got the following error:<tr><td></td><td>error:</td></tr><tr><td></td><td><strong> rake aborted!</strong></td></tr><tr><td></td><td><strong> Mysql::Error: query: not connected: CREATE TABLE `schema_migrations` (`version`varchar(255) NOT NULL) ENGINE=InnoDB</strong></td></tr><tr><td></td><td></td></tr><tr><td></td><td>(See full trace by running task with --trace)</td></tr><tr><td></td><td>Using <strong>rake db:create</strong> database succesfully created.</td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td><Strong><em>Solution to get rid of this issue</em></strong> </td></tr><tr><td></td><td> <strong>Step -1</strong> To get rid of the issue copy the <Strong>libmySQL.dll</strong></td></tr><tr><td></td><td> <strong>Step -2</strong> Paste it in C:\Ruby\bin of yours </td></tr></td></tr></table></td></tr><tr><table width="491" border="0"></table></td></tr></table></td></tr></table>Shreehttp://www.blogger.com/profile/08761061007954529368noreply@blogger.com0tag:blogger.com,1999:blog-9018173469036676402.post-43225903651959909952010-08-06T05:25:00.001-07:002011-01-13T00:49:20.904-08:00Rails Application with MySQL DB<table width="492" height="100%" border="0"><tr><td width="96%" valign="top"><table width="100%" height="100%" border="0"><tr><td>Follow the following step to work on rails application with mysql.</td></tr><tr><td colspan="2"><table width="492" border="0"><tr><td width="15" valign='top'><strong>1:</strong></td><td width="461">Our system should have the ruby installed .If not install the ruby <a href=" http://rubyinstaller.org/downloads" target="_blank">from here </a></td></tr><br /><tr><td width="15" valign='top'><strong>2:</strong> </td><td width="461">Start a Command prompt with Ruby <strong>C:\Ruby\bin </strong></td></tr><tr><td valign='top' width="15"><strong>3:</strong></td><td width="461">Enter the following command to install the special version of MySQL bindings.<table><tr><td> <strong> gem install mysql</strong></td></tr><tr><td><em>You should expect a similar output like this:</em></td></tr><tr><td> Successfully installed mysql-2.8.1.1-x86-mingw32</td></tr><tr><td> 1 gem installed</td></tr></table></td></tr><tr><td valign='top' width="15"><strong>4:</strong></td><td width="461">Enter the following command to install rails<table><tr><td> <strong>gem install rails</strong></td></tr><tr><td>This is going to take a bit, since Rails and it’s dependencies takes around 2MB or so, and need to be downloaded and <br /> installed.</td></tr><tr><td><em>Once done, expect see at the screen something like this:<br /></em></tr><tr><td> Successfully installed activSupport-2.3.2</td></tr><tr><td> Successfully installed activerecord-2.3.2</td></tr><tr><td> Successfully installed actionpack-2.3.2</td></tr><tr><td> Successfully installed actionmailer-2.3.2<tr><td> Successfully installed activeresource-2.3.2<br /><tr><td> Successfully installed rails-2.3.2<tr><td> 6 gems installed</td></tr></table></td></tr><tr><td valign='top' width="15"><strong>5:</strong></td><br /><td width="461">Copy the <strong>libmySQL.dll</strong> file <a href="http://instantrails.rubyforge.org/svn/trunk/InstantRails-win/InstantRails/mysql/bin/libmySQL.dll" target="_blank">from here </a><table><br /><tr><td>and paste it in your c:\ruby\bin location.</td></tr></table></td></tr><tr><td valign='top' width="15"><strong>6:</strong></td><td width="461">Create a rails application with mysql .Create a new Folder RailsPrg in C:<table><tr><td>In Command prompt switch to C:\RailsPrg></td></tr><tr><td> Let’s name our application <em>appInMySQL </em></td></tr><tr><td> <strong>rails appInMySQL --database=mysql </strong></td></tr><tr><td>The --database option indicates to Rails that we want to use <br /> MySQL instead of the default database adapter (SQLite3).</td></tr><tr><td>Rails will output a lot of lines when creating your application <br /> structure, just an excerpt of what to see:</td></tr><tr><td> ...</td></tr><tr><td> create config/database.yml</td></tr><tr><td> create config/routes.rb</td></tr><tr><td> create config/locales/en.yml</td></tr><tr><td> create config/initializers/backtrace_silencers.rb</td></tr><br /><tr><td> create config/initializers/inflections.rb</td></tr><tr><td> create config/initializers/mime_types.rb</td></tr><tr><td> create config/initializers/new_rails_defaults.rb</td></tr><tr><td> create config/initializers/session_store.rb</td></tr><tr><td> create config/environment.rb</td></tr><br /><tr><td> ...</td></tr></table></td></tr><tr><td valign='top' width="15"><strong>7:</strong></td><br /><td width="461">Now Rails have configured for us the name of the database we want to use, and you can verify it in <em>appInMySQL\config\database.yml </em><table><tr><td>In that <strong>database.yml</strong> file modify as you need in the development phase</td></tr><tr><td>development:<tr><td> adapter: mysql</td></tr><tr><td> encoding: utf8</td></tr><tr><td> reconnect: false</td></tr><tr><td> database: testMySql</td></tr><tr><td> pool: 5</td></tr><tr><td> username: username</td></tr><tr><td> password: password</td></tr><tr><td> host: hostname</td></tr></td></tr></table></td></tr><tr><td valign='top' width="15"><strong>8:</strong></td><td width="461">In command prompt switch to C:\RailsPrg\appInMySQL> type the command <table><tr><td> <strong> rake db:create</strong></td></tr> <tr><td>Just that, simple db:create is going to connect to our MySQL server, and create the database for us.</td></tr></table></td></tr><tr><td valign='top' width="15"><strong>9:</strong></td><td width="461">Let’s verify that everything is in place, using the following command:<table><tr><td> <strong>ruby script\about</strong></td></tr><tr><td>We can see the something like this as result:</td></tr><tr><td>About your application's environment</td></tr><tr><td> Ruby version 1.9.1 (i386-mingw32)</td></tr><tr><td> RubyGems version 1.3.4</td></tr><tr><td> Rack version 1.0 bundled</td></tr><tr><td> Rails version 2.3.2</td></tr><tr><td> Active Record version 2.3.2</td></tr><br /><tr><td> Action Pack version 2.3.2</td></tr><tr><td> Active Resource version 2.3.2</td></tr><br /><tr><td> Action Mailer version 2.3.2</td></tr><tr><td> Active Support version 2.3.2</td></tr><br /><tr><td> Application root C:\RailsPrg\appInMySQL</td></tr><tr><td> Environment development</td></tr><tr><td> Database adapter mysql</td></tr><tr><td> Database schema version 0</td></tr></table></td></tr><tr><td valign='top' width="15"><strong>10:</strong></td><td width="461">Now we can start generating the table for our application<table><tr><td>Command to create a table & generate the pages for performing operation like inserting, deleting & modifying<br /> Table name is cart </td></tr> <tr><td><strong> ruby script\generate scaffold cart cartId:integer productInCart:string</strong></td></tr><tr><td>Enter the migrate command</td></tr><br /><tr><td> <strong>rake db:migrate</strong></td></tr></table></td></tr><br /><tr><td valign='top' width="15"><strong>11:</strong></td><td width="461">Command to start the server <strong>ruby script\server</strong><table></td></tr></table></td></tr><br /><tr><td valign='top' width="15"><strong>12:</strong></td><td width="461">Execute http://localhost:3000/carts/ =>You can see the application page & can refine further the application<table></td></tr><br /></table></td></tr></table></td></tr></table></td></tr></table>Shreehttp://www.blogger.com/profile/08761061007954529368noreply@blogger.com0tag:blogger.com,1999:blog-9018173469036676402.post-45520507908811376652010-07-16T02:55:00.000-07:002011-01-13T00:50:41.117-08:00Google Map in RailsTo have google map in an application.First we have to get a key from this link <br /><a href="http://code.google.com/apis/maps/signup.html" target="_blank">http://code.google.com/apis/maps/signup.html</a><br />Signing up a key for http://yourdomain.com is usually the best practice, as it will work for all sub domains and directories.<br /><br /><strong>Steps to include Google Map in an application</strong><br /><br />1. Generate an <em>application geomap </em>with latitude:decimal ,longitude:decimal,location <br />name:string and place description:string using scaffold.<br /><br />2. We have to show this data in the map.Map we will get from the google server.<br /><br />3. <strong>Download </strong>the file at <a href="http://tinyurl.com/hfrailsmap " target="_blank">http://tinyurl.com/hfrailsmap </a>.Its a partial file save it as _map.html.erb and place in the app/views/geomaps/ like app/views/geomaps/_map.html.erb<br /><br />4. We have the <strong>update the google_key </strong>in the _map.html.erb file with the key we got from google api link.<br /><br />5. Copy the generated code from the show.html.erb & paste in new file called <br />show_map.html.erb.place it in <strong>app/view/geomaps/show_map.html.erb</strong><br /><br />6. In the <strong>app\controllers\geomaps_controller.rb </strong>place the following code<br /><pre name="code" class="ruby"><br />def show_map<br />@geomap=Geomap.find(params[:id]) <br />end<br /></pre><br /><br />7. Include the following code in the <strong>route.rb </strong>located in <strong>config </strong>folder. <br /><pre name="code" class="ruby">map.connect 'geomaps/map/:id',:action=>'show_map',:controller=>'geomaps'</pre><br /><br />8. Place a <strong>test.xml </strong>data file in the <strong>public</strong> folder.This to check the map with static data.<br /><pre name="code" class="xml"> <data><br /> <description>Vision Tech Solutions Description: Vision Tech Solutions is a Software Product and Outsourced Software Product Development firm, dedicated to provide custom made software services to customer's need of any size within global reach.</description><br /> <latitude>10.784745 </latitude><br /> <longitude>78.689575 </longitude><br /> <title>Vision Tech Solutions</title><br /> </data></pre><br /><br />9. We have to now include the <strong>_map.html.erb </strong>partial code in the display page <strong>show_map.html.erb </strong><pre name="code" class="ruby"><%=render(:partial=>'map',:local=>{:data=>'test.xml'}) %></pre><br />We need to pass a local variable called data containing the path to<br />the map data /test.xml <br /><br />10. <strong>Check</strong> the display of map in <em>http://yourdomain:3000/geomaps/map/1</em>Shreehttp://www.blogger.com/profile/08761061007954529368noreply@blogger.com0tag:blogger.com,1999:blog-9018173469036676402.post-83058631497085930542010-07-15T04:34:00.000-07:002011-01-13T01:02:42.749-08:00Ruby On Rails for Beginners<strong>Rails</strong> is a web-application framework that includes everything needed to create database-backed web applications according to the Model-View-Control pattern.<br />Rails is a collection ruby script. It’s better to have basic idea of ruby language before entering into Rails.<br /><em>Rails has the following things </em><br /><br />1. An <strong>Application framework </strong>/Action Pack that will help us to <br />generate data-driven, interactive pages.<br />2. Rails comes with one build in <strong>WebServer</strong> -We can run the web <br />application <br />3. <strong>Database</strong>-Rails creates application that are configured to <br />work with an integrated SQLite3 database<br />4. <strong>Active Record</strong>-Rails provides for object-relational mapping <br />library. This makes the database like a collection of Ruby objects.<br />5. Rails also provide the <strong>collection of tool scripts </strong>that helps <br />to manage the application.<br /><br /><em>Principle in Rails:</em> <strong>Don’t Repeat Yourself </strong><br />[If we tell Rails something once,its not required to say it again]<br /><br /><strong>Install </strong>Ruby on Rails or RoR version2.1 & SQLite3 for database<br /><a href="http://www.rubyonrails.org/down" target="_blank">http://www.rubyonrails.org/down</a><br /><br /><strong>Getting started with Application</strong><br /><br /><em><strong>I - Steps to create a new application in Rails</strong></em><br />1. At a Command Prompt –type ><strong>rails <em>Application name</em></strong><br /> <em>Ex:</em> C:\ >rails MyApp<br /><br />A New Folder names MyApp will be created with basic structure of the <br />application.<br />The basic Structure has the following folders &files<br />App,Config,Db,Doc,Lib,Log,Public,Script, test, tmp, vendor ,Rake files & readme <br />file<br /><br />2.In that command prompt change into MyApp folder C:\MyApp>.<br />Type <strong>ruby script/server</strong> –To run the web server.<br /><br /> <em>Ex:</em> C:\MyApp>ruby script/server<br /><br />3.Check this link <a href="http://localhost:3000/" target="_blank">http://localhost:3000/</a> to <br />confirm whether the webserver running Rails starts its webserver on port <strong>3000 </strong>by <strong>default</strong>.<br /><br /><strong>II -Start developing the Application</strong><br /><br /><strong>CRUD</strong> operation<br /><em>CRUD operation/ Scaffolding</em> –Basic operation of an application <br />Create,Read,Update & Delete.<br />Type <strong>scaffold</strong> command _Will generate the code for doing CRUD <br />operation in a database and also in the presentation layer .<br /><br /> <em>Ex: </em>C:\MyApp\>ruby script/generate <strong>scaffold </strong>employee employee_name:string <br />address:text<br /><br />Creates <em>employee.rb </em>file in models & <em>create_employees.rb <br /></em>file in Db -migrate<br /><br />[<strong>Note:</strong> We have to give the db name in singular form like <br />Employee,Shop..etc., and the table name will be in plural like <br />employees,Shops..etc.,]<br /><br /><strong>To create the Tables in the database</strong><br /><br />We have to run the migration script using another rails tool called Rake.This <br />migration ruby script is generated by the scaffolding.<br /><br />Type <strong>rake db:migrate </strong>at the command prompt –Which runs the <br />migration code& creates the table.[Db files are location the db folder]<br /><br /> <strong>Ex:</strong>C:\MyApp\>rake db:migrate<br /><br /> Run the <em>employees.rb </em>file in Db –migrate & create the table.<br /><br />Go for link <em>http://localhost:3000/employees </em>In a couple of minutes we <br />can enter few records & perform the CRUD operations. <br /><br /><br />In app folder we will have Model, Controller & View folders .<br /><br /><strong>To changes the display of the page</strong><br /><br />We can make the changes in the labels by changing the four .html.erb files in <br />the views folder.<br /><br /><em>To append a column after creating the Table.</em><br />Rails understand the migration <strong>Add..To..</strong>=>Add particular column <br />to a particular table.<br /><em>Ex:</em>If we want to include Phone Number column in employees table.<br /><br /> C:\MyApp\>ruby script/generate migration <br /><strong>Add</strong>Phone<strong>To</strong>Employees phone:string<br />Rails write the migration code.<br /><br />After this command we have to give <strong>Rake db:migrate </strong>to make the <br />reflection of new column in the table.<br />Go for link <em>http://localhost:3000/employees </em>to conifrm the addition of <br />one more column in the table.<br />We can check the changes whenever we update the code.No need for publish & deploy <br />operations.<br /><br /><strong>Without Scaffolding</strong><br />We are in some time need of writing the code by our self for some application.Instead of having the same basic CRUD functions.We might be in need of genearating our own models & controllers<br /><br /><strong><em>Command to create own </em>model</strong><br /> <em>ruby script/generate </em><strong>model </strong><em>table name in singular form column name:type</em><br /><br />> <em>rake db:migrate</em><br /><br />This command will create <em>magic columns</em> <br /> <em>Id</em> – Generated Primary Key.<br /> <em>Created_at and updated_at</em> – record when data is entered or updated <br /><br /><strong><em>Command to create own</em> controller</strong><br />> <em>ruby script/generate </em><strong>controller</strong> <em><Controller name in plural></em><br />A Controller file will be created in the controller folder.<br /><br /><strong>III- Routes </strong><br />Route tells Tails where the web pages are located.<br />Routes are defined in a ruby program in config/routes.rb<br /><br />By default this two line swill be the <em>routes.rb</em><br /><pre name="code" class="ruby"><br /> map.connect ':controller/:action/:id'<br /> map.connect ':controller/:action/:id.:format'</pre><br />We can specify our own routes.<br /> Ex:<strong>map.connect </strong>'/employees/:id'<strong>,:controller</strong>=>'employees'<strong>,:action</strong>=>'show'<br /><Request path> <Controller name> <function in the controller to be executed><br />The controller by using the <em>finder method </em>in the model sends the employees to the view<br /><br /><em>employees_controller.rb</em> file<br /><pre name="code" class="ruby"><br /> Class employeesController < ApplicationController<br /> Def show<br /> @employee=Employee.find(params[:id])<br /> end<br /> end<br /></pre><br /><br /><strong>Rails Layout</strong><br /> Super-template exists in Rails is called Layout. one Single <br />template that will control how a group of other templates will look.<br />We have to place the html.erb file in the <strong>app/views/layouts</strong>.<br /><br /><strong>To Add the style-sheet in the</strong> <br /> Style sheet, images & javascripts will resides in the public folder.Which has all the static files.<br /><em>Include the following code in the head tag of the html template.</em> <br /><pre name="code" class="ruby"> <%=stylesheet_link_tag 'style sheet name(css)'></pre><br /><br /><strong> Redirect </strong><br /> A redirect tells the browser to go to a different URL for output.<br /> <strong>redirect_to "/---/# {---}" </strong><br /> # -symbol and {} inserts the value of the variable into a string.<br /> <em>Ex:</em> While creating a new sample .We have to redirect to the currently <br /> created sample.<br /><pre name="code" class="ruby"><br /> def create<br /> @sample = Sample.new(params[:sample])<br /> @sample.save<br /> redirect_to "/samples/#{@sample.id}"<br /> end<br /></pre><br /><br /><strong>Restricting access to a function</strong><br /> Rails will use special kind of web security called HTTP Authenticating .This type of security will pops up a dialog box and asks for a username and password when someone tries to enter a secure area of a website.<br />In the controller we have to specify the following code to make the filtration before doing security applied functions.<br /><br /> <strong>before_filter :</strong><em>function name to be called before executing particular function</em>,<strong>;only=></strong>[:security applied operation name]<br /><br />function name to be called before particular operations<br /><pre name="code" class="ruby"><br /> def functionname<br /> authenticate_or_request_with_http_basic("The name of the secured area of the website-domain") do |username,password| <br /> username == "username "&& password =="password"<br /> end<br /> end<br /></pre><br /><em>Ex:</em><br /><pre name="code" class="ruby"><br /> class SampleController <ApplicationController before_filter check_logged_in,:only=>[:edit]<br /> def check_logged_in<br /> authenticate_or_request_with_http_basic("Samples") do |username,password| <br /> username == 'admin' && password =="XY2HYS8"<br /> end<br /> end <br /> end<br /><br /></pre>Shreehttp://www.blogger.com/profile/08761061007954529368noreply@blogger.com1tag:blogger.com,1999:blog-9018173469036676402.post-49098704622362331122010-07-08T01:51:00.000-07:002010-07-08T02:25:17.540-07:00Execute RUBY program on Command Prompt<strong>Ruby</strong> is an object-oriented interpreted scripting language.<br /><br /><a href="http://rubyforge.org/frs/?group_id=167" target="_blank">Download Ruby </a> -One-Click Installer (old) - ruby186-27_rc2.exe<br /><br /><strong>Know about Ruby</strong> by having a look at the below links <br /><a href="http://www.ruby-lang.org/en/about/ " target="_blank">http://www.ruby-lang.org/en/about/</a><br /><a href="http://www.techotopia.com/index.php/What_is_Ruby%3F" target="_blank">http://www.techotopia.com/index.php/What_is_Ruby%3F</a><br /><br />Simple steps for <strong>executing </strong>a tiny <strong>ruby program </strong>in <strong>command prompt</strong>. <br /><br />1. Write a simple program & save the file as “<em>welcome.rb</em>”<br /> <em>Code:</em> puts "Welcome ==> RUBY !"<br /> <br />2. Set Ruby on Path as follows : <br /> <strong> C:\ruby\prg>set path=%path%;c:\ruby\bin</strong><br /><br />3.To excute the program give the filename with .rb extension suffix to the word ruby<br /> <strong>C:\ruby\prg>ruby welcome.rb</strong><br /><br />4.Add .rb to the PATHEXT environment variable as follows: <br /> <strong>C:\ruby\prg>set PATHEXT=.rb;%PATHEXT% </strong><br /><br />5.Once the above settings are configured simply run the program by typing the filename at the command prompt (the .rb filename extension is not required): <br /> <strong>C:\ruby\prg> welcome</strong><br /><br /><em>Command Prompt code</em><br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpBGny3FMsT1Nri-XZRR2mI8p_YYoYjqedo8qhe7kXVpP3WsZVtrqmns_7Jtf3gVdo3hGonkdJyMcNEEJFkvy5W-hL3DU9ZmSE62XI3Ere58auFx9Z3LCLUiVfMB4onEQvyPUqH_ya7Ak/s1600/ruby.jpg"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 174px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpBGny3FMsT1Nri-XZRR2mI8p_YYoYjqedo8qhe7kXVpP3WsZVtrqmns_7Jtf3gVdo3hGonkdJyMcNEEJFkvy5W-hL3DU9ZmSE62XI3Ere58auFx9Z3LCLUiVfMB4onEQvyPUqH_ya7Ak/s320/ruby.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5491456720894703618" /></a>Shreehttp://www.blogger.com/profile/08761061007954529368noreply@blogger.com0tag:blogger.com,1999:blog-9018173469036676402.post-49109031323086067652010-07-07T23:26:00.000-07:002010-07-07T23:22:37.212-07:00PostGres Vs MySQL Database<div class=Section1> <p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size: 12.0pt'><o:p> </o:p></span></font></p> <table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 align=left width=407 style='width:305.6pt;border-collapse:collapse;margin-left:6.75pt; margin-right:6.75pt'> <tr height=23 style='height:17.0pt'> <td width=119 height=23 valign=top bgcolor="#F3F3F3" style='width:89.6pt; border:solid windowtext 1.0pt;background:#F3F3F3;padding:0in 5.4pt 0in 5.4pt; height:17.0pt'> <p class=MsoNormal align=center style='text-align:center;mso-element:frame'><b><font size=2 color=navy face="Times New Roman"><span style='font-size:11.0pt; color:navy;font-weight:bold'>PROPERTY <o:p></o:p></span></font></b></p> </td> <td width=144 height=23 valign=top bgcolor="#F3F3F3" style='width:1.5in; border:solid windowtext 1.0pt;border-left:none;background:#F3F3F3;padding: 0in 5.4pt 0in 5.4pt;height:17.0pt'> <p class=MsoNormal align=center style='text-align:center;mso-element:frame'><b><font size=2 color=blue face="Times New Roman"><span style='font-size:11.0pt; color:blue;font-weight:bold'>POSTGRES<o:p></o:p></span></font></b></p> </td> <td width=144 height=23 valign=top bgcolor="#F3F3F3" style='width:1.5in; border:solid windowtext 1.0pt;border-left:none;background:#F3F3F3;padding: 0in 5.4pt 0in 5.4pt;height:17.0pt'> <p class=MsoNormal align=center style='text-align:center;mso-element:frame'><b><font size=2 color=blue face="Times New Roman"><span style='font-size:11.0pt; color:blue;font-weight:bold'>MYSQL<o:p></o:p></span></font></b></p> </td> </tr> <tr height=27 style='height:20.2pt'> <td width=119 height=27 valign=top style='width:89.6pt;border:solid windowtext 1.0pt; border-top:none;padding:0in 5.4pt 0in 5.4pt;height:20.2pt'> <p class=MsoNormal style='mso-element:frame'><i><font size=3 color="#333399" face="Times New Roman"><span style='font-size:12.0pt;color:#333399; font-style:italic'>License<o:p></o:p></span></font></i></p> </td> <td width=144 height=27 valign=top style='width:1.5in;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0in 5.4pt 0in 5.4pt;height:20.2pt'> <p class=MsoNormal style='mso-element:frame'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>BSD<o:p></o:p></span></font></p> </td> <td width=144 height=27 valign=top style='width:1.5in;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0in 5.4pt 0in 5.4pt;height:20.2pt'> <p class=MsoNormal style='mso-element:frame'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>GPL or Commercial<o:p></o:p></span></font></p> </td> </tr> <tr height=56 style='height:41.7pt'> <td width=119 height=56 valign=top style='width:89.6pt;border:solid windowtext 1.0pt; border-top:none;padding:0in 5.4pt 0in 5.4pt;height:41.7pt'> <p class=MsoNormal style='mso-element:frame'><i><font size=3 color="#333399" face="Times New Roman"><span style='font-size:12.0pt;color:#333399; font-style:italic'>OS Support<o:p></o:p></span></font></i></p> </td> <td width=144 height=56 valign=top style='width:1.5in;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0in 5.4pt 0in 5.4pt;height:41.7pt'> <p class=MsoNormal style='mso-element:frame'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>Windows, Unix, Linux, Mac OS.<o:p></o:p></span></font></p> </td> <td width=144 height=56 valign=top style='width:1.5in;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0in 5.4pt 0in 5.4pt;height:41.7pt'> <p class=MsoNormal style='mso-element:frame'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>Windows, Unix, Linux, Mac OS, Symbiyan.<o:p></o:p></span></font></p> </td> </tr> <tr height=59 style='height:44.5pt'> <td width=119 height=59 valign=top style='width:89.6pt;border:solid windowtext 1.0pt; border-top:none;padding:0in 5.4pt 0in 5.4pt;height:44.5pt'> <p class=MsoNormal style='mso-element:frame'><i><font size=3 color="#333399" face="Times New Roman"><span style='font-size:12.0pt;color:#333399; font-style:italic'>Fundamental Futures<o:p></o:p></span></font></i></p> </td> <td width=144 height=59 valign=top style='width:1.5in;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0in 5.4pt 0in 5.4pt;height:44.5pt'> <p class=MsoNormal style='mso-element:frame'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>ACID, Referential Integrity, Transactions, Unicode, Interface – GUI & SQL<o:p></o:p></span></font></p> </td> <td width=144 height=59 valign=top style='width:1.5in;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0in 5.4pt 0in 5.4pt;height:44.5pt'> <p class=MsoNormal style='mso-element:frame'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>ACID, Referential Integrity, Transactions, Unicode, Interface – GUI & SQL<o:p></o:p></span></font></p> </td> </tr> <tr height=27 style='height:20.2pt'> <td width=119 height=27 valign=top style='width:89.6pt;border:solid windowtext 1.0pt; border-top:none;padding:0in 5.4pt 0in 5.4pt;height:20.2pt'> <p class=MsoNormal style='mso-element:frame'><i><font size=3 color="#333399" face="Times New Roman"><span style='font-size:12.0pt;color:#333399; font-style:italic'>Max DB Size<o:p></o:p></span></font></i></p> </td> <td width=144 height=27 valign=top style='width:1.5in;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0in 5.4pt 0in 5.4pt;height:20.2pt'> <p class=MsoNormal style='mso-element:frame'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>Unlimited<o:p></o:p></span></font></p> </td> <td width=144 height=27 valign=top style='width:1.5in;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0in 5.4pt 0in 5.4pt;height:20.2pt'> <p class=MsoNormal style='mso-element:frame'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>Unlimited<o:p></o:p></span></font></p> </td> </tr> <tr height=27 style='height:20.2pt'> <td width=119 height=27 valign=top style='width:89.6pt;border:solid windowtext 1.0pt; border-top:none;padding:0in 5.4pt 0in 5.4pt;height:20.2pt'> <p class=MsoNormal style='mso-element:frame'><i><font size=3 color="#333399" face="Times New Roman"><span style='font-size:12.0pt;color:#333399; font-style:italic'>Max Table Size<o:p></o:p></span></font></i></p> </td> <td width=144 height=27 valign=top style='width:1.5in;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0in 5.4pt 0in 5.4pt;height:20.2pt'> <p class=MsoNormal style='mso-element:frame'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>32 TB<o:p></o:p></span></font></p> </td> <td width=144 height=27 valign=top style='width:1.5in;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0in 5.4pt 0in 5.4pt;height:20.2pt'> <p class=MsoNormal style='mso-element:frame'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>256 TB<o:p></o:p></span></font></p> </td> </tr> <tr height=27 style='height:20.2pt'> <td width=119 height=27 valign=top style='width:89.6pt;border:solid windowtext 1.0pt; border-top:none;padding:0in 5.4pt 0in 5.4pt;height:20.2pt'> <p class=MsoNormal style='mso-element:frame'><i><font size=3 color="#333399" face="Times New Roman"><span style='font-size:12.0pt;color:#333399; font-style:italic'>Max Row Size<o:p></o:p></span></font></i></p> </td> <td width=144 height=27 valign=top style='width:1.5in;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0in 5.4pt 0in 5.4pt;height:20.2pt'> <p class=MsoNormal style='mso-element:frame'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>1.6 TB<o:p></o:p></span></font></p> </td> <td width=144 height=27 valign=top style='width:1.5in;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0in 5.4pt 0in 5.4pt;height:20.2pt'> <p class=MsoNormal style='mso-element:frame'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>64 KB<o:p></o:p></span></font></p> </td> </tr> <tr height=28 style='height:21.1pt'> <td width=119 height=28 valign=top style='width:89.6pt;border:solid windowtext 1.0pt; border-top:none;padding:0in 5.4pt 0in 5.4pt;height:21.1pt'> <p class=MsoNormal style='mso-element:frame'><i><font size=3 color="#333399" face="Times New Roman"><span style='font-size:12.0pt;color:#333399; font-style:italic'>Max Columns per row<o:p></o:p></span></font></i></p> </td> <td width=144 height=28 valign=top style='width:1.5in;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0in 5.4pt 0in 5.4pt;height:21.1pt'> <p class=MsoNormal style='mso-element:frame'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>250 – 1600 Depending on type<o:p></o:p></span></font></p> </td> <td width=144 height=28 valign=top style='width:1.5in;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0in 5.4pt 0in 5.4pt;height:21.1pt'> <p class=MsoNormal style='mso-element:frame'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>4096<o:p></o:p></span></font></p> </td> </tr> <tr height=27 style='height:20.2pt'> <td width=119 height=27 valign=top style='width:89.6pt;border:solid windowtext 1.0pt; border-top:none;padding:0in 5.4pt 0in 5.4pt;height:20.2pt'> <p class=MsoNormal style='mso-element:frame'><i><font size=3 color="#333399" face="Times New Roman"><span style='font-size:12.0pt;color:#333399; font-style:italic'>Max BLOB Size<o:p></o:p></span></font></i></p> </td> <td width=144 height=27 valign=top style='width:1.5in;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0in 5.4pt 0in 5.4pt;height:20.2pt'> <p class=MsoNormal style='mso-element:frame'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>2 GB<o:p></o:p></span></font></p> </td> <td width=144 height=27 valign=top style='width:1.5in;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0in 5.4pt 0in 5.4pt;height:20.2pt'> <p class=MsoNormal style='mso-element:frame'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>4 GB<o:p></o:p></span></font></p> </td> </tr> <tr height=27 style='height:20.2pt'> <td width=119 height=27 valign=top style='width:89.6pt;border:solid windowtext 1.0pt; border-top:none;padding:0in 5.4pt 0in 5.4pt;height:20.2pt'> <p class=MsoNormal style='mso-element:frame'><i><font size=3 color="#333399" face="Times New Roman"><span style='font-size:12.0pt;color:#333399; font-style:italic'>Max Char Size<o:p></o:p></span></font></i></p> </td> <td width=144 height=27 valign=top style='width:1.5in;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0in 5.4pt 0in 5.4pt;height:20.2pt'> <p class=MsoNormal style='mso-element:frame'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>1 GB<o:p></o:p></span></font></p> </td> <td width=144 height=27 valign=top style='width:1.5in;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0in 5.4pt 0in 5.4pt;height:20.2pt'> <p class=MsoNormal style='mso-element:frame'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>64 KB<o:p></o:p></span></font></p> </td> </tr> <tr height=27 style='height:20.2pt'> <td width=119 height=27 valign=top style='width:89.6pt;border:solid windowtext 1.0pt; border-top:none;padding:0in 5.4pt 0in 5.4pt;height:20.2pt'> <p class=MsoNormal style='mso-element:frame'><i><font size=3 color="#333399" face="Times New Roman"><span style='font-size:12.0pt;color:#333399; font-style:italic'>Max Number Size<o:p></o:p></span></font></i></p> </td> <td width=144 height=27 valign=top style='width:1.5in;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0in 5.4pt 0in 5.4pt;height:20.2pt'> <p class=MsoNormal style='mso-element:frame'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>Unlimited<o:p></o:p></span></font></p> </td> <td width=144 height=27 valign=top style='width:1.5in;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0in 5.4pt 0in 5.4pt;height:20.2pt'> <p class=MsoNormal style='mso-element:frame'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>64 bits<o:p></o:p></span></font></p> </td> </tr> <tr height=27 style='height:20.2pt'> <td width=119 height=27 valign=top style='width:89.6pt;border:solid windowtext 1.0pt; border-top:none;padding:0in 5.4pt 0in 5.4pt;height:20.2pt'> <p class=MsoNormal style='mso-element:frame'><i><font size=3 color="#333399" face="Times New Roman"><span style='font-size:12.0pt;color:#333399; font-style:italic'>Min Date Value<o:p></o:p></span></font></i></p> </td> <td width=144 height=27 valign=top style='width:1.5in;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0in 5.4pt 0in 5.4pt;height:20.2pt'> <p class=MsoNormal style='mso-element:frame'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>-4713<o:p></o:p></span></font></p> </td> <td width=144 height=27 valign=top style='width:1.5in;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0in 5.4pt 0in 5.4pt;height:20.2pt'> <p class=MsoNormal style='mso-element:frame'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>1000<o:p></o:p></span></font></p> </td> </tr> <tr height=28 style='height:21.35pt'> <td width=119 height=28 valign=top style='width:89.6pt;border:solid windowtext 1.0pt; border-top:none;padding:0in 5.4pt 0in 5.4pt;height:21.35pt'> <p class=MsoNormal style='mso-element:frame'><i><font size=3 color="#333399" face="Times New Roman"><span style='font-size:12.0pt;color:#333399; font-style:italic'>Max Date Value<o:p></o:p></span></font></i></p> </td> <td width=144 height=28 valign=top style='width:1.5in;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0in 5.4pt 0in 5.4pt;height:21.35pt'> <p class=MsoNormal style='mso-element:frame'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>5874897<o:p></o:p></span></font></p> </td> <td width=144 height=28 valign=top style='width:1.5in;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0in 5.4pt 0in 5.4pt;height:21.35pt'> <p class=MsoNormal style='mso-element:frame'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>9999<o:p></o:p></span></font></p> </td> </tr> <tr height=27 style='height:20.2pt'> <td width=119 height=27 valign=top style='width:89.6pt;border:solid windowtext 1.0pt; border-top:none;padding:0in 5.4pt 0in 5.4pt;height:20.2pt'> <p class=MsoNormal style='mso-element:frame'><i><font size=3 color="#333399" face="Times New Roman"><span style='font-size:12.0pt;color:#333399; font-style:italic'>Max Column Name<o:p></o:p></span></font></i></p> </td> <td width=144 height=27 valign=top style='width:1.5in;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0in 5.4pt 0in 5.4pt;height:20.2pt'> <p class=MsoNormal style='mso-element:frame'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>63<o:p></o:p></span></font></p> </td> <td width=144 height=27 valign=top style='width:1.5in;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0in 5.4pt 0in 5.4pt;height:20.2pt'> <p class=MsoNormal style='mso-element:frame'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>64<o:p></o:p></span></font></p> </td> </tr> <tr height=91 style='height:68.35pt'> <td width=119 height=91 valign=top style='width:89.6pt;border:solid windowtext 1.0pt; border-top:none;padding:0in 5.4pt 0in 5.4pt;height:68.35pt'> <p class=MsoNormal style='mso-element:frame'><i><font size=3 color="#333399" face="Times New Roman"><span style='font-size:12.0pt;color:#333399; font-style:italic'>Database Capability<o:p></o:p></span></font></i></p> </td> <td width=144 height=91 valign=top style='width:1.5in;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0in 5.4pt 0in 5.4pt;height:68.35pt'> <p class=MsoNormal style='mso-element:frame'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>Union, Inner join, Intersect, Except, Inner join, Outer join, Inner Selects, Merge join, Windowing Functions, Common Table Expressions.<o:p></o:p></span></font></p> </td> <td width=144 height=91 valign=top style='width:1.5in;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0in 5.4pt 0in 5.4pt;height:68.35pt'> <p class=MsoNormal style='mso-element:frame'><st1:place w:st="on"><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>Union</span></font></st1:place>, Inner join, Outer join, Inner Selects, Merge Joins.<o:p></o:p></p> </td> </tr> <tr height=55 style='height:40.9pt'> <td width=119 height=55 valign=top style='width:89.6pt;border:solid windowtext 1.0pt; border-top:none;padding:0in 5.4pt 0in 5.4pt;height:40.9pt'> <p class=MsoNormal style='mso-element:frame'><i><font size=3 color="#333399" face="Times New Roman"><span style='font-size:12.0pt;color:#333399; font-style:italic'>Objects<o:p></o:p></span></font></i></p> </td> <td width=144 height=55 valign=top style='width:1.5in;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0in 5.4pt 0in 5.4pt;height:40.9pt'> <p class=MsoNormal style='mso-element:frame'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>Data Domain, Cursor, Trigger, Function, Procedure, External Routine.<o:p></o:p></span></font></p> </td> <td width=144 height=55 valign=top style='width:1.5in;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0in 5.4pt 0in 5.4pt;height:40.9pt'> <p class=MsoNormal style='mso-element:frame'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>Cursor, Trigger, Function, Procedure, External Routine.<o:p></o:p></span></font></p> </td> </tr> </table> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> <p class=MsoNormal style='margin-left:39.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p> </div> Shreehttp://www.blogger.com/profile/08761061007954529368noreply@blogger.com0tag:blogger.com,1999:blog-9018173469036676402.post-31018094529174166482010-07-07T05:01:00.000-07:002011-01-05T21:20:18.548-08:00Facebook API<strong> FaceBook API </strong>lets you create and manage your own ads on Facebook programmatically
<br />
<br /><strong>DownLoad Facebook jar</strong>
<br />To work in JAVA <a href="http://code.google.com/p/facebook-java-api/" target="_blank">Download </a> - facebook-java-api-3.0.2-bin.zip
<br />
<br /><em>Inlcuded the jar in the class path and try to access the class in the jar</em>
<br />
<br /><strong>IDE</strong>
<br />Eclipse - Version: 3.4.0
<br />
<br />
<br /><strong>Get the API key & Application Secret </strong>
<br />
<br /> To start your work with Facebook API, You need to get the
<br />API key & Application Key.
<br />
<br /> You need to get register your applications in this page <a href="http://www.facebook.com/developers/apps.php" target="_blank">http://www.facebook.com/developers/apps.php</a> using Facebook account.
<br />
<br />Necessary fields to be entered as follows
<br />In <em>Basic </em>- Include the developers name .Who will be involving in developing the application.
<br />In <em>Canvas </em>–Give the callback url of your application
<br />
<br />
<br /><em>We can start coding the application now.</em>
<br />
<br />Create the Twitter object & get the request token by passing the application Consumer key & secret.
<br />
<br /><strong>To get the user client </strong>
<br />
<br /><em><strong>FacebookJsonRestClient </strong></em>class is used for getting user client returns the object in JSON format.
<br /><pre name="code" class="java">
<br />FacebookJsonRestClient userClient =getUserClientsession);
<br />public static FacebookJsonRestClient.getUserClient(HttpSession session) {
<br /> return (FacebookJsonRestClient)session.getAttribute(FACEBOOK_USER_CLIENT);
<br />}
<br /></pre>
<br />
<br /><em>User session doesn't have a Facebook API client setup yet.</em>
<br />
<br /><em>Pass the API key & Application </em>secret to get the valid userclient
<br />And <em>store it in a session</em>.
<br /><pre name="code" class="java">
<br /> userClient = new FacebookJsonRestClient(api_key, secret);
<br /> session.setAttribute(FACEBOOK_USER_CLIENT, userClient);
<br /></pre>
<br />
<br />Pass the Facebook url with your api key & required permission redirect the call.
<br />
<br />You can check the <a href="http://developers.facebook.com/docs/authentication/permissions" target="_blank"><strong>permission</strong> </a>available in Facebook .
<br /><pre name="code" class="java">
<br /> facebook = new FacebookWebappHelper<Document>(req, res, api_key, secret);
<br /> nextPage = req.getRequestURI();
<br /> nextPage = nextPage.substring(nextPage.indexOf("/", 1) + 1);
<br /> //cut out the first /, the context path and the 2nd /
<br /> System.out.println(nextPage);
<br /> boolean redirectOccurred = facebook.requireLogin(nextPage);
<br />if(redirectOccurred){
<br /> res.sendRedirect("http://www.facebook.com/login.php?api_key=dbfc65d0e72f5c103gg0gfgd8c5&connect_display=popup&v=1.0&next=http://www.facebook.com/connect/login_success.html&cancel_url=http://www.facebook.com/connect/login_failure.html&fbconnect=true&return_session=true&session_key_only=true&req_perms=read_stream,publish_stream,offline_access,sms,email,user_location");
<br />return;
<br /> }
<br /></pre>
<br />After execution of the above code.It request you enter the Facebook username & password.
<br />
<br /><strong>Get the auth_token</strong>
<br /><pre name="code" class="java">
<br />String authToken=request.getParameter("auth_token");
<br /></pre>
<br />By passing this authToken to the client you can start working on the functionalities like getting friends ,knowing user details etc.,
<br />
<br />You can check the functionalities available in the FacebookJsonRestClient in this link
<br /><a href="http://developers.facebook.com/docs/reference/rest" target="_blank">http://developers.facebook.com/docs/reference/rest</a>/
<br />
<br /><strong>Functions</strong>
<br /><strong>To know the current user id</strong>
<br /><pre name="code" class="java">
<br />Long facebookUserID = userClient.users_getLoggedInUser();
<br /></pre>
<br /><strong>To get friends Id’s</strong>
<br /><pre name="code" class="java">
<br />JSONArray arrayObj = (JSONArray)userClient.friends_get();
<br /></pre>
<br /><strong>Get the id’s from Array & store it in a list</strong>
<br /><pre name="code" class="java">
<br />List userIds = new ArrayList();
<br />for(int i=0;i<arrayObj.length();i++){
<br /> try {
<br /> userIds.add((arrayObj.getString(i));
<br /> } catch (JSONException e) {
<br /> e.printStackTrace();
<br /> }
<br />}
<br /></pre>
<br /><strong>Set the necessary fields in the ProfileField,that you need from a
<br />User. </strong>
<br />
<br /><pre name="code" class="java">
<br />EnumSet<ProfileField> fields = EnumSet.of ( com.google.code.facebookapi.ProfileField.NAME, com.google.code.facebookapi.ProfileField.PIC, com.google.code.facebookapi.ProfileField.CURRENT_LOCATION, com.google.code.facebookapi.ProfileField.FIRST_NAME, com.google.code.facebookapi.ProfileField.LAST_NAME);
<br /></pre>
<br /><strong>To get the user details </strong>
<br /><pre name="code" class="java">
<br /> JSONArray userArray = null;
<br /> try {
<br /> userArray = client.users_getInfo(userIds, fields);
<br /> } catch (FacebookException e1) {
<br /> e1.printStackTrace();
<br /> }
<br /> for(int i=0;i< userArray.length();i++){
<br /> try {
<br /> for (int j = 0; j < userArray.length(); j++) {
<br /> JSONObject obj = userArray.getJSONObject(j);
<br /> System.out.println("User Id"+obj.getString("uid"));
<br /> System.out.println("Pic url "+obj.getString("pic"));
<br /> System.out.println("Name"+obj.getString("first_name")
<br /> +" "+obj.getString "last_name"));
<br /> }
<br /> } catch (JSONException e) {
<br /> e.printStackTrace();}
<br /> }
<br /></pre>
<br />
<br /><strong>To update the status of the current user</strong>
<br /> Check whether the user having the permissions & than try the functions
<br /><pre name="code" class="java">
<br />if (userClient.users_hasAppPermission(Permission.STATUS_UPDATE)){
<br />userClient.users_setStatus("Status-Developing Facebook apps in Java!", false);
<br />}</pre>
<br /><strong>To Publish the stream for the current user</strong>
<br /><pre name="code" class="java">
<br />if(userClient.users_hasAppPermission(Permission.PUBLISH_STREAM)){
<br />userClient.stream_publish("Stream-Publish-Wall written using Facebook API !", null, null, null, null);
<br />}
<br /></pre>
<br />
<br /><strong>To post the link to single /Group of user</strong>
<br /><pre name="code" class="java">
<br />userClient.links_post(Long.parseLong("Give the UserID"), "www.kyyba.com", "IT Recruitment");
<br /></pre>Shreehttp://www.blogger.com/profile/08761061007954529368noreply@blogger.com0tag:blogger.com,1999:blog-9018173469036676402.post-14962278510943817762010-07-04T22:38:00.000-07:002011-01-13T00:59:39.018-08:00Twitter APITwitter4J is a Java library for the Twitter API.<br />With Twitter4J, We can easily integrate our Java application with the Twitter service.<br /><br /><strong>Step-up Twitter4j API</strong><br /><br /><strong>Get the Consumer key \ API key & Consumer Secret \Secret Key.</strong><br /><br /> To start your work with Twitter4j API, You need to get the <br />Consumer key \ API key & Consumer Secret \Secret Key.<br /><br /> You need to get register your applications in this page <a href="http://twitter.com/apps " target="_blank">http://twitter.com/apps</a><br /> using Twitter account.<br /><br /><strong>Download Twitter4j jar</strong><br /> <a href="http://twitter4j.org/en/index.html#download" target="_blank">Download</a> - twitter4j-core-2.1.3-SNAPSHOT.jar<br />Inlcuded the jar in the class path and try to access the class in the jar<br /><br /><strong><em>We can start coding the application now.</em></strong><br />Create the Twitter object & get the request token by passing the application Consumer key & secret.<br /><br /><strong>Code</strong><br /><pre class="java" name="code"><br />Twitter twitter = new Twitter();<br />twitter.setOAuthConsumer("consumer key",”consumer secret” );<br />RequestToken requestToken = twitter.getOAuthRequestToken(); <br /></pre><br /><br /><strong>Get the Access Token & Secret </strong><br /><br />By using the request token you need to get the access token & token secret.<br /><strong>Code</strong><br /><pre class="java" name="code"><br /> String token = requestToken.getToken(); <br /> String tokenSecret = requestToken.getTokenSecret();<br /></pre> <br /><br /><strong>Authorized URL for accessing the Application</strong><br /> Store the requestToken & Authorized URl in a session.<br /><pre class="java" name="code"><br /> String authUrl = requestToken.getAuthorizationURL(); <br /> session.setAttribute("authUrl", authUrl);<br /> session.setAttribute("requestToken", requestToken);<br /></pre><br /><br /><em>Example Authorized Application URL</em><br /><br />https://twitter.com/oauth/authorize?auth_token=LJyavdddrrrreddddy3sfpm8bTHg3H3Bddddm4<br /><br />Once you click the authorized link it will ask for you twitter username & password.Once user details verfied it redirect to your application.<br /><br /><br /><strong>Functions in Twitter4j</strong><br /><br /><strong>Tweet Message </strong><br /><br />This function is to tweet a text message in his/her twitter.<br /><pre class="java" name="code"><br />Status status = twitter.updateStatus(“Tweet Message .”);<br /></pre><br /><br /><strong>Delete the Tweeted message</strong><br /><br />We can delete the tweeted message by passing the TweetId<br /><pre class="java" name="code"><br />destroyTweet(twitter,tweetId);<br /></pre><br /><strong>User details </strong><br /> This function is used to get the user details.We need to pass the user’s id .<br /><pre class="java" name="code"><br />User user = twitter.showUser(twitter.getId());<br /></pre><br />From the user object we can get the details of the user profile,description …<br /><pre class="java" name="code"><br />user.getProfileImageURL(); <br />user.getScreenName();<br />user.getName();<br />user.getDescription(); <br />user.getURL();<br />user.getLocation();<br />user.getProfileBackgroundColor();<br />user.getProfileBackgroundImageUrl();<br /></pre><br /><br /><strong>Search Tweet </strong><br /> We can search for tweets by using this method<br /><pre class="java" name="code"><br /> String searchTweet ="TieCon MidWest"<br /> Query query = new Query("searchTweet");<br /> QueryResult result = twitter.search(query);<br /> System.out.println("hits:" + result.getTotal());<br /> for (Tweet tweet : result.getTweets()) {<br /> System.out.println(tweet.getFromUser() + ":" + tweet.getText());<br /> }<br /></pre><br /><strong>To get the friends tweets & details</strong><br /><em> <br />/* All the Tweets in the first page will be displayed*/</em><br /><pre class="java" name="code"><br />List<Status> statuses = twitter.getFriendsTimeline(); <br />for (Status status : statuses) {<br /> System.out.println(status.getUser().getName() + ":" +<br /> status.getText());<br />}<br /></pre><br /><br /><em>/** Four tweets in the first page will be displayed*/</em><br /><pre class="java" name="code"><br /> Paging paging = new Paging(1, 4);<br /> List<Status> statuses = twitter.getFriendsTimeline(paging);<br /></pre><br /><br /><strong>Sending / Receiving Direct Messages</strong><br /><pre class="java" name="code"><br />Twitter sender= new TwitterFactory().getInstance(senderID,senderPassword);<br />sender.sendDirectMessage(recipientId,message);<br />Twitter receiver = new TwitterFactory().getInstance(recipientId,recipientPassword);<br />List<DirectMessage> messages = receiver.getDirectMessages();<br />for (DirectMessage message : messages) {<br /> System.out.println("Sender:" + message.getSenderScreenName());<br /> System.out.println("Text:" + message.getText());<br />}<br /></pre><br /><br /><br /><strong>Method's avaialabe in the Twitter API </strong><br /><br /><a href="http://apiwiki.twitter.com/Twitter-API-Documentation" target="_blank">http://apiwiki.twitter.com/Twitter-API-Documentation</a>Shreehttp://www.blogger.com/profile/08761061007954529368noreply@blogger.com3tag:blogger.com,1999:blog-9018173469036676402.post-3189099907202808472010-06-24T02:39:00.000-07:002011-01-04T04:38:08.204-08:00LinkedIn APII have just started to work in this API with Java .bcoz am basically a Java developer.<br /><br /><strong>Step-up LinkedIn API</strong><br /><br />To start your work with LinkedIn API, You need to get the <br /><strong>Consumer key \ API key</strong> & <strong>Consumer Secret \Secret Key</strong>.<br />Go for this link to get your Consumer key & Consumer Secret for your application <br /><a href="https://www.linkedin.com/secure/developer" target="_blank">https://www.linkedin.com/secure/developer</a><br />You have to give application name & some regular fields you have to fill up.<br /><br /><strong>IDE & JDK Version </strong><br />Working with IBM Rational Application Developer-Version: 7.0.0<br /><strong>jdk</strong> used is <strong>1.6</strong> version.<br />You can work on Eclipse also.<br /><br /><strong>Download 3 Jars </strong><br /><br />1.<em>commons-codec-1.3.jar</em> –<br /><a href="http://code.google.com/p/linkedin-j/source/browse/#svn/trunk/linkedin-j/lib" target="_blank">http://code.google.com/p/linkedin-j/source/browse/#svn/trunk/linkedin-j/lib</a><br /><br />2.<em>linkedin-j.jar </em>- <a href="http://code.google.com/p/linkedin-j/source/browse/#svn/trunk/linkedin-j/dist" target="_blank">http://code.google.com/p/linkedin-j/source/browse/#svn/trunk/linkedin-j/dist</a> [version downloaded is May24]<br /><br />3.<em>signpost-core-1.2.1.1.jar </em>- <a href="http://code.google.com/p/linkedin-j/source/browse/#svn/trunk/linkedin-j/lib" target="_blank">http://code.google.com/p/linkedin-j/source/browse/#svn/trunk/linkedin-j/lib</a><br /><br /><em>Included the jar in the class path and try to access the class in the jar</em><br /><br /><em><strong>Got :( Error</strong></em> bcoz I tried out downloading snapshot version of linkedIn.jar ,<br />Not able to get the authService object. <br /><pre name="code" class="java"><br />final LinkedInOAuthService oauthService = LinkedInOAuthServiceFactory.getInstance().createLinkedInOAuthService(consumerKeyValue, consumerSecretValue); <br /></pre><br /><strong>Error got </strong> <br />Exception in thread "main" java.lang.NoClassDefFoundError: oauth/signpost/signature/OAuthMessageSigner<br />With the support of Linked Forum got rid from this issue.<br /><a href="http://developer.linkedin.com/message/5585#5585" target="_blank">http://developer.linkedin.com/message/5585#5585</a><br /><br />Lets start coding ....<br /><strong>How to get LinkedIn –token, token secret & Authorization URL using consumer key & consumer secret?</strong><br /><br /><pre name="code" class="java"><br />final LinkedInOAuthService oauthService = LinkedInOAuthServiceFactory.getInstance().createLinkedInOAuthService(consumerKeyValue, consumerSecretValue); <br />LinkedInRequestToken requestToken = oauthService.getOAuthRequestToken("your application url");<br />String token = requestToken.getToken();<br />String tokenSecret = requestToken.getTokenSecret();<br />String authUrl = requestToken.getAuthorizationUrl(); <br /></pre><br /><br /><em>Set all this objects in session.Inorder to proceed with the functions.</em><br /><pre name="code" class="java"><br />session.setAttribute("LINKEDIN_TOKEN", token);<br />session.setAttribute("LINKEDIN_TOKEN_SECRET", tokenSecret);<br />session.setAttribute("LINKEDIN_REQUEST_TOKEN", requestToken );<br />session.setAttribute("LINKEDIN_AUTH_URL", authUrl );<br /></pre><br />After execution of these codes, the service will be verfied .<br /><br />Place this authorized url as a link in a jsp page.<br />When the link is clicked it asks for your LinkedIn username & Password.<br /><br /><strong>How to get the LinkedIn –Access Token?</strong><br /><br />Once your application ,username& password are verified you will get a auth_verifier with the url.<br /><pre name="code" class="java"><br />String oauthVerifier = request.getParameter("oauth_verifier");<br />//Pass the requestToken[session.getAttribute("LINKEDIN_REQUEST_TOKEN")] & oauthVerifier to get accesstoken<br />LinkedInAccessToken accessToken = oauthService.getOAuthAccessToken(requestToken, oauthVerifier);<br /></pre><br /><em>Set the access token in a session </em><br /><pre name="code" class="java"><br />session.setAttribute("LINKEDIN_ACCESS_TOKEN", accessToken);<br /></pre><br /><br /><strong>How to create the Client Object?</strong><br /><br />Create the factory object by passing consumerKeyValue & consumerSecretValue<br /><pre name="code" class="java"><br />final LinkedInApiClientFactory factory = LinkedInApiClientFactory.newInstance(consumerKeyValue, consumerSecretValue); <br /></pre><br /><em>Pass the access token to get the client object .</em><br /><pre name="code" class="java"><br />final LinkedInApiClient client = factory.createLinkedInApiClient(accessToken);<br /></pre><br /><br /><strong>Functions in Linked-Id</strong><br /><br /><em>Check out all the <a href="http://linkedin-j.googlecode.com/svn-history/r263/trunk/linkedin-j/core/src/main/java/com/google/code/linkedinapi/client/AsyncHandlerLinkedInApiClient.java" target="_blank">functions </a>available in the LinedIn API</em> <br /><br />I have given some of the main functions with example code ,Here it goes...<br /><br /><strong>To get the Current user Profile</strong><br /><pre name="code" class="java"><br />Person profile = client.getProfileForCurrentUser(EnumSet.of(ProfileField.ID));<br />System.out.print("CurrentUsers Profile-Id >>"+profile.getId());<br /></pre><br /><strong>To get specific information of the Current User</strong><br /><br /><em>Set the fields which you need .</em><br /><pre name="code" class="java"><br />Person userprofile = client.getProfileById(profile.getId(), EnumSet.of(ProfileField.FIRST_NAME,ProfileField.LAST_NAME,ProfileField.HEADLINE,ProfileField.INDUSTRY,ProfileField.API_STANDARD_PROFILE_REQUEST, ProfileField.PICTURE_URL, ProfileField.PUBLIC_PROFILE_URL));<br />System.out.println("PersonID:" + userprofile.getId()); <br />System.out.println("Name:"+ userprofile.getFirstName()+ " " + userprofile.getLastName()); <br />System.out.println("Headline:" + userprofile.getHeadline()); <br />System.out.println("API Request:" + userprofile.getApiStandardProfileRequest()); <br />System.out.println("Industry:" + userprofile.getIndustry()); <br />System.out.println("Picture:" + userprofile.getPictureUrl());<br />System.out.println("Public URL:" + userprofile.getPublicProfileUrl());<br /></pre><br /><br /><strong>To get the connections of the Current User</strong><br /><em>Set the fields which you need .</em><br /><pre name="code" class="java"><br />final Set<ProfileField> connectionFields = EnumSet.of(ProfileField.ID, ProfileField.FIRST_NAME, ProfileField.LAST_NAME, ProfileField.HEADLINE, ProfileField.INDUSTRY, ProfileField.CURRENT_STATUS, ProfileField.CURRENT_STATUS_TIMESTAMP,ProfileField.API_STANDARD_PROFILE_REQUEST, ProfileField.EDUCATIONS,ProfileField.PUBLIC_PROFILE_URL, ProfileField.POSITIONS, ProfileField.LOCATION, ProfileField.PICTURE_URL);<br /></pre><br /><em>Pass the connection fields & get the connection object </em><br /><pre name="code" class="java"><br />Connections tryconnections = client.getConnectionsForCurrentUser(connectionFields);<br /></pre><br /><br /><em>Iterate the Person object from the person list.</em><br /><pre name="code" class="java"><br />for (Person person : connections.getPersonList()) { <br />System.out.println( "PersonId :"+ person.getId());<br />System.out.println("Name:" + person.getFirstName() + " " + person.getLastName()); <br />System.out.println("Headline:" + person.getHeadline()); <br />System.out.println("Industry:" + person.getIndustry()); <br />System.out.println("Picture:" + person.getPictureUrl()); <br /></pre><br />//<em>To get the Location details </em><br /><pre name="code" class="java"><br />Location location = person.getLocation(); <br />System.out.println("Location:" +location.getName()+" - "+location.getCountry().getCode());<br />System.out.println("API Request:" + person.getApiStandardProfileRequest()); <br />System.out.println("Public URL:" + person.getPublicProfileUrl()); <br /></pre><br />//<em>To get the Header information </em><br /><pre name="code" class="java"><br />ApiStandardProfileRequest apiStandardProfileRequest=person.getApiStandardProfileRequest();<br />System.out.println("Header:" + apiStandardProfileRequest.getHeaders());<br />}</pre><br /><br /><strong>To get Profile ID by using public url</strong><br /><br /><em>Pass the public URL of a person & connection fields </em><br /><pre name="code" class="java"><br />Person checkPerson = client.getProfileByUrl("public url of a person,connectionFields);<br />System.out.println("PersonID:" + checkPerson.getId()); <br />System.out.println("Name:" + checkPerson.getFirstName() + " " + checkPerson.getLastName()); <br />.<br />.<br /></pre><br />You can get all the data of a person for whatever fields mentioned in the connection field.<br /><br /><strong>To get Profile ID by using Person ID </strong><br /><pre name="code" class="java"><br />Pass the PersonID & required fields <br />Person othersProfile = client.getProfileById(userID, EnumSet.of(ProfileField.FIRST_NAME,ProfileField.LAST_NAME,ProfileField.HEADLINE,ProfileField.INDUSTRY,ProfileField.API_STANDARD_PROFILE_REQUEST, ProfileField.PICTURE_URL, ProfileField.PUBLIC_PROFILE_URL));<br /></pre><br /><strong>To invite by using E-mail </strong><br /><em>Pass the client object,emailId of the person you want to invite,firsname,lastname,subject & message.</em><br /><pre name="code" class="java"><br />inviteByEmailID(client,emailID, firstName, lastName,subject,msg);<br /></pre><br /><em>Note</em>:e-mail,first name & last name should not be passed Empty.Null Pointer Exception will be thrown.<br /><br /><strong>To invite by using PersonId</strong><br /><br /><em>Pass the header token value ,userId,subject & message.</em><br /><br /><em>Code to take the header token value</em><br /><pre name="code" class="java"><br />String tokenValue=authHeader.getHttpHeaderList().get(0).getValue(); <br />System.out.println("tokenValue "+tokenValue);<br />client.sendInviteById("PersonID", subject, msg,tokenValue);<br /></pre><br /><br /><strong>To send message to specific group of people</strong><br /><em><br />You have to pass the id’s of the people in a list whom you want to send message<br /></em><br /><em>Iterate the list in a for loop</em><br /><pre name="code" class="java"><br />client.sendMessage(Arrays.asList(((String) list.get(i)).split(",")), subj, message);<br /></pre><br /><strong>To Search within Linked In</strong><br /><br />We can search by passing company name,keyword,title,CountryCode<br />…etc<br /><em><br />Example code is given for searching connection based on particular company</em><br /><em>Function to put the search parameters [Company name is set]</em><br /><pre name="code" class="java"><br />private static Map<SearchParameter, String> getSearchParameters() {<br />Map<SearchParameter, String> searchParameters = new EnumMap<SearchParameter, String>(SearchParameter.class); <br />searchParameters.put(SearchParameter.COMPANY, "Kyyba"); <br />return searchParameters;<br />}<br />Map SearchParameter, String searchParameters = getSearchParameters();<br /></pre><br /><br /><em>Pass the search Parameters to find the people based on search</em><br /><pre name="code" class="java"><br />People people = client.searchPeople(searchParameters);<br /></pre><br /><br /><em>To get the people information</em><br /><pre name="code" class="java"><br />for (Person person : people.getPersonList()) {<br />System.out.println(person.getId() + ":" + person.getFirstName() + " " + person.getLastName() + ":" + person.getHeadline());<br />}</pre><br /><br /><strong>We can't get the connections of connections</strong><br /><pre name="code" class="java"><br />Connections otherscon = client.getConnectionsById("ProfielID");<br /></pre><br /><strong>Error</strong> will be thrown as <strong><em>Access to other member's connections denied</em></strong>.<br /><br />In <em>Linkedin forum </em>they have mentioned as currently they not support getting other people's connections. <br /><br /><a href="http://developer.linkedin.com/thread/1329" target="_blank">http://developer.linkedin.com/thread/1329</a><br /><a href="http://developer.linkedin.com/message/3706;jsessionid=3E26C276AF047188942CDE50F562B638.node0" target="_blank">http://developer.linkedin.com/message/3706;jsessionid=3E26C276AF047188942CDE50F562B638.node0</a>Shreehttp://www.blogger.com/profile/08761061007954529368noreply@blogger.com9tag:blogger.com,1999:blog-9018173469036676402.post-17339377505890970132010-05-31T21:29:00.000-07:002010-07-20T22:40:02.892-07:00About Twitter APITwitter4J is a Java library for the Twitter API.<br />With Twitter4J, We can easily integrate our Java application with the Twitter service.<br /><br /><strong><a href="http://twitter4j.org/en/code-examples.html" target="_blank">Click to Download Twitter API</a></strong><br /><br />example :Code to update Tweets<br /><pre name="code" class="java"><br />............<br />..........<br />public static void main(String[] args)throws TwitterException{<br /><br /> Twitter twitter = new TwitterFactory().getInstance(username,password);<br />Status status = null;<br /> try {<br /> status = twitter.updateStatus(statusInput);<br /> } catch (TwitterException e) {<br /> System.out.println("Exception while updating the status to [" + status.getText() + "].");<br /> e.printStackTrace();<br /> }<br /> System.out.println("Successfully updated the status to [" + status.getText() + "].");<br /></pre>Shreehttp://www.blogger.com/profile/08761061007954529368noreply@blogger.com0tag:blogger.com,1999:blog-9018173469036676402.post-80187970506524104622010-05-15T02:22:00.000-07:002011-02-08T00:39:41.242-08:00Links for Jquery Learners<strong>ToolTip</strong><br /><a href="http://www.ajaxdaddy.com/javascript-tooltip-jtip.html" target="_blank">http://www.ajaxdaddy.com/javascript-tooltip-jtip.html</a><br /><br /><strong>Marquee </strong><br /><a href="http://www.seangw.com/wordpress/index.php/2009/01/basic-ajax-tutorial-smooth-scrolling-text-marquee-with-a-jquery-plugin/" target="_blank">http://www.seangw.com/wordpress/index.php/2009/01/basic-ajax-tutorial-smooth-scrolling-text-marquee-with-a-jquery-plugin/</a><br /><br /><strong>Floating Box</strong><br /><a href="http://www.phpletter.com/Demo/Jquery-Floating-Box-Plugin/" target="_blank">http://www.phpletter.com/Demo/Jquery-Floating-Box-Plugin/</a><br /><br /><strong>Paging</strong><br /><a href="http://rikrikrik.com/jquery/pager/#examples" target="_blank">http://rikrikrik.com/jquery/pager/#examples</a><br /><br /><strong>Slide Show</strong><br /><a href="http://malsup.com/jquery/cycle/" target="_blank">http://malsup.com/jquery/cycle/</a><br /><br /><strong>Image Zooming</strong><br /><a href="http://dynamicdrive.com/dynamicindex4/imagepanner.htm" target="_blank">http://dynamicdrive.com/dynamicindex4/imagepanner.htm</a><br /><br /><strong>JScrollPane</strong><br /><a href="http://www.kelvinluck.com/assets/jquery/jScrollPane/jScrollPane.html" target="_blank">http://www.kelvinluck.com/assets/jquery/jScrollPane/jScrollPane.html</a>Shreehttp://www.blogger.com/profile/08761061007954529368noreply@blogger.com1tag:blogger.com,1999:blog-9018173469036676402.post-5135198525985230172010-05-15T01:49:00.000-07:002010-05-15T04:22:02.289-07:00My first try in Jquery .... :)Tried a fix for <a href="http://forum.jquery.com/topic/toggle-css-in-multiple-instances-individually" target="_blank">Toggle-css-in-multiple-instances-individually</a><br /><em><strong>Include the Script & Style within Head tag</strong></em><br /><br />$(document).ready(function(){<br /> $('.showAnswer').click(function(){<br /> var htmlStr = $("li.theAnswer").html();<br /> $("li.theAnswer").html($("li.theAnswer").text().replace(htmlStr,'<span>'+htmlStr+'</span>'));<br /> $(this).text($(this).text() == 'Hide Answer' ? 'Show Answer' : 'Hide Answer');<br /> });<br />});<br /><br /> <style type="text/css"><br /> .ul.specials li { color:navy; }<br /> .ul.specials li span { color:green;font-weight:bold;}<br /> </style><br /><strong><em>Include the code in Body tag</em></strong> <br />A list with one alone with class for example<br /> .. class="theAnswer"(C) 6 to 7.. <br />Have A hyperlink with class class="showAnswer" <br /><br /><a href="http://sundarishree.blogspot.com/p/source-code.html" target="_blank"><br /> <br /><strong>View Demo</strong></a><strong></strong>Shreehttp://www.blogger.com/profile/08761061007954529368noreply@blogger.com0