blog
2010 June Archive at Jozef Chúťka's blog
June 30, 2010
Quick Tip: Chrome & Flash Debug Player
Having issues with installing latest debug player into Chrome? Go to about:plugins, deactivate the bundled Shockwave Flash (path ends with … Chrome\Application\5.0.375.86\gcswf32.dll) and install the desired flash player version.
I did not know why did my Flash Builder suddenly stopped communicating with flash debugger yesterday (June 30, 2010), today I have discovered latest news from Google Chrome.
June 29, 2010
Quick Tip: uint To 6 Digit RGB Hex
Shortest possible, simple / no looping method of getting hex string from color is:
var color:uint = 0x00ff00;
var hex:String = color.toString(16);
trace("00000".substr(0, 6 - hex.length) + hex);
// output 00ff00
trace("#00000".substr(0, 7 - hex.length) + hex);
// output #00ff00June 29, 2010
Licensing All My Software

I have decided to license the majority of my software under MIT License (X11). I hope this license makes all the permissions clear, and gives you enough space to use my code in your projects. I will do my best to add the license text to all the libraries and software stuff as soon as possible. So If you do not find license in particular file or article, please do like it contains this one. It is also possible that some software will be released under different license, in that case the particular software will contain license text in it. Thank you.
June 28, 2010
anaglyphs cyan depth map matrixes pixel bender red
Anaglyphs With Pixel Bender & Depth Map

Pixel Bender and displacement maps were so much fun to develop that my next experiment led me to create some more advanced effects. Do you know anaglyphs? Anaglyph images are used to provide a stereoscopic 3D effect, when viewed with 2 color glasses. There are multiple types of glasses (colors), but the most comon is red-cyan combination. So, I have created this simple pixel bender kernel that makes anaglyph images based on original image and its depth map (just like those used in displacement maps)
June 24, 2010
flash builder Flex Builder upgrade
Switching Flex Builder To Flash Builder Issues

Finally I managed to switch from Flex Builder 3 to Flash Builder. Altought, most of the workspaces, projects and casual things were running after switch just fine, there were some issues that made me mad. Some of them I was able to fix, some keep fuss me. I decided to write this post so it may help someone with dealing the same issues…
June 22, 2010
callback Callbacks Facebook facebook api FacebookOAuthGraph
Extending FacebookOAuthGraph Class

While The Facebook Graph API article becomes pretty popular and a lot of developers keep asking me to publish some practices I use, I managed to create this blog post. Here is a list o some functions you may want to extend FacebookOAuthGraph Class with.
June 18, 2010
CALL MySQL mysqli PREPARED PROCEDURE sequence SQL
Numeric Sequence In SQL
Few years ago I came accross an issue, when I needed to find smallest continuous integer in a sequence. My data were like 1, 2, 3, 100, 101, 102, 520, 521, 530 and the task to find lets say next continuous bigger than 100. Long story short, fastest and the final SQL was:
SELECT t1.num+1 FROM table AS t1
WHERE NOT EXISTS
(SELECT t2.num FROM table AS t2 WHERE t1.num+1 = t2.num)
AND t1.num>=100
GROUP BY t1.num ORDER BY t1.num LIMIT 1Today, the issue was a little more difficult. I have to find smallest continuous 2D sequence in any direction.
June 17, 2010
Quick tip: Fastest ActionScript PNGEncoder (update)
Here are some benchmark tests for current available PNGEncoders. Sync encoding tested on 2 real bitmap images (500x300px, 256x256px) on Intel Core 2 Duo @ 2.80GHz, win XP:
encoder / image 500x333 px 256x256 px
by.blooddy.crypto.image.PNG24Encoder 78ms 125ms
dsk.PNGEncoder 140ms 141ms
net.kaourantin.PNGEnc 188ms 187ms
mx.graphics.codec.PNGEncoder 203ms 172ms
com.adobe.images.PNGEncoder 219ms 172ms
org.aswing.image.png.AsPngEncoder 234ms 172ms
ru.inspirit.encoders.png.PNGEncoder 391ms 203msby.blooddy.crypto.image.PNG24Encoder worked fastest for me.
Update Nov 15, 2011: There is a new worth to try async and superfast encoder from Cameron written in HaXe called PNGEncoder2.
Check out some more benchmarks from Blooddy and Cameron.
June 17, 2010
Quick tip: Ports Required For RTMFP
In order to be able to use P2P communication within flash apps, you need to have opened UDP ports in range 1024..65535. First, to connect stratus server, you need UDP ports 1935 and 10000..10100, then the communication between peers (Flash Players and AIR) goes through random UDP port in range 1024..65535. In detail:
UDP port 1935 and ports 10000+ are used by the Stratus servers. the UDP ports used on client computers could be any port from 1024..65535. in order to just connect to the Stratus servers, you must be able to send and receive UDP packets with any UDP port on your client computer (source port for outgoing, destination port for incoming) and port 1935 and ports 10000+ on the Stratus server computers (destination port for outgoing, source port for incoming). *just* connecting to Stratus isn’t useful, though, since all it can do is help you to connect directly to other clients running Flash Player or AIR. other client computers, just like your client computer, will be using a random UDP port in the range 1024..65535. therefore, in order to communicate P2P with other client computers using RTMFP, you must do one of the two following things: 1) allow all UDP with a source or destination port from 1024..65535. 2) have a “stateful firewall” that allows bidirectional UDP connections to and from any UDP ports in the range 1024 through 65535 inclusive as long as a first packet is sent outbound through the firewall. this is commonly called “allowing outbound UDP”. sending the first packet outbound through your firewall to allow return packets is commonly called “UDP hole punching”. searching on these terms should give you more information. in general, a firewall that blocks UDP will block RTMFP communication.
Read more about PORT NUMBER of RTMFP.
June 11, 2010
buffer Callbacks event execute store
Callbacks Class To Store Your Wishes In Time

Things are much easier when they works synchronously, you just ask for what you want and thats it, but with flash you always have to count on with asynchrony. For example you are waiting on some requests to complete or 3rd party to log you on etc. The issue is, you know you want to execute something, with custom properties, but you have to do that just after some asynchronous event dispatched. E.g. you want to update status with some message, but you need to connect to facebook first. Here comes the handy Callbacks class. What it does is, it stores your wishes and executes when things are prepared.