I'm not sure when this came out, but Google now has source code search. These guys never stop amazing me.
So what you need to do now is create a new bookmark in firefox. Point it to: http://www.google.com/codesearch?hl=en&q=+lang:php+%s
Give it a name and in the keyword field, put something like 'phpcode'. Save it.
Now in your address bar, type 'phpcode array_merge' and return.
tips
Google Code Search
Spam: The Final Solution
Submitted by Harry Slaughter on November 15, 2006 - 5:15pmUntil the mid 90s, spam was a non-issue. It was exciting to get email. The web was also virtually spam-free. Netizens respected one another and everything was very pleasant. Those days are long gone. Fortunately, there are some pretty amazing tools out there for fighting email spam. I use a combination of SpamAssassin on the server side and Thunderbird (with its wonderful built in junkmail filters) on the desktop. I am sent thousands of spam messages a day that I never see thanks to these tools.
But approximately five years ago, a new type of spam emerged which exploited not email but the web. Among this new wave of abuse, my personal favorite, comment spam.
I love getting comments on my blog. I also like reading comments on other blogs. However, it's not practical to simply allow anyone who wants to leave a comment, as within a very short period of time, blog comments will be overrun with spam generated by scripts that exploit sites with permissive comment privileges. To prevent this, most sites require that you log in to post a comment. But this may be too much to ask of someone who just wants to post a quick comment as they pass through. I often come across blog postings which I would like to contribute to, but I simply don't bother because the site requires me to create an account (which I'd likely only use once) before posting a comment. Not worth it. Another common practice is the use of "captchas" which require a user enter some bit of information to prove they are human and not a script. This works fairly well, however, it is still a hurdle that must be jumped before a user can post a comment. And as I've personally learned, captchas, particularly those that are image based, are prone to problems which may leave users unable to post a comment at all.
Opcode Cache for Dummies
Submitted by Harry Slaughter on November 12, 2006 - 6:40pmPHP is an interpreted language. This means that each time a PHP generated page is requested, the server must read in the various files needed and "compile" them into something the machine can understand (opcode). A typical Drupal page requires more than a dozen of these bits of code be compiled.
Opcode cache mechanisms preserve this generated code in cache so that it need only be generated a single time to server hundreds or millions of subsequent requests.
Enabling opcode cache will reduce the time it takes to generate a page by up to 90%.
PHP is known for its blazing speed. Why would you want to speed up your PHP applications even more? Well, first and foremost is the coolness factor. Next, you'll increase the capacity of your current server(s) many times over, thereby postponing the inevitable need to add new hardware as your site's popularity explodes. Lastly, high bandwidth, low latency visitors to your site who are currently seeing page load times in the 1-2 second range will be shocked to find your vamped up site serving up pages almost instantaneously. After enabling opcode cache on my own server, I saw page loads drop from about 1.5 seconds to as low as 300ms. Now that's good fun the whole family can enjoy.
Doing Drupal development effectively
Submitted by Harry Slaughter on July 22, 2006 - 8:22pmClients seem to come in sets. A couple months back, I had several clients who had hired cheap off-shore companies 12 time zones away whose developers were curiously unavailable by phone, email or carrier pigeon. You probably already know the rest of the story: client needed to spend more money to have someone else go in and try to make it all work. (BTW, always use the term "refactored" rather than "threw out" when referring to the busted up stuff the client paid for).
Lately the theme has been clients who hired a 'Drupal developer' to do custom development and ended up with hacked up Drupal core, semi-working custom functionality and lots of odd behavior in different parts of the system. As an intelligent, hip, effective web entrepreneur, you should not strive for this.
Gumby -vs- Pet Rock
The typical LAMP application is made up of a tightly coupled set of code that all works in unison. While you may be able to configure this type of application, you cannot easily create or remove core functionality yourself. There is absolutely nothing wrong with this approach if you're developing a closed system designed to be maintained by a relatively small group of developers and whose feature set is pretty easy to anticipate and can be built in from the ground up. But this approach is not a good one for something like a CMS.
Why, you ask? Well, this is quite a coincidence as I was just preparing to answer that very question. Unlike more specialized applications (think phpbb, phpmyadmin, photo galleries, etc...), a good CMS is something that you should be able to extend, possibly in ways never imagined by the authors of the software. This type of extensibility separates applications like Google Maps from MapQuest. Like Gumby, Google Maps can be made to do any number of things never thought of by Google (from a developers perspective). And like a pet rock (did I just give away my age?), MapQuest pretty much does what it does, and if you want it to make it do something else, that's too bad, you should be using Google Maps, fool!
Dreaded blank page of death
Submitted by Harry Slaughter on July 10, 2006 - 11:53amA search for "blank page" of the Drupal.org domain yields about 37,000 results.
This is probably one of the more common and frustrating problems for Drupal admins.