RSS

Monthly Archives: August 2010

Install geoip on xampp

Geocoding (finding latitude/longitude for street addresses), Geotagging (tagging media with latitude/longitude coordinates), and Geolocation (finding latitude/longitude of computer with IP X-Forwarded-For). There are some options to install on linux environment:

# wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
# gunzip GeoLiteCity.dat.gz
# sudo mkdir -v /usr/share/GeoIP
# sudo mv -v GeoLiteCity.dat /usr/share/GeoIP/GeoIPCity.dat

Install geoip with php5
# sudo apt-get install php5-geoip (ubuntu)

# sudo yum install php5-geoip (centOS)

# sudo pecl install geoip (with PECL)

In Windows environment we have to add extension “php_geoip.dll” with PHP

Download extension from here : http://blog.svnlabs.com/php-5.2.1_geoip-w32.zip

Copy “php_geoip.dll” to xampp “php/ext” .. add a line in php.ini
“extension=php_geoip.dll” and restart xampp

This extension will work on development system using Windows, Apache 2.2.3 and PHP 5.2.10.
We can
check “geoip” with phpinfo() module is loaded.

<?php
$record
= geoip_record_by_name('www.svnlabs.com');
if (
$record) {
print_r($record);
}
?>

Array
(
    [country_code] => US
    [region] => CA
    [city] => Marina...
    [postal_code] =>
    [latitude] => 23.9776792798
    [longitude] => -128.435796741
    [dma_code] => 867
    [area_code] => 400
)

<?php
$result = geoip_record_by_name('78.aaa.yyy.xxx');
var_dump($result);
?>

There is alternative PHP version of the GeoIP API from MaxMind,
but this solution is quite slow on servers. MaxMind uses MaxMind database to display geo locations.
Advertisements
 

Tags: , , , , , , ,

How to run cronjobs per second?

Have you checked my previous article on cronjobs…

http://blog.svnlabs.com/tag/crontab-command-line/

To run cronjob per second you have to execute crontab/cronjob per minute and then have to run task in cron file per second using PHP function time_sleep_until().

<?php

$start = microtime(true);

for($ii=0;$ii<60;$ii++)
{

//……………………….

/// here is the tasks which need to run per second…

//……………………….

time_sleep_until($start + $ii + 1);
} // end for

if (!function_exists(‘time_sleep_until’))
{
function time_sleep_until($future)
{
if ($future < time())
{
trigger_error(“Time in past”, E_USER_WARNING);
return false;
}

usleep(($future – microtime(1))*1000000);
return true;
}
}

?>

 
1 Comment

Posted by on August 21, 2010 in CentOS, Fedora, Linux, Tricks

 

Tags: , , , ,

Make your website instantly available in other languages

I think everyone know about google language translation

We can use http://www.wibiya.com/ to translate webpage/blog content in worlds very known languages

Add the free Google Translate gadget to instantly translate your webpage or blog into other languages: English, Afrikaans, Albanian, Arabic, Armenian, Azerbaijani, Basque, Belarusian, Bulgarian, Catalan, Chinese, Croatian, Czech, Danish, Dutch, Estonian, Filipino, Finnish, French, Galician, Georgian, German, Greek, Haitian Creole, Hebrew, Hindi, Hungarian, Icelandic, Indonesian, Irish, Italian, Japanese, Korean, Latvian, Lithuanian, Macedonian, Malay, Maltese, Norwegian, Persian, Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovenian, Spanish, Swahili, Swedish, Thai, Turkish, Ukrainian, Urdu, Vietnamese, Welsh, Yiddish….

Other translation tools
http://babelfish.yahoo.com/
http://www.microsofttranslator.com/
http://www.systran.co.uk/

 
 

Tags: , , , , , ,

Wish you a Happy Independence Day

Wish you a Happy Independence Day
Salute TIRANGA

I M PROUD TO BE AN INDIAN
HAM HOGE KAMYAB HAM HOGE KAMYAB EK DIN MAN ME HE VISVAS PURA HE VISVAS HAM HOGE KAMYAB EK DIN

SAARE JAHAN SE ACCHA… HINDUSTAN HAMAR

HAPPY INDEPENDENCE DAY

happy independence day all my friends

JAI HIND

 
Leave a comment

Posted by on August 14, 2010 in Uncategorized

 

Tags: , , ,

CakePHP vs YII

Have you checked my previous article on CakePHP…

http://blog.svnlabs.com/2009/11/cakephp-in-svnlabs/

Yii (Yes, it is) — a high-performance component-based PHP framework best for developing large-scale Web applications. Yii have features, including MVC, DAO/ActiveRecord, I18N/L10N, caching, jQuery-based AJAX support, authentication and role-based access control, scaffolding, input validation, widgets, events, theming, Web services, and so on. Written in strict OOP, Yii is easy to use and is extremely flexible and extensible.

YII Features:

– Magic overloading functions
Lazy loading
– Authentication / Validation
– Widgets (sharing extensions)
– Yii console
– High-performance
– Templates
MVC Push-Pull
RBAC
– Test Case (PHPUnit, Selenium)
EAccelerator
– jQuery
– Zend support

I am currently reviewing YII in comparison with CakePHP … Keep in touch 🙂

 
 

Tags: , , , , , , , , , , ,