Skip to content

Posts from the ‘Programming’ Category

21
Feb

Proguard on MacOSX

While executing proguard (via maven2) on MacOSX Snow Leopard, I’ve got the following error:

[proguard] Error: Can't read [/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/rt.jar] (No such file or directory)

That happens because the Java bundled with MacOSX doesn’t provide a standard library configuration, that is the rt.jar has been moved and renamed to classes.jar. To fix the issue simply symlink rt.jar to the corresponding classes.jar file:

localhost:~ root# cd /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/
localhost:lib root# ln -sf ../../Classes/classes.jar rt.jar

25
May

CyberzOrg::Event library: typesafe event handling in C++

The following article is date back to Thu Dec 14 22:12:44 CET 2006

Event is a little library built on top of boost::signal and boost::mpl that allows the user to declare in a simple way an object that can emit events and allow connection of (type-safe) callbacks as event handler to them. Usage is pretty straightforward, as shown in test/hello.cc:

#include <iostream>
#include "event.h"

enum { HELLO /* event type */ };

using namespace CyberzOrg::Event;

struct HelloEmitter
 : Emitter<
  Event<HELLO, void (const std::string &)>
 >
{ };

void callback(const std::string &s) {
 std::cout << "Event HELLO: " << s << std::endl;
}

int main() {
 HelloEmitter hello;

 // preferred syntax (useful if event emitter has the event table depending on itself,
 // in such case getSignal method is not directly visible).
 getSignal<HELLO>(hello).connect(callback); // connect signal handler (callback)
 getSignal<HELLO>(hello)("hello world"); // fire signal

 // easy syntax
 hello.getSignal<HELLO>().connect(callback); // connect signal handler (callback)
 hello.getSignal<HELLO>()("hello world"); // fire signal
}

You can look at sources or download a tarball. Any feedback is well accepted.

8
Dec

SVGPan: a Javascript SVG (Viewer) Pan/Zoom/Drag library

Some time ago the need for a browser-compatible vectorial language pushed me to consider the SVG markup language (I won’t say anything about Internet Explorer – it’s just unsupported there). The language itself is great, but, as a beginner, I was so disappointed about the fact that on the Internet I couldn’t find ANY library ready to use for panning and zooming features that I had to write one from scratch.

The SVGPan library features:

  1. Panning (pan à la Google maps) (click on the white background and pan)
  2. Zooming (using the mouse wheel)
  3. Element dragging (click on a drawing element and drag it somewhere else)
  4. Combinations of the above like zooming while dragging

The resulting javascript library is published here, in the hope that someone can find it useful. The library itself is very small and easy to use; and it’s licensed under the BSD license. You can try a demo here

 

No SVG support at all!

 

Read moreRead more

8
Mar

Solaris 10 si3124 backport (workaround for bug #6566207)

Do you think you can get a fast cheap SATA mass storage at home with Solaris 10 and ZFS just plugging a cheap si3124 controller?

Not so easily: on Solaris 10 you will be afflicted by some boring bug known as bug #6566207 which gets your controller stuck for around a minute after some heavy I/O.

Read moreRead more