Thursday, October 22, 2009

Error #1009 and counting

Back to Flash.

This year I've mostly been hard at work baking cakes one after another. Man I love it!

But yesterday I had to stop and think. You see, I needed a video player. And somehow from all the hmmm, probably 10-15 player I've built, big and small, MVC or timeline scripted, there was not one that I could put my hands on and say to myself "This will do!". That's what u get when u do custom jobs. Maybe I should get into building and selling a customizable flash video player. Wait, what the hell am I thinking!?

So well, I was in need of a good video player. AS3 based. There's no way I'd go and code myself another AS2 player. It's 2009 for God's sake!

Well the truth is I did make a fully customisable AS3 video player that suports all sorts of parameters passed from HTML. but that one used a standard FlvPlayback skin. And it was all good but for the project I'm working on a standard skin was a no-no. I used it for the video moderation in the admin just fine. But does Youtube have a standard skinned flash video player on the front? Does Google? NO!

Hmm, "I need to code meself an AS3 video player" said I to me. Flash IDE is great for drawing but sucks at AS code. Nothing new there. I need an AS3 tool that works with my everyday Eclipse. There was none last time I checked. That's a good while ago though. Easy Eclipse still doesn't have a LAMP version using the latest Eclipse. May be Easy but it's old. I'm still young but time flyes and I can't wait. I'll have to do it the hard way. Got Eclipse Galileo for PHP developers. That's us I thought. I smiled.

Galileo is polished. Cocoa version is snappy. I pointed it to my old workbench and all was there. Slapped Aptana and Subclipse in there and there was nothing more to add. Well except for the AS3 support. Ok I said, ASDT will have to do. I'll pair it with the funky BigSource Zarkov and tame that Flex 3 SDK into submission. Hmmm, "You can find the development site at http://axdt.org". Silly typo... Wait! "enable you to write ActionScript3 code in an integrated environment". Thats me! Had to install IMP for Eclipse too. "meta-tooling for Eclipse". Hmm that sounds metalicious.

Well syntax highlighting didn't work from the start. It did after I installed Colorer take5. But using the IMP editor. Weird. Well...

AXDT rocks! Keeps opening the compiled swf even if I said not to but hey, why not?

Export swc from Flash to the axdt project's lib folder, run from Eclipse, deploy to web server with ANT, debug with Demonsterdebugger.

"TypeError: Error #1009: Cannot access a property or method of a null object reference."

Hmm, good thing I didn't get the other 1008 errors, right?

ADDED_TO_STAGE to follow...

Friday, October 09, 2009

So what's planned for 10.9 I ask?

Well not much...

Except that Flash Profesional CS5 will enable you to build applications for iPhone and iPod touch using ActionScript 3 !!!

These applications can be delivered to iPhone and iPod touch users through the Apple App Store.

A public beta of Flash Professional CS5 with prerelease support for building applications for iPhone is planned for later this year.

Excellent fix for the Open Screen vs Apple problem from Adobe!

Vali can't wait to see that iPhone tab in the Flash Publish Settings and hit that Export to App Store button :)

Wednesday, October 07, 2009

CakeBaker HasMany Client Trough Project

Hopefully the above always returns true on save ;)

This looks like old - like wine though - Cake HABTM stuff talking about Cake vs Rails and HABTM relationships. Quite interesting read.

Here you can read an article and comments (best articles are those with comments even more interesting than the article itself, trust me;) about Cake vs Rails.

Second is an old debuggable.com (yeah, I'm  fan and hopefully I'll catch the next CakeFest in Germany) talking about faking Rail's HasManyTrough in Cake.

And to add something meaningful from my own bag I must tell you that if you're looking at Cake's HABTM and you're wondering how it'll fit your slightly more complex HABTM table you're better off not using HABTM at all but making the HABTM table into a Model. It'll definitely give you more control in the end!

Monday, October 05, 2009

Flash 10.1 is here. So what's planned for 10.9?

Adobe announced the Flash Player 10.1 on Labs:

"Flash Player 10.1 is the first runtime release of the Open Screen Project that enables uncompromised Web browsing of expressive applications, content and video across devices."

I must say they really crammed a lot into that 0.1, but now it really looks mobile ready...

I wonder what the checklist up to 10.9 looks like ;)

Sunday, September 20, 2009

CakePHP slugs from MySQL unicode data

[Update] Well it seems that Cake is a bit stale on the utf-8 part. Not everyone can mod the mysql config especially on a production setup and this is actually not needed. Looks like PHPMyAdmin does good when the proper collation and server encodings are set. But it's Cake that needs an explicit 'encoding' => 'utf8' in the config/database.php file. Well I gues that the below info is still ok for when ur doing an initial setup with no legacy projects running and you're set on using utf-8 for all your future work. And why wouldn't you?

Until today I thought that PHPMyAdmin is the only one responsible for messing my romanian chars at edit. Mainly because editing from my PHP apps worked like a charm. But I just tried some Eclipse DB plugins and neither those nor my MySQLWorkbench weren't able to properly store utf-8 strings in the database. So I blamed the connection itself. Apparently this was the case because from all my tools Cake was the only one who explicitly told MySQL that they can chat only in utf-8. So I got radical on my XAMPP install and added this to my.cnf:




init_connect='SET collation_connection = utf8_general_ci'
init_connect='SET NAMES utf8'
default-character-set=utf8
character-set-server=utf8
collation-server=utf8_general_ci
skip-character-set-client-handshake


The proper mix is not mine. It was posted on Saiweb.co.uk a while ago. So far all the MySQL clients seem to be happy. In case some become unhappy I'll remember to update this post.

And since we're at it I may as well tell you the full story. The app I'm working on is in romanian and the slugs Cake Inflector was giving were well, horrible. The romanian chars were not included in the replacement map and it seems that only Cake 1.3 will officially support a map of custom chars as a parameter. So since I was already using a self made TreeNavi helper (who doesn't? :) I added this to it:




function rumSlug ( $str ) {
// șȘîÎăĂâÂțȚ
$map = array(
'/ă|â/' => 'a',
'/Ă|Â/' => 'A',
'/î/' => 'i',
'/Î/' => 'I',
'/ș/' => 's',
'/Ș/' => 'S',
'/ț/' => 't',
'/Ț/' => 'T'
);
return preg_replace(array_keys($map), array_values($map), $str);
}


and used it like this:


Inflector::slug($treeNavi->rumSlug($category['Category']['name']))


Works just fine!