Archive for July, 2005

Total download size for a web page

I understand that there is ‘Page Info -> Size’ in Firefox, but that only gives me the total size of the current HTML page, and not for the total download required for all bits and pieces on that page.

I want something that will tell me that there is 5kb in the HTML source, with 2kb more in CSS and 3kb in JavaScript code, for instance.

Anyone know of anything that would do this?

Microsoft wants to patent smilies

According to Om (and the US Patents Office), Microsoft wants to patent the emoticons. Now I don’t get surprised by anything anymore, but I think it’s pretty amusing to imagine whoever was in charge of this:

*Some random legal office*
Jim: Hey Susan, how’s the emoticon project going?
Susan: Oh, finally submitted it to the patents office.
Jim: Excellent!

Good thing Despair, Inc. trademarked the frownie.

Previously on Battlestar Gallatica

Can someone explain to me why we need the extra 2-3 minutes worth of “previously on B.G.” on each episode? I mean, if you lost the previous episode, those 2 minutes are not enough for you to be satisfied anyway. Any geek addicted to this series would simply try to download a torrent of the previous episode, so could we please stop this nonsense? I want those 2-3 minutes for actual fresh content!

PSP games sales numbers smaller than expected?

So I was just reading about the sales statistics regarding the PSP and it seems a bit off to me:

+ 5.07 million PSPs sold worldwide
+ 2.74 million PSPs sold in US
+ 2.33 million PSPs sold in Japan

+ 11.2 million PSP games sold worldwide
+ 7.3 million PSP games sold in US
+ 3.9 million PSP games sold in Japan
+ 48 PSP games released to date
+ 150 available games by March 31, 2006

+ 4.3 million UMD movies sold in US
+ 400,000 UMD movies sold in Japan

Just look at the game sales, either in the US or Japan. That tells me that the average is about 1.5 games per PSP sold, and I expected more (even though I bought just one game myself). Maybe it’s a sign that the current available games are not that attractive to gamers?

It’s also pretty amazing how small the number of UMD movies sold in Japan is..

Application Structure

I love how Richard Heyes’ Application Structure post which describes his way of layint out PHP applications is similar to my own personal structure. I have been using something very similar for a few years now, which evolved by working with PHP applications and dealing with problems and how to avoid them in the future, so it’s amusing to see two people come up with something so similar.

I basically agree with the way he separates library code from normal PHP scripts that are available to the Web, but I do things a bit different. I use the following directory structure:

application root
  +- crons
  +- include
  |    +- jpgraph
  |    +- pear
  |    +- Smarty
  +- locks
  +- logs
  +- scripts
  +- setup
  +- templates
  +- templates_c
  +- webroot
       +- css
       +- images
       +- js


  • crons: where scripts that run off the crontab are located.
  • include: the main directory where the business logic classes are located. I also store PEAR, Smarty and Jpgraph classes here since I don’t really need to see them on the top-level directory every time I want to browse for a file. Richard couldn’t be more right about the whole idea of bundling the libraries that you depend on with your application. There’s nothing worse than waking up one day and having your code totally broken because someone upgraded PEAR to the latest release.
  • locks: scripts that run off the crontab save their lock files to avoid having two copies of the same script running at the same time. Since I cannot simply trust PHP to create a temporary file on the appropriate place, I’ll create my own directory for this.
  • logs: where assorted error logs and informative debugging logs are stored.
  • scripts: where other types of scripts are located, such as manual scripts that are available for convenience. In some cases this might not be needed.
  • setup: where configuration related files are stored. The all-mighty file is stored here, as well as database schema files and etc.
  • templates: where smarty template files are stored.
  • templates_c: smarty uses this directory to save compiled templates.
  • webroot: the actual web accessible directory of the application, from which PHP scripts will include the configuration file, business logic classes, Smarty and etc.

So what do I have on my

< ?php
ini_set('display_errors', 1);
// define the constants related to the structure
@define('APP_ROOT_PATH', '/www/htdocs/appname/');
@define('APP_PATH', APP_ROOT_PATH . 'docs/');
@define('APP_INC_PATH', APP_ROOT_PATH . 'include/');
@define('APP_PEAR_PATH', APP_INC_PATH . 'pear/');
@define('APP_SMARTY_PATH', APP_INC_PATH . 'Smarty/');
if ((stristr(PHP_OS, 'darwin')) || (!stristr(PHP_OS, 'win'))) {
    ini_set('include_path', '.:' . APP_PEAR_PATH);
} elseif (stristr(PHP_OS, 'win')) {
    ini_set('include_path', '.;' . APP_PEAR_PATH);
@define('APP_SETUP_PATH', APP_ROOT_PATH . 'setup/');
@define('APP_LOG_PATH', APP_ROOT_PATH . 'logs/');
@define('APP_ERROR_LOG', APP_LOG_PATH . 'errors.log');
@define('APP_LOCKS_PATH', APP_ROOT_PATH . 'locks/');
// ...

Then in each PHP script on the webroot directory, I do something like this:

< ?php
include_once(APP_INC_PATH . 'class.auth.php');
include_once(APP_INC_PATH . 'class.template.php');
include_once(APP_INC_PATH . 'class.db_connection.php');
// ...

And you go from there. I like Richard’s idea to use basename() to get the base directory dynamically.

« Previous Page« Previous entries « Previous Page · Next Page » Next entries »Next Page »