Fix: XAAMP Apache can not start in XP

One day after rebooting my Windows XP my XAAMP Apache 2.0 was unable to start. Here is what the error log showed”

[Sun Sep 20 15:01:00 2009] [crit] (OS 2)The system cannot find the file specified.  : Parent: Unable to connect child stdout to NUL.
[Sun Sep 20 15:01:00 2009] [crit] (OS 2)The system cannot find the file specified.  : master_main: create child process failed. Exiting.
[Sun Sep 20 15:01:00 2009] [error] (OS 6)The handle is invalid.  : Parent: SetEvent for child process 0 failed

So while trying to find a solution for this problem, which in the beginning looked like a Apache related problem (I tried reinstalling XAAMP several times in different directories etc…) I found out that it actually was a Windows XP problem.  Somehow the NULL driver on my PC has stopped working.  So how to fix this problem:

  1. Open the Device Manager (right click My Computer -> Properties -> Hardware)
  2. From the View menu select Show Hidden Devices
  3. From the Non-Plug and Play Drivers group find the Null driver right click it and Uninstall it
  4. Restart your PC and start Apache from the XAAMP control center

I hope this helps!

PHP Listing pages optimization

Recently I was asked to develop a website that had a product page listing of over over 20.000 products. The SELECT query to get the products was optimized as much as it could be. But it was not enough! Due to the high volume of traffic this product listings have the server was always with load over 2 (Cent OS using top). I was forced to use a simple optimization that in the end came out to be quite effective.

To get the product listing there were 2 queries. If we simplify them they would look something like this:

SELECT COUNT(*) FROM products WHERE .....

SELECT something FROM products WHERE ..... LIMIT start, offset;

So even though the COUNT(*) in MySQL goes pretty fast it uses a lot of memory. This COUNT(*) was needed to find out how many products were there and display the number of pages.


So instead of having this 1,2,3,4… page numeration I got it down to prev/next


Here comes the trick. The first 1,2,3,4… navigation requires 2 SQL queries to be done. The second one requires ONLY ONE.

The trick is to select one more result than you are actually showing. Let’s say that you want to display 20 results per page, you select 21. If the 21st record exists than you have a “next page” if it doesn’t you don’t.

What about the “previous page” link?

The LIMIT start, offset in the SQL query will tell you if you have a “previous page” if this number is different from 0 (start !=0) or to be more specific

if(($start - $records_per_page) <= 0)

you have a previous page.

This technique is useful for high volume traffic sites where every hardware resource matters. It can not be applied on all listings due to design/functionality issues, but in some cases it could be a life saver.

Getting NuSOAP to work in PHP5

After a night of angry typing and googling to find a solution why my scripts that worked on PHP 4.2 and used NuSOAP now show the following error on PHP 5:

Fatal error: Cannot redeclare class soapclient in D:\www\nusoap.php on line 7240

The thing is that PHP5 has its own built in class soapclient and this is where the error comes from.

The solution to get NuSOAP working on PHP5 is quite simple. Open the nusoap.php file and replace soapclient with mysoapclient or whatever you think of. Use a mass find/replace if supported by your editor.

Flash Gallery update preview

Here is a development version to how will the new Flash Photo Gallery look and feel like. The navigation is changed and the viewing is improved.

Flash and XML Gallery NEW

There is a download link for the current image (will be configurable in the XML file) and some other improvements. Unfortunately this version is only for preview of what is really coming so expect the official release soon.

Take a look at the Flash Gallery Development Preview Demo!

Flash Gallery update coming soon…

Last night I’ve put some of my ideas for the new update of Flash Gallery on paper. Here are some of them.

  • Create a better, more modern looking interface for the Flash Gallery
  • Create a multi-gallery mode
  • PHP and MySQL based administration panel enabling users to manage galleries through a web based interface
  • Full screen mode
  • Slideshow option
  • Integrate Flickr RSS option

So, after putting this things as priorities for the development of the Flash Gallery, I think that there should be two versions of the Flash Photo Gallery, one simple for easy gallery deployment and one advanced with the web based interface.

I plan on releasing the simple one in few weeks due to some everyday work that has to be done.

Google as your own free MP3 search engine

Lets say you want to find MP3 songs from Madonna, basically you can just type in this search pattern:

"index of/" "madonna" "mp3".

This way works pretty well and it’s also the way I used to search for MP3 files. But if you use this pattern, in most cases the search result convince more:

-inurl:(htm|html|php) intitle:"index of" +"last modified" +"parent directory" +description +size +(wma|mp3) "madonna"

Try it out! You’ll see how it works…

10x to …

IBM ThinkPad Warranty – The things I didn’t know!

Last night I accidentally tripped over my audio cable, which at the time was connected to my laptop. So I broke my audio input… When I plugged the cable in the laptop speakers were still playing and no signal was delivered to my 2.1 sound system.

Next time I will try not to leave my cable laying on the ground … finally something went wrong with my ThinkPad…. I did it! I finally succeeded in hurting it.

So, the next morning I took it to the IBM Support Center to fix the problem. They took a look at the box, asked for the warranty. After 5 minutes or something, someone from the support told me that if the laptop was spilled with watter, coffee or something else… my warranty would not matter. I will have to pay like $700.00 + something else I didn’t get.

Continue reading

AJAX, Flash, Actionscript, PHP, MySQL…. the tools of the modern developer!