[Update: It seems this little blog and the weight of PlanetKDE was enough to bring my webhost to its knees and lead them to suspend my account. I've changed the PNG's to JPG's so hopefully that reduces the load enough to keep me on their good side. You should see the bandwidth graph spiking at 7-8pm Europe time :-) ]
I've blogged previously about the changes I've been making to the KHolidays library. The main improvement is the ability to calculate holidays using alternative calendar systems, such as the Hebrew, Hijri/Islamic or Jalali/Persian calendars. The holiday region files are also able to be split into geographical sub-regions such as States and Provinces, and embed metadata such as the language they are available in. Due to restricted time I wasn't able to complete all the new features I wanted, such as holiday classifications and multiple holiday regions, which would have allowed a better means of separating and controlling the display of different holiday types (e.g. civil and religious). Those will have to wait for SC 4.6, but the backend changes I have made are now visible to users so I thought I would show the results so far.
To do so I'll be using the Plasma calendar widget, which has seen some new features of it's own. The two big ones are displaying your PIM Events and To-do's via Akonadi (implemented by Frederick Gladhorn), and a new information pop-up that appears when you mouse-over a date rather than having to click it (implemented by Aaron Seigo). It will also try auto-detecting a default holiday region to use (also by Aaron). You can see the net effect effect here (ignore the plasmoidviewer frame :-):
Here you can see a number of things at a glance:
There's still some polishing work and bug fixing to be done on this for SC 4.5 (e.g. the Event start and end date are not really needed), and we're likely to be looking at the whole appearance of the calendar in SC 4.6, so keep that in mind when commenting on the appearance :-).
The details for today also show up when you hover over the panel clock:
The configuration hasn't changed much, other than displaying the language that the holiday region is available in which is useful for people living in multilingual countries. As already mentioned, in SC 4.6 the config will be a lot more flexible with the ability to choose multiple holiday regions and holiday classifications, and how these will affect the display of the holidays.
New region files have been added for the following:
Looking at some of these will illustrate the new features.
The file format supports optional holidays, which is useful in defining substitute holidays:
Here you can see holidays calculated in alternative calendar systems such as Hebrew, Jalali and Hijri, and displayed on either a Gregorian, Hebrew or Jalali calender:
A number of other regions have been reviewed for accuracy with the help of the i18n teams, and this is where you can also help. If you have SC 4.5 Beta 2, you can check your national holidays in the Plasma calender for the next few years and raise a bug under kdepimlibs/KHolidays if you find any mistakes (you could also browse the region rule files at websvn). If your country, region or language isn't supported, also raise a wish requesting support. Please try include a link to a definitive source for your holiday rules, preferably in English so I can read it, otherwise I'll need your help in translating.
In particular, the Iran files are entirely a copy-and-paste from Wikipedia, I'd be grateful if someone could check them. Note that the Islamic holidays are calculated using the Civil version of the calendar so may differ by 1 day from the actual lunar calculations. I'd also welcome lists of holidays for any other countries using alternative calendars to ensure the code works in as many cases as possible.
Yes, my favourite topic :-)
In SC 4.5 I've only added 3 new calendar systems, all based on the Gregorian calendar but using different epochs or year counting methods.
The Thai calendar uses the Buddist Era as its epoch, which starts counting years from March 545 BC, making 2010 AD = 2553 BE. Thanks go to Thai user Thanomsub Noppaburana for helping me to implement this. This is sometimes mistakenly called the Buddhist Calendar due to using the Buddhist Era, but the real Buddhist Calender uses a lunar calculation.
The Taiwanese calendar (also called the Minguo or Republic of China calendar) uses the ROC Era which starts counting years since 1912 AD, making 2010 AD = 99 ROC (yes, they have a Year 100 problem coming up :-). By coincidence this is the same as the North Korean Juche calendar, which uses the birth of Kim Il-sung as its epoch. If there's any North Korean users out there, I can add the calendar if you need it.
I did think about implementing the Korean Dangi Era calendar which used 2333 BC as its epoch, but as far as I can tell this was only used between 1952 and 1961 so would have no current usage. Strangely Microsoft does implement it, so if you know a reason why we should support it drop me a line.
The Japanese calendar can use the usual AD/CE year 1 as it's epoch, but also has an alternative year counting system based on the Nengo or Japanese Era system. Basically, this system counts the year number from the start of the Emporers reign, so 2010 AD = Heisei 22, but 1988 AD was Shōwa 63. Implementing this required implementing the POSIX standard for era date formats, so you can also now configure your date formats in any calendar system to include the Era. For Gregorian, this also includes the ability to choose between AD/BC and CE/BCE. As a bonus, you can also now configure your date formats to include ISO Day of Year, ISO Week, and ISO Day of Week. (Note there's a bug in System Settings when choosing Use Common Era, but the setting does get saved and used. It will be fixed soon.)
If you want different formats for the Era names, such as A.D. instead of AD, or even to create your own set of eras, then this can be done in the global config file. I haven't implemented a gui for this in Sytem Settings as I doubt it would be much used, but it is an option for the future.
One note on the Taiwanese calendar, distro's that maintain a patchset removing other Taiwanese features from KDE such as locale, flags, and translations for distribution in mainland China will probably need to remove this as well. KDE is apolitical and the presence or absence of such features should not be read as any kind of political statement, we merely seek to meet the needs of as many users as possible. (For the record, both Windows and OSX also ship outside mainland China with these features enabled).
Speaking of the competition, this means we now have 11 calender systems implemented, which are 8 of the 15 available in Windows and 4 they don't support, and 10 of the 12 available in OSX and 1 they don't support. We really only need the lunar based calendars now, mainly the Islamic Lunar and the Chinese Lunar which are the basis of many local variants.
For the coders out there, I've also added some more utilities to the API. The most interesting are getDate() (copied from the new QDate method in Qt4.6) that returns all the YMD componants in a single call, various routines to calculate the years, months and/or days difference between two dates in a consistent manner with the add YMD methods. I've also added the ability to format dates using a subset of the Unicode standard as used by Qt in the QDate::toString() method.
I'll also mention here that I've added support for 10 more local digit sets as shown below (the values from Bengali onwards are new):
There's another 20 digit sets supported by the Unicode standard that we could implement, but their languages are as yet un-translated in KDE so I've only documented them for now. If any of the languages are ever translated, we only need to un-comment one line to enable their digit set.
It's been a quiet few months on the blogging and KDE front, with very little time to achieve what I wanted for SC 4.5. I've spent a fair amount of time away from home on some archaeology projects, with limited connectivity and after a day in the field little energy left for hacking. The last couple of weeks I've been trying to catch up and make sure what I did get it into SC 4.5 actually works :-) I'll post a couple of blogs in quick order about what I did get finished. I really need to clear out my draft e-mail folder, there's a few offline replies there I forgot to send :-)
One consequence of being away is my blog got overwhelmed with more than 12,000 spam comments in about 2 months! I guess the Drupal captcha has been defeated, so I've upgraded to the latest Drupal and installed reCaptcha which hopefully will fix that problem.
I've just booked my tickets and accomodation for Tampere, so:
(and as a bonus to Estonia too, seeing as it's only a 2 hour ferry from Helsinki)
Which has got me to thinking about what I want to achieve while there. Code is good, but it's facetime that is the true value of Akademy. There's quite a few topics I'd like to talk to various people about, a couple of which probably deserve a full BoF session. I'll try blog about them in the next few weeks, but here's a short list for now:
Good thing Akademy lasts a whole week, eh? :-)
After a pleasant break during KDE 4.4 when I worked on stuff I wanted to do, I guess it's time to drag myself back to my penance, err I mean Printing, and trying to get the needed features up-streamed into Qt. This primarily means taking the big mess of code I did last year, adding support across all the official Qt platforms and automated unit tests, and breaking it up into nice small bite-sized pieces to feed to the Trolls via Gitorious merge requests.
My first merge request for the Current Page option in the print dialog has already been accepted and will be in Qt 4.7. This was a very simple change to do, but was a good way to test out the process as to took a few iterations to change it to how Qt wanted it. Note that any apps that wish to use the feature will need to enable the option as it can't be turned on by default.
My next merge request, just submitted, is for Multiple Page Ranges (e.g. "1,3-5,7-9"). The 'fun' and time-consuming part here was to set up a Virtualbox Windows development environment to compile and test the code on that platform (eventually I'll have to set up a Mac one too, but for now I'm not bothering as OS X doesn't support these features). If it survives the merge review and the Nokia lawyers, it should be in Qt 4.8 (sorry, no sooner than that).
The next few feature submissions in fairly short order should be:
After that I'll take a break to go back to some coding on KHolidays, KLocale, Calendar Systems, and the Plasma Clock for KDE 4.5, before moving onto the biggie: saving and restoring print settings.
Right now, however, I'm looking for some help on the Page Set code on Windows, so any Windows hackers out there keep reading!
Windows does not provide a built-in option for Page Set, so I need to add a new combo control to their print dialog. From reading MSDN it appears I need to define a new custom template for the standard Print Properties Sheet:
I think the required steps are:
That's the theory, but I have no idea how to actually do this. It's probably elementary to a Windows hacker, but I'm over my head here :-)
I've coded up what I can and pushed it to Gitorious. Commit f55cd14a is for the common framework and other platforms, and commit f73119eb sketches out where I think the Windows dialog code needs implementing. All you need to do is fill in the TODO items :-)
Once this is done, it should then be easy to add support for the Page Order feature by adding a tickbox for "Reverse pages".
It should also help with using the PRINTDLGEX lphPropertyPages feature to implement the QAbstractPrintDialog::setOptionTabs() feature. Bonus points for figuring out how to make that happen!
So if this looks like something you'd like to help with, drop me a line, I'm john (squiqly thingy) layt (dotty thingy) net.
Oh, and if you do send code, it should be stating the obvious that you must be willing to agree to Nokia's contribution agreement.
I've just made a change to the CUPS detection code in the print dialog that should now always match when Qt is using CUPS (it detects a specific behaviour of QPrinter when running CUPS as a heuristic, rather than trying to find a CUPS server for itself). This is to solve the current bug of not detecting when Qt is printing to a remote CUPS server. I've tested it still works for local servers, but I don't have a real-world remote CUPS server/printer floating around to test on. If you have a trunk or 4.4 branch checkout and a remote CUPS set-up, could you give this a test for me? Just make sure you have no local CUPS server running, call up a print dialog, and confirm the odd/even page selector is there and the page selection prints OK.
(Yes, I could fake it using a virtualbox session, but a real-world test would be more reassuring).
I'm home from my first ever trip to FOSDEM and I'm pleased to say had a great time there, most of all because of the chance to meet up with so many fantastic KDE people. I've never been to a conference with so many different FOSS groups involved and the vibe from so many geeks was incredible. It was especially refreshing to see so many female contributors there and so actively involved in their communities. I had planned to blog more about my impressions while there, but my laptop was quickly expropriated as the booth demo machine, and there was no free wifi at the hotel, so here's a long brain-dump of some random thoughts. You can see a few photos here.
I spent most of my time manning the KDE booth, more than I had planned and I missed a few talks I had wanted to see, but it was a pleasure to be able to interact with so many people, almost all of whom were overwhelmingly positive about KDE4. I had only one "Amarok 2 sucks" (he didn't have the guts to tell Sven on the 'rok booth to his face though...), and one "I stopped using KDE after 4.0" but who was very keen to give 4.4 a go as he believes our technology is on the right track. Much of my time seemed to be spent directing traffic. There was the guy who wanted to get involved with the Windows port who I demo'ed stuff to in Virtualbox and referred to the Windows team. Several people were eager to point out bugs they had found (directed them to bko). Others wanted to know if an obscure bug was fixed (err, I may be a dev, but I don't know every bug or feature). Someone wanted help with the openBSD packaging (hmm, dunno, Sune wasn't about, try Ade or the freeBSD guys?). Someone else wanted to know how to get the latest version of their app packaged by all the distros (talk to them at their booths just along the hall, or attend the OBS talk in 5 minutes time...). Someone demanded to know why KDevelop had made certain design choices (palmed off on Milian, sorry!). Someone else wanted to recruit some KDE devs to work on some desktop stuff (company business cards were quickly produced and handed over). Someone wanted to know about colour management in KDE, so they got Boud's e-mail address :-) An openSUSE developer wanted to check if a patch of his worked on my install (it didn't). And the guy wanting to interview a Dutch-speaker for a podcast was directed towards Jos (poor soul ;-).
The best chat I had was with a guy from the Netherlands who walked up to the table and loudly declared "I Love KDE!" (no, not Paul). He explained he was asked by a friend to help their mother with some PC problems. He visited her at her retirement village and replaced Windows with Kubuntu. A while later she asked him to visit again as some of the other residents wanted this Linux stuff too. He refused to install it himself but instead he taught them to do it themselves. Long story short, it spread like wildfire, last time he visited to give a talk there were over 80 very happy users aged 60 to 90 who had their own support community going. They love Linux for how fast and stable it is, but also because they can play with it. The beige box is no longer some mystery machine, but something they understand and control, and they are now contributing back to projects like OpenStreetMap and doing translations. Inspirational stuff.
For all the positives however, I think we can do some things better next time.
I know it's been talked about before, but we really do need a small demo machine with nicely pre-configured demo users that can easily be restored once messed up. The obvious tricks we missed this time were to have an open-pc as our demo machine (cross promotion and sales opportunity there), an N900 running Qt/KDE stuff (the one on the Gnome table was constantly being pawed at), and a netbook to show off the new Plasma Netbook containment (I had planned to bring my eee but it died last week). And the biggest screen we can lay our hands on, with some kind of very flashy demo program running to draw people in (could we steal one from the openSUSE booth???).
We also need to give more thought beforehand to what we want to achieve with the booth. Are we just there to sell t-shirts? Or something more? It's a decision we need to make for each event, and for FOSDEM I don't think the traditional "attract new users with a flashy demo" mode is going to work. I think we need to focus on attracting new community members and interacting with upstream/downstream projects. People mostly either wanted swag, or wanted to talk about technical stuff, there were no "What is KDE?" style questions. These people are either already involved in a FOSS community and wanted to know how we can interact with them, or were looking to get involved. Saying "visit the website" or "Google it" just doesn't cut it. The "KDE Handbook" was hugely popular and we need more handouts like it. We need to have "How can I help? / How to get involved?" handouts pointing potential contributors to the main participation entry points (wiki, mailing list, irc etc). We may need some kind of (private?) KDE directory to know which person or mailing list project X needs to talk to about problem Y. Knowing the areas of expertise of each KDE attendee would also be useful so you can grab an expert when needed.
There probably wouldn't be room, but rather than a table cutting us off from the people who wanted to talk, I think a "KDE Kafe" could work well at this sort of event. Several chairs or beanbags, a few developers/translators/packagers/etc, a few demo workstations and laptops, free coffee for those who stop to talk, and lots of time to talk, network, bug triage and collect brainstorm ideas.
FOSDEM itself is impressively well organised, as you need to be with 5000+ visitors. I'll just highlight two points, firstly their signage was very good, there was lots of it and it was very big, no getting lost here. That's something I've always thought we could improve on at Akademy/Desktop Summit. Not so good was the room allocation, where each project/stream got one room to use regardless of the size of audience each talk was likely to generate. So talks about "What's in the KDE 4.4 Release" and "What's new in Drupal 7" in smaller lecture rooms were massively overcrowded and had to turn people away while bigger auditoriums next door on obscure topics were sparsely populated. While staying in one room is good for a stream's more specialised topics, each major stream's keynote talk aimed at the mainstream could be given an auditorium slot.
Free foot massages for booth volunteers would be a welcome feature :-)
Fingers crossed, I'll be back next year, if only for the chance to eat waffles and drink beer at 11am while listening to a talk!
I haven't seen it mentioned anywhere else KDE related, but in Madrid you can now take a uni course in KDE and Gnome programming. I wonder if there will be guest lectures by Professor Faure and Dr Seigo? ;-)
It's been a few weeks, so what's up in the KDE Clapham office? (I'm pretty sure I'm the only KDE hacker in Clapham so can safely claim 'office' status, if I'm not, meet me for a pint down the Abbeville pronto!).
I'll be at Fosdem this weekend, so if you're there be sure to drop by the KDE stand for a chat, I promise not to bang on about calendars too much :-) (Well, unless you happen to be a Gtk/Gnome/Evolution hacker wanting to talk about shared standards for calendars and holiday files, then I'm all mouth). Just don't ask me about license stuff, you'll be wanting that weird bloke down the other end of the hall... I'll be in Brussels from 10am Friday wandering the streets in search of waffles, so if you're getting in early and looking for the same let me know.
Speaking of calendars (yeah, you knew it was coming) I decided on a whim to have a play with KHolidays in kdepimlibs to see if I could hack in support for holidays defined in non-Gregorian calendars, something I've been threatening the PIM guys I'd look at for ages. After about a weeks intense hacking, cramming on Bison and Flex (blech!), and dredging up long suppressed university lectures on LALR grammars (it's been almost 20 years now! And no, I didn't understand Richard's last post either...) I had a new experimental parser working. I waved it in the direction of the PIMsters to see if they were interested and next thing I know I've been anointed a Maintainer. Whoops, wasn't expecting that :-) So in 4.5 look for some improvements in how we handle holidays, in particular the ability to have non-Gregorian holidays like Jewish and Islamic religious holidays in the Plasma calendar and KOrganizer.
On that front, could I just ask for people in those countries and communities that use a non-Gregorian calendar to drop me a line with a list (or pointers to an official list in English) of both your official public holidays and the main religious holidays, and especially the rules about how they are calculated? I'm particularly interested in the more complex to define holidays, the ones that need special or long calculations, so I can see if the new code supports them. (We already have the KOrganizer Jewish Holidays plugin that I can crib from, but that's C++ and I'd like some English explanations). I'm john @ my domain name.
Oh, if you use the Hebrew calendar, sorry I've messed up the Hebrew numbers support in 4.4, I should have a fix in place before it goes gold.
What else? Oh yeah, there was some noise around the whole turn-of-the-decade thing, and Ade rightly pointed out we shouldn't be so pedantic about not having a year 0 to count from, especially with those 'lost' 10 days still to be found down the back of your sofa. In fact it's worse than that. It wasn't like on 1/1/1 that everyone suddenly woke up and decided "Hey let's start a new millennium!". Nope, the Romans didn't even use proper year numbering. It was some bloke called Dionysius Exiguus in 525 who came up with the idea to count consecutively from the birth of Jesus, except he got his maths wrong. And it wasn't until 731 that the Venerable Bede popularised using it. Later Gregory came along and decided to chuck away a few unnecessary leap days. And somewhere in there New Years Day moved around various dates before settling back to 1st January. And...
So the whole year numbering scheme is entirely arbitrary and retrospective and open to being revised and refactored at will or whim. As with the millennium, nobody's actually celebrating the passage of a fixed number of years. No, we're all just looking at that car odometer click over to a neat line of 0's. That's what we celebrate, and it's as good a reason as any for a beer. Just imagine if we had evolved fewer fingers, we'd be doing it more often :-) But if you really insist on being pedantic, then I will just point you at the ISO standard for calendars and dates where they arbitrarily declared the year 0 to exist for their purposes.
Speaking of which, my own clock ticked over to one of those 0's recently. Life supposedly begins this side of the great divide, I'll let you know...
[Edit: revised version hiding my blushes by giving the right reason for the policy, it's nothing to do with Qt anymore, D'oh! :-)]
Licensing and license compatability is hard, and I'm no expert (that would be Ade...), but I do know that krazy is telling me there is an increasing amount of code turning up in KDE that is licensed only under GPL3 which is a no-no according to the KDE Licensing Policy. The policy is in place because we need to keep our code base consistent and internally compatible while still allowing us to link to GPL2 only libraries if needed.
I'll be nudging people to get fixes made, but please remember that any new app code needs to be (GPL2+ || (GPL2+ && GPL3+)). Any new library code (kdelibs, kdepimlibs, kdebase-runtime) needs to be (LGPL2.1+ || (LGPL2.1+ && LGPL3+) || BSD || MIT || X11) where appropriate. This is just a high-level summary, read the Licensing Policy for the exact details, start the New Year with a refresher course :-). Contact the licensing mailing list if you need expert advice.
Don't forget you must also include a copyright statement in the form "Copyright <year> <name of author> <e-mail>". Although not explained in the policy, there's a few important criteria this needs to meet to carry maximum legal weight (at least according to discussions on the licensing list):
So an ideal notice would look like "Copyright 2003, 2004, 2005, 2009 Joe Bloggs email@example.com".
I see a few people trying to beat the email harvesters by writing "joe.bloggs kde org", I guess that's still acceptable if a little futile? Please try make the email an address that will last a while: University, work, and even ISP addresses have natural life-spans far shorter than your code and someone may need to reach you 5-10 years later. The kdemail forwarder is a good option if you are not an ev member with a kde.org address (hmm, about time I joined!).
Krazy is your friend for checking stuff like this, remember to look a couple of days after any commit to see if you've missed something :-) I wonder if we could have an svn hook that runs krazy and apidox over only the files changed by a commit and e-mails the result to the committer? Or if all the checks would be too inefficient, at least an important subset? All I know is most people forget to check krazy and apidox, so any automation would be good.
Happy New Year y'all!
I've almost completed my QA review of the code in the existing Calendar Systems, with the Hijri / Islamic calendar passing relatively unscathed but some possible optimisations noted (it uses recursion where direct calculation may be faster). The Jalali calendar (aka Iranian or Persian, as used in Iran and Afganistan) has proven somewhat harder and needed a lot of research.
The basic problem is that the Jalali is a purely Solar calendar with the first day of the year being officially defined in relation to the vernal equinox and solar noon at the reference longitude for Iran Standard Time (52°30' E). There is no offically defined rule for calculating leap years, nor can there be, a leap year is just any year in which there are 366 days between successive vernal equinoxes. The upshot is there is no simple arithmetic method to calculate when leap years should occur, for complete accuracy you must correctly calculate the vernal equinox.
There are two popular approximations for sequences of leap years, the 33 year cycle and the 2820 year cycle (aka the Birashk method), but these each return wrong results in various and different years, and there is much debate on which is better. Most implementations choose to use one of these for efficiency and simplicity regardless of accuracy, Microsoft has chosen the 33 year cycle which is more accurate in years immediately around AD 2000, many FOSS projects have gone with the 2820 year cycle due to Emacs implementing it first. I haven't confirmed which Apple supports.
In KDE we have been using the 2820 year cycle when calculating date conversions, but were using the 33 year cycle when calculating leap years, leading to some quirky errors. I've fixed that to always use the 2830 year cycle, and now restrict the valid date range to the years AP 1244 to 1530 (roughly AD 1865 to 2152), a useful range of modern dates during which the 2830 year cycle is only wrong twice (AP 1404 and 1437, roughly 2004 and 2058). I've added special exceptions to cover these two cases so we now exactly match the true astronomical calendar for the entire supported period.
In 4.5 we should begin to support astronomical calendars properly, so we will switch Jalali to correctly calculating the equinox and thus extend the supported date range. We will also provide reference implementations of the 33 and 2820 year cycle calendars to allow for interoperation with systems that use them.
The final calendar for QA is the Hebrew calendar, which looks to have had some bad bugs creep in.