Better Code Through Destruction
688508
Perl 5's reference counting scheme almost always keeps memory usage predictable...except for one corner case. The Resource Acquisition Is Initialization strategy helps avoid memory leaks--and can improve your use of exceptions, alarms, other resources, and even transactional systems. Igor Gariev demonstrates.
699435
A researcher has posted proof-of-concept code for a zero-day flaw within Mac OS X dealing with its handling of disk image (.dmg) files. The issue causes a memory corruption vulnerability that could allow attackers to execute arbitrary code.
146149
An introduction to using refactoring, unit testing and ZenTest on existing code.
565800
Flawed software code used by numerous Microsoft applications to render images mean that a specially constructed image file could hijack a computer or spread a virus.
256980
A little while back Matthew Turland posted about something that some developers moving over to PHP from more strict languages have an issue with - variable typing - and how its evolved in languages over time.   Without a little background in programming languages or computer science in general, it's entirely possible that typing systems are not something that have crossed your mind. I thought I'd take a blog entry to share some of my thoughts on how itÃ¢ÂÂs affecting the creation and evolution of languages.   He walks through history a bit, mentioning C, Java, Python and PHP and how they differ in their default type handling. He especially focuses on the "blurred line" between strong and weak typing and how some if offers special features to the language that uses the method.
513650
In his latest post, Jacob Santos talks about global functions and some of the dangers behind using them in your code (as per his own experience debugging with them in place).   When I develop in PHP and code functions, I always either place them in a file or place them at the top of the script. Well, this is more about C++ and how I totally freaked out my teacher, by breaking his paradigm of thought. You see, you can have a definition of a function at the top of the page and then code the body of the function later.   He soon discovered his problem in debugging the script - he was too used to having the global functions at the top (as in C++) and not mixed in with the code - or at the bottom of the script.    If there is something at least somewhat common about popular scripts that people use and extend, is that the functions are placed in organized manner. Reforming otherwise is a bitch and I remember rewriting the entire script anyway. You can't reform when you can't reuse anything.
678152
In a new post on the Splitbrain blog today about creating and working with Semacode and QR Codes, specifically with PHP functionality.   I was more interested in Semacode, because it looks somehow cooler than QR in my opinion. Unfortunately I wasn't able to find any free (beer and speech) PHP library to create these codes.   He did, however, find a Javascript port (from a C library) to harvest the logic from and create his own PHP class to handle the semacode creation. He notes that it's probably still a bit buggy but is offering it for download to whoever might want to mess around with it.
489518
On his blog today, Alex Netkachov has posted a suggestion of how to combat a common issue facing PHP scripts - their memory usage.   PHP has a build-in garbage collector so you do not need to track the links on the objects, allocate memory for objects and delete them when they are not longer necessary. Things seem so perfect that developers do not even know that their scripts allocate a lot of memory until their server stops processing requests because of the out of memory error.   His example is the processing of a parent/child relationship tree. If not managed correctly, the variables being used could get out of hand quite quickly. Alex recommends the use of a "destructor" at the end of each iteration to help destroy variables and values no longer needed.
689192
Finishing off their series on destructors in PHP5 applications today, DevShed has posted this new tutorial showing how to manually run the destructors of your class (in case there's ever a need).   In this final tutorial of the series I'm going to show you how to manually trigger a destructor, and in addition you'll learn how to emulate the behavior of this magic method when using PHP 4.   They not only talk about how to call the destructor manually but they also show how to call multiple destructors at the same time to destroy lots of objects at once. And, as promised, they include a method for being able to use a destructor-like bit of functionality in a PHP4 app as well.
620094
roundup Free-roaming source code breeds new Netsky pest. Also: From IE to Opera, browsers are a likely prey.
755326
Back in the days of stone knives and bearskins applications were  things that were written in cretinous languages like COBOL that  ran on wierd 71 bit architectures and used messed up file formats like  JCL and VSAM files or whatever.  What's a 'Data Division'?  Some whiny  80s band from Manchester?      Of course today we are so much  smarter.  If you look at the evolution, from ML, to branched languages  to structured programming to OOP, and from 3270 applications, to PC  apps to client server to web apps, you can clearly see how the  applications programmer transformed himself from knuckle dragging  simian to homo sapiens. That's the stereotype, right?    We have a name for all that old stuff, a pejorative name:  'legacy'.[1]   I'm here to tell you that the web application is the new  legacy.
449459
DevShed continues their series looking at some of the fundamentals of working with PHP in this new tutorial posted today. It looks at one of the flow control statements the language has to offer and a very useful data structure - the switch statement and arrays.   In our last exciting adventure (back in early November), we braved crocodiles, ravenous editors, most of the PHP statements, and beginning loops. In this edition we'll cover the final statement, the Switch, and discuss arrays. So sit back, order your R2D2 robot to bring you a cold, frosty Jolt Cola, and let's get cracking.   They start with a simple example of a switch statement (to echo out strings) and follow it with a detailed description of the different sorts of arrays - numeric indexed, associative and multidimensional versions.
480373
About 25% of a developer's time is spend searching for information. It's time well spent, though -- finding reusable code can get a project done on time and with high-quality results.
558542
Easy-peasy-sleazy: A new piece of PHP code making the malware rounds can install a phishing site on a compromised server in about two minutes.
621839
"Rubinius is a project to watch", so says Charles Nutter in his post Rite, Rubinius, and Everything &mdash; I think he's right.  Evan is hard at work making things work better in rubinius.  He's now got continuations working (I think this makes him the first alternative implementation of Ruby to do so), and says he should have serializable continuations soon (see his post on it here).  W00t!
378782
Simple to code does not always mean simple for the user. And simple for the user is often not easy to code.
194190
Matthew O'Phinney has two new posts that talk about something object-oriented developers seem to shy away from - globals in their classes and how they can make things more difficult to make "embeddable applications" a reality.   In my previous entry, I ranted about the use of globals in popular PHP applications, and how they make embedding said applications difficult. I develop using object-oriented practices, and can honestly say I can't recall ever having slung a global variable around in my own code. Globals seem hackish to me, and as a result, trying to get applications that use them to behave correctly has been a challenge.   In the first part, he notes an interesting find about the $GLOBALS value and illustrates with a code example how he was able to get around it in his instance (wrapping a Serendipity instance in a Zend Framework app).   In part two, though, and uses another code example to show what kind of issues he was seeing with the $GLOBALS - a script that sets some globals in different instances and echoes the results back out.