Pages

Tuesday, May 31, 2011

Company 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.View .

You can check the below URL's by using a simple java program

Links to get company information in combination with LinkedIn data
1. To get the company information by giving the company domainhttp://api.linkedin.com/v1/companies?email-domain=kyyba.com
Output :



586336
Kyyba Inc


2. To get the company information by giving the company id
http://api.linkedin.com/v1/companies/586336:(id,name,description,industry,logo-url)

output :



586336
KYYBA Inc
Kyyba, Inc. is a Global provider of strategic staffing and managed services for the Information Technology and Engineering Clients
Kyyba service lines provide customers the following services:
Product and Software Development Services
Engineering and Design Services
Staff Augmentation Services
Outsourcing Services

Staffing and Recruiting
http://media.linkedin.com/mpr/mpr/p/2/000/050/2e0/322206a.png


3. To get the companies around the given area [us:84] http://api.linkedin.com/v1/company-search:(companies,facets)?facet=location,us:84 Output :






1028
Oracle

.
.
.



location
Location


us:0
United States
596338
false

.
.
.





4. To get company in which the token is createdhttp://api.linkedin.com/v1/people/~/following/companies

Output :





96307
Vision Tech Solutions


5. To get company to follow by the current userhttp://api.linkedin.com/v1/people/~/suggestions/to-follow/companies
I didn’t get any output data .

Links to get LinkedIn's jobs by company, industry and more to display relevant jobs to the users.
1. To get some job information in LinkedIn for the user
http://api.linkedin.com/v1/people/~/suggestions/job-suggestions
Output :






1641017

1333802

1441
Google


5EyneQPD-C
David
S.
test at Test Advantage

This position is based in Bangalore, India.
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

Bangalore

.
.

50


2. To get some job information exsisiting in given area [US:84]http://api.linkedin.com/v1/job-search:(jobs,facets)?facet=location,us:84
Output :






1653582

1231
Symantec

Best in Industry

YRNg4JA8HX
Shyam Sundar
V.
Principal Recruiter at Symantec

 Symantec R&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
Pune, Maharashtra

.
.

3. To get the particular job information by giving the JobId [jobid=1653560]
http://api.linkedin.com/v1/jobs/1452577:(id,company:(name),position:(title))
Output :




1653560

Tata Consultancy Services


Siebel Architect- Performance Management


4. To get some job bookmarcks
http://api.linkedin.com/v1/people/~/job-bookmarks

I didn’t get any output data .

Simple Java Program using LinkedIn API

The below program will helps you to fetch & view linkedIn data in a short time.

Follow this link to download the jars & to get token, secret to work with LinkedIn API

Simple Java Program. To get the LinkedIn details about the current user [Who created the token & secret key]


public static void main(String[] args) {

String linkedinKey = "C2E7PG.."; //Your LinkedIn key
String linkedinSecret = "9hyC6.. ";//Your LinkedIn Secret
OAuthConsumer consumer = new DefaultOAuthConsumer( linkedinKey,linkedinSecret);

OAuthProvider provider = new DefaultOAuthProvider("https://api.linkedin.com/uas/oauth/requestToken",
"https://api.linkedin.com/uas/oauth/accessToken",
"https://api.linkedin.com/uas/oauth/authorize");

System.out.println("Fetching request token from LinkedIn...");
String authUrl;
try {
authUrl = provider.retrieveRequestToken(consumer, OAuth.OUT_OF_BAND);
System.out.println("Check the below link and grant this app authorization -You will get Pin Number.Copy it\n" + authUrl );
System.out.println("Enter the PIN code and hit ENTER when you're done:");
} catch (OAuthMessageSignerException e1) {
e1.printStackTrace();
} catch (OAuthNotAuthorizedException e1) {
e1.printStackTrace();
} catch (OAuthExpectationFailedException e1) {
e1.printStackTrace();
} catch (OAuthCommunicationException e1) {
e1.printStackTrace();
}
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String pin;
try {
pin = br.readLine();
System.out.println("Fetching access token from LinkedIn...");
provider.retrieveAccessToken(consumer, pin);
System.out.println("Access token: " + consumer.getToken());
System.out.println("Token secret: " + consumer.getTokenSecret());
URL url = new URL("http://api.linkedin.com/v1/people/~:(id,first-name,last-name,picture-url,headline)");

HttpURLConnection request = (HttpURLConnection) url.openConnection();
consumer.sign(request);
request.connect();
System.out.println("Sending request to LinkedIn...");
String responseBody = convertStreamToString(request.getInputStream());
System.out.println("Response: " + request.getResponseCode() + " "
+ request.getResponseMessage() + "\n" + responseBody);

} catch (OAuthMessageSignerException e) {
e.printStackTrace();
} catch (OAuthNotAuthorizedException e) {
e.printStackTrace();
} catch (OAuthExpectationFailedException e) {
e.printStackTrace();
} catch (OAuthCommunicationException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
public static String convertStreamToString(InputStream is) {

BufferedReader reader = new BufferedReader(new InputStreamReader(is));
StringBuilder sb = new StringBuilder();
String line = null;
try {
while ((line = reader.readLine()) != null) {
sb.append(line + "\n");
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return sb.toString();
}
}


Output

Fetching request token from LinkedIn...
Check the below link and grant this app authorization -You will get Pin Number.Copy it
https://api.linkedin.com/uas/oauth/authorize?oauth_token=dcb835667-a5d7-4e95-91f9-fde4b9b47e3a
Enter the PIN code and hit ENTER when you're done:
59278
Fetching access token from LinkedIn...
Access token: f0f94b3d-50b9-4549-bd96-5d1ea3ba7a9c
Token secret: f2b13c99-f206-4612-bf9e-2afc1387bc1a
Sending request to LinkedIn...
Response: 200 OK



GtYKzPiNkX
Sundari Shree
Gunasekaran
Software Engineer at Vision Tech Solutions


Note: By passing the different URL’s as parameter You can check all the available information in LinkedIn .

URL url = new URL("http://api.linkedin.com/v1/people/~:(id,first-name,last-name,picture-url,headline)");

This URL is to get about the people information.

Monday, April 11, 2011

GoogleMap - Latitude and Longitude

I have to display the map with respect to the place given.

In that tags the longitude and latitude of the location to be passed as parameters to get the exact location in Map.

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.

Code: To get the Longitude & Latitude of the location

To have Google map in an application. We have to get a key from this link
http://code.google.com/apis/maps/signup.html



import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;


try {

String locationName="johannesburg"; \\Give any location\place name
String gmapKey="ABQIAAAAiqblAQNWNoua1VYnGtU1dBRdtL7gCpXlU8FuabFvwIMVSlhRL4gzsM_7WZ6hbScCw1YuLXHNjwA"; \\Give your google map key
URL url = new URL("http://maps.google.com/maps/geo?q="+locationName+"&output=csv&key="+gmapKey);
URLConnection urlConnection = url.openConnection();
BufferedReader in;
String inputLine;
String data =null;

in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
while ((inputLine = in.readLine()) != null){
data =inputLine;
System.out.println("Accuracy,Status,Latitude,Longitutude of " +locationName+" >> "+data);
}
in.close();

}
} catch (IOException e) {
e.printStackTrace();
}


output:

Accuracy,Status,Latitude,Longitutude of johannesburg >> 200,4,-26.2041028,28.0473051

Monday, February 21, 2011

Bitly using Mashape

Mashape is an API marketplace where service providers and individual developers can instantly make available an API.Its FREE to use.

Mashape can used in 2 ways

1. Making use of the featured API’s available in Mashape
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.

I tried out the first way, which I need currently to work on
Check the featured services provided by Mashape -Explore.
They are in ready to use state.Avaiable in Ruby, Java, Python, PHP Obj-C, and JSON

I tried out with SimpleGeo and Bitly.

Steps to work on Bitly using Mashape :

Step1: 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]


Step2: Download the featured Bitly API from Mashape .
The Jar will contain Bitly component's Java client library will contain the following files:

- mashapeClient.jar - This file to be include in the project, that contains the core
functionalities of every Java client library and that is
immutable for every component.
- Bitly.java - The auto-generated *.java file for the component, that
declares a Bitly class.
- LICENSE - README

Step3 Download the following jars to work on all the above API's using Mashape.

- httpclient-4.0.jar
- httpcore-4.0-beta3.jar
- json-rpc-1.0.jar
- json-20080701.jar

Step4 Signup in Bitly & get the bitly-login and bitly-Api-key.

Step5 Code:

//Enter Mashape API key
Bitly bitly=new Bitly("sgFFDCfgEOKsLMsO9X7l75gCI ");

//Pass the url to be shortened, bitly-login and bitly-Api-key &it returens the JSONObject

JSONObject bitlyResponse = bitly.getShortenedUrl("http://sundarishree.blogspot.com/","shree","R_08de4b3475dd5655818230c15c4966471");


Advantage of this Mashape is no need to download the API jar from different sites. We can get in one point.

Monday, February 7, 2011

Session in PHP

This post might help the newbie to work on session in php.

1. Start up the session

session_start()
Function must appear before the html tag.Its initialize session data
Example :


.
.


2. Store a session variable
Example:

session_start();
$_SESSION['username']="Misty"; // store session data
?>

echo "Name =". $_SESSION['username']; //retrieve session data
?>


Where ever we try to access[Store or Retirve] the session variable the
session_start() function has to be called once before accessing the
session variable.

3. To delete the session data

The unset() function is used to free the specified session variable:
Example:

unset($_SESSION['username']);
?>


4. To destroy the session
We can completely destroy the session by calling the session_destroy()
function
Example:

session_destroy();
?>

session_destroy() will reset the session and We will lose all the stored session
data.

5. To check whether the session variable is null
Example:

is_null($_SESSION['username'])==true


6. Some of the Session Functions
session_cache_expire — Return current cache expire
session_cache_limiter — Get and/or set the current cache limiter
session_commit — Alias of session_write_close
session_decode — Decodes session data from a string

session_encode — Encodes the current session data as a string
session_get_cookie_params — Get the session cookie parameters
session_id — Get and/or set the current session id
session_is_registered — Find out whether a global variable is
registered in a session
session_module_name — Get and/or set the current session module
session_name — Get and/or set the current session name
session_regenerate_id — Update the current session id with a newly
generated one
session_register — Register one or more global variables with
the current session
session_save_path — Get and/or set the current session save path
session_set_cookie_params — Set the session cookie parameters
session_set_save_handler — Sets user-level session storage functions
session_unregister — Unregister a global variable from the
current session
session_write_close — Write session data and end session
7. To check the page expiry using session
Example:

session_start();
ini_set('display_errors', true);
ini_set('display_startup_errors', true);
error_reporting (E_ALL);
session_cache_expire( 20 );
$inactive =250;
if(isset($_SESSION['start']) ) {
$session_life = time() - $_SESSION['start'];
if($session_life > $inactive){header("Location:login.php?errorMsg=Your session
has expired.Please login again.");
}
}
$_SESSION['start'] = time();
?>

This code has to placed in the pages in which we need to check for session
expiry [Session expires beyond 4 mins].


8. ERRORS -> While working on sessions in PHP you might
come across
the following errors. I got these 2 errors.

8.1 Warning: session_start() [function. session-start]: Node no
longer exists in C:\wamp\home.php on line 3

occurs if a object is taken from a xml file or format.

Cannot serialize object wrapping 3rd party library structs. Must serialize
the xml (to a string) and store that to session and reload the xml when
restoring from session
Example

session_start();
/*To get from the mail.xml */
$xml = simplexml_load_file("../mail.xml");
foreach($xml->children() as $child){
if($child->getName()=='servername'){
$servername=$child;
}else if($child->getName()=='dbname'){
$dbname=$child;
}else if ($child->getName()=='username'){
$username=$child;
}else if ($child->getName()=='password'){
$password=$child;
}else if ($child->getName()=='url'){
$url=$child;
}
}
$_SESSION['url']=(string)$Url; // Casting is required


8.2. The following error might occur when we try to re-direct the page from one
page to another.

Warning: Cannot modify header information – headers already
sent by (output
started /home/kvel/kyybaventures.com/laton_v/views/leftnav.php:28) in
/home/kvel/kyybaventures.com/laton_v/views/welcome.php on line 10


The problem is mainly due to the header start writing the output and again
trying to resent the header information. Normally when we use echo statement
before the header, this type of problem will come. It will not reflect in
the development environment and if try to deploy the code in the remote
server, this problem used to occur. Even if you remove the echo statement
and still the problem persist, follow the below solution.

To get rid of this error use these two lines

  

at the start of the php file and

 

at the bottom of the php file where you got the above error.

Wednesday, January 12, 2011

Searching for PAAS providers

In 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.

In 2011 many more enterprises virtualized and get onto private cloud journey as next step.
Surely will be great competitions between the Cloud Service providers.

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.

Did some analysis on Bungee connect, Joyent & WSO2.

Regarding,
Bungee Connect – 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.
After surfing a day, we felt this is best for us. Tried to work with beta .They have not yet released their beta work.
Might be in near future they might release the beta but we can’t wait for it.

Joyent -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.
Also don’t know whether it suits to build our application.

WSO2 –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.

When we go through the video, tutorial & definifiton it seems like “Spoon
Feeding”.But when tried practically something is missing. Some notch in the flow of integration.
There comes the check they have kept all sort of pricing in the name of support.Showing the great business.

We are trying this as a first application in cloud so we are not ready to afford much on this trial.

Still searching is not completed.

Sunday, January 2, 2011

About CLOUD COMPUTING from a Tenderfoot

I 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.

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

"A pool of abstracted, highly scalable, and managed compute infrastructure capable of hosting end-customer applications and billed by consumption"

Already We are using some kind of cloud ser­vice, such as Web email (Gmail, Yahoo! Mail or Hot­mail),online data stor­age (IDrive, Mozy) or online soft­ware.

Cloud Environment is divided in three segment
SAAS
PAAS
IAAS


SAAS - Software As A Service

Provides software applications to end users without requiring the end user to run the application on their own computer.
Increasingly popular with Small and medium enterprises(SMEs).
No hardware or software to manage .
Service delivered through browser.

Examples of SAAS

CRM
ERP
Project Management
Banking
Spreadsheet

PAAS - Platform As A Service
Is an environment for running custom applications that provides operating-system level services for accessing the hosting and hardware resources needed in a cloud.
Some PaaS have their own dedicated SaaS architecture (For example : Salesforce's Force.com).
Most platforms anyway allow the consumer to choose their own SaaS tools.

Example of PAAS

Google App Engine
Mosso (Hosting cloud service)
AWS: S3(A Ruby Library for Amazon's Simple Storage Service's (S3) REST API)

IAAS - Infrastructure as a service
Is a form of hosting.
It includes network access, routing services and storage.
The IaaS providers will usualy provides the hardware and administrative services needed to store applications and a platform for running applications.


The cloud has become


1.our enter­tain­ment net­work we are spend­ing hun­dreds of mil­lions of hours on sites like YouTube , Flickr and so on.

2.our social net­work Face­book,Bebo, hi5 ,MySpace and sim­i­lar sites now claim hun­dreds of mil­lions of mem­bers.

3.our work­bench we man­age projects in Base­camp, share large files with Pando,tweak pho­tos in online photo edi­tors like Adobe Pho­to­shop Express and Pic­nik.

4.our devel­op­ment net­work open source pro­gram­mers trade code on sites like SourceForge.net and Drupal.org.

Still not started to fly in CLOUD.While I do,surely i will post the next.