Archive for September, 2006
Friday, September 29th, 2006
-
Compiling Your PHP Scripts Into Executables
-
Sphider is a lightweight web spider and search engine written in PHP, using MySQL as its back end database. It is suitable for adding search functionality to small or medium sites (up to around 100,000 pages).
-
The power of Oracle databases without the licensing costs.
-
gure it to use static libraries rather than shared libraries. Dynamic binaries that use shared libraries save on disk space, but static binaries are faster. However, some systems require dynamic linking if you use the user-defined function (UDF) mechanism
(more…)
Posted in Links | No Comments »
Tuesday, September 26th, 2006
The FOSS team is gearing up for the annual FOSS.IN/2006 event to be held in November at Bangalore. The dates for the event as of now are November 24th to 26th. This year’s FOSS.IN event will be held over at the National Science Symposium Centre, IISc, Bangalore.
Speaker registrations are open at present. So if you’re interested in giving a tech talk at FOSS.IN, head over to FOSS.IN and register yourself.
Delegate registrations will open up during the first week of November.
Posted in General Stuff | 3 Comments »
Wednesday, September 20th, 2006
EnterpriseDB is an open source database system which allows you to port most Oracle applications over to their database server with almost no change to your code. They allow you to use the database free of cost, while providing paid support. So if you’re planning to reduce your TCO costs on your applications look at EnterpriseDB to run your database servers. EnterpriseDB is based on PostgreSQL database.
Link: EnterpriseDB : Open source based relational database, PostgreSQL based database management software
Posted in Databases | 2 Comments »
Wednesday, September 13th, 2006
An interesing article which explains what can go wrong when you’re handing UTF-8 character sets in PHP. The current versions of PHP do mangle up UTF-8 characters when you use the built in string functions in PHP.
“When I discovered that the popular web development tool PHP has almost complete ignorance of character encoding issues, blithely using 8 bits for characters, making it darn near impossible to develop good international web applications, I thought, enough is enough.”
“Darn near impossible” is perhaps too extreme but, certainly in PHP, if you simply “accept the defaults” you probably will end up with all kinds of strange characters and question marks the moment anyone outside the US or Western Europe submits some content to your site
Link to article: Php I18n Charsets - Web Application Component Toolkit
If you’re looking for a function set for PHP which is UTF-8 character safe, head over to the following link:
http://dev.splitbrain.org/view/darcs/dokuwiki/inc/utf8.php
They have a whole set of helper functions which allow you to manipulate UTF-8 data without corrupting the data.
Posted in PHP, Web Development | 2 Comments »
Monday, September 11th, 2006
Another did you know in PHP.
< ?
function test() {
echo "This function can be called dynamically!";
}
$function_name = "test";
$function_name();
?>
What is the output of the code show above? If you guessed that the output is “This function can be called dynamically!”, you may be a PHP guru.
The code shows you how to dynamically call the function test without actually calling test(). This method of calling a function could be useful in complex applications where you have to call on a function dynamically from you code.
Here’s a tutorial which shows you how to use :
- Dynamic Vairables
- Dynamic functions and objects
- Dynamic static properties and methods
When you’re trying to build more complex classes/applications, the need for doing things dynamically often arises. I figured I’d compile a list of ways to do dynamic PHP for those starting out with PHP. Please note that the list was elaborated with PHP 5 in mind.
Link: epiphantastic » Blog Archive » Dynamic PHP
Posted in PHP, Techniques | No Comments »
Monday, September 11th, 2006
Did you know that PHP has a built in function to detect which browser your visitor is running? Well neither did I till one of my collegues, Ansar, pointed out PHP’s get_browser function.
Here’s how to use this function:
< ?
$visitorbrowser = get_browser(null,true);
print_r($visitorbrowser);
?>
The output of this function is an object which contains details about the user’s browser and looks something like the one below:
[browser_name_regex] => ^mozilla/5\.0 (windows; .*; windows nt 5\.1.*) gecko/.* firefox/1\.5.*$
[browser_name_pattern] => Mozilla/5.0 (Windows; *; Windows NT 5.1*) Gecko/* Firefox/1.5*
[parent] => Firefox 1.5
[platform] => WinXP
[browser] => Firefox
[version] => 1.5
[majorver] => 1
[minorver] => 5
[css] => 2
[frames] => 1
[iframes] => 1
[tables] => 1
[cookies] => 1
[backgroundsounds] =>
[vbscript] =>
[javascript] => 1
[javaapplets] => 1
[activexcontrols] =>
[cdf] =>
[aol] =>
[beta] =>
[win16] =>
[crawler] =>
[stripper] =>
[wap] =>
[ismobiledevice] =>
[netclr] =>
To get PHP to detect your browser properly, you’ll have to get the updated browsecap.ini file and set the path to the file in your php.ini file.
To set the path to browsecap.ini file, add the following entries in your php.ini file:
[browscap]
browscap = /path/to/browscap.ini
Links:
browsecap.ini file: http://browsers.garykeith.com/downloads.asp
PHP get_browser function lookup: http://in.php.net/manual/en/function.get-browser.php
Posted in PHP | No Comments »
Tuesday, September 5th, 2006
GROUP_CONCAT(expr) - This function returns a string result with the concatenated non-NULL values from a group.
Where it can be useful?
For example to get PHP array without looping inside PHP:
CREATE TABLE services (
id INT UNSIGNED NOT NULL,
client_id INT UNSIGNED NOT NULL,
KEY (id));
INSERT INTO services
VALUES (1,1),(1,2),(3,5),(3,6),(3,7);
SELECT id,client_id FROM services WHERE id = 3;
+----+-----------+
| id | client_id
+----+-----------+
| 3 | 5
| 3 | 6
| 3 | 7
+----+-----------+
SELECT id,GROUP_CONCAT(client_id) FROM services WHERE id = 3 GROUP BY id;
+----+-------------------------+
| id | GROUP_CONCAT(client_id)
+----+-------------------------+
| 3 | 5,6,7
+----+-------------------------+
Read more: MySQL Performance Blog » GROUP_CONCAT useful GROUP BY extension
Posted in Databases, Techniques | No Comments »
Monday, September 4th, 2006
An interesting read from Peter Zaitsev about optimizing MySQL queries which use ORDER BY with LIMIT.
Suboptimal ORDER BY implementation, especially together with LIMIT is often the cause of MySQL Performance problems. Here is what you need to know about ORDER BY … LIMIT optimization to avoid these problems
Read on: MySQL Performance Blog » ORDER BY … LIMIT Performance Optimization
Posted in Databases, Techniques | No Comments »