SpinDrop.us: Parsing a list of Key:Value pairs
626189
Dave Dash has posted a quick script to help with an integration of openID into your application - well, really just to read the response back easily.   I'm working on implementing openID for reviewsby.us and for use in symfony apps. One thing I was having trouble with was parsing key value pairs, which is one of the requirements to reading responses. It's a fairly easy task, but [PHP][] offers so many ways to do this.   He notes the spec for how the results are returned and shares his code (based around a regular expression) that goes through the response and separates things out into key/value pairs automatically.
641397
The other day Tim Bray wrote up an interesting piece on java.util.regex.  I sent him off a quick email detailing my past experiences  and he just blogged his feedback .  "Well... yeah, but here's a story. I was kind of surprised at the results on my OS X box, so I took the code and data over to a nearby Windows XP box and got similar results, so I took 'em to a Debian-stable box I had handy and once again, about the same story. "  "Only, not quite the same. Because it was Perl 5.8.1 on one box and 5.8.3 on another and 5.6.1 on the third, and the i18n/regex code was slightly different in each version, and no two of them gave quite the same results. "  "Now, I'll grant that Unicode/i18n is one ...
381461
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.
400016
Launching off from this previous post on the Stubbles Blog, two more posts (from two other developers) have been posted on the same subject:  In this new post, Frank Kleine takes things a step further and talks about the same kind of type hinting but for more types - including arrays and objects. Examples of how he'd expect things to work followed. The other post is from Stephan Schmidt again and varies slightly off into the world of Namespaces to be included in PHP6 along with the use of annotations.  Be sure to check out the comments on each for some more interesting tidbits...
655958
On the Make Me Pulse blog, Antoine Ughetto shares a method he came up with to recurse through an array using the SPL method - the RecursiveArrayIterator method.   When we have a multidimensional array we have to make some recursives function to parse it. A simple way to get the keys and the value of this type of array is to use the SPL library of PHP.   A code example is included, parsing through a recursive array to output each of the key/value pairs it contains (and using only about five or six lines of code to do it).
703914
On his blog, Stuart Herbert has a quick tip showing how to mimic a feature of Ruby on Rails:   I'm still working on the next article in my series looking at PHP on servers, so in the mean time, check out this simple way to emulate Ruby's nice way of handling separate getter, setter and state query methods in PHP.   He admits his example isn't as elegant as the Ruby method, but it does get the job done. Code for the method is included in his post ready for cut and pasting.
667745
This week we look at text nodes, node lists, forms and the level 0 DOM, DOM hyperspace and markers. The W3C DOM defines a few methods for getting and changing texts, but the core string methods and properties are more useful and versatile. By Peter-Paul Koch. 1120
582158
Michael Kimsal points out the posting of the latest part of his "Grails for PHP developers" series to his blog site - Part Five of the series.   I've put up the latest installment in my "Grails for PHP developers".  Rather than delve too much more in to Grails head on, I'm taking this installment (and at least the next one) to delve more in to the Groovy language itself.  Groovy offers similarities to PHP, but also many differences which can trip you up if you're not careful.  I'll try to lay those out as best I can in the next couple of installments.   This new part of the series goes back and puts the spotlight on GRoovy, the base of the Groovy/Grails combo. He talks about working with variables and arrays as containers for multiple pieces of data and some possible gotchas that could come up along the way.
306317
Work begins on a Perl 6 regexp parser, and Unicode manipulation of strings prompts discussion on the language list.
752277
Alexey Zakhlestin mentions some new YAML functionality he's worked up - emitter functionality:   One more good news for you, YAML-users. I've implemented emitter functionality in php-binding of syck library. It is quite straight-forward, no fancy stuff for now, but it should work.   Supported datatypes include associative arrays, strings, integers, floats, booleans and nulls. He includes an example of the code in action (dumping out the information for an associative array). You can get this latest update from the subversion source on his site.
347638
In a new post on his blog, Kore Nordmann takes a look at a feature that's been around a long time (first introduced in a message board application) - BBCodes.   The discussion on my blog post "Do not use regular expressions for parsing" ended in a discussion about BBcodes in general. I just used them as an example to demonstrate why it it is impossible to parse such a language with regular expressions - and mentioned in a subclause, that I don't see any sense in using them at all.   He looks at some of the myths surrounding them and their use (more secure, easier to use, safer than HTML) and gives some reasons for making teh choice of HTML over them.
465248
Ever wanted to write a Java program that crawls the Web, reads HTML-pages, retrieves the links, and gets the new pages with more links? Well, this month Keld Hansen shows you how.
350929
As Ed Finkler points out there's a new article posted (written by him) on the C7Y site (from php|architect) talking about his Inspekt library - an introduction to the filtering library showing how to help make your applications safer.   Inspekt is a library for PHP4 and PHP5 that aims to make safe input handing easier, and unsafe actions more difficult. Inspekt establishes a new development approach by wrapping input within "cage" objects, and requiring the developer to use validation and filtering methods to test and manipulate the input data. This article provides a brief introduction to Inspekt and its capabilities.   The article covers all of the basics - what the library can do for you, how it integrates into your application and how it helps to protect you from potential problems with the data in your superglobals ($_GET, $_POST, $_REQUEST, etc).
157542
Thousand Parsec (http://www.thousandparsec.net) is working toward a framework for creating online turn-based space strategy games.    Thousand Parsec has released a new version of libtprl, a C++ ReadLine library. libtprl is used by the C++ server, tpserver-cpp.  There are changes to the actual library this time. New methods added and some small cleanup. Added were methods for getting the current commandset, setting whether readline catches signals, redisplaying the line and force redisplaying the line, and setting the finish of completions (disabling the filename completion). All 0.1.x releases will be interface compatible.   See: https://sourceforge.net/projects/thousandparsec
456511
Compiled by PAUL MONTELLA Sept. 19
628030
Found this really cool search engine (Koders ) via ResearchBuzz:   "An article at Newsforge pointed me to Koders ( http://www.koders.com ) a search engine for finding programming code. Nifty. The front page allows you to specify keywords, sixteen languages (from..."  This is pretty dead on.  I had a similar idea about 3 years ago I was calling SourceEngine which for a while was my Alexandria  project under Jakarta.  Some of this technology morphed into Gump .  Heres one innovation which I don't think Koders has picked up yet; use source includes as indegree to compute a CodeRank.  There you go... I'm giving you guys that one for free!  This is the Google innovation but applied to source code ...
228808
Stefan Esser points out a new patch today - CORE GRASP - from the Core Security Technologies group that provides taint support surrounding the mysql_query function.   Their implementation adds a tainted or not flag for every byte so that it is possible on invocation of mysql_query() to determine any kind of injection.   Unfortunately, Stefan also mentions two big issues it might have from the get-go: the overhead for the memory needed can slow things down and an incorrect parsing in their query handler could lead to injection attacks.