This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nlogviewer = new NLogViewer(this); | |
nlogviewer.Show(); | |
log = LogManager.GetLogger("Main"); | |
#region Workaround for ConfuserEx | |
var richLogTarget = LogManager.Configuration.FindTargetByName<NLog.Windows.Forms.RichTextBoxTarget>("rich"); | |
richLogTarget.FormName = nlogviewer.Name; | |
richLogTarget.ControlName = nlogviewer.rtbNLog.Name; | |
#endregion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package require Ffidl | |
ffidl::typedef SYSTEMTIME uint16 uint16 uint16 uint16 uint16 uint16 uint16 uint16 | |
ffidl::callout SetLocalTime {pointer-var} int [::ffidl::symbol kernel32.dll SetLocalTime] | |
proc set_local_time {unixtime} { | |
set tcl_clock_fmts {%Y %m 0 %d %H %M %S 0} | |
set values [list] | |
foreach fmt $tcl_clock_fmts { | |
set v [clock format $unixtime -format $fmt] | |
lappend values [scan $v %d] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package require XOTcl | |
namespace import xotcl::* | |
proc log {msg} { | |
set ts [clock format [clock seconds] -format %T] | |
puts "\[$ts\] $msg" | |
} | |
Class Test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proc log {msg} { | |
set ts [clock format [clock seconds] -format %T] | |
puts "\[$ts\] $msg" | |
} | |
proc backtrace {} { | |
set frames [list] | |
for {set i 1} {$i < [info level]} {incr i} { | |
set frameinfo [info frame $i] | |
if {[dict exists $frameinfo cmd]} { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package require sqlite3 | |
proc cleanup {db} { | |
$db eval {VACUUM} | |
$db eval {REINDEX} | |
} | |
proc format_sql {sql} { | |
set sql [regsub -all -line -- {--.+$} $sql ""] | |
set sql [string map [list "\n" ""] $sql] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package require sqlite3 | |
proc format_sql {sql} { | |
set sql [regsub -all -line -- {--.+$} $sql ""] | |
set sql [string map [list "\n" ""] $sql] | |
set sql [string map [list "," ",\n"] $sql] | |
set sql [string map [list "(" "(\n"] $sql] | |
set sql [string map [list ")" "\n)"] $sql] | |
return $sql | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package require sqlite3 | |
proc format_sql {sql} { | |
set sql [regsub -all -line -- {--.+$} $sql ""] | |
set sql [string map [list "\n" ""] $sql] | |
set sql [string map [list "," ",\n"] $sql] | |
set sql [string map [list "(" "(\n"] $sql] | |
set sql [string map [list ")" "\n)"] $sql] | |
return $sql | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package require sqlite3 | |
proc format_sql {sql} { | |
set sql [regsub -all -line -- {--.+$} $sql ""] | |
set sql [string map [list "\n" ""] $sql] | |
set sql [string map [list "," ",\n"] $sql] | |
set sql [string map [list "(" "(\n"] $sql] | |
set sql [string map [list ")" "\n)"] $sql] | |
return $sql | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package require sqlite3 | |
proc format_sql {sql} { | |
set sql [regsub -all -line -- {--.+$} $sql ""] | |
set sql [string map [list "\n" ""] $sql] | |
set sql [string map [list "," ",\n"] $sql] | |
set sql [string map [list "(" "(\n"] $sql] | |
set sql [string map [list ")" "\n)"] $sql] | |
return $sql | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proc backtrace {} { | |
set frames [list] | |
for {set i 1} {$i < [info level]} {incr i} { | |
lappend frames [dict get [info frame $i] cmd] | |
} | |
return $frames | |
} |