Tuesday, March 09, 2010

Custom Quartz Composer Patches: How to include a shared library

I have been struggling a little bit to make my "DataMatrixDecoder" patch load libdmtx as a shared library.

Actually it is pretty simple:
instead of the @executable_path, the install name needs to contain @loader_path.

Here some tools that can help you to make things work and check that things worked out the intended way (credits go to Mac OS X Hacking Tools):
1) install_name_tool to change recorded install names of a mach-o-binary.

2) lipo: to check if the universal binary magic worked out e.g.:
orion:Release wimpi$ lipo -detailed_info QuartzDM.plugin/Contents/MacOS/QuartzDM 
Fat header in: QuartzDM.plugin/Contents/MacOS/QuartzDM
fat_magic 0xcafebabe
nfat_arch 3
architecture x86_64
    cputype CPU_TYPE_X86_64
    cpusubtype CPU_SUBTYPE_X86_64_ALL
    offset 4096
    size 18872
    align 2^12 (4096)
architecture i386
    cputype CPU_TYPE_I386
    cpusubtype CPU_SUBTYPE_I386_ALL
    offset 24576
    size 21460
    align 2^12 (4096)
architecture ppc7400
    cputype CPU_TYPE_POWERPC
    cpusubtype CPU_SUBTYPE_POWERPC_7400
    offset 49152
    size 21956
    align 2^12 (4096)
3) otool to check and display info about the mach-o-binary like it's dependencies. e.g.
orion:Release wimpi$ otool -L QuartzDM.plugin/Contents/MacOS/QuartzDM 
QuartzDM.plugin/Contents/MacOS/QuartzDM:
 /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 15.0.0)
 /System/Library/Frameworks/Quartz.framework/Versions/A/Quartz (compatibility version 1.0.0, current version 1.0.0)
 @loader_path/libdmtx.dylib (compatibility version 1.0.0, current version 1.0.0)
 /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 123.0.0)
 /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 227.0.0)
 /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 550.0.0)
 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 38.0.0)
 /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 751.0.0)

Monday, March 08, 2010

DataMatrix in Quartz Composer

A while ago I was working on a project proposal for a digitally supported library. The idea was not only to provide digitalized content and metadata, but also to link the physical items (books, tapes etc.) with the digital catalog.

For the link between the physical items and their digital entries, I proposed to tag the items with DataMatrix Codes (2D Barcodes, see DataMatrix@Wikipedia) that store a computer readable unique reference.

Given that the proposal for the terminals was to use iMacs, I put together a piece of software that would allow to grab the barcodes directly from the built-in webcam.

To make it versatile, I developed a simple Quartz Composer Plugin that provides a "DataMatrixDecoder" patch, based on libdmtx.

The result in a simple composition (above), with the viewer (below); the patch is marked with a red dashed oval:


It is versatile, because these compositions can - for example - be embedded into Cocoa applications :


Unfortunately the proposal never turned into a project, but if anybody is interested, don't hesitate to contact me.

Edit 09/03/10:
I have packaged a binary distribution under a Creative Commons Non-Commercial License, which can be downloaded here (RapidShare). Enjoy.

Tuesday, February 23, 2010

It's time to move on....

Things constantly change. Go outside, open your eyes. Open your mind and try to capture that every single instant, every single moment that passes is unique and will never return or repeat as is.

Instead of embracing it, and live in the present, we live and cling to the illusion of the permanent. Often, we put all our imagination and our personal power into this clinging. We find the perfect argumentation for it and when somebody comes along to state otherwise, we know how to unmake their arguments, because being expressed they are always automatically subjective (and need to be proven otherwise first to become objective).

The real freedom of our life is to make choices. These decisions are like the branching points of our way through life. As hard as it sometimes may be, we need to make these choices and go along from the point where we branched, until the next. It's a one way trip on a one way road. If we realize we took a wrong turn, there is no point in returning, there is only a point in making a new decision, taking a new direction and to carry on.

The reward is experience. It's about learning new things, about us and what we are and what we could be.

This is what we should take from it, instead of loading it with doubts and culprit. Nobody is perfect, we all make mistakes and it's up to us to learn and not repeat them.

Following the way of the heart, becoming more conscious about ourselves and what we are, and why we are, is not about being selfish, it's about trying one's best to make an individual contribution to a higher consciousness, within the boundaries of the free will, the principle that gives us all our freedom of choice.

Today is one of these days, when a choice needs to be made. And flail I do not.
I hope that you may all find your way, learn and experience what you need.
I'll try to do my best as well on the way I'll take and I thank you very much for all the things we have shared along the piece of the way we happily shared.

Farewell :)