Several months ago I was talking with some Java developers who were being forced to move onto PHP. They were actually quite open to the idea but had some questions. One of them was on how you would set up a page counter. In the Java world what you would do is define a static property within a class, synchronize it, and increment it for each page that hit the site. In my explanation I went through the myriad of ways that you could do that, probably confusing them even more.
Following closely on the heels of my previous blog posting on how to create a basic Hello World application using Flash RIA with Zend Framework based remoting I have created a video showing how to do exactly what I just did in the blog posting. Additionally, I have a compressed copy of the workspace I used so you can download it and run it in your own copy of Zend Studio. You will probably need to change a few settings to make it work in your IDE. Be forewarned that you will likely also need the Flash Builder 4 plugin installed. The 60 day trial should be more than enough to let you do that.
It would be a fair statement to say that I have not paid attention to Flash for several years. Obviously I know that those awesome interfaces for movie web sites are made in flash, as are those annoying video ads that start screaming at you as soon as you load up a page, competing with Megadeth on Rhapsody, cranked out on the 700 watts of power I have in my office. But the last time I really looked seriously at Flash was almost a decade ago and I was thrilled at tweening widgets from one place to another. Unfortunately, there’s not really any benefit to tweening a text box. Cool? Yes. Practical? No. So I never really picked it up. Plus I was cheap.
We all know of the ubiquitous CAPTCHA; those horrendous looking images that are designed to keep robots from submitting forms with spam in them because it is assumed that the robots cannot read the messed up images. The problem is, of course, that humans can’t read them either. We’re just better at guessing what the letters are. CAPTCHA, if you’re wondering, stands for “Completely Automated Public Turing test to tell Computers and Humans Apart.” A Turing Test is a test where a computer is able to sufficiently mimic a human to the point where another human cannot tell the difference between the two. CAPTCHA is the exact opposite. Its purpose is specifically to determine who is a machine and who is a human when user generated content is placed on a web site.
Debugging is one of the things that every single PHP developer in the world needs to know how to do. Unless you are simply learning the language, learning how to debug will save you countless hours and save you loads of money in anti-anxiety medications. var_dump() or print_r() is not debugging. At least, it’s not debugging in a way that is very useful, or safe.
There are two primary debuggers in the PHP world. XDebug and the Zend Debugger. I am not an expert in XDebug (though I really need to learn it better) so I will leave those discussions to someone else.
I have a thing for charts. Charts have the ability to convey very complex scenarios in a single line, or a few lines, if there are multiple considerations to be made. But the reason I have an interest in charts is not because of the information they convey, but the information that they don’t convey. I find that the information that is left out of a chart is often the most important piece. This is because statistics can be made to say pretty much anything. You’ve probably heard the line “Lines, Damn Lies and Statistics”. When I start hearing things like “60% of people think X” or “20% of people think Y” I tend to switch off. Interestingly enough, I do the same thing, though. Probably because that’s the easiest way to make a point. It sounds scientific. It sounds like you’ve done your research, even if you really haven’t.
I was doing some talking with some gentlemen last night over several adult beverages and fine tobacco products. They worked for a partner of ours and had brought up an interesting point concerning Zend Framework. It seems as though people who ask them about their product set and how it fits in with PHP were asking about Zend Framework and whether or not you had to use the whole framework to be able to integrate with their software.
Code Assist is one of those “must have” features in any IDE. Some developers are so brilliant and have such good memories that they are able to know what parts of their application do what and those silly drop down boxes just get in their way. I am not one of those developers. I love Code Assist. In fact, I learned Java via code completion in JBuilder 8. It was horrible Java code, but it worked. And eventually I learned how to write good Java… using code completion as well.
Matthew wrote up an article on modules in Zend_Application and that got me thinking a little bit. When I have done training for Zend Framework, one of the things that mystifies students to some extent is the whole plugin architecture and where things can go. There has been several articles written about it, but they tend to use code to describe it. I was only able to find a small handfull of articles that used some kind of chart to describe what goes on. Not that that’s a problem, but I had found that when I drew out the request lifecycle that it helped the students understand it better.
In our previous installment we looked at setting our backend up so it could automatically retrieve the bit.ly URL for a given URL and store it as part of the data for a given instance of a Content model. What we’re going to do this time is take a look at the front end components.
Sometimes I find that doing things backwards can actually make things a little more clear. That way you can see the end result and then, as you work backwards, see how all the pieces work together.