Blog

  • Calculating Hebrew Holidays

    hebcal is a nice utility that compiles on all major platforms and calculates the Hebrew holidays using a perpetual calendar.

    iconv is an amazing piece of work that can convert between zillions of encoding formats and is also available for all major platforms.

    By default, just running hebcal displays the current year’s Hebrew holidays in English. Adding the parameter -8 displays them as 8-bit Hebrew (ISO-8859-8-Logical), which was gibberish on my console. To display the Hebrew holidays in UTF-8 Hebrew I just did the following:

    hebcal -8  | iconv -f ISO-8859-8 -t UTF-8

    Works like a charm.

    By the way, if you want to convert the encoding of a file (say cal.txt) using iconv but you have no idea what the current encoding is, from a linux console, just issue the following

    file -i cal.txt

    Note that for non-unix platforms where you don’t have the file command you can try and use chared or simply drag the file to your favorite Internet browser. If it is displayed correctly check what encoding was detected by the browser and if not, play around with the encodings until it does…

    After you find the current encoding, you can then check if iconv supports it and the parameter iconv requires by issuing:

    iconv -l
  • Ubuntu – Accessing sqlite3 from Lua

    I thought this would be trivial but ended up fighting with various solutions until I found one that worked without requiring additional configurations.

    So first you might need to install the sqlite3 development libraries (which are needed to compile the Lua sqlite3 connector):

    sudo apt-get install libsqlite3-dev

    install luarocks if you don’t have it

    sudo apt-get install luarocks

    and finally, install lsqlite3:

    sudo luarocks install lsqlite3

    Web page is at this site and you can find some usage examples here