Marcos Placona Blog

Programming, technology and the taming of the web.

Month: March 2007 (page 1 of 2)

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.

<mx:ApolloApplication xmlns:mx="" layout="absolute">
            private function getResults(event:ResultEvent):void
                var str:String = event.result.toString();
                var pattern:RegExp = "/<div id="lyric">.*?</div>/"
                var returnStr:String = pattern.exec(str)
                if(returnStr != null){
                requestResult.htmlText = pattern.exec(str);
                requestResult.htmlText = "No Matches Found";
            private function doSearch():void
                import mx.controls.Alert;
                var url:String = "";
                var queryStrURL:String = prepareString(artistCriteria.text,songCriteria.text);
                var newURL:String = url + queryStrURL;
                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
<mx:HTTPService url="" id="pageRequest" method="GET" resultFormat="text" result="getResults(event)"/>
        text="Type the artist name"
        text="Type the song name"
    <mx:Button label="Search" id="loadWeb" bottom="10" click="doSearch()" right="10"/>

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.

I’m Iron Man

Reading time: 1 – 2 minutes

After testing myself to know which Super Hero personality I have, I got this:

Your results:
You are Iron Man

Iron Man
Green Lantern
The Flash
Wonder Woman
Inventor. Businessman. Genius.

Click here to take the Superhero Personality Test

Hope you’re not catwoman! Show me your results…

Ray has done it again! ColdFire RC1 released.

Reading time: < 1 minute

As usual Raymond Camden is always trying to make our lives easier with his free tools.

Now it’s time for a ColdFusion version of Firebug. For those who don’t know, Firebug is a very handy FireFox extension for debugging Ajax and DOM. And this one will be used for ColdFusion.

Check it out

Thanks Ray!!!

UPDATE: I forgot to mention Adam Podolnick on the original post. He worked on the Firefox side. Thanks Adam

UKCFUG calling for some drinks!

Reading time: < 1 minute

We’re gonna have some drinks together tonight. If you wanna join us for a whole bunch few drinks, just pop in.


Older posts