Sunday, August 21, 2011

Azan 3.4 Released

Check out "Azan"

The latest version of Android based Azan application has been released.

It now has more than 30000(and still counting) total downloads and an average rating of more than 4 stars (out of 5). And It is being used by people from all over the world.

Friday, August 19, 2011

some sscanf magic

In the world of regular expressions and comprehensive frameworks like boost, ace etc it is justifiable if you have forgotten about poor sscan and the string parsing capabilities it provides.

Recently I had to do some rudimentary string parsing in C and didn't have external frameworks at my disposal. Thus sscanf came to the rescue and solved the problem just one line.

The following invocation of sscanf extracts from str everything uptill the first '*' and puts it in res_str.

sscanf(str, "%[^*]%*s", res_str);

Friday, August 12, 2011

Determine ringer mode on Android

The following code would let you determine if Android the device is on silent or vibrate.




private boolean isDeviceSilentOrOnVibrate(){
AudioManager am = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
switch(am.getRingerMode()){
case AudioManager.RINGER_MODE_SILENT:
case AudioManager.RINGER_MODE_VIBRATE:
return true;
default:
return false;
}
}


Saturday, January 15, 2011

Streched ImageView in Android

If you want to have ImageViews that stretches to fit the screen size, use change the scaleType ImageView attribute to the following:

android:scaleType="fitXY"/>

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    ";
boost::algorithm::trim(line);


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.

Download

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


Twitter



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.

Acknowledgements

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;
}