Archive for the 'Code' Category

CakePHP is really cake!

25th May 2010

I’ve spent the last two months or so working on websites for various endeavors  and I’ve gotten to REALLY enjoy CakePHP.  So much so that dare I say that web development is now fun again!  In the olden days (about 5-6 years ago) we had to code up our own libraries to connect your website to MySQL and create queries, headers, etc.  With a good PHP framework, we can now spend more time coding and less time dealing with the intricacies of just getting your DB connections working (ie: more fun coding the working pieces vs the supporting pieces).

I’ve evaluated both CakePHP and Symfony and I liked both for various reasons.  I have found that the Symfony framework is just overly complicated when building a website that isn’t necessarily enterprise level from the get go.  To add insult to the injury, the framework isn’t thoroughly documented.  I found it extremely difficult to find something as basic as options for methods and the associated values that the options can contain.  Asking the forums just got overly redundant and thus required me to manually go through the framework code.  This isn’t too bad, but just took way too much time.  Isn’t time saving the reason why I chose a framework?

CakePHP on the other hand is very well documented.  In fact, the documentation is so good that you can get up and running in a few hours.  While the ORM isn’t as detailed as Symfony, I didn’t have to learn a whole new language in order to create simple queries.  CakePHP, to me just, just fits the PHP mindset better.  If you understand the MVC model and PHP, you probably can get the ball rolling in CakePHP within the hour.

Having said that, the testing utility in Symfony is amazing and the fact that you can develop offline using Symfony by using the built in models works really nicely too.  CakePHP is still faster for me for developing and creating databases and tables in MySQL using PHPMyAdmin is much more intuitive than hand coding everything in Symfony using Doctrine.

Apparently the early gripes with CakePHP were about HABTM tables, but those are now fixed in at least CakePHP 1.3.  The documentation in CakePHP as well as the support community on IRC is much more complete than Symfony.  This leads to a much faster development time and less downtime when you are stuck for an answer.

Overall CakePHP 1.3 is the clear winner in my book for development of the majority of the websites out there.  If you need enterprise level code Symfony might work for you, but I’m fairly certain the majority of the developers will develop from scratch to accomplish complete security and thorough code auditing.

Posted in Code, Software | No Comments »

Intro to data manipulation through GNU Utilities (part 1)

9th June 2006

This is a quick tutorial to go over how using a few basic commands can save you hours of work (either through code or manual labor). If you do not have a version of *nix installed, I would suggest installing Cygwin. Cygwin is a free Linux-like enviroment which default installs Bash, cut, cat, etc.

You should only work with ASCII text files with these commands. Executing these commands on Binaries tend to not go too well. So if you have a Word document, you should first save whatever file you are working with in ASCII text. The goal here is not to worry about formatting of the text, but more on the content itself. Secondly you should run the dos2unix command on the document. This will get rid of those crazy ^M characters that Microsoft uses as a new line character.

Here are the common commands that you will use often for data manipulation:

  1. cat
  2. cut
  3. grep
  4. sed/awk

The last one is a bit more difficult and whenever I find time to do a small writeup on regular expressions I’ll cover that.

The cat command is going to be the basis for all of the commands. You can actually use both the cut and grep command without using cat, but for I find the commands much easier to use this way and it also will help show how powerful the *nix enviroment really is.

The cut command is very useful for removing a section of text from each line seperated by a hard line break. This is very powerful if you are dealing with a lot of repetive information seperated by line breaks. For instance, each line contains someone’s name, phone number, and social security number seperated by some sort of delimiter.

ie: Joe|555-555-5555|123-45-6789
Bob|555-123-5555|123-13-2345

The last command, grep, is used to search for lines containing a given pattern. This is often used to search for a line containing information that is often encompassed with a lot of non-related junk data. Grep is great for log files, config files, and reports.

Posted in Code | 1 Comment »