The Blog of Fourthbit

Explorations in Software

SchemeSpheres v0.2 Released

The project, aimed at providing schemers (the species of developer skilled in the art of Scheme) with an infrastructure to build multiplatform apps (Android/iOS/Win/OSX/Linux). Following the concept of “batteries included”, the project releases its 0.2 version, one step more towards the v1.0 release. The main changes in this release are:

  • Much easier installation of SchemeSpheres: download and run one single script.
  • A new program called spheres will take care of installing and uninstalling spheres for you. No more finding Spheres through Github!
  • Various fixes in core functionality, like FFI and Spheres importing.
  • Several fixes in Fabric, Energy, Fusion and String spheres.

Try it out if you want to start hacking right away. And stay tuned for updates! You’ll see pretty awesome stuff very soon, especially if you are into game development in Lisp / Scheme ;).

…continue

Essential CSS positioning

This isn’t 1999 any more. I don’t even remember designing with transparent tables (but I DO remember what a discovery for me this technique was). Yeah, positioning with transparent tables. It was even worse than CSS positioning. It was better to give this job to a WYSIWYG tool (but not many where able to do it properly). No wonder why Macromedia Flash took over the world back then. Not Adobe Flash, but Macromedia Flash. Version 3, to be more precise.

Nowadays nobody really thinks the future is Flash, as the war is probably already won by HTML5, along its pals CSS3 and Javascript. And, most importantly, nobody can expect using transparent tables and avoid summoning the CSS Gods to release their wrath upon the living. It also happens to make sense, technically. So CSS positioning be it.

That said, I think understanding CSS positioning is useful for any developer these days. Even if is just for avoiding the trial-and-error method of setting positions of HTML elements until I get one that works.

Let’s dive in.

…continue


Creating an open-source project in C with Autotools (Part 2 of 2)

In the previous post, I created a stub for a C program using Autotools. It didn’t have any functionality, so now I am going to implement it, exploring some of the aspects involved in the creation of a program like dfym. I will leave a few of them for future posts (such as profiling, testing and debugging), as they deserve proper attention on their own.

This post is not about this particular program, but rather about topics commonly encountered when creating a new program in C. Here, I’ll deal with program structure, argument processing, input, output, code formatting, documentation and packaging. These are topics that can be useful for many other programs, so I believe they can be found useful for different purposes.

…continue

Creating an open-source program in C with Autotools (part 1 of 2)

In this post I will start building a command-line utility in C, using some interesting tools and distributing my package properly. This is not a tutorial on Git, Autotools, C or GDB, but rather on using all the tools together to make an open-source project. This first part will focus on setting up the construction system with Autotools.

The program I’m going to develop is a command-line utility for tagging files systemwide. I’ll call it dfym (Don’t Forget Your Music). It will allow us to tag files or directories and find the files and directories matching a tag, as well as manage the database. It will use SQLite as a database (it won’t work at the filesystem level, as this is not an exercise on userspace filesystems). Actually, using a database will have its benefits as well as it drawbacks.

…continue

Using match and comprehensions in Scheme

One of the blogs on functional programming I like most is Matt Might’s. In my first post I want to comment on Higher-order list operations and port its code to R5RS Scheme thanks to SRFI-42 and Alex Shinn’s matching macro libraries. The original code is written for Haskell and Racket.

The first thing I’ll need to do is to import the libraries using my favourite Scheme implementation’s specific forms. This code requires a R5RS-compatible implementation, with syntax-rules macros. For this examples I’m using Gambit Scheme compiler, with the Scheme Spheres libraries. If I’d like to use Gambit without Scheme Spheres (or any Scheme implementation without R5RS hygienic macros), I’d need a syntax-rules expander, such as Psyntax (bundled with Gambit’s distribution, supports syntax-case), Alexpander (a fast, generic implementation) or the Blackhole module system. Scheme Spheres is using Alexpander. The two aforementioned modules are necessary, but fully R5RS-compatible, so importing them in any Scheme implementation should be straightforward.

…continue