Apr 05

cakephp.gifI spent some time working with a few of the “cool” features of CakePHP this week.

I again noted that Cake is a capable PHP framework in ways that aren’t obvious at first glance. In fact, I found myself fairly impressed by their AJAX and Script.aculo.us support.

For the particular application I was working on, a drag & drop interface was going to be particularly handy. Having spent time previously implementing drag & drop interfaces with Script.aculo.us, Yahoo UI, and Rico, I was hoping the process would be a bit easier using Script.aculo.us as an extension on top of Cake and I was pleasantly surprised with the results. I walked away with a functional drag & drop interface in an amazingly short amount of time with very little coding.

Important Note: A CakePHP beginner should be able to get this tutorial working, but I am still assuming that you have a basic understanding of Cake in order to implement this tutorial properly. If, not please see this article to get started.

In this example, we’ll use a very simplified page of widgets that are “draggable” to change their order and save the changes to a MySQL database in real time.

Make sure you have a recent version of CakePHP (I used version 1.1.14.4603). The document root of your web server should probably be set to:

SERVER-PATH/CAKE-ROOT/app/webroot/

Now, you just need to grab the latest stable version of Script.aculo.us (I used v1.7.0 for this example). For my set up, I extracted the files in the following manner:

CAKE-ROOT/app/webroot/js/scriptaculous/lib/prototype.js
CAKE-ROOT/app/webroot/js/scriptaculous/src/scriptaculous.js (and remaining “src” files)

Also, for this example, I used a MySQL database called “widgets” with a table called “widgets” that contained three fields: “id”, “title”, and “order”.

Here’s The Code:
———————————————————-
Widgets Controller
[ --controllers/widgets_controller.php ]
class WidgetsController extends AppController
{

var $name = ‘Widgets’;/** These are the needed helpers **/
var $helpers = array(‘html’, ‘javascript’, ‘ajax’);

/** Implements the index view **/
function index() {
$this->pageTitle = ‘Widgets Index’;

//status message to be used later
$this->set(‘status’, ‘Widget Ordering Succesfully Saved!’);

//assign widgets to view sorted by the ‘order’ field
$this->set(‘widgets’, $this->Widget->findAll(null,null,’order’,null,null));
}

/** Receives ajax request from index **/
function order()
{
//loop through the data sent via the ajax call
foreach ($this->params['form']['widgets'] as $order => $id)
{
$data['Widget']['order'] = $order;
$this->Widget->id = $id;
if($this->Widget->saveField(‘order’,$order)) {
//we have success!
} else {
//deal with possible errors!
}
}
$this->autoRender=false;
}

}
?>

/*
The data comes to your order action in this format:
Array (
[0] => 19
[1] => 16
[2] => 7 )
where the array indexes ([0],[1],[2]) are the “orderings” and the array values (19,16,7) are the actual “id’s” of each question.
*/


Widget Model

[ --models/widget.php ]
<?php
class Widget extends AppModel
{

var $name = ‘Widget’;

}
?>

Index View
[ --views/widgets/index.thtml ]
<?php
if (isset($javascript)) {
echo $javascript->link(‘scriptaculous/lib/prototype.js’);
echo $javascript->link(‘scriptaculous/src/scriptaculous.js’);
}
?>
<div id=”status” style=”display: none;”><?php echo $status; ?></div>

<ul id=”widgets”>
<?php foreach ($widgets as $row): ?>
<?php echo ‘<li id=”widget_’ . $row['Widget']['id'] . ‘”>’ . $row['Widget']['title'] . ‘</li>’; ?>
<?php endforeach; ?>
</ul>

<?php echo $ajax->sortable(‘widgets’, array(‘url’=>’order’, ‘before’=>”Element.hide(‘status’);”, ‘complete’=>”Element.show(‘status’);”)); ?>

———————————————————-

Take special note of the “before” and “complete” ajax helpers to show and hide the status message. Read more about them here under the heading “AJAX”.

And that’s it! You now have a drag & drop interface that will serialize your form data and save it to the database quickly and easily. Isn’t that a little too easy?

A few important side tips:

- Use Firebug to do your debugging. It’s an invaluable tool that you should use if you don’t already.
- For debugging Cake errors, make sure you have debug level 2 set in [core.php] for some additional help.

If you have questions or comments about this tutorial, feel free to leave a comment at the bottom and I’ll do my best to answer what I can. Remember, this was intended to be a basic tutorial with as much elegance as possible while still remaining clear to differing skill levels. I’m also fairly new to CakePHP myself, so feel free to offer suggestions to make the code better!

I was going to offer a zip download of the source code, but I’d rather you type it out or copy & paste– maybe you’ll learn something in the process.

Mar 17

google-apps.gifSo what’s with this new-fangled Google Apps thing?

To me, it initially just seemed like a fancy version of Gmail. However, as I really started delving into it, I was thoroughly impressed.

Here’s the general description from Google:

Communicate…
Give your users Gmail, Google Calendar and Google Talk accounts that
use your own custom domain, helping them to stay connected and work
together more effectively.

Collaborate and publish…
Docs & Spreadsheets lets users share files and collaborate in
real-time. The Start Page is the first place your users will look to
preview their inboxes and calendars, access your essential content, and
search the web.

…and get on with business.
It’s all hosted by Google, so there’s no hardware or software to
install or download, and minimal setup and maintenance. You can get up
and running quickly, even if you don’t have technical resources.

To try it out for myself, I moved all the email accounts for my web development business to Google Apps Standard Edition. I have to admit, the changeover worked flawlessly. All I had to do was verify my domain by uploading a file to my server. Once verified, I was able to get the email moving to Google’s servers with a few simple MX record changes (and as far as I know didn’t miss one single email in the process). Soon after, I created some additional CNAME’s so I could access the calendar, document, and start page functionalities a little easier. Once those few things were done, I tinkered around with some of the admin controls in Google Apps, but for the most part, the process was complete. It all worked amazingly well.

I am totally sold on this system. I think this new offering will change the way many small, medium, and large businesses handle their communication infrastructures. The real advantages come with the Premier Edition of the service. The most important additions are as follows:

- 99.9% uptime guarantee for email
- 10 GB of space (and I suspect that will grow in the future)
- No ads in emails
- Conference room and resource scheduling
- A very poweful API system (including custom sign-on, authentication, user provisioning & management, and support for email gateways allowing backups of data).
- Email migration tools (in the works)
- 24/7 support via phone/email
- A variety of 3rd party applications and services to enhance the system
- Extremely low-cost ($50/user/year)

Yes, the amazing email client is incredible with it’s spam filtering, organizational ‘labeling’, and search functions, but the other tools included are the pieces that will create an evolution in how businesses operate (in my humble opinion):

- Imagine having the ability to have incredibly powerful calendar/scheduling tools without the hassle and complexity of expensive Exchange servers.

- Imagine being able to only allow certain groups of people (or individuals) to see certain calendars and events in real time, with just a few simple clicks.

- Imagine having a chat client integrated with your system that allows quick and effortless communications instead of picking up the phone or waiting on email responses. What if this client was embedded throughout the system and all communication could be archived and saved for security/legal purposes? What if that chat client also allowed voice calls to be made for free over the internet?

- Imagine being able to collaborate on documents or spreadsheets with teams of users all in real time over the web. What if you could publish these documents for only certain members of your organization to see? What if they could be saved in popular document and spreadsheet formats for desktop editing?

- What about a very powerful, yet simple & easy to use corporate start page that has important information customized for each particular employees’ job functions and can be easily branded?

- What if your users could access this data anywhere in the world with just a browser? No more need for VPN’s (to access email securely), Outlook clients, software updates, et cetera.

- What if the majority of these systems integrated with wireless/portable devices like BlackBerry phones with little-to-no effort?

- What if this entire system was simple to administrate for even the largest of companies? You would hardly need one employee (at most) to manage the system. No exchange server experts needed ever again (sorry guys)!

- What if this amazing system was hosted in some of the most secure and reliable data centers in the world (Google’s) and optimized for world-wide use? No more worrying about expensive hardware, licensing, storage, bandwidth, replication, or down-time concerns.

- What if there were a plethora of 3rd party and advanced packages allowing custom email gateway services, archiving, security, authentication, et cetera?

It’s all available right now!

So go and check out Google Apps Enterprise Edition… no matter what your company size, it has the potential to save your company time, effort, and vast quantities of money while increasing productivity and profit. Seems like a no-brainer to me.

Mar 08

http-pipeline.gifDefined here by Wikipedia.org, “HTTP pipelining is a technique in which multiple HTTP requests are written out to a single socket without waiting for the corresponding responses.

Mozilla talks a bit more about the topic: “Normally, HTTP requests are issued sequentially, with the next request being issued only after the response to the current request has been completely received. Depending on network latencies and bandwidth limitations, this can result in a significant delay before the next request is seen by the server.

I have accepted the fact that HTTP pipelining is pretty much disabled in all modern browsers, but that doesn’t mean I have to like it!

I have a widget in Firefox that allow me to bypass this missing “feature” and it sure seems to speed up my browsing quite a bit. However, why can’t everyone get together and work this problem out so we don’t need extensions/widgets/hacks to get around the limitations?

I attempted to harass Microsoft about it and never received an answer (I didn’t really harass them per say). Firefox isn’t mum on the subject (here), but it seems to come down to compatibility issues with certain servers, routers, et cetera in some specific cases (even if the HTTP/1.1 spec allows it).

So what does a web developer do (programmatically)?

Do we just accept the fact and move on or is there something we can do about it? How can we speed up our page loads to a world that can’t use pipelining?

It turns out there is a relatively simple way to “fake HTTP pipelining”. When I read through the article “Optimizing Page Load Time“, I had a very revealing moment of self-inflicted-disrespect. The solution is so obvious, but it never dawned on me previously. Why not simply source content on the page from different locations? It doesn’t even have to be different servers, just different domains. Pretty simple right?

For example, we could do something like this for a single web page:

- Static Images: images.dustinweber.com
- Javascript Includes: includes.dustinweber.com
- CSS: css.dustinweber.com
- Static Content: static.dustinweber.com
- Dynamic Content: dynamic.dustinweber.com

Now this is a pretty extreme example that I wouldn’t recommend for production (except in very specific cases), but let me explain what happens in simple terms. Instead of your browser making a request to one domain for all the content, data, files, and everything for a page; it splits up the requests amongst the various sub domains (of which could be hosted separately or together).

What does splitting up the content get us?

The advantage is that the browser isn’t sitting around waiting on previous requests to complete before moving on to the next item. It really only makes sense for larger pages. In fact there is a drawback, according to Aaron, “Beware that each additional hostname adds the overhead of an extra DNS lookup and an extra TCP three-way handshake. If your users have pipelining enabled or a given page loads fewer than around a dozen objects, they will see no benefit from the increased concurrency and the site may actually load more slowly. The benefits only become apparent on pages with larger numbers of objects. Be sure to measure the difference seen by your users if you implement this.”

Perhaps now you can consider playing around with this idea a bit on your own. Given plenty of tinkering time and careful examination, it could help decrease page load times noticeably.

If you’d like some more tips on this subject, check out Optimizing Page Load Time.

Mar 07

consumer-testing-labs.gifI realized the other day that I haven’t really talked about my employer, Consumer Testing Labs, all that much.

So, what is it that we do?

Let me quote from our web site so I get it correct: “Since 1952, we have been helping quality conscious retailers and manufacturers ensure the quality of the products they sell and by doing so protect their business and their most important asset–their customers’ continued patronage.”

Basically, we help out the consumer by ensuring quality products are on the shelves and the retailer by ensuring they don’t sell products that will be returned frequently or are hazardous to the health/safety of their customers. Not only that, but we do it faster, better, and cheaper than the competition!

With all that being said, let me explain why it’s a cool company. I have to openly admit that our testing laboratories are really hypnotic (interesting) places to visit.

We have a world-wide presence in three major categories of testing:

1) Food — essentially anything edible
2) Softlines — essentially anything you wear
3) Hardlines — everything else (yes, a massive category)

On my initial interview with the company, I received a first-class tour of the Food Labs located in Bentonville, Arkansas. I can truly say that the food testing process is awe-inspiring. The employees who test these food products are highly skilled and the testing procedures they go through are rigorous, complicated, and highly accurate. They use machinery and test equipment in the lab that I swear I’ve only seen in Star Trek episodes. But outside of the cool equipment, even the simple taste-testing area is neat.

Truthfully though, the Hardlines lab is my real favorite. Can you imagine how fun it is to test the break strength of steel cable? Or to see how many tons it takes to cause an industrial shelving unit to collapse? How bout checking the electrical bleed tendencies of high power air conditioners? You can imagine the fun when it comes time to test barbecue grills! It’s a really fascinating place that is always buzzing with activity, huge machines, and strange noises. Every time I go there, at least one test-in-progress captivates my attention for a lengthy time (usually only as long as I’m allowed to stand there gawking). I’m just skimming the top here, but I think you get the picture; it’s a cool place.

But even the Softlines Lab has neat stuff going on. Fiber analysis, color accuracy testing, & children’s sleepwear flammability testing just barely touches on all the interesting testing that occurs there.

So yeah, basically, it’s a pretty unique place to work.

As a web developer, I don’t get to see all the testing that occurs every day, but my job is to enable the testers and the company itself to achieve goals more accurately, efficiently, and faster by leveraging existing technology and creating new technology where it fits.

The employees at Consumer Testing Labs have a lot of pride in their work and although I don’t get to blow stuff up on a daily basis, I really enjoy the fact that my efforts enable our employees’ hard work to pay off even more for themselves and the company as a whole.

If you have any interest in working for us, please check out our job openings (and tell em’ I sent ya). We always seem to have new jobs available as the company keeps growing and growing.

In the mean time, just remember that we might’ve tested that chain saw you use every weekend or that piece of cheese you ate last night; so feel free to silently thank us that neither one killed you!

Mar 02

web-worker-daily.gifCourtesy of Web Worker Daily, here are some really interesting jobs that seem to be a good fit for someone working in a Web 2.0 job.

Likely most interesting to someone with some extra time on their hands (outside of their regular job). Still, pretty interesting stuff.

1) New Media Producer
- Essentially video blogging and similar forms of media production.2) Clothing Label Crafter
- Basically creating t-shirts that say something like “Pedro For President”.

3) Micro Investor
- Offering loans person to person.. eliminating banks and lending companies.

4) Publisher
- A standard run-of-the-mill author (who prints on paper).

5) Community Curator
- Creating your own social network (like Facebook).

Go see the original article to learn more about the jobs themselves.

Feb 23

cakephp.gifAfter literally weeks of tenuous back and forth rhetoric with myself (internally) and my fellow co-workers, I have finally, humbly, and assuredly concluded that CakePHP is the best PHP Web Framework in the world!

I could argue the benefits of Cake vs. other Frameworks again, but I’ve already done that, twice (though I originally decided differently).

Instead I’m hoping to help the Cake community a bit today. I’m not a “Cake expert” yet, but I think I can contribute a few things that can possibly ease some of the few frustrations that might occur when getting started with Cake.

Dustin’s CakePHP Beginner’s Guide!

I’m gonna try and keep it simple (K.I.S.S.) for ya’ll and do my best to actually offer any Cake newbies out there some advice that can help get the ball rolling quicker.

After showing it off to my co-workers and going through the manual a few times, here’s my

reccommended approach to the learning process:

First, Some Installation Tips:

- Use Apache… it’s just easier than IIS and it’s time to make the switch if you haven’t yet. Make sure mod_rewrite is enabled; again to make things easier.
- If you must use IIS, check out my writeup to help you get the ball rolling.
- “Make sure that an .htaccess override is allowed in your
httpd.conf (Apache), you should have a section that defines a section for
each Directory on your server. Make sure the
AllowOverride is set to All for the
correct Directory.”
- Don’t mess with the production install of Cake yet; just do a development setup.


Second, do the basic blog tutorial:

- Prepare for the inner excitement that will soon come.
- I know it’s not the recommended order of learning, but I think it works better to give a real-world example right off the bat before anything else.

Third, save that blog code and start working your way through the manual:

- Start at the very beginning, don’t skip any sections, and read every word.
- When you get confused (which you probably won’t much), re-read!
- It’s not a big manual, you’ll be done in an hour or two.


Fourth, go watch a few of the screencasts:

- Especially: Building The Bakery & Admin Routing

Last, start your own basic project and see where you get.

Here’s a few more helpful tips:

- Explore the Bakery for cool stuff.
- Get the ‘Cakesheet‘, it can save some serious searching time.
- Use the Cake Google Group, en excellent option for help.
- Remember to search through the User Manual, API, the web (2.1 million results for Cakephp on Google), and the entire Google Group BEFORE asking a question. You’d be surprised how often I see thread’s on the group posted that look something like: “Cake N3wbie – How do I connect to a database”. I know it’s easy to just ask and be lazy, but trust me, there’s a really good chance it’s already been answered. Don’t wear out the Cake experts prematurely with the simple stuff.

Ok, now you have enough to get started, so why are you still here reading this?

By the way: Let me know how Cake works out for you!

Feb 20

upward-trend.gifI promise I’m not not trying to brag, but I’ve recently noticed that my rankings in the ole’ search engines have been near the top for almost every topic I post (especially on Google).

Now, normally I haven’t had trouble showing up near the top for most topics, but lately (in the last six months) I’ve seen my rankings doing better than they ever have before (overall). I know it’s only a portion of the true reason, but I also just noticed my PageRank is now 5 and that seems to be a contributing factor.

After a little celebration, I checked out the PageRank Prediction Tool to see where I was headed. This thing, however inaccurate it’s predictions may be, is fun to play around with. It’s fun to see what the big domains are doing and I really like to check out the competition and see how they are “really doing”.

I’d recommend taking a second to play around with the Page Rank Prediction Tool if you get a chance.

Feb 16

nist-logo.gifCourtesy of The National Institute of Standards and Technology (NIST), I have discovered this incredible collection of algorithms, algorithmic techniques,
data structures, archetypal problems, and related definitions.

You might ask yourself: “What’s so special about a few algorithms”? Well, I don’t care who you are, if you are a programmer of ANY type, this stuff is good for you to know and use!

I actually enjoyed going back and looking at some of the problems I worked on back in college. Truthfully, these bad boys can make your job (as a programmer) a whole lot easier and your code a whole lot more efficient.

So come on, check out The Dictionary of Algorithms and Data Structures.

Note: The Byzantine Generals Problem is still my favorite.

Feb 12

bubble-comments.gifCame across a pretty neat little CSS trinket this afternoon on del.icio.us.

It provides a very simple, yet powerful way to generate “CSS Speech Bubbles“. It does use a bit of Javascript (25K – Yikes!) which confuses me because that really makes this thing, “Javascript/CSS Speech Bubbles”, doesn’t it?

However, I’m guessing the Javascript was used to make the code cleaner (and probably validate properly).

With that being said, still seems a tad hokey to me, but I suppose the project could nonetheless be useful in some instances. Too bad I don’t really have a use for ‘Speech Bubbles’ right now… maybe someday.

You can see original site here: CSS Speech Bubbles or just download the package directly.

Feb 09

cakephp.gifLately, I’ve been taking some serious time out of my schedule to sit down and really examine a few of the top PHP Web frameworks (CakePHP, Symfony, & Zend) even more than I had previously. After a bunch of reading, tinkering, and playing around, I can now officially declare: “I think CakePHP is the best”. There I said it, I hope I won’t regret it… heh.

In fact, after actually sitting down and expanding on the basic blog tutorial offered in the manual, I am tepidly excited about the prospects of implementing something cool and truly useful in Cake (I may even switch The Weber Report over to my new, fancy, Cake-Powered, conglomeration that I created during the learning process) and really start taking advantage of the MVC Design Pattern.

Now that I have read through the manual a few times, I can humbly offer some of my favorite parts of the Cake experience:

Powerful Associations Between Models

“One of the most powerful features of CakePHP is the relational
mapping provided by the model. In CakePHP, the links between tables are
handled through associations. Associations are the glue between related
logical units.

There are four types of associations in CakePHP:

- hasOne
- hasMany
- belongsTo
- hasAndBelongsToMany

When associations between models have been defined, Cake will
automagically fetch models related to the model you are working with.
For example, if a Post model is related to an Author model using a
hasMany association, making a call to $this->Post->findAll() in a
controller will fetch Post records, as well as all the Author records
they are related to.”
Powerfully Flexible Data Validation Features

“Validations are defined using Perl-compatibile regular expressions,
some of which are pre-defined in /libs/validators.php. These are:

- VALID_NOT_EMPTY
- VALID_NUMBER
- VALID_EMAIL
- VALID_YEAR

But custom validation (outside of regular expressions) is also extremely easy. If you’d like to perform some custom validation apart from the
regex based Cake validation, you can use the invalidate() function of
your model to flag a field as erroneous. Imagine that you wanted to show
an error on a form when a user tries to create a username that already
exists in the system. Because you can’t just ask Cake to find that out
using regex, you’ll need to do your own validation, and flag the field
as invalid to invoke Cake’s normal form invalidation process.”


Stringent Security Component

“The Security component is used to secure your controller actions
against malicious or errant requests. It allows you to set up the
conditions under which an action can be requested, and optionally
specify how to deal with requests that don’t meet those requirements.

So if a request doesn’t meet the security requirements that we
define, what happens to it? By default, the request is black-holed,
which means that the client is sent a 404 header, and the application
immediately exits. However, the Security component has a
$blackHoleCallback property, which you can set to the name of a custom
callback function defined in your controller. Rather than simply give a 404 header and then nothing, this
property allows you to perform some additional checking on the request,
redirect the request to another location, or even log the IP address of
the offending client.

Every time the Security component is loaded, even if it is not
being used to protect an action, it does the following things: First, it
generates an authentication key using the core Security class. Then, it
writes this key to the session, along with an expiration date and some
additional information (the expiration date is determined by your configuration file).
Next, it sets the key in your controller, to be referenced later.

Then in your view files, any form tag you generate using
$html->formTag() will also contain a hidden input field with the
authentication key. That way, when the form is POSTed, the Security
component can compare that value to the value in the session on the
receiving end of the request. After that, the authentication key is
regenerated, and the session is updated for the next request.”

Cool Scaffolding (Similar to Rails)

“So cool that you’ll want to use it in production apps. Now, we
think its cool, too, but please realize that scaffolding is… well…
just scaffolding. It’s a bunch of stuff you throw up real quick during
the beginning of a project in order to get started. It isn’t meant to be
completely flexible. So, if you find yourself really wanting to
customize your logic and your views, its time to pull your scaffolding
down in order to write some code.

Scaffolding is a great way of getting the early parts of
developing a web application started. Early database schemas are
volatile and subject to change, which is perfectly normal in the early
part of the design process. This has a downside: a web developer hates
creating forms that never will see real use. To reduce the strain on the
developer, scaffolding has been included in Cake. Scaffolding analyzes
your database tables and creates standard lists with add, delete and
edit buttons, standard forms for editing and standard views for
inspecting a single item in the database.”

Remember, these are just some of the highlights. There is a LOT more in the manual to get you excited. In the near future, I’d really like to contribute a bit to the Bakery and really begin discovering the power of Cake in ways I can’t yet foresee.

You know you want to check Cake out, so stop wasting time… take the leap!

Feb 07

A while back, a friend of mine showed me some “secret” photos he had from a Nuclear Power Plant located on the East coast

At first, I was a little worried that he had ascertained the photographs in some clandestine way.  However, it turns out that a close friend of his actually worked in the reactor and had taken some these amazing pictures of the inside bowels of a modern nuclear reactor.

Feel free to check all the pictures out in my gallery if you have a bit of interest.

Interesting Note:  That blue glow seen in some of the pictures is no Photoshop effect my friends; it's actually Cherenkov Radiation.  According to Wikipedia, the glow is caused by “electromagnetic radiation emitted when a charged particle passes through an insulator at a speed greater than the speed of light in that medium. The characteristic 'blue glow' ” seen above is an example of this phenomenon.

Tagged: , , , , , , , , , ,

Jan 25

cakephp.gifOver the last few weeks, I have been attempting to learn two major PHP frameworks: Symfony & CakePHP.

Originally, I had decided (in a bit of short-sighted wisdom) that Symfony was the obvious champion. I think I may have been wrong. I spent nearly a week tinkering with Symfony off and on. I came to a simple conclusion: I’m confused.

The Symfony framework is so huge and poorly supported that it confused the heck out of me. Their basic “sandbox” tutorial doesn’t work in any way close to what the documentation states. And the documentation, oh the documentation; what could be the best part of this huge framework fails because of one fatal flaw: no one updates it for the new each new revision that (sarcastically) seems to come out every other day.

After seeing my co-worker struggle with the installation process for days and my own copy just barely functional (with hardly a thing to show from it), I called it quits. At least until I read this (from The Symfony Blog):

“You know that we spent the last months writing a complete guide for
symfony that will be released in bookshops on January 29th. We also
mentioned the fact that the content of this book would become the
official symfony online documentation and be published in HTML on the
same date.”

So, it looks like I’ll put Symfony off until this new-fangled documentation goes live, then I’ll give it another swing.

In the mean time, I’ve been working with CakePHP and genuinely lovin’ it. After tinkering around with it for a while, here are my thoughts about the two frameworks:

Documentation
- CakePHP: Up to date, but not totally complete and somewhat difficult to search through. They also have an extremely helpful CakePHP Google Group that helped most problems I ran into quickly (almost instantaneously during normal business hours) and efficiently. You can’t beat live support that’s free.
- Symfony: Until the new release, not all that helpful because much of the content is dated. However, what is there is easily searchable and they have an active forum that seems to be full of knowleable (yet somewhat arrogant) people.

Installation
- CakePHP: Very easy to install. For the most part, just copy it into your web root and you are good to go (provided you have Apache and mod re-write previously enabled). Once it’s in there, all you really have to do is setup the DB connection and you can be off and running.

- Symfony: Ouch… this is my major sticking point here. I know people that would say, “If it’s not hard, it’s not worth doing”. I agree with that idea, but this is one tough cookie to crack. There are so many little tricks, files, variables, and directory permissions to set-up… it’s a wonder I even got to the point I did. Their basic tutorial, “my first project“, wouldn’t work by following the given instructions… no matter what I did. They also rely on Pear to deliver the goods, which is inherently fraught with little tricks to keep it all running smoothly.

Directory Structure
- CakePHP: It makes sense and it’s extremely logical for almost anyone. You don’t have to be the creator of the framework to understand what each directory is used for. The framework code is in a separate directory totally away from all of your own code. Props to these guys, it works well.

- Symfony: File and directory overload. We’re talking a huge amalgamation of directories buried within directories and files scattered all over the place. When I started really digging, it left me dazed. Truthfully, after spending countless hours working with Symfony, I still haven’t figured out what all the directories are there for (which could be because the framework kinda mixes it’s own libraries in with the programmer’s code).

I could go on for hours, but I think you get the picture. For the time being, I have revised my opinion on the matter of PHP web frameworks. In my somewhat humble opinion, I think CakePHP is the current champion. However, Symfony may present some good competition just as soon as their new release comes out on the January 27th, 2007. Only time will tell I suppose. Rest assured, I’ll be choosing one or the other.

UPDATE: My mind is made up – CakePHP wins! Please read this, and this.

Jan 18

symfony-logo.gifThanks to a great mentor (Greg) in my starting days of web development and a strong background in Computer Science from several excellent professors in college, I had a good start at web development a few years back. My original skills for PHP featured an Object oriented approach, secure validation & error reporting, some nice Pear DB functionality (with MYSQL), and the Smarty Templating Engine. My skills and knowledge regarding PHP have continued to grow each day (especially regarding efficiency and security).

Recently though, I began playing with the big new talk of the town: Ruby on Rails. I have to admit, the process hasn’t been as easy as I thought. Most of the slowdown revolves around the fact that I don’t know Ruby all that well. Combining a totally new realm of development (the Rails framework) with a new language makes the switchover difficult for me. Regardless of the difficulties, I certainly see the power of Rails and understand how it’s framework can make the development process amazingly more agile and efficient.

With that being said, at Consumer Testing Labs we’ve been talking extensively of doing some major changes to how we code. We thought it would be a great idea to implement a standard templating system (like Smarty) for everyone to use, develop some internal libraries that all the developers could agree on and use frequently, and even strong rules on everything from coding practices to directory structures to design patterns. I think we all sorta hit a no duh moment when considering how to implement all these ideas effectively: a PHP MVC framework!

The discussions at work piqued my interests enough to send me on a quest of nightly rituals over the last week or two discovering, testing, and playing around with the nearly fifty frameworks that currently exist for PHP. Ok, I didn’t try them all out, but I did try out the best of the best according to my reading (and the ones that seemed to fit into the MVC layout). After tinkering around with CakePHP, Zend Framework, and Symfony, I did a lot more reading on these types of agile development packages.

Here are my conclusions on things at this point in time (01-17-2007):

CakePHP: Had a great basic install and easy to implement first run of things. I really liked being told what to do from the Cake code itself. Sorta like a wizard. Getting into more advanced coding had me pulling my hair out though. Mostly, the documentation was at fault – but not that it was all lacking. I just thought it was sorta scattered and hard to follow. Some tutorials I found helped a bit, but I was still left confused much of the time.

Zend Framework: Where do I begin? I had an icky feeling from the get-go with this thing. First, I’ve been a little off put by Zend for trying to commercialize something that has for so long been open-source… at least for the most part (PHP). In my opinion, the problem with the Zend Framework is that it appears to be a half-hearted attempt at a framework. It seems like it’s more like a collection of libraries than a true framework. When I compare it to Cake and Symfony or even Ruby on Rails, it just doesn’t feel quite right. There are lot’s of specific reasons I feel this way, but anyone’s attempt to convince me otherwise would simply be futile, heh. I don’t think Zend would ever be the type of framework I would want to use on a daily basis (at least until they make some major revisions or enhance it a bit more).

Symfony: If you hadn’t guessed it yet, Symfony was the winner in my book. I saw a lot of true similarities here between it and my reference: Ruby on Rails. Now, don’t get me wrong; it isn’t a straight-up clone of Rails, but the good parts are all there. So what does this mean to me? It means I get to use all the power of the Rails framework (albeit a tad different) without having to learn an entire new language (Ruby). It’s the best of both worlds!

So, if you are out there looking for a well-rounded and properly executed PHP web framework, be sure to check out Symfony.

UPDATE: I have actually changed my mind! Please read this, this, and this.

Jan 11

Quoted from here:

Microsoft Office Outlook 2007 uses the HTML parsing and
rendering engine from Microsoft Office Word 2007 to display HTML
message bodies. The same HTML and cascading style sheets (CSS) support
available in Word 2007 is available in Outlook 2007.

The limitations imposed by Word 2007 are described in detail in the article, but here are a few highlights:

  • no support for background images (HTML or CSS)
  • no support for forms
  • no support for Flash, or other plugins
  • no support for CSS floats
  • no support for replacing bullets with images in unordered lists
  • no support for CSS positioning
  • no support for animated GIFs

Read More.  What do I have to say?  Buh.

Jan 06

I was recently presented with two projects at work that offered me a good opportunity to delve into the 'scary' world of Javascript WYSIWYG (what you see is what you get) content editors for the web. 

Normally, I try to avoid Javascript like the plague, but lately with the advent of AJAX and Javascript effect packages, I'm feeling a bit more used to it.

In this case, I needed two specific and diverse solutions to a few problems I had.

Problem 1: I needed a way to embed an editable spreadsheet in a web page without any special plug-ins or proprietary Microsoft scripts.  In basic terms: a web spreadsheet application.

SolutionCodeThat, a small venture heralding from the Ukraine offers a powerful, simple, and easy to configure all-in-one solution called CodeThatGrid

The power of this software is it's simple ability to allow any web user access to a simplistic replica of Microsoft Excel.  It closely resembles Microsoft's product in form and function, so there isn't much of a learning curve.  Best of all, it's relatively lightweight size-wise and seems to have a robust feature-set.  Overall, I think it's a great solution for a tough problem. 

Problem 2: I needed a simple yet powerful text editor that would allow a user to post content to the web without the need to know any html or any knowledge beyond Microsoft Word.  In basic terms: an advanced rich text editor.

Solution:  After lot's of research, Moxiecode's TinyMCE seemed to have the easiest to use and most robustly supported Rich Text Editor I could find at this time. 

When fully decked out, this thing looks almost exactly like Microsoft Word… and has almost all of the features.  Some highlights: real-time spell checking, table support, image insertion (even an optional file/image management system), a fully-compliant gzip compressor, and support for PHP, JSP, .NET, and Coldfusion.  It works well and I'm thoroughly impressed by the wide range of plug-ins and options available for the software.

So, remember to check them out if you have a need for some powerful WYSIWYG tools for your next web project.  And no, neither one of these companies paid me for this review.  I truly just like them a lot!