Welcome to my website on programming. I started coding in the eighties, when computers began to replace typewriters in the newsroom of the daily newspaper I was working for. From the very beginning those machines strongly attracted my interest. It was love at first sight, as they say. And the computer and I never got divorced, although I've retired from my work quite a few years ago.
In the beginning, the software for the printing industry, due to a lack of choice, did not always exactly produce what we – the journalists – expected. Challenged by these 'imperfections', I started coding. Generally I created small additional applications and functions. My first programming tool was a Basic interpreter. Later on I 'found' an illegal copy of Turbo Basic, Power Basic's predecessor. After giving it a try, I decided to buy it, because I wanted (as you can imagine) to be one hundred percent sure that I and my newspaper used a legal copy. In the meantime Turbo Basic, a Borland product in those years, was sold back to its inventor Bob Zale who brought it to the market as PowerBASIC. I purchased the Power Basic DOS compiler which was indeed a very powerful tool. Nowadays, I create most of my code using Power Basic's Windows compiler and sometimes (not very often) I use the Console Compiler as well. But the tool with the GUI is my favorite one, as was the DOS-product back in 'the good old days'. Having said this, I want to emphasize that I am in no way affiliated to Florida-based Power Basic Inc. I'm just one of their (satisfied) customers.
One of my most significant projects is the Gregorian Date Library, a still growing bundle of routines to manipulate calendar dates. The main function of that bundle is a computation that converts a calendar date into an integer day number (type LONG). It fits exactly in the Gregorian Calendar, which means: day number 1 represents 15 October 1582, the official first date of our modern calendar system. In some publications day numbers from the Gregorian Calendar are referred to as Lilian Day Numbers. But make no mistake, a Lilian Day Number is just a calculated Julian Day Number from which 2,299,160 days were subtracted. Note that the first date in the Julian numbering system is 25 November 4714 BC, on – what is called – the proleptic Gregorian Calendar. In other words, Lilian-computations hide approximately 60 centuries of useless Julian day numbers. My Gregorian Day Number algorithm has no need of trickery. It has its own, genuine mathematics.
The latest version of the library – release date: September 13, 2011; timestamp 11:09 (yy:mm) – contains 2 new functions:
ShortMonthName. Those functions help you to retrieve the abbreviations for the name of the day and the name of the month, respectively. For any Locale! The library also provides all the functions you'll need to retrieve the Easter-related calendar dates: Easter Sunday, Good Friday, Ascension Day, Whit Sunday. For both, the Western and the Eastern or Orthodox churches. The calendar date for Easter in the Eastern churches does not always coincide with that in the Western churches. It's all demonstrated in the file
EASTER.BAS. The four main functions are
GetOrthodoxEasterDate(). Those functions return the Gregorian Day Numbers for Easter Moon and Easter Sunday, respectively.
Another important function contains an algorithm to find the Gregorian Day Numer (GDN) for such dates as 2nd Monday of October (Columbus Day) or 4th Thursday of November (Thanksgiving Day in the USA). The use of this function is demonstrated in
The archive (GREGORIAN.ZIP) offers the following content:
GREGORIAN.INC, the main library.
GREGEASTER.INC, Easter-related library functions.
DATEFORMAT.BAS: shows how
GregDateFormat() repairs the British, Welsh, Irish, Canadian (both French and English), Catalonian and Swedish long dates as returned by the Windows API function
DAYDIFF.BAS: returns the number of days between 2 calendar dates.
DAYOFWEEK.BAS: demonstrates how to calculate a date's day of the week (Monday - Sunday).
DAYSINMONTH.BAS: returns the number of days in a given month (Jan.= 31, Feb. = 28 or 29, etc.).
EASTER.BAS: Easter-related holidays in the Western and the Orthodox churches.
GREG2DATE.BAS: demonstrates how to convert a Gregorian Day Number to a calendar date.
GREGDEMO.BAS: demonstration of several routines from the Gregorian Date Library.
SAMEDAY.BAS: returns the GDN for the "same" date either in the previous or the next year.
THANKSGIV.BAS: will show a couple of ordinal-related functions, such as finding the date for Thanksgiving Day.
WEEKNUMBER.BAS: demonstrates how to calculate ISO-proof week numbers (see: next issue).
Recently I had to rewrite the week number routine in the above mentioned calendar library, due to the fact that the function GetLocaleInfo from Windows' application programming interface (API) does not always return a correct first week of the year, especially for some countries in the European Union. This is very strange, because Windows does offer a month calendar control (SysMonthCal32) with correct week numbers. Is this a known or a neglected issue in Redmond?
Read article: Windows' Wrong Week information
Animated card backs
One of my latest projects was an article about creating card games, using Windows' default playing cards library. To be honest, I did not do it all by myself. Borje Hagsten from Sweden has been a great help, especially in the field of 'drag and drop'. The article has been published in The Power Basic Gazette and is still available for download here. You need to click on gaz043.txt to read it. Of course, there's a code sample as well. You may either download it from Power Basic or from my site. Important note for XP-users: in case you want to use animated card backs (not supported in Windows XP) you can download the matching library from Microsoft's download site. Note that the library is packed in a file named games.exe. The only file you need to extract is cards32.dll.
Download cards.zip from my site (Berlin).
Download cards.zip from Power Basic's download area (USA).
Download games.exe from Microsoft.
Easter Date Calculator shown in its Welsh GUI
It's very easy now to check if your next birthday party will coincide with Easter Sunday or Pentecost. For that purpose I've added a special menu to my well-known Easter Date Calculator. Actually this little program was my very first project for Windows. It was an application originally written for DOS. After purchasing PBWin, I decided to port it to the Windows platform, which was not easy. Not because of the calendrical calculations, since they did not change (apart from a few minor corrections). It was the Windows environment or Graphical User Interface which was so different and sometimes difficult to work with. Text controls, for instance, appeared to be too narrow to display the beautiful (but long) names for Easter and Pentecost as used in Cataluņa (Spain). Another problem was caused by going international. While running in Spain, my proggie knew very well it had to 'speak' Spanish. But when installed on a Mexican computer, it reverted to English. The same happened in all the Spanish speaking countries of Latin America, to mention a few unexpected hick-ups. I've solved those problems now. And last but not least, I got the opportunity to add Cymraeg (Welsh). I want to thank John Krijnen, Simon Morgan and Chris Holbrook for their contributions.
Download easter.zip from my site (Berlin).
Download easter.zip from Power Basic's download area (USA).