Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Sameer Borate:
Cron Expression Parser in PHP
Jul 21, 2015 @ 10:15:09

If you've ever worked with the "cron" tool on a unix-based system, you know that there's a special syntax that comes along with defining when the commands should run. It can be difficult to get this timing exactly right, especially if you're very picky about the execution time. In this post from Sameer Borate he shows you a PHP library that can help not only parse current cron configurations but also provides shortcuts for common timings (ex: "daily" or "weekly").

Working with cron scheduling can many times be a frustrating affair. Although setting a few cron jobs at one time can be easy, calculating cron dates in the future in code can get time consuming quickly. The PHP cron expression parser described here can parse a CRON expression, determine if it is due to run, calculate the next run date of the expression or calculate the previous run date of the expression. You can calculate dates far into the future or past by skipping n number of matching dates.

He includes some examples of putting the library to use to define a cron object based on an expression (either via a shortcut or an actual cron time expression). You can then check to see if the cron is "due" or perform some various operations about its run dates. This includes a formatted output of the previous run time, the next run time and the calculation of the next/previous run time based on a relative timestamp.

tagged: cron parser library example tutorial run due evaluation datetime

Link: http://www.codediesel.com/php/cron-expression-parser-in-php/

Warren Tang's Blog:
PHP Unit Testing & Mock Objects with SimpleTest plugin for Eclipse
Jun 17, 2011 @ 12:58:36

Warren Tang has put together this new post to his blog showing how you can use the SimpleTest extension for Eclipse to execute your tests without leaving the IDE.

He breaks it down into a few simple steps (some including screeshots):

  • Download the plugin
  • Install and configure
  • Create a basic test with an assertion
  • Run the test via "Run As > SimpleTest"

He also includes the option for running the test as a web page, but that requires a little bit more code. There's also a quick look at how to run a suite of tests from the IDE (as well as in the browser). for more about using SimpleTest, head over to the project's site.

tagged: unittest simpletest eclipse plugin configure run

Link:

Zoe Slattery's Blog:
Oh no! Not more tests!
Jul 09, 2009 @ 09:42:16

As Zoe Slattery mentions in her new post more testing for PHP is a good thing, but has come with a bit of a problem.

One of the problems with the incredible level of success of the PHP TestFest is that PHP gets more tests, 887 more to be precise. Well, isn't that the point? Yes, but it's beginning to take *forever* to run them which is a bad thing and as TestFests get bigger and better this will only get worse.

As a result, more work has been put into a project started a while back - a tool to allow more than one test to run at once (instead of linearly). This grab shows some of the resulting gains in speed. It jumps to about half to the time to make it through the ~7700 tests.

tagged: batch run performance unittest

Link:

Cal Evans' Blog:
Microsoft and PHP
May 06, 2009 @ 10:26:33

In some of his research into PHP and Windows recently, Cal Evans has come across two surprising things about the (usually dismissed) combination of the two:

  • It actually runs well if setup properly
    I don't have a spare computer so I'm not going to discuss performance or show benchmarks. I am talking about ease of use in getting things setup. [...] No, I'm not nearly ready to give up my Linux servers in production and despite Sam Ramji's recent pleas to their open source vendors not to compete on price but compete on value, I can still fail fast and cheap using open source software and operating systems.
  • A lot of open source developers just don't trust Microsoft, just because.
    I am, however, willing to give them the benefit of the doubt. I am part of the slim majority on the above poll who thinks they are sincere. The reason I am willing to give them the benefit of the doubt is not because I believe that the core of Microsoft has changed in any way [...] but because I believe that inside of Microsoft, there are pockets of brilliance.

Check out more of Cal's thoughts on the matter and the results of his "unscientific" polls he mentions in the rest of the post.

tagged: microsoft opinion combination windows run well trust

Link:

Richard Heyes' Blog:
An epiphany... (using cron)
Dec 26, 2007 @ 09:40:00

Richard Heyes has shared an epiphany he's come up with - a method for running scripts in a web-based environment using lynx.

OK maybe not to you, but it has just occurred to me, and things don't come to me all that fast these days. Cron jobs. [...] You can have a directory inside your webroot called "cron" (imaginative eh?) with scripts in there that are run via cron.

His method uses the cron daemon on the machine to invoke lynx and call the web page through its url. Of course, there are advantages and disadvantages of the method (including having the script open to the world - scary). Be sure to check out the comments for other suggestions from fellow developers.

tagged: cron lynx run script advantage disadvantage cron lynx run script advantage disadvantage

Link:

Richard Heyes' Blog:
An epiphany... (using cron)
Dec 26, 2007 @ 09:40:00

Richard Heyes has shared an epiphany he's come up with - a method for running scripts in a web-based environment using lynx.

OK maybe not to you, but it has just occurred to me, and things don't come to me all that fast these days. Cron jobs. [...] You can have a directory inside your webroot called "cron" (imaginative eh?) with scripts in there that are run via cron.

His method uses the cron daemon on the machine to invoke lynx and call the web page through its url. Of course, there are advantages and disadvantages of the method (including having the script open to the world - scary). Be sure to check out the comments for other suggestions from fellow developers.

tagged: cron lynx run script advantage disadvantage cron lynx run script advantage disadvantage

Link:

php|architect:
Introduction to PHPUnit
Aug 22, 2006 @ 07:26:39

On php|architect's A/R/T article repository today, there's a new guide written by Sebastian Bergmann - an introduction to PHPUnit.

In the last decade, PHP has developed from a niche language for adding dynamic functionality to small websites to a powerful tool making strong inroads into large-scale, business-critical Web systems. Financial institutions such as banks and insurance companies use PHP, for instance, to develop and maintain solutions for Basel II Credit Rating. Critical business logic like this needs to work correctly. But how do you ensure that it does? You test it, of course.

The tutorial takes a look at how to get started writing tests for your code and how to run those tests against your code to find problems. Sebastian also includes a few of the common misconceptions about unit testing, specifically using PHPUnit to test their apps.

tagged: introduction phpunit unit test tutorial create run misconceptions introduction phpunit unit test tutorial create run misconceptions

Link:

php|architect:
Introduction to PHPUnit
Aug 22, 2006 @ 07:26:39

On php|architect's A/R/T article repository today, there's a new guide written by Sebastian Bergmann - an introduction to PHPUnit.

In the last decade, PHP has developed from a niche language for adding dynamic functionality to small websites to a powerful tool making strong inroads into large-scale, business-critical Web systems. Financial institutions such as banks and insurance companies use PHP, for instance, to develop and maintain solutions for Basel II Credit Rating. Critical business logic like this needs to work correctly. But how do you ensure that it does? You test it, of course.

The tutorial takes a look at how to get started writing tests for your code and how to run those tests against your code to find problems. Sebastian also includes a few of the common misconceptions about unit testing, specifically using PHPUnit to test their apps.

tagged: introduction phpunit unit test tutorial create run misconceptions introduction phpunit unit test tutorial create run misconceptions

Link:

ITtoolbox.com:
So I'm a PHP developer and my company runs SAP now what?
Apr 25, 2006 @ 06:50:56

SAP keeps popping up on the PHPradar more and more these days, and this new article from the ITtoolbox site blog explains the situation from a PHP developer's point of view in a SAP-using company (and a few tips to get you started).

So you're a PHP developer and your company is running SAP, the problem though is you have no clue about SAP or what it does - you are curious though. The following are a few tips on making the cross over from building web applications to building SAP based web applications using PHP.

They start with the obvious, finding out what version you're working with, before moving on to the actual development. They link to a few resources for tools to help you make the connections and functionality inside the SAP systems. The simple script they give to test things out just logs you into the system and displays a status for your connection - nice and easy.

tagged: developer company run sap database connection sample hint developer company run sap database connection sample hint

Link:

ITtoolbox.com:
So I'm a PHP developer and my company runs SAP now what?
Apr 25, 2006 @ 06:50:56

SAP keeps popping up on the PHPradar more and more these days, and this new article from the ITtoolbox site blog explains the situation from a PHP developer's point of view in a SAP-using company (and a few tips to get you started).

So you're a PHP developer and your company is running SAP, the problem though is you have no clue about SAP or what it does - you are curious though. The following are a few tips on making the cross over from building web applications to building SAP based web applications using PHP.

They start with the obvious, finding out what version you're working with, before moving on to the actual development. They link to a few resources for tools to help you make the connections and functionality inside the SAP systems. The simple script they give to test things out just logs you into the system and displays a status for your connection - nice and easy.

tagged: developer company run sap database connection sample hint developer company run sap database connection sample hint

Link: