Tuesday, December 21, 2010

Removing leading and trailing whitespace in C++

If you have the boost library installed, its simply a one liner

std::string line = "     hello world    ";

Wednesday, September 29, 2010

Azan Android Application

Just published my first Android application called: Azan

This application takes your address as input, determines your location information(latitude, longitude and timezone), look up the prayer times associated with the location and then plays Azan whenever it is due.

The app supports various calculation methods and both Shia and Sunni recitations.


Search the Android market with the application's name "Azan" or my name "Sibtay" and you should find the app named Azan (Beta).


Screen Shots

Daylight Adjustments

A manual step is required, whenever daylight times are adjusted in your locality. You just have to reconfigure your app. The adjusted timezone offset would be picked implicitly and used in prayer time calculations.


Sarah Jamal for helping in the UI design and testing.

http://www.praytime.info The app uses the excellent webservices from this website to lookup all prayer times based on latitude, longitude, timezone and date.

http://www.elegantthemes.com For icons. The icons developed by Nicholas Roach are used

http://www.styleislam.com For the beautifull Islamic icons.

Friday, June 18, 2010

Determine the endian'ess of the current platform

The following function would determine whether the current platform is little endian or not

bool is_little_endian()
unsigned short int word = 1;
unsigned short int mask = 0x00;

// get the most significant bytes of the word
unsigned short int msb = word>>4;

// the platform is little endian if the most significant bytes
// contains zero
if ( (msb | mask) == 0 )
return true;
return false;

Monday, May 10, 2010

Sleep the current thread using boost

The following code would sleep the current thread for 200 milliseconds

Thursday, May 6, 2010

Thursday, April 8, 2010

Change lower case letters to upper case in bash

This can be done using the tr command.

For example:
echo "change my case" | tr '[a-z]' '[A-Z]'

Tuesday, March 23, 2010

Prepend string in bash using sed

You can do that using the following sed command

sed 's/^//g'

The key here is the use of ^ Which matches the start of line.

For example below is how you can prepend "foo" to a string "bar"

echo "bar" | sed 's/^/foo-/g'