Monday, January 11, 2010

Unloading DLLs in Python through CTYPES

How can I unload a DLL using ctypes in Python? - Stack Overflow discusses the issues related to unloading a DLL which has been loaded using ctypes in Python

Sunday, January 10, 2010

SCC - Trac

Streaming component combinators framework (a Haskell library) is a collection of streaming components and component combinators. As described on the website "The components operate on data streams, usually producing output before all input is known. "

This looks like an interesting library to explore in future.

Certified Programming with Dependent Types

Certified Programming with Dependent Types

This is the web site for an in-progress textbook about practical engineering with the Coq proof assistant. The focus is on building programs with proofs of correctness, using dependent types and scripted proof automation.

Saturday, January 9, 2010

Writer - Windows Live

Writer - Windows Live

Writer makes it easy to share your photos and videos on almost any blog service—Windows Live, Wordpress, Blogger, LiveJournal, TypePad, and many more.

It also has an Insert code plugin which helps you quickly format source code examples in your blog posts.

GLFW - An OpenGL library

GLFW - An OpenGL library: "GLFW is a free, Open Source, multi-platform library for creating OpenGL contexts and managing input, including keyboard, mouse, joystick and time. It is intended to be simple to integrate into existing applications and does not lay claim to the main loop."

A Techie Tech Writer Blog � Single-sourcing Training Exercises with Sphinx

A Techie Tech Writer Blog � Single-sourcing Training Exercises with Sphinx shows a nice example of how to use Sphinx to generate training exercises from Python source files.

Thursday, January 7, 2010

Tooltips in dijit.layout.TabContainer

Some time back I started using dijit.layout.TabContainer from DOJO Toolkit in my user interface. Soon a particular requirement came where I needed to attach tooltips to the tab headings in the tab container. In the following I outline the issues I faced and solutions I figured out for the same.

DOJO toolkit comes with a widget dijit.Tooltip which can be used to easily associate rich tooltips with any element in the page. It requires the "id" of the element with which the tooltip will be associated. After some experiments with Firebug, I figured out that when a dijit.layout.TabContainer is parsed, specific ids are assigned for the titles of content panes inside it. These ids look like:
  • dijit_layout__TabButton_0
  • dijit_layout__TabButton_1
  • dijit_layout__TabButton_2
  • and so on...
Depending upon your page structure and number of tab containers in the page, these ids would vary.

I first tried to add a declarative tooltip like as follows.

But as luck would have it, it didn't work. I guess the reason is the fact that the ids are assigned at runtime during parsing and probably when the tooltip was processed, the corresponding connect ids were not yet assigned. So I had to figure out an alternative solution.

dojo.addOnLoad(function(){setTimeout(function(){addTooltips();}, 1000);});

function addTooltips()
var tooltip = new dijit.Tooltip({
connectId: ["dijit_layout__TabButton_0"],
label : 'Hello World'

What this achieved was following:
  • Call a function 1 second after the page has been loaded. By this time, the ids for different titles for tabs inside the tab container are expected to be associated.
  • Create the tooltips at run time based on the generated ids.

This approach worked. May be there is a better way of doing this, but this works for me now :)