Larry Ullman

Translating Geek Into English

Passing Values by Reference in PHP 5

\[intlink id="3168" type="post"\]\[/intlink\]

. Generally, though, I’m a big advocate of re-reading manuals. It’s a great way to correct mistaken thinking you may have, and to learn new and better approaches. For example, I just came across something that had previously slipped past me: the ability to change an array within a foreach loop by passing values by reference.

In versions of PHP prior to 5, in order to change the values of array elements within a loop, you had to do this:

\[php\]\[$key\]\[/php\]

Just changing the value of $value within that foreach loop had no impact on the actual array element, as the loop only received the value of each array element, not the actual element itself.

This doesn’t come up often—if I need to change the elements in an array, I’m likely to use array_walk(), but it’s nice to know that in PHP 5 you can pass array values by reference in a foreach loop, so that changing the value within the loop actually changes the array:

Yii and Me (aka, the Yii Book)

Thanks largely to the success of my Learning the Yii Framework series, people are often asking me about my plans to write a book on Yii. Writing a book on Yii is something that I’ve been meaning to do for some time, but have been way too busy for the past couple of years to make it happen. Every so often I post something about the phantom Yii book, and so here’s another. This time, it’s pretty good news…

\[intlink id="3168" type="post"\]\[/intlink\]

” book. That project will take the next couple of months, through June. I’m hoping it will be entirely done (rewrites and all) in early July. I think I’ll have a decent-sized Web project to do in the fall, but other than that, I have no deadlines and obligations for the latter half of 2012. Little things will no doubt come along, but this kind of free time is unusual for me. (And, strangely, isn’t frightening at the moment, although free time come January could be a problem!) So, reasonably speaking, I will be able to work on the Yii book full time as of August 2012. This should coincide nicely with the hopeful release of Yii 2.0 over the summer. Speaking of which…

Properly Salting Passwords, The Case Against Pepper

Anthony Ferrara, creator of the PHP PasswordLib library, just recently posted a discussion of using salts and pepper to improve the security of a stored password. Mostly, the article is a discussion of why a pepper is unnecessary (and if you don’t know what a “pepper” is, just read the article), but the posting also does a good job of explaining the purpose of a salt, and why the salt does not need to be a secret. The posting is relatively short, and is something I think everyone can benefit from reading.

The posting ends with the most important security fact:

Remember, the most dangerous kind of security is a false sense of it. Thinking you’ve made your application more secure, when in fact you’ve weakened it, is the worst thing you could possibly do.

My 99designs Logo and Business Card Contest

\[intlink id="3176" type="post"\]\[/intlink\]

, I recently ran a 99designs contest to get a new logo and business card (see that post for the final results). In this post, I want to talk about the experience in more detail, although I should add that I decided (for some unknown reason) to make my contest private, so it cannot be viewed by anyone that is not a 99designs member (membership is free, if you really want to take a peek).

My New Logo and Business Card

For me, 2012 is a year focused on legitimizing much of my business. You might think that having written 22 books, worked for clients, performed training, and spoken at conferences, that my business would be well established. Well, you’d be right and wrong. I’m a one-man operation, so almost all of my energy and time is directed towards getting and doing work, with little to no time left for the secondary work-related things. The business side of things is going well enough, but I can no longer ignore these other issues. Towards that end, I finally decided that I’d pony up the money for a logo and business card. I received an estimate from a local (central Pennsylvania) company last year, that was around $6,000 (USD). Besides being well beyond what I could afford, it was also well beyond the value I place on having a logo and business card. A while back, I heard about 99designs, and decided to use that system instead. In a separate post, I’ll write about that process and experience, but here, I want to share the results.

Five Ways to Lose Work

\[intlink id="1564" type="page"\]\[/intlink\]

and emails, I’ve put forth my thoughts on what one can do to get work. What’s easier to identify, though, is how one loses work. This post discusses five quick and easy ways to lose work. This may seem like an odd topic, but by not doing these things, perhaps you can improve your chances of getting work.