Archive by Author

Install SpamAssassin on Mac OSX 10.6

I had an interesting conversation with a colleague of mine today. You see, we are working with a company that is going to do some marketing for us. The issue we are facing is their IT guy is a Microsoft kool-aide drinker. He knows just enough to get himself in trouble, but couldn’t code his way out of a paper bag. But we have to work through him to get any email sent. We are being blocked because he looks at the content we want to send and says, “There is not enough content, it will be marked as spam. We need more content.”

Someone please correct me if I am wrong, but spam filtering does not necessarily only look at the quantity of the content, but the quality and specific words the contained within it. For example, spamassassin uses filtering that will check the content and apply a score based on multiple things like: relays, headers, subject line, dates, etc. So the first question I asked was, “How can this Microsoft loving IT guy eyeball the content and be able to tell it will be marked as spam?”


Read more

How To Treat A Coder (a Geek)

I have been thinking a lot lately about what it means to write code. What is a coder exactly? I have asked myself the question, “Why are there some companies who understand how to treat coders, and others who do not?”


Read more

CakePHP Shell Not Seeing MySQL with MAMP Pro MAC

MAMP is a great product. It makes using the MAMP stack on MAC very easy. I liked it so much I actually purchased MAMP Pro. Installing was a breeze, configuration is simple, and it is up and running in no time. However, for some reason, when I am trying to connect to MySQL from a CakePHP shell, the database connection cannot be found.
Read more

Limit Data by User with CakePHP

CakePHPThrough the years, I have realized there are two types of web applications.

  • Community
  • Single User

While there are certainly some hybrid combination’s of these classifications, all applications can be categorized into these two categories. For example PHPNuke. It’s a single login to a community. As a user, you can use all of the functionality in the application AND you can see other users, etc. While something like FaceBook for example is a Hybrid of community and single user. While you can allow other users to see your data and content, they cannot modify your data or settings. You own that and nobody else has access to it without your username and password.

So comes the question. How can I limit data to a specific user with CakePHP? I love the CakePHP framework. But I have never been able to get a straight answer from anyone on the proper “cakeish” way to limit data to a specific user. For example. Let’s say I want to build a check book balancing application. I want it to be available to multiple subscribers. While all subscribers have access to the same functionality, they do not all see or modify the same data. While their data should be limited, they may all have access to the same Bank. This means that any user should be able to see all the banks we currently support… for example.

I have searched the internet and posted to stackoverflow.com trying to find the answer to this question. It is apparent that I am not the only one trying to figure this out. Add in the potential complexity to provide ADMIN routing and what you potentially have is a complicated mess of code if it is not done properly.

Well, search no more my Internet Friends! I think I have figured out the mess. I have been able to use a combination of things I have learned from here and here. But ultimately, I had to build this with good old ingenuity and a lot of trial and error. Keep Reading!
Read more

Single Login For Multiple User Types with CakePHP

I started working on a project that requires a single login for multiple user types. Because of the way my mind organizes things, I was having difficulty getting my mind around multiple models pointing to the same table in the database. It just felt messy. But I found this to be the best solution. I can provide single user login and keep the user functionality separated.

In this case, I have managers and tenants both pointing to the users table. I simply add a ‘type’ column to the user table to track what type of user it is. Then in my callback methods on the models, I set the conditions for the beforeFind and the beforeSave within each model to it’s corresponding type. This keeps both the data it displays and the data it saves in check and accurate. Here is what my manager model looks like.

<?php
class Manager extends AppModel {

 var $name = 'Manager';
 var $useTable = 'users';

 // only return users where type = Manager
 function beforeFind($queryData) {
$queryData['conditions']['Manager.type'] = 'Manager';
return $queryData;
 }

 // Ensure the Type is set to Manager before saving this record
 function beforeSave() {
$this->data['Manager']['type'] = 'Manager';
return true;
 }

}

?>

The same would apply to the tenants model. This works like a charm. It helps to provide excellent separation between user types without writing a lot of extra code to manage and check for the differences in user types.

Happy coding!

Is the customer always right?

I have had some discussions with a project manager about how we use technology and the decision making process behind it. During one such discussion I raised issues with the choice of technologies for the development of some tools we were developing. The debate came to an abrupt end when he said, “The customer is always right.” This got me thinking. Is that true? Should it be that way?
Read more

Open Source CakePHP Components

CakePHPI am getting more focused in my engineering career. Lately I have been feeling a strong desire to contribute to the open source community. Of course by open source community I mean contributing code and making it available to anyone who wants to use it… for free. As such, I decided to pick something I am passionate about. I have decided to create components, helpers, and other bits of code that are usable with the CakePHP framework. I have also decided to make these snippets of code available on GitHub.
Read more

Job Interviews: Fair Question?

A few days ago I read a blog about job interviews. The way I found it was by glancing through a LinkedIn summary email I get frequently. The email contained a snippet about how to answer the question, “Why do you want to work here?” I followed the link to the blog, read the article, and watched the video as to how to respond. I must say, it’s a huge steamy crock of crap! Their response as to how to answer this question is similar to saying, “I have read your profile on FaceBook. I talked to other people who have dated you. I have read your blog. I want to marry you.” What!? Are you kidding me?
Read more

Domain Validation Class Updated

Around three weeks ago, I sent an email to iana.org about their TLD file. (http://data.iana.org/TLD/tlds-alpha-by-domain.txt) This is the file that contains a list of all the valid top level domains (TLDs) on the Internet.  Here is a snippet from the email I sent requesting how to best access this file for my domains class:
Read more

AJAX Loading Image Generation Web 2.0

Have you ever wanted to create an animated .gif for your Ajax enabled lightbox? Or any other Ajax/Processing screen where you want to give the user the impression something is actually happening in the background? Well, now you can and you barely have to life a finger! I found this new website that will not only allow you to pick the style, but you can also pick the colors; foreground and background! Just zip over to to http://ajaxload.info/ and get yours today!