I have been building a new platform for an existing product over the past year. It so happens that we are using the CakePHP framework (version 2.2.1 as of this writing). The database connection requirements are designed to distribute the load of database access across multiple instances. The idea is we will setup a MySQL master / slave combination. All of the inserts, updates, and deletes will be performed on the master database. All of the selects will be sent to the slave database.
As I thought about this in more depth, I wasn’t quite sure how I would accomplish this. I first thought about using the beforeFind and beforeSave callbacks in the AppModel.php. I would set the $this->useDbConfig to readOnly or writeOnly and viola, instant database changing! WRONG! It didn’t work. Why? Because the $this->useDbConfig is used to bind a model to a database. It’s a one-to-one relationship model-to-database. It didn’t always work trying to switch between the two using this method. Continue reading
Managing CakePHP configuration files in a multi-person team environment can be frustrating. Here is a really slick way to build custom configuration files without have to continuously make changes every time someone makes a commit to the repo. An no, you won’t have to pass around files manually to keep things updated. Let’s get started!
First, this article assumes you are running the latest version of the CakePHP framework (2.2.1 stable at the time of this writing), you are familiar with how CakePHP works, and you are using a *nix environment (Linux, Mac, etc.). Continue reading
I do not pretend to know anything about the potential of Apple TV. However, if Steve Jobs said he “cracked the code” for the interface, it must have a feature set that average person would not only find easy to use, but would actually want in a TV. I am going to present my take on what the “perfect” TV feature set would be. Continue reading
I did some digging on Google and found a few helps, but nothing as specific as I wanted. So here I present how to get Parallels to server up MAMP pages from my OSX MacBook Pro. Continue reading
I had a real epiphany today. I suddenly realized that I am so busy doing work at work, I don’t have time for growth. I find that there is no room for judgment or creativity on my part. I am told what to do, how to do it, and the order to do it in. And the priorities may change from one day to the next. I am not allowed to provide input or innovation. It’s almost mechanical. The only thing I really get to decide is determining how long it’s going to take, but even that gets negotiated. To make matters worse, I get thrown the task of fixing other coders bugs. I feel like an extension of someone else. Like I am there to be the clone of someone who feels they need another body. They decide what needs to get done, how they want it done, whether or not it sounds too difficult, and how to implement: design, function, and format. In a word, micromanaged. Didn’t that go out of style with the 90′s?
How did I come to that realization? It has taken some time to realize, but it hit me full force today when I couldn’t even think outside the box for a simple reordering algorithm. I was given the opportunity for a brief moment and I froze! I have allowed myself to get to this point. It’s not from lack of effort however. I always put forth ideas, best practices, and user interaction improvements. The problem is, someone else has control and I always get overridden. I don’t even know if my ideas get passed on to the powers that be. I am not included in any discussion, asked what I think, or allowed to propose designs or functionality. Again, I am told what to do, every step of the way. Continue reading
Wow! I had the WORST customer service ever from Bert Murdock Music in Orem, Utah. I am still in shock about the whole thing. I thought these stories were always made up.
To bring you up to speed, I went to Bert Murdock Music in Orem to purchase some microphones. We want to do some recording with family members. We got the idea from storycorps.org. We thought it would be a great idea to interview family members. So I found a place to purchase microphones.
I purchases two microphones on Saturday, Sep. 11, 2010. My receipt says 1:59pm. I brought them home, hooked them up and played with them on GarageBand and my Mac through my 4 port m-audio fast track ultra over the weekend. They worked great and I was able to make a few recordings. Then the unthinkable… Continue reading
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?”
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?”
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. Continue reading
Through the years, I have realized there are two types of web applications.
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! Continue reading