Ahmad Masykur

Share your knowledge although one function!

About the author

Ahmad Masykur is a Software Architecture Engineer at PT. Freeport Indonesia Jakarta Indonesia.
In this blog, I share things of interest to me. Most topics are likely to be related to software development, but don't hold me to it.



Powered by

Widget Prayer Time not found.

There is an error in XML document (4, 16278).X

Page List


Ahmad Masykur

Updating Prayer Widget due to Previous IP to Geo Service was Unavailable

I was developed Prayer Time widget a month ago. I was used IP to geo service that not available anymore. This update using hostip.info service instead. The hostip.info service is not reliable enough for all IP world wide. Some IPs are not covered yet but more stable than previous service.

Here’s core of my code to retrieve geographic information from hostip.info.

WebClient webClient = new WebClient();
string responseString = null;
    responseString =
catch (WebException)
    responseString = string.Empty;
catch (Exception)
    responseString = string.Empty;
Regex regex = new Regex("Country\\:\\s(?<Country>[A-Za-z0-9]+)\\s\\((?<CountryId>[A-Z]{2})\\)\\nCity\\:\\s(?<City>[A-Za-z0-9]+)\\nLatitude\\:\\s(?<Latitude>\\-?[0-9\\.]+)\\nLongitude\\:\\s(?<Longitude>\\-?[A-Za-z0-9\\.]+)");
if (!string.IsNullOrEmpty(responseString))
    Match m = regex.Match(responseString);
    if (m.Success)
        city = m.Groups["City"].Value;
        country = m.Groups["Country"].Value;
        countryId = m.Groups["CountryId"].Value;
        longitude = m.Groups["Longitude"].Value;
        latitude = m.Groups["Latitude"].Value;

The complate source code can be downloaded here.

I hope this update will be more reliable that previous version.

Categories: BlogEngine
Permalink | Comments (3) | Post RSSRSS comment feed

Prayer Time Widget for BlogEngine.NET 1.4.x

Prayer Time is time schedule for moslem prayer. This widget shows the daily prayer time based on user location. Thispicture below shows prayer time at January 11, 2009 in Jakarta. If you are from outside of Jakarta, the prayer time will automatically calculate base on your location.


I’m using prayer time algorithm from here and previous post here. This widget use Shafii and Muslim World League calculation except Indonesia and Malay use custom calculation.

Complete source code can be downloaded from here. The installation is very easy, follow installation steps below:

  1. Extract the zip file to widget folder of your BlogEngine.NET site
  2. Login as Administrator
  3. Goto buttom of page
  4. Select “Prayer Time” from available widgets in combo box as picture below.
  5. Click Add.
  6. You can also move the widget to another location by refreshing the browser and drag n drop “Prayer Time” widget to desired location.



I hope this widget be useful for moslem blogger.

Categories: BlogEngine
Permalink | Comments (15) | Post RSSRSS comment feed