Tcl and the Tk Toolkit
Author: John K. Osterhout
Reviewer: Phil Hughes
Tcl and Tk are receiving a lot of press. They offer a quick way to develop X applications or add a graphical front-end to existing code (see Linux Journal #8). Plus John Osterhout, the author of Tcl, is now working for Sun—and Sun is talking about turning Tcl into a serious product. In this book, Osterhout offers an introduction and overview of Tcl and Tk to get you started and continues on to the serious stuff.
The first part of the book following the introduction covers the Tcl language itself—chapters include syntax, variables, expressions, lists, flow of control, procedures, string manipulation, file access, processes and error handling—and ends with chapters on tcl internals and the history mechanism.
Next, the book covers the Tk toolkit for writing X-Windows applications. Again, there are a lot of chapters covering widgets, geometry managers, bindings, focus, window managers, communications between applications and invocation of procedures by real-world events. The final chapters discuss configuration, assorted commands and concepts that don't fit elsewhere and also give two applications examples.
The end of the book covers working with Tcl and C, and working with Tk and C. The Tcl chapters first tell you why you may want to combine Tcl with C and then explain how the interface works and how to develop code using it. There are a liberal number of examples. The Tk and C chapters thoroughly cover the nitty-gritty of the Tk/X interface. If you are not familiar with X-Windows programming, this looks a little scary, but it isn't the fault of Tcl/Tk.
The book ends with an appendix that points you at ftp sites where you can get software and a brief description of how to get it running. There are 450 pages of information contained in the book.
I am not a Tcl/Tk programmer and got the book to start from scratch. When I first looked at the book it reminded me a lot of The C Programming Language written by Kernighan and Ritchie (K&R), who also wrote the C language. Osterhout's book, like K&R's, begins with an overview and then continues by showing the reader all the details. A “hello world” program is used early on as a programming example and this illustrates that both Tcl and C are relatively simple languages. Also of note, is that Brian Kernighan is Addison-Wesley's consulting editor for a series of books.
I remember reading K&R, writing some C code, being a little frustrated, going back, learning more and eventually learning C. When I was learning C (1980) K&R was the only book out there. Today, even though there are hundreds of books on C, I still use K&R for reference and don't look in other C texts for information.
I have played a little with Tcl/Tk using this book and have felt more than a little frustrated. After looking over the book again, my conclusion is that it covers the language in detail as a tutorial, but it is not a good reference book. In the case of C, I use SSC's C Library Reference (a pocket-sized guide that I wrote) as a quick reference. Then I use K&R for additional reference, if needed, because it offers information in an easy-to-find format.
Osterhout's book isn't going to be the book you use when you are writing code and need to look something up. I see it as one of the tools you utilize to get started with Tcl/Tk, but a second, smaller book or pocket guide is necessary to help you with the nuts and bolts as you actually do development. Is it worth buying? Yes. But life will be easier when a reference exists that will complement this book.
Phil Hughes is the publisher of Linux Journal.
Practical Task Scheduling Deployment
July 20, 2016 12:00 pm CDT
One of the best things about the UNIX environment (aside from being stable and efficient) is the vast array of software tools available to help you do your job. Traditionally, a UNIX tool does only one thing, but does that one thing very well. For example, grep is very easy to use and can search vast amounts of data quickly. The find tool can find a particular file or files based on all kinds of criteria. It's pretty easy to string these tools together to build even more powerful tools, such as a tool that finds all of the .log files in the /home directory and searches each one for a particular entry. This erector-set mentality allows UNIX system administrators to seem to always have the right tool for the job.
Cron traditionally has been considered another such a tool for job scheduling, but is it enough? This webinar considers that very question. The first part builds on a previous Geek Guide, Beyond Cron, and briefly describes how to know when it might be time to consider upgrading your job scheduling infrastructure. The second part presents an actual planning and implementation framework.
Join Linux Journal's Mike Diehl and Pat Cameron of Help Systems.
Free to Linux Journal readers.Register Now!
- SUSE LLC's SUSE Manager
- My +1 Sword of Productivity
- Managing Linux Using Puppet
- Non-Linux FOSS: Caffeine!
- Murat Yener and Onur Dundar's Expert Android Studio (Wrox)
- Doing for User Space What We Did for Kernel Space
- SuperTuxKart 0.9.2 Released
- Google's SwiftShader Released
- Parsing an RSS News Feed with a Bash Script
- SourceClear Open
With all the industry talk about the benefits of Linux on Power and all the performance advantages offered by its open architecture, you may be considering a move in that direction. If you are thinking about analytics, big data and cloud computing, you would be right to evaluate Power. The idea of using commodity x86 hardware and replacing it every three years is an outdated cost model. It doesn’t consider the total cost of ownership, and it doesn’t consider the advantage of real processing power, high-availability and multithreading like a demon.
This ebook takes a look at some of the practical applications of the Linux on Power platform and ways you might bring all the performance power of this open architecture to bear for your organization. There are no smoke and mirrors here—just hard, cold, empirical evidence provided by independent sources. I also consider some innovative ways Linux on Power will be used in the future.Get the Guide