I had a call today from a client who was having trouble with Apple Mail. Specifically, there was a 25mb email sent to him by a family member that Mail was continually trying to ‘recover’ and send up to his Google Apps mail account. After a bit of googling, the answer was pretty easy, though asking someone to use the ‘rm’ command who’s never used the Terminal.app was a little concerning :)
# Close Mail.
# Open a new terminal window and paste the following:
# ls -la
# Then replace ‘email@domain.com’ with the one that matches the account that’s having issues
# rm ~/Library/Mail/email@domain.com/.OfflineCache
That should fix it.
Sometimes it’s useful to be able to browse via the file system via a GUI. So on the advice of @AndyGale I installed Samba on my Ubuntu OS instance and created a share for the entire server. The first part of these instructions were from labs.boulevart.be.
- open the samba config
sudo nano /etc/samba/smb.conf - change “security=user” to “security=share”
- comment out “passdb backend = tdbsam” and “obey pam restrictions = yes”
- add a line saying “map to guest = bad user”
- comment out the lines beginning “passwd program =” and “passwd chat = “
Then we need to add a new share to the conf
[share]
path = /
read only = no
guest ok = yes
Have waded through the net and found these the most useful.
- Download VMWare Fusion demo from https://www.vmware.com/tryvmware/?p=vmware-fusion&lp=1
- Get the server image you require from http://www.thoughtpolice.co.uk/vmware/#ubuntu8.04
- Install using the guide that matches your download http://www.thoughtpolice.co.uk/vmware/howto/1-minute-guide.html#ubuntu8.04
- Follow these instructions for installing SSH, VMWare tools http://intranation.com/entries/2009/03/development-virtual-machines-os-x-using-vmware-and/
Now you can set up apache, mysql etc as you would do normally on a VPS or dedicated box, using SSH.
I’ve been using TinyMCE as a text editor in my CMSs, and whilst it’s good, it can lead to the odd empty tag/para ending up in the html, font tags and all manner of other crap (especially if M$ Word has been involved at all), so I created a cakephp behaviour that uses the HTMLPurifier class to make all inputted html valid.
First, you need to download the most recent version of the HTMLPurifier class from http://htmlpurifier.org/download, drop this in /{app}/vendors, and save the pasted code as ‘brita.php’ in /{app}/models/behaviors/.
It’s dead simple to use, just do:
var $actsAs = array(
'Brita'=>array('synopsis', 'body', 'extended_body')
);
In the model(s) you need to clean up.
Saw this on IRC earlier, thought I’d blog it as it’s pretty useful info.
Add this method to your AppModel:
public function sum($field='total')
{
$data = $this->find('first', array(
'conditions'=>$conditions,
'fields'=>array('SUM('.$field.') AS summed'),
'contain'=>array()
));
return $data[0]['summed'];
}
Then call it like so:
$total = $this->Model->sum('cost');
Hope this is useful for someone.
And, here, to cap off a really terrible brain day, is the solution, using cake’s core functionality, to the find(‘neighours’) with habtm conundrum!
$this->Mixture->bindModel(array('hasOne'=>array('MixtureCategoriesMixture')), false);
$this->set('neighbours', $this->Mixture->find('neighbors', array(
'field' => 'Mixture.sku', 'value' => $this->data['Mixture']['sku'],
'conditions'=>array(
'MixtureCategoriesMixture.default'=>1,
'MixtureCategoriesMixture.mixture_category_id'=>$this->data['MixtureCategory'][0]['id'],
'Mixture.status'=>1
)
)));
Doh, doh doh!
After some IRCing, it appears I’d misunderstood how the array should work to get the method working correctly.
$this->set('neighbours', $this->Species->find('neighbors', array(
'field' => 'Species.latin_name', 'value' => $this->data['Species']['latin_name'], 'order'=>'asc',
'conditions'=>array(
'Species.species_category_id'=>$this->data['Species']['species_category_id'],
'Species.status'=>1
)
)));
What a plonker.
Found brain, solution realised, brainfart over, see http://blog.jben.net/post/125858269/update-on-find-neighbours-with-habtm
Brain found, solution realised, brain fart over, see http://blog.jben.net/post/125844770/update-on-find-neighbours