Of ‘the wiki’
Dear Internet,
The term ‘wiki’ does not imply Wikipedia, nor even MediaWiki. Cut it out.
Dear Internet,
The term ‘wiki’ does not imply Wikipedia, nor even MediaWiki. Cut it out.
Over the last few months I’ve been gradually migrating my data from Mozilla based applications. The move did not start out targeting Mozilla, however I realised that I’ve becoming increasingly unhappy with Firefox and Thunderbird.
I’ve settled upon Chromium as my browser for the time being. Firefox has been showing a steadily increasing tendency to lag when using javascript heavy pages, or when opening a significant number of tabs. As I tend to scan a few forums through breadth-first tab exploration, this is obviously a significant issue. Chromium has a few differences I’ve not become accustomed to, such as newly opened tabs appearing adjacent to their parent instead of at hard-right. However it has been performing reliably for me since day one.
For my email client I’ve decided to move back to claws. While claws does not have the swiftly updating UI of Thunderbird, it will always do precisely what I tell it, and nothing I don’t expect it to. It has proven supremely reliable. There have been a few too many occasions where Thunderbird 3 has decided to repeatedly cache my large IMAP accounts, or sit in the background consuming 100% CPU after it has supposedly closed.
The key message here I suspect, is that your software should behave in a manner the user expects. I don’t have any issue waiting for software when it appears it has good reason to be processing information. However when your application kicks off some ‘intelligent’ background processing it had better not damn well get in the way of useful work.
I’ve been dusting off my GEGL and BABL source trees to see if I can’t get them into shape for some hacking in the near future. After a day of dicking about with environment variables, debuggers, and other paraphernalia I seem to have arrived at a useful set of instructions for future reference. This setup will contain a checkout of both GEGL and BABL, which are self contained and do not intrude on existing installed versions.
It’s exceedingly frustrating to debug errors where either library bring in code from your host system, so always ensure that each step executes error free.
First off we set up the base environment: a common area for code is created, we checkout both projects, and setup a cautious CFLAGS for debugging.
DEV_PREFIX=$HOME/projects
mkdir $DEV_PREFIX
git clone git://git.gnome.org/babl
git clone git://git.gnome.org/gegl
CFLAGS="-O0 -g"
We quickly build BABL. Ensure that all the checks pass at completion.
cd $DEV_PREFIX/babl
./autogen.sh
make
make check
GEGL is the next target. We must tell it explicitly where libbabl is located, how to utilise it, and where its extensions are found respectively. It is critical that all variables are defined.
BABL_LIBS=$DEV_PREFIX/babl/babl/.libs/libbabl-0.1.so.0.100.1
BABL_CFLAGS=-I$DEV_PREFIX/babl/
BABL_PATH=$DEV_PREFIX/babl/extensions/.libs/
Due to a bizarre issue with the nVidia supplied libGL, we may need to force load it before other modules. It appears to dynamically alter references to malloc within BABL as it gets loaded by GEGL extensions. This breaks BABL’s memory sanity checks. It’s a nasty hack, and you may not need this, but I certainly did.
LD_PRELOAD=/usr/lib/libGL.so
Building GEGL is the easiest part. Once again, make sure you’re not encountering any errors in the test suite.
cd $DEV_PREFIX/gegl
./autogen.sh
make
make check
Hopefully you have a working version of GEGL and BABL at this point. Congratulations! The final test is to see if the gegl application works successfully. To allow us to play freely with this application on the command line we need to define where GEGL and BABL libraries are located, where GEGL operations are located, and we may as well add in some nice debugging variables too.
LD_LIBRARY_PATH=$DEV_PREFIX/babl/babl/.libs:$DEV_PREFIX/gegl/gegl/.libs
GEGL_PATH=$DEV_PREFIX/gegl/operations
G_DEBUG=fatal-warnings
GEGL_DEBUG_TIME=yes
GEGL_SWAP=RAM
To run the final test:
bin/gegl
Remember: all the above environment variables must be defined every time you want to work with GEGL. I suggest creating a simple script to export them for you each time. If anyone encounters an error in the above, please let me know!
Over the last year I’ve picked up something of an interest in photography. It’s a decent excuse to get outside and see my surrounds, while simultaneously allowing me to indulge in geekery behind the scenes. This post is dedicated to the latter.
While talking with a few people both on- and off-line, I’ve discovered a pet peeve relating to digital processing. Almost all people who mention image resolution have a bizarre misconception that any given image file has a specific corresponding physical resolution. Eg, “You should save foo.tif as 300 DPI”. This seems to stem from a confusion, or lack of distinction, between physical and abstract image representations.
When we work with digital photographs, we are working with a collection of coloured dots, or pixels. These are arranged in a grid of some width and height. The total number of pixels is referred to as the image’s resolution or size. A digital image consists primarily of this pixel grid, and some associated notes from your camera or image editor. Of particular note: these pixels have no physical size.
A person, software, or printer using the image must associate some size to each dot before a set of physical dimensions can be calculated. It is equally valid to say that each pixel is 1nm square, or 1km square, or both. Doing so does not in any way change the appearance of your image, only its scale.
Typically, a pixel size that is advantageous to conceptually work with may be placed in a note alongside the image with help from your favourite image editor (I’m looking angrily at you Photoshop). This allows convenient use of physical measurements when editing, but it may be changed immediately, and losslessly, by changing this note – Ie. changing your idea of what size a pixel is.
I’ve recently been getting back into a small amount of recreational coding, some of which has been web development oriented. Hopefully this shall become fruitful over the next month. In the course of these adventures I’ve been testing some web scraping software built using the wonderful hpricot and mechanize libraries.
To avoid infuriating web server owners I’ve adapted some webrick example code to create a simple static web server. Point it at a directory, give it a port, and you can use it to serve a dumped mirror of a site. Or whatever your fancy is. Code follows:
#!/usr/bin/env ruby18
require 'webrick'
include WEBrick
DEFAULT_PORT = 8000
DEFAULT_DIR = Dir::pwd
def print_usage
puts <<EOF
#{$0} docroot [port]
EOF
end
if ARGV.count < 1
print_usage()
exit(-1)
end
s = HTTPServer.new(
:BindAddress => 'localhost',
:Port => ARGV[1] ? ARGV[1] : DEFAULT_PORT,
:DocumentRoot => ARGV[0] ? ARGV[0] : DEFAULT_DIR
)
trap("INT"){ s.shutdown }
s.start
exit(0)
After pounding away with a whole lot of LaTeX recently for a variety of university related documents I gave in to my natural urges to complicate things somewhat. As a lot of my work tends to focus around acronym and initialism usage, I decided to fancy up how they were input and displayed in my documents with a simple self-contained macro.
This macro will display an abbreviation, in full form followed by the abbreviated form, the first time it occurs in a document. The remaining occurrences will be replaced with the abbreviated form. This way you don’t have to keep track of the first occurrence or worry about moving text around. Plus, it’s simple to use.
Add the following code to the front portion of your document:
%%
% Define a command for a given term. This will create a command which gives
% the long name, with a parenthesised acronym, on the first call.
% Additionally it will redefine itself to call the acronym function instead
% on subsequent executions.
%
% Takes:
% 1, command name
% 2, long name
% 3, acronym
\newcommand{\acroterm}[3]{%
\expandafter\newcommand\expandafter{\csname #1\endcsname}{%
\emph{#2} (#3)%
\expandafter\renewcommand\expandafter{\csname #1\endcsname}{%
#3%
}%
}%
}
After which, you can define terms by using:
\acroterm{dbi}{Dynamic Binary Instrumentation}{DBI}
And then use the terms in your document thusly:
User instrumentation is inserted through the Pin \dbi\ framework.
The macro works by dynamically defining a macro, which when called will output the initial version of the text. It then overwrites itself with another macro which then simply outputs the abbreviated form. The liberal uses of comments were to prevent newlines from being introduced into the macro IIRC, however it has been a little while since I wrote it.
Future enhancements could include adding code which negates the need for the trailing backslash when requiring a proceeding space. I know there’s a way, I just need to ask my mate for the technique again…
After at least year and a half over at the good ship Slicehost I’ve decided to scale back on my hosting services. This isn’t a reflection on their service, product, or any deficiency whatsoever; in fact I can’t recommend these guys enough if you’re in the market for a cheap VPS. However the amount of time and energy I was putting in maintenance and setup of the various services I was hosting there started outweighing the benefits I was receiving. If you’re interested in how to run a server then the exercise is an enjoyable and educating one which I would highly recommend, as I’ve gotten an immense amount out of it.
So as I say a reluctant goodbye to the lads at Slicehost, I’m gradually getting services up and running on a shiny new account at Dreamhost. These guys appear to have support for almost everything I was already using: ssh, httpd, git, smtp/imap, jabberd, and a touch of rails. And there is the positive aspect that I no longer have to worry too much about keeping a system up to date and secure, not to mention a reduction in required moolah. Time will tell if this was a good choice, but I have fairly minimal demands these days so I have high hopes.
For now, the most pressing issue is to wait until the various DNS entries propagate around the internet…