jump to navigation

Javascript Debug Log October 13, 2008

Posted by vikhyat86 in Uncategorized.
Tags: , ,
add a comment

This was a really neat thing i stumbled upon while working with javascript . Im sure many of you will find it useful. You can debug your script by replacing your general alert() with log().

<html>
<div name=”log” id=”log” style=” height:35%; width:80%; overflow : auto ; visibility : visible ;border: 1px solid black; “><b><u>Logs:</u></b></div>
</html>
<script>
function log(temp)
{
logContent = “</br>”+ temp;
document.getElementById(“log”).innerHTML+=logContent;
document.getElementById(‘log’).scrollTop=document.getElementById(‘log’).scrollHeight;
}
log(“<font color=’red’>Errors:</font>This is an error”);
</script>

Cakephp migrations- Get it up and running September 29, 2008

Posted by vikhyat86 in cakephp, migrations.
Tags: , , , , , , ,
add a comment

Following is a short tutorial to save you the time to get migrations up and running for your cake, it includes installation directions for PEAR and MDB2 as well….

Tutorial was composed taking data/matter from several sources,some quoted at end…

REQUIREMENTS:
1)CAKEPHP installed, up and running.

SETTING IT UP:

  1. Download latest cakephp migrations vendors (compliments of Joel Moss).
  2. Simply copy the ‘vendors’ directory found in this package into your Cake root not you app/ or        cake/.
  3. Set up Cake console(IF NOT ALREADY DONE)
  4. Download latest version of PEAR.
  5. Go to this page and save this page as go-pear.php in same location as latest pear version.
  6. open CMD-PROMPT and change directory to the go-pear.php location and execute command “php      go-pear.php” .
  7. Follow the instructions of install and double click on registry file as specified at end of install (usually PEAR_ENV.reg).
  8. copy the entire latest version of PEAR folder (ex PEAR-1.7.2) into a preferred location and specify environment variables for it.
  9. Restart command prompt type ‘pear’ to confirm install.
  10. In command prompt,execute commands:-
  11. > pear install MDB2 /*pear might say :*/
    Ignoring installed package pear/MDB2
    Nothing to install
    /*which means already installed*/

    > pear install MDB2_Driver_mysql
    > pear install MDB2_Driver_sqlite

  12. To learn more about MDB2 Object, like how to use in php code or if more drivers etc required, visit
    http://www.installationwiki.org/MDB2 .
  13. Navigate via “cmd” to your project folder and then into /cake/console.
  14. Type in “php cake.php migrate“  and it will migrate to the latest version.

MIGRATIONS HOW TO:
(After completing above steps.)

  1. In command prompt navigate to your cake app root (again not /app or /cake)
    execute:
    > cake
    This will list all the shells that are installed and ready to run. If you installed everything
    correctly, then ‘migrate’ and ‘fixtures’ will be listed.
  2. Next Execute this:                                                                                                                                 > cake migrate help This will display the help and usage instructions.
  3. To generate your first migration file, run this:                                                                                        > cake migrate generate my_first_migration If you have not already configured your Cake database config, it will help you with that
    After that, the script will then check that the ’schema_info’ table exists in your database,
    and creates it if it isn’t there. This table is used to keep a record of what migration version
    your app is currently at. So it is very important and should not be tampered with.
  4. Your migration files have to be (and have been) placed in app/config/migrations.
  5. Then edit the file (using YAML) it generates after which you can migrate:
    > cake migrate
  6. Learn YAML from:
    YAML IN FIVE MINUTES
    More on YAML
  7. From here on you can follow Joel Moss’s famous tutorial “The joy of cake migrations my first tutorial”.

Sources and thanks to:
Joel Moss
Tim Koschützki

HAve fun….

Follow

Get every new post delivered to your Inbox.