PaperKingdoms

September 9, 2009

Bit.ly in AS3

Filed under: actionscript, code, flash, internet, web development — bardicknowledge @ 8:42 am

I know this is pretty damn simple, but in case you’re in a hurry here’s a quick example of using bit.ly in as3 i whipped up. This is really just the basics. I will likely expand on it, but you can get the gist.

  1. Download as3corelib : http://code.google.com/p/as3corelib/
  2. Sign up with bit.ly : http://bit.ly/account/register?rd=/
  3. That’s pretty much it….


import com.adobe.serialization.json.JSON

var login:String = "put your bit.ly login here";
var api:String = "put your bit.ly api key here. It's on your account details page";
var url:String = escape("the url you want to shorten");
var bitly:String = "http://api.bit.ly/shorten?version=2.0.1&longUrl="+url+"&login="+login+"&apiKey=" + api;

var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, completeHandler);
loader.load(new URLRequest(bitly));

function completeHandler(ev:Event):void
{
var bitlyObj:Object = JSON.decode(ev.target.data);
var o:Object = bitlyObj.results[url];
if(bitlyObj.statusCode == "OK")
{
trace("Success! Short URL is : " + bitlyObj.results[url].shortUrl);
}
}

That’s pretty much it. I didn’t write my error handling yet, but it’s pretty simple. Just trace out ev.target.data to see the JSON structure in case you need more details ^^

Hope it helps

*Updated to add the escape to the URL.

June 11, 2009

red5+wamp

Filed under: code, flash, internet, open source, tech, tutorial, web development — bardicknowledge @ 8:50 pm

Well this gave me a bit of a run around, but I have finally (I think) got it all sorted out : red5 running on windows through wamp. This isn’t really that big of a feat but it’s the first time I’ve done something like it and I’d like to explain step by step how to get it working since none of the guides I read held your hand through the whole set up.  So I will ^^

If you don’t know what Red5 is here’s a snippet from Wikipedia that explains the basic idea:

Red5 is considered as a free alternate to Adobe Flash Media Server, and supports many of the same feature sets. It has a few additional feature sets such as the ability to intercept live streams, and the ability to easily plug in other Java libraries such as Hibernate.

So, my first attempt was to use tomcat, but that didn’t work so so well, and since I have a wamp server already running I figured it would be best to use that. After some googling  I found other people that had already done this, on the  Red5 mailing list , here.

Pretty much I’m just gonna copy their nine steps and add my additional comments since their way works, it’s just a little vague though.

  1. Install wamp
  2. Create a directory named “red5-server” into C:\wamp\www
  3. Download and install TortoiseSVN
  4. right-click on C:\wamp\www\red5-server folder and click SVNCheckout
  5. enter  the url from which red5-server will be downloaded : http://red5.googlecode.com/svn/java/server/trunk
  6. download ant from the apache software foundation (manage dependencies for compilation)
  7. Extract ant to a folder where ever you want. Just remember it’s path since you will need to add it to your system variables later. I put it at : C:\apache-ant-1.7.1
  8. Download the JDK 6 and install
  9. Add ant and javac.exe to your system’s Path variable (right click on my computer – > Advanced – > Enviroment Variables – > Find variable Path in System Variables and edit. You need to add the path to the javac.exe which is in your JDK installation (default on xp for me : C:\Program Files\Java\jdk1.6.0_14\bin) and the bat files for ant (C:\apache-ant-1.7.1\bin) . Make sure that each variable is separated by a semi colon or it won’t work.)
  10. open a shell on C:\wamp\www\red5-server
  11. just type ant server – if ant is not found your system variables are set up wrong. If during building it says that it can’t find tools.jar where it expected the easiest solution is to find where the tools.jar file is on your pc and copy it to where the ant expects it. If at the end of the build it says it can’t find javac.exe, you either installed the wrong version of java or your system vars are set up wrong.
  12. You can install samples demo via the administration console http://localhost/RED5-server/webapps/installer/index.html

And there ya go -Red5 through your wamp installation.

August 22, 2007

Web app’s that need upgrades

Filed under: blog, culture, internet, musings, social networking — bardicknowledge @ 9:23 am

I have been slinking around the net and attempting to bring everything together with SMS, IM, email and feeds, but a few places have been more than annoying with their lack of certain features. So I am going to make a list of the web apps that I use that I think need some updates.Please note that I am aware that many of these features can be achieve with scripts or APIs, but I would like to see there features natively to get full functionality, such as SMS updates/reminders.    Twitter: GROUPS! Twitter needs built in groups. There is one that I know of using the API, but I would love to see that feature built in. I want to be able to tweet a group and send a txt to my entire apartment, or my pen and paper friends.Google Reader: Search. Wtf is the point of me starring objects if I can’t bloody well go back and search for them later. Google Reader: Organization of starred items. I want to go back and view these items by tag, or date. Not just a huge stream. Google Calendar : A to-do list! GIVE ME A BLOODY TODO list! And allow me to update the thing using the current way I add events. Just have it as a keyword. So: todo get food, kill neighbor, eat offspring.  That way it still works with twitter, which means I can use my cell to add items! Gtalk/Gmail – SMS to message gmail members.  So that I can send an email or message to friends that don’t have a cell or text messaging.   FaceBook – Wallposting/PMing through SMS. Something like: Frank John w Hey frank! Party in 2 hours. I’m downtown. Get your shit together. Gmail/Facebook – Option to send SMS to members/friends if they have already set up the SMS function within the site.Gtalk – SMS instead of IMing a person.  Again, just using simple text commands.Gtalk:Bardic, you there?SMS@Bardic Where the hell are you?   Well there is something to chew on. I may think of more things later, but I want all these updates. So Google/Twitter, pleassse please please please please add these. I have been bitching for a while and I can keep doing it. You two are the best at what you do and I want you to be the center of my social life lol. So please take the step.   

August 2, 2007

Winamp 5.33 vs iTunes 7.3

Filed under: blog, culture, internet, mac, music, musings, program, reviews, software, tech — bardicknowledge @ 4:33 pm

Well I have talked about this before, iTunes vs Winamp but I have recently jumped ship from musikCube and moved back to winamp. So I figured I would give both the newest versions a spin and did what I could to make both use a little memory with actually hacking any files.

All I want my music player to do is to play music. That it’s. i don’t give a shit about visuals or stores, or podcasts, or internet radio, or ipod support, or whatever. All it has to do is play music, cd’s and rip them if I for ever some reason have a cd.

So how did things turn out?

Well I installed the latest version of winamp and itunes.  Winamp 5.33 and iTunes 7.3

In Winamp I literally removed every plugin that isn’t needed to play my library or rip/burn cds.  In iTunes I turned off every feature but the library. I didn’t delete anything because the preferences didn’t give me the option like Winamp does.

I stat again I did not hack or did anything to change the configs other than use the options available to me through the preferences.

Anyways, Winamp’s memory usage sits between 6000k-20000k which is pretty good for a media player.

iTunes, after installing and turning of all the features used 44000k.  And when you add all the other crap processes it runs, updater, devices and I dunno what else, it was over 55000k mem usage.

Obviously I choose to keep my Winamp installation.

If you purely want to listen to music through a library, Winamp is your best bet. If you want only to listen to playlists, you may want to consider foobar, but!!! it just as much (and more if skinned) than Winamp.

You could also consider Evilplayer but I wouldn’t. No id3 tag support, no way in hell I’m using it.

So there ya go. Winamp wins hands down if you ONLY want to listen to music. If you want to buy songs (pff) then iTunes may be useful. Don’t even mention ipods. I have an ipod and I run the software from the ipod. I can run it on anyones Win installation. If ya have a mac you have iTunes so no worries there.

Oh, btw, I am obliviously talking about all Windows software here.

I am going to try to hack iTunes a little and see what I can do. I have nothing against mac. I use a mac at work and I rather enjoy it. But I am looking at things in a purely functionality/memory usage point of view. Take my word or not, makes no difference to me. Sorry if I sound kinda rude but I got slammed for my last review because Winamp won then too and that was without configuring and I just want to make sure people don’t bitch that I’m a fanboy or anything. I will switch music players if you can show me a better one.

July 31, 2007

mp3 player – ActionScript

Filed under: actionscript, code, design, flash, internet, music, open source, software, tech, web development, XML — bardicknowledge @ 8:07 am

Hey for anyone that reads this. It has been a little bit, but I have a new code snippet for ya’s. It’s a pretty simple mp3 player that you could easily embedded on a site.

Here’s there script (link). It uses a pretty simple XML also.

<song>
<t st=”songtitle” l=”url” a=”artist” />
</song>

Give it a whirl. I will be trying to remake it with a slider on the next version and make it smaller.

Older Posts »

Blog at WordPress.com.