php|architect: Programming: you're doing it wrong
In an opinion piece posted to the php|architect site Marco Tabini suggests that we (as developers) are doing it wrong as we move further and further away from the pragmatic side of programming into the abstract.
No matter how advanced the techniques that we use, there is always something that we could be doing better. [...] Which one is right? The real problem is that the answer to that question is, "yes." That's because it lacks a specific context in which it can be inserted.
He suggests that, in our quest to figure out what the perfect case for any situation, we stop focusing on the practicality of writing applications to accomplish goals. Sometimes it's not about getting the right theory behind the code - sometimes it's just doing it.
Brian Moon's Blog: PHP command line progress bar
Brian Moon has a quick post that links to a but of code that gives you a progress bar for the command line that's flexible enough to be used in an number of situations.
Was just looking through some code and came across this function I wrote some time ago. If you do a lot of your processing scripts in PHP like we do, you probably need to know what is going on sometimes. So, I made a progress bar for use on the cli. I thought I would share it.
You can see a demo of it here (screencast) or just download the code. Comments on the post also point out the PEAR Console_Progressbar package and the ez Components class for creating a more advanced progress bar.
Alan Skorkin's Blog: How To Fix The WP-Syntax Special Character Escaping Issue
Alan Skorkin has a recent post to his blog about a trouble that many WordPress users have come across in working with their content and the WP-Syntax plugin (for displaying code) - a special character escaping bug that escapes characters that don't need it.
Suffice to say, [WP-Syntax] does the job fine except for one very annoying issue. Whenever you have any kind of special characters in your code (which you inevitably do e.g. <, >, & etc.), these always render as their escaped representations.
It only happens with the WYSIWYG editor for writing content (which the tool's FAQ recommends turning off) but there's a better solution that Alan found - change a line of code in the plugin to use the htmlspecialchars_decode function to rid your install of this pesky escaping bug.
Eli White's Blog: An intriguing use of lambda functions
In a new post to his blog today Eli White takes a look at an interesting use of lambda functions he's figured out for a his development at work.
I found a very specific use out of the blue of Lambda functions that I have now used and I see as a great use-case. Which is specifically passing functions/logic from your Controller to your View. In the case of Goodsie, I'm using PHP for my templating language and as usual I'm trying to remove as much logic from my View as possible, while still allowing the view to be malleable.
His method centered around a pagination subview that he wanted to make flexible enough to work with both the standard page view and with an ajax request. Lambda functions came to the rescue by dynamically creating a function based on the request need.
Site News: Blast from the Past - One Year Ago in PHP
Here's what was popular in the PHP community one year ago today:
Perplexed Labs Blog: PHP Forking to Concurrency with pcntl_fork()
On the Perplexed Labs blog there's a recent post looking at how to fork processes in PHP with the help of the pcntl_fork function and the process management extension.
Let's say you want to take advantage of more than one core for a given process. Perhaps it performs many intensive computations and on a single core would take an hour to run. Since a PHP process is single threaded you won't optimally take advantage of the available multi-core resources you may have. Fortunately, via the Process Control (PCNTL) extension, PHP provides a way to fork new child processes.
He gives a quick snippet of code showing how to spawn off a few new processes, get their process IDs and watches a max number of children until one dies (then starts another).
Community News: Microsoft Returns with The Ultimate Coder Battle
Microsoft is back with another round of their Ultimate Coder Battle for Canadian developers wanting to create Windows-based PHP applications for some great prizes (like a Dell computer makeover or a Dell notebook).
Now's your chance to put those skills to the test, going toe-to-toe with Canada's best and brightest web developers during the FTW! Coding Competition. Choose your weapon...ahem...language and platform to develop the next great Canadian Web App. Walk ten paces, turn, and…dazzle the country with your incredible new app!
You can get the full details about the competition from the FTW Coding Competition site including information on the rules, what kind of platform your application needs to run on and what kind of data it needs to use. The deadline for signups is April 20th, 2010 so get those ideas in and get started developing!
Webitech.net: Create an Impressive Content Editing System with jQuery and PHP
On Webitech.net there's a new tutorial showing how to combine PHP and jQuery to create a simple content editing system when you don't need a full-blown CMS to manage the pages of your site.
I'm going to show you how to use jQuery and PHP to build a content editing system that will allow you or your client to easily edit .html pages visually. [...] Our file structure is going to be really simple - just admin.php, the wymeditor package and jquery together in the demo directory.
The tool uses PHP's file_get_contents to pull in the source of the page into a textarea and edit it with jQuery and the WYM Editor. Full code is included for your cut and paste pleasure but if you need a quicker fix, you can download the source. There's also a demo to see it in action.
php|architect: It's not all about the code
In a recent (quick) post to the php|architect site Koen Van Urk reminds us that it's not all about the code, there's planning to consider too.
Sure, it is important to have your code as bug free as possible, well documented and as optimized as possible. It is, however, impossible to achieve this all without prior planning. Good project coordination.
He suggests one of the most useful and reliable forms of planning and defining the requirements for an application - writing them down on a normal piece of paper. Then from there let the ideas flow with things like look and feel, mapping out page structure, etc. Website planning tools are good, but when it comes down to basic prototyping, sometimes there's just nothing better than a pencil and a few sheets of plain white paper.
Brian Swan's Blog: mssql vs. sqlsrv: What's the Difference? (Part 1)
In a new post to his blog Brian Swan compares the database drivers for MSSQL and SQLSRV by what they have to offer and what the real differences are to your applications.
In this post I want to begin looking at some of the differences between the two drivers and perhaps gain an understanding of why the mssql driver continues to be used (although I have some good guesses). There are lots of comparison points between the mssql and sqlsrv drivers. I'll break my comparison into two posts, focusing on high-level differences in this post and then dive into an API comparison in the next post.
This first of the two parts looks at some of the differences between the two - the Microsoft support for the sqlsrv driver vs community-driven mssql and the fact that they're very different "under the hood" (see this diagram).
|