News Feed
Sections




News Archive
feed this:

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

Chris Hartjes' Blog:
How the Testing Sausage Gets Made
May 17, 2012 @ 09:19:33

For those either just getting into unit testing your applications (maybe even TDD) or those that are old hat at it and what to figure out a few more tricks of the trade, you should check out this latest post from Chris Hartjes about some of the tools he uses to get the job done.

So how does the Grumpy Programmer write code, TDD style? It starts with using a set of tools that reduce the amount of friction required. First, I do almost all my work from a terminal. [...] Why the terminal? PHPUnit is a CLI application. Yes, many popular editors and IDE's can do things like execute PHPUnit for you, but they are limited in what flexibility they provide.

He also talks about his editor of choice, vim, and some of the plugins he uses in his day to day testing development. This includes tools to handle things like interfacing with git/gists, working with ctags to see the code's structure, working with "surroundings" and the pathogen plugin to make adding other plugins easier. He keeps the code up in one terminal and his testing tool (PHPUnit or other) accessible in a second, making it a simple matter of switching to write the test then the functionality to make it pass.

If there is a lesson to be learned from this, it's to make sure that every tool that you use reduces the friction that is generated when building your application using TDD.
0 comments voice your opinion now!
testing tools vim plugins tdd unittest phpunit terminal


Brian Moon's Blog:
Check for a TTY or interactive terminal in PHP
September 02, 2011 @ 09:12:47

In a new post to his blog Brian Moon describes a need he had for detecting if the client or user calling a PHP script was using an interactive terminal (TTY) or not:

Let's say I am trying to find out why some file import did not happen. Running the job that is supposed to do it may yield an error. Maybe it was a file permission issue or something. There are other people watching the alerts. What they don't know is that I am running the code and looking at these errors in real time.

Since the errors were being sent to the log file, they were lost to the client/user on the other end left staring at their script wondering what went wrong. He ended up with a solution (a pretty simple one too) that uses posix_ttyname and posix_isatty. He includes the little snippet of code he puts in his prepend file that checks for errors then checks for a TTY. If both are there, it turns off logging the errors to the file and sends them direct instead.

0 comments voice your opinion now!
check tty interactive terminal posixisatty posixttyname error log


Rob Morgan's Blog:
Howto Log Directly to Your OS X Terminal using Zend Framework and NodeJS
February 19, 2010 @ 11:14:02

In an interesting post to his blog Rob Morgan shows how you can log in to a terminal from a Zend Framework application (on OS X) with the help of NodeJS.

NodeJS is a tool designed to provide an easy way to build scalable network programs. By using the I/O capabilities of NodeJS, I have built a simple TCP server that writes log messages to the OS X terminal (via STDOUT).

He shows how to take his example script and run NodeJS as a server on a local port (like 8003). You can then use his log writer plugin in your Zend Framework app to write directly to the waiting NodeJS server.

0 comments voice your opinion now!
zendframework nodejs terminal osx tutorial


PHP-GTK Community Site:
Three Widgets and a Timer Class
May 31, 2007 @ 10:26:00

The PHP-GTK website has four new posts highlighting three different widgets and a Timer class to make working with delays in applications simpler:

Keep an eye on the Code Snippets section of the PHP-GTK website for more helpful tips and tricks.

2 comments voice your opinion now!
timer codesnippet widget terminal dial scrolling label timer codesnippet widget terminal dial scrolling label



Community Events





Don't see your event here?
Let us know!


podcast community release install framework library developer application series bugfix threedevsandamaybe api list language configure interview introduction wordpress project code

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework