<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>KosherJava &#187; Software Dev</title>
	<atom:link href="http://www.kosherjava.com/tag/software-dev/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kosherjava.com</link>
	<description>A weblog about Zmanim, Kosher Coffee (Kosher Java) and other odds &#38; ends</description>
	<lastBuildDate>Fri, 06 Jan 2012 18:28:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>FAQ: Outputting Zmanim for A Different Time Zone With the the Zmanim API</title>
		<link>http://www.kosherjava.com/2011/11/08/outputting-zmanim-for-a-different-time-zone-with-the-the-zmanim-api/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=outputting-zmanim-for-a-different-time-zone-with-the-the-zmanim-api</link>
		<comments>http://www.kosherjava.com/2011/11/08/outputting-zmanim-for-a-different-time-zone-with-the-the-zmanim-api/#comments</comments>
		<pubDate>Tue, 08 Nov 2011 05:01:03 +0000</pubDate>
		<dc:creator>KosherJava</dc:creator>
				<category><![CDATA[Software Dev]]></category>
		<category><![CDATA[Zmanim]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[FAQ]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Software Bugs]]></category>
		<category><![CDATA[Timezone]]></category>

		<guid isPermaLink="false">http://www.kosherjava.com/?p=1349</guid>
		<description><![CDATA[Question:Why does the output of zmanim for a different time zone appear incorrect?Answer: One of the common issues encountered by developers using the API is that zmanim generated for a different time zone than the user&#8217;s time zone may return output that appears incorrect. For example a user in Lakewood, NJ trying to calculate sunrise [...]]]></description>
			<content:encoded><![CDATA[<img class="alignleft" src="/images/coffeeQuestion.jpg" alt="Zmanim API FAQ"/><h2>Question:</h2>Why does the output of zmanim for a different time zone appear incorrect?<h2>Answer:</h2>
One of the common issues encountered by developers using the API is that zmanim generated for a different time zone than the user&#8217;s time zone may return output that appears incorrect. For example a user in Lakewood, NJ trying to calculate sunrise for Yerushalayim may attempt to use the following code:

<pre class="brush: java; title: ; notranslate">
String locationName = &quot;Jerusalem&quot;;
double latitude = 31.778; // Har habayis
double longitude = 35.2354;// Har Habayis
double elevation = 0;
TimeZone timeZone = TimeZone.getTimeZone(&quot;Asia/Jerusalem&quot;);
GeoLocation location = new GeoLocation(locationName, latitude, longitude, elevation, timeZone);
ZmanimCalendar zc = new ZmanimCalendar(location);
zc.getCalendar().set(2011, Calendar.FEBRUARY, 8);
System.out.println(&quot;Sunrise: &quot; + zc.getSunrise());
System.out.println(&quot;Sunset: &quot; + zc.getSunset());
</pre>

While you would expect a <a href="http://www.kosherjava.com/maps/zmanim.html?lat=31.778&#038;lng=35.2354&#038;zoom=19&#038;date=2011-2-8">sunrise of 6:27:41 AM and sunset of 5:19:19 PM</a>, running this code on a computer anywhere in the Eastern Standard time zone would generate the following time that appears to be 7 hours early:
<pre class="brush: plain; title: ; notranslate">
Sunrise: Mon Feb 07 23:27:41 EST 2011
Sunset: Tue Feb 08 10:19:19 EST 2011
</pre>

The issue is simple, and the sunrise and sunset returned above are actually accurate. Zmanim are returned by the Zmanim API as a Java <a href="http://download.oracle.com/javase/7/docs/api/java/util/Date.html">Date object</a> that represents a moment in time (stored internally by Java as <a href="http://en.wikipedia.org/wiki/Unix_time">Unix Time</a> &#8211; the number of milliseconds since the January 1, 1970 GMT). Sunrise in Yerushalayim on February 8th actually happens at 11:27:41 PM on February 7th <b>EST</b>. Java is simply outputting the <a href="http://download.oracle.com/javase/7/docs/api/java/util/Date.html#toString%28%29">Date as a String</a> formatted to the users default time zone (EST in this example). The user probably intends to output the time in IST &#8211; Israel Standard Time (&#8220;Asia/Jerusalem&#8221; in the Olson database). To do this you have to output the zmanim using a formatter set to use the &#8220;Asia/Jerusalem&#8221; time zone.

<pre class="brush: java; title: ; notranslate">
DateFormat zmanimFormat = new SimpleDateFormat(&quot;EEE MMM dd HH:mm:ss z yyyy&quot;);
zmanimFormat.setTimeZone(location.getTimeZone());

System.out.println(&quot;sunrise: &quot; + zmanimFormat.format(zc.getSunrise()));
System.out.println(&quot;sunset:&quot; + zmanimFormat.format(zc.getSunset()));
</pre>
will output the expected
<pre class="brush: plain; title: ; notranslate">
sunrise: Tue Feb 08 06:27:41 IST 2011
sunset:Tue Feb 08 17:19:19 IST 2011
</pre>

Below is the full code example. 

<pre class="brush: java; highlight: [16,17,18,19]; title: ; notranslate">
import net.sourceforge.zmanim.*;
import net.sourceforge.zmanim.util.*;
import java.util.TimeZone;
public class FormatZmanim{
	public static void main(String [] args) {
		String locationName = &quot;Jerusalem&quot;;
		double latitude = 31.778; //latitude of Har habayis
		double longitude = 35.2354; //longitude of Har Habayis
		double elevation = 0; //optional elevation
		//use a Valid Olson Database timezone listed in java.util.TimeZone.getAvailableIDs()
		TimeZone timeZone = TimeZone.getTimeZone(&quot;Asia/Jerusalem&quot;);
		//create the location object
		GeoLocation location = new GeoLocation(locationName, latitude, longitude, elevation, timeZone);
		ZmanimCalendar zc = new ZmanimCalendar(location); //create the ZmanimCalendar
		zc.getCalendar().set(2011, Calendar.FEBRUARY, 8); //set the date
		DateFormat zmanimFormat = new SimpleDateFormat(&quot;EEE MMM dd HH:mm:ss z yyyy&quot;); //Create the formatter
		zmanimFormat.setTimeZone(location.getTimeZone()); //set the formatter's time zone
		System.out.println(&quot;sunrise: &quot; + zmanimFormat.format(zc.getSunrise()));
		System.out.println(&quot;sunset:&quot; + zmanimFormat.format(zc.getSunset()));
	}
}
</pre>]]></content:encoded>
			<wfw:commentRss>http://www.kosherjava.com/2011/11/08/outputting-zmanim-for-a-different-time-zone-with-the-the-zmanim-api/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Zmanim API Ported to Cocoa / Objective-C</title>
		<link>http://www.kosherjava.com/2011/07/29/zmanim-api-ported-to-cocoa-objective-c/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=zmanim-api-ported-to-cocoa-objective-c</link>
		<comments>http://www.kosherjava.com/2011/07/29/zmanim-api-ported-to-cocoa-objective-c/#comments</comments>
		<pubDate>Fri, 29 Jul 2011 16:48:25 +0000</pubDate>
		<dc:creator>KosherJava</dc:creator>
				<category><![CDATA[Software Dev]]></category>
		<category><![CDATA[Zmanim]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Cocoa API]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[port]]></category>

		<guid isPermaLink="false">http://www.kosherjava.com/?p=875</guid>
		<description><![CDATA[Moshe Berman completed the 2.0 release of his port of the KosherJava Zmanim API from Java to a Cocoa API using Objective-C. You can see the work in the KosherCocoa project page. The original work on the port dates back to Moshe&#8217;s iPhone Ultimate Omer 2 (iTunes link) app. In that app, he ported the [...]]]></description>
			<content:encoded><![CDATA[<img class="alignleft" src="/images/PortCityJava240.jpg" alt="Port City Java" title="Port City Java" /><a href="http://www.mosheberman.com">Moshe Berman</a> completed the 2.0 release of his port of the KosherJava <a href="http://www.kosherjava.com/zmanim-project/">Zmanim API</a> from Java to a <a href="http://en.wikipedia.org/wiki/Cocoa_%28API%29">Cocoa API</a> using <a href="http://en.wikipedia.org/wiki/Objective-C">Objective-C</a>. You can see the work in the <a href="https://github.com/MosheBerman/KosherCocoa">KosherCocoa</a> project page. The original work on the port dates back to Moshe&#8217;s iPhone <a href="http://mosheberman.com">Ultimate Omer 2</a> (<a href="http://itunes.com/apps/mosheberman/sefira">iTunes link</a>) app. In that app, he ported the minimum amount of code needed to calculate sunset in order to roll the day of the Omer after sunset. With Moshe&#8217;s latest check-in at <a href= "https://github.com">github</a>, he provided a port of a good portion of the API sticking to the basic design of the KosherJava API. The complexZmanimCalendar still remains to be ported, but the majority of zmanim in common use are in the ported ZmanimCalendar. Moshe&#8217;s blog post <a href="http://mosheberman.com/wordpress/2011/07/25/koshercocoa-2-0/">Introducing KosherCocoa 2.0</a> has additional details. Additional developer notes can be seen in the <a href="https://github.com/MosheBerman/KosherCocoa/wiki">KosherCocoa wiki page</a>. This port will be a boon to <a href="http://en.wikipedia.org/wiki/IOS_%28Apple%29">iOS</a> developers who now have a simple way to include zmanim in their iPhone and iPad apps.
Here is some sample code that outputs zmanim to the <a href="http://en.wikipedia.org/wiki/Console_%28Mac_OS_X%29">console</a>.

<h3>Zmanim.m</h3>
<pre class="brush: objc; highlight: [24,25,26,27]; title: ; notranslate">
#import &lt;Foundation/Foundation.h&gt;
#import &quot;ZmanimCalendar.h&quot;

int main (int argc, const char * argv[]){

    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

    //  Set up the location
    NSString *locationName = @&quot;Lakewood, NJ&quot;;
    double latitude = 40.096; //Lakewood, NJ
    double longitude = -74.222; //Lakewood, NJ
    NSTimeZone *timeZone = [NSTimeZone timeZoneForSecondsFromGMT:-18000];

    //  Initialize the Zmanim Calendar
    GeoLocation *geoLocation = [[GeoLocation alloc] initWithName:locationName andLatitude:latitude andLongitude:longitude andTimeZone:timeZone];
    ZmanimCalendar *zmanimCalendar = [[ZmanimCalendar alloc] initWithLocation:geoLocation];

    //  Create a Formatter for the date information
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    [formatter setTimeZone:timeZone];
    [formatter setDateStyle:NSDateFormatterNoStyle];
    [formatter setTimeStyle:NSDateFormatterMediumStyle];

    NSDate *sunrise = [zmanimCalendar sunrise];
    NSDate *sofZmanShmaMGA = [zmanimCalendar sofZmanShmaMogenAvraham];
    NSDate *sofZmanShmaGRA = [zmanimCalendar sofZmanShmaGra];
    NSDate *sunset = [zmanimCalendar sunset];

    NSLog(@&quot;Today's Zmanim for %@&quot;,  [geoLocation locationName]);
    NSLog(@&quot;Sunrise: %@&quot;,  [formatter stringFromDate:sunrise]);
    NSLog(@&quot;Sof Zman Shema MGA: %@&quot;,  [formatter stringFromDate:sofZmanShmaMGA]);
    NSLog(@&quot;Sof Zman Shema GRA: %@&quot;,  [formatter stringFromDate:sofZmanShmaGRA]);
    NSLog(@&quot;Sunset: %@&quot;,  [formatter stringFromDate:sunset]);

    [pool drain];
    return 0;
}
</pre>

This would output (on February 8th):
<pre class="brush: plain; title: ; notranslate">
Today's Zmanim for Lakewood, NJ
Sunrise: 6:58:43 AM
Sof Zman Shema MGA: 8:59:04 AM
Sof Zman Shema GRA: 9:35:04 AM
Sunset: 5:24:09 PM
</pre>]]></content:encoded>
			<wfw:commentRss>http://www.kosherjava.com/2011/07/29/zmanim-api-ported-to-cocoa-objective-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Calculating Kiddush Levana Times Using the Zmanim API</title>
		<link>http://www.kosherjava.com/2011/05/20/calculating-kiddush-levana-times/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=calculating-kiddush-levana-times</link>
		<comments>http://www.kosherjava.com/2011/05/20/calculating-kiddush-levana-times/#comments</comments>
		<pubDate>Fri, 20 May 2011 22:43:43 +0000</pubDate>
		<dc:creator>KosherJava</dc:creator>
				<category><![CDATA[Software Dev]]></category>
		<category><![CDATA[Zmanim]]></category>
		<category><![CDATA[Alpha]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Hebrew Date]]></category>
		<category><![CDATA[Jewish Calendar]]></category>
		<category><![CDATA[Jewish date]]></category>
		<category><![CDATA[Kiddush Levana]]></category>
		<category><![CDATA[Molad]]></category>

		<guid isPermaLink="false">http://www.kosherjava.com/?p=978</guid>
		<description><![CDATA[Calculating the earliest and latest times for Kiddush Levana has not been part of the KosherJava Zmanim API until now. This is because unlike other zmanim that solely rely on solar calculations that are tied to the Gregorian calendar, times for Kiddush Levanah depend on the Jewish calendar molad (lunar conjunction) computation. With the recent [...]]]></description>
			<content:encoded><![CDATA[<img class="alignleft" src="/images/moonCrescent3DayLunation.jpg" alt="Moon Crescent 3 Day Lunation"/>Calculating the earliest and latest times for <a href="http://en.wikipedia.org/wiki/Kiddush_levana">Kiddush Levana</a> has not been part of the KosherJava <a href="http://www.kosherjava.com/zmanim-project/">Zmanim API</a> until now. This is because unlike other zmanim that solely rely on solar calculations that are tied to the <a href="http://en.wikipedia.org/wiki/Gregorian_calendar">Gregorian calendar</a>, times for Kiddush Levanah depend on the Jewish calendar <a href="http://en.wikipedia.org/wiki/Molad">molad (lunar conjunction)</a> computation. With the recent addition of Jewish calendar support to the <a href="https://code.google.com/p/kosherjava/">alpha releases</a> of the KosherJava Zmaim API 1.3, molad calculation was added, allowing for calculation of kidush levana times. Times include the earliest time calculated as 3 and 7 days after the molad. Sof zman kidush levanah includes the <a href="http://en.wikipedia.org/wiki/Yaakov_ben_Moshe_Levi_Moelin">Maharil&#8217;s</a> opinion that it is calculated as halfway between molad and molad, and the more lenient full 15 days from the molad mentioned by the <a href="http://en.wikipedia.org/wiki/Yosef_Karo">Mechaber</a> in the <a href="http://en.wikipedia.org/wiki/Shulchan_Aruch">Shulchan Aruch</a>. It should be noted that some opinions hold that the Rema who brings down the opinion of the Maharil&#8217;s of calculating half way between molad and molad is of the opinion that the Mechaber agrees with him. Also see the Aruch Hashulchan. For additional details on the subject, See Rabbi Dovid Heber&#8217;s very detailed writeup in Siman Daled (chapter 4) of  <a href="http://www.worldcat.org/oclc/461326125">Shaarei Zmanim</a>.
<h2>Calculating the Molad</h2>
Kidush levanah times depend on the time of the molad. The time of the molad announced in shuls on <a href="http://en.wikipedia.org/wiki/Shabbat_Mevarchim#Shabbat_Mevarchim">Shabbos Mevarchim</a> is the time of the Molad Emtzai (Average Molad) in Yerushalayim <a href="http://en.wikipedia.org/wiki/Local_mean_time">local mean time</a>. This has to be converted to <a href="http://en.wikipedia.org/wiki/Standard_time">standard time</a>. Standard time uses <a href="http://en.wikipedia.org/wiki/Time_zone">time zones</a> to unify clock times across a large area. With 360&deg; of <a href="http://en.wikipedia.org/wiki/Longitude">longitude</a> around the globe, the world is divided into 24 timezones (one per hour) resulting in timezones that are 15&deg; of longitude each. <a href="http://en.wikipedia.org/wiki/Temple_Mount">Har Habayis</a> with a longitude of <a href="http://www.kosherjava.com/maps/zmanim.html?lat=31.778&#038;lng=35.2354&#038;zoom=18&#038;type=h">35.2354&deg;</a> is 5.2354&deg; away from the 30&deg; longitude line. Multiply the 5.235&deg; by 4 minutes per degree (15&deg; of longitude per hour) to reach 20.94 minutes, or 20 minutes and 56.496 seconds (5.235 * 4 = 20.94). This time is subtracted from the local molad time to arrive at Standard time. Since the time of the molad is at the same instant globally (unlike zmanim such as sunrise that depend on a person&#8217;s location), converting this to a user&#8217;s local time involves simply calculating the time difference between the time in Yerushalayim and your location. If daylight savings time is in use, this has to be added to the calculation. Java <a href="">date formatting classes</a> do this calculation on <a href="http://download.oracle.com/javase/7/docs/api/java/util/Date.html">Date objects</a> without forcing the developer to do any calculations.

<h2>Calculating the Start and End of Kiddush Levana Times</h2>
The <a href="http://www.kosherjava.com/zmanim/docs/api/net/sourceforge/zmanim/hebrewcalendar/JewishCalendar.html">JewishCalendar</a> class contains the methods for claculating these zmanim. Calculating Tchilas Zman Kiddush Levana (the earliest time Kiddush Levana can be said) is done by <a href="http://www.kosherjava.com/zmanim/docs/api/net/sourceforge/zmanim/hebrewcalendar/JewishCalendar.html#getTchilasZmanKidushLevanah3Days%28int,%20int%29">adding 3 days</a> or <a href="http://www.kosherjava.com/zmanim/docs/api/net/sourceforge/zmanim/hebrewcalendar/JewishCalendar.html#getTchilasZmanKidushLevanah7Days%28int,%20int%29">7 days</a> to the <a href="http://www.kosherjava.com/zmanim/docs/api/net/sourceforge/zmanim/hebrewcalendar/JewishCalendar.html#getMoladAsDate%28int,%20int%29">molad time</a>. Sof Zman Kiddush Levana (the latest time Kiddush Levana can be said) is either the <a href="http://www.kosherjava.com/zmanim/docs/api/net/sourceforge/zmanim/hebrewcalendar/JewishCalendar.html#getSofZmanKidushLevanahBetweenMoldos%28int,%20int%29">time between molad and molad</a> calculated by adding 14 days, 18 hours, 22 minutes and 1.666 seconds to the molad (half the 29 days, 12 hours, 44 minutes and 1 chelek (3.333 seconds)), or by <a href="http://www.kosherjava.com/zmanim/docs/api/net/sourceforge/zmanim/hebrewcalendar/JewishCalendar.html#getSofZmanKidushLevanah15Days%28int,%20int%29">adding 15 days to the molad</a>.

<h2>Using the Zmanim API Calculate Molad Based Times</h2>
Here is sample code for calculating various kiddush levana times for anywhere in the world for Shevat 5729 (1969). Since formatting classes requires a timezone for proper formatting, the simple code below assumes that you are looking for the time in your local timezone. If you want the time for a timezone other than the one your computer is in, set the SimpleDateFormat.setTimeZone() to the timezone you wish to display the times for.
<pre class="brush: java; title: ; notranslate">
int year = 5729;
int month = JewishDate.SHEVAT;
Date tchilas3Days = JewishCalendar.getTchilasZmanKidushLevanah3Days(year, month);
Date tchilas7Days = JewishCalendar.getTchilasZmanKidushLevanah7Days(year, month);
Date sofZmanBetweenMoldos = JewishCalendar.getSofZmanKidushLevanahBetweenMoldos(year, month);
Date sofZmanKidushLevanah15Days = JewishCalendar.getSofZmanKidushLevanah15Days(year, month);
SimpleDateFormat sdf = new SimpleDateFormat(&quot;MMM dd, yyyy 'at' HH:mm:ss z&quot;);
System.out.println(&quot;Tchilas Zman Kiddush Levana 3 Days: &quot; + sdf.format(tchilas3Days));
System.out.println(&quot;Tchilas Zman Kiddush Levana 7 Days: &quot; + sdf.format(tchilas7Days));
System.out.println(&quot;Sof Zman Kiddush Levana Between Moldos: &quot; + sdf.format(sofZmanBetweenMoldos));
System.out.println(&quot;Sof Zman Kiddush Levana 15 Days: &quot; + sdf.format(sofZmanKidushLevanah15Days));
</pre>

this will output the following in an EST timezone.
<pre class="brush: plain; title: ; notranslate">
Tchilas Zman Kiddush Levana 3 Days: Jan 21, 1969 at 06:06:29 EST
Tchilas Zman Kiddush Levana 7 Days: Jan 25, 1969 at 06:06:29 EST
Sof Zman Kiddush Levana Between Moldos: Feb 02, 1969 at 00:28:31 EST
Sof Zman Kiddush Levana 15 Days: Feb 02, 1969 at 06:06:29 EST
</pre>

<h2>Kiddush Levana Times During Daylight Hours</h2>
As you can see, all of these times are at night (After tzais 72 and prior to Alos 72 minutes in Montreal). Many times, these calculations will result in times that are during daylight hours when Kidush Levana can&#8217;t be said. When using the API and calculating the time for the tchilas zman kiddush levana and the time is during daylight hours, the earliest time should be tzais the following night. When the calculated time of sof zman kiddush levana is during daylight hours, the time posted should be alos on the previous night. The API may at some point support a method of automatically calculating this.]]></content:encoded>
			<wfw:commentRss>http://www.kosherjava.com/2011/05/20/calculating-kiddush-levana-times/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>KosherJava Zmanim API Released Under the LGPL License</title>
		<link>http://www.kosherjava.com/2011/05/09/kosherjava-zmanim-api-released-under-the-lgpl-license/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=kosherjava-zmanim-api-released-under-the-lgpl-license</link>
		<comments>http://www.kosherjava.com/2011/05/09/kosherjava-zmanim-api-released-under-the-lgpl-license/#comments</comments>
		<pubDate>Mon, 09 May 2011 20:43:23 +0000</pubDate>
		<dc:creator>KosherJava</dc:creator>
				<category><![CDATA[Site News]]></category>
		<category><![CDATA[Software Dev]]></category>
		<category><![CDATA[Zmanim]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[GPL]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[LGPL]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[port]]></category>

		<guid isPermaLink="false">http://www.kosherjava.com/?p=879</guid>
		<description><![CDATA[Until this point the KosherJava Zmanim API has been released under the GPL V2.0 open source license. This had the effect of forcing any application written using the library to release it&#8217;s source code under the same license. Being that the Zmanim API is a library, the LGPL is a more appropriate license. The LGPL [...]]]></description>
			<content:encoded><![CDATA[<img class="alignleft" src="/images/lgpl.png" alt="LGPL"/>Until this point the <a href="http://www.kosherjava.com/zmanim-project/">KosherJava Zmanim API</a> has been released under the <a href="http://en.wikipedia.org/wiki/GNU_General_Public_License">GPL</a>  <a href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html">V2.0</a> <a href="http://en.wikipedia.org/wiki/Open-source_license"> open source license</a>. This had the effect of forcing any application written using the library to release it&#8217;s source code under the same license. Being that the Zmanim <a href="http://en.wikipedia.org/wiki/API">API</a> is a <a href="http://en.wikipedia.org/wiki/Library_%28computing%29">library</a>, the <a href="http://en.wikipedia.org/wiki/LGPL">LGPL</a> is a more appropriate license. The LGPL allows developers to use the KosherJava Zmanim API, yet keep their application code <a href="http://en.wikipedia.org/wiki/Proprietary_software">closed source</a>. Only changes to the API itself (such as ports to different languages) would have to be released as open source. I had in the past on request released the source under the LGPL (the <a href="http://www.kosherjava.com/2010/04/20/zmanim-api-ported-to-net-c/">Zmanim API .NET port</a> has already been released under the LGPL with my permission), and with the recent 3/27/2011 <a href="http://www.kosherjava.com/2011/03/23/zmanim-api-in-svn/">SVN checkin</a> I formally changed the Java Zmanim API license to the <a href="http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html">LGPL 2.1</a> (not the newer <a href="http://www.gnu.org/copyleft/lesser.html">LGPL 3.0</a>). The next 1.3.0 release will be the first formal release under the LGPL. In one case the change to the license required permission from developer who wrote code used by the the Zmanim API, and this was done.]]></content:encoded>
			<wfw:commentRss>http://www.kosherjava.com/2011/05/09/kosherjava-zmanim-api-released-under-the-lgpl-license/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Calculating Erev Pesach Zmanim</title>
		<link>http://www.kosherjava.com/2011/04/14/calculating-erev-pesach-zmanim/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=calculating-erev-pesach-zmanim</link>
		<comments>http://www.kosherjava.com/2011/04/14/calculating-erev-pesach-zmanim/#comments</comments>
		<pubDate>Fri, 15 Apr 2011 03:20:32 +0000</pubDate>
		<dc:creator>KosherJava</dc:creator>
				<category><![CDATA[Software Dev]]></category>
		<category><![CDATA[Zmanim]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Jewish Calendar]]></category>
		<category><![CDATA[Pesach]]></category>

		<guid isPermaLink="false">http://www.kosherjava.com/?p=950</guid>
		<description><![CDATA[The Zmanim API did not have dedicated zmanim to claculate the Erev Pesach zmanim of sof zman achilas chametz (the latest time one can eat chametz), and sof zman biur chametz (the latest time to burn chametz) till the April 14 check in to the KosherJava Zmanim Project SVN repository. The latest time for eating [...]]]></description>
			<content:encoded><![CDATA[<img class="alignleft" src="/images/matzah.jpg" alt="Matzah"/>The Zmanim API did not have dedicated zmanim to claculate the Erev Pesach zmanim of <em>sof zman achilas <a href="http://en.wikipedia.org/wiki/Chametz">chametz</a></em> (the latest time one can eat chametz), and sof zman <a href="http://en.wikipedia.org/wiki/Chametz#Removal_of_chametz">biur chametz</a> (the latest time to burn chametz) till the <a href="https://code.google.com/p/kosherjava/source/detail?r=42">April 14 check in</a> to the <a href="https://code.google.com/p/kosherjava/">KosherJava Zmanim Project SVN repository</a>. The latest time for eating chametz is at the end of the 4th hour of the day. This corresponds to sof zman tfila. The API has about 12 of those, so that does not require any special programming, but to help developers who are unaware of how they work I created 3 wrapper getSofZmanAchilasChametz methods (<a href="http://www.kosherjava.com/zmanim/docs/api/net/sourceforge/zmanim/ComplexZmanimCalendar.html#getSofZmanAchilasChametzGRA%28%29">getSofZmanAchilasChametzGRA()</a>, <a href="http://www.kosherjava.com/zmanim/docs/api/net/sourceforge/zmanim/ComplexZmanimCalendar.html#getSofZmanAchilasChametzMGA72Minutes%28%29">getSofZmanAchilasChametzMGA72Minutes()</a> and <a href="http://www.kosherjava.com/zmanim/docs/api/net/sourceforge/zmanim/ComplexZmanimCalendar.html#getSofZmanAchilasChametzMGA16Point1Degrees%28%29">getSofZmanAchilasChametzMGA16Point1Degrees()</a>) calling the 3 most commonly used getSofZmanTfila methods (getSofZmanTfilaGRA(), getSofZmanTfilaMGA72Minutes() and getSofZmanTfilaMGA16Point1Degrees()). For example here is the exact code used in getSofZmanAchilasChametzGRA()
<pre class="brush: java; title: ; notranslate">
public Date getSofZmanAchilasChametzGRA() {
	return getSofZmanTfilaGRA();
}
</pre>

The API itself is very flexible, and as long as you know the calculation of the zman, you can easily calculate it. For example, to calculate sof zman biur chametz according to the <a href="http://en.wikipedia.org/wiki/Vilna_Gaon">GR&quot;A</a>, the time would be 5 shaos zmaniyos after sunrise. Using the Zmanim API this would be coded as:
<pre class="brush: java; title: ; notranslate">
Date SofZmanBiurChametzGra = getTimeOffset(getSeaLevelSunrise(), getShaahZmanisGra() * 5);
</pre> 
The exact code used in the API is:
<pre class="brush: java; title: ; notranslate">
public Date getSofZmanBiurChametzGRA() {
	return getTimeOffset(getSeaLevelSunrise(), getShaahZmanisGra() * 5);
}
</pre>
Developers who want to use the current API to generate these zmanim can use the following sample as a guide.
<pre class="brush: java; highlight: [11,12,13,14,15,16]; title: ; notranslate">
String locationName = &quot;Lakewood, NJ&quot;;
double latitude = 40.09596; //Lakewood, NJ
double longitude = -74.22213; //Lakewood, NJ
double elevation = 0; //optional elevation
TimeZone timeZone = TimeZone.getTimeZone(&quot;America/New_York&quot;);
GeoLocation location = new GeoLocation(locationName, latitude, longitude, elevation, timeZone);
ComplexZmanimCalendar czc = new ComplexZmanimCalendar(location);
czc.getCalendar().set(Calendar.YEAR, 2011);
czc.getCalendar().set(Calendar.MONTH, Calendar.APRIL);
czc.getCalendar().set(Calendar.DAY_OF_MONTH, 18);
Date graAchilas = czc.getSofZmanTfilaGRA();
Date graBiur = czc.getTimeOffset(czc.getSeaLevelSunrise(), czc.getShaahZmanisGra() * 5);
Date mga72Achilas = czc.getSofZmanTfilaMGA72Minutes();
Date mga72Biur = czc.getTimeOffset(czc.getAlos72(), czc.getShaahZmanisMGA() * 5);
Date mga16Achilas = czc.getSofZmanTfilaMGA16Point1Degrees();
Date mga16Biur = czc.getTimeOffset(czc.getAlos16Point1Degrees(), czc.getShaahZmanis16Point1Degrees() * 5);
System.out.println(&quot;Erev Pesach Zmanim for &quot; + locationName);
System.out.println(&quot;Sof Zman Achilas Chametz GRA: &quot; + graAchilas);
System.out.println(&quot;Sof Zman Biur Chametz GRA: : &quot; + graBiur);
System.out.println(&quot;Sof Zman Achilas Chametz MGA 72 Minutes: &quot; + mga72Achilas);
System.out.println(&quot;Sof Zman Biur Chametz MGA 72 Minutes: &quot; + mga72Biur);
System.out.println(&quot;Sof Zman Achilas Chametz MGA 16.1 Deg: &quot; + mga16Achilas);
System.out.println(&quot;Sof Zman Biur Chametz MGA 16.1 Deg: &quot; + mga16Biur);
</pre>

this would output

<pre class="brush: plain; title: ; notranslate">
C:\path\to\code&gt;javac ErevPesachZmanim.java

C:\path\to\code&gt;java ErevPesachZmanim

Erev Pesach Zmanim for Lakewood, NJ
Sof Zman Achilas Chametz GRA: Mon Apr 18 10:42:42 EDT 2011
Sof Zman Biur Chametz GRA: : Mon Apr 18 11:49:39 EDT 2011
Sof Zman Achilas Chametz MGA 72 Minutes: Mon Apr 18 10:18:42 EDT 2011
Sof Zman Biur Chametz MGA 72 Minutes: Mon Apr 18 11:37:39 EDT 2011
Sof Zman Achilas Chametz MGA 16.1 Deg: Mon Apr 18 10:13:56 EDT 2011
Sof Zman Biur Chametz MGA 16.1 Deg: Mon Apr 18 11:35:18 EDT 2011
</pre>]]></content:encoded>
			<wfw:commentRss>http://www.kosherjava.com/2011/04/14/calculating-erev-pesach-zmanim/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zmanim API Now in a Public SVN Server</title>
		<link>http://www.kosherjava.com/2011/03/23/zmanim-api-in-svn/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=zmanim-api-in-svn</link>
		<comments>http://www.kosherjava.com/2011/03/23/zmanim-api-in-svn/#comments</comments>
		<pubDate>Thu, 24 Mar 2011 03:19:52 +0000</pubDate>
		<dc:creator>KosherJava</dc:creator>
				<category><![CDATA[Site News]]></category>
		<category><![CDATA[Software Dev]]></category>
		<category><![CDATA[Zmanim]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[SVN]]></category>
		<category><![CDATA[Zmanim API Release]]></category>

		<guid isPermaLink="false">http://www.kosherjava.com/?p=834</guid>
		<description><![CDATA[Thanks to Jay Gindin, the Zmanim API source code is now in a publicly available SVN server. The Google Code project can be found at code.google.com/p/kosherjava. This will have a number of benefits to the project. It will more easily allow users to find the code, ensure that they have the latest code, track changes, [...]]]></description>
			<content:encoded><![CDATA[<img class="alignleft" src="/images/vault.jpg" alt="Java Vault"/>Thanks to <a href="http://code.google.com/p/android-zmanim/">Jay Gindin</a>, the <a href="http://www.kosherjava.com/zmanim-project/">Zmanim API</a> source code is now in a publicly available <a href="http://en.wikipedia.org/wiki/Apache_Subversion">SVN</a> server. The <a href="http://code.google.com/hosting/">Google Code project</a> can be found at <a href="https://code.google.com/p/kosherjava/">code.google.com/p/kosherjava</a>. This will have a number of benefits to the project. It will more easily allow users to find the code, ensure that they have the latest code, track changes, and allow reverting to prior versions in case an issue arises with newly checked in code. It will also allow me to stop the manual backups (part of the projects <a href="http://en.wikipedia.org/wiki/Apache_Ant">Ant</a> <a href="http://code.google.com/p/kosherjava/source/browse/trunk/build/build.xml">build script</a>) done as part of every development build. The repository has the new <a href="http://www.kosherjava.com/zmanim/docs/api/net/sourceforge/zmanim/hebrewcalendar/package-summary.html">hebrewcalendar</a> package mentioned in the recently posted <a href="http://www.kosherjava.com/2011/02/23/faq-how-do-i-calculate-the-jewish-hebrew-date-for/">FAQ: How do I Calculate the Jewish/Hebrew Date for …?</a>. This new code is under heavy revision, and there will be changes that will likely break code using the current alpha version. The pace of changes to the interface will likely remain stable once the first beta version is released (probably after Pesach). The next step will be to touch base with various people who have copies of the API in their own SVN to either update or link to this official project SVN server.]]></content:encoded>
			<wfw:commentRss>http://www.kosherjava.com/2011/03/23/zmanim-api-in-svn/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New release of the Hebrew Date Plugin for WordPress</title>
		<link>http://www.kosherjava.com/2010/07/04/new-release-of-the-hebrew-date-plugin-for-wordpress/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=new-release-of-the-hebrew-date-plugin-for-wordpress</link>
		<comments>http://www.kosherjava.com/2010/07/04/new-release-of-the-hebrew-date-plugin-for-wordpress/#comments</comments>
		<pubDate>Sun, 04 Jul 2010 19:55:55 +0000</pubDate>
		<dc:creator>KosherJava</dc:creator>
				<category><![CDATA[Software Dev]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Hebrew Date]]></category>
		<category><![CDATA[WordPress Plugin]]></category>

		<guid isPermaLink="false">http://www.kosherjava.com/?p=722</guid>
		<description><![CDATA[Mike who took over development of the WordPress Hebrew Date plugin in 2006, released a new version of the plugin. The WordPress Hebrew Date plugin is now hosted at the WordPress plugin repository. This should make it easier for people to find and update the plugin. New in this version is support for the WordPress [...]]]></description>
			<content:encoded><![CDATA[<img class="alignleft" src="/images/WPMug.png" alt="WordPress Mug"/><a href="http://mikeage.net/">Mike</a> who <a href="http://www.kosherjava.com/2006/11/05/hebrew-date-plugin-has-a-new-home/">took over development</a> of the WordPress <a href="http://www.kosherjava.com/wordpress/hebrew-date-plugin/">Hebrew Date  plugin</a> in 2006, released a new version of the plugin. The <a href="http://wordpress.org/extend/plugins/hebrewdates/">WordPress Hebrew Date plugin</a> is now hosted at the <a href="http://wordpress.org/extend/plugins/">WordPress plugin repository</a>. This should make it easier for people to find and update the plugin. New in this version is support for the WordPress 3.0 default theme, a general rewrite, and expansion of the API calls intercepted by the plugin. See the <a href="http://wordpress.org/extend/plugins/hebrewdates/changelog/">changelog page</a> for a more detailed list of all the changes. Please <a href="http://mikeage.net/personal/contact-information/"> contact Mike</a> with any suggestions, comments or bugs.]]></content:encoded>
			<wfw:commentRss>http://www.kosherjava.com/2010/07/04/new-release-of-the-hebrew-date-plugin-for-wordpress/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>FAQ: Why Some Zmanim Never Occur (Developers Beware)</title>
		<link>http://www.kosherjava.com/2010/06/02/faq-why-some-zmanim-never-occur-developers-beware/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=faq-why-some-zmanim-never-occur-developers-beware</link>
		<comments>http://www.kosherjava.com/2010/06/02/faq-why-some-zmanim-never-occur-developers-beware/#comments</comments>
		<pubDate>Thu, 03 Jun 2010 02:30:11 +0000</pubDate>
		<dc:creator>KosherJava</dc:creator>
				<category><![CDATA[Software Dev]]></category>
		<category><![CDATA[Zmanim]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Arctic Circle]]></category>
		<category><![CDATA[FAQ]]></category>
		<category><![CDATA[Latitude and Longitude]]></category>
		<category><![CDATA[null]]></category>
		<category><![CDATA[Software Bugs]]></category>
		<category><![CDATA[Twilight]]></category>

		<guid isPermaLink="false">http://www.kosherjava.com/?p=671</guid>
		<description><![CDATA[Question:Why do Some Zmanim Never Occur in Some Locations? (Developers Beware) Answer:While most people realize that the sun may not rise or set in the Arctic and Antarctic Circles (see the Star-K&#8217;s When Does One Pray When There Is No Day), many are not aware that some twilight dips will not occur during part of [...]]]></description>
			<content:encoded><![CDATA[<img class="alignleft" src="/images/EnglandTwilightMap.png" alt="England Twilight Map" title="England Twilight Map" /><h2>Question:</h2>Why do Some Zmanim Never Occur in Some Locations? (Developers Beware)
<h2>Answer:</h2>While most people realize that the sun may not rise or set in the <a href="http://en.wikipedia.org/wiki/Arctic_Circle">Arctic</a> and <a href="http://en.wikipedia.org/wiki/Antarctic_Circle">Antarctic</a> Circles (see the Star-K&#8217;s <a href="http://www.star-k.org/kashrus/kk-whendoesonepraywhenthereisnoday.htm">When Does One Pray When There Is No Day</a>),  many are not aware that some twilight dips will not occur during part of the year as far south of the Arctic Circle as London. For example around the <a href="http://en.wikipedia.org/wiki/Summer_solstice">summer solstice</a> in <a href="http://www.kosherjava.com/maps/zmanim2.html?lat=51.5&#038;lng=-0.10&#038;zoom=6&#038;date=2010-06-21">London (on the zmanim map)</a> the sun will never dip far enough below the horizon to reach <a href="http://www.kosherjava.com/zmanim/docs/api/net/sourceforge/zmanim/ComplexZmanimCalendar.html#getAlos16Point1Degrees%28%29">Alos 16°</a>. This happens in London from June 5<sup>th</sup> till July 8<sup>th</sup>. The image seen on the top right (original at <a href="http://www.timeanddate.com/worldclock/sunearth.html?n=136&#038;month=6&#038;day=21&#038;year=2010&#038;hour=0&#038;min=28&#038;sec=0">timeanddate.com</a>) shows various <a href="http://www.kosherjava.com/zmanim/docs/api/net/sourceforge/zmanim/AstronomicalCalendar.html#getBeginAstronomicalTwilight%28%29">civil twilights</a> centered on London on Midnight June 21<sup>st</sup>. Look carefully to see the various bands of twilight. Gateshead will not have Alos 16° from May 16<sup>th</sup> through July 28<sup>th</sup>, while <a href="http://www.kosherjava.com/maps/zmanim2.html?lat=61.189412&#038;lng=-149.86042&#038;zoom=17&#038;date=2010-08-21">Anchorage, Alaska</a> (yes there is a <a href="http://lubavitch.com/centers/detail.html?id=389">Frum Shul in Anchorage</a> with an interesting davening direction issue that is discussed in the <a href="http://www.kosherjava.com/2011/01/17/davening-direction-from-alaska/">Davening Direction from Alaska</a> post ) will not have Alos 16.1° from April 25<sup>th</sup> to August 20<sup>th</sup>. Zmanim based on sunrise such as <a href="http://www.kosherjava.com/zmanim/docs/api/net/sourceforge/zmanim/ZmanimCalendar.html#getAlos72%28%29">Also 72</a> that is a 72 minute offset of sunrise can be calculated as long as sunrise can be calculated, something that will happen as long as you are not in the Arctic or Antarctic Circles.
For this reason, the Zmanim API will return a <a href="http://en.wikipedia.org/wiki/Pointer_%28computing%29#Null_pointer">null</a> when a zman will not happen. A <a href="http://java.sun.com/javase/6/docs/api/java/lang/Long.html#MIN_VALUE">Long.MIN_VALUE</a> will be returned when a <a href="http://en.wikipedia.org/wiki/Long_integer">long</a> is expected such as in the case of a Shaah Zmanis. While an inconvenience to developers who have to code for this, the alternative of a default date would mean that developers unaware of this would return incorrect zmanim, something far worse than a program error from a <a href="http://java.sun.com/javase/7/docs/api/java/lang/NullPointerException.html">NullPointerException</a>.
In recent weeks two publicly available programs using the Zmanim API ran into issues due to nulls returned for early alos times. Being something not anticipated by the developers, the nulls generated errors in the programs that quickly led to fixes.  For this reason Yitzchok updated the <a href="http://github.com/Yitzchok/Zmanim/">Zmanim .NET project</a> to return the nullable <em>DateTime?</em> instead of the regular DateTime that it had previously been returning. While the <a href="http://www.kosherjava.com/zmanim/docs/api/">Zmanim API documentation</a> always made the possibility of a null being returned possible, I modified the documentation to make this clear on the return value documentation for every zman. Code with the modified documentation was part of the recently released Zmanim API 1.2.1.]]></content:encoded>
			<wfw:commentRss>http://www.kosherjava.com/2010/06/02/faq-why-some-zmanim-never-occur-developers-beware/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zmanim API 1.2.1 Released</title>
		<link>http://www.kosherjava.com/2010/05/30/zmanim-api-1-2-1-released/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=zmanim-api-1-2-1-released</link>
		<comments>http://www.kosherjava.com/2010/05/30/zmanim-api-1-2-1-released/#comments</comments>
		<pubDate>Mon, 31 May 2010 02:36:11 +0000</pubDate>
		<dc:creator>KosherJava</dc:creator>
				<category><![CDATA[Site News]]></category>
		<category><![CDATA[Software Dev]]></category>
		<category><![CDATA[Zmanim]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Download]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Zmanim API Release]]></category>

		<guid isPermaLink="false">http://www.kosherjava.com/?p=657</guid>
		<description><![CDATA[The Zmanim API 1.2.1 was released today. Changed in this release were the addition of a few very early Tzais zmanim, and the removal of references to the GregorianCalendar in favor of the base Calendar class to ease Noah Blumenthal&#8217;s use of the Zmanim API in a zmanim application for the BlackBerry. This change has [...]]]></description>
			<content:encoded><![CDATA[<img class="alignleft" src="/images/SpilledCoffee.png" alt="Zmanim API 1.2.1 Release" title="Zmanim API 1.2.1 Release" />The Zmanim API 1.2.1 was released today. Changed in this release were the addition of a few very early <em>Tzais</em> zmanim, and the removal of references to the <a href="http://java.sun.com/javase/7/docs/api/java/util/GregorianCalendar.html">GregorianCalendar</a> in favor of the base <a href="http://java.sun.com/javase/7/docs/api/java/util/Calendar.html">Calendar</a> class to ease <a href="http://twitter.com/statichippo">Noah Blumenthal&#8217;s</a> use of the Zmanim API in a zmanim application for the BlackBerry. This change has no impact on functionality as tested using Yitzchok&#8217;s new JUnit tests. Additionally, the JavaDoc <a href="http://www.kosherjava.com/zmanim/docs/api/">Zmanim API documentation</a> was modified to clearly indicate that zmanim can return nulls. A followup post will have details on this.
The main download is the <a href="http://www.kosherjava.com/zmanim/release/zmanim-1.2.1.zip">Zmanim 1.2.1 release</a> zip file that includes source files and JavaDoc documentation. Also available for download (included in the above zip file) is the main <a href="http://www.kosherjava.com/zmanim/lib/zmanim-1.2.1.jar">zmanim-1.2.1.jar</a> and the <a href="http://www.kosherjava.com/zmanim/lib/zmanimAstronomical-1.2.1.jar">zmanimAstronomical-1.2.1.jar</a> that only includes the <a href="http://www.kosherjava.com/zmanim/docs/api/net/sourceforge/zmanim/AstronomicalCalendar.html">AstronomicalCalendar</a>. The removal of the GregorianCalendar was in this class. Additional detail on the downloads can be seen on the <a href="http://www.kosherjava.com/zmanim-project/downloads/">Zmanim Download page</a>]]></content:encoded>
			<wfw:commentRss>http://www.kosherjava.com/2010/05/30/zmanim-api-1-2-1-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zmanim API Ported to .NET (C#)</title>
		<link>http://www.kosherjava.com/2010/04/20/zmanim-api-ported-to-net-c/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=zmanim-api-ported-to-net-c</link>
		<comments>http://www.kosherjava.com/2010/04/20/zmanim-api-ported-to-net-c/#comments</comments>
		<pubDate>Wed, 21 Apr 2010 04:07:08 +0000</pubDate>
		<dc:creator>KosherJava</dc:creator>
				<category><![CDATA[Software Dev]]></category>
		<category><![CDATA[Zmanim]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[port]]></category>
		<category><![CDATA[VB.NET]]></category>

		<guid isPermaLink="false">http://www.kosherjava.com/?p=514</guid>
		<description><![CDATA[Yitzchok ported the Zmanim API from Java to a .NET API using C#. The Zmanim .NET project was released under the LGPL. This is a change from the GPL used by the Java API, something that may change shortly. Also part of the project was the creation of a C# version of the Zmanim CLI, [...]]]></description>
			<content:encoded><![CDATA[<img class="alignleft" src="/images/PortCityJava240.jpg" alt="Port City Java" title="Port City Java" /><a href="http://twitter.com/yitzchok">Yitzchok</a> ported the <a href="http://www.kosherjava.com/zmanim-project/">Zmanim API</a> from Java to a <a href="http://en.wikipedia.org/wiki/.NET_Framework">.NET</a> API using <a href="http://en.wikipedia.org/wiki/C_Sharp_%28programming_language%29">C#</a>. The <a href="http://github.com/Yitzchok/Zmanim/">Zmanim .NET project</a> was <a href="http://github.com/Yitzchok/Zmanim/downloads">released</a> under the <a href="http://www.gnu.org/licenses/lgpl.html">LGPL</a>. This is a change from the <a href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt">GPL</a> used by the Java <a href="http://en.wikipedia.org/wiki/Application_programming_interface">API</a>, something that may change shortly. Also part of the project was the creation of a C# version of the Zmanim <a href="http://en.wikipedia.org/wiki/Command-line_interface">CLI</a>, matching <a href="http://dosilinux.wordpress.com/">Moshe Wagner&#8217;s</a> <a href="http://www.kosherjava.com/2009/11/21/zmanimcli-command-line-interface/">Java Zmanim CLI</a>. When developing the project, Yitzchok created the <a href="http://gist.github.com/360934">ZmanimTest</a> <a href="http://www.junit.org">JUnit</a> test case class to confirm that the C# port output matched the Java API. I will likely add this to the core Zmanim API in the near future. <span style="text-decoration: line-through;">The port currently relies on <a href="http://www.ikvm.net/">IKVM</a> assemblies as can be seen in the Java references in the code sample below, mostly because of the lack of a native .NET equivalent of the Java <a href="http://java.sun.com/javase/7/docs/api/java/util/TimeZone.html">TimeZone class</a></span>. Yitzchok also created some <a href="http://github.com/Yitzchok/Zmanim/tree/master/Samples/">examples of the use of the Zmanim .NET API</a> that will be of help to developers. Below are two of the simpler examples in C# and <a href="http://en.wikipedia.org/wiki/Visual_Basic_.NET">VB.NET</a> demonstrating a very simple use of the API to output zmanim from the console.
<h3>C#</h3>
<pre class="brush: csharp; title: ; notranslate">
using Zmanim.TimeZone;
using Zmanim.TzDatebase; //in Zmanim.TzDatebase.dll assembly
using Zmanim.Utilities;

namespace Zmanim.Samples.Console
{
    class Program
    {
        static void Main(string[] args)
        {
            string locationName = &quot;Lakewood, NJ&quot;;
            double latitude = 40.09596; //Lakewood, NJ
            double longitude = -74.22213; //Lakewood, NJ
            double elevation = 0; //optional elevation
            ITimeZone timeZone = new OlsonTimeZone(&quot;America/New_York&quot;);
            GeoLocation location = new GeoLocation(locationName, latitude, longitude, elevation, timeZone);
            ComplexZmanimCalendar zc = new ComplexZmanimCalendar(location);
            //optionally set it to a specific date with a year, month and day
            //ComplexZmanimCalendar zc = new ComplexZmanimCalendar(new DateTime(1969, 2, 8), location);

            System.Console.WriteLine(&quot;Today's Zmanim for &quot; + locationName);
            System.Console.WriteLine(&quot;Sunrise: &quot; + zc.GetSunrise()); //output sunrise
            System.Console.WriteLine(&quot;Sof Zman Shema MGA: &quot; + zc.GetSofZmanShmaMGA()); //output Sof Zman Shema MGA
            System.Console.WriteLine(&quot;Sof Zman Shema GRA: &quot; + zc.GetSofZmanShmaGRA()); //output Sof Zman Shema GRA
            System.Console.WriteLine(&quot;Sunset: &quot; + zc.GetSunset()); //output sunset

            System.Console.WriteLine(&quot;Press enter to exit.&quot;);
            System.Console.ReadLine();
        }
    }
}
</pre>
<h3>VB.NET</h3>
<pre class="brush: vb; title: ; notranslate">
mports Zmanim.TzDatebase 'in Zmanim.TzDatebase.dll assembly
Imports Zmanim.Utilities
Imports Zmanim.TimeZone

Module Module1

    Sub Main()
        Dim locationName As String = &quot;Lakewood, NJ&quot;
        Dim latitude As Double = 40.09596 'Lakewood, NJ
        Dim longitude As Double = -74.22213 'Lakewood, NJ
        Dim elevation As Double = 0 'optional elevation
        Dim timeZone As ITimeZone = New OlsonTimeZone(&quot;America/New_York&quot;)
        Dim location As New GeoLocation(locationName, latitude, longitude, elevation, timeZone)
        Dim zc As New ComplexZmanimCalendar(location)
        'optionally set it to a specific date with a year, month and day
        'Dim zc As New ComplexZmanimCalendar(New DateTime(1969, 2, 8), location)
        System.Console.WriteLine(&quot;Today's Zmanim for &quot; &amp; locationName)
        System.Console.WriteLine(&quot;Sunrise: &quot; &amp; zc.GetSunrise().ToString)
        'output sunrise
        System.Console.WriteLine(&quot;Sof Zman Shema MGA: &quot; &amp; zc.GetSofZmanShmaMGA().ToString)
        'output Sof Zman Shema MGA
        System.Console.WriteLine(&quot;Sof Zman Shema GRA: &quot; &amp; zc.GetSofZmanShmaGRA().ToString)
        'output Sof Zman Shema GRA
        System.Console.WriteLine(&quot;Sunset: &quot; &amp; zc.GetSunset().ToString)
        'output sunset
        System.Console.WriteLine(&quot;Press enter to exit.&quot;)
        System.Console.ReadLine()

    End Sub

End Module
</pre>
The current Zmanim .NET TODO list for the project includes:
<ul>
<li style="text-decoration: line-through;">Remove dependency to Java (IKVM assemblies)</li>
<li>The API should follow the <a href="http://msdn.microsoft.com/en-us/library/ms229042.aspx">.NET guidelines</a></li>
<li>Make it <a href="http://en.wikipedia.org/wiki/Language_Integrated_Query">Linq</a> friendly</li>
<li>Add examples how to use this project in a ASP.NET MVC site and WPF Application</li>
<li style="text-decoration: line-through;">Try to get it to work on <a href="http://www.silverlight.net/">Silverlight</a></li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://www.kosherjava.com/2010/04/20/zmanim-api-ported-to-net-c/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

