 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
PHPMaster.com: Localizing PHP Applications "The Right Way", Part 5
by Chris Cornutt November 25, 2011 @ 14:58:09
PHPMaster.com has posted the fifth part of their "Localizing PHP Applications 'The Right Way'" series, this time with a focus on extracting data from the .pot template files to define in your PHP. (This is the final part of the series.)
In Part 4 you learned how to use gettext for one of the most complex aspects of localization a developer can face, plural forms. In this, the final part of the five-part series, I'll teach you how you to automate part of the localization process by extracting msgids and generating a PO template file (.pot) from your application's PHP code.
They show how to use the xgettext command-line tool to pull out strings from your source and automatically make them into a domain template. They help you set up three sample PHP files and run the xgettext command on them to pull out messages defined in the text of the files to set up keys in the template. Screenshots are included showing how to use Poedit to use these templates for your new translations.
voice your opinion now!
localize xgettext tutorial gettext extract
Kae Verens' Blog: Extracting a sudoku puzzle from a photo
by Chris Cornutt February 04, 2009 @ 12:57:18
Kae Verens has posted a cool little application of how to pull information out of a photo and parse it with the GD library. His example is a visual sudoku solver (part one, at least).
The plan for this one is that, if you're doing a sudoku puzzle in the pub or on the train, and you get stuck, you just take a snapshot of the puzzle with your camera-phone, send the photo to a certain mobile number, and a few seconds later the solution is sent back as an SMS message. The solution costs you something small - 50 cents, maybe.
The script looks at a picture of a sudoku puzzle, converts it to b&w and tries to find the squares surrounding each position of the board. With these measurements, the next step is to grab the numbers already in the puzzle and hand those off to the puzzle solver to be processed.
voice your opinion now!
extract sudoku puzzle number grid photo solve textmessage
Sameer Borate's Blog: Refactoring 2 Extract Method
by Chris Cornutt January 12, 2009 @ 20:18:35
Sameer has posted the second part of his series looking at refactoring with a spotlight on the Extract method.
The 'Extract Method' is one of the most common refactorings you will ever do. It is also one you will frequently see implemented on the Refactor tool menu on various IDE's. What this method basically does is to take a group of related code and convert it to a function with a appropriate name that easily explains the purpose of the code.
He gives a code example - converting hotel room price to points based on the currency its requested in - both with and without the Extract method in use.
voice your opinion now!
refactor extract method example convert hotel price points
PHPImact Blog: Refactoring the Front Controller of the Zend Framework
by Chris Cornutt August 20, 2008 @ 14:04:01
The PHP::Impact blog has a new tutorial posted today with a look at a refactoring of the front controller of the Zend Framework to make it a bit more manageable.
One of the most fundamental decision in object design is deciding where to put responsibilities. No one, and I mean no one, gets it right the first time. That's why refactoring is so important. As Kent Beck puts it, refactoring is the process of taking a system and adding to its value, not by changing its behaviour but by giving it more of these qualities that enable us to continue developing at speed.
He follows the "extract" refactoring method that makes things simpler by removing unneeded parts of the code (in favor of an interchangeable external "extract class". He removes seven methods from the class and splits them off into their own. This reduces the controller down to a more manageable size and takes a lot of the complexity out.
voice your opinion now!
tutorial refactor extract class zendframework front controller
Developer Tutorials Blog: Extracting text from Word Documents via PHP and COM
by Chris Cornutt March 26, 2008 @ 12:02:06
In a recent blog post Akash Mehta showed how to reach into a Microsoft document (a Word file) and pull out the content inside via a PHP script.
Communicating via COM in PHP is easy as ever; especially for people coming from a VB background where executing complex tasks in MS-applications is a piece of cake, you will feel right at home in PHP. In fact, VB COM calls can be converted to PHP COM calls in just a few simple search and replaces.
He shows how to use the COM extension in a (Windows) PHP installation to access the text inside the document and manipulate the contents however you'd like (even writing them back out to another Word file).
voice your opinion now!
com document word extract content manipulate
Andries Seutens' Blog: Zend Framework, just get me started, okay?
by Chris Cornutt June 20, 2007 @ 12:03:00
Andries Seutens has created his own quickstart method for working with the Zend Framework and in his latest post, he shares the files.
If you are looking for a quick way to get started with the Zend Framework, then you should download this file. This download has a default setup for the Zend Framework, including: a conventional directory structure, a bootstrap file, configuration file with 2 stages: production, staging, an error controller, an index controller and more.
For course, you'll have to have the framework installed to get things up and running, but outside of that you'll only need to put the downloaded files above into the right place.
voice your opinion now!
zendframework quickstart download extract zendframework quickstart download extract
Felix Geisendorfer's Blog: Cake 1.2's Set class eats nested arrays for breakfast!
by Chris Cornutt February 28, 2007 @ 10:04:00
Felix Geisendorfer has a great functionality note that CakePHP users might want to check out. It's related to the Set class and how it handles nested arrays.
So far this has been a little dark spot for me in the core and from my previous quick looks at the class I've never been quite able to figure out what it's exact purpose was. Until now all I knew was "well it's probably some fancy array manipulation code that is somewhat obfuscated and undocumented". Oh boy, I wish I had spent more time on this earlier. It's probably one of coolest new features in 1.2 and nobody realizes it.
He starts with a simple example of how the class works with a nested array of user information. Normally, you'd loop through the array and append the values you'd need to another array (like the user's name), but with Set, it's as simple as calling the static "extract" method with the "path" to what you want out of the array. A simple one-line replacement for a (normally) three to four line bit of code.
He gives a few other examples using this same user information, grabbing various results and includes one at the end that is very nice indeed - pulling in an XML document, running it through a simple xmltoArray function and pulling out the titles in a few easy lines.
voice your opinion now!
set class cakephp nested array extract combine xml parse set class cakephp nested array extract combine xml parse
|
Community Events
Don't see your event here? Let us know!
|