alex

alex

(8 comments, 35 posts)

This user hasn't shared any profile information

Home page: http://www.alexfilatov.com

Posts by alex

MySQL import slow on ext4 Ubuntu Lucid Lynx x64

0

I’ve faced an issue whive making an SQL import on my Ubuntu Lucid Lynx on my macbook pro 6,2.

To make it working fast you need to disable writing barrier for the ext4 fs :

$ sudo vi /etc/fstab

you’ll see there something like:

/dev/sda3       /   ext4    errors=remount-ro 0 1

Just add there barrier=0 :

/dev/sda3       /               ext4    errors=remount-ro,barrier=0 0       1

and reboot.

After that change my SQL import performed very fast.

AJAX request with Symfony sfBrowser in Lime functional test

1
Hello Symfonians!
While doing functional tests for my current Symfony application I needed to make AJAX call to one of my project endpoint.
I have found that not Lime or sfBrowser have this ability out of the box.
So if you need to make AJAX request from your Lime functional test you need do the following in your test:
<?php
include(dirname(__FILE__) . '/../../bootstrap/functional.php');

$browser = new sfTestFunctional(new sfBrowser());
$limeTest = $browser->test();

$browser->setHttpHeader("X-Requested-With",	"XMLHttpRequest");

$browser->post('/ajax/uri', array('param_name' => 'param_value'))->
        with('request')->begin()->
        isParameter('module', 'someModule')->
        isParameter('action', 'someAction')->
        end()->

        with('response')->begin()->
        isStatusCode(200)->
        end();
?>
The key point is in the headers, you send to the server:
$browser->setHttpHeader("X-Requested-With",	"XMLHttpRequest");

Install Symfony 1.4 under Git

0
I’ve met in the Internet nice article about Howto Create Symfony 1.4 project with Git and cut out stuff related to Symfony and Git only.
1. Clone the symfony-1.4 svn repository.
$ git svn clone http://svn.symfony-project.com/branches/1.4  lib/vendor/symfony-1.4
When a 1.4 update comes along, go to the lib/vendor/symfony-1.4 directory and
execute the following command to update your copy.
$ git svn rebase
2. Now take care of the svn externals by first retrieving a script that extends git’s power
(based on a work by Andre Pang) and running git-svn-update-externals inside the
framework directory lib/vendor/symfony-1.4.
$ git clone git://git-sue.git.sourceforge.net/gitroot/git-sue/git-sue  lib/vendor/git-sue
$ cd lib/vendor/symfony-1.4
$ ../git-sue/git-svn-update-externals
3. Assuming you are back on your project root directory, verify your Symfony installation.
$ lib/vendor/symfony-1.4/data/bin/symfony -V
If Symfony has been installed correctly, the version should be displayed.
If you got something like
PHP Fatal error:  require(): Failed opening required '/home/alex/projects/php-projects/sfprojects/project/lib/vendor/symfony/lib/event_dispatcher/sfEventDispatcher.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/alex/projects/php-projects/sfprojects/project/lib/vendor/symfony/lib/autoload/sfCoreAutoload.class.php on line 99
This means that you didn’t find ‘event_dispatcher’ item that is external item. Please run
$ ../git-sue/git-svn-update-externals
to fix that.
4. Initialize your Symfony project.
$ lib/vendor/symfony-1.4/data/bin/symfony generate:project {project_name}
Note that Symfony also creates a symfony script at your project root directory. You can
use that instead of referring back to lib/vendor/…, which can be really repetitive.
5. Modify ./symfony to add directory tracking support for git. Before the chdir() call in
symfony, add the following line:
register_shutdown_function(create_function('', 'touch("cache/.ignore");
touch("log/.cache");'));
6. Initialize a project application. Repeat for other applications if project consists of more
than one application. You can skip this step if your project is still on the drawing board,
but pay attention to step 9.
$ ./symfony generate:app {app_name}
7. Configure git scm on project root and add user information. Signing key and remote
repository are optional (team/public project), although they are recommended for
obvious reasons.
$ git init
$ git config user.name {real_name}
$ git config user.email {email_address}
$ # git config user.signingkey {gpg_key}
$ # git remote add origin {repo_url}
8. Add git exclude information to .git/info/exclude. Files to be excluded are normally editing
backup copies and vendor files (which are already gitted). Special care is also needed
for cache and log directory because git don’t track empty directory but can introduce
symfony errors later on.
~
cache/*
!cache/.ignore
log/*
!log/.ignore
You can create the .ignore files now, especially if you skipped step 7.
$ touch cache/.ignore log/.ignore
9. Perform your initial commit. Optionally, you can also pushed your newly initialized
repository to the remote repo if you’ll be working with a team or just making it available
publicly.
$ git add .
$ git commit -a -m 'Initial commit.'
$ # git push origin master
10. Configure your httpd configuration with virtual hosting as appropriate, and don’t forgot to
alias /sf to lib/vendor/symfony-1.4/data/web/sf. Refer to the LAMP HOWTO for the
procedures. Upon (re)starting your httpd, you should be able now to see the Symfony
Congratulations page.

alex's RSS Feed
Get Adobe Flash playerPlugin by wpburn.com wordpress themes
Go to Top