Path to Enlightenment

July 9, 2010

I’m a big fan of Chet Haase and his brilliant blog Codedependent. He makes very entertaining instructional videos about coding on the Flex 4 framework. I occasionally spend some time on his blog getting to know the new features in the Flex 4 framework. And time and time again he has managed to motivate me to get back to work and use my skills in a playful manner.

A while a go I watched this gripping and suspenseful video about creating a simple drawing application. The video talks about the new “Path” object in Flex 4. The Path object is an easy tool to save and manipulate line data. (This simple demo uses only simple straight line segments but this object could be used for bezier curves as well.)

Anyway I was fascinated by the small amount of code needed for this application. I downloaded the code and played with it. Here’s my interpretation of the Path to Enlightenment. It’s in the spirit of “less is more”. Draw some lines and wait a few seconds to see what I mean. Your lines will be enlighted and stripped down to their bare essentials. 🙂

The demo (press your left mouse button and draw by moving your mouse)
The source



Quick Response Code Platipus, originally uploaded by Platipus – Software Inside.

(What’s a Quick Response Code?)

Last night I ran into the crazy problem that a mysql result set contained rows (confirmed with mysql_num_rows) but I wasn’t able to fetch the rows in mysql_fetch_array while loop construction. I managed to create a workaround but I posted a note on the php.net mysql_fetch_array page asking for an explanation. The note got rejected so I figured I could use my own blog in the search for an answer.

Here is the note;

I hope someone can help me with this question.

I have 2 code snippets. The first works, the second doesn’t. I would prefer using the second code snippet because it seems cleaner. What’s wrong with the second code snippet?

This works;

$results = mysql_query("SELECT DISTINCT(col) FROM table WHERE col!='' ORDER BY RAND()");
for( $i = 0; $i < mysql_num_rows( $results ); $i++ )
{
// do something with mysql_result($results,$i,0);
}

This doesn’t work;

$results = mysql_query("SELECT DISTINCT(col) FROM table WHERE col!='' ORDER BY RAND()");

 while($result = mysql_fetch_array($results))
 {
 //do something with $result
 }

I’m writing a web application that allows it’s users (among other things) to upload their company logos. PHP script is used to take the user provided jpgs/pngs and present them uniformly in a webpage. I ran into the problem that rescaled png images had their transparent regions turned black.

Here’s the solution I found;

Voila.

Although the last step effectively overwrites all the pixels in your image, step 2 and 3 seem to be absolutely necessary to allow transparency inside your png image.

One more word of advice; use imagecopyresampled instead of imagecopyresized.

Resampled

Resampled "Dutch Design Award"

Resampled "Dutch Design Award"

Resized

Resized "Dutch Design Award"

Resized "Dutch Design Award"




Make Up Your Mind!

Originally uploaded by Theo Lagendijk

This commercial is about ….
A) a laptop with “Windows 7 Home Premium”
B) a laptop with “Windows Vista Home Premium”

I just had a weird unexpected exception thrown by the Flex 3.4 compiler on an existing ActionScript 3.0 project that always compiled without a problem.

exception during transcoding:
Unexpected exception encountered while reading font file 'F.ttf'
unable to build font 'F'
Unable to transcode assets/F.ttf

Luckily I found solution via Google.  Thanks Crazy Flexer “pixelfreak” adding -managers flash.fonts.AFEFontManager as an additional compiler argument fixed the build process.

Hope this blog post helps people that encounter the same issue.

Today I tried using my T-Mobile Netherlands Web N Walk USB stick with Kubuntu 8.10. I had been dreading this moment, since installing T-Mobile’s web n walk manager for Windows has been a terrible experience for me. After a firmware update T-Mobile’s drivers became completely uninstallable. (A nightmare of several weeks with little to none support from T-Mobile Netherlands.) I figured, that since T-Mobile was offering driver downloads for Windows operating systems but not for Linux I was in for deep trouble. But this time I was pleasantly surprised. There are very well written tutorials on the Internet that explain how to use your web n walk stick with Linux within minutes.

I compiled the driver for my kernel with the instructions on this page: http://www.pharscape.org/hso.html

And then run the HSOconnect connection manager to connect to T-Mobile’s HSDPA network. It works!

HSOconnect connection manager for Linux

HSOconnect connection manager for Linux

I’ve been using the connection for several hours now with proper down- and upload speeds.

I guess the big difference between my Windows vs Linux experience is that Option NV (the chip-maker for T-Mobile’s web n walk stick) does not offer windows driver downloads directly (they forward you to T-Mobile), but Option does seem to work together with the Linux community to build good Linux drivers. I’m very happy with the Linux drivers and I recommend Option and T-Mobile to use a similar construction for the Windows support!