CakePHP: Update model after changing database


After changes are made in the Database, to see the changes updated or reflect to the cakephp models, do the following
  1. Delete all the temporary model files from app/tmp/cache/models/*.
  2. In app/Config/core.php, change the debug value from 0 to 3, load your app in browser and again change it from 3 to 0 

Run Internet Explorer 7, 8, and 9 in Mac OS X


Source: http://osxdaily.com/2011/09/04/internet-explorer-for-mac-ie7-ie8-ie-9-free/


Following is the post from osxdaily.com

Notes: the admin password for all of the IE VMs is “Password1″ without the quotes. This has been tested and confirmed to work with Mac OS X 10.7 Lion and Mac OS X 10.6 Snow Leopard.
  1. Download & Install VirtualBox – Download Now (direct .dmg download link) – visit VirtualBox Downloads page
  2. Launch the Terminal (located in /Applications/Utilities/)
  3. Decide which versions of Internet Explorer you want to download and install – each version of Internet Explorer is contained within a separate virtual machine that runs within VirtualBox. In other words, if you want to run Internet Explorer 7, 8, and 9, you will need to download three separate VM’s, which may take a while so keep that in mind. Select the text below and copy it:
    • Install ALL versions of Internet Explorer: IE7, IE 8, and IE 9

    • curl -s https://raw.github.com/xdissent/ievms/master/ievms.sh | bash
    • Install Internet Explorer 7 Only

    • curl -s https://raw.github.com/xdissent/ievms/master/ievms.sh | IEVMS_VERSIONS="7" bash
    • Install Internet Explorer 8 Only

    • curl -s https://raw.github.com/xdissent/ievms/master/ievms.sh | IEVMS_VERSIONS="8" bash
    • Install Internet Explorer 9 Only

    • curl -s https://raw.github.com/xdissent/ievms/master/ievms.sh | IEVMS_VERSIONS="9" bash
  4. Copy and paste the selected command from above into the Terminal and hit return, this will start the download and conversion process. How long this takes depends on your internet connection and how many versions of Internet Explorer you chose to install
  5. Launch VirtualBox and boot Windows & Internet Explorer – select the virtual machine corresponding to the version of Internet Explorer you intend to use: IE7, IE8, IE9, then click on the “Start” button to boot that Windows machine with that version of Internet Explorer.
Remember that the default Windows admin password is “Password1″, it’s also the password hint within the VM should you forget it. 
That’s really all there is to it. These commands are part of the ievsms script from xdissent and it manages the entire download, conversion, and installation procedure, it doesn’t get much easier.
VM Snapshots Circumvent Microsofts 30 Day Limitation
The other great thing about this method is that it circumvents Microsofts 30 day limitation by utilizing snapshots, a feature built into VirtualBox. This preserves the original Windows VM state and allows you to continuously use the IE virtual machine without any time limitation simply by reverting to the original snapshot once the 30 day lock occurs.
To use a snapshot after the 30 day Windows expiration, just open VirtualBox, select the IE VM, and click on the “Snapshots” button. From here you can boot from the original snapshot that was created and use IE again for another 30 days. You can do this indefinitely, effectively having a clean IE test environment forever.

SVN: Moving subversion repository from one server to another server

This works between any kind of servers windows or linux...

Step 1: Backup / create a dump of old repository
svnadmin dump /path/to/repository > repo_name.dump 

Step 2: Create a new repository on the new server
svnadmin create /path/to/repository 

Step 3: Import the the old repository
svnadmin load /path/to/repository < repo_name.dump

Matlab: Sort 2D array with respect to one column

sort function in Matlab, sorts matrix columns independently.
But,
B = sortrows(A, column) sorts the matrix based on the columns specified in the vector column. 

Example:


>> A = [2 10; -1 20; 5 40]

A =

     2    10
    -1    50
     5    15

>> sortrows(A, 1)

ans =

    -1    50
     2    10
     5    15

>> sortrows(A, 2)

ans =

     2    10
    -1    50
     5    15



MATLAB: String tokenizer, string split

myStr = 'one_two_three';
pieces = regexp(myStr , '_', 'split')

%Output would be an pieces array with 3 elements.
pieces =

    'one'    'two'    'three'

Python contextlib for Timing Python code

If you've ever found yourself needing to measure the execution time of specific portions of your Python code, the `contextlib` module o...