House of Nerds
I have forgotten more than I'll ever know
I have forgotten more than I'll ever know
Feb 25th
Feb 8th
Here are a couple of nifty functions I came across, to limit the results that are returned in a Cake app.
When using the find() function, by default it will return all of the results. These two methods if placed in the appModel will only return results that are associated with a given user.
<?php function findMy($type, $options=array()) { if($this->hasField('user_id') && !empty($_SESSION['Auth']['User']['id'])){ $options['conditions'][$this->alias.'.user_id'] = $_SESSION['Auth']['User']['id']; return parent::find($type, $options); } else{ return parent::find($type, $options); } } function deleteMy($id = null, $cascade = true){ if (!empty($id)) { $this->id = $id; } $id = $this->id; if($this->hasField('user_id') && !empty($_SESSION['Auth']['User']['id'])){ $opt = array( 'conditions' => array( $this->alias.'.user_id' => $_SESSION['Auth']['User']['id'], $this->alias.'.id' => $id, ), ); if($this->find('count', $opt) > 0){ return parent::delete($id, $cascade); } } return false } ?>
Feb 8th
http://www.macworld.com/article/156941/2011/02/safariextension.html
Macworld Daily Reader brings the best Apple-related news, tips, and reviews from Macworld right to your iPad. You can read stories, save them for later, see what’s happening right now, and share stories with friends! Learn more at http://www.macworld.com/dailyreader
Feb 8th
Add this to the model
class Foo extends AppModel { var $currentUsrId = NULL; }
Then add this to the controller
class FooController extends AppController { function beforeFilter(){ parent::beforeFilter(); $this->Foo->;currentUsrId = $this->;Auth->user('id'); } }
Jan 29th
Installing Active Directory Windows 2008 Server
This video describes how to install active Directory using Windows 2008 Server.
Nov 20th
So it begins,
I’ve often flirted with the idea of blogging, preached to the importance of if nothing else keeping your own personal knowledge base. However it is something that I myself have just never gotten around to doing. So here we are, I’m out there live and online. I really don’t expect many people to ever read this, aside from the occasional lost individual looking for the same answer I was searching for at one point or another, but after 15 years in IT I’ve come to a very startling revelation, and that is that I have forgotten much more then I currently know.
Lost is the years I’ve spent figuring out how to setup BIND the hard way. Configuring what is now know as a LAMP server. Spending countless hours in FreeBSD trying to get a simple shared key IPSEC VPN to connect.
Offering complete web,email, database, and email services out of my 1 bedroom apartment try to just pay for my new DSL line, that I split with the guy 2 floors up, as we tried to hide the CAT5 in the cable conduit. Today’s on demand, cloud-oriented environment does it even matter?
The short of it is, that I’m not blogging for fame nor fortune, if nothing else I am looking just for a way to “organize” my thoughts hold on to ideas, and maybe provide some record for my children who might one day want to know who their father really was.