• Publicity: Public Only All

xowiki-utility-procs.tcl

XoWiki - Utility procs

Location:
packages/xowiki/tcl/xowiki-utility-procs.tcl
Created:
2006-08-08
Author:
Gustaf Neumann
CVS Identification:
$Id: xowiki-utility-procs.tcl,v 1.60 2024/09/11 06:15:56 gustafn Exp $

Procedures in this file

Detailed information

xowiki::filter_option_list (public)

 xowiki::filter_option_list option_list except

Process an option list (pairs of label and id) suitable to be passed to several widgets and remove all entries having an id from the except list.

Parameters:
option_list (required)
list of labels and ids
except (required)
list of internal ids
Returns:
filtered option list

Testcases:
api_filter_option_list

xowiki::hstore::dict_as_hkey (public)

 xowiki::hstore::dict_as_hkey dict
Parameters:
dict (required)
Returns:
dict value in form of a hstore key.

Testcases:
api_hstore

xowiki::hstore::double_quote (public)

 xowiki::hstore::double_quote value

From hstore manual: "Double-quote keys and values that include whitespace, commas, =s or >s. To include a double quote or a backslash in a key or value, escape it with a backslash." https://www.postgresql.org/docs/current/hstore.html

Parameters:
value (required)
Returns:
double_quoted value as appropriate for hstore

Testcases:
api_hstore, xowiki_test_cases

xowiki::randomized_index (public)

 xowiki::randomized_index [ -seed seed ] length

Return a single randomized value between 0 and length-1.

Switches:
-seed (optional)
Parameters:
length (required)

Testcases:
api_randomized

xowiki::randomized_indices (public)

 xowiki::randomized_indices [ -seed seed ] length

Produce a list of "length" random numbers between 0 and length-1. Measure quality of randomization:

      time {lappend _ [xowiki::randomized_indices -seed [clock microseconds] 3]} 1000
      foreach t $_ {
        lassign $t a b c; dict incr stats "a $a"; dict incr stats "b $b"; dict incr stats "c $c"
      }
      set stats
    

Switches:
-seed (optional)
Parameters:
length (required)

Testcases:
api_randomized
[ show source ]