 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Ian Barber's Blog: Benford's Law
by Chris Cornutt April 05, 2011 @ 09:12:46
In a recent post to his blog Ian Barber looks at applying Benford's Law in PHP to determine if the dataset you're working with is "real" or not.
Benfords Law is not an exciting new John Nettles based detective show, but an interesting observation about the distribution of the first digit in sets of numbers originating from various processes. It says, roughly, that in a big collection of data you should expect to see a number starting with 1 about 30% of the time, but starting with 9 only about 5% of the time.
He pulls data from the data.uk.gov site to illustrate and includes a simple PHP script to run through the data looking scoring it with a "Benford" rating. He plots these on a graph along side the data to show the (almost exact) match between the data and the Benford numbers. You can find more details on the law on Wikipedia.
voice your opinion now!
benfordslaw real fake data evaluate
Community News: No Starch Press Releases "Wicked Cool PHP"
by Chris Cornutt February 13, 2008 @ 16:07:00
No Starch Press has officially released their PHP title "Wicked Cool PHP" (Real-World Scripts That Solve Difficult Problems).
Here's a bit from the press release:
Wicked Cool PHP [...] is a different breed of PHP book. It's made specifically for the developer who wants to know how to get things done without mucking around and wasting a lot of time. This is not a weighty PHP complete reference or bible that threatens to take down your bookshelf and the rest of the bookcase. This is a book for coders to pick up and use, not wade through.
It provides the reader with "76 immediately useful PHP scripts" that do a variety of things like send/receive email notifications, do some web scraping, track users with cookies and sessions and use web services like SOAP.
You can find out more about the book on this page on the O'Reilly website. The book will officially hit the stands February 15th.
voice your opinion now!
nostarchpress oreilly real script book release wicked
Jacob Santos' Blog: Multitasking in PHP
by Chris Cornutt August 19, 2006 @ 15:23:43
In his latest blog post, Jacob Santos takes a look at a common request PHP developers hit after a while - is it possible to multitask processes/actions in php?
The ability to run two or more commands in parallel is totally sexy, but the Web is a different playing field and it doesn't make complete sense.
PHP loses control, once the output is sent and the connection is closed. Multithreading would probably make sense in streaming, but PHP already handles that for you where it makes sense for the function. Furthermore, mulithreading has its purpose in applications that continue to run and not something that closes and cleans up everything after the last command is issued.
He continues talking more about what multitasking is, a more real life example, the goods, the bads, and some of the issues that can come along with it. Finally, he suggests a feature to be added to the core of PHP - an "internal multitasking mechanism" to help aid these kinds of processes.
voice your opinion now!
multitasking common questions real world good bad multitasking common questions real world good bad
The PHP Grind: Get real about PHP4 vs. PHP5!
by Chris Cornutt June 08, 2006 @ 14:48:46
From ThePHPGrind.net today, there's a new post with some opinions on the real differences between PHP4 and PHP5, including suggetions to just make the jump to the latest version.
I am repeated aggravated by so called "reputable" people in the PHP industry marginalizing and downplaying PHP5 in favor of the ever aging and antiquated PHP4.
And, I'm not talking about small applications. I'm talking about a complete online fantasy sports systems. Content and product management, e-commerce, integration systems and many custom modules for very large companies in the construction and industrial manufacturing industries. Company names that your kids probably know, but names that probably shouldn't be mentioned in my little rant here out of respect.
He makes the case that not only is it a pretty simple matter to make the move (usually) plus the fact that several large companies using PHP have already made the leap as well. I also like this great little "soundbite" quote he shares:
PHP5 is here already, and many of its' versions are completely stable for the vast majority of people. And, soon PHP6 will be here whether other people like it or not. So, why not get ready?
voice your opinion now!
get real php4 php5 versus upgrade large get real php4 php5 versus upgrade large
Sitening.com: Getting Real With Databases in PHP
by Chris Cornutt June 01, 2006 @ 06:11:58
This new post on the Sitening.com blog (written up by Tyler Hall) today takes a look at PHP and databases (MySQL specifically in this case) and "getting real" with them.
many of the ideas behind Ruby on Rails are spot on. I particularly like how well it abstracts database queries into separate objects for each table. That's very cool and can save having to write a lot of repetitive code. But having to run a Rails script to generate new files is a little too cumbersome for me. Like I said, I prefer to keep things simple. Can we do the same thing with PHP? Using just one file?
Yes.
He proceeds to show a class that can perform operations similar to those styled in RoR - creating the object, applying proterties to it and performing the action (inserts/delete/etc). It's all made possible through the use of the __get and __set functions offered in PHP5. From there, it's just a simple matter of defining the functions for the actions.
To bring the point home, he also includes some examples of how to use this kind of functionality with a bit more than the previous example - selecting, updating, deleting, and inserting a new record (including the action function for each). Lastly, he gives an example of extending this base class, as mentioned in his first example (creating an object like "Animal" or "User" to abstract out the connections even more.
voice your opinion now!
getting real databases rubyonrails class __get __set getting real databases rubyonrails class __get __set
NewsForge: Real world control from a Web page
by Chris Cornutt May 23, 2006 @ 07:20:11
If you've ever wanted yout scripts to do something more "outside the box" and out in the real world, you might want to check out this new tutorial from NewsForge for a good start.
In "Acquiring data from the physical world" we examined how to use a microcontroller to turn physical events (such as reading a switch) into data and send that data to a Linux box via the serial line. With this capability you can do things like counting people passing through a gate or recording how the temperature changes over time in a factory process. You can then send the data to a Web page. In this article, we'll do it in reverse -- from a Web form, instruct a microcontroller to perform some actions
The concept's pretty simple - the form they build submits back to the page and writes the input out to a file. This file is then read by the controller for the LED they have connected and, with the proper input, will turn it on and off. The code for the PHP/web side of things is included, but it might take a little work to get the rest of the hardware interfaced (as the author saw as well).
voice your opinion now!
real world control web page microcontroller led light real world control web page microcontroller led light
|
Community Events
Don't see your event here? Let us know!
|