twitterlink facebooklink feedlink

April 10, 2010: This afternoon I recieved a visit from a plushy black cat. I've never seen her before and since she has a collar she may be moved in with her owner in the last days.

Read more about project 365 ...

A weekly calendar plugin for rails

Posted by semantosoph on Jul 29, 2009 | 2 comments

Something that bugged me with its non-existence in the past was a rails plugin that would display a weekly calendar, while being highly configurable. And by saying highly configurable, I mean it should have options for its look, its operation and, beyond that, it should accept any kind of data to display. As there was no such plugin, I did it myself. So today, I proudly present you the weekly_schedule plugin for rails.

Installing

This plugin is really easy to install. Just download it from GitHub and place it into the vendor/plugins directory.

Usage

The simplest possible call in your code would be

schedule()

which generates a plain calendar (which can then be customized using CSS) for the current week. However, this may be customized in a variety of ways—changing the default CSS classes, populating the individual day entries with appointments, and so on. Generating a calendar that shows the whole christmas week 2009, starting from monday, would require the following call:

schedule(:day => Date.civil(2009, 12, 25), :first_day_of_week => 1)

A more typical use case for schedules is to show what happening today or the very next time. The following code generates a calendar that always starts with today:

schedule(:first_day_of_week => Date.today.cwday)

A more convenient variant of this is the following:

schedule(:first_day_of_week => Date.today.cwday - 3)

This calendar starts three days earlier and therefore keeps today right in the middle of the display

Options

As I said earlier in this post, I wanted this plugin to be as customizable as possible. So it is now packed with different options for the CSS classes:

:table_class
:month_name_class
:day_name_class
:day_class

An additional ‘weekend’ class is applied to weekend days.

The following options are available for customizing the behaviour of the calendar:

:day

This option specifies the day, whose week shall be displayed. Defaults to Date.today

:abbrev

This option specifies how the day names should be abbreviated. Use (0..2) for the first three letters, (0..0) for the first, and (0..-1) for the entire name.

:first_day_of_week

This renders a calendar starting on a specific weekday. Use 1 for Monday up to 7 for Sunday. This option applies only if :only_workdays is set to false.

:show_today

Highlights today on the calendar using the CSS class ‘today’. Defaults to true.

:only_workdays

Turns off weekend display. Defaults to false. When turned on, the value of :first_day_of_week is fixed to 1 (monday). If :day is a saturday or sunday, the following week is shown.

:show

Now, this gives us a hint where to search for info to show and is handed over to details(). Defaults to nil (showing no info).

A word about details()

This function evaluates if something is given in in the :show option. The following should give you a rough idea how this may be useful. Imagine, you’ve given @this_weeks_appointments as an array via the :show option. The value in date is the currently processed day as a Date object.

def details(date, options)
    if options[:show]
      appointments = options[:show].select{|a| a.date == date}.sort_by{|t| t.time}
      appointments.map{|a| "#{a.time} #{a.place}"}
  else
    'Nothing to do today'
  end
end

Feel free to download the plugin from GitHub. If you have some comment or a great idea, please let me know.

The Semantic Web Landscape 2009

Posted by semantosoph on Jul 19, 2009 | 0 comments

Long time no post. Learning for exams keeps me busy. But while learning, I found this neat presentation that was created by Lee Feigenbaum of Cambridge Semantics.

These slides were originally a tutorial presented for the SIG preceding the May 2009 meeting of the PRISM Forum. They attempt to give a survey of the technologies, tools, and state of the world with respect to the Semantic Web as of the first half of 2009. You may note the complete absence of topic maps, which clearly says, that more topic maps evangelization is needed.

Filed under , ,

The princess and the pea

Posted by semantosoph on May 27, 2009

K won the local the-princess-and-the-pea-lookalike-contest without a struggle. In addition, she recieved the jury award for the most bored look.

Filed under

Google accepts RDFa and microformat

Posted by semantosoph on May 15, 2009

On Tuesday, the alpha animal of all search engines – Google – announced a new Feature called “rich snippets”, that will delight the semantic web community in some way.

How come?

With rich snippets, Google jumps on the accelerating bandwagon of linked data and the semantic web. It does so, by reading embedded semantic annotations, that were placed into the HTML code of a site. For now, the Google spiders understand the concepts of People and Reviews and will accept descriptions in RDFa and microformat. After reading, Google will then display so called “rich snippets” on any search result, that points to a site that contains semantic annotations.

For more information, read the original article in the Webmaster Central Blog of Google. Web coders may find this Google support site on marking up structured data helpful.

Topic Maps Lab starts

Posted by semantosoph on May 04, 2009

Today ist the first working day of the new Topic Maps Lab project. We entered the new rooms in downtown Leipzig. They are located in the 9th floor of an university building. The respective look is great. However, as this is the south side of the building, we’ll have heat problems in the summer.

After some celebration with sparkling wine, we gathered together in the meeting room to share our ideas and discuss the next steps on our schedule.

Stay tuned for more information out of Topic Maps Lab pot.

Filed under