Marcos Placona Blog

Programming, technology and the taming of the web.

Category: Apollo

Apollo is the former name for Adobe AIR

Tip of the day: Regular Expression Generator

Reading time: 1 – 2 minutes


I have just came across this very nice service which promises to write Regular Expressions for you.
We all know how painful writing a regular expression can be, and on this website, you can not only have the pattern created for you, but also have it translated into the most common languages on the web.
I’ve tried it myself, and can say it’s pretty darn good, although it’s automatic generator gives you a lot of “functional-crap” sometimes, it’s good for when you’re in a hurry and need to have a pattern up and running, or is not very confident with regexps.
Check it out here

Adobe AIR 1.5.1 released

Reading time: < 1 minute

I know I’m a bit late on this one, but yesterday Adobe released AIR 1.5.1 with a few bug fixes and one “minor-albeit useful-new feature.” as they say.

Check-out Adobe’s Blog

And download Adobe AIR 1.5.1 here

AS3 my own implementation of capFirst()

Reading time: < 1 minute

I’m just studying a little bit of Flex and Action Script 3. Basically to be able to build some tiny gadgets using Apollo.

While building one of them, I came up with the following function:

private function capFirst(txt:String):String{
    var str:String = txt;
    var aSTR:Array = str.split(” “);
    var i:int;
    var uString:String;
    var newStr:String = “”;
    var strSpace:String = “”;
    for (i = 0; i < aSTR.length; i++) {
           uString = aSTR[i].substr(0, 1).toUpperCase() + aSTR[i].substr(1);
           newStr = newStr + strSpace + uString
           strSpace = ” “;
    }
    return newStr
}

What it does, is take all the first letters of each word of the string given and return them in upper case.

Not sure if there’s any easier way of doing that, but for my first steps it’s just fine.

Yet another first Apollo app – Lyric Finder

Reading time: 3 – 4 minutes

I was going through the blogs and found that I was pretty late in releasing my first Apollo app.
So I decided to play around with Apollo and build something. It’s a Lyric Finder (I know… very stupid creative name).
It uses lyricwiki as source and some regular expressions to interpret the results.
I know there should be an easier way to do that using some sexy webservices, but as I’m still learning the stuff….

And it also helped me to realize that I’m still pretty bad in AS3.



        .*?
/"                 var returnStr:String = pattern.exec(str)                 if(returnStr != null){                 requestResult.htmlText = pattern.exec(str);             }             else{                 requestResult.htmlText = "No Matches Found";             }                          }             private function doSearch():void             {                 import mx.controls.Alert;                 var url:String = "http://lyricwiki.org/";                 var queryStrURL:String = prepareString(artistCriteria.text,songCriteria.text);                 var newURL:String = url + queryStrURL;                 trace(newURL);                 pageRequest.url=newURL;                 pageRequest.send()                 lbl_res.text="Results For:";                 lbl_details.text = capFirst(artistCriteria.text," ") + " - " + capFirst(songCriteria.text," ");             }             private function prepareString(artist:String,track:String):String             {                 var newArtist:String = capFirst(artist,"_");                 var newTrack:String = capFirst(track,"_");                 return newArtist + ":" + newTrack;             }             private function capFirst(txt:String,delimiter:String):String{                 var str:String = txt;                 var aSTR:Array = str.split(" ");                 var i:int;                 var uString:String;                 var newStr:String = "";                 var strSpace:String = "";                 for (i = 0; i < aSTR.length; i++) {                     uString = aSTR[i].substr(0, 1).toUpperCase() + aSTR[i].substr(1);                     newStr = newStr + strSpace + uString                     strSpace = delimiter;                 }                 return newStr             }         ]]>     

    
    
    
    
    
    
    
    
    

© 2014 Marcos Placona Blog

Theme by Anders NorenUp ↑