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!

I hope that this post gets found by people encountering the same problem that I did. So I’m deliberately using the keywords that I searched on. In this post I describe how I solved the problem of installing a T-Mobile software update (which turned out to be in a conflict with Kaspersky’s Internet Security software) and how I fixed the terrible slow upload performance after that.

For a few weeks now I have been bothered by a very annoying problem. T-Mobile Netherlands offered a free firmware update and driver update for their web’n'walk stick. (Contained in a zip found here: web n walk manager upgrade) I was delighted because the description of the update appeared very promising and I was getting tired of the bad performance of the mobile broadband connection under Windows Vista (performance is way better on my girlfriends Windows XP laptop). The zip contained (along with some pdf documentation) a self extracting executable named Superfire.exe. By following the on screen instructions I succesfully upgraded the web n walk USB sticks firmware but after a reboot trying to update the software drivers failed with this error;

“An incompatible standalone version of the speedmanager plus/ByteMobile Client is present on the system. This version must be uninstalled and OS restarted!”

Strange. I never explicitly installed a speedmanager or ByteMobile Client. If it was part of previous T-Mobile software I would have expected it to be easily uninstalled or updated. I started in Windows Vista’s Control Panel’s “Programs and Features” to uninstall everything possible related to mobile internet. With no success.

Inspired by Jürgen Pabel’s succes story I went to regedit to remove every registry key possible related to a ByteMobile client or Speedmanager.  (Indeed I found some keys, I removed every key containing ”ByteMobile”, “Novatel”, “Option NV”, “GlobeTrotter”  or “T-Mobile”.) No success.

At this point I was getting really annoyed. I started looking for a download of the old firmware or drivers. I found a working driver on t-mobile.at (austria) that at least made be able to use the web n walk stick again. Terrible network performance but good enough for web browsing. 

Still wishing to solve this problem, I looked for ways to get more information about the microsoft installer failure. I found a way to get verbose logging from the microsoft installer. 

I used: 

msiexec /i webnwalkManager_en.msi /l*v c:\wnw.log

And this produced a 510 lines logfile. With this curious lines 277 and 278.

MSI (c) (04:1C) [12:05:38:939]: PROPERTY CHANGE: Modifying MINSTALLCHECKMSIRETURN.102FE328_B77C_41FB_847C_166244959AAB property. Its current value is ‘0′. Its new value: ‘BM_ERROR_CONFLICT_SOFTWARE’.

MSI (c) (04:1C) [12:05:38:939]: PROPERTY CHANGE: Modifying BMCONFLICTSOFTWARENAME.102FE328_B77C_41FB_847C_166244959AAB property. Its current value is ‘0′. Its new value: ‘Kaspersky Internet Security 6.0′.

It appears that Kaspersky Internet Security is the ByteMobile Client issue that the installer error speaks of. Weird, since I never explicitly installed that but this must be a part of my Kaspersky Antivirus. And indeed uninstalling Kaspersky allowed me to install the new web n walk software! (And reinstalling Kaspersky Antivirus made both work at the same time as well…)
New Web N Walk Manager interface

New Web N Walk Manager interface

It was quiet dissappointing to discover that network performance (in particular uploading) was still terrible. Large file uploads (like uploading 5MB photos to Flickr) where even completly impossible, for a few seconds I would have 300-400kbps but then upload speed would drop to somewhere near 0 bps. :(
Looking for solutions to this problem I found the following possible cause. The T-Mobile driver documentation hints about a possible problem with Vista’s TCP window size autotuning algorithm. (In other versions of Microsoft’s OS it possible to explicitly configure a tcpwindowsize parameter in the registry. Vista ignores that parameter because it uses it’s own auto tuning algorithm that attempts to find the best tcp window size for you. But apparantly it fails to do so.) I found this post that explains how you can modify the default behavior of the tuning algorithm. I used;
netsh interface tcp set global autotuninglevel=highlyrestricted
(In this article on speedguide.net you info find more tcp settings that can increase your network speeds. But I believe these settings bring only marginal results.)
For a short time it looked like the highlyrestricted autotuninglevel improved matters. But I guess that was only wishfull thinking. What made the big difference for me was disabling “Internet Protocol  Version 6 (TCP/IPv6)” and “Kaspersky Anti-Virus NDIS 6 Filter” in the connections properties.
Web n Walk mobile broadband connection properties

Web n Walk mobile broadband connection properties

I’m happily continuing uploading to my Flickr stream

IMG_4175

Win!!!

October 15, 2008

w00t!!! We have won a Silver W3 Award for Studio Roosegaarde

w00t!!

We (me, Sylvia and Daan) have won an Silver W3 Award for Studio Roosegaarde!

In our humble opinions this is a well deserved result of our fanatic affords (in good and bad times) to build the best we could. And we’re determined to make it a gold one next time.

Daphne Farquharson

September 6, 2008

Today we were notified of a terribly sad thing. 

Our friend Daphne Farquharson was found dead in her parent’s house in Badhoevedorp.

Words can’t express what a loss this is. 

Me and Daphne in the skilift

Daphne, you will be missed and remembered.

Thanks for the fun times, the wonderful diners, the good book recommendations and the introduction to poker that we had with you! :)

We will not forget the fun we had!

Your buddies,

Sylvia and Theo.

I’ve updated FlickrPickrTickr (requires Flickr account).

  • You can now view your friends pictures too!

    FlickrPickrTickr now supports watching your friend's/family's non-public photos.

  • You can now drag the photos around.

    FlickrPickrTickr now supports dragging photos around.

What I would like to add in the near future:

  • More controls for controlling speed and density
  • Fullscreen!

Hope you like it!

JoyRider 1.2

June 2, 2008

I released a new version of JoyRider.

Screenshot of JoyRider 1.2 gameplay

This time with sound (soundtrack and soundeffects), levels, and upgrades. Let me know what you think of it!