Daily Prayer Timing

I have found a great service at islamicfinder.org. Its daily prayer timing. Now anyone can show the daily prayer timing on his own website. IS just a piece of html code to put on the website. I put here the code for the city Dhaka, Bangladesh.

<iframe

src=”http://www.islamicfinder.org/prayer_service.php?country=bangladesh

&city=dhaka&state=81&zipcode=&latitude=23.7231&longitude=90.4086

&timezone=6&HanfiShafi=1&pmethod=1&fajrTwilight1=10&fajrTwilight2=10

&ishaTwilight=10&ishaInterval=30&dhuhrInterval=1&maghribInterval=1

&dayLight=0&page_background=&table_background=&table_lines=

&text_color=&link_color=&prayerFajr=&prayerSunrise=&prayerDhuhr=

&prayerAsr=&prayerMaghrib=&prayerIsha=&lang=”

frameborder=0 width=175 height=280 marginwidth=0 marginheight=0scrolling=”no”>

</iframe>

You can see it in the action here.

What is this???

9 24947 73800 67013 22247 75838 25476 64051 92535 44010 79958 29902 10309 36080 29565 65805 59610 04761 31215 55730 58464 90245 42650 47654 19020 97669 79058 27672 54479 29026 15806 67487 15669 67166 87781 57814 83854 68287 40682 13904 67694 27809 51774 59820 81094 86314 67725 76296 25700 34225 39582 11451 17842 91740 45553 09456 56656 94021 03759 68977 73451 04671 90634 46067 80985 34559 34820 44157 14816 57162 38608 28858 17169 58496 15443 47147 17468 37130 67595 48487 67748 85808 57871 52804 52544 45185 14554 00990 77754 62950 81187 75475 30309 83715 00921 63396 73550 74023 20792 65361 38198 56821 64290 88393 77520 34003 89763 76817 57525 73830 19258 20025 81510 26027 05890 15776 50741 43699 96094 31568 75063 73190 13957 51137 39703 54348 50125 49547 23327 01638 55657 41076 13665 71062 37313 81467 23947 48016 44140 19101 17652 51658 04943 86331 54249 62629 14669 95839 17451 38490 99874 71792 19924 10890 08377 21531 72208 39399 15256 26033 08218 86493 76486 29057 95218 59625 40238 05015 74916 87847 49595 14067 79716 41442 56177 00893 14434 31033 74926 49945 42376 05488 47535 72035 26522 45033 22204 06079 81403 63983 02277 61020 68141 50686 48044 14240 60444 06283 01398 64769 78379 87206 77957 75093 73326 18306 88079 82986 41139 82175 45839 62020 38076 38912 47662 14024 75684 74970 96215 51877 76519 38293 93829 16289 70249 27861 35251 47577 79950 57624 30296 43554 45908 07280 68740 85602 14543 84040 25497 68674 36610 61273 16136 87598 96159 56528 42717 90118 81855 20030 27876 63574 14244 48193 15465 81365 97545 26948 00024 72273 60759 69740 25941 32640 07957 87636 47625 72106 73953 32727 35323 67734 37482 19929 34353 33570 60205 44225 60727 55269 17620 69944 62858 63033 62376 58179 19922 94687 74606 54079 39081 00678 46811 45451 00140 77359 59030 82174 66081 91617 57146 32510 66116 02434 73929 52411 31428 23141 78142 01482 91477 44880 96088 28685 48764 37625 41174 25032 16172 79213 37680 27111 83068 26615 37800 60583 71192 08568 15305 35668 98368 07610 51991 79393 46318 22097 57424 53436 75856 13835 07837 86370 00208 23013 21031 53921 93901 69044 67224 39733 68770 64579 43679 15843 44429 94727 94609 36250 96255 12982 47823 57845 73105 57062 43933 60651 78915 81461 01769 15741 71556 37896 69760 40534 14369 79289…

m39 = 213,466,917-1

It has 4,053,946 digits in decimal

Its the largest known prime number. Very interesting. Here is the glimpse of that number. To see the full number, please visit http://www.math.utah.edu/~pa/math/largeprime.html

Preloading images using JavaScript

Now a days, website design using images becomes popular trends. As Internet speed increases, designers can now use images for website design more freely and frequently. But if our targeted user base has slow connection, then they may experience a broken site. Images are loaded part by part. Web browsers start to build the output as soon as it start to get the html. So the user may see a broken site as all the design images on that page is not loaded first. To overcome this problem we can use JavaScript. We can use JavaScript to preload the design images for any page at the very first moment of loading the page. We can put the JavaScript code below inside our <head> tag so that the images are started to load as soon as the page started to load. After that we can use the images in normal way. If we put the CSS codes after that, then the page will be built without any broken look.

<script type="text/javascript">
   image01 = new Image();
   image01.src = "http://mywebsite.com/images/1.gif";
   image02 = new Image();
   image02.src = "2.jpg";
</script>

If we have many images for any page, then we can use array to load
images. For example,
<script type=“text/javascript”>
if(document.images)
{
imgPreloader = new Image();
ImageUrl = new Array();
ImageUrl[0] = “http://myweb.com/images/topbar.png”;
ImageUrl[1] = http://myweb.com/images/sidebar.png;
ImageUrl[2] = “images/mainbanner.jpg”;
for(i = 0; i <= count(ImageUrl); i++)
{
imgPreloader.src = ImageUrl[i];
}
}
</script>

This preloading technique can be used for any photo album or gallery where we can preload the
next or previous images of the current image so that the user does not have to wait much
when he see a slideshow or browse images using next/previous links. You can view such
album in Picasa by Google or at facebook. We can use Ajax with this to avoid the page loading in viewing photo albums.

Definition of Web2.0

The good and clear definition of Web2.0 at Wikipedia

Web2.0 Tag Cloud

Web2.0 Tag Cloud

JavaScript : Submit form conditionally

Javascript lets you submit a single form, conditionally, to different script. Here, we’ll learn how to achieve this. First, let us go through a simple form:
<form method=”post” name=”frm1″ onSubmit=”javascript: decide_action();” action=”">
<input type=”radio” name=”ch” value=”one” /> Choice 1<br />
<input type=”radio” name=”ch” value=”two” /> Choice 2<br />
<input type=”radio” name=”ch” value=”three” /> Choice 3<br />
<input type=”submit” name=”s1″ value=”Submit” />
</form>
As you can see, this form displays three radio buttons. The objective is, send the form to a script according to the radio button selected. Since some Javascript action needs to take place once the Submit button is clicked, we invoke decide_action() function through the onSubmit attribute of the <form> tag. Although we include the action attribute, it is left blank. The other form fields are the usual ones. Now let us dive into the cryptic world of the actual script that steers the submission.
<script language=”javascript”>
function decide_action(){
if(check_buttons()==true){
if(document.frm1.ch[0].checked==true){
document.frm1.action=”one.php”;
}else if(document.frm1.ch[1].checked==true){
document.frm1.action=”two.php”;
}else{
document.frm1.action=”three.php”;
}
document.frm1.submit();
}
}

function check_buttons(){
var ok=false;
for(i=0; i<3; i++){
if(document.frm1.ch[i].checked==true){
ok=true;
}
}
if(ok==false){
alert(“Select at least one option.”);
}
return ok;
}
</script>

SMS Sending Gadget for Windows Vista Sidebar

Vista Sidebar Gadgets

Vista Sidebar Gadgets

Some days ago I tried Windows Vista. The first thing I liked is its sidebar. Its transparency and animations also very nice. I was studied the technology behind the sidebar and I found its nothing but a html and an xml file. Yes its that simple. So I tried to make a sidebar for my own. Then I was using Banglalink mobile connection. At that time Banglalink was given 100 free sms for every recharge. I had all free sms and all sms were getting wasted as I feel very annoying to type sms on my mobile and send it to my friends. Then one idea clicked in my mind and think I can build a SMS sending gadget at Vista. It takes me 30 minutes to build this gadget. This gadget has merely a text field to write the recipent’s name and a textarea to write the message and a send button. To build this gadget I used my old is gold Nokia 6650 phone as modem and ActiveXperts SMS and Pager Toolkit v3.2 for SMS sending functionalities. Here I have discussed the steps I did in developing the gadgets. Hope you can find this helpful. Lets first look at the checklist we need to build this gadget:
1. Apache and PHP (that means your localhost)
2. A mobile phone which can be used as a GSM modem with PC connectivity like data cable, infrared or bluetooth with connectivity software (I used my Nokia 6650 with DKU-2 cable with PC Suite).
3. ActiveXperts SMS and Pager Toolkit v3.2

First, Download the ActiveXperts SMS and Pager Toolkit. I have used the ver3.2 of this software. This software is not free. But you can download a one month trial version from here. After downloading the software, install it by taking all default settings. When the software is installing, it will also install some sample applications in different programming languages. You can find these sample applications in the ‘/Samples’ folder of your installation directory. I built this gadget using PHP sample program. You can see the sample application written in PHP. I changed this application to fit my need. You can see my changed php file very shortly. Now copy the php file in your localhost to test and run it.

Then connect your phone to your PC using a datacable or Bluetooth or infrared device whatever your phone supports. I have used my Nokia 6650 phone. Its a very old phone from Nokia having all development tools. Its the first version of phone from when different gorgeous things are started to included with mobile phones like camera, video, bluetooth, infrared, GPRS, Java and so on. I used DKU-2 cable to connect the phone. After a while the PC Suite opens up a small popup window on bottom right corner on system tray saying that ‘Nokia 6650 is connected through USB’. To use your phone please refer to the ActiveXperts website for a list of supported phones. Ok, I left all work for connecting your phone to PC upon you.

After connecting your phone to your PC, run the sample php file from your localhost that you just copied. If everything goes well then you can see a window like this in your browser. In the top drop down box, your phone name will be shown. As here my phone name is shown.

ActiveXperts Test Page

ActiveXperts Test Page

The interface tells you what to do to send a sms from this page. If you are still confused then please read the manual and help file of ActiveXperts SMS and Pager Toolkit. You can found these inside the ‘/Help’ folder of your installation directory. Alternatively you can find this manual from ‘Start->Programs->ActiveXperts Software->SMS and Pager Toolkit’. This help files are very helpful and describes everything you need to run your application using their toolkit.

Now come to the gadget part. Make a new folder at ‘Root Drive:/Program Files/Windows Sidebar’ and name it whatever you want to call to your gadget. If you dont have access to your programe files directory, then you can also create it in your ‘Document and Settings’ folder. Here you can also find a folder named Windows Sidebar. I named it as ‘S16-SMS.Gadget’. Now I have make two files named ‘ajax.html’, ‘gadget.xml’ and a folder named ‘/images’. The html file is the main file which will be shown as gadget on the sidebar and xml file is the manifest file. Before showing you the contents of these files I want to tell you the general scenario. The ajax.html files only contains a form where you will write your sms and the recipents number. When you submit the form it will send a ajax request to your localhost’s php file (remember you copied a php file to your loclhost and tested it???) that will actually send the sms using the ActiveXperts SMS and Pager Toolkit and your attached phone connected to your pc. If sms sent successfully, then it will return a success message otherwise will return an error message. Thats very nice, right? Lets look at ajax.html file:
ajax.html

<html >
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=Unicode” />
<title>Ajax Gadget</title>
<style type=”text/css”>
body
{
margin: 0;
width: 130px;
height: 300px;
font-family: verdana;
font-weight: bold;
font-size: small;
color:#000000;
}

#gadgetContent
{
margin-top: 20px;
width: 130px;
vertical-align: middle;
text-align: center;
overflow: hidden;
}
</style>
<script type=”text/javascript” language=”javascript”>
function init()
{
var oBackground = document.getElementById(“imgBackground”);
oBackground.src = “url(images/background.png)”;
}

var xmlHttp = createXmlHttpRequestObject();

function createXmlHttpRequestObject()
{
var xmlHttp;

if(window.ActiveXObject)
{
try
{
xmlHttp = new ActiveXObject(“Microsoft.XMLHTTP”);
}
catch(e)
{
xmlHttp = false;
}
}
else
{
try
{
xmlHttp = new XMLHttpRequest();
}
catch (e)
{
xmlHttp = false;
}
}

if(!xmlHttp)
{
alert(“Error creating the XMLHttpRequest object.”);
}
else
{
return xmlHttp;
}
}

function process()
{
if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
{
textRecipient = encodeURIComponent(document.getElementById(“textRecipient”).value);
textMessage = encodeURIComponent(document.getElementById(“textMessage”).value);
textPincode = encodeURIComponent(document.getElementById(“textPincode”).value);

qry_str = “http://192.168.0.14/process1.php?” + “textRecipient=” + textRecipient + “&textMessage=” + textMessage + “&textPincode=” + textPincode;
//alert(textRecipient);

xmlHttp.open(“GET”, qry_str, true);
xmlHttp.onreadystatechange = handleServerResponse;
xmlHttp.send(null);
}
else
{
// if the connection is busy, try again after one second
setTimeout(‘process()’, 1000);
}
}

function handleServerResponse()
{
if (xmlHttp.readyState == 4)
{
if (xmlHttp.status == 200)
{
xmlResponse = xmlHttp.responseText;
// obtain the document element (the root element) of the XML structure
//xmlDocumentElement = xmlResponse.documentElement;
// get the text message, which is in the first child of
// the the document element
message = xmlHttp.responseText;
document.getElementById(“div_message”).value = ” + message + ”;
}// a HTTP status different than 200 signals an error
else
{
document.getElementById(“div_message”).value = ” + xmlHttp.statusText + ”;
}
}
else
{
document.getElementById(“div_message”).value = ‘Sending request…’;
}
}
</script>
</head>

<body onLoad=”javascript:init();”>

<g:background id=”imgBackground”>

<span id=”gadgetContent”>
<form name=”frmMessage” id=”frmMessage”>
<input style=”width: 250px” type=”text” name=”textRecipient” id=”textRecipient” value=”[Recipient]” ><br>
<input style=”width: 250px” type=”text” name=”textMessage” id=”textMessage” value=”[Message]” ><br>
<input type=”hidden” name=”textPincode” id=”textPincode” value=”1234″>
<input type=”button” name=”submit” id=”submit” value=”Submit” onClick=”javascript:process();” /></div>
</form>
<input type=”text” name=”div_message” id=”div_message” value=”" />
</span>

</g:background>

</body>
</html>

Here is the xml manifest file

gadget.xml

<?xml version=”1.0″ encoding=”utf-8″ ?>
<gadget>
<name>S16 SMS Application</name>
<version>1.0.0.0</version>
<author name=”Moshfiqur Rahman”>
<info url=”http://moshfiq.wordpress.com” />
</author>
<copyright>© Moshfiqur Rahman.</copyright>
<description>SMS Application for your desktop</description>
<hosts>
<host name=”sidebar”>
<base type=”HTML” apiVersion=”1.0.0″ src=”ajax.html” />
<permissions>Full</permissions>
<platform minPlatformVersion=”1.0″ />
</host>
</hosts>
</gadget>

Now comes the most hard and important part, the process.php file

process.php

if($_GET['textMessage'] != “”){

$objGsmOut->LogFile = $_GET['logfile'];
$objGsmOut->Device = $_GET['device'];
$objGsmOut->DeviceSpeed = $_GET['baudrate'];

$objGsmOut->EnterPin ( $_GET['pin'] );

$objGsmOut->MessageRecipient = $_GET['recipient'];
$objGsmOut->MessageData = $_GET['message'];

if($objGsmOut->LastError == 0)
{
$objGsmOut->Send;
}

$result = $objGsmOut->GetErrorDescription($objGsmOut->LastError);

return $result;
}
?>

Now browse for available sidebar gadgets from the sidebar control panel. You can find your own gadget in the list. Just add it to your sidebar. Now you can send sms to your friend directly from your desktop. Please ensure that your mobile is connected to your pc and your apache server is running. Hope everything is going fine and you can send sms to your friends. If you find something wrong please drop me a line. Enjoy :D

Caution:

  1. I am no using this gadget because my Nokia 5560 phone is out of order :(
  2. Banglalink is no more providing the free sms :(
  3. And finally, I have formatted my hard drive to get rid of windows vista as its near to kill my poor machine with celeron processor and 512 RAM :(

So you are on your own!!! :D

08-08-08 : The magical marriage date

Today we have passed a magical date of 08-08-08. Wish best of luck to all in this magical date. The number eight is believed to bring happiness and fortune. The three eights in Aug 8, 2008, therefore, make that day especially popular. Especially the Chinese thinks that this day will bring fortune for them. They also want to get married in this date as they believe, getting married in this day will bring them happiness for whole life. Record number(16,400) of marriage registration application has been placed in china to register their marriage on this day.

Li Jun, who is going to get married officially on Friday told to China Daily that, “Eight is such an auspicious number, and with the opening of the Beijing Olympics, the whole nation will be celebrating with us”.

To know more about that, visit http://www.chinadaily.com.cn/olympics/2008-08/06/content_6907038.htm

My recent study on address book api of Gmail, Yahoo and Windows Live

Recently I was asked by my job authority to study and research on address book api of Gmail, Yahoo and Windows Live(Hotmail). This study is for friend inviter script of our social networking site hottDhaka.com. It a very good news that all of these email providers has released some sort of web services to access their address book. So now any user using any of the above mentioned email services can access their address book programatically and retrieve, add, edit and synchronize their contacts from a third party application.

I have studied all these api’s and found that, all the providers tried to keep their service as simple as possible. And social networking has a great impact on todays web trend. Otherwise I don’t think that the trio would give these type of functionality. This will greatly help the social networking sites to let their users access their address book directly from their sites and search and invite friends to their sites. While studying these api’s, I found one bottleneck which is not so important and I think developers can overlook this problem. The problem is, any user trying to access their address book from any third party web application, s/he has to authenticate from their respective service providers website. They don’t provide any mechanism for third party sites to authenticate the users off the providers sites. For example, if any Gmail users try to access his email address book from any third party web application, then he will be redirected to Gmail login page, s/he will authenticate him/herself there by providing his username and password, then Gmail send him back to the original site with his address book information. This is for security reason and I think this is ok. At least the developers don’t need to develop the security and login things by themselves as the service providers are take the responsibility to doing this. This also ensure the highest level of security.

But, as usual, Windows Live has another bottleneck I found, at least in my case. For security reason, the use the hash function mhash() for which I have to install the php mhash module. This is very rare module installed in local web hostings. And I still can’t check windows service for mhash() function. So I am looking for a hosting who can give me the mhash support. may be then I can use the api for PHP. Otherwise I have to try at .NET.

And I also tried the Yahoo Addressbook API. At very first sight, I thought Yahoo’s API is the easiest to build and test. But in fact, still I am getting a service unavailable error. And the interesting thing is that, I was trying their web services with a test code downloaded from their web site :D

Though, at first sight, it was seems that, Google’s api is very tough to try. And again interesting matter is that, I first success with Google’s API. I tried and played with their Javascript addressbook api. Its very easy. Google also provides a full working example. I just downloaded it and make some changes need for me. If you like to see, you can see it here.

Picasa albums in Lightbox

If you surf the web frequently then you must have heard the name of Google. If you don’t, then do not proceed, because this post may not have any worth to you. Google has many many great services. And among them, Picasa is a nice photo service provided by google. You can upload as many images as you can at picasa. All you need is a google id. Picasa is a free service. You can upload photos in different albums. You can also make you albums private and public.

So, some days ago I was trying to accessing my picasa albums using google picasa web api. I successfully accessed my public albums and see the images in those albums. So I thought to find some ways to make these photos visible by an Lightbox image album created in Javascript. After a day of work, I can successfully see my picasa albums through lighbox. If you want to see your own album, check this link. Next I am thinking to build this up as a widget to add to any website for its user’s personal use.

Strip all non alpha-numeric characters from a string

Last night I was working on a home project. I was trying to build a lightbox photo gallery from picasa image gallery feed using google api. When I trying to get all photo list by album name, then I found that, google strips all non alpha-numeric characters from the album name and capitalize the first character of each words in the album name. For example, I have an album named “Little angels (1)”. But in the album url, google wrote the name as “LittleAngels1″ (http://picasaweb.google.com/<my_user_name>/LittleAngels1). So I need to write a tiny function to take my actual album name and made it url ready as google. Here is the function:

<?php

function stripNonAlphaNumChars($dirtyStr)
{
$string = ucwords($dirtyStr); // capitalize the first characters of each word in the string
$patterns = ‘/[^a-zA-Z0-9]+/’; // reg. exp. for non alphanumeric characters
$replacements = ”; // replaced with empty string
$cleanStr = preg_replace($patterns, $replacements, $string); // return the clean string

return $cleanStr;
}

echo stripNonAlphaNumChars(‘The little angels (1)’);

// the output is: TheLittleAngels1

?>

Very large function huh ?!

« Older entries