 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
CodeIgniter.com: New User Guide in Development
by Chris Cornutt October 06, 2011 @ 09:55:48
The CodeIgniter development team is happy to announce work that's been done on the framework's user guide to help make it even better and easier to find the information you're looking for (now based on the Sphinx documentation generation engine).
In addition to handling the tedium of generating page and document tables of contents, or maintaining internal links and references, the documentation is now easier to write, as you can simply focus on the content instead of markup and presentation. Don't forget syntax highlighting of PHP, HTML, CSS, and JavaScript in code samples. Based on ReStructured Text, it's also more human readable in a text editor than HTML is, which is likely where you spend most of your time. As an added benefit, Sphinx can output HTML, PDF, and even EPUB formats all from the same source files.
There's also been a style redesign in the latest release (here on github) on the development branch of the framework. They warn of a few "bumps" that you might come across in using it, but they're working hard to take care of those quickly. If you'd like to see the new version, check out the nightly build results.
voice your opinion now!
usergruide development sphinx markup generation framework codeigniter
Anthony Ferrara's Blog: Random Number Generation In PHP
by Chris Cornutt July 21, 2011 @ 10:03:28
Anthony Ferrara has a new post to his blog today looking at true random number generation as it relates to predictability and bias. He also talks about a method/tool you can use (based on RFC 4086) to generate truly random numbers - PHP-CryptLib.
When we talk about "random" numbers, we generally talk about two fundamental properties: Predictability and Bias. Both are closely related, but are subtly different. Predictability in reference to random numbers is the statistical problem of predicting the next value when knowing any number of previous values. Bias on the other hand is the statistical problem of predicting the next value when knowing the distribution of previous values.
He looks at how predictability can effect true random number generation and a common mistake in generation related to bias in the calculation method. He talks about some of the functions PHP includes to work with randomness, but notes that they all have their flaws. He points to the PHP-CryptLib package as a solution (adhering to the guidelines in RFC 4086 for randomness). He includes some sample code of how to use it to generate random numbers, tokens and sets of bytes. You can find the full source over on github.
voice your opinion now!
random number generation library phpcryptlib library predictability bias
Matthew Weier O'Phinney's Blog: Code Generation with ZendCodeGenerator
by Chris Cornutt March 28, 2011 @ 10:40:29
Matthew Weier O'Phinney has put together a beginners guide to code generation with the help of the Zend_CodeGenerator component of the Zend Framework (v2):
Zend Framework has offerred a code generation component since version 1.8, when we started shipping Zend_Tool. Zend_CodeGenerator largely mimics PHP's ReflectionAPI, but does the opposite: it instead generates code. [...] ZendCodeGenerator in the ZF2 repository is largely ported from Zend Framework 1, but also includes some functionality surrounding namespace usage and imports.
He includes an overview of the different code generation classes available (like PhpBody, PhpFile, PhpProperty, etc) and a bit of code to show you how to create a skeleton class that includes namespace use, class definition and the addition of a "get" method. He also offers some "tips" and "gotchas" to watch out for your first time around like the helpful automagic getter and setter handling.
voice your opinion now!
code generation zendframework codegenerator tutorial introduction
Sameer Borate's Blog: Easy thumbnail generation using PHP
by Chris Cornutt March 25, 2011 @ 08:19:57
Sameer Borate has a recent post to his blog looking at a PHP_Thumb tool.
One of the frequent requirements in web design is that of thumbnail generation. Although there are many libraries out there I found PHP Thumb simple and quick enough to implement in a recent project. PHP Thumb is a light-weight image manipulation library aimed at thumbnail generation. It offers the ability to resize, create custom crops, or square crops from the center, and rotate the image. If the need arises you can also easily add custom functionality to the library through plugins.
Code examples are, of course, included in the post showing simple thumbnail creation, image rotation, cropping, resizing and outputting to a different format. There's a brief mention of custom plugins and the ability to chain functions.
voice your opinion now!
thumbnail generation phpthumb generation tutorial
Qafoo.com: Practical PHPUnit Testing XML generation
by Chris Cornutt September 17, 2010 @ 13:51:02
On the Qafoo blog today there's a new post from Tobias Schlitt about a method you can use to unit test methods that generate XML without messing with a lot of extra overhead just to test the results.
Testing classes which generate XML can be a cumbersome work. At least, if you don't know the right tricks to make your life easier. In this article, I will throw some light upon different approaches and show you, how XML generation can be tested quite easily using XPath.
He includes a sample class, qaPersonVisitor, that has methods inside it to create a simple XML documents based on the first and last name data into a DOM element. He sets up the basic test case that creates a simple person - including gender and date of birth - and offer a few different suggestions on handling the check (in PHPUnit tests):
- the naive way of rebuilding the DOM object and assert that they are equal
- testing the resulting XML from the DOM object against a pre-generated XML document
- matching the contents via CSS selectors
- using the tag matching assertions
- using XPath in a custom assertion (with short and long uses of it included)
voice your opinion now!
unittest phpunit xml generation xpath dom
Jani Hartikainen's Blog: Practical uses for reflection
by Chris Cornutt February 17, 2009 @ 10:22:36
Reflection can be a handy tool when you need it, but how many times have you actually found a use for it in the past few applications you've written? Jani Hartikainen has one suggestion of a place it can be used - form generation.
Most web applications use forms. Forms often represent some model, such as a news post. If the model is simple, writing the form in HTML is not too bad, or we might be able to use a scaffolding feature in our framework. [...] Here's a good use for reflection! Since in models we often have a naming scheme for the data the users would be able to input, we can utilize this knowledge with reflection to generate a list of possible fields in the model, and then generate the form with less typing required from us.
His example looks into the model class and pulls out the "get" functions and, after pulling out the name, adds it to a fields array. This array is then passed out to the display part of the script and looped over to create a text field for each. He expands it a bit to also include checking for "@return" values in docblock comments for the type of form field that should be displayed.
voice your opinion now!
reflecton api form generation practical suggestion model view
Micheal Kimsal's Blog: Symfony __toString() generation
by Chris Cornutt August 20, 2008 @ 11:14:50
Michael Kimsal has pointed out a small irritation when using the Symfony framework and models - an issue when using models that have relationships.
If there are relations (an Author has a Book, for example). the generated forms will complain that the generated Models need a __toString() method to be used in the Form/View. In grails, this is the case, but every domain (corresponding to a Symfony 'model') has an implicit toString() method already generated, which return the string ":". For most production work, you'll want to override it with whatever you need the string to read, but for prototyping, it's fine.
He went in and modified the Symfony core to add in a __toString call that would return the object correctly. Several of the commentors agree with his frustration and some of the Symfony developers even chime in with some of the reasoning behind why it's like that.
voice your opinion now!
symfony tostring generation model issue join
|
Community Events
Don't see your event here? Let us know!
|