Monday, November 16, 2009

PHP date.timezone warning fix

OK, Have you gotten this (or similar):
PHP Warning: PHP Startup: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Los_Angeles' for '-8.0/no DST' instead in Unknown on line 0

I am running PHP 5.3.0 on my Windows XP, and have spent the better part of the day to try to get rid of this warning and finally managed to do it. How, you say?

The breakthrough came after I have read this instructions from the PHP web site Changes in PHP datetime support. Here is part of it:

Since PHP 5.1.0, there has been an extension named date in the PHP core. This is the new implementation of PHP’s datetime support. Although it will attempt to guess your system’s timezone setting, you should set the timezone manually. You can do this in any of three ways:

  • in your php.ini using the date.timezone INI directive
  • ion your system using the TZ environmental variable
  • ifrom your script using the convenience function date_default_timezone_set()

All supported timezones are listed in the PHP Manual.

Notice that you can set your system’s timezone setting using php.ini, set TZ environment variable or from your php script.

The first option did not work for me. The third option does not work for php scripts that are not written by me, so the only option left is to set environment variable TZ. That finally saved the day!
On Windows XP:

  1. go to My Computer
  2. View System Information
  3. Advanced Tab
  4. Environmental Variables
  5. Add New Variable with name ‘TZ’ and value whatever your timezone is. In my case is ‘America/Los_Angeles’.

That’s it. I hope this saves somebody few hours of searching.

Monday, November 2, 2009

Say Hello to the Newest Kindle


Amazon came out with a new smaller 6″ diagonal Kindle. It goes for $259 and has international wireless coverage. Check it out at Amazon.com.

Wednesday, October 28, 2009

Periodic Table of Visualization Methods

Following this post on Flare Data Visualization library, here is one more entry for visualization. Includes Data , Information, Concept, Strategy, Metaphor and Compound Visualization, Enjoy!

Saturday, October 24, 2009

"B.S." Stands for Business-Speak


Today I have read this very interesting article on the American Management Association web site about the need of communicating clearly and avoid empty words. You can read the business speak article here.

Friday, October 23, 2009

Flare Data Visualization

Flare is an ActionScript library for creating visualizations that run in the Adobe Flash Player. From basic charts and graphs to complex interactive graphics, the toolkit supports data management, visual encoding, animation, and interaction techniques. Even better, flare features a modular design that lets developers create customized visualization techniques without having to reinvent the wheel. View the demos and sample applications to see a few of the visualizations that flare makes it easy to build.

Friday, September 25, 2009

Zend, Microsoft, IBM join forces to simplify cloud-app devlopment forPHP coders | All about Microsoft | ZDNet.com


As this article says all the right buzzwords are part of a newly unveiled Simple API for Cloud Application Services. It’s an open-source initiative that currently includes Zend, Microsoft, IBM, Nirvanix, Rackspace and GoGrid as the founding members. (No Google and no Amazon, however.) Here you can read more : Zend, Microsoft, IBM join forces to simplify cloud-app devlopment for PHP coders | All about Microsoft | ZDNet.com.

Sunday, September 6, 2009

A Role-Based Access Control (RBAC) system for PHP

Anyone, that has searched the web for anything related to PHP, sooner or later must have come across the web site of Tony Marston. It is very rich source of ideas and information, and it is worth visiting any time you have a moment to spear. One of the topics that web developers tackle often is the issue of providing accurate and flexible access to the web site users. One way to do this is by using RBAC or Role-Based Access Control system. This system is most ofter implemented with a database, but this is not a requirement. Recently I looked again at one of Tony Marston’s articles about RBAC implementation for PHP and I thought, I share the link with you. I hope it will help or inspire somebody. Enjoy!

Monday, August 3, 2009

Modular applications in ZF 1.8

OK, so you jumped ahead and upgraded to Zend Framework 1.8. What now? One of the new features, that came along with this new release, was the possibility of individual module bootstaping. Or.. does it? If you find the whole thing about module bootstraping confusing, read this blog post and may be it will become a little bit clearer. It was for me. Let us know how you did. Happy coding!

Monday, June 15, 2009

Have you made the jump to Zend Framework 1.8?

Over the weekend I have finally made the jump to 1.8. There, of course, are few changes in this new version, some of the most significant is the introduction of Zend_Application and Zend_Tool. Several blog posts helped me along the way, but I should be honest with you, it took me a good number of hours to assimilate the new “Bootstrap.php” paradigm and move my project to the the new way of doing bootstrapping. If you are starting new project, take a look at this clean writeup. I, however, was not starting a new project and needed something that will accommodate a modular directory structure. A good start was this blog post. I hope this two links will help somebody to make the jump to the new Zend Framework version less painful.


Geography Of Jobs

I have stumbled upon this post and thought it is pretty interesting.

Saturday, May 30, 2009

Phing

One of the best Phing resources I have come across is the blog of Raphael Stolt. I have used Phing based scripts for backup and code generation, but that is not all you can do with it. As Raphael is showing in its blog, you can use it for unit testing, phplocing (see my post on phploc), refactoring, code sniffing, database generation and so on.

Monday, May 18, 2009

phploc

phploc is cool tool, by Sebastian Bergmann, to check the size of your php project. You can install it with PEAR. The short version of the installation goes like this:
// add PEAR channel
user@host ~ % pear channel-discover pear.phpunit.de
// install phploc
user@host ~ % pear install phpunit/phploc
// run
user@host ~ % phploc /path/to/your/project/code/folder

For more detailed instructions and system requirements, here is the link.

Now we are going to play a little honesty game:
Run the tool against your php project library code
[user@host] phploc ./library/Zend/
phploc 1.0.0 by Sebastian Bergmann.
Directories: 285
Files: 1372
Lines of Code (LOC): 275436
Comment Lines of Code (CLOC): 130251
Non-Comment Lines of Code (NCLOC): 145185
Interfaces: 53
Classes: 1321
Functions/Methods: 9170

Run the tool against your php project own code:
[user@host] phploc ./my_application/my_modules/
phploc 1.0.0 by Sebastian Bergmann.
Directories: 30
Files: 85
Lines of Code (LOC): 6644
Comment Lines of Code (CLOC): 580
Non-Comment Lines of Code (NCLOC): 6064
Interfaces: 0
Classes: 94
Functions/Methods: 284

Now calculate the percentage of your code vs. your favorite framework library codepercentage = my_code_NCLOC/my_library_NCLOC*100in my case the result is 4.17% !!! :) :) How about in your project?