|
RSS feeds on your webpages Optimized for webmasters |
|
Home
Demo Download F.A.Q. |
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 Mon February 6, 12
New Rockville PHP Group - Brandon Savage
-
Planet PHP
-
RSS
There are lots of active, vibrant developer groups in the DC area: DC PHP, Baltimore PHP, and the Frederick Web Tech group. The DC PHP Beverage Subgroup meets monthly in Northern Virginia. But in the middle between all these groups lies Montgomery County, Maryland. In that area live hundreds of developers who struggle to reach [...]
Revamping my development toolchain - Ben Ramsey
-
Planet PHP
-
RSS
It used to be that once a year I would take a good, hard look at the tools I used and endeavor to learn something new or change my workflow with those tools. However, I've been living the #startuplife for the past two years, so it's been about three years since I last addressed my development toolchain. I decided to come up for air and take some time this weekend to rectify that by addressing five main areas: my terminal emulator, my shell, my terminal multiplexer, my IRC client, and my color scheme—yes, even my color scheme! In addition, I decided to push out my updated Octopress-powered blog, even though things are still a little rough around the edges. Switching to iTerm2I've been a long-time user of Terminal.app, but I had been hearing good things about iTerm2. I actually used iTerm (version 1) years ago, but I switched back to Terminal.app for reasons I cannot recall. Nevertheless, iTerm2 has come a long way, and I wanted to take advantage of some of its functionality like split panes, better full-screen support, etc. So, that was the first major change I made to my tools. Ditching bash for zshBash has been my favored shell since I began using Linux about fourteen years ago. I'd never given much thought to using a different shell, and to be honest, switching shells always seemed a daunting task. I thought I'd have to relearn my way around the shell, and everything I took for granted with Bash would be non-existent in a different shell. Fortunately, this is not true. As it turns out, zsh “can be thought of as an extended Bourne shell with a large number of improvements, including some features of bash, ksh, and tcsh” (Wikipedia). I was able to switch to zsh without ditching my knowledge of bash. As a result, I've gained all the advantages of zsh, which include advanced customization and scripting capabilities, while continuing to provide most (if not all) the same functionality and commands I'm used to in bash. I have much more to learn, though, so if you have tips and tricks, please share. If you're interested in switching to zsh, I recommend checking out oh-my-zsh. It's a framework for managing your zsh configuration, and it contains lots of goodies. In addition, there are great posts by Mark Nichols and Jon Kinney that will get you quickly up-to-speed with oh-my-zsh. The latter post has the awesome title “It's not enough to bash in heads, you've got to bash in minds…with ZSH”. Using tmux instead of screenGenerally, I've really only used screen when I started noticing that my connection to a remote development machine was getting sluggish or I wanted to keep a constant connection to IRC, but tmux has opened my eyes to so many more possibilities that a multiplexer can offer. I've just only started using it, so I can't say much about it, but I encourage you to read Hawk Host's two-part post on tmux. Moving back to irssiI used irssi in a screen session for years. Then, I decided I needed Growl notifications from my IRC client. I quit using irssi in favor of Linkinus. I've used Linkinus for about two years—together with the IRC bouncer znc for some of that time—but I've continued to miss the flexibility and functionality of irssi. On a whim, I decided to switch back to irssi, but it wasn't without so Truncated by Planet PHP, read more at the original (another 3132 bytes) Sat February 4, 12
PHPUnit Plugin For Sublime Text 2 - Stuart Herbert
-
Planet PHP
-
RSS
Sublime Text 2 is a new cross-platform text editor that I've recently switched to. It's still in public beta, but already offers better performance (and battery life!) and a better look (fonts that render properly!) than Java-based IDEs such as Netbeans. One thing it didn't have was support for PHPUnit, so I've made a plugin. It's available to install via Package Control. You Need A phpunit.xml or phpunit.xml.dist FileTo use this plugin, your project needs to contain either a phpunit.xml or a phpunit.xml.dist file. This file contains all the configuration that needs to be passed to PHPUnit. The plugin searches upwards from your code, and will favour a phpunit.xml file over a phpunit.xml.dist file if it finds both. If you don't have one, you need to go and create one now. How To UseIf you have your code open in a Sublime Text 2 window, right-click inside the window to see what your options are:
If you have your tests open in a Sublime Text 2 window, right-click inside the window to see what your options are:
If you're someone who prefers keyboard over mouse, then you'll probably want to run the PHPUnit plugin commands from Sublime Text 2′s Command Palette: You get the same commands that appear on the right-click menu … the right commands will appear for the file that you're currently editing, just as you'd expect. Finally, you can also right-click on your phpunit.xml (or phpunit.xml.dist) file in the Project Sidebar, and run your unit tests using that specific config file. Helpful SnippetsLike TextMate before it, Sublime Text 2 also has a handy snippets feature, where it can insert a pre-crafted block of text (or, in our case, PHP code) to speed up your coding. I'm collecting most PHP-related snippets in my Additional PHP Snippets plugin (hat-tip to Rob Allen for the inspiration for this), but the PHPUnit plugin includes a few PHPUnit-related snippets to help.
Truncated by Planet PHP, read more at the original (another 664 bytes) Fri February 3, 12
/dev/hell Podcast Episode #5 - Brian Moon
-
Planet PHP
-
RSS
I was privileged to be invited to be a part of the /dev/hell podcast this week. Thanks to Chris and Ed for having me on. Check it out. And subscribe to their podcast.
Zend Framework application.ini Cheat-Sheet - Mayflower Blog - PHP
-
Planet PHP
-
RSS
With the release of Zend Framework 1.8 came the long awaited component for bootstrapping a Zend Framework application. Many different bootstrapping-solutions became obsolete with Zend_Application. In the beginning of the framework most developers didn?t give much thought on bootstrapping. Most of the initialisation work was done directly in index.php, the central starting point of the application. Teams often moved that bootstrapping code to a separate configuration script. The solution worked, but many people wanted a more standardised process for application initialisation. Continue reading "Zend Framework application.ini Cheat-Sheet"
Another Serious Security Bug on PHP 5.3.9 - PHP Classes
-
Planet PHP
-
RSS
By Manuel Lemos
PHP 5.3.9 release was mostly meant to fix a security bug, but it introduced a new more serious bug. PHP 5.3.10 was just released to fix this issue.
Meanwhile Debian Linux maintainers decided to stop enabling the Suhosin extension by default. This extension is used by several Linux distributions to provide protection against present and future security bugs of PHP. Read this article to learn more about the just fixed bug what you should do to avoid these security issues. You can also learn more what is the current PHP security status and the importance of the Suhosin extension to prevent PHP security problems.
PHP Summit in München - Sebastian Bergmann
-
Planet PHP
-
RSS
This blog posting is in German as the event it relates to is German-only.Sorry for the inconvenience. Bei allen PHP-Themen zählt nichts mehr als die Praxis. Deshalb bieten wir unsere Power-Workshops interaktiv und mit intensivem Praxisbezug an. Über die behandelten Themen entscheiden die Teilnehmer mit ihren konkreten Fragen. Anstelle von Frontalunterricht erleben sie die Entwicklung von neuem Code unmittelbar. Mit Augenzwinkern und Spaß erläutern Sebastian Bergmann, Arne Blankerts und Stefan Priebsch Entwicklungsmethoden und Tools und stellen Trends und Konzepte vor. Der nächste PHP Summit findet im März in München statt. Und das sind die Workshops: Update PHP: Neue Features und Technologien nutzen Workshop von Sebastian BergmannPHP 5.3 und PHP 5.4 überzeugen im Programmieralltag durch eine Fülle relevanter Vereinfachungen. Lernen Sie die innovativen Features und geschickte Einsatzmöglichkeiten der neuen Versionen kennen. Entdecken Sie das Lösungspotenzial aktueller Technologien aus dem PHP-Umfeld (memcached, ZeroMQ ?) für Ihre Fragestellungen. Weg mit Strubbelcode: identifizieren ? verbessern ? vermeiden Workshop von Sebastian BergmannFrüher oder später wird unsauber geschriebener Code zum Ärgernis. Nicht nur für den, der ihn warten muss. Änderungen und Erweiterungen können im Extremfall den Code unwirtschaftlich machen. Lernen Sie schlechten Code durch statische Codeanalyse aufzufinden und in test- und wartbaren Code umzuschreiben. Lernen Sie mithilfe der SOLID-Prinzipien, nachhaltig wartbaren Code zu schreiben. Best Practices ? aus dem Alltag für den Alltag Workshop von Arne BlankertsNatürlich könnte man das Rad jeden Tag neu erfinden. Meist fehlt dafür die Zeit, Spaß macht es auch nicht und Fehler können sich so immer wieder an denselben Stellen einschleichen. Für die vielen alltäglichen Probleme, die nur geringfügig von schon vorhandenen Lösungen abweichen, gibt es clevere Ansätze, die das Leben leichter machen. In einer komplett vom Auditorium gesteuerten Live Session zeigt der Workshop dafür programmatische Konzepte und lädt zur Diskussion über Tools und klassische Fragestellungen ein. Auf Fehler sicher vorbereitet sein Workshop von Arne BlankertsProgramme und Webseiten enthalten Fehler. Immer. Sie werden sichtbar, wenn Benutzer falsche, ungültige oder unerwartete Eingaben machen, der Zugriff auf die Datenbank plötzlich unmöglich ist oder die Festplatte überläuft. Um solche und andere Probleme sicher abzufangen, gibt es verschiedene Ansätze, die hier vorgestellt und diskutiert werden. Wie man Exceptions richtig anwendet, warum ein eigener Error Handler hilfreich ist und dass Debugging viel mit Sicherheit zu tun hat, vermittelt der Workshop lebendig und anschaulich. Objektorientierte Programmierung (OOP) in PHP I: Basiswissen Workshop von Stefan PriebschDer Workshop klärt die Frage, was es mit der objektorientierten Programmierung eigentlich auf sich hat. Jenseits der bekannten Standardbeispiele führt er praktisch in die OOP mit PHP ein. Dabei werden neben den Grundlagen und zentralen Prinzipien der OOP interessante Features beispielsweise aus der Standard PHP Library (SPL) vorgestellt und ihr sinnvoller Praxiseinsatz vorgeführt. Neben Faktenwissen wird eine Denkweise vermittelt, die es erlaubt, unnötig komplizierte Ansätze von vornherein zu umgehen. Objektorientierte Programmierung (OOP) in PHP II: Aufbauwissen Workshop von Stefan PriebschDer Workshop zeigt Teilnehmern, die mit den Grundlagen der OOP vertraut sind, fortgeschrittene Techniken wie Dependency Injection, abstrakte Klassen, Interfaces und Best Practices für erfolgreiche OOP. Eine Live-Coding-Session macht den Einsatz der vorgestellten Techniken in der Praxis erfahrbar. Außer Faktenwissen zeigt der Workshop, dass gute Lösungen einfache Lösungen sind: Einfache Objekte sind leichter wieder zu verwenden und vermeiden Fehler. PHP-Anwendungen testen: Basiswissen Workshop von Sebastian BergmannDer Workshop vermittelt grundlegende Kenntnisse und Fähigkeiten im Einsatz von PHPUnit bei Unit Tests, Datenbank-Interaktionstests, Edge-to-Edge- Tests und End-to-End-Tests. Sie lernen alles, was Sie über das Schreiben, Ausführen und Organisieren von Unit Tests mit PHPUnit beherrschen müssen. PHP-Anwendungen testen: Aufbauwissen Workshop von Sebastian BergmannPHPUnit clever einsetzen: Die Teilnehmer lernen die besten Praktiken beim Einsatz von PHPUnit und erprobte Strategien bei der Einführung von Testmaßnahmen an vorhandener So Truncated by Planet PHP, read more at the original (another 6664 bytes)
Excited About PHP Again - Brandon Savage
-
Planet PHP
-
RSS
Ten months ago when I started at Mozilla, I began transitioning away from PHP and into Python and Django. This was inevitable: the Mozilla Webdev team favors Python over PHP in almost every webapp (Socorro is the critical exception). However, over time I had become disillusioned with the direction that PHP was taking. The project [...]
Thu February 2, 12
DMSFilter Library 1.0.1 and Bundle - Rafael Dohms
-
Planet PHP
-
RSS
The past weeks I finally had some time to invest in the DMS library again, so i got busy with a few things. I also had to fix a big problem which had gone unnoticed to me, so i have to thank Mr. Guilherme Blanco for pointing it out. Sadly this means a BC break, so please follow and make adjustments. The BC break: ->filter() becomes ->filterEntity()The reasoning here is simple, PHP still supports legacy from PHP4 meaning a function with the same name as the class is understood as a constructor. This generates a few nasty notices, and it made enough sense to rename the function, making it clear like the other ones. The DMSFilterBundleAlong with this i had time to work on building a Bundle so you can plug filtering into Symfony 2 just as you would with validation. Composer supportThis bundle is also available on Packagist, making it easy to install, i'll also add the DMS and Filter library as standalones to this soon. TagsI finally tagged the releases as 1.0, or rather 1.0.1 as i quickly found a few fixes to put in. The rest remains, here are the links: DMS Library: github DMS Filter Library (sub-tree split): github DMS Filter Bundle (sub-tree split): github packagist/composer © Rafael Dohms for Rafael Dohms, 2012. |
Permalink |
No comments
PHP 5.3.10 Released! - PHP: Hypertext Preprocessor
-
Planet PHP
-
RSS
The PHP development team would like to announce the immediate availability of PHP 5.3.10. This release delivers a critical security fix.Security Fixes in PHP 5.3.10:Fixed arbitrary remote code execution vulnerability reported by Stefan Esser, CVE-2012-0830.All users are strongly encouraged to upgrade to PHP 5.3.10.For source downloads please visit our downloads page, Windows binaries can be found on windows.php.net/download/.
Wed February 1, 12
Hey Delta, is it this hard to find an iPad? - John Mertic
-
Planet PHP
-
RSS
So this post is a bit of a rant more than anything, so for the three regular readers of this blog feel free to skip over this post. I promise to make this foray a brief one. I made a blunder on my flight home from Atlanta to Akron/Canton Airport a few weeks ago; I left my lovely, SugarCRM logo and my name engraved iPad safely in it's case in the seat pocket of seat 3A. D'oh! I realized this the moment I got home, and being a bit of a snow storm decided it not prudent to risk life and limb to return to the airport. Calling the airport informing them of this, they took my name and number as said they would ask the Delta desk about this. Being my self driven self, I started tracing the plane, and saw it was doing a CAK-ATL-CAK-ATL-OMA run that day, so figured it would end up in one of CAK, ATL, or OMA ( Omaha for those who aren't as familiar with airport codes ). So I went back to the airport at CAK, and they didn't have it ( but had another iPad someone lost on a plane ), and called OMA, which didn't see it either. My guess is that it's in ATL, but low and behold, THERE IS NO NUMBER TO CALL ABOUT DELTA LOST AND FOUND AT ATLANTA. That's right, nobody to call and ask, nor anyone I could be transfered to that will call there and ask. What do they want you to do? Fill out a web form and hope for the best. Which I did, and all I am left with is hope . So my call to the blogosphere and twittersphere is this: short of going down to Atlanta and stalking the Lost and Found desk, who can I call to help me.
MicroPHP vs Complicated PHP - Lately in PHP podcast episode 20 - PHP Classes
-
Planet PHP
-
RSS
By Manuel Lemos
Earlier in January Ed Finkler announced the MicroPHP manifesto. It seems to be a rant about against the practices of developers that make PHP development more complicated than it should be. This is one of the main topics discussed by Manuel Lemos and Ernani Joppert in the episode 20 of the Lately in PHP podcast.
They also discuss the final release of PHP 5.4.0 and whether you should upgrade it or not, the repercussion of the PHP Hash Collision Vulnerability, as well the trends of PHP world based on the analysis of the PHP Zeitgeist 2011 initiative. Listen to the podcast or read the transcript now to learn more in detail about these interesting PHP topics.
Building a RESTful PHP Server: Output Handlers - Lorna Mitchell
-
Planet PHP
-
RSS
This is the third installment in my series about writing a RESTful web service in PHP. It is probably the last one but there are a few other things I'd like to cover such as error handling, so I might keep adding to it, especially if I get any particular requests or interesting questions in the comments. So far we've covered parsing requests to determine exactly what the user is asking for, and also looked at routing to a controller to obtain the data or perform the action required. This post gives examples of how to return the data to the client in a good way. Output Handlers Instead of ViewsWe'll have as many output handlers as we have supported output formats. The joy of having all the controllers return the data to index.php is that we can then add common output handling to all the data. In our example system, we can remove that ugly print_r from index.php and instead detect which output format is needed and load the relevant view. My code looks like this: $view_name = ucfirst($request->format) . 'View';
if(class_exists($view_name)) {
$view = new $view_name();
$view->render($result);
} The most simple example is a JsonView which looks like this:
class JsonView extends ApiView {
public function render($content) {
header('Content-Type: application/json; charset=utf8');
echo json_encode($content);
return true;
}
} As you can see here, it's pretty simple! We send the Content-Type header first to let the consumer know what's in the response, then we just encode the JSON and echo it out. To support other formats, you might loop over your array (remember it might be nested – things usually get recursive at this point for something like an XML format) and transform it into the new format. Between two PHP systems, it might be simpler to support serialised PHP as a format as it is a little more verbose than the JSON. I also like to support html as an output format - for example the joind.in API does this; just go to http://api.joind.in with your browser and it will realise you're a web browser and return you the html version. Joind.in is open source and since I wrote it Truncated by Planet PHP, read more at the original (another 2412 bytes)
A Tool's Tale - Sebastian Bergmann
-
Planet PHP
-
RSS
When Noah Sussman asked me to give a Code as Craft Technology Talk last week when I was consulting for Etsy I immediately said yes. However, I was a bit surprised when the talk was announced under the title "An Evening with Sebastian Bergmann". When I read that title the first time, it was just minutes after Arne, Stefan and I had talked about one of our favourite scenes from "A Knight's Tale": Chaucer: I'm a writer. Wat: A what? Chaucer: A wha- a what? A writer. You know, I write, with ink, and parchment. Geoffrey Chaucer's the name, writing's the game. You've probably read my book? The Book of the Duchess? No? Well, it was allegorical. Roland: Well, we won't hold that against you, that's for every man to decide for himself. Just like with a talk that I gave last year, I suddenly had a chain of associations in my head that I just had to follow. And down the rabbit hole I went once more ... Hi! I have no idea why this talk is titled "An Evening with Sebastian Bergmann". I hope that this evening will turn into an interesting discussion about PHPUnit and all things testing. To break the ice, and to not appear completely unprepared, I came up with the following slides ... So I recently talked with my friends Arne and Stefan about the movie "A Knight's Tale". Somehow the idea stuck in my head that a variation of that title might be a good idea for a talk of mine. After dismissing "A Fool's Tale" I arrived at "A Tool's Tale". So that's what we're stuck with and what I am going to try right now ...
What I just did was a variation on how Geoffrey Chaucer introduces himself in the movie. Some time in 2001 I started to work on PHPUnit because I wanted to have something like JUnit for PHP. The initial "port" was completed within one weekend. The code was ugly because I had to emulate exception which PHP 4 did not have. On November 27th 2001 I checked the code into cvs.php.net. A lot has changed since 2001. Hopefully not very many developers are still stuck with PHP 4. As of PHPUnit 2.0, which was released on July 14 2004, the day after PHP 5.0.0 was released, PHP 5 is required to run PHPUnit. PHPUnit is neither the only testing framework nor the only quality assurance tool for PHP. Over the last years a nice ecosystem of static analysis tools started to grow. I get this question a lot: why do only Germans work on tools that tell me that my code is bad? I do not have an answer for this, sorry. But the statement is also not true: PHP_CodeSniffer is not developed by a German. PHP has changed and so the have the tools we use to write and maintain code. In 2006 the PHPUnit code was migrated from CVS to Subversion ... Truncated by Planet PHP, read more at the original (another 3751 bytes) Tue January 31, 12
PHP Benelux 2012 – Learning lessons - Rafael Dohms
-
Planet PHP
-
RSS
After hearing about how great PHP Benelux Conferences were I finally made it over to Belgium to check it out, and i was impressed. To catch you up on the new, I moved to Amsterdam last december and thus had the chance of attending the conference which is now 2 hours away on a train ride. I could not expect less of a wonderful conference when names like Michelangelo van Dam are involved and this was no exception. Its a community conference, planned and organized by community leaders and for community members, this is what makes it so amazing that even without a big name behind it this conference can put up quite a show and bring so many sponsors. As I sat there watching the closing remarks I realized other User Groups and conferences have lots of lessons to pickup from this conference. Let me name a few: 1. Value your sponsors. This was very well executed, during the whole event the sponsors had their logos all over the place and the ones who were present had plenty one on one time with conference attendees. Finally during closing remarks each one was mentioned and with a touch of genius their contributions were described, talk about being thankful. 2. Value your speakers. Who would not want to be a speaker at a conference where you get free belgian beer and chocolates at the end? I know i would, and i'm not even a beer drinker. The amount of care put into the speakers is legendary, pickups, great hotel and i can only imagine what else I did not see myself as a non-speaker. 3. Value your attendees. This should be easy, but lots of conferences fail at it. Good sessions, good venue, good food and infrastructure, just make your client feel confortable. Don't make him want, make everything available to him at the venue and keep him around for more networking and fun. 4. Awesome socials are awesome. The social events around a conference are the crowning jewel to the experience, it allows for much more networking and just plain fun and bonding. This is great for speakers and attendees alike, and is usually the moment where great projects take shape. There is a lot to learn from a chat with Ian Barber about public speaking, he even put it in writing. And there was so much more. 5. Make your attendees pay. Yeah, I said pay. Many conferences think that being "open source" means having a free conference, I say "ppfffff". Charge a reasonable "I'm a beginner developer with low income"-price and put up a great conference using that money, and people will pay. If they do not pay their employers will, if neither of them does, the problem is bigger. Surely the people who will be leaving the conference better then they came in will be willing to pay. This also adds value to the conference, makes it an investment. 6. Value the organizers and your volunteers. There was no single-man effort in the conference, they (from what i saw) worked together like a very well oiled machine. Many times did i see all organizers united discussing something and no man was left trying to solve everything alone. Expand your group, get more people, get volunteer and be sure to thank them, give them their "dues", they will give you their all. 7. Have Fun! Events are always stressful, but you would never guess this from seeing the PHP Benelux crew at work. They just had fun with it, enjoyed, worked, solved solvable problems and apologized for unsolvable ones, what more do we need? There are probably more lessons to be learnt here, it was a very well executed event, with great speakers, great guests. Coming from Brazil to such a rich network of PHP events is very exciting for me, I love events and now i have multiple large events all around me. In Belgium I got to see great friends, make new ones, ans most of all realize that it will not be a year before I see them again (yay!). I also picked up quite a few topics to research more and study, as well as being inspired to kickoff new projects and old ideas, the keynotes really did an awesome job to get us inspired. You can be sure to find me around PHP Benelux 2013, I will be putting out my best to be either a speaker or an attendee, but I'll be there for sure. Congratulations PHP Benelux Crew, it was a wonderful show and a great experience. © Rafael Dohms for Rafael Dohms, 2012. | Truncated by Planet PHP, read more at the original (another 1006 bytes)
PECL/mysqlnd_ms: faster slave reads - Internet Super Hero
-
Planet PHP
-
RSS
Why read stale data from an asynchronous MySQL replica (slave)? Fetch it from a local cache instead! Good for the clusters overall load, good for your applications performance. And, possible with PECL/mysqlnd_ms 1.3, the replication and load balancing plugin for PHP MySQL users. The idea is simpleAny application using asynchronous MySQL replication must be capable of handling stale results read from a slave (replica) that is lagging behind the master. The quality of service that the application needs from the database cluster is low. If an application explicitly states the minimum service quality it needs, the underlying systems can adopt to it. That's a cool thing, because the underlying systems don't need to do more work than necessary. In the case of a PHP MySQL user, the first underlying system is the database driver library, which is mysqlnd. Tell mysqlnd that you can deal with data that is as old as five seconds. Then, mysqlnd can search a matching slave lagging no more than five seconds or even replace the slave access with a TTL-based cache access. Cache? Sure, PECL/mysqlnd_qc, various storage backends including main memory, user-defined, APC and Memcache … have a look at the quickstart. It exists…The first step is done. The development trees of PECL/mysqlnd_qc 1.1 and PECL/mysqlnd_ms 1.3 have been de-stabilized. A first, crude approach to make the query cache and replication plugin work transparently together exists.
PECL/mysqlnd_ms 1.2 introduced the mysqlnd_ms_set_qos() function for setting the service level required from the cluster. mysqlnd_ms_set_qos($connection, MYSQLND_MS_QOS_CONSISTENCY_EVENTUAL, MYSQLND_MS_OPTION_CACHE, 5);
If you set the service level as shown above, PECL/mysqlnd_ms does never read from a slave that reports itself to be lagging more than 5 seconds behind the master. If no matching slave is found, PECL/mysqlnd_ms picks the master. Additionally, PECL/mysqlnd_ms tries to cache all slave queries for up to 5 seconds. The cache logic is so, that you never get data older than 5 seconds. The initial cache logicFirst, PECL/mysqlnd_ms asks PECL/mysqlnd_qc if the query is already in the cache. If so, PECL/mysqlnd_ms stops searching slaves, continues working and tries to fetch the results from the cache in the following. If fetching from cache fails, which should happen rarely, it reads the result from a master. In case the query is not cached yet, PECL/mysqlnd_ms searches for all slaves that lag no more than 5 seconds. The cache TTL is reduced by the highest lag found. If, for example, there are two slaves, lagging 2 and 3 seconds behind, the cache TTL is set to 5 - max(2, 3) = 5 - 3 = 2 seconds. MYSQLND_MS_OPTION_CACHE Slave lag TTL Slave 1 5 2 3 Slave 2 5 3 2Then, slave selection continues, for example, load balancing is done. At the end of the chain eventually one slave has been selected. The query is run on the slave and put into the cache for 2 seconds. How the plugins work togetherPECL/mysqlnd_ms does control the cache, PECL/mysqlnd_qc, through SQL hints. PECL/mysqlnd_ms sets exactly the same SQL hints that are also available to the user, as described in the PECL/mysqlnd_qc manual. /*qc=on*//*qc_ttl=2*/SELECT id FROM test
… and tomorrow: a sneak preview of the new built-in pattern based caching for PECL/mysqlnd_qc 1.1. Happy hacking!
Plat_Forms 2012 announcement - Gaylord Aulke
-
Planet PHP
-
RSS
Heise and the university of Berlin just announced the next iteration of the Plat_Forms programming contest. This time, the task all teams need to implement will be more "cloudy", not that frontend-heavy. Hopefully, PHP will perform better than in 2011 this time. If you have a team of 3 PHP developers and if you think you can compete with Ruby and Java: registration is open!
Presentation Tips from Benelux - Ian Barber
-
Planet PHP
-
RSS
I had a great time at the recent PHP Benelux Conference in Belgium. There was a real mix of very interesting people to talk to, and I came away from it buzzing with new ideas (and a ridiculously long todo list). Some of the conversations I had during the weekend were around technical presenting at conferences and usergroups, so I thought I'd collect a handful of the tips that were discussed into a post, and use a few of my favourite speakers at the event to illustrate them. David ZülkeDavid is the project lead on the Agavi framework, and the founder of the consultancy Bitextender. I've seen David speak a fair few times, and for my money he is one of the very best anywhere at presenting technical information in a clear, digestible way - his talk at PHP BNL 12 about Hadoop being no exception. There are principles at work in his presentations that are worth noting: Make concepts concrete with examples and demos - When you're talking about a technical subject, you're usually introducing some technology that the attendees are unfamiliar with. Most conference talks are 45min-1hr, including time for questions, so there isn't time to teach a subject - rather you have to focus on inspiring. This means it's vital to mix conceptual, general information with specific, concrete examples and demonstrations so that people can immediately see applied what you have just described to them. David is brilliant at this, constantly switching between the idea he has introduced, and practical applications. For example, in his PHPBNL12 Hadoop talk he discussed the idea of writing mappers and reducers in PHP, then showed it with actual code examples and a demo. After proving that, he then discussed the value of combiners as a way of reducing data transfer, and then showed that. If he had described them all at once then just showed the final demo, his talk would have been less memorable and less effective. Structure your talk to repeatedly ask and answer questions - One of the worst sins in a technical presentation is to be boring, but that's exactly what many presenters end up with (and I'm as guilty of that as anyone). This usually happens out of the best of intentions, as the speaker wants to introduce sufficient background before moving on to how the subject of the talk solves the problem. Good talks repeatedly introduce problem/solution pairs, so that there is a constant stream of interesting contrast. David is very good at breaking down a problem in to these steps. In his Hadoop talk he bounced between problem and solution very smoothly:
By introducing problems then solutions, he holds the interest of the audience, and naturally splits the information into bite sized chunks. Rowan MerewoodRowan is a technical lead in the Sheffield office of consultancy Ibuildings in the UK, and a conference regular. He spoke at PHP Belenux on project estimation. Care About The Visuals - Presentations, even technical ones, are not about the slides - they're about the speaker. That said, if used effectively slides can make a big difference in how well the audience understands the topic. You don't need a slide for every point, and you definitely don't want to fill your slides full of text, but you should pay attention to making every slide you use, clear, effective, and attractive. Slides form the back drop, and particularly on a large stage you can be quite a small figure walking in front of a big glowing wall of picture or code. Rowan always puts a great deal of effort into coming up with a theme for his slide design, and it immediately sets the tone for his presentations. Take a look at the day of the dead style figures in his estimation talk, the comics and characters from his legacy code presentation or the Alice in Wonderland theme in his depedency injection talk. Not only are these vi Truncated by Planet PHP, read more at the original (another 4831 bytes)
Phix 0.15 Released - Stuart Herbert
-
Planet PHP
-
RSS
Phix v0.15 is now available from pear.phix-project.org. This release is dedicated to my Dad, Leslie Herbert, who passed away in December 2011 whilst I was recovering from surgery. He was always encouraging me to spend as much time as possible working on my own software, and I'm sure he'd be happy that his PC has become my new dev box for working on things like Phix. What's New In This Release
A big thanks to everyone who attended my workshop at PHPNW11 in October for their feedback and feature requests for this release. How To InstallTo install Phix, we have handy one-line install scripts on the Phix project homepage. And I've put together a screencast of how to install Phix on Ubuntu. It's my first ever screencast, so please be gentle :) How To UpgradeTo upgrade from an earlier release of Phix, please do the following: sudo pear clear-cache sudo pear upgrade phix/phix4componentdevOnce you've upgraded phix itself, don't forget to go into each of your components, and run phix php-library:upgrade .to upgrade all of the skeleton files (build.xml et al) for your component. What's Coming In Phix 0.16Windows support hasn't happened yet, but I hopefully have a volunteer who is going to look into that during February. My priority for phix-0.16 is to make it easy to build phix-based components in Jenkins, based on Sebastian's Jenkins Template. I'm doing this next because I'm not sure how much I've got to change things to suit Jenkins, so I'd rather get it done sooner so it's done and out of the way. (And I promise that I haven't forgotten docblox support either …) Our roadmap has all the details.
High quality JavaScript - Qafoo - PHP
-
Planet PHP
-
RSS
It's time for something big: Qafoo goes JavaScript and from now on provides expert consulting, training and engineering for the full stack of your web application. We warmly welcome Jakob Westhoff, a well-known expert for PHP and JavaScript, in our team.
Roo J Solutions Limited is recruiting - Alan Knowles
-
Planet PHP
-
RSS
Article originally from rooJSolutions blog
Since we have been very busy already this year, I have now almost completed the process of migrating from a Sole Proprietor into a Limited Company. Roo J Solutions Limited is now a registered Hong Kong Company. We are now looking for full or part-time staff (based in Hong Kong).
Please read the full post for details.
Mon January 30, 12
Explore Cairo your self without a manual or tutorial - PHP-GTK Community
-
Planet PHP
-
RSS
There are some very good tutorials for doing some basic or a bit more advanced things in php gtk cairo. However it is logical that they do not cover everything. But luckily one can go further in using cairo by him self, I provide a single and very simple example script that allows you to discover all by your self things like:
Getting a descendant (child) widget by name - PHP-GTK Community
-
Planet PHP
-
RSS
This script gets a descedant (child) widget by name using recursion. A name should be defined for the child previously, if not as a name is considered the class name. The name is passed as a variable by reference, when the target is found it is stored in this variable.
PHP 5.4 Features: Shall you Upgrade to the newer PHP Version? - PHP Classes
-
Planet PHP
-
RSS
By Manuel Lemos
PHP 5.4 is being released after many months of development and tests.
Read this article to get a brief overview of the features of this new release and learn about criteria that you may follow to decide if and when you should upgrade to the new version.
PHP 5.4 Built In Webserver - Lorna Mitchell
-
Planet PHP
-
RSS
One of the big features arriving with PHP 5.4 is the addition of a built-in basic webserver for use in development environments. Quite a few of the other scripting languages have something like this so I'm very pleased to see it in PHP. Using a server like this makes it easy to quickly try out some scripts without needing to configure apache or really do anything much! I had to look up a few things to get started, so I thought I'd write them down for posterity. Get the Server RunningThe server runs when you pass the -S switch to PHP on the command line. I had actually compiled PHP 5.4 alongside my existing PHP 5.3 installation, using instructions from an earlier post, and I just specified the full path to the version of PHP I wanted to run). You then supply the server name and port number: php -S localhost:8080This gives some initial output, and then information about each request as it comes in: PHP 5.4.0RC7-dev Development Server started at Sun Jan 29 16:40:49 2012 Listening on localhost:8080 Document root is /home/lorna/test Press Ctrl-C to quit. [Sun Jan 29 16:40:55 2012] 127.0.0.1:46713 [200]: / [Sun Jan 29 16:40:55 2012] 127.0.0.1:46714 [404]: /favicon.ico - No such file or directoryBy default, the current directory is your webroot and you can now request whatever files are here, and run PHP in the usual way. You can also edit and save those files and re-request them without restarting the server, just as you would with a normal webserver (something I love about PHP). The port number can be absolutely anything that you're not already using, I've seen examples with 8080, 8000 and even 1337 - you can use whatever you like. If you pick a port that something else is using, you'll see an error Failed to listen on localhost:8080 (reason: Address already in use) Changing the DocRootIf you want to run the server from one place and point it at a document root in another location, simply use the -t flag, followed by the path to the new docroot: php -S localhost:8080 -t /var/www/awesomecodeBear in mind that the webserver will run as the user you run this command as, so that user will need to have access to those files. Webservers such as apache often run as other users, but this one will probably run as you. Routing Requests Like Apache RewriteOne immediate feature that I was looking for was the ability to redirect all incoming requests to index.php, which I usually do with an .htaccess file. This webserver doesn't support those (although my good friend Josh has created something pretty close) but it does support a routing file. There's a great example in the manual of doing this which I used for reference. You create a file routing.php in the same directory and this becomes your front controller, looking like this: if (file_exists(__DIR__ . '/' . $_SERVER['REQUEST_URI'])) {
return false; // serve the requested resource as-is.
} else {
include_once 'index.php';
} (this code taken entirely from this internals post as linked from the user contributed notes. It works like a charm but I can't take the credit for it!) This allows you to serve any files which are access by path in the usual way, but then redirect all other requests through to index.php. It's such a common use case and I'm very pleased so see the examples already in th Truncated by Planet PHP, read more at the original (another 1355 bytes) Fri January 27, 12
Static Analysis with HipHop for PHP - Sebastian Bergmann
-
Planet PHP
-
RSS
In July 2010 I already blogged about the fact that 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. Today I started to work on a convenience wrapper for HipHop's static analyzer: ? ~ hphpa /usr/local/src/code-coverage/PHP hphpa 1.0.0 by Sebastian Bergmann. /usr/local/src/code-coverage/PHP/CodeCoverage/Filter.php 206 TooManyArgument: $this->addFileToWhitelist($file, FALSE)Of course the tool can also generate an XML logfile in a format that is suitable for continuous integration: ? ~ hphpa --checkstyle hphpa.xml --quiet /usr/local/src/code-coverage/PHP hphpa 1.0.0 by Sebastian Bergmann. ? ~ cat hphpa.xml addFileToWhitelist($file, FALSE)" source="TooManyArgument"/> Wed January 25, 12
Mockery 0.7.2 Released (And On Packagist.org!) - Pádraic Brady
-
Planet PHP
-
RSS
Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its core goal is to offer a framework for creating test doubles like mock objects through the use of a simple and succint API capable of clearly defining all possible object operations and interactions using a human readable Domain Specific Language (DSL). Designed as a drop in alternative to PHPUnit's phpunit-mock-objects library, Mockery is easy to integrate with PHPUnit and can happily operate alongside phpunit-mock-objects. Today, I am pleased to announce the release of Mockery 0.7.2, a maintenance release fixing a small number of bugs and annoyances. A special thanks to all those who forked the Github project at and submitted pull requests! Leaving a developer with hardly any work to do other than a quick test and merge is always appreciated! You can install or upgrade to the new version from the survivethedeepend.com PEAR channel. Another piece of news is that Mockery is now available on Packagist.org for users of Composer. Composer is a tool to help you manage your own projects' or librarys' dependencies and it can handle and mix dependencies from Composer compatible repositories like Packagist.org, any git repository using tags, and any PEAR channel. I do this of my own free will and not because Luis Cordova and Benjamin Eberlei are standing behind me with pitchforks . The more pertinant fixes include: Users should also note that Hamcrest 1.0.0, which includes a small filename change (hamcrest.php was capitalised to Hamcrest.php), was released several days ago. If you use Hamcrest matchers with Mockery, you should ensure that both libraries are updated on your system. As always, please report any bugs or potential improvements to the Github issue tracker using the relevant label or, even more appreciated, send me a pull request.
Create your own framework... on top of the Symfony2 Components (part 12) - Fabien Potencier
-
Planet PHP
-
RSS
This article is part of a series of articles that explains how to create a framework with the Symfony2 Components: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12. In the last installment of this series, we have emptied the Simplex\Framework class by extending the HttpKernel class from Symfony. Seeing this empty class, you might be tempted to move some code from the front controller to it: Tue January 24, 12
PECL/mysqlnd_qc: query cache statistics log - Ulf Wendel
-
Planet PHP
-
RSS
Is it worth the efforts to cache the results of a MySQL query at the client? In most cases the answer is: try it, measure it! Install the development version of the mysqlnd query cache plugin, which can be used with PDO_MySQL, mysqli and mysql. Set three PHP ...
Top Ten Reasons To Go To DrupalCon Denver - Larry Garfield
-
Planet PHP
-
RSS
You mean you aren't already attending what will likely be the largest web developer conference in the Western US this year? What are you waiting for? Not sure if it will be worth it? It will be. Oh, it will be... If you still need some convincing, or if your boss still needs some convincing, here's the top ten reasons you want to be at DrupalCon Denver:
Last updated : Mon February 6, 12 - 21:15:04
|