More information about your product's certification and the award is available on
this page.
This highly configurable gadget calculates and displays the five daily prayer times
on a daily basis. If javascript is enabled in your browser, see it in action as
it determines your
Your Islamic Prayer Times.
The configuration of the gadget is done via the settings dialog which provides a
multitude of options that span four tab areas: Location, Method, Parms,
and Adhan/Misc. For more information concerning an option, mouse over it
or its label to display a tooltip.
Initially, this gadget was created as a
Windows Vista Sidebar Gadget. Its code was then refactored to be configurable
in a standard web environment. Since the code for sidebar gadgets is written in
javascript, this was not a difficult process. However, as anyone who is familiar
with code refactoring will tell you, it can be quite a lengthy one. As part of the
refactoring process, I also used the excellent javascript library
jQuery written by John Resig which I am
using for this site as well. The gadget is basically a prayer times calculator that
performs some complex mathematical calculations related to astronomy to determine
the daily prayer times for Muslims who reside in a particular location of the world.
That is, any location that Google Maps
can find as the gadget uses its web service to perform the location search to obtain
geographical information necessary to calculate the prayer times. Other geographical
information such as timezone and elevation are obtained through the
Earth Tools web service. If a location cannot be found, then explicit values
can be given for the latitude and longitude necessary to determine the prayer times,
although they could be less accurate because other geographic information, such
as location elevation, may not be able to be determined.
The code that is used to do the calculation was not written by me, but was obtained
after browsing the internet after several hours. I don't understand fully, or even
marginally, the complex mathematical calculations that are used to determine the
prayer times. The library used was the "Islamic Tools Library" developed in C by
Arabeyes' that I believed would be the most
accurate. Of course, coming from someone who doesn't understand the mathematical
formulas that are used to calculate the values, feel free to take my accuracy assessment
with a grain of salt. I ported the code to C# as this is the language I currently
develop in, and verified the accuracy of calculations by comparing them against
those of the various different locations around the world as determined by a multitude
of pre-existing websites, including some of those that probably use the same C code
library that I ported, behind the scenes. I believe I also verified my ported code
against the existing code, but I can't really remember as software developers have
a relatively short memory when it comes to code. Thus, the need for verbose comments
in the code to help us remember what we were doing merely one month ago. The port
was done several months before I started to write the Windows sidebar gadget.
The prayer times gadget can be configured to call the ported C# code that does all
the heavy lifting in two distinct ways:
- Using Microsoft's Component Object Model (COM) via the creation of an automation
object.
- Using a Window's Communication's Foundation (WCF)
REST service via Ajax using jQuery.
The difference between the two is that, in the first case, the DLL and type library
must reside on the machine that the gadget was installed on, and so would necessitate
more disk space, as well as a registration process by the user via "regasm", so
that the COM automation infrastructure would have the required information about
the DLL in order to create it. Whereas, in the second case, the DLL would not need
to reside on the user's local machine, but would exist on a web server and be accessed
via HTTP. The advantage of the first case is that if the gadget is configured with
geographical location information (which requires internet access to obtain it because
it uses external web services), any further internet access will be unnecessary
because the calculation DLL resides on the user's local machine. However, I do not
expose this library as part of the Windows sidebar gadget download because of the
added complexity of user installation and its larger download size. Also, it isn't
needed because most people have internet access 99% of the time, and internet access
is only required if the settings are changed, or the next day's prayer times need
to be obtained after the last prayer time of the day has past.
One thing to note about the implementation details concerning the second case, where
jQuery's Ajax functionality is used to call the WCF REST service, is the fact that
the WCF services expect JSON serialized dates to be in a specific format. The standard
json2.js file from JSON.org does not "stringify"
the javascript dates in a format that is expected by the DataContractSerializer
of the .NET framework. In order to perform this serialization, I used
Rick Strahl's modified version of the json2.js as explained
here that performs the specialized stringify for dates so they can be
deserialized correctly on the server side in order to work with WCF.
Two other differences between the gadget in Windows and standard web mode:
- Audio sounds are played using Windows Media player ActiveX control in Widows mode,
or using Scott Schiller's
SoundManager 2 in standard web mode.
- Windows mode doesn't have the Glass theme due to a bug in the Windows Sidebar
concerning transparency issues.