Blog

Driving libzip with CFFI

Published , updated

NOTE: This post is a little dated, as it does not make use of features in newer releases.

There is a huge number of C libraries that provide functionality that would be very useful in an application. One way to access this functionality from Tcl is to write a binding using Tcl's C API. This requires fairly detailed knowledge of both C as well as Tcl's API. An alternative is to use a Foreign Function Interface extension for Tcl such as cffi or Ffidl.

(read more)

Using TLS connections from Tcl

Published

The use of the Transport Layer Security (TLS, formerly known as SSL) is becoming increasingly prevalent to secure network communication, particularly with the browser and search companies pushing web sites to move to HTTPS instead of HTTP. This post discusses the options for using TLS over Tcl sockets and specifically some important potential pitfalls to keep in mind with respect to certificate validation. The discussion is limited to client-side operation.

(read more ...)

Push files to your mobile using Tcl

Published

In my previous post, I described how to connect to Bluetooth devices from Tcl. That however only went as far as discovering devices and establishing network connections and left unanswered the question of what you do next once a connection is established. This post, and succeeding ones, will build on that by showing how you can transfer files, contact information etc. to Bluetooth devices from Windows using the OBEX protocol.

(read more ...)

Tracking device changes with Tcl

Published

Windows can send notifications to applications advising them of changes in device configuration. The most common manifestation of this is file managers popping up a window showing the contents of a USB pen drive when it is plugged in and automatically closing it when the drive is ejected. This post describes how to hook into these notifications within a Tcl application.

(read more ...)

Using async/await to parallelize sequential code

Published

The latest post in our series on promises introduced the async and await commands. That post focused on how these commands further simplify asynchronous programming with promises. This post takes a different angle on their utility - how they can be used to speed up sequential code with minimal effort.

(read more)

Parsing via metaprogramming

Published , updated

This blog post is adapted from my book The Tcl Programming Language.

What is metaprogramming? Roughly speaking, metaprogramming involves writing a program that in turn writes a program to do the desired task. In some cases metaprogramming makes for simpler or more succinct code while in others it optimizes performance by generating specialized code at runtime. Tcl lends itself naturally to this style of programming. This article illustrates one such use.

(read more)

Cryptography on Windows Part 4 - Symmetric cryptography I

Published , updated

In a prior post, I described the use of Windows CryptoAPI to compute message digests and message authentication codes which ensure integrity of messages. We now move on to the use of symmetric algorithms in cryptography, which can be used for both message confidentiality and integrity. Asymmetric algorithms will be covered in future posts. Refer to the introductory post in this series for the difference between the two.

(read more)