Archive for May, 2008
Daily Weather Reports from MARS
It’s really strange that I can buy an old car for a few hundred dollars and fix it for a few hundred more but if I want to be more progressive and get an electric conversion kit instead for my bicycle to help get over those nasty hills in the summer heat, it’s more expensive?
I’ve been researching e-bike kits for the past few days and apparently the lowest cost decent front wheel hub motor is like $400 and then I can either get ancient & heavy sealed lead-acid batteries for a couple hundred more or relatively new/light and “environmental” LifePO4 batteries for $400-$500.
Sigh, oh well. Maybe next summer. I guess I’m stuck at home for this one.
ps. why doesn’t Wikipedia have a page on electric bikes? Weird.
I have written some extensive scripts for PHP to do things it probably was not meant to do.
Unfortunately some get so large and take so long that I’ve researched a few tricks that may be helpful to others:
1. put error_reporting(E_ALL); at the start to make sure you find out any little errors like undeclared strings or unexpected output – very helpful for script that may take long periods of time to execute and you want to get it right the first time
2. put ini_set("max_execution_time", "300"); at the start to extend the timeout (typically 30-60 seconds in a default PHP setup). If you are on a shared server this ability may be locked out to you. 300 is an example for 5 minutes.
3. put ini_set('memory_limit','64M'); at the start to boost your memory limit for very complex arrays, etc. The default is typically 16M. Again, this may be unavailable to you on a shared server.
4. best trick of all – unbuffered output to browsers in HTML, so you can see results in realtime, even if the script takes 5+ minutes, etc.
put at the start:
ini_set('output_buffering', 0);
ini_set('implicit_flush', 1);
ob_end_flush();
ob_start();
then after each write (echo, print_r, etc) put ob_flush(); flush();
You’ll know it’s working when you see each line appear as it happens in your browser window.
Note if you have an older Apache 1.x server that uses mod_gzip this trick may not work. It should however on Apache 2.x, lighttpd, litespeed (maybe even IIS, but I dunno)

Recent Comments