CakePHP app/tmp permissions

chown -R www-data app/tmp

first run the simple PHP script

 <?php echo `whoami`; ?>

Whatever gets output by this script is your web server user.
And then just cd into your app folder and do

chown -R whateverGotOutputByThePHPScriptAbove tmp

Rubik’s cube solution in one page

פתרון לקוביה הונגרית, לא אני המצאתי אותו, אך איבדתי את הדף מספיק פעמים והייתי צריך לשחזר אותו כדי שלתת לאחרים, אז הנה הכנתי אותו בפעם האחרונה וסרקתי אותו.
תהנו
עמיחי היינס

AWS mysql data on another volume for increased performance and security

Running MySQL on Amazon EC2 with EBS (Elastic Block Store)
Use the AWS management console which is the web based gui for managing EC2.
Click on EC2 dashboard, then click on EBS Volume, then Click on CreateVolume. No snapshot, choose 8 BG or whatever you want to pay for, and same geographical zone as the EC2 computer.
Now log in to the terminal with ssh and

sudo apt-get install -y xfsprogs
grep -q xfs /proc/filesystems || sudo modprobe xfs
# the next command fails, couldn't find fix on internet.
#sudo /sbin/MAKEDEV sdh
sudo mkfs.xfs /dev/sdh

didn’t work because I used an alpha version of ubuntu – not the stable long term support release.
Now it all works.

AWS ubuntu

1. search for AMI id in the ubuntu site, I use ami-19dd1670
2. after login run:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install apache2
curl http://localhost/
sudo apt-get install php5 libapache2-mod-php5
sudo /etc/init.d/apache2 restart
sudo vim /var/www/phpinfo.php # <?php phpinfo(); ?>
curl http://localhost/phpinfo.php
sudo apt-get install mysql-server
sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin
sudo /etc/init.d/apache2 restart

Instead of ftp, use dropbox: (https://www.dropbox.com/install?os=lnx)

cd ~ && wget -O - http://www.dropbox.com/download?plat=lnx.x86 | tar xzf -
~/.dropbox-dist/dropboxd

Mensa Riddle

What is the only number between 1000 and 2000 which is not a sum of consecutive natural numbers?

That was interesting enough for a little program. I wrote a small program to check this and found many solutions :(

You can check the source in your browser. Be patient when you click the link to start the calculation, you won’t see anything for several seconds until all calculations are complete. I wanted this program to be as small and easy to understand as possible.

Did I make a mistake? Let me know. Here is the little program.

redirecting subdomains under localhost to localhost

I just want the subdomain as a parameter in my application.
Here is a link to the instructions for ubuntu.

sudo apt-get install dnsmasq
sudo vim /etc/dnsmasq.d/localhost

add this text to the newly created file: “address=/localhost/127.0.0.1″

sudo /etc/init.d/dnsmasq restart
sudo vim /etc/dhcp/dhclient.conf

find and uncomment this line (line 20): #prepend domain-name-servers 127.0.0.1;
right click and disable networking, near the clock, again to enable.

you should be able to navigate to any.imaginary.sub.domain.localhost and get the regular result of navigating to localhost.