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.

September 4, 2009

I can’t be the only one…

Filed under: culture, musings, philosophy, rants — bardicknowledge @ 2:02 pm

I’ve been doing a lot of thinking of lately and soon I will be living alone for the first time since my accident. I have avoided living alone the last four years due to frequent slumps of depression I slide into but I figured it was time for me to face this aspect of my life and either beat it or let it beat me. Either way is acceptable but the first option is likely the most pleasant.

I really can’t be the only person out there that has a hard time dealing with people. Others must be the same. Others must not want to talk to people, be it on the phone or in person. Other must also want to avoid conflict, even if it comes at a personal loss. Others. The thing I’m afraid off. I dunno what it is about people that make be want to stay at home, or that make me so angry. Why can’t they see? Maybe it’s just me that can’t see? But either way, I’m pissed about it. Is it really that difficult to be a consider person, to keep your word, to not only ever look out for number one?

This is my main problem with society. It’s one for one. It’s almost never all for one, or one for all. No one give’s a shit about anything but themselves. And this is why I avoid conflict. Because I don’t want to start arguing with people that are only looking out for themselves. Because no matter no sound your logic is, those fuckwads will bend it to fit their twisted sense that everything in the world revolves around them.

And it’s these thoughts of people constantly looking out for themselves that make me depressed. Or at least a large part of it. How can you trust someone that only looks out for themselves? How can you tell when they really care or just using you? (this is in no way directed at my girlfriend in case she ends up reading this… which is unlikely).

I dunno. I can’t be the only one. There has to be others out there that care for more than just themselves. But here is the kicker. I’m too afraid of dealing with people to find out.

Oh well. Fuck it. I’ll just live with my depression caused by my perception of society. At least I won’t bother anyone since I can’t stand dealing with them…

June 15, 2009

Deluge Torrent compared to uTorrent

Filed under: blog — bardicknowledge @ 3:36 pm

This is far from new, but I haven’t written a post about it   so I figured I would.

Lately, I have been using Deluge torrent on my windows xp box instead of uTorrent for pretty much just two reasons: It’s open source and I can squeeze just slightly faster speeds out of it.

So, let’s take a quick look :

Interface:

These one is pretty close, but I’ll have to give it to utorrent since it’s skinable, otherwise they are almost the same

Features:

These one again is pretty close. uTorrent has a few more advanced features but deluge can handle plugins (but none really exist…). Plus deluge has a bitchin’ feature to run the daemon on one pc and the interface on another. I haven’t tested this, but I’ve been meaning to. So I’m gonna call this one a draw with the future potential going to Deluge

Speed:

I get just slightly faster/consistent speeds with deluge. Not enough for an average user to switch but something for those that are looking for every ounce of speed to maybe check out.

Bugs

This one goes to Deluge. They are buggier than utorrent but I really only found this on windows since it’s a port.

Platforms

Deluge is available for all major OS’s. uTorrent on the other hand is just windows. It can be ran using Wine on linux though. But I’m gonna give this to Deluge.

Source

Deluge is open source which is the decided factor here for me. If I can, I will always choose open source.

So there’s a quick comparison. Maybe sometime I’ll do a more in depth one with a few more clients but don’t hold you’re breathe 😉

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.

June 9, 2009

Wow, it’s been a while…

Filed under: blog — bardicknowledge @ 3:52 pm

Well, its been about 2 years since I’ve last posted here and deiced to attempt just to run a PBBG development blog (Openbracket) but lately I’ve been feeling the urge to blog about things that don’t necessarily related to PBBG’s or game design so I’m gonna reboot this mofo… or at least try to.

I’m hoping to keep this going as it was in the past : focus on tech, software, code and random nerdy things/thoughts.  Will hopefully also be posting some as3 and php up here as well as software comparisons.

So if you liked my old shit, check back. I will try to be a little more active ^^

Older Posts »

Blog at WordPress.com.