Blog
SUBMIT A FORM WITH AJAX |
||
|
09.11.2008 |
||
|
The new release of CakePHP (RC2) comes with a completely rewritten AjaxHelper::form() function (with the disadvantage that it breaks existing code). Let’s look how to use it: I think this code is self-explanatory (if not, please write a comment). What’s cool about this code is the fact that it will also work when you disable JavaScript. The form will submit the form data in both cases to /controller/action. That means you have to distinguish in your action whether it is called via Ajax or not, and then you have at least to select the appropriate layout. You can do it in the following way (thanks to nate for this hint):
|
||
HOW TO GET A FILE EXTENSION IN PHP, PERL... |
||
|
09.11.2008 |
||
|
How to get a file extension in PHP: $ext = pathinfo($file_name, PATHINFO_EXTENSION); How to get a file extension in Perl: my $ext = ($file_name =~ m/[^.]+$/)[0]; How to get a file extension in Ruby: ext = File.extname(file_name) How to get a file extension in Bash: ext=${file_name#*.} name=${file_name%.*} How to get a file extension in Python (thanks to Jensen): import os ext = os.path.splitext(file_name)[1] |
||
HOW TO USE FIREBIRD WITH PHP? |
||
|
09.11.2008 |
||
|
The simplest way of adding Firebird support is adding the interbase module to an existing PHP installation. On Windows it's a matter of simply unpacking the .zip package and extracting the PHP_INTERBASE.DLL extension, or choosing the Interbase package while installing from setup.exe installer. Please note that in the latter case, the installer also installs old gds32.dll from InterBase 6.0, which you need to delete manually and replace with Firebird's fbclient.dll (just rename it to gds32.dll). On Linux, you need to compile the interbase.so module. It is done like this:1. install php-devel package (needed for phpize. If you already have phpize command, you don't need it) 2. get the php source code for the exact version as you are running 3. unpack the source and go to ext/interbase directory 4. run: phpize 5. run: ./configure --with-interbase=shared,/opt/firebird 6. run: make 7. this will create interbase.so module (most probably in .libs subdirectory) The following steps apply for Windows as well: 8. copy the module (.so or .dll) to /usr/lib/php/extensions (or whatever is the 'extension_dir' setting in php.ini) 9. uncomment the ;extension=php_interbase.dll in php.ini 10. restart Apache if you are using PHP with it Here's a set of tests to see if you extension is working properly: http://fbexport.sourceforge.net/ibtest.php.txt Please note that PHP5.x has a bug regarding NUMERIC(18,7) and other datatypes with precision higher than 6. The bug has been reported to PHP bug tracker, but is not fixed yet (PHP 5.2.3). |
||



The simplest way of adding Firebird support is adding the interbase module to an existing PHP installation. On Windows it's a matter of simply unpacking the .zip package and extracting the PHP_INTERBASE.DLL extension, or choosing the Interbase package while installing from setup.exe installer. Please note that in the latter case, the installer also installs old gds32.dll from InterBase 6.0, which you need to delete manually and replace with Firebird's fbclient.dll (just rename it to gds32.dll). On Linux, you need to compile the interbase.so module. It is done like this:
