logo RSS feeds on your webpages
Optimized for webmasters

Display by date - Display by feed

computer download english français games informatique jeux vidéos mac ordinateur pc php software téléchargement webmaster windows
Thu August 26, 10

Zend Framework 1.10.8 Released - Zend Developer Zone - Planet PHP - RSS
The Zend Framework team announces the immediate availability of Zend Framework 1.10.8 , our eighth maintenance release in the 1.10 series. This release includes around 22 bug fixes. A special reminder to those users of Zend_Service_Twitter , please ensure you upgrade to 1.10.6, 1.10.7, or 1.10.8 ASAP. These releases introduce a change in the Zend_Service_Twitter API that enforces the use of OAuth by default when using methods that require authentication. The change was introduced to help prepare Zend Framework users for the Twitter OAuthcalypse scheduled in 6 days from now on August 31, 2010 . (If you cannot upgrade, there are other ways to integrate Zend_Oauth with Zend_Service_Twitter .)

Pragmatic Guide to Git - Travis Swicegood - Planet PHP - RSS

My latest book on Git, Pragmatic Guide to Git goes on sale today! I'm really excited about this new book. It's the culmination of a year's worth of work on an entirely new format for Pragmatic Bookshelf.

From today's announcement:

Last summer, Pragmatic author Travis Swicegood proposed a new kind of book covering the popular version control system, Git. We thought it was a good idea–so much so that we've launched a whole new series in this format. Check out the details on the series below, as well as Travis' new book, Pragmatic Guide to Git, now available in beta.

Having a good idea is cool. Having a good idea that you can get other people excited about too is even better. I thought I was onto something interesting when I pitched the idea to Prag, and so did everyone else there. A year later and here we are with an entire new series lined up.

Here's the quick description of the new book:

Need to learn how to wrap your head around Git, but don't need a lot of hand holding? Grab this book if you're new to Git, not to the world of programming. Git tasks displayed on two-page spreads provide all the context you need, without the extra fluff.


Company rename and RooJS sites now online - Alan Knowles - Planet PHP - RSS
Article originally from rooJSolutions blog After what seems like forever in design and migration, I've turned on the roojs.com and roojs.org domains, I'm slowly in the process phasing out my old company name - AK BK Consulting, which is now rooJSolutions

Quite a few of the key pages are missing content at present, but the blog and it's features are mostly moved over.

After I fill out all the missing content, I'll get back to blogging about how most of the Javascript tools and associated backend libraries all work together. Exciting times for a quality platform neutral Javascript Rich User Interface, guaranteed $(wtf) free...



Visualization - Travis Swicegood - Planet PHP - RSS

David McCandless gave an excellent TED talk on visualization of data. The take-away quote from this was:

Data is the new soil

I love that line. Data gives rise to new ways of understanding something. Presenting something spatially gives you the ability to put it in context more quickly than trying to explain the context.

Take 20 minutes, this video is well worth the time investment:


NP-Gravatar - Zend Developer Zone - Planet PHP - RSS
Zend Framework extension, which provides classes for using and implementing Gravatar's services and features. It consists of HTTP client for performing Gravatar Profile Requests, client for Gravatar XML - RPC API and view helper for rendering Gravatar image URL s.


Is Your PHP Application Affected by the Y2K38 Bug? - SitePoint » PHP - Planet PHP - RSS

I don't want to be too alarmist, but try running the following PHP code on your system:

With luck, you'll see “Wednesday 1 February 2040 00:00″ displayed in your browser. If you're seeing a date in the late 60's or early 70's, your PHP application may be at risk from the Y2K38 bug!

What's the Y2K38 bug?

Y2K38, or the Unix Millennium Bug, affects PHP and many other languages and systems which use a signed 32-bit integer to represent dates as the number of seconds since 00:00:00 UTC on 1 January 1970. The furthest date which can be stored is 03:14:07 UTC on 19 January 2038. Beyond that, the left-most bit is set and the integer becomes a negative decimal number — or a time prior to the epoch.

Yes, it's 28 years away and I'm sure many of you think it's ridiculous to worry about it now. However, developers thought that way about the Millennium bug the 1970's and 80's. Also, any web application which handles long-term future events could be at risk. For example, a typical mortgage runs for 25 years. Pensions and savings plans can be far longer.

Will 64-bit save us?

Probably. If you're using a 64-bit OS with a compiled 64-bit edition of PHP, your application shouldn't be affected. I'd recommend you test it, though. A signed 64-bit number gives a maximum future date which is 21 times greater than the current age of the universe — 292 billion years, give or take a day or two.

You can probably sleep at night if you're convinced your financial application will always be installed on a 64-bit system.

Are there alternative options?

Fortunately, PHP introduced a new DateTime class in version 5.2 (experimental support was available in 5.1 and be aware that some methods were introduced in 5.3)…

DateTime does not suffer from Y2K38 problems and will happily handle dates up to December 31, 9999. I might have paid off my mortgage by then!

It may not be worth upgrading existing applications, but you should certainly consider the DateTime class when planning your next project.

Has you experienced Y2K38 problems in your application? How did you fix it?

Related Posts

  • How To Create an Offline Web Application
  • Sat Nav – the Killer Application for Offline Web Technology?
  • PHP is Fifteen Today!
  • Related posts brought to you by Yet Another Related Posts Plugin.




    Is it really that hard ...? (or how i finally learned to hate CSS) - PHP, the universe and all the rest - PHP - Planet PHP - RSS

    I confess that i've been hiding under a stone for quite some time when it comes to contemporary html stuff, for most of the things i'm doing on the presentation level even good old html 1.0 would be sufficient if it weren't for the occasinal tabular data ...

    So while i know CSS in theory i've never really looked into the black magic of doing CSS layouts and stuff ... until now ...

    What i'm up to right now was to produce a small series of step by step examples on how to use OpenLayers to present customized OpenStreetMap based maps, and for that i wanted to have a simple layout like this:


    Continue reading "Is it really that hard ...? (or how i finally learned to hate CSS)"

    Razors and Development - Travis Swicegood - Planet PHP - RSS

    A few years ago I switched to an old fashion safety razor and haven't looked back. The latest entry into the razor market has reaffirmed my decision as the right one.

    The new Pro Glide from Gillette only costs less than $10 to purchase. Good deal, right? Nope. The replacement blades cost $3-$4 each! Assuming you get a few weeks out of each blade, you're looking at paying between $6 and $10 every month to use this razor blade.

    It's a great deal—for Gillette.

    I use Merkur razor. I paid a lot, comparatively speaking, up front but I can buy better quality razors for less than $0.75 each. They last a lot longer and I end up with a much better shave.

    I view the trade-off here as the same one you have to look at when deciding what framework you choose to develop your code in. There are a lot of frameworks that provide a lot of help getting off of the ground. It almost seems too easy.

    Write your on custom blog in 5 minutes? Sure! Want to have a RESTful API? Add a couple of classes, some new routes, mark as complete.

    Look at the framework and read some of the comments from its detractors. Those complaining generally have one of two problems:

  • They're going to complain about anything, they're just ranting. Ignore these people.
  • They've hit a legitimate pain point in the framework where they deviated too far from the intended use. Pay attention to what these people are talking about.
  • If you're application is significantly complex, no off-the-shelf framework is going to do everything you need it to. Some frameworks may even get in the way. Make sure you realize the trade-offs before you commit.

    What makes a good framework?

    The best ones serve as scaffolding—in the original meaning.

    … a temporary structure used to support people and material in the construction or repair of buildings and other large structures.

    Put another way for software development:

    … helps you ramp up quickly, then gets out of the way.

    Historically, frameworks manage the first part of this well. That's where they shine. It's the last part that they've had a problem with.

    Django manages both of these well. My one complaint with it is that it manages the latter part better than the first. There's a lot of boilerplate needed to get started, but I can live with that. When my applications outgrow Django, removing Django from the equation is easy with one exception.

    Models.

    Models are like your razor's blades. Without blades, your razor doesn't shave; without models your application doesn't have any data to work with. The fix I've found works best for me is to keep my models then and put all of my logic for operating on them in other areas of the code base.

    This separation helps me keep my business logic portable. I might be using the cheap route to get started, but the heavy lifting goes with me if I decide something else is a better fit.


    5 Useful jQuery Snippets for your Website - Web Development Blog » PHP scripts - Planet PHP - RSS

    jQuery is a popular JavaScript library which is used by many developers and applications. While using jQuery you need to write less code, writing functions is less complex and there are a lot of plugins you can use for free in your web application. Even if you code everything by yourself, you need only a few rows of code to create nice and powerful features for your website. If you're in hurry check the jQuery demo page.

    Populate select menus with jQuery and Ajax

    One of the most powerful jQuery function is the Ajax Suite. This example shows how-to populate a second select menu based on the option from the first select menu.

    Just in case we have this select menu with the main categories:

    Choose: Fruit Grains Vegetables

    If someone has changed the value for this select menu, we want to show the equivalent menu inside the span element with the ID “subcat”. To do this we use this jQuery snippet that makes an Ajax request to a PHP file called “getSubCat.php”. After the select menu is changed a loading image will show up (in case of slow Internet connections), the PHP script is called and the sub-select menu becomes visible.

    $(document).ready(function() { $('#category').change(function() { var category = $(this).val

    Truncated by Planet PHP, read more at the original (another 29362 bytes)

    Tue July 27, 10

    Using HipHop for Static Analysis - Sebastian Bergmann - Planet PHP - RSS

    HipHop for PHP, the source code transformer that turns PHP code into C++ code that can then be compiled with g++, can also be used for static code analysis to find problems in PHP source code.

    sb@vmware Money % hphp -t analyze --input-dir . running hphp... creating temporary directory /tmp/hphp_Zz7AXg ... parsing inputs... parsing inputs took 0'00" (20 ms) wall time inferring types... inferring types took 0'00" (10 ms) wall time saving code errors, dependency graph and stats... all files saved in /tmp/hphp_Zz7AXg ... running hphp took 0'00" (208 ms) wall time

    The script below takes a CodeErrors.js file (which is generated by hphp and in the example above is saved to /tmp/hphp_Zz7AXg) as its input and print an XML document in Checkstyle's format (the same XML format that is also used by PHP_CodeSniffer, for instance). This XML logfile can then be used with Hudson, for instance, in a continuous integration context.


    Keynoting at PHPNW10 - Lorna Mitchell - Planet PHP - RSS
    I'm slightly surprised but mostly wildly excited to announce that I'll be the keynote speaker at the PHP North West Conference in October. It is held in Manchester in the UK, which is about an hour from where I live in Leeds, so it is definitely my "home" conference, and this makes me even more excited since I know I'll be in such great company!

    The talk is Teach A Man To Fish: Coaching Development Teams and really it's about how a little investment of time or effort can build your existing team into something better - and how that team can then sustain its improvements and continue to raise its performance and the game of the individual team members. All in all I am pretty excited about this talk - as with most of my conference talks, it started life as a rant in a bar, and I'm now excited to be preparing it for a more formal setting!

    The event itself is a must-see for anyone doing PHP or allied technologies that can get there (Manchester is pretty central and pretty cheap - if you're in the UK, you have no excuses!). It's a Saturday event, 9th October 2010 and tickets are on sale - the Early Bird prices are still available and we've held the prices as low as possible again, we don't need frills, we just want lots of people to be able to join in! I hope to see quite a few of you there, let me know if you're coming :)

    PHP for Android, PHP 6 canceled, APC in PHP 5.4 - Lately in PHP podcast episode 3 - PHP Classes - Planet PHP - RSS
    By Manuel Lemos
    On this episode of the Lately in PHP podcast, Manuel Lemos and Ernani Joppert comment on the launch of the PHP for Android project and the consequences for the PHP market.

    They also talk about the cancellation of PHP 6 and the inclusion of features planned for PHP 6 in PHP 5.4, like the integration of the APC cache extension in the main PHP distribution bundle.

    Some of the most interesting classes nominated for the May edition of the PHP Programming Innovation Award are commented, like the PDF text extract, PHP duplicate files finder, Fast Fourier Transform and splx_graph.

    PHP 5.3 at New York PHP this Tuesday - Daniel Krook - Planet PHP - RSS
    This month Hans Zaunere and Nate Abele will give us a look at the new features in PHP 5.3 and how they're used in production today. Specifically, these NYPHP regulars will cover three new major language features: namespaces, late static binding, and closures. RSVP now for the meeting at IBM in midtown Manhattan on Tuesday [...]

    ? PHP 5.2 support ends just as its adoption begins - Marco Tabini - Planet PHP - RSS

    In case you missed it, the PHP team has just released 5.2.14, which effectively ends active support for the 5.2 branch1:

    This release marks the end of the active support for PHP 5.2. Following this release the PHP 5.2 series will receive no further active bug maintenance.

    The logic behind this decision is… puzzling.

    Several large projects—WordPress and Drupal among them—recently announced that they intend to push support for 5.2 into their products with their next major release. For example, Drupal 7 will accept 5.2 features, and the WP folks are just working on EOL'ing their support for PHP 4.

    This means that a large number of people are just beginning learning, using and stress-testing PHP 5.2. Remember—these projects have very large user bases, so even moving a small percentage of adopters over to a different platform means a big shift. Perhaps—just perhaps—it might be better to reconsider canning 5.2. If, from a technical perspective, the move from 5.2 to 5.3 is an easy one, there is a huge psychological barrier to finally adopting 5.2 only to have it yanked from under your feet.

    The real issue at hand, however, is the fact that these large user communities are not engaged in the PHP world, and vice-versa. Ignoring the hundreds of thousands of Drupal and WordPress integrators and developers is bad for both PHP and for those products; we should, instead, try our best to open a dialogue between all the communities that are centred around PHP and ensure that everyone's interests are properly represented.

    This is not to say that the fact that WP has only now decided to move to PHP 5.2 should necessarily affect the progress of PHP, nor that the PHP developers should take a “we don't need you” attitude toward projects that are based on the language. Ultimately, it's up to these projects if they want to actively contribute back to PHP or not, and that is the only way for them to effectively affect the development of the language itself.

    However, PHP development is too unevenly connected to downstream adopters. Some—particularly framework makers—have an unusually high level of participation in deciding how PHP evolves, and that needs to change.

    At least year's WDC, a small conference organized by Microsoft, I made this very same point and managed to bring a room full of developers into complete disarray in less than five minutes—which means that, in addition to the fact that my ability to drive a bunch of people up the wall in no time flat has not changed over the years, there is plenty to talk about.

    [Update: the latest 5.2.x release is 5.2.14, not 5.2.11 as I originally stated. Thanks to Ilia for pointing that out.]

  • As I understand it, this means no more added features or bug fixed. Presumably, security issues will still be taken care of. ?

  • GTAC 2010 - Sebastian Bergmann - Planet PHP - RSS

    I have been invited to attend the 5th Annual Google Test Automation Conference, better known as GTAC, in Hyderabad, India in October. I am very much looking forward to discuss cutting edge challenges in test automation and evaluate potential solutions, especially with this year's focus on testability.

    Another thing I like about this year's GTAC is that the participants are responsible for selecting the presentations for the conference. Here is my submission:

    Challenges in Unit Testing PHP Applications

    According to TIOBE, PHP is the most popular programming language after C/C++ and Java. The language has made strong inroads into large-scale, business-critical Web systems. In the six years since the release of PHP 5 -- which not only kickstarted the development of PHP-based frameworks for Web development but also the development of tools for dynamic and static testing techniques -- the PHP community as a whole has developed an increasing interest in developing software that delivers the best possible quality.

    When PHP developers start to write unit tests they rarely find themselves without any constraints that are imposed by prior work of less than optimal quality. It is a well-known fact that writing unit tests for legacy code is hard. In the case of PHP it can be even harder: the legacy code has not only been written without testability in mind, but it may have been written for earlier versions of PHP that encouraged practices that make the code next to impossible to unit test.

    PHPUnit, the de-facto standard framework for unit-testing PHP code, has some unique features not found in other xUnit test frameworks that allow the testing of untestable code. While developers should not use these features (as they are not required when writing tests for testable code), these features ease the pain of writing tests for legacy code and thus help developers get started with unit testing before they refactor the code for testability.

    This session, presented by the creator of PHPUnit, highlights the challenges developers are facing when unit testing legacy PHP code. Some of these challenges will be familiar to developers that use other programming languages such as Java but they will see a new perspective on the problem and different approaches to solve it.

    Although I am hoping, of course, that my submission will be accepted by my peers, I know that GTAC will be valuable for me even if I do not get to present: the "hallway track" of GTAC 2008 was amazing.


    PHPUnit 3.5: Refactoring to Components - Sebastian Bergmann - Planet PHP - RSS

    When you look at the list of changes for PHPUnit 3.5, you will see that many of them deal with refactoring to components. Here is an overview of these new components:

    • PHP_CodeCoverage

      The collection, processing, and rendering of code coverage information has been factored out into a separate component. A bit more information can be found here.

    • PHPUnit_MockObject

      The functionality to automatically generate an object that can act as a test double for a specified original class has been factored out into a separate component. Do not worry, getMock() and related methods will work just as they did in previous versions of PHPUnit. The refactoring, however, makes the usage of other mock object libraries (such as Mockery or Phake, for instance) easier.

    • DbUnit

      The database testing functionality that is provided by the DbUnit extension and the respective DatabaseTestCase class has been moved to a separate component. Michael Lively Jr, the author of DbUnit, is now able to make releases of the database testing extension on a release schedule that is separate from PHPUnit itself, meaning that I will be even less involved in its development than I have before.

    • PHPUnit_Selenium

      SeleniumTestCase, the Selenium RC integration for PHPUnit, has been moved to a separate component to allow a release cycle separate from PHPUnit itself.

    • File_Iterator, PHP_Timer, Text_Template

      Utility methods to collect files and report resource usage as well as a simple templating mechanism have been moved to separate components so that they can be reused by other tools such as phpcb, phpcs, phpcpd, and pdepend.


    The GPL: legit, but may contain malicious code - Marco Tabini - Planet PHP - RSS

    WooThemes's official Twitter account, in response to a request on whether a site giving away all their GPL'ed themes1 for a low fee is in breach of the license:

    [I]t's legit, but we don't promote it as the themes are outdated & may contain malicious code.

    So that's it, then: the GPL is great until someone copies your commercial work and openly resells it, at which point making subtly unfounded allegations is the best way to save face.

  • I'm not linking to it out of respect for the work that actually went into building Woo's themes. For the record, I think that what has been done here is despicable, although it illustrates the weakness of the GPL model that the WPF wants everyone to adopt perfectly. ?

  • Ingewikkeld - Stefan Koopmanschap - Planet PHP - RSS
    Time for a new adventure. Last monday, my wife Marjolein and I visited the local Chamber of Commerce to register our new company: Ingewikkeld. We're both doing completely different things, but we've decided to capture both into a single company because it saves us a shitload of administrative work, and since we're married anyway, it doesn't really matter. I (could you have expected something else?) will be offering (PHP) development, consultancy and training services, and my wife will be a baby wearing consultant.

    Recent performance improvements for Midgard 8.09 - Henri Bergius - Planet PHP - RSS

    Midgard 8.09 is an industrial CMS that is now in Long-Term Supported stage, with the community maintaining it until 2013. As we all know, performance is a feature, and with a CMS framework that has lived through many changes including transitions from PHP4 to 5.2 and from Classic Midgard era to the modern APIs, there is a lot to do.

    For the next 8.09.10 release we decided to put quite a bit of efforts into performance tuning, with some excellent work done by Content Control to simplify ACL handling and cache navigation information. As you can see, the result is quite impressive:

    What is left to be done is some work with the multilingual content database queries. After that we should be good to go with what is probably the fastest Midgard1 ever.

    Tue July 6, 10

    Zend Framework Modules: Autoloading & Namespaces - Court Ewing - Planet PHP - RSS

    Modules are natively supported in Zend Framework, but their implementation is not conducive to flexible autoloading nor the use of namespaces in PHP 5.3. There may be a few contributors out there that will defend the current implementation of module autoloading, but throughout the development lifecycle of the current Model-View-Controller implementation in the framework, poor design decisions have made working with modules less flexible and more frustrating.

    The First Problem

    The problem stems from the initial decisions about the naming conventions for directories and classes for controllers and views. The convention that controllers would be stored in a directory called "controllers" and views would be stored in a directory called "views" throws any attempt at dynamic autoloading immediately out the window. Instead, this single design decision served to ensure that all attempts to autoload consistently-named module-based PHP classes would require some sort of explicit configuration. As a result, many developers decided to put their classes such as forms, models, and mappers into separate libraries — not very modular, eh?

    The Official Solution: AKA The Second Problem

    Enter the current implementation of "resource" autoloading. This greatly anticipated addition to Zend Framework was to solve our insatiable hunger for module-specific classes (hereto referred to as "resources"). The immediate effect was our modules could finally autoload our most used module resources. Unfortunately, every single type of resource has to be explicitly defined for each module! To help make this configuration easier, a "module" autoloader was added to Zend_Application that pre-configures common resources such as models and forms. But think of that for a second. An entire class was added to the framework with no other purpose other than pre-configuring options. If that doesn't scream red-flag, I don't know what does.

    Let's Talk Solutions

    I am extremely opinionated, and I could probably rant for hours about a topic like this, but I digress. Instead, let's look at a proof of concept that I implemented:

    http://github.com/epixa/Epixa

    The premise is pretty simple: modules should be nothing less than near-independent libraries of code. When modules are treated like libraries in their own right, they gain all of the flexibility and speed that we get from autoloading library files. Better yet, the main autoloader in Zend Framework can handle the autoloading all on its own, which means your module resources can be namespaced.

    With extensions in that library, you can achieve a directory structure like the following with little to no configuration:

    What We're Missing

    This is currently to serve only as a proof of concept, so there is still plenty that can be added. For instance, while I updated the dispatcher so controllers are namspaced like "BlogControllerPost", I did not remove the class loading logic from the dispatcher itself. To separate concerns, the controller class loading should be passed off entirely to the autoloader.

    The library also still leaves a lot to be desired when it comes to efficient module bootstrapping and plugin loading. I'll post improvements in both of those regards along with module dependency loading in the near future.

    In the meantime, I would love feedback about this approach. If I can refine it a bit further, I plan to campaign for its inclusion as the standard module setup in Zend Framework 2.


    pkSFX - yet another setup program - PHP-GTK Community - Planet PHP - RSS

    Remember pkTail and pkStart and pkTheme?
    Today, I'm pleased to introduce pkSFX to you.

    All these tools are shipped with the pkTypical pack available at sourceforge.

    Well. Imagine that you have written a new application, or a new version of that app, and now is the time to deploy... This is going to be the easiest task of the project, thanks to pkSFX - Yet Another Setup Program!

    Read more...

    read more


    Webscrapers Mailing List - Matthew Turland - Planet PHP - RSS

    Daniel Stenberg, one of the primary authors of the libcurl library on which the PHP cURL extension is based, was kind enough to comment on and clarify a recent blog post of mine regarding web scraping using the PHP and cURL. He later sent me a tweet to invite me to a new mailing list for web scraping enthusiasts just before tweeting a public invitation. In addition to the mailing list itself, the web site also has links to books (including my book) and popular tools related to the subject. I think this is awesome and I encourage anyone with an interest in web scraping, professional or recreational, to join.


    The Ten Commandments of Open Source - Keith Casey - Planet PHP - RSS

    Update: To be fair, a great deal of inspiration for this post came from Ed "Funkatron" Finkler and his session at phpWorks 2008 Picachu pitch-at-ya peek-at-you lightning talk called "Users are Assholes" and later by Matthew Weier O'Phinney's lightning talk called "How to get kicked off my Project." Thanks for the fodder guys!

    On all sides of software development, there are annoyances. Some of them go beyond annoyances and into pet peaves. Some of them go beyond pet peeves and incite open war within projects and communities. After witnessing a number of these rants - from developers and non-developers - and even sharing a few myself, I thought maybe I could make the situation better.

    Therefore, I present here for comment:

    The Ten Commandments of Open Source Software.

    0. Thou shalt not ask questions without basic research including documentation and the Google.

    I. Thou shalt realize that most developers work on passion and freetime. Thou are not paying them.

    II. Thou shalt not criticize code and architectures before seeking understanding.

    III. Thou shalt not use the phrase "this should be simple" unless thou has confirmed it as such.

    IV. Thou shalt apply patches and updates in a timely manner. Further, thou shalt have a vague idea of when the next release is due-eth.

    V. Honor thy developers and designers.

    VI. Thou shalt include specific error messages and screenshots when thou hast problems. Thou stating "thy software sucks" is not helpful and angers the Funkatron.

    VII. Thou shalt not murder.*

    VIII. Thou shalt not copy without respecting both the license and the terms within.

    IX. Thou shalt not covet the features and functionality in thy neighbor's software.

    Did I miss any?

    * No, I'm not kidding.


    Monte Carlo Simulations - Ian Barber - Planet PHP - RSS

    Monte Carlo simulations are a handy tool for looking at situations that have some aspect of uncertainty, by modelling them with a pseudo-random element and conducting a large number of trials. There isn't a hard and fast Monte Carlo algorithm, but the process generally goes: start with a situation you wish to model, write a program to describe it that includes a random input, run that program many times, and look at the results.

    In each case, you're taking a pot shot at the result, and over many iterations you should get a broad picture of the probabilities of certain outcomes. If these match observations of the real situation, your model is a good one. Alternatively, if you can achieve certain results through randomness that others put down to some other factor, perhaps there is more chance in the real situation that others have expected.

    As an example, lets imagine visiting an SEO expo, filled with 10,000 SEO experts. Now, 20% of the experts are creative copywriters and link profile experts who will help to make your site more usable, more readable, faster, and help drive traffic from disparate sources as they improve your search profile. The others are clueless keyword stuffers and link spammers, who will turn your site into an real mess.

    However, a given rank on a results page is dependent on an awful lot of things - how the site was originally, what other sites are doing, changes to google's algorithms, temporary network and server effects and so on. Because of that, sometimes the bad SEOs get their sites onto the front page, and sometimes the good ones don't. Let estimate that the good SEOs get their site onto the first page under a given term two thirds of the time, while for the bad SEOs it's only one third of the time. Now, whichever SEO you ask claims to be in the good category, of course, so you ask to see the results for the last 5 sites they optimised. If they are all on the first page, can you be confident you've got a good one?

    We can set up a monte carlo simulation for that by simply looping over the five sites, and seeing which ones succeed each time, by chance, and which fail. Starting with our total 10,000 SEO population, how many good vs bad SEOs do we expect.


    Time Machine Forensics - Andrei Zmievski - Planet PHP - RSS

    About a year ago, I finally wisened up to the obvious: 1) losing data sucks, and 2) doing daily (or frequent) backups manually are a pain in the ass, especially for portables. 2) is why most people forgo backups in the first place, resulting in 1). I needed something that I could set up once and pretty much forget about. Thankfully, there was just the thing: Time Capsule  —  a single device that encapsulates both Airport Extreme base station and a huge hard drive, and can be used for automatic, transparent, wireless backups from any of your Mac devices via the Time Machine.

    I purchased the 1 TB version, configured it, and have been using it ever since. It has already saved my butt a couple of times, when I accidentally deleted (rm -rf) a directory and had that familiar sinking feeling, but then remembered that the Time Machine was there ready to lend a hand.

    However, I noticed recently that the hourly backups were taking longer and growing in size, sometimes up to 1GB or more. It didn't seem like there was that much data changing on an hourly basis, so I set out to investigate. A quick look around revealed that the Time Machine itself will not reveal the backup details, but someone wrote a script called timedog that displays the files that the Time Machine backed up during its most recent run (or any of your choosing). The output of the script is something like this (abbreviated):

    # cd /Volumes/Backup of foo/Backups.backupdb/foo # timedog -d 5 -l ==> Comparing TM backup 2010-06-29-160846 to 2010-06-29-101853 399B-> 399B [1] /Mac HD/Library/Application Support/CrashReporter/ [..skip..] 52.6KB-> 53.0KB /Mac HD/Users/andrei/.dbshell 863B-> 866B /Mac HD/Users/andrei/.lesshst 11.0KB-> 15.1KB /Mac HD/Users/andrei/.viminfo 10.4KB-> 30.7KB /Mac HD/Users/andrei/.zsh_hist 6.7MB-> 6.7MB /Mac HD/Users/andrei/.dropbox/dropbox.db 3.9MB-> 3.9MB /Mac HD/Users/andrei/.dropbox/migrate.db 25.2MB-> 50.3MB [10] /Mac HD/Users/andrei/.dropbox/cache/ 21.0KB-> 21.0KB [1] /Mac HD/Users/andrei/Desktop/ 120.0MB-> 120.4MB [1] /Mac HD/Users/andrei/Documents/Linkinus 2 Logs/ 142.8MB-> 146.2MB [156] /Mac HD/Users/andrei/Library/Application Support/ [..skip..] 608.0MB-> 608.0MB [5] /Mac HD/private/var/data/mongodb/ [..skip..] ==> Total Backup: 967 changed files/directories, 1.88GB

    Looking at this, a couple of offenders are immediately obvious. Linkinus (an IRC client) keeps all the conversation logs in one single file, and since I'm frequently on IRC, that file grows and gets backed up every hour. The data files for MongoDB that I use for development are also fairly large and change often. Finally, there is something in Library/Application Support, but it wasn't shown because of the depth limit I set. After increasing the depth to 7, I discovered that it was the Google Chrome cache and history.

    Conversation logs and Chrome stuff are not important enough for me to back up hourly, and MongoDB data I can copy periodically to an off-site server. By excluding these 3 items from the backup process via Time Machine Preferences I was able to reduce the size of the hourlies to 50 MB or less.

    This brings up an important point though: while Time Machine is great for doing automated backups over your local network, you should have a separate copy of the data off-site, for redundancy. How and when to do the off-site backups varies according to everyone's needs, but I would suggest something like CrashPlan, which does unlimited online backups for about $5/month. Once again, it's automatic and hands-off, which is how you want it.

    Tools I found useful while investigating this Time Machine issue:

    Thu July 1, 10

    Session steganography idea - Michael Kimsal - Planet PHP - RSS

    Quick idea I had the other day. Session ID tokens are typically short strings of seemingly random characters. While they don't typically change all that much during a session, it's good practice to change the session ID every so often to help prevent against security attacks. If someone was to periodically change the session ID, and hide a short message in the ID values such that, when strung together, the message could be extracted, would that be a useful way of transmitting data in a hidden manner? I'm not sure of how much info you could reasonably hide in a series of short session IDs, but it seems like this would be possible.


    Creating Zend_Tool Providers - Matthew Weier O'Phinney - Planet PHP - RSS

    When I was at Symfony Live this past February, I assisted Stefan Koopmanschap in a full-day workshop on integrating Zend Framework in Symfony applications. During that workshop, Stefan demonstrated creating Symfony "tasks". These are classes that tie in to the Symfony command-line tooling -- basically allowing you to tie in to the CLI tool in order to create cronjobs, migration scripts, etc.

    Of course, Zend Framework has an analogue to Symfony tasks in the Zend_Tool component's "providers". In this post, I'll demonstrate how you can create a simple provider that will return the most recent entry from an RSS or Atom feed.


    Continue reading "Creating Zend_Tool Providers"

    web2project v2.0 Release Notes - Keith Casey - Planet PHP - RSS

    As of 29 June 2010, web2project v2.0 is officially released! You can download it from SourceForge now.

    Although this release had lots of bug fixes, the primary focus was on a few specific new features and major pieces of functionality. You can read the full v2.0 Release Notes, but in my opinion, the six most important items are:

    • User-based Timezones: Everywhere a time is used or displayed within the system, it's now stored in GMT/UTC and presented in the user's local timezone. If you set a meeting for 5pm America/New_York, someone with America/Chicago timezone will automatically see it at 4pm. If you have team members spread across timezones, this is vital. Lots of thanks to Derick Rethans - the master of all things time-related in PHP - on his numerous presentations on DateTime and Timezones. His information made it possible.
    • Unit Tests have come a long way since the v1.0 release. We had zero at that time but Trevor Morse - founder of the Halifax, NS PHP Group and core web2project member - has led the way to 240+ tests focused on the Tasks and Projects classes.
    • Subprojects are now Useful: Previously you could denote one project as a subproject as another but it didn't really do anything, it was just presented a bit differently. With this release, when you assign a project as a subproject, now it creates a token task within the parent project. This token task takes on the start/end dates, duration, hours worked, and percent complete of the subproject. As the subproject updates, the token task updates. Even more usefully, you can use the Token Task as a dependency for other tasks in the parent project. That all sounds complicated, so just try it out.
    • The class structure has been completely restructured: While this won't be relevant to 99% of our users, it makes it much easier to add standalone frameworks - like the Zend Framework or whatever - to the system for other functionality. On a related point, web2project now supports the naming conventions put forth in the Framework Interoperability Group. This will also allow easier third-party authenticators for systems like Drupal, Joomla, or WordPress.
    • Audit Logs - We cleaned up the core system objects to provide historical logging of all CRUD operations. Any Add On modules that use the core objects will get this functionality by default.
    • Added an 'update checker' - This is a regular script which runs to notify the System Administrator that a new release is available and collects basic system information. This was modeled after Drupal's update functionality. No sensitive information is collected and this can be opted out of via the System Configuration.

    A number of community members stepped up and did a great job in reporting issues, helping test fixes and release candidates, and generally being insightful. Special thanks goes to opto, adolfo, zbyszek, and egemme. Without them, v2.0 would not be as solid, useful, and generally as bug-free as it is.

    In summary, we closed about 79 items with ranging from 15 crash-level issues to 42 minor bugs. Once again, those are just the formally reported issues. If you want to explore everything of interest, check out the web2project v2.0 Release Notes on our wiki. And of course, if you're looking for ways to share your code more easily, you should check out our web2project git repository.

    You can download web2project v2.0 from SourceForge now.

    * And yes, I always wait a few days to announce the releases in case we have to make a patch release. ;)


    Transforming end user queries to Solr - Lukas Smith - Planet PHP - RSS

    A bit less than a year ago I last did a presentation about a telephone book application where we used SQL to do some fairly advanced filtering over about 30 tables of data. The app generated SQL statements that filled pages, the more terms the more pages, but on a 10k dataset it still came back within a few milliseconds, thanks to a ton of indexing and denormalization tricks (SQL Server is a lot more powerful here than MySQL) I had applied. Now in a more recent project I am dealing with 10M+ dataset running on MySQL and so decided to learn about Solr. Wow, that thing is amazing and way more flexible in terms of query language than I expected. As a result I do not see it any more for just projects that are too big for an RDBMS, but more as the way to do search in general. I have mentioned resolutionfinder.org a few times (used to be called UN-informed.org). Solr is a key piece there and more importantly I am looking to expand the use of Solr query language quite a bit. Actually for those who know, you can already do a lot more powerful queries, something Liip will be investing some more time to make more accessible to end users with some UI tweaks planned in July. But in this blog post I want to talk about a prototype class I threw together (Look ma', I'm using git!) by working ezcSearch to help me in parsing and transforming end user queries into complex Solr queries.

    Right now we have 3 input boxes on the resolutionfinder.org start page. The first one lets user input terms which are searched in the document title and the clause content. Here I recently exposed some of the syntax supported by the dismax handler like "+" to require and "-" to prohibit terms. Next is an input box that doesn't directly affect the search filtering. What it does is use auto suggest to build up a list of tag to filter on. The third input box actually is a separate search form entirely which is used for searching for specific documents by document code. My vision is to bring these all together into one input box. So if someone wants to do a fulltext search they could do something like the following:

    "security council" +africa tag:malaria code:A/RES/*

    This query would be parsed and result in looking for documents that must contain "africa" in the document title or clause content (scoring those that also contain "security council" higher), which are tagged with "malaria" and who's document code started with "A/RES/". This requires quite a bit of transformation. Actually the final queries I want to construct looks like this:

    q=tag_ids:23 AND document_code_prefix:(A/RES/) AND (_query_:"{!dismax qf='content document_title' pf='content document_title' mm=0 v=$qq}")&qq="security council" +africa

    So what happened here? As you can see I transformed "tag" to "tag_ids" and "code" to "document_code_prefix". These are the internal fields I use in the Solr index. There is actually also a "document_code" field, which I would use if the code would not end with a "*". The "document_code_prefix" just copies the "document_code" and applies an ngram filter to make prefix searches super fast. Also you may notice that instead of "malaria" I am filtering for 23, this is because right now I just index the tag id's and not the names. The next bit is taking all the un-fielded filters and apply a dismax search handler on them. In order to not require fancy escaping I use "v=$qq" to define that the actual search terms are passed in the "qq" GET parameter.

    With the above mentioned class this sort of thing becomes fairly simple. I am using the symfony sfSolrPlugin, which provides query construction tools via the sfLuceneCriteria object. All I have to do is use the parser to parse the end user query into tokens and then use a custom term class that uses the sfLuceneCriteria instance to handle the serialization.

    Truncated by Planet PHP, read more at the original (another 14976 bytes)

    Last updated : Wed September 8, 10 - 13:41:13



    By G.Bouchayer (SERECOM student) for and directed by Dahu.fr