Sep 23

The first barCamp Orlando was great. All of the people who spoke prepared good presentations and all of them gave something to learn. I even picked up some good information from the topics I was already familiar with. Many thanks to Gregg and Jason and everyone else who helped as well as all of the presenters.
I was originally hoping most of the presentations would be more code based examples of programming techniques, but I am glad they were higher level as I am sure that would have become pretty boring after a couple presentations. Next year I hope to have a presentation of my own. I thought about presenting something this year, but everything I thought of presenting on I kinda just figured with all the geeks in the audience they would already know it. After seeing the variety of presentations this year, I am sure I can find something to present on next year.
Some of the presentations I particularly enjoyed:
- Designing Apps for the iPhone
- (mostly because I just bought one and I am ready to start writing apps for it)
- Staying on Track (Project Management) by Robert Dempsey.
- Project Management has always been a strong topic for me. While I don’t particularly enjoy it, doing it correctly can decrease my headaches and let me do what I love more effectively, development. Robert’s presentation pointed out many great points, some of which we pretty much know and a couple of other good tips. I hope to see a presentation next year on applying the principles. Many of us “know” what goes into it, but effectively executing on those principles is usually the deciding factor.
- Why Ruby on Rails by Gregg Pollack
- I am not a RoR activist and I have never even written an application in Ruby. I have always been skeptical of it because of all of the scaling problem rumors and the fact that there is sort of an elitist attitude among many RoR developers, kinda like Mac enthusiasts vs. Windows. I have eventually made the switch to Mac also but I like to make informed decisions on what to use instead of just following the herd and I can say that Mac is pretty good but using it doesn’t necessarily make you better at everything.
Gregg’s presentation was good though and showed some real reasons for considering RoR. We already use a custom MVC php framework but I want to really do a couple of RoR projects to try it out. At the very least I picked up a couple of ideas to possibly include on our own framework.
I really look forward to next year. I am sure we can double the attendance so we will need a bigger venue for sure. Oh, and let’s do it on a Sat. so we can watch football on Sun. 
Sep 08
I was talking about Object Oriented Design with someone the other day and the topic of making an object’s member variable read only came up. This is normally a simple task, simply define the member variable as protected or private within the class definition. That essentially makes it inaccessible to any code outside of the class it is a member of. One would then typically define an access function that allows outside code to read the variable. Here is an example:
class readOnly
{
private $readOnlyVar;
public function __construct()
{
$this->readOnlyVar = 'This is read only';
}
public function getReadOnlyVar()
{
return $this->readOnlyVar;
}
}
$readOnly = new readOnly();
echo $readOnly->getReadOnlyVar();
$readOnly->readOnlyVar = 'Trying to change this';
Running that code would produce the following output:
This is read only
Fatal error: Cannot access private property readOnly::$readOnlyVar
Read the rest of this entry »
May 31
We recently upgraded our servers at NFi from PHP 5.1.2 to PHP 5.2.2. We needed to upgrade to fix a bug in PHP’s COM object support. PHP 5.2.2 and PHP 5.2.1 have proven to be buggy on windows and broken things that have previously worked. Upgrading to 5.2.2 introduces a bug in the mysql module that keeps outputting the following at the end of every script:
Error in my_thread_global_end(): 3 threads didn’t exit
Wordpress is based upon MySQL so this obviously won’t work even though the error is present even when non MySQL code is being run. Downgrading to PHP 5.2.1 fixes that problem. You are not in the clear yet though. With PHP 5.2.1 there is a problem with the standard method Wordpress uses for permalinks.
The default method for using permalinks with Wordpress is to use the following URL style:
/index.php/2007/05/31/sample-post/
This will not work with PHP 5.2.1 though. It appears that it treats that location as the full path to the file to serve. It looks for the folder index.php instead of running the actual script. Since the folder doesn’t exist you get a 404 File Not Found Error.
Moving down yet again to PHP 5.2.0 will fix the problem and that is what I am now running with this blog. Alternatively you can use ISAPI Rewrite for WordPress which will rewrite your URL’s to not use the standard style. There is another popular Wordpress Permalink ISAPI Filter though that still relies upon the /index.php/%year%/%monthnum%/%day%/%postname%/ style. If you are using this filter you will need to use PHP 5.2.0.
Apr 26
MySQL has reached the $50 million revenue mark and is gearing up towards an IPO. This could prove to be an interesting time for MySQL and the open source database world for web 2.0. I am interested in what lay ahead, how MySQL could be affected and whether it may be a good investment opportunity ;).
Read more from my post at the NFi Studios Blog.
Apr 19
I have always believed that iterating an array using a foreach loop in php was slower than iterating through the same array using a standard for loop. I figured this because there is no foreach equivalent in the underlying native code that php is run on and therefore a standard for loop didn’t require any additional translations.
I have never read any concrete evidence as to which is faster and a quick google search didn’t provide any results. Thus I decided to setup a benchmark test myself. The question in mind for me was “Is it more efficient to loop through a given array with a for or foreach loop?” This is also assuming a standard indexed array and not an associative array or hash table. since you would pretty much only use a foreach for that anyway.
The test involved first filling an array 100,000 items by just counting up from zero. A for loop counting to 100,000 was then setup along with a foreach loop set to iterate through the pre-filled array. An extra loop was setup around each of the test loops to do the iterations multiple times. I like to do this to get more of an average running time because using time as a measurement in a multitasking environment isn’t exactly 100% accurate. The body of each loop was merely a continue statement to move on to the next cycle.
Here is the php code:
set_time_limit(0);
$array = array();
echo "Filling arrayn";
for($index=0; $index < 100000; $index++)
{
$array[$index] = $index;
}
$start = time();
for($iteration = 0;$iteration < 10; $iteration++)
{
for($index=0;$index < 100000;$index++)
{
continue;
}
}
$end = time();
$duration = $end - $start;
echo "For loop: ".$duration;$start = time();
for($iteration=0; $iteration < 10; $iteration++)
{
foreach ($array as $value)
{
continue;
}
}
$end = time();
$duration = $end - $start; echo "nForeach loop: ".$duration;
The results went against what I originally thought about php. I changed the iteration counts and the array size to make sure there wasn’t any affect due to loop setups or such. The results were nearly always the same. The for loop took twice as long to iterate than the foreach. Performance with any code is highly dependent on the context it is used in (especially in php) but this shows me my original thoughts were wrong.
Results for the above:
Filling array
For loop: 21
Foreach loop: 11
The benchmark was run on a Macbook Pro 1.8 Ghz Core Duo with 1.5GB ram. The test was run via CLI on php version 5.2.0. No optimizers or opcode cache was used. Try it out on different configurations and post your results in the comments.
Mar 01
Below are my results from my programmer personality test.
Your programmer personality type is:
DLSB
You’re a Doer.
You are very quick at getting tasks done. You believe the outcome is the most important part of a task and the faster you can reach that outcome the better. After all, time is money.
You like coding at a Low level.
You’re from the old school of programming and believe that you should have an intimate relationship with the computer. You don’t mind juggling registers around and spending hours getting a 5% performance increase in an algorithm.
You work best in a Solo situation.
The best way to program is by yourself. There’s no communication problems, you know every part of the code allowing you to write the best programs possible.
You are a liBeral programmer.
Programming is a complex task and you should use white space and comments as freely as possible to help simplify the task. We’re not writing on paper anymore so we can take up as much room as we need.
Nov 16
Read Here. This is pretty funny yet true. It won’t make much sense to any non professional programming geeks. I’d like to see the evolution in other languages like php,java, etc. The bit about managers is f’in hilarious because it is so true. Reminds me how nice it is to not be working in a big corporate environment.