On the 3rd of May 2010, I ran the Belfast City Marathon. It was hard work, but I got there in the end and even had enough energy left-over for a little heel click.
@Tweetrise: Exploring the Twitter API and the Sunrise
Back in April I thought I would spend some time re-familiarising myself with Twitter and the Twitter API. The project I decided to wrap this investigation in was Tweetrise, a twitter account that daily tweets the time of the sunrise and sunset for the following day.
Working with the Twitter API was as easy as I remembered it, and getting it to run on a Cron Job on MediaTemple was also very straightforward. The difficulty, for me, was calculating the sunrise and sunset times.
I wanted times that were accurate and went to seconds, so that I could compare the difference of sunlight between days. Using the formulas provided by Moonstick Co. I created the PHP functions which would allow me to get accurate results through interpolation. In regards to these calculations, apart from it being an interesting learning experience, it was a waste of time… PHP 5 date_sunrise :-P
FOTB09 – Elevator Pitch
Calling for ‘Flash on the Beach’ speakers… http://www.flashonthebeach.com/participate/
Last year I had the opportunity to speak at ‘Flash on the Beach’. It was a great experience and I would encourage anyone to give it a go for 2010 (26th-29th of April)!
FOTB09 – Elevator Pitch – Trevor Boyle from John Davey on Vimeo.
Rickshaw Run – Winter 2010 – Rickshawshank Redemption
In January this year Amy, Keith and I travelled over 3000km’s from Pokhara, Nepal to Cochin, India in an Auto-Rickshaw, in 14 days, as part of The League of Adventurists Winter 2010 Rickshaw Run.
Here is a short video of our time on the road…
Dynamically changing the palette of an image using Flash (AS3)
For the generative art framework ARTionscript I wanted to be able to dynamically change the colours of an image using actionscript. This can easily be done using Photoshop (or similar), but what about the latest uploaded Flickr image?
Having experimented with a few options, I settled on the following process:
- Load an external image
- Convert the BitmapData of the image to grey scale
- Perform a histogram equalisation on the BitmapData
- Posterize / limit the BitmapData to the number of colours in the new palette
- Swap the remaining colours in the BitmapData with the colours in the new palette
- Create some effect using the new BitmapData


And here is the code which takes advantage of the BitmapData.histogram, BitmapData.paletteMap & ColorMatrixFilter :
package com.artionscript.assistants
{
import com.artionscript.palettes.Palette;
import flash.display.BitmapData;
import flash.filters.ColorMatrixFilter;
import flash.geom.Matrix;
import flash.geom.Point;
import flash.geom.Rectangle;
/**
* ...
* @author Trevor Boyle
*/
public class ImageAssistant
{
public static function convertBDToGreyScale(sourceBD:BitmapData):BitmapData {
//BT.709-5 luminance constants
var tempBD:BitmapData = sourceBD.clone();
var greyScaleCMF:ColorMatrixFilter = new ColorMatrixFilter();
greyScaleCMF.matrix = new Array(
0.2125, 0.7154, 0.0721, 0, 0,
0.2125, 0.7154, 0.0721, 0, 0,
0.2125, 0.7154, 0.0721, 0, 0,
0, 0, 0, 1, 0);
tempBD.applyFilter(tempBD, new Rectangle(0, 0, tempBD.width, tempBD.height), new Point(0, 0), greyScaleCMF);
return tempBD;
}
public static function equaliseGreyScaleBDHistogram(sourceBD:BitmapData):BitmapData {
//concept by http://www.generation5.org/content/2004/histogramEqualization.asp
var tempBD:BitmapData = sourceBD.clone();
var v:Vector.<vector .<Number>> = tempBD.histogram();
var adjustmentMultiplier:Number = 255 / (tempBD.width * tempBD.height);
var tempAdjustedFreq:int;
var cumulativeFreq:Number = 0;
var adjustedRedFreqArr:Array = new Array();
var adjustedGreenFreqArr:Array = new Array();
var adjustedBlueFreqArr:Array = new Array();
for (var i:int=0; i < 256; i++) {
cumulativeFreq += v[0][i];
tempAdjustedFreq = cumulativeFreq * adjustmentMultiplier;
adjustedRedFreqArr[i] = tempAdjustedFreq << 16
adjustedGreenFreqArr[i] = tempAdjustedFreq << 8
adjustedBlueFreqArr[i] = tempAdjustedFreq
}
tempBD.paletteMap(tempBD, new Rectangle(0, 0, tempBD.width, tempBD.height), new Point(0, 0),
adjustedRedFreqArr, adjustedGreenFreqArr, adjustedBlueFreqArr, null);
return tempBD;
}
Continue reading </vector>
Flash on the Beach ’09
I had a great time at ‘Flash on the beach’ this year and, like everyone else who attended, I have been inspired again to create.
This year was also more special, than the previous years that I have attended, because I was fortunate enough to be able to speak on the main stage for 3 minutes as part of the ‘Elevator Pitch’ session, along with 20 other people.
I also promised during my speech to release the source code for my ’3D Pixelated Video’ project. So, here it is in all its uncommented, unoptimised glory. I have also included a glitchy perlin noise version, which I put together over the past hour, to get you thinking of what you could do with it. Other suggestions include converting it to Papervison and creating some installation art.
NotWhileIAmEating.com
For the past few weeks I have been working on a little ‘Web 2.0′ hobby blog. I think that it’s now time to release it to the masses :-)
It’s basically an image and video blog about all sorts of yucky food.
A new post is added daily.
The idea sprang from a 16 month old sandwich that had been hidden under a desk where I was working.
Please rate, comment, dig, blog, share, contribute and suggest :-)
ActionScript 3.0 Client Library for Facebook Platform API – Flash Sample Code
The new ActionScript 3.0 Client Library for Facebook Platform API, fully supported by Facebook and Adobe, makes it easy to build applications that combine the strengths of the Flash Platform and Facebook Platform.
I had a few problems trying to find some sample AS3 code, using the new ‘ActionScript 3.0 Client Library for Facebook Platform API‘ which is supported both by Adobeand by Facebook, which wasn’t focused on Flex. So I took Adobe’s ‘BROWSE THUMBNAILS OF FACEBOOK PHOTOS‘ example and converted it into something you can use for Flash.
- Watch this video http://www.adobe.com/devnet/facebook/articles/video_facebook_quick_start.html
- Download the ActionScript 3.0 Client Library for Facebook vX.X – Source from http://code.google.com/p/facebook-actionscript-api/downloads/list
- Setup your facebook application as per the video instructions, making sure you select ‘Desktop’ as your ‘Application Type’ in the advanced tab
- Create a new Flash AS3 file
- Open the components panel (Window>Components) and drag to your library the ‘Button’, ‘List’, ‘TileList’ and ‘UILoader’ components
- Create a new ‘Document class’, named FacebookImageBrowser.as, and assign it to your newly created Flash file
- Add the following code to your document class and include your own ‘API_KEY’ and ‘SECRET_KEY’, which is listed on your Facebook application’s settings page
- Publish your movie and step through the buttons as you get feedback
package {
import flash.display.Sprite;
import flash.text.TextField;
import fl.controls.Button;
import flash.events.Event;
import flash.events.MouseEvent;
import fl.events.ListEvent;
import fl.controls.List;
import fl.controls.TileList;
import fl.controls.ScrollBarDirection;
import fl.data.DataProvider;
import fl.containers.UILoader;
import com.facebook.data.photos.AlbumData;
import com.facebook.data.photos.PhotoData;
import com.facebook.Facebook;
import com.facebook.events.FacebookEvent;
import com.facebook.net.FacebookCall;
import com.facebook.data.photos.GetAlbumsData;
import com.facebook.data.photos.GetPhotosData;
import com.facebook.commands.photos.GetAlbums;
import com.facebook.commands.photos.GetPhotos;
import com.facebook.utils.FacebookSessionUtil;
/**
* ...
* @Flex Developer: Steven Shongrunden
* @Flash Conversion: Trevor Boyle
*/
Continue reading
Through the Twittersphere
http://blog.trevorboyle.com/wp-content/uploads/twittersphere/Twittersphere-Visualizer.html
Having had a few days off from work over the Easter break, I decided to… work.
Using the AS3 twitterscript library (http://code.google.com/p/twitterscript/) and a php proxy script by Woven Interactive (http://woveninteractive.net/?p=45) I have created a simple flash visualisation of Twitter’s Twittersphere.
The flash application periodically requests the latest tweets from Twitter and then animates them in the sky.
I plan to add some search functionality to it at a later date, but it’s now time to go buy some cheap Easter eggs and drink some beer.
Twitter and Flash (twitterscript)
For those of you trying to create a twitter vs flash mash-up, hopefully this will help.
- Download an svn client, such as TortoiseSVN (http://tortoisesvn.net/downloads)
- Using your client, download the latest .as (AS3) files from http://twitterscript.googlecode.com/svn/trunk
- Create a new Flash AS3 file
- Create a new ‘Document class’, named TwitterUserFeed.as, and assign it to your newly created Flash file
- Add the following code to your document class (updating your package name and TWITTER_USER accordingly)
- Publish the movie and watch the ‘output’ panel
- View the Twitter.as file to help you extend this example
package com.trevorboyle.twitter
{
import flash.display.Sprite;
import twitter.api.data.TwitterStatus;
import twitter.api.Twitter;
import twitter.api.TwitterSearch;
import twitter.api.events.TwitterEvent;
/**
* ...
* @author Trevor Boyle
*/
public class TwitterUserFeed extends Sprite
{
private static const TWITTER_USER:String = "stephenfry";
private var _twitter:Twitter;
private var _twitterSearch:TwitterSearch;
public function TwitterUserFeed()
{
_twitter = new Twitter();
_twitterSearch = new TwitterSearch();
_twitter.loadUserTimeline(TWITTER_USER)
_twitter.addEventListener(TwitterEvent.ON_USER_TIMELINE_RESULT, userTimelineResult)
}
private function userTimelineResult(e:TwitterEvent):void {
var twitterStatus:TwitterStatus;
for (var i in e.data) {
twitterStatus = e.data[i]
trace(twitterStatus.text)
}
}
}
}


