Unicode bangla writing using Bijoy (or Unijoy) keymap

Few days ago I released unicode based transliterator to write unicode bangla in web apps. Since then I was working on a unijoy version of that script.

Good news that the project has been finished. Last night I just uploaded all the contents in google project. This is a small javascript which will help to write unicode bangla in web applications using bijoy (or unijoy) keyboard mapping.

Old style Ref is also supported in this version.

You can see a live version of this script here
http://phpxperts.net/unijoy/example.htm

Or you can browse the subversion repository at
http://unijoybangla.googlecode.com/svn/trunk

Now you can write bangla in both phonetically and in unijoy key map.

Anyone will help me to release both of these scripts as a firefox extension?

Using More DBs concurrently in PHP+MySQL – a Solution

Last night Hasan provided me a new solution which seems awesome. I am describing it here

$db1 = mysql_connect("host","user","pwd")
mysql_select_db("db1", $db1);
$res1 = mysql_query("query",$db1);

$db2 = mysql_connect("host","user","pwd")
mysql_select_db("db2", $db2);
$res2 = mysql_query("query",$db2);

At this point you can only fetch records from you previous ResultSet, i.e $res1 – But you cannot execute new query in $db1, even if you supply the link as because the link was overwritten by the new db.

so at this point the following script will fail
$res3 = mysql_query("query",$db1); //this will fail

So how to solve that?

take a look below.
$db1 = mysql_connect("host","user","pwd")
mysql_select_db("db1", $db1);
$res1 = mysql_query("query",$db1);

$db2 = mysql_connect("host","user","pwd", true)
mysql_select_db("db2", $db2);
$res2 = mysql_query("query",$db2);

So mysql_connect hasa nother optional boolean parameter which indicates whether a link will be created or not. as we connect to the $db2 with this optional parameter set to ‘true’, so both link will remain live.

now the following query will execute successfully.
$res3 = mysql_query("query",$db1);

Thanks goes to Hasan for informing me abt the fourth parameter.

I got a Laptop

My Laptop

Yesterday I got a generous gift from Systech Digital, where I worked before I join somewherein. Rashidul Hasan, the IT Manager of Systech Digital managed a nice Laptop for Me. The model is Toshiba Satellite L30.

I am very happy with this fantastic gift. Thanks goes to Mahbubur Rahman, Rashidul Hasan, Omi Azad and Systech Digital.

I am now running Ubuntu in my Laptop.

Qucik and Dirty – using 2 DB concurrently in MySQL

Day b4 yesterday I was stuck with a simple and frustrating problem. You know that using builtin mysql support in PHP you cannot use concurrently more than one database to work with. That was also my problem while working in such a project where I badly need to read data from one database, validate it against existing data in second database and then insert the data into the second database. So you got the project? Yes its a simple data migration project. But the problem is that I cannot import the old database tables into the new one and I have to work with them keeping seperate.

So you may ask how about reading all the data from first database, then store it in a temporary media and then again read them while inserting in second db. Well that was not possible because in first DB I had 10 tables and in I have to merge all those info in two table in second database. Also I have to validate some of those data against existing data in second DB.

There comes the idea. What I did is a quick-n-dirty solution of this problem. I connected to the first DB using MySQL API, and I connected to the 2nd DB using MySQLi API. That gives me live connection of two DB at the same time. So I read data from first DB using MySQL API and then inserted using MySQLi API.

For sure I could apply another solutions like temporary storage. But why bother when you can trick??? This is just a one time operation, no matter how you do it. All you need is a merged output, at minimum efforts. Ha Ha Ha.

Just a small anouncement from me on localization

I have done couple of projects for the companies I am working in or worked out, which are localized applications. But most of those projects were ANSI based, not unicode. So I made a decision last night that I wont spend my time for any ANSI projects in near future. All my localized projects will be Unicode.

Some of my colleagues will be extremely happy seeing this announcement, I bet that. But I have to mention a few names who inspired me a lot for making such a decision, among those Ekushey, Ankur and Omicronlab to mention.

One more thing, If , by any chance I have to develop a solution for ANSI, be sure that there will also be a unicode port of that project. That means a Hybrid solution.

Thanks to all who inspired me.

Using Blog API – Part 2: Get Categories and Posts

In our first part we just discussed what is a blogging API and how we can utilize them. In this post I am going to show how to fetch available categories in a blog and how to retrieve a specific post.

To retrieve available categories you have to use metaWeblog.getCategories as shown below

<?php
	include("xmlrpc.inc.php");

	$c = new xmlrpc_client("/xmlrpc.php", "hasin.wordpress.com", 80);
	$c->return_type = 'phpvals'; // let client give us back php values instead of xmlrpcvals

	echo "<pre>";

	$x = new xmlrpcmsg("metaWeblog.getCategories",array(php_xmlrpc_encode("1"),
	                                     php_xmlrpc_encode("someusername"),
	                                     php_xmlrpc_encode("somepassword")));


	$r =$c->send($x);
    if ($r->errno=="0")
	print_r($r);
?>

And To retrieve a specific post you have to metaWeblog.getPost API as shown here

<?php
	include("xmlrpc.inc.php");

	$c = new xmlrpc_client("/xmlrpc.php", "hasin.wordpress.com", 80);
	$c->return_type = 'phpvals'; // let client give us back php values instead of xmlrpcvals

	echo "<pre>";

	$x = new xmlrpcmsg("metaWeblog.getPost",array(php_xmlrpc_encode("1"), //postId
	                                     php_xmlrpc_encode("someusername"),
	                                     php_xmlrpc_encode("somepassword")));


	$r =$c->send($x);
    if ($r->errno=="0")
	print_r($r);
?>

Little Afif

Little Afif with Papa

Afif is learning how to talk in alien language these days. He express many of his wishes using “gili-gili-gulu-gulu’ , ‘gggggiiiiiii’, ‘aoouuuu’ words. Everyday we talk for a long long time. Afif become very happy when his mom talks with him.

These days Afif sleeps sooner in my lap instead of his mom’s. So I got this duty unofficially. Afif also express his strong opinion to eat or ‘not to eat’ sometime just by trying to leap from her mom’s lap. He can now react with public expression. He get annoyed when someone tries to talk with him with same “Alien Language” that he speaks in. So we understand that he likes our “Bangla” to hear but he likes “Alien Lang.” much more to speak 😀

Afif’s mom took this picture week ago.

Packt Open Source CMS Award

A new award scheme was launched 24th July by Packt Publishing offering a first
prize of $5,000 and the title of best Open Source Content Management System,
2006. Voted for by a panel of independent judges and visitors to
www.PacktPub.com , the award is designed to
recognize and reward outstanding achievement in a high quality and highly
competitive marketplace.

Packt Publishing is currently looking for people to nominate their
favourite Content Management System at www.PacktPub.com/award. The five
projects that receive the most public nominations will go through to a final
round of voting, with a panel of judges and votes from users deciding who
receives the $5,000 prize.

For more information about the Packt Open Source Content Management System
Prize, please visit: www.PacktPub.com/award

Now Its time to Bring some Great Open Source CMS Up.

WordPress4SQLite – alpha one

The project finally see some light. It comes to a prematured state where it is working smoothely, but with lack of some features. I have to go thru every piece of code where SQL statements are present and I make them SQLite compatible. The project is not finished, Category and Image upload is not working properly but I will complete them next week. I have been suddenly bz in another official project which I have to complete within next 5 days, so I may not be able to contribute before next week. But I am extremely confident that I can solve those problems.

You can download this prematured version of WordPress4SQLite from the following link and just after modifying the config file as usually, you can proceed.

Please note that error reporting has been turned off just to save you from some annoyances :D. If want to turn error reporting on, open wp-includes/wp-db.php and remove the error_reporting() function.

There is a sample config.php file present already. You can modify it to kickstart using WordPress4SQLite. Please use absolute path for database file.

Download From Here : WordPress4SQLite

You can see a running version of WordPress4SQLite here

WordPress SQLite – Update One

1. Installer is Finished
2. WordPress DB core conversion finished

Now I am stuck with Role Management and I will finish it hopefully within a day. Last night a funny thing happened. In wordpress installer they check whether a table has been successfully created by invoking “SHOW Tables” command which is not compliant with SQLite. So I start searching how to get information about database scheme. After searching for a while, I finally went thru the code of phpsqliteadmin and found the solution.

Every SQLite database has a table called SQLITE_MASTER which remains hidden. So you can just execute the following command to get all the table names.

“SELECT name FROM SQLITE_MASTER where type=’table'”

Really Cool. !!! I am very much excited abt this project and I am sure – I will release it in friendly way. In WordPress SQLite edition you can use standard wordpress distribution (with modified db core) but you can just configure your config file and add the following line.

driver = ‘sqlite’

I just want to avoid all the hassle for the end user 🙂

Lets see!!