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:
Monkey-patching Is for Closers
July 16, 2012 @ 09:09:51

In this new post to his blog Chris Hartjes looks at why "monkey patching is for closers" - how it should be avoided in favor of making the code itself more testable rather than "hack" with the patching.

The use of monkey-patching is extremely prevalent in the Ruby community and also to a certain extent in Python usage. I'm not going to go into length about their use of it except to say that it seems quite common and I think most developers are using it as a shortcut to counter what might be poor code architecture decisions.

He includes some example code, excerpted from a blogging system where runkit was originally use to test its functionally. He shows how some simple refactoring (adding input parameters, replacing a static method call, etc) makes it easier to unit test. Comments to the post include further refactoring ideas as well as a response from the original "offender" whose post sparked Chris' response.

0 comments voice your opinion now!
monkey patch modify runkit unittest refactor


IBM developerWorks:
Getting Graphic with PHP
July 03, 2008 @ 10:20:00

The IBM developerWorks site has a new tutorial posted (registration/login required) talking about image creating in PHP using the GD library.

The purpose of this tutorial is to show you how to get started with the GD library and to provide a variety of techniques you can apply to your Web-page coding. The tutorial doesn't cover every GD function, but it teaches you the basics. The Resources section provides Web sites where you can learn more about using the GD library.

They go through the creation of sample images, working with gradients and lines, adding text, saving the image data out to a file and how to work with existing graphics to modify them.

0 comments voice your opinion now!
tutorial graphic gd image gradient text modify lines


IBM developerWorks:
Use an XML database in PHP and Java applications
April 03, 2008 @ 09:33:36

The IBM developerWorks site has posted a tutorial (you'll need to log in) showing how to use native XML databases to speed up development time for your applications.

Native XML databases have grown in popularity along with XML, because data is stored as native XML, rather than through tables in a traditional database. Using a native XML database means that a change to the schema requires minimal changes to your code and no change to the database. PHP and Java developers can benefit greatly from using native XML databases

IT talks about how to connect to the database (in this case DB2), grab the XML data via a query and how to insert information back in via a web-based form. There's also an example showing how to make a "search" on the data and how to change the schema of the database on the fly as well.

0 comments voice your opinion now!
xml database application tutorial db2 modify schema


DevShed:
A Quick Overview of the XML DOM Extension in PHP 5
February 26, 2008 @ 12:26:00

DevShed has started up a new tutorial series today with part one of their overview of the DOM extension that's included with PHP5:

Simply put, the DOM XML extension, as its name suggests, will permit you to work on XML documents by way of the DOM API. [...] In this article series I'll be discussing some of its most relevant methods and properties and accompanying all of these explanations with concise and instructive hands-on examples.

They look at using the DOM to create new documents, modify documents by adding additional nodes and converting over a SimpleXML document to be manipulated.

0 comments voice your opinion now!
dom extension tutorial php5 build modify simplexml


Leo Buttiker's Blog:
Trevi is online!
January 08, 2008 @ 11:17:00

Leo Buttiker has posted a release announcement about the new framework they've developed - Trevi.

There're already thousands of web frameworks out there so I would sink into the ground if we really wrote another one. [...] Zend Framework looked like a nice solution. But what we probably liked most is that ZF allowed us to replace every component in the framework.

To this end, their "framework" isn't truly a new way of doing things - it's just a heavily modified version of the Zend Framework they've customized to fit their needs. Trevi is their own internal name for this release.

0 comments voice your opinion now!
trevi zendframework online framework modify component custom trevi zendframework online framework modify component custom


Jonathan Street's Blog:
When scraping content from the web don't make it obvious
November 07, 2007 @ 11:26:00

Jonathan Street has a tip for those developers out there that have no other choice than scraping content from a remote site - don't make it obvious. He also includes a suggestion on how to make it a little less obvious.

A couple of hours ago I was playing around scraping some content from a website. All was going well until suddenly I couldn't get my script to fetch meaningful content. [...] The first thing I did was stop visiting the site for 15 minutes or so and then increase the time between requests. It briefly worked again but quickly stopped.

One simple change to his user agent string in his php.ini made the problem evaporate pointing to a user agent filtering happening on the remote side. His helpful hint involves two methods - one in just PHP and the other in cURL - to change the user agent that your scripts are sending. An even better sort of solution might be some sort of rotating array that would alternate between four or five strings to make things even more random.

0 comments voice your opinion now!
scrape content remote server useragent filter modify phpini scrape content remote server useragent filter modify phpini


Vinu Thomas' Blog:
Modifying your MySQL databases to be UTF-8 compliant
December 28, 2006 @ 07:47:00

There's a quick tip from Vinu Thomas on his blog for anyone having issues with UTF-8 data in a MySQL database (as accessed by PHP).

Most of us have had problems with UTF-8 problems in PHP and MySQL. Here's how to modify your database and table to be UTF-8 compliant. Most of the time we do set the character set to utf8 but forget to set the collation set to utf8.

He includes both SQL statements you'll need to make the transition - two ALTER statements that update the properties of a database and change the encoding on a specific table to UTF-8 compatibility.

0 comments voice your opinion now!
mysql database modify utf8 compliant alter sql statement mysql database modify utf8 compliant alter sql statement



Community Events





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


community framework interview library release version podcast tool composer language series laravel symfony voicesoftheelephpant update mvc introduction opinion security package

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