Friday, May 24, 2013

Searching Live Events from YouTube

I was slightly surprised and also somewhat annoyed when I found out that there is no way to make a free text search for finding YouTube Live Events with YouTube Data API. The Live Events section of the API is still experimental, but I feel the search functionality is so essential that is almost strange that it is missing.

Sure, you can filter the search results with some simple comparisons (see https://developers.google.com/youtube/2.0/developers_guide_protocol_partial), but I was unable to find a wildcard for titles or description/summary searches, similar to SQL's functionality WHERE title LIKE '%bbc%'.

So if you want to search live events, you have at least these two options:

1.  Load everything from one live event feed and make a string search over the xml result.
2. Do not use YouTube Data API, but use the web page search instead.
Example with PHP
The next code snippet loads the web page url, finds the video ids, and loads the detailed information about the live event with YouTube Data API.

// get your keywords and page index from page request 
// $searchwords    = $_REQUEST["searchwords"] 
// $page           = $_REQUEST["page"] 
$page = 1; 
$searchwords = 'arirang'; 
// create url 
$search_url = "http://www.youtube.com/results?search_query=" 
             ."$searchwords&filters=live&lclk=live&page=$page"; 
// load web page contents 
$html = file_get_contents($search_url); 
// now search the content ids 
$ids = array();                      // to store the found ids 
$idlength = 11;                      // length of youtube videoid 
$attr = 'data-context-item-id="';    // video id in the html 
$pos = strpos($html,$attr,0);        // pos in html 
while ($pos!==FALSE) { 
    $ids[] = substr($html, $pos+strlen($attr), $idlength); 
    $pos=strpos($html,$attr,$pos+$idlength); 
} 
// now you can loop the ids and load live events for each id 
foreach ($ids as $id) { 
    $xmlurl = "http://gdata.youtube.com/feeds/api/videos/" 
             ."$id?v=2&prettyprint=true"; 
    $xmldata = file_get_contents($xmlurl); 
    // parse live event here etc... 
} 

Friday, April 26, 2013

My first Android app - Marble Lands has been released


I have been playing games since C64 era, but only recently I have joined to the group of people who are also actually making the games! Well, nowadays the iOs and Android platforms have made it "easy" for "everyone" to start programming and publishing games, so making an Android game is not that big of a deal, but I am still very happy and satisfied that I have been involved in this kind of a game programming project.

You can check out the game from Google Play: https://play.google.com/store/apps/details?id=fi.vihmalo.marblelands

Screenshots and other info can be found from the game's blog: http://marblelands.blogspot.com

Fun fact: Actually my fisheye lens blog post (http://popscan.blogspot.fi/2012/04/fisheye-lens-equation-simple-fisheye.html) was made based on game code, because we really needed that kind of an effect to the ball that is rolling in the game. So load the game and see the fish eye lens effect in action!


Tuesday, April 9, 2013

How enable Android Debug Bridge (ADB) in Acer Iconia B1-A71

When you connect your Acer Iconia B1-A71 Android device to your laptop, in my case Windows laptop, the device chooses one connection method (Media device MTP) and installs drivers for that functionality.

Useful, but not necessary step: 
When still connected with USB, drag down the top status bar, and you can see the text "Connected as a media device". Click the text, and you can change the connection method from Media device to Camera (PTP) mode. Change the connection type and windows will install yet another bunch of drivers.

The most important step:
Now go to the Settings > Developer Options and enable the developer options by sliding the top most button to right. Now select USB Debugging to be active. Windows will now download the drivers for ADB. Wait for the drivers to be installed and then test the connection.

Test the connection:
Open command prompt and type:  
adb devices

You should see something like:
List of devices attached
C4F12260AFFF58F device


Type command:
adb logcat
And you will see the output from the device.

Windows has finished installing drivers.

Friday, March 29, 2013

Angry Birds Amazon

So far we have seen Angry Birds soda cans with the Yellow Bird, Red Bird, Bad Piggie and Black Space Bird. The latest Angry Birds character to appear in a side of a soda can is the Boomerang Bird (also known as the Green Bird).

The soda is named as "Amazon" and the flavor is citrus fruit.







Links:
The official manufacturer homepage for the Amazon soda: http://www.olvi.fi/web/en/293
The first Angry Birds sodas: http://popscan.blogspot.fi/2012/03/angry-birds-soda-cans.html
More Angry Birds sodas: http://popscan.blogspot.fi/2012/09/new-angry-birds-soda-cans-lagoon-and.html

Monday, February 25, 2013

Angry Birds chocolate Easter eggs

Angry Birds Easter eggs from Fazer are now available in Finnish stores!

Each chocolate egg contains an Angry Birds toy, which can be used as a pencil topper or as a decorative on your desk. There are eight different toys available. Sorry, not yet images from the toys... :)
 




Links
Info in Finnish  - http://www.fazer.fi/Tuotteet/Uutuudet/Vihaiset-linnut-munivat-yllatyksia-Fazerin-perinteiseen-paasiaiseen/

Tuesday, January 15, 2013

Angry Birds soda in big bottles

This are the latest Angry Birds sodas available: Diamond and Sunrise!

The orange color soda with Orange Bird (Sunrise) has a mandarin flavor and the red soda with Pink Bird (Diamond) has a raspberry flavor in it.

The bottle size is 1,5 litres, which is 50,7210341 US fluid ounces, according to Google.


Links:
Olvi Oy, Sunrise - http://www.olvi.fi/web/en/283
Olvi Oy, Diamond - http://www.olvi.fi/web/en/282

Saturday, December 15, 2012

Angry Birds coffee

Yes, we have also Angry Birds coffee available now...







Links:
http://www.pauligcafe.fi/angrybirds/