Version 263 of JM

Updated 2019-07-26 04:10:56 by Jorge

Jorge Moreno

contact

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

My Books:

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

Effective Tcl/Tk Programming


Pages I started...


pages where I have made minor edits...


when programming with Tcl, I use:

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:



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

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

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

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 [email protected]
 .path insert 0 /home/jorge/sample.txt

 pack .from .path .button

gnuplot and the tkcanvas terminal type

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

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

XML Post HTTP

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?

 % 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

TreeQL Examples

1 wiki-reaper tbd
2 Web Scraping with htmlparse withatt type
3 https://github.com/jtcl-project/jtcl/blob/master/src/main/resources/tcl/pkg/tcllib/library/page/util_norm_peg.tcl over n

RS Script Catalog

Part 1

1 Visual TAL tal.tcl_002.png
2 string geometry string_geom.png
3 vgrep: a visual grep vgrepSS
4 A tiny Tcl server WikiDbImage tclserve.jpg
5 A pocket Wiki WikiDbImage pwiki.jpg
6 checkvar WikiDbImage checkvar.jpg
7 webchain WikiDbImage wubchain.png
8 Webdings animation WikiDbImage textanim.jpg
9 xlistbox WikiDbImage xlistbox.JPG
10 A graphical timetable WikiDbImage gratt.jpg
11 Yin-yang https://wiki.tcl-lang.org/_repo/wiki_images/yinyang.jpg
12 Linear regression toy WikiDbImage linreg.jpg
13 A little pie chart WikiDbImage piechart.jpg
14 Rolling credits WikiDbImage credits.jpg
15 A tiny notebook WikiDbImage notebook.jpg
16 Canvas dials WikiDbImage dial.jpg
17 Pocket Soccer WikiDbImage soccer.jpg
18 editRecord WikiDbImage editRecord.jpg
19 Disabling listbox items WikiDbImage disabledlistbox.jpg
20 Simple search and replace WikiDbImage searchrep.jpg
21 myPIE WikiDbImage mypie.jpg
22 Sepp WikiDbImage see_inline.jpg
23 strimj to XBM WikiDbImage strimjbuttons.jpg
24 encoview as eTcl plugin WikiDbImage encoview.jpg
25 IDE: from cathedral to patchwork bazaar http://www.itworld.com/shared/images/2003/3/Unicode_editor.gif
26 htext as eTcl plugin WikiDbImage htext_ppc.jpg
27 e: a tiny editor plugin for eTcl WikiDbImage e2.jpg
28 text line coloring WikiDbImage colorlines.jpg
29 Xmas tree WikiDbImage xmas.jpg
30 Shaded text on canvas WikiDbImage shadetext.jpg
31 Encoding table generator WikiDbImage iso8859-6.gif
32 Playing SHARK WikiDbImage shark.jpg
33 Canvas balloon help WikiDbImage cballoon.jpg
34 Authentication by formula WikiDbImage passform.jpg
35 Lotto WikiDbImage lotto.jpg
36 counterclock WikiDbImage counterclock.gif
37 A minimal starfield WikiDbImage stars.jpg
38 Iris animation WikiDbImage iris.jpg
39 Playing with matches WikiDbImage match.gif
40 The Montana, Utah &amp; Texas WikiDbImage mutex.jpg
41 Tacit programming http://www.cs.trinity.edu/About/The_Courses/cs2322/zippy.gif
42 Random name generator Random name generator screen.png
43 The house of Santa Claus WikiDbImage nikolaus.gif
44 A little bar chart WikiDbImage barchart.jpg
45 A little NNTP reader WikiDbImage nntp.jpg
46 A little RSS reaper https://wiki.tcl-lang.org/_repo/wiki_images/rss2html.jpg
47 RS's RSS WikiDbImage rssrss.jpg
48 Collapse (iPaq) WikiDbImage collapse.jpg
49 A tiny drawing program WikiDbImage tinydraw.jpg
50 An arc clock WikiDbImage arcclock.gif
51 A base-5 clock WikiDbImage berlinclock.gif
52 Cursor demo WikiDbImage cursors.jpg
53 Domino WikiDbImage domino.gif
54 Flashing light simulation WikiDbImage strobe.gif
55 LemonTree WikiDbImage LemonTree.gif
56 icoview WikiDbImage icoview.gif
57 A balance toy WikiDbImage balance.gif
58 Polygon clipping WikiDbImage polyclip.gif
59 Elevator simulation WikiDbImage elevator.gif
60 Animated cyclist WikiDbImage cyclist.gif
61 moon phase http://dire.straits.free.fr/vertigo/ScreenShot_Moon.jpg
62 Kaleidoscope WikiDbImage kal1.gif
63 A little reaction tester WikiDbImage reactest.gif
64 Binary image compression challenge WikiDbImage courier12.gif
65 Face control WikiDbImage facecontrol.gif
66 Toy car workshop WikiDbImage steamroller.gif
67 Toy cars WikiDbImage toycars.gif
68 Playing with circuits WikiDbImage circuit.gif
69 Small caps WikiDbImage smallcaps.png
70 Rainbow Tunnel WikiDbImage rainbow.png
71 timeliner WikiDbImage timeliner.jpg
72 Playing WIMP WikiDbImage mycon.jpg
73 Text widget elision WikiDbImage elide.jpg
74 Polygon intersection Polygon intersection screenshot
75 spiral WikiDbImage spiral.jpg

Part 2

1 A Dilbert reformatter WikiDbImage dil030720.jpg
2 a little code page browser WikiDbImage codepages.jpg
3 A little file searcher (iPaq) WikiDbImage tgrep_ce.jpg
4 A little file searcher WikiDbImage tgrep.jpg
5 A little fortune teller WikiDbImage tkfortune.jpg
6 A little login dialog WikiDbImage login.jpg
7 A little multiplication toy WikiDbImage multiply.jpg
8 A little value dialog WikiDbImage valuedialog.jpg
9 A little XML browser WikiDbImage xmltree.jpg
10 starDOM WikiDbImage stardom042.jpg
11 A Mini Database Manager http://www.eolas.net/tcl/mini-db-mgr.gif
12 A symmetric doodler WikiDbImage symdoodle.jpg
13 Traffic lights WikiDbImage traffic.jpg
14 Regular polygons WikiDbImage polygons.jpg
15 A toy piano WikiDbImage piano.jpg
16 TclMusic WikiDbImage tclmusic.jpg
17 An APL playstation WikiDbImage aplkbd.gif
18 Turtleshell WikiDbImage turtleshell.jpg
19 Canvas presentation graphics WikiDbImage present.jpg
20 Canvas rectangle marking Canvas rectangle marking screenshot png
21 Chess in Tcl WikiDbImage chess.jpg
22 Code 39 generation WikiDbImage test8252v.gif
23 Describing and rendering flags in Tcl http://www.purl.org/NET/akupries/noway/flags.gif
24 Playing 3D happy-3d-easter.png
25 Fun with functions WikiDbImage funplot.jpg
26 A little calculator http://www.eteamz.com/cmym/images/calculator.jpg
27 Graph theory in Tcl http://wfr.tcl.tk/fichiers/images/editeur_graphes.jpg
28 Median filtering WikiDbImage lrsubsample.gif
29 Horseracing in Tcl WikiDbImage horses.jpg
30 Car racing in Tcl WikiDbImage carracing.jpg
31 iDict: a multilingual dictionary WikiDbImage idict.jpg
32 iKnow: a pocket quiz WikiDbImage iKnow.jpg
33 iFile: a little file system browser WikiDbImage ifile01.jpg
34 Image scaling WikiDbImage ifilezoom.jpg
35 iFly WikiDbImage iFly.jpg
36 Palindromes WikiDbImage palindrome.jpg
37 TkSoroban WikiDbImage tksoroban.jpg
38 iMap: an indexed map viewer WikiDbImage imap.jpg
39 iRead: a Gutenberg eBook reader WikiDbImage iread.jpg
40 iShow WikiDbImage ishow.jpg
41 Model railroading with Tcl Model-railroading_loco
42 trains3.tcl WikiDbImage trains.jpg
43 Postcard from Switzerland WikiDbImage postcard.jpg
44 Notes on a canvas http://www.purl.org/NET/akupries/noway/note.gif
45 Photo image rotation WikiDbImage imgrot.jpg
46 A little image viewer WikiDbImage tbgview.jpg
47 PocketPC WikiDbImage ChessOnJornada.jpg
48 A little Ferris Wheel WikiDbImage tkferris.jpg
49 Visual menus WikiDbImage visualmenus.jpg
50 strimj - string image routines WikiDbImage strimj.jpg
51 Mongolian in Tcl strimjes WikiDbImage mongolian.jpg
52 Decision trees WikiDbImage dtree.gif
53 Playing with bits WikiDbImage bits.jpg
54 taiku goes multilingual WikiDbImage taiku.jpg
55 Tclworld http://www.eteamz.com/cmym/images/tclworld2.jpg
56 A little primes toy WikiDbImage primes.jpg
57 A funny cookbook WikiDbImage cookbook.jpg
58 The Q function WikiDbImage q.jpg
59 TkSnake WikiDbImage TkSnake.jpg
60 TkAlign4 WikiDbImage TkAlign4.jpg
61 Trees as nested lists http://www.florentmerlet.com/images/treeAsNestedList.gif
62 XML Graph to canvas WikiDbImage doteddemo.jpg
63 imEdit WikiDbImage triangle.jpg
64 iRule WikiDbImage imedit.jpg
65 Alphabet Wheel WikiDbImage alphabetwheel.jpg
66 The Gallows game WikiDbImage gallows.jpg
67 MasterMind 2 WikiDbImage mastermind.jpg
68 Memory 2 WikiDbImage memory.jpg
69 Over and Out WikiDbImage overandout.jpg