Google I/O is the annual Google developer conference full of geeky stuff. This year i found some nice tools that i think they will be cool to see and implement :’)
Random order:
AdSense for Ajax Google Storage a big hit for Amazon S3
An API for predicting stuff – Prediction API BigQuery – a DB in the cloud like Amazon RDS but only running on BigTable and Google’s infrastructure and not tons of cheap servers like Amazon does
Yea so i got a friend called SaltwaterC that has a friend called Json (it reads Jason) and i have met him… a lightweight dude, that can make your life easier.
Here is an simple example:
{
"created_at": "Tue May 11 11:50:14 +0000 2010",
"in_reply_to_screen_name": null,
"favorited": false,
"truncated": false,
"source": "<a href=\"http://destroytwitter.com/\" rel=\"nofollow\">DestroyTwitter</a>",
"in_reply_to_status_id": null,
"place": null,
"contributors": null,
"user": {
"notifications": false,
"profile_background_tile": false,
"profile_sidebar_fill_color": "1A1B1F",
"description": "Anticrist Superstar Programmer, Head editor @ w2.ro, Pro Drinker, slaker and typo expert.",
"lang": "en",
"verified": false,
"created_at": "Thu Jun 19 15:17:28 +0000 2008",
"profile_sidebar_border_color": "1A1B1F",
"profile_image_url": "http://a3.twimg.com/profile_images/842271117/ochelari_normal.jpg",
"following": true,
"followers_count": 1017,
"screen_name": "necenzurat",
"statuses_count": 9385,
"profile_background_color": "000000",
"url": "http://w2.ro",
"time_zone": "Bucharest",
"friends_count": 454,
"contributors_enabled": false,
"profile_text_color": "666666",
"protected": false,
"location": "Bucharest, Romania",
"favourites_count": 15,
"name": "Costin M.",
"profile_background_image_url": "http://a3.twimg.com/profile_background_images/81980881/twtbg.png",
"profile_link_color": "1e8f89",
"id": 15169998,
"geo_enabled": true,
"utc_offset": 7200
},
"coordinates": null,
"in_reply_to_user_id": null,
"id": 13784107904,
"geo": null,
"text": "WikiLeaks has probably produced more scoops in its short life than the Washington Post has in the past 30 years http://p.ly/ad4rb"
}
And now Mr. XML
<?xml version="1.0" encoding="UTF-8"?>
<status>
<created_at>Tue May 11 11:50:14 +0000 2010</created_at>
<id>13784107904</id>
<text>WikiLeaks has probably produced more scoops in its short life than the Washington Post has in the past 30 years http://p.ly/ad4rb</text>
<source><a href="http://destroytwitter.com/" rel="nofollow">DestroyTwitter</a></source>
<truncated>false</truncated>
<in_reply_to_status_id/>
<in_reply_to_user_id/>
<favorited>false</favorited>
<in_reply_to_screen_name/>
<user>
<id>15169998</id>
<name>Costin M.</name>
<screen_name>necenzurat</screen_name>
<location>Bucharest, Romania</location>
<description>Anticrist Superstar Programmer, Head editor @ w2.ro, Pro Drinker, slaker and typo expert.</description>
<profile_image_url>http://a3.twimg.com/profile_images/842271117/
ochelari_normal.jpg</profile_image_url>
<url>http://w2.ro</url>
<protected>false</protected>
<followers_count>1017</followers_count>
<profile_background_color>000000</profile_background_color>
<profile_text_color>666666</profile_text_color>
<profile_link_color>1e8f89</profile_link_color>
<profile_sidebar_fill_color>1A1B1F</profile_sidebar_fill_color>
<profile_sidebar_border_color>1A1B1F</profile_sidebar_border_color>
<friends_count>454</friends_count>
<created_at>Thu Jun 19 15:17:28 +0000 2008</created_at>
<favourites_count>15</favourites_count>
<utc_offset>7200</utc_offset>
<time_zone>Bucharest</time_zone>
<profile_background_image_url>http://a3.twimg.com/profile_background_images/
81980881/twtbg.png</profile_background_image_url>
<profile_background_tile>false</profile_background_tile>
<notifications>false</notifications>
<geo_enabled>true</geo_enabled>
<verified>false</verified>
<following>false</following>
<statuses_count>9385</statuses_count>
<lang>en</lang>
<contributors_enabled>false</contributors_enabled>
</user>
<geo/>
<coordinates/>
<place/>
<contributors/>
</status>
First of all:
JSON can be parser is one freaking like
$json = json_decode($file, true);
and the XML… well i don’t want to get into details
Second: the upper examples are in size: JSON – 1,37 KB (1.406 bytes) XML – 2,04 KB (2.090 bytes)
and yes, when you are doing an import of 15.000 products from XML every thing counts.
Ok…. so i’m not a rich guy to afford a iPhone, blackberry or an Android (but i’ts on the wishlist) so i made a little programing… yeah.
Well the ideea is quite simple: get the Google Latitude Latitude and Longitude them send them to 4sqr, after that check for nearby venues…. then check in in the appropriate one:
Let’s begin:
i searched for a phpclass as a base… and found this one witch is a little buggy so i had to do some quick fixes:
now: index.php
include "kernel/foursquare.class.php";
include "kernel/latitude.php";
include "conf/conf.php";
$foursquare = new Foursquare($phone, $pass);
$foursquare->format = "json";
$json = $foursquare->nearbyAndSearch($l, $lo,"30","");
$where = json_decode($json, true);
foreach ($where['groups'] as $element){
foreach ($element['venues'] as $venues){
$nume = $venues['name'];
$id = $venues['id'];
$dist = $venues['distance'];
echo "<a href='check.php?id=$id'>$nume</a> - $dist m<br />" ;
}
}
This thing does the searching for the venues and lists them. then send’s them
check.php – the file
include "kernel/foursquare.class.php";
include "conf/conf.php";
$foursquare = new Foursquare($phone, $pass);
$foursquare->format = "json";
$id = $_GET['id'];
$check = $foursquare->checkin($id,"","","","1","1","","");
$checkr = json_decode($check, true);
echo "<pre>";
var_dump($checkr);
Yeah, the output rocks
so next in line is the how to get the code the Latitude and Longitude from Google Latitude:
$phone = ""; // phone #
$pass = ""; // password
$latidude_code = ""; //get the code from the http://www.google.com/latitude/apps/badge, you need to have it shared on street level, exluclude the - sign
Yea so we all know that The Google Page Rank is just for showing off (yes, The Google Page Rank does not matter anymore) but is kinda embarrassing for your Twitter profile to have PR 5 and your blog(s) to have 4 or below.
Yeah, it sucks!
Hello World, and welcome to my developer blogjournal site. Here i will try to code write in English and post my work (like a portfolio) or bits and pieces of code.