cal: always include the year in the month header
PATCH 1/4 cal: always include the year in the month header
Most of cal's output has the year in the month header. The exception is when a full year is output, which then has a top header containing the year.
There is a bug when using --span with --year, --Year, or with only a year for the date parameter; then months for multiple years are output and only one year is displayed at the top.
These are all broken:
cal -Sy 2020
cal -SY 2020
cal -S 2020
cal -3 2020 (this is broken in the current release because it
too sets --span, but still displays 12 months)
The top header typically scrolls off the screen for a full year output anyway. So it is convenient to have the year included in each month.
To fix these issues and to make cal's output consistent, always display the year in the month header.
--- misc-utils/cal.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
misc-utils/cal.c +6 -7
@@ -705,17 +705,16 @@ static void cal_output_header(struct cal_month *month, const struct cal_controlchar out[FMT_ST_CHARS ];struct cal_month *i; -if (ctl->header_hint || ctl->header_year) { +if (ctl->header_hint) {for (i = month; i; i = i->next) {sprintf (out,_ ("%s" ), ctl->full_month[i->month -1 ]);center (out, ctl->week_width -1 , i->next ==NULL ?0 : ctl->gutter_width); } -if (!ctl->header_year) { -my_putstring ("\n" ); -for (i = month; i; i = i->next) { -sprintf (out,_ ("%04d" ), i->year); -center (out, ctl->week_width -1 , i->next ==NULL ?0 : ctl->gutter_width); - } +my_putstring ("\n" ); +for (i = month; i; i = i->next) { +sprintf (out,_ ("%04d" ), i->year); +center (out, ctl->week_width -1 , + i->next ==NULL ?0 : ctl->gutter_width); } }else {for (i = month; i; i = i->next) {
PATCH 2/4 cal: remove year top header
Year is now always displayed in the month header.
--- misc-utils/cal.c | 32 +++----------------------------- 1 file changed, 3 insertions(+), 29 deletions(-)
misc-utils/cal.c +3 -29
@@ -225,7 +225,6 @@ struct cal_control {int gutter_width;/* spaces in between horizontal month outputs */ struct cal_request req;/* the times user is interested */ unsigned int julian:1, /* julian output */ - header_year:1, /* print year number */ header_hint:1; /* does month name + year need two lines to fit */ };
@@ -244,8 +243,7 @@ static void headers_init(struct cal_control *ctl);static void cal_fill_month (struct cal_month *month,const struct cal_control *ctl);static void cal_output_header (struct cal_month *month,const struct cal_control *ctl);static void cal_output_months (struct cal_month *month,const struct cal_control *ctl); -static void monthly (const struct cal_control *ctl); -static void yearly (const struct cal_control *ctl); +static void months (const struct cal_control *ctl);static int day_in_year (const struct cal_control *ctl,int day,int month,int32_t year); static int day_in_week(const struct cal_control *ctl, int day,
@@ -538,7 +536,6 @@ int main(int argc, char **argv) ctl.num_months =MONTHS_IN_YEAR ;if (yflag) { ctl.req.start_month =1 ;/* start from Jan */ - ctl.header_year =1 ;/* print year number */ } }
@@ -551,10 +548,7 @@ int main(int argc, char **argv)if (!ctl.num_months) ctl.num_months =1 ;/* display at least one month */ -if (yflag || Yflag) -yearly (&ctl); -else -monthly (&ctl); +months (&ctl);return EXIT_SUCCESS ; }
@@ -805,7 +799,7 @@ static void cal_output_months(struct cal_month *month, const struct cal_control } } -static void monthly (const struct cal_control *ctl) +static void months (const struct cal_control *ctl) {struct cal_month m1,m2,m3, *m;int i, rows, new_month, month = ctl->req.start_month ? ctl->req.start_month : ctl->req.month;
@@ -852,26 +846,6 @@ static void monthly(const struct cal_control *ctl) } } -static void yearly (const struct cal_control *ctl) -{ -char out[FMT_ST_CHARS ]; -int year_width =0 ; - - year_width += (ctl->week_width +1 ) * (ctl->julian ?2 :3 ); -if (ctl->julian) - year_width--; - -if (ctl->header_year) { -sprintf (out,"%04d" , ctl->req.year); -center (out, year_width,0 ); -my_putstring ("\n\n" ); - } -monthly (ctl); - -/* Is empty line at the end year output really needed? */ -my_putstring ("\n" ); -} -/* * day_in_year -- * return the 1 based day number within the year
PATCH 3/4 cal: new top header to display the calendar system
In reply to J William PiggottOutput a top header showing what calendar system is being
displayed: Julian, Gregorian, or Mixed.
Add months_in_row handling for 2 month columns; this enables proper centering of the header in that case.
Also set the default gutter_width with to 3; using multiple values complicates alignment of the top header; changing it to 3 makes cal's output consistent.
cal 8 1752
Julian
August 1752
Su Mo Tu We Th Fr Sa
1 2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31
cal 9 1752
Mixed
September 1752
Su Mo Tu We Th Fr Sa
1 2 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
cal 10 1752
Gregorian
October 1752Su Mo Tu We Th Fr Sa
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
cal -3 9 1752
Mixed
August 1752 September 1752 October 1752
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 1 2 14 15 16 1 2 3 4 5 6 7 2 3 4 5 6 7 8 17 18 19 20 21 22 23 8 9 10 11 12 13 14 9 10 11 12 13 14 15 24 25 26 27 28 29 30 15 16 17 18 19 20 21 16 17 18 19 20 21 22 22 23 24 25 26 27 28 23 24 25 26 27 28 29 29 30 31
30 31
cal --iso 9 1752
Gregorian
September 1752
Su Mo Tu We Th Fr Sa
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
cal --reform julian 1 2018
Julian
January 2018Su Mo Tu We Th Fr Sa
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
--- misc-utils/cal.1 | 3 ++ misc-utils/cal.c | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 86 insertions(+), 3 deletions(-)
misc-utils/cal.1 +3 -0
@@ -67,6 +67,9 @@ is followed by the 14th (the 3rd through the 13th are absent). .sp Optionally, either the proleptic Gregorian calendar or the Julian calendar may be used exclusively. +.sp +The calendar system being output is displayed at the top. The values can be: +Gregorian, Julian, or Mixed. .RB See\ \-\-reform\ below. .SH OPTIONS .TP
misc-utils/cal.c +83 -3
122 lines not on this page · raw message
PATCH 4/4 cal: new option to drop the calendar system header
In reply to J William PiggottAdd an option to not display the new calendar system header.
--- misc-utils/cal.1 | 5 +++++ misc-utils/cal.c | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-)
misc-utils/cal.1 +5 -0
@@ -80,6 +80,11 @@ Display single month output. \fB\-3\fR, \fB\-\-three\fR Display three months spanning the date. .TP +.B \-\-drop-header +Do not display the calendar system header. +.br +.RB See\ \%DESCRIPTION\ above. +.TP \fB\-n , \-\-months\fR \fInumber\fR Display \fInumber\fR of months, starting from the month containing the date. .TP
misc-utils/cal.c +9 -1
@@ -223,6 +223,7 @@ struct cal_control {size_t day_width;/* day width in characters in printout */ size_t week_width;/* 7 * day_width + possible week num */ int gutter_width;/* spaces in between horizontal month outputs */ +int drop_header;/* don't display calendar system header */ struct cal_request req;/* the times user is interested */ unsigned int julian:1, /* julian output */ header_hint:1; /* does month name + year need two lines to fit */
@@ -278,6 +279,7 @@ int main(int argc, char **argv)enum {OPT_COLOR =CHAR_MAX +1 , +OPT_DROP_HEADER ,OPT_ISO ,OPT_REFORM };
@@ -295,6 +297,7 @@ int main(int argc, char **argv) {"color", optional_argument, NULL, OPT_COLOR}, {"reform", required_argument, NULL, OPT_REFORM}, {"iso", no_argument, NULL, OPT_ISO}, + {"drop-header", no_argument, NULL, OPT_DROP_HEADER}, {"version", no_argument, NULL, 'V'}, {"twelve", no_argument, NULL, 'Y'}, {"help", no_argument, NULL, 'h'},
@@ -412,6 +415,9 @@ int main(int argc, char **argv)case OPT_ISO : ctl.reform_year =ISO ;break ; +case OPT_DROP_HEADER : + ctl.drop_header =1 ;; +break ;case 'V' :printf (UTIL_LINUX_VERSION );return EXIT_SUCCESS ;
@@ -551,7 +557,8 @@ int main(int argc, char **argv)if (!ctl.num_months) ctl.num_months =1 ;/* display at least one month */ -top_header (&ctl); +if (!ctl.drop_header) +top_header (&ctl);months (&ctl);return EXIT_SUCCESS ;
@@ -1135,6 +1142,7 @@ static void __attribute__((__noreturn__)) usage(void)fputs (_ (" -j, --julian use day-of-year for all calendars\n" ), out);fputs (_ (" --reform <val> Gregorian reform date (1752|gregorian|iso|julian)\n" ), out);fputs (_ (" --iso alias for --reform=iso\n" ), out); +fputs (_ (" --drop-header do not display the calendar system header\n" ), out);fputs (_ (" -y, --year show the whole year\n" ), out);fputs (_ (" -Y, --twelve show the next twelve months\n" ), out);fputs (_ (" -w, --week[=<num>] show US or ISO-8601 week numbers\n" ), out);
Re: [PATCH 3/4] cal: new top header to display the calendar system
In reply to J William PiggottQuoted 2 lines · J William Piggott
Output a top header showing what calendar system is being
displayed: Julian, Gregorian, or Mixed.
Is it really necessary to print these extra lines always and by default? I've never seen a calendar which reminds me on each page that we are using Gregorian "nowadays".
Also I think it would be nice to fix the tests at least at the end of each pull request.
cu,
Rudi
Quoted 233 lines
Add
months_in_rowhandling for 2 month columns; this enables proper centering of the header in that case.Also set the default
gutter_widthwith to 3; using multiple values complicates alignment of the top header; changing it to 3 makes cal's output consistent.cal 8 1752
Julian August 1752 Su Mo Tu We Th Fr Sa 12 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31cal 9 1752
MixedSeptember 1752 Su Mo Tu We Th Fr Sa 1 2 14 15 1617 18 19 20 21 22 23
24 25 26 27 28 29 30cal 10 1752
Gregorian October 1752Su Mo Tu We Th Fr Sa
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31cal -3 9 1752
MixedAugust 1752 September 1752 October 1752
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa1 1 2 14 15 16 1 2 3 4 5 6 7 2 3 4 5 6 7 8 17 18 19 20 21 22 23 8 9 10 11 12 13 14 9 10 11 12 13 14 15 24 25 26 27 28 29 30 15 16 17 18 19 20 21 16 17 18 19 20 21 22 22 23 24 25 26 27 28 23 24 25 26 27 28 29 29 30 3130 31
cal --iso 9 1752
GregorianSeptember 1752 Su Mo Tu We Th Fr Sa 1 23 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30cal --reform julian 1 2018
Julian January 2018Su Mo Tu We Th Fr Sa
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31Signed-off-by J William Piggott <[email protected]>--- misc-utils/cal.1 | 3 ++ misc-utils/cal.c | 86++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 86 insertions(+), 3 deletions(-)
misc-utils/cal.1 +0
-0@@ -67,6 +67,9 @@ is followed by the 14th (the 3rd through the 13thare absent). .sp
Optionally, either the proleptic Gregorian calendar or the Julian
calendar may be used exclusively.
+.sp
+The calendar system being output is displayed at the top. The values can be: +Gregorian, Julian, or Mixed.
.RB See\ \-\-reform\ below.
.SH OPTIONS
.TPmisc-utils/cal.c +0
-0@@ -244,6 +244,8 @@ static void cal_fill_month(struct cal_month *month, const struct cal_control *ct static void
cal_output_header(struct cal_month *month, const struct cal_control *ctl); static voidcal_output_months(struct cal_month *month, const struct cal_control *ctl); static voidmonths(const struct cal_control *ctl);misc-utils/cal.c +9
-3+static int is_mixed_output (const struct cal_control *ctl); +static void top_header (const struct cal_control *ctl);static int day_in_year (const struct cal_control *ctl,int day,int month,int32_t year); static int day_in_week(const struct cal_control *ctl, int day,@@ -269,7 +271,7 @@ int main(int argc, char **argv) .colormode = UL_COLORMODE_UNDEF, .weektype = WEEK_NUM_DISABLED, .day_width = DAY_LEN, - .gutter_width = 2, + .gutter_width = 3, .req.day = 0, .req.month = 0 };@@ -531,7 +533,6 @@ int main(int argc, char **argv) }if (yflag || Yflag) { - ctl.gutter_width =3 ;if (!ctl.num_months) ctl.num_months =MONTHS_IN_YEAR ;if (yflag) {@@ -539,7 +540,9 @@ int main(int argc, char **argv) } } -if (ctl.num_months >1 && ctl.months_in_row ==0 ) +if (ctl.num_months ==2 ) + ctl.months_in_row =2 ; +else if (ctl.num_months >2 && !ctl.months_in_row) ctl.months_in_row = ctl.julian ?MONTHS_IN_YEAR_ROW -1 :MONTHS_IN_YEAR_ROW ;else if (!ctl.months_in_row)@@ -548,6 +551,7 @@ int main(int argc, char **argv)if (!ctl.num_months) ctl.num_months =1 ;/* display at least one month */ +top_header (&ctl);months (&ctl);return EXIT_SUCCESS ;@@ -846,6 +850,82 @@ static void months(const struct cal_control *ctl) } } +/* +* Use the requested date, number of months to display, and the span option to + * determin whether the Gregorian reform month will be displayed; meaning mixed + * calendar systems will be used in the output.
+ */misc-utils/cal.c +71
-1+static int is_mixed_output (const struct cal_control *ctl) +{ +if (ctl->req.year > ctl->reform_year) { +if (ctl->span_months && ctl->num_months /2 + > ((ctl->req.year - ctl->reform_year) *MONTHS_IN_YEAR ) + - ((REFORMATION_MONTH +1 ) - ctl->req.month)) +return 1 ; + }else if (ctl->req.year < ctl->reform_year) { +if (ctl->span_months) { +if (ctl->num_months /2 + ctl->num_months %2 + > ((ctl->reform_year - ctl->req.year) + *MONTHS_IN_YEAR ) + + (REFORMATION_MONTH - ctl->req.month)) +return 1 ; + }else { +if (ctl->num_months + > ((ctl->reform_year - ctl->req.year) + *MONTHS_IN_YEAR ) + + (REFORMATION_MONTH - ctl->req.month)) +return 1 ; + } + }else {/* req.year is reform year */ +if (ctl->req.month >REFORMATION_MONTH ) { +if (ctl->span_months && ctl->num_months /2 + > (ctl->req.month - (REFORMATION_MONTH +1 ))) +return 1 ; + }else { +if (ctl->span_months) { +if (ctl->num_months /2 + ctl->num_months %2 + > (REFORMATION_MONTH - ctl->req.month)) +return 1 ; + }else { +if (ctl->num_months + > (REFORMATION_MONTH - ctl->req.month)) +return 1 ; + } + } + } +return 0 ; +} + +/* Print first line - shows the calendar system being displayed */ +static void top_header (const struct cal_control *ctl) +{ +char out[FMT_ST_CHARS ]; +int cols =0 ; + +if (ctl->reform_year ==GREGORIAN ) { +sprintf (out,"%s" ,_ ("Gregorian" )); + }else if (ctl->reform_year ==JULIAN ) { +sprintf (out,"%s" ,_ ("Julian" )); + }else {/* we have a reform year */ +if (is_mixed_output (ctl)) +sprintf (out,"%s" ,_ ("Mixed" )); +else if (ctl->req.year > ctl->reform_year) +sprintf (out,"%s" ,_ ("Gregorian" )); +else if (ctl->req.year < ctl->reform_year) +sprintf (out,"%s" ,_ ("Julian" )); +else {/* req.year is reform year */ +if (ctl->req.month >REFORMATION_MONTH ) +sprintf (out,"%s" ,_ ("Gregorian" )); +else +sprintf (out,"%s" ,_ ("Julian" )); + } + } + + cols += (ctl->week_width * ctl->months_in_row) +1 ; +center (out, cols,0 ); +my_putstring ("\n\n" ); +} +/* * day_in_year -- * return the 1 based day number within the year -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 4/4 cal: new option toggles the calendar system header
In reply to J William PiggottAdd an option that toggles displaying of the new calendar system header.
---
v2 changelog
Changed the new option to a boolean. This allows overriding an alias configuration and makes it easy for Karel to choose what the default should be.
misc-utils/cal.1 | 5 +++++ misc-utils/cal.c | 17 +++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-)
misc-utils/cal.1 +5 -0
@@ -147,6 +147,11 @@ calendar output uses the Julian calendar system. .RB See\ \%DESCRIPTION\ above. .RE .TP +.BR \-\-top-header\ on | off +Toggle displaying of the calendar system header (default on). +.br +.RB See\ DESCRIPTION\ above. +.TP \fB\-y\fR, \fB\-\-year\fR Display a calendar for the whole year. .TP
misc-utils/cal.c +15 -2
@@ -223,6 +223,7 @@ struct cal_control {size_t day_width;/* day width in characters in printout */ size_t week_width;/* 7 * day_width + possible week num */ int gutter_width;/* spaces in between horizontal month outputs */ +int top_header;/* display the calendar system header */ struct cal_request req;/* the times user is interested */ unsigned int julian:1, /* julian output */ header_hint:1; /* does month name + year need two lines to fit */
@@ -265,6 +266,7 @@ int main(int argc, char **argv)int ch =0 , yflag =0 , Yflag =0 ;static struct cal_control ctl = { + .top_header =1 , .reform_year =DEFAULT_REFORM_YEAR , .weekstart =SUNDAY , .span_months =0 ,
@@ -279,7 +281,8 @@ int main(int argc, char **argv)enum {OPT_COLOR =CHAR_MAX +1 ,OPT_ISO , -OPT_REFORM +OPT_REFORM , +OPT_TOP_HEADER };static const struct option longopts[] = {
@@ -295,6 +298,7 @@ int main(int argc, char **argv) {"color", optional_argument, NULL, OPT_COLOR}, {"reform", required_argument, NULL, OPT_REFORM}, {"iso", no_argument, NULL, OPT_ISO}, + {"top-header", required_argument, NULL, OPT_TOP_HEADER}, {"version", no_argument, NULL, 'V'}, {"twelve", no_argument, NULL, 'Y'}, {"help", no_argument, NULL, 'h'},
@@ -412,6 +416,12 @@ int main(int argc, char **argv)case OPT_ISO : ctl.reform_year =ISO ;break ; +case OPT_TOP_HEADER : + ctl.top_header = +parse_switch (optarg, +_ ("invalid --top-header argument" ), +"on" ,"off" ,"1" ,"0" ,NULL ); +break ;case 'V' :printf (UTIL_LINUX_VERSION );return EXIT_SUCCESS ;
@@ -551,7 +561,8 @@ int main(int argc, char **argv)if (!ctl.num_months) ctl.num_months =1 ;/* display at least one month */ -top_header (&ctl); +if (ctl.top_header) +top_header (&ctl);months (&ctl);return EXIT_SUCCESS ;
@@ -1135,6 +1146,8 @@ static void __attribute__((__noreturn__)) usage(void)fputs (_ (" -j, --julian use day-of-year for all calendars\n" ), out);fputs (_ (" --reform <val> Gregorian reform date (1752|gregorian|iso|julian)\n" ), out);fputs (_ (" --iso alias for --reform=iso\n" ), out); +fputs (_ (" --top-header <on|off>\n" +" toggle the calendar system header\n" ), out);fputs (_ (" -y, --year show the whole year\n" ), out);fputs (_ (" -Y, --twelve show the next twelve months\n" ), out);fputs (_ (" -w, --week[=<num>] show US or ISO-8601 week numbers\n" ), out);
Karel Zak
maintainerRe: [PATCH 3/4] cal: new top header to display the calendar system
In reply to J William PiggottQuoted 3 lines · J William Piggott
Output a top header showing what calendar system is being
displayed: Julian, Gregorian, or Mixed.
This is overkill and strange thing, at least by default. I have no problem to add a command line option for this feature, but don't enable it by default. Please.
Karel
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com
Karel Zak
maintainerRe: [v2 PATCH 4/4] cal: new option toggles the calendar system header
In reply to J William PiggottQuoted 2 lines · J William Piggott
+.BR \-\-top-header\ on | off
+Toggle displaying of the calendar system header (default on).
I don't like the name of the option, what about
--calendar-type-header=on|off
and default OFF.
Karel
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com
Karel Zak
maintainerRe: [PATCH 2/4] cal: remove year top header
In reply to J William PiggottQuoted 2 lines · J William Piggott
misc-utils/cal.c | 32 +++----------------------------- 1 file changed, 3 insertions(+), 29 deletions(-)
Do I understand correctly that "cal -y" will not display year on the top and year will be always behind all month names?
If yes, I'm not sure if I like it. I understand that "Month Year" is a good thing for complicated outputs (especially cross year borders), but if I ask for all year (by -y)?
Karel
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com
Re: [PATCH 2/4] cal: remove year top header
Quoted 10 lines · Karel Zak
Quoted 2 lines · J William Piggott
misc-utils/cal.c | 32 +++----------------------------- 1 file changed, 3 insertions(+), 29 deletions(-)Do I understand correctly that "cal -y" will not display year on the top and year will be always behind all month names?
If yes, I'm not sure if I like it. I understand that "Month Year" is a good thing for complicated outputs (especially cross year borders), but if I ask for all year (by -y)?
I'd also like to see the year only once per year. FreeBSD's cal does it very nice IMO.
Unfortunately we have this bloated output already now in
$ cal -n 36
Karel Zak
maintainerRe: [PATCH 2/4] cal: remove year top header
Quoted 13 lines · Ruediger Meier
Quoted 10 lines · Karel Zak
Quoted 2 lines · J William Piggott
misc-utils/cal.c | 32 +++----------------------------- 1 file changed, 3 insertions(+), 29 deletions(-)Do I understand correctly that "cal -y" will not display year on the top and year will be always behind all month names?
If yes, I'm not sure if I like it. I understand that "Month Year" is a good thing for complicated outputs (especially cross year borders), but if I ask for all year (by -y)?
Quoted 6 lines
I'd also like to see the year only once per year. FreeBSD's cal does it very nice IMO.
Unfortunately we have this bloated output already now in
$ cal -n 36
Not perfect, but makes some sense, and it's used for this new feature from the beginning.
The "cal -y" is pretty old and I don't think we need a change here.
Karel
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com