Version 140 of Jos Decoster

Updated 2009-09-17 11:20:02 by jdc

Contact info

mail: jos _dot_ decoster _at_ gmail _dot_ com

jdc on the Tcler's chat.

homepage: http://sites.google.com/site/josdecoster

Contributions

Using BLT with Tcl 8.5.2

For an application I develop, I'm using the BLT commands bgexec, busy, graph and barchart. bgexec and busy are available as starkits (check Standalone bgexec and busy), but the graph and barchart commands have no startkit equivalent. So I had to get BLT going for Tcl 8.5.2. The followings changes were needed:

  1. BLT has its own copy of the TkDisplay structure definition. A new member was added to this struct in Tk 8.5.2, which caused a crash of the busy command. This new member is XIMStyle inputStyle;, found in file tkInt.h of the Tk distribution. This member needs to be added to the TkDisplay definition as found in bltWindow.c file of BLT.
  2. Tk must be compiled without Xft support. Xft seems to cause trouble with e.g. the bitmap command.
  3. Some libs need to be added to the link command. This needs to be inserted before -lX11 in the generated Makefile in the src and src/shared subdirectories: -lX11 -lXss -lXext.
  4. When using the zoom-stack, some assertion trigger. Commenting them out solved the problem without introducing problems. I removed the 4 assert statements in the BoxesDontOverlap function in file bltGrMarker.c.

Wiki edit statistics

Edit statistics can be generated with this script:

package require Mk4tcl

mk::file open db wikit-20081226.tkd -readonly

proc get_nick {who} {
    set idx [string first @ $who]
    if {$idx > 0} {
        return [string range $who 0  [expr {$idx-1}]]
    } else {
        return $who
    }
}

mk::loop i db.pages {
    lassign [mk::get $i name who date] name who date
    set y [clock format $date -format %Y]
    incr ys($y)
    incr w($y,[get_nick $who])
    incr p($y,[string range $i 9 end])

    mk::loop j $i.changes {
        lassign [mk::get $j who date] who date
        set y [clock format $date -format %Y]
        incr ys($y)
        incr w($y,[get_nick $who])
        incr p($y,[string range $i 9 end])
    }
}

foreach y [lsort -integer [array names ys]] {

    puts "***$y: $ys($y) edits***"

    set l {}
    foreach {k v} [array get p $y,*] {
        set n [lindex [split $k ,] end]
        set name [mk::get db.pages!$n name]
        lappend l [list $name $v]
    }
    set n 0
    puts "\n%|Page|Number of edits|%"
    foreach il [lsort -integer -decreasing -index 1 $l] {
        puts "&|[join $il |]|&"
        incr n
        if {$n>20} {break}
    }

    set l {}
    foreach {k v} [array get w $y,*] {
        lappend l [list [lindex [split $k ,] end] $v]
    }
    set n 0
    puts "\n%|Nick|Number of edits|%"
    foreach il [lsort -integer -decreasing -index 1 $l] {
        puts "&|[join $il |]|&"
        incr n
        if {$n>20} {break}
    }
}

mk::file close db