jQuery Mobile: Part 3 – Modifying default ‘loading’ and ‘error loading page’ messages

In the second part of this series we have learned how to link pages. If you followed them, probably, you’ve also noticed that a ‘loading’ message while you are visiting pages back and forth. jQuery Mobile shows this while it loads the page behind the scene. Well, you may not see this in fast connection or during testing in your computer as it loaded too fast. Similarly, jQuery Mobile shows ‘error loading page’ when it fails to load any page.

In my application, I wanted to change these texts as I wanted them in Bangla.  We were seeing these because they are set by default in the framework. By modifying the default properties, we can change them to something we want.

To do so we will hook into jQuery Mobile’s ‘mobileinit’ event. This event (on document object) is triggered just on the moment jQuery Mobile is started to load. So, we will have to override these before loading jQuery Mobile library.

So far, we have loaded the library files in the following order:

Continue reading →

Get free SMS alert on your server down (or something else)!

Well, first thing first. This blog may be little bit immoral even if it is not illegal by the provider terms of service. So, if you read this or later sentences, the responsibilities are on you.


I am going to share an idea that I’ve personally used a bit ago (2009) in my previous office to monitor the server and get notified when any server/service is down. I wrote a small PHP application that would do the tasks. Though I planned that time to blog about it, apparently, I forgot about it. The steps of the idea is:

  • A php chunk checks server status
  • If it finds something unexpected (or may be expected; depends on your logic :)) it creates an event in your google calendar which is due just 1-3 minutes from now
  • If your SMS alert is setup in Google Calender, Google will email you about the event.

Here I will not show how to write a PHP script to monitor server. I just told it as I applied this idea for same purpose. I guess you will get lots if you google it. However, the initial version that I developed just checked site’s homepage (using CURL) and if they were returning 200 response within a sensible time limit. If the response was not 200, it would create the event for me.

How to create Event?

It’s very simple. First of all download the following classes from phpclasses.org

Put them in your project path. Create a php file. Lets assume it is createevent.php. Now include the wrapper file in createevent.php.

Continue reading →

Recaptcha with AJAX application, get new challenge using JavaScript

Currently, I am working on a commercial project (for me) that will be dedicated to the soul of Michael Jackson. I have used some AJAX based interface where I have used reCaptcha challenges to fight spamming. The form where I have used reCaptcha, will be submitted through AJAX calls. As the page won’t reload, the same captcha challenge exists even the user makes a mistake during filling the form.  I wanted to show a new challenge each time he/she makes a mistake. I thought, I will be in trouble in this part! However, I have seen it is extremely easy to get a new challenge. Continue reading →

Passing filename arguments to PHP from shell and space issue…

Today, while working with a project to import thousands of articles from text files to wordpress,  I had faced a trouble while I am executing a shell script to iterate through all text files and call a PHP script with sending the filename as argument. The PHP script would then process the file as our requirement. The shell script looked like:

for i in `find . -type f -name '*.txt'`;


php import_posts.php $i


Here, $i would be the filename and it is passed to PHP script for processing. But the problem is that, when the filename (including directory name) consists any whitespace in its name, the script would broken. For example, some files path looked like
/home/user/articles/Internet Business/Web Hosting/how_to_start_your_company.txt

Here, notice the space after Internet and Web. The shell script was breaking just after Internet. It was sending /home/user/articles/Internet as argument to PHP script and obviously PHP script was failed to find this file.

After searching a lot, finally I found a solution.

It was really simple. I am quoting from his blog:

If none of your files or folders have spaces in their names, then this isn’t a problem, but that is increasingly unlikely nowadays.  If your songs do have spaces in their filenames, then the solution is to change how the shell splits that output.  This is controlled by the variable $IFS, which is set to spaces, tabs, and newlines by default.  We’d like it set to just newlines, so we do:

So, here is the solution. I just put the following line at the top of my shell script.

export IFS=$'\n'

After that everything is fine. The script is running exactly how I intended it to run.

Thanks for Anthony for his solution.

Red5 installation never been easiest!

Several times I have tried to install Red5 Streaming server in my linux box and I successfully failed during every try.

Today from morning I again started to try as success was my sheer determination. I planed I would surely find out a positive result. But no hope. I again failed to install it.

Later, while searching online, I have found a magic script. i instantly downloaded the file and executed it. Within a few minutes, Red5 is installed successfully. Thats really magic. I just run service red5 start and its started.

To get details visit: http://forums.hostv.com/showthread.php?t=134

To download the magic file click here.

Make it executable (755) and execute it (./red5_install). And count for success. Thanks a lot to the author for a fantastic script.

Optionally I have upload that script here for backup storage. You can download from here.