Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

NetTuts.com:
Refactoring Legacy Code: Part 2 - Magic Strings & Constants
Apr 03, 2014 @ 17:47:46

NetTuts.com has posted the second part of their "Refactoring Legacy Code" series today continuing on from their beginning of the series. They continue the refactor of their "trivia" application.

Old code. Ugly code. Complicated code. Spaghetti code. Jibberish nonsense. In two words, Legacy Code. This is a series that will help you work and deal with it. We first met our legacy source code in our previous lesson. [...] The time for the first changes have come and what better way to understand a difficult code base than start to extract magic constants and strings into variables? These seemingly simple tasks will give us greater and sometimes unexpected insights into the inner workings of legacy code. We will need to figure out the intentions of the original code author and find the proper names for the pieces of code that we've never seen before.

They talk about refactoring out things like "magic strings" and other hard-coded return values and checks. They mention updating the tests to reflect these changes while keeping an eye out for "magic constants" as well.

tagged: refactoring unittest magic string constant trivia

Link: http://code.tutsplus.com/tutorials/refactoring-legacy-code-part-2-magic-strings-constants--cms-20527

Brian Teeman's Blog:
Who is the Joker in the Joomla pack?
Mar 05, 2010 @ 20:05:13

A fun bit of trivia for the Joomla users out there from Brian Teeman's blog today - why the default user ID is 62 and how it could effect your site's security.

Andrew attempted to give the most complete answer but the truth is the answer is lost in the dim and distant past. There is nothing you can do about it. On every install a superadmin user is created with username "admin" and userid "62".

Since this is a common "feature" of the older Joomla installs, it could potentially be used in a sort of attack on the site. Fortunately, as of the Joomla 1.6 release, the installation allows you to select a username of your own (while still suggesting "admin") with a new change to the user's ID - 42 instead of 61.

tagged: joomla trivia admin user security

Link:

Zend Developer Zone:
PHP/ZendCon Trivia on twitter
Aug 05, 2008 @ 14:31:13

As the time for this year's Zend/PHP Conference & Expo grows closer, there's more and more talk about who'll be there and what will be talked about. The Zend Developer Zone is taking the opportunity to do a little looking back - and having some fun in the process. They're hosting a ZendCon trivia contest for some fabulous prizes.

Let's have a little fun, shall we? Here is what we'll do. I'll ask ZendCon or PHP trivia via twitter (http://twitter.com/zendcon) and the first person to email me the correct answer at contest@zend.com will win a prize.

Up for grabs are ZendCon trading cards, books, elePHPants and copies of Zend Studio. Remember, you have to be following zendcon on twitter to get the questions and answers must be submitted via email (no DM, IM, tweets or IRC answers will count).

tagged: zendcon2008 zendcon2009 trivia contest email twitter zendcon

Link:

Adam Trachtenberg's Blog:
PHP Trivia Contest: DOM + Default Namespaces
Sep 27, 2006 @ 12:25:00

Alright power PHP users out there, Adam Trachtenburg has a little quiz for you to see how much you know about working with the DOM in PHP.

Here's a question based on a recent PHP bug report which shows why DOM is fun. [...] But how do you retrieve it (the namespace URI of the root node) using DOMElement::GetAttributeNS()? What are the two magical input parameters to coax that value out?

The code is simple, but it's an interesting problem - anyone have any answers?

tagged: trivia contest dom handling namespace uri root node trivia contest dom handling namespace uri root node

Link:

Adam Trachtenberg's Blog:
PHP Trivia Contest: DOM + Default Namespaces
Sep 27, 2006 @ 12:25:00

Alright power PHP users out there, Adam Trachtenburg has a little quiz for you to see how much you know about working with the DOM in PHP.

Here's a question based on a recent PHP bug report which shows why DOM is fun. [...] But how do you retrieve it (the namespace URI of the root node) using DOMElement::GetAttributeNS()? What are the two magical input parameters to coax that value out?

The code is simple, but it's an interesting problem - anyone have any answers?

tagged: trivia contest dom handling namespace uri root node trivia contest dom handling namespace uri root node

Link:


Trending Topics: