Updated 2018-10-05 15:59:07 by Jorge

Jorge Moreno

contact  edit

jorge raul moreno -at- hot mail -dot- com

I heard that every android has a wish: to be ticklish...
This Android never suffered Pteronophobia (the fear of being tickled by feathers!)

Great Tutorials  edit

My Books: edit

TitleAuthor
Effective Tcl/Tk Programming Brent Welch
Practical Programming in Tcl and Tk Mark Harrison/Michael McLennan
Tcl/Tk for Real Programmers Clif Flynt


Pages I started... edit


pages where I have made minor edits... edit


when programming with Tcl, I use: edit

for XML parsing

web scrapping

  • tool that helps: firefox add-on that shows tdom structure (DOM Inspector)
  • tool that shows http protocol (HttpFox)
  • LemonTree branch

diagrams

WebServer

Static content

driving other windows application

Most used:


Bookmarks: edit



2013-12-07 A few of your favorite things about editing scripts with Tkcon
2014-06-25 Hack-O-Matic
2014-08-09 filewait
2014-08-22 Quick Formatting ANSI Colour Escape Strings
2014-08-22 cgrep - Color your output with regular expressions!
2014-10-03 WikIndent input line by line
2015-01-13 Heronian triangles sqlite
2015-03-13 Freecell for a cross platform alternative to SystemButtonFace color
2015-03-13 Invoking browsers to launch firefox under linux
2015-10-15 vgrep: a visual grep
2016-11-17 serial ports on Windows
Matthias Hoffmann

Detlef Groth

wdb

2017-03-17 minimalist wget
2017-07-05 getopt to parse out switches from the command line (argv) by name
2017-07-11 LiSA
SWIG exemples http://wfr.tcl.tk/1693
Scan and modify text files http://wiki.tcl.tk/15518
Easy Text Print (includes awk) http://wiki.tcl.tk/42409
'xpg' - a text file browser (includes awk) http://wiki.tcl.tk/38443 awk and shell script
DatePagetags
2017-12-20Get CPU Temperature Statisticssqlite
2017-12-28w3mautomate web browser with Expect

6/7/2018 Web HTML http

My formatting guide edit

Italics: My quick reference
Bold: My formatting guide
puts "Tcl is great!"

 puts "did I mention that Tcl is great?"
puts "Tcl/Tk"

Links:
For Formatting Rules click here or here


[graffiti]

tclODBC + tclhttpd  edit

JM 22 Jul 2011 - I was just playing a little bit with tclhttpd by putting the following code on the file: \htdocs\cgi-bin\test.cgi
 package require tclodbc
 set driver "Microsoft Access Driver (*.mdb)"
 set dbfile "C:\\Program Files\\Microsoft Office\\office11\\samples\\Northwind.mdb"

 puts [html::h3 "getting info from Access through tclODBC..."]
 puts "<table border=1 cellpadding=4>"
 database connect db "DRIVER=$driver;DBQ=$dbfile"

 foreach rec [db "select EmployeeID,LastName,FirstName FROM Employees;"] {
   puts "<tr>"
   foreach field $rec {
     puts "<td>$field</td>"
   }
     puts "</tr>"
 }
 puts "</table>"
 db disconnect

just after the following existing lines:
 puts [html::h1 "Hello, World!"]
 puts [html::h2 [clock format [clock seconds]]]

and I got a dynamic page that queries the database that comes as a sample with the Microsoft Access installation.

you can get there by means of the CGI link on the home page, then through the Sample form posted to test.cgi and finally hitting the "Submit Query" button.

pscp  edit

JM 7 Sep 2013 - pscp from the putty family of tools, see also plink

  • The following script runs on a windows machine
  • Getting a file from an ubuntu machine
  • The file will be copied to c:\putty in this case
 console show
 proc action {} {
   cd c:/putty
   set f [open "|\"pscp.exe\" -l jorge -pw yourpwd [.from get]:[.path get] ."]
   puts done
 }
 entry .from
 entry .path -width 50
 button .button -text get -command action

 .from insert 0 jorge@192.168.1.82
 .path insert 0 /home/jorge/sample.txt

 pack .from .path .button

gnuplot and the tkcanvas terminal type  edit

JM 26 Oct 2013 - I dont know why, but I had to put some puts commands after the source command to make it work, if not, I was getting an error saying that the gnuplot commmand did not exist
 console show
 #set gpexe C:/gnuplot-4.0/bin/pgnuplot.exe
 set gpexe "C:/Program Files (x86)/gnuplot/bin/pgnuplot.exe"
 #set outfile C:/data/resultat.tk
 set outfile "C:/Users/jmoreno/Documents/code/gnuplot/resultat.tk"

 set gp [open "|\"$gpexe\"" r+]
 puts $gp "set term tk"
 puts $gp "set output '$outfile'"
 puts $gp "set noborder\nset zeroaxis"
 puts $gp "set xtics 1\nset ytics .5"
 puts $gp "plot \[-2:2\] atan(x)"
 close $gp

 pack [canvas .c]
 source $outfile
 puts $outfile
 puts [info commands gnu*]
 update
 gnuplot .c

JM 7 Nov 2014 - Looks like the real fix is this (just waiting a little, to let pgnuplot.exe to completely close):
 console show
 #set gpexe C:/gnuplot-4.0/bin/pgnuplot.exe
 set gpexe "C:/Program Files (x86)/gnuplot/bin/pgnuplot.exe"
 #set outfile C:/data/resultat.tk
 set outfile "C:/Users/jmoreno/Documents/code/gnuplot/resultat.tk"

 set gp [open "|\"$gpexe\"" r+]
 puts $gp "set term tk"
 puts $gp "set output '$outfile'"
 puts $gp "set noborder\nset zeroaxis"
 puts $gp "set xtics 1\nset ytics .5"
 puts $gp "plot \[-2:2\] atan(x)"
 close $gp
 after 1000
 pack [canvas .c]
 source $outfile
 #puts "we are at: [pwd]"
 #puts $outfile
 #puts [info commands gnu*]
 #update
 gnuplot .c

Expect  edit

JM 18 Feb 2014 - The following example was good for me to try the basics
Remote input-output with Expect

XML Post HTTP  edit

JM 26 Feb 2017 - from:
https://groups.google.com/forum/#!topic/comp.lang.tcl/B6afDJQg8LA
 package require http
 console show

 set organism_name "nipah"
 set xml "
 <?xml version=\"1.0\" encoding=\"UTF-8\"?>
 <orgPdbQuery>
 <version>B0905</version>
 <queryType>org.pdb.query.simple.OrganismQuery</queryType>
 <description>Organism Search : Organism Name=$organism_name </description>
 <organismName>$organism_name</organismName>
 </orgPdbQuery>
 "
 set url "http://www.rcsb.org/pdb/rest/search"

 set tok [::http::geturl $url -query $xml -type application/x-www-form-urlencoded]
 set rep [::http::data $tok]
 puts "[::http::status $tok]"
 puts $rep

 ::http::cleanup $tok

Where is tablelist?  edit

 % package require tablelist
 5.13
 % package ifneeded tablelist 5.13
 package provide tablelist 5.13;source -encoding utf-8 C:/Tcl/lib/teapot/package/tcl/teapot/tcl8/8.0/tablelist-5.13.tm
 %

                                                       C:\Tcl\lib\teapot\package\tcl\lib\tablelist_common5.13