Bluetooth Handling Comparison Between Macintosh & Linux

We are now entering a Bluetooth century, a periods where Bluetooth are exist right up next to large numbers of gadgets. From entry level mobile phones to portable multimedia player equipments & now become a standard kit for notebooks or PCs. It’s presents replacing an old IrDA (infra red) data transfer technology. Still remember when I used an old Micron laptop & Siemens SL45i which both are equipped with IrDA link to did some data exchanges. And both too still I keep just for my own personal collections museum box.

Although that Bluetooth is not a modern technology, but it still become a mystery for some Unix based OS (CMIIW). This “mystery” word referring to OS native (kernel) software incapability to handle communication through Bluetooth between devices. I’m not talking about Windows series on this since it already robust & mature. Windows makes Bluetooth complied with main aspects; 3rd party drivers availability, the GUI & ease of use. Especially for Bluetooth, I agree with “Plug & Play” terms in Windows, but most “Plug & Pray” in Linux. Be ready to feel sad when your OS can’t provide a Bluetooth communication to your gadget.

Anyway, the Bluetooth handling in Macintosh is very easy to setup. I did the test with Nokia mobile phone & made a file transfer from and to between my laptop & the phone, just like a Nokia PC Suite software in Windows. First of all, make sure that you have already activate the Bluetooth link on both devices. Next from right upper panel on your Mac, you can see the Bluetooth icon. Make a click on it & select Browse Device… menu.



A Browse Files window will show up & you have to pick one device you want to pair after automatically search process finished. Continued to click Browse button.



Next, it will show the content of the memory on a new Browsing… window. You can decide whether you want to get or send files from this point. Just for example, you may want to get a file from the memory, select one file & click Get… button.



Then, a small window will appear indicate the progress of the process.



When it finished out, the file will be stored on default Documents directory. Just open your Finder from kicker shortcut.



It seem that you have succeeded to make a handshake between your Mac & gadget via Bluetooth. The whole process are quite easy. Just couple of clicks on an intuitive interfaces & it’s done. This Tiger are able to handling Bluetooth devices without 3rd party device driver.

What about Linux? I got to test out Ubuntu 7.10 Live CD with this & here below is the result.



The GNOME interface within Ubuntu 7.10 are similar to Macintosh. You may see the Bluetooth icon on the right upper to the status panel. Select Browse Device… menu from the icon. Anyway, the device search process are succeeded to identify the mobile phone name.



After clicking the Continue button, it raises an error message box saying something about invalid location through OBEX protocol.



Nothing error message are listed in on /var/log/messages & I still confusing about this error. Curious about this, I tried on a Fedora 7 box & still find out that it even worst than Ubuntu 7.10. This Fedora only show 2 menu (Preferences & About) without Browse Device menu in Bluetooth applet kicker.



Finally, I discovered that there are 3rd party software called KBluetooth listed on sourceforge.net for Fedora 7 KDE plug-in but still I failed to compiles the ball packages. Something about KIO (KDE Input Output) failed binding with Qt3 library system. Anyway, the 2 samples above signed that Linux still having a big homework with natively Bluetooth handshaking especially to the OBEX file transfer protocol services. The immature Bluetooth software on Linux restrict common users to gain more advantages playing Bluetooth on their gadgets. This is one of several aspect impacts to the terms that Linux is difficult to learn. Anyone agree with this?

Labels: , , , , , ,

  Post a Comment

Simple AJAX Methodology

What is AJAX? Well you can see what is it stand for behind the word to the left image shown. But - for those who just heard AJAX acronym - what does it like? What does it purposed to? Many of AJAX online documentation you can pointed to and learned, but anyway, this official wiki page is a good start. As personally for me, AJAX give many useful things in a web programming. Generally, it can eliminated some limitations you will face in a pure HTML page. And somehow, it can make website more attractive & increasing interactivity.

Moreover, this blog article would like describe out about a simple AJAX implementation, especially just for beginner programmer like me ;-). AJAX technology is not a latest one in World Wide Web but it’s almost new to me. I’m not an expert but this is my first experience to AJAX and I’d like to share about it to you. Think about a job but you have to force finished it only with one tool. And this was happened to me when I had to create a web chat module written in PHP.

Basically, a common rule acceptable chat application is that it has capability to refresh the display automatically when everyone leave a message, for example: Yahoo Messenger or IRC. In a regular HTML page (web based application), you can use a META tag but it will refresh the whole page in a specified time. Look at an example below:

<meta equiv="refresh" content="5;URL=chat.php">


The lack is, the message you type in a input box will lost when the time achieved (5 second to get the page refreshed automatically – chat.php). Give it 60 second and you will get an unreliable chat application since there are long duration time to rendering a new screen.

The point is, you will never have a good chat application with above technique. But the mighty AJAX can. How? First of all, take a subject to the database side. This will hold the whole messages from users. Create a table contains 2 row in MySQL just like below script. (database name: chat)

# MySQL-Front Dump 2.5
#
# Host: xxx Database: chat
# --------------------------------------------------------
# Server version 4.1.11

USE chat;

#
# Table structure for table 'chat'
#

DROP TABLE IF EXISTS chat;
CREATE TABLE chat (
pesan text,
time time NOT NULL default '00:00:00'
) ENGINE=MyISAM DEFAULT CHARSET=latin1;


This is a simple table, you can rearrange it to your needs later. Anyway, look at the picture below and this what’s looks like with MySQLFront



Finally, I remade & simplify the chat AJAX script until it contain only 2 files; the chat library (chat.lib.php) & the form page (index.php).



Take a look at complete chat.lib.php class below:

<?php
class chat
{
var $host="your_db_host_server";
var $user="your_db_user";
var $db="chat";
var $pass="your_db_password";

function connect_easy($query)
{
$b = array();
if(!$connect = mysql_connect($this->host,$this->user,$this->pass));
if(!$dbr = mysql_select_db($this->db));
if(!($result = mysql_query($query)));
@$num = mysql_num_rows($result);
@$num2 = mysql_num_fields($result);
for($x=0;$x<$num;$x++)
{
$a = mysql_fetch_array($result);
for($i=0;$i<$num2;$i++)
{
$b[$x][$i] = html_entity_decode($a[$i]);
}
}
return $b;
}

function show($a)
{
if(count($a)>0)
{
$a=array_reverse($a);
if(count($a)<9)
$end=count($a);
else
$end=9;
for($i=0;$i<$end;$i++)
{
echo "<font size=2 color=red>".$a[$i][1]."</font>: ".$a[$i][0]."<br />";
}
}
}
}


All you need to do is change the variable of $host, $user and $pass and make an appropriate with your existing database server. Globally, this class has 2 function; the connection query & retrieval argument. Next, copy below script as form page and rename it as index.php.

<?
session_start();
require_once("chat.lib.php");
$action=$_GET["action"];
switch ($action)
{
case 'refresh' : $refresh = new chat();
$query="select * from chat";
$a=$refresh->connect_easy($query);
$refresh->show($a);
exit;
break;

case 'submit': $submit = new chat();
$query="insert into chat values ('".$_GET["chat"]."',NOW())"; $submit->connect_easy($query);
exit;
break;
}
?>

<html>
<head>
<title>AJAX Chat</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
function ajaxConstructor()
{
var request_;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer")
{
request_ = new ActiveXObject("Microsoft.XMLHTTP");
}
else
{
request_ = new XMLHttpRequest();
}
return request_;
}

var http = new Array();
var http2 = new Array();

function getRefresh()
{
var curDateTime = new Date();
http[curDateTime] = ajaxConstructor();

http[curDateTime].open('get', 'index.php?action=refresh');

http[curDateTime].onreadystatechange = function()
{
if (http[curDateTime].readyState == 4)
{
if (http[curDateTime].status == 200 || http[curDateTime].status == 304)
{
var response = http[curDateTime].responseText;
document.getElementById('ajax_chat').innerHTML = response;
}
}
}

http[curDateTime].send(null);
}

function getSubmit()
{
var curDateTime = new Date();
http2[curDateTime] = ajaxConstructor();
http2[curDateTime].open('get', 'index.php?action=submit&chat=' + document.ajax.chat.value);
http2[curDateTime].send(null);
}

function kirim()
{
getSubmit();
document.ajax.chat.value=" ";
}

function refreshLayar()
{
getRefresh();
window.setTimeout("refreshLayar()", 2000);
}
</script>
</head>

<body onLoad="refreshLayar()">
<div id="ajax_chat" style="overflow=auto; width: 375px; height: 200px; border: 1px;" align="left"></div><br>
<form action="JavaScript: kirim()" method="get" name="ajax">
<font size="2" face="Trebuchet MS, Verdana, MS Sans Serif">Tulis Pesan: </font>
<input name="chat" type="text">
<input type="button" value="Kirim" onClick="kirim()">
</form>
</body>
</html>


All the both files must stay in the same path of a web server and make sure that you have a valid parameter database connection described earlier in chat.lib.php. Take a test and call the index page from any browser available from client.



That’s it & you’re done. The explanation of index page is very much simple. It contains some of core chat functions in JavaScript; the AJAX constructor, refreshing display, submit message & auto render screen in 2 second!. Got it? Well, class dismissed & hope this lesson benefit to us.

Labels: , ,

  Post a Comment

Setting Up Email in Nokia 5610

Changing personal handset is an exhausted activity, especially to the who which have hundreds of contacts, including tens of scheduling appointments & some of critical configurations such as email setting. Which is – in other words – you have to move it whether you like or not. As what I did in last days, finally I had migrate to Nokia brand name cellular phone replacing my old HP6365 windows based mobile phone. I though, it is the time for me to get back to common communication model, as I tired of running PDA with me for more than 3 years!

I was interested with 5610 since attracted to the dummy model shown at one of local cellular market when I heading for a new candidate phone unexpectedly. The criteria for the candidates was too easy: high Mpx camera, supported large external memory, small screen, ease of use, internet ready, multimedia dedicated & light weight. At the ends, this 5610 series defeated others nominees which was: 02 Stealth, HTC Touch & N73.

No big deal that there’s no smart categories phone (Symbian or Windows OS) since still I miss for old phone function; call, messaging (SMS, MMS, Email & Instant Messaging), camera & MP3. I’d love to pick this 5610 because it’s sexiest form factor. It has passed all of my qualifications either. It also fit in my hands & great pleasure with the slider. Although I was shocked moving in from PDA, especially the lost touch screen & different UI. Anyway, it took times to take over the control.

Moving contacts was my first problem since Address Book from Laptop Outlook Express couldn’t permitted it. But it solved with Bluetooth data transfer per 5 contacts manually from HP6365. It also works moving the appointments data. Even that I had to made correction with some records. The Instant Messaging feature is so easily to setup & there’s no great difficult over it. I could connecting to Yahoo Messenger as easy as I connect from PC. One big shot for me was configuring the Gmail (Google mail) services since it more bit different from PDA or PC. And here below is the action I’d done from 5610 to setting the POP & SMTP configuration:

1. Make sure that you have an active account from Gmail. Check the POP activation option from Setting link.
2. Also make sure that you have already GPRS services activation from your network provider.
3. Go to 5610 Messaging Menu & point it to Email Message under Message Settings.
4. Edit Mailbox preferences & create a name. Example: GMail
5. Entry My name with your real name.
6. Set Email address with your email address complete with domain. Example: user_name@gmail.com
7. in Login information setting, fill your existing user name (without domain) & password.
8. Next, go to Incoming mail setting.
9. Set Incoming POP3 server with pop.gmail.com.
10. Set Security with Secure port.
12. Set Port with 995 and back to previous menu.
13. next, go to Outgoing setting.
14. Set Outgoing SMTP server with smtp.gmail.com.
15. Set SMTP authentification to On.
16. Set your user name & password (without domain name).
17. Set Security with Secure port.
18. Set Port with 465 and back to previous menu.
19. Save configuration & you’re done.
19. Give a try to retrieve or send an email.

Note that the configuration above is only works for Gmail email services, hence there’s no guarantee for others POP3 services or others network provider works for the same setting (I use SimPATI pre-paid from Telkomsel Indonesia for the test). I provide the configuration above also without any screenshot since I don’t have already a Java snap application. Be an understanding for my short review of my 5610.

Labels: , , , ,

  Post a Comment