Thursday, July 22, 2010

PHP reading from 2 mysql databases with different encoding

I came across a problem of reading data from 2 mySQL databases
one with latin1 encoding and have Arabic char
The other is in UTF encoding and have Arabic Char
the final php page is using UTF encoding
i tried allot and I searched allot for a solution and i came to this solution
i have only one user having access to both databases
code below:
// open database 1
$dbc = mysql_connect (DB_HOST, DB_USER, DB_PASSWORD);
$var_select=mysql_select_db (DB_NAME1);
//first read the data from the latin1
mysql_query("SET NAMES latin1;");
mysql_query("SET CHARACTER_SET latin1;");
mysql_query("SET character_set_client=latin1");
mysql_query("SET character_set_connection=latin1");
mysql_query("SET character_set_database=latin1");
mysql_query("SET character_set_results=latin1");
mysql_query("SET character_set_server=latin1");
$query1="SELECT quesr";
$result1=mysql_query($query1);
$ris1=mysql_fetch_row($result1);
$datalatin1=$ris1[0];
// convert data to utf
$datalatin1=$user=iconv("windows-1256","utf-8", $datalatin1);
//first read the data from the UTF
mysql_query("SET NAMES utf8;");
mysql_query("SET CHARACTER_SET utf8;");
mysql_query("SET character_set_client=utf8");
mysql_query("SET character_set_connection=utf8");
mysql_query("SET character_set_database=utf8");
mysql_query("SET character_set_results=utf8");
mysql_query("SET character_set_server=utf8");
$query="SELECT quesr";
// can use the converted $datalatin1 in the query as it's not UTF
$result=mysql_query($query);
$ris=mysql_fetch_row($result);
$datautf1=$ris[0];

Tuesday, July 20, 2010

Tone's Brush Set Version 2

ound these amazing videos, using Tone's Brush Set Version 2
check them




Tuesday, July 13, 2010

Geolocation API and new service from whereinme.com

"The W3C Geolocation API is an effort by the W3C to standardize an interface to retrieve the geographical location information for a client-side device" information from wikipedia site


a new service from whereinme.com to allow users using devices supporting the geolocation api to add new POIs using their own location.
first you need to register to the site here then you can connect to the site from your mobile and add the information of the POI and it will be saved using you current GPS location



this is tested on:
1- N900 with the built-in web browser and maemo-geolocation extension and
2- Iphone 4 with built-in web browser
3- Samsung Galaxy S / Android 2.2 (Updated 29/11/2010)

whereinme.com is a community POIs with categories, ranking, and comments

try it and tell me if it works on your mobile

the web site will ask you to allow it to find your location, so you need to accept it

Monday, July 5, 2010

How DSLR auto mode parameters differs

I always think of the auto modes in my DSLR and how they differs in the mean of parameters (F number, shuter speed, ...)
so i did a quick test using my D90 and if you have time to do it please do it and send me the result
Camera: D90
Lens: Nikon 18-135
Test description: take the same shoot with all the auto modes and compare the parameters
Results:

Mode Flash F ISO Shutter
Auto yes 3.5 800 1/60
Portrait yes 3.5 800 1/60
Landscape no 5.6 800 1/8
Close-up yes 5.6 200 1/125
Sports no 3.5 1600 1/30
Night portrait yes 3.5 800 1/15

from the table i see that auto-mode assumed it's a portrait photo