Tag Archives: Joel Leclerc

Joel Leclerc: extract-xxx – An easy way of extracting XXX/TODO/FIXME’s

First: The “Why”. Well, it’s because when I write code, I usually don’t have the time (or the patience) to write everything perfectly, so I usually just write in a small TODO or FIXME for later. The issue is, when I do want to fix them (e.g. in the final polishing stage of development), it’s hard to find them (especially if you have many source files, and it takes some time to open any of them). Also, it’s because I wanted to learn perl, and I wanted to take a small break from my other project (which is taking up most of my free time).

The repository is here: https://github.com/MiJyn/extract-xxx. Download it however you want, then run extract-xxx.pl.

What it basically does is that it searches through a file for the “comment types” (which is just a name I assigned for things like “XXX” or “TODO”, since I don’t know that they’re really called), and then prints them with (by default), 2 lines of context, both before and after. It’s kind of like grep, but it’s a bit more specialized towards this task (though you could theoretically do everything this does by fancy utilization of grep, find, and nl).

Example usage:

$ ./extract-xxx.pl
./README.md

 48  | An incomplete list of limitations would be:
 49  | 
>50>>|  * It doesn't do any lexical parsing, so if you wrote `XXX:` in a string or something else (not a comment), it would still report it. Though it's also somewhat of a feature, as then it supports any language
>51>>|  * It requires a colon (`:`) after a comment type (i.e. you have to write `XXX:` instead of `XXX`)
 52  |  * The `-x` option just places whatever you put in a `m/.../` without any kind of processing. Therefore, don't expect things to go too well if you added some kind of weird scripting stuff (or a `/`).
 53  |

When run with no arguments, it will recursively go through the current directory (including sub-directories, and sub-sub-directories, etc…), and will then go through each file, as mentioned previously. As you can notice, lines 50 and 51 are highlighted (by >50>>), as they contain a “comment type” (in both cases, XXX), proceeded by a colon.

Instead of rewriting everything here, check out the repository, as the README explains pretty much everything you need to know about it.

Anyways, let me know what you think, any constructive criticism is appreciated

Source: FULL ARTICLE at Planet Ubuntu

Joel Leclerc: IT – A game/demo that takes 4D realism to the next level

For the past week or so, I’ve been working on a game, or rather, a demo, on using a highly immersive 4D environment (3 dimensions plus time). I know that many games have used synthesized 3D images on a 2D canvas, constantly being updated at a certain rate, synthesizing the fourth dimension in real life, in fact, this is the standard for most games. The realism in these games rely on the capabilities on the 3D artists and the designers to create imperfect environments that simulate this world.

When I started working on this game, I wanted to do something completely different, and take 4D realism to the next level. It sounds impossible with the current technology, but it actually isn’t. In fact, nearly every computer has the required capabilities of doing this! By using the interfaces that allows real life to interact with the core of the computer (and vice-versa) in creative ways, it is possible to reverse this, and create an application or game that interacts with real life, while still remaining as software.

Though it may sound hard, it is actually really simple! It doesn’t need any kind of direct hardware interaction, you can implement this easily with most major kernels! Since I currently use linux, this game only runs under linux (might run on FreeBSD, I have heard that they had some kind of support layer for linux… not sure though).

Since I wanted to release this demo as soon as possible, I didn’t do an amazing job at keeping the codebase clean, but once I have finished cleaning it up (or at least so that it will be somewhat readable), I will release it on github.

But I have created both i386 and AMD64 builds for this, available here:

EDIT: Some people have been complaining about the game being some kind of virus that tries to break a users system. I get where people are getting at (since it does interact with the OS and/or kernel, temporarily editing components to challenge the user to fix and/or interact with them), but anything it does is fully reversible, and the worst it can do is force you to reboot (though that should never happen, I don’t even know why it would happen, just giving the worst scenario I can think that this game could possibly do, or, for that matter, what any game could possibly do). If you have any problems, please let me know instead of posting hate-mail! Also, there is an options screen enabling you to select/deselect what it will do, so choose what you are comfortable with it doing (it works on an exclusive basis, so if there is somehow a bug, it will not run).

…read more
Source: FULL ARTICLE at Planet Ubuntu

Joel Leclerc: bfdk – A brainf*** development kit

Yes, I know, yet another compiler/interpreter for brainf***… we all know how many there are, we all know how easy it is to write, etc… First, you have to know, that was my 3rd application written in C, and I needed an exercise in C (compilers, interpreters, plugin systems, API design, etc…), so I decided to write this. So for the features:

  • Compiler (compiles to C, then runs GCC) and interpreter
  • Supports multiple dialects (pbrain, brainlove, ook!, and blub)
  • Source slimming (strips all comments)

I know, not very exciting. You’re probably wondering where “development kit” comes in. That’s for later, as I planned to write some sort of shell for it, which would complete it. For now, I think it’s stable enough for general usage.

The source is available here: https://github.com/MiJyn/bfdk. Since this written was before I switched to vim, it uses eclipse makefiles, so it would be simplest for you to compile using eclipse. If you can’t, you can always use make -f Debug/makefile.

Here are some examples of usage:
bfdk -f hello.bf — Will run hello.bf
bfdk -c -f hello.bf -o hello — Will compile hello.bf to hello
bfdk -s -f hello.bf — Will output a slimmed version of hello.bf (you can also specify an output file using -o)
bfdk -d brainlove -f test.bl — Will run test.bl using the brainlove dialect
bfdk — Will run a shell (currently just a simple EOF thingy)

As I said in the beginning, this is not a serious product, this was just an exercise for fun. If you can find it useful, awesome, if not, don’t blame me for writing a useless product.


Source: FULL ARTICLE at Planet Ubuntu

Joel Leclerc: shbuild – An alternative to GNU Make… using shell scripts

I’ve been trying to find a make alternative or interface using more common languages, and so far, the only one I’ve found was waf (which, IMHO, wasn’t well documented and overly complex). Maybe I haven’t done enough research, but seriously, why do people have to reinvent the wheel for just a build system?

I spent around two days writing this (haven’t wrote shell scripts for a while), and I’m pleased of the result. Notice that this script is still in alpha stage, so I can’t guarantee that everything will work as expected. The main difference between this build system and others is that it works by commands (functions), which then runs the compilers, linkers, and whatever else is needed. Because of this design, it should (in theory) be more powerful and easier to code than a normal makefile. Here is an example of what I’m saying (sorry about the horrible formatting, wordpress breaks it):

Buildfile:

build() {
sources='file1.c file2.c file3.c file4.c file5.c file6.c main.c'
objects='file1.o file2.o file3.o file4.o file5.o file6.o main.o'
output="main"
runtargets $sources $objects 'gcc -c $target -o $output'
gcc $objects -o $output
}
addcmd build build Builds the project
default_command=build

Makefile:

all: main
file1.o: file1.c
gcc -c file1.c -o file1.o
file2.o: file2.c
gcc -c file2.c -o file2.o
(repeat this for each of the targets...)
main: file1.o file2.o file3.o file4.o file5.o file6.o main.o
gcc file1.o file2.o file3.o file4.o file5.o file6.o main.o -o main

For me, the buildfile technique seems much cleaner and easier, and anyways, it’s shell, so you can call functions within it to make your life even easier, etc…

The other thing that I spent a bit of time on was to add common utility functions so you don’t have to write them yourself. Some of them include:

  • Automatic uninstaller
  • printc for printing text in colors
  • Many array utilities
  • Help system (still a WIP)

No documentation is currently available, since I’m still polishing it, but I will add some soon. In the meantime, you can just browse through the source (honestly, it will only take you a couple of minutes, it’s currently very small). You can also check the buildfile for it, as it contains many of the functions you would probably use.

Source is located here: https://github.com/MiJyn/shbuild. You can easily build and install the source by using the “build.sh” script (it’s simply a wrapper to use the unbuilt version of shbuild), like so:

sudo ./build.sh install

Let me know what you think, anything constructive (bug reports, ideas, patches, things that were unclear in this post, etc…) is appreciated :)


Source: FULL ARTICLE at Planet Ubuntu

Joel Leclerc: libsatcr – A 2D collision detection and response library

This month, I’ve been working on a top-down adventure horror game with a friend of mine, and one part that I got stuck on was the field of collision detection and response. Since it was an online game written in JS, I tried to use Box2DWeb for the task, but of course, it didn’t work out the way I wanted it to. I’m sure that my problems could have been resolved some way or another, but really, if my only purpose of using a physics engine is for the collision detection and response, why don’t I just take a collision detection and response library? After a bit of googling, I stumbled upon SAT.js. I’ve been really impressed with how minimalist, yet powerful it was. It did the job of collision detection and response without needing to rewrite the whole codebase. So while I was waiting for my friend to do the art, and since C was my favourite programming language, I wrote libsatcr, a port of SAT.js to C. TL;DR version of this paragraph: libsatcr is a port of SAT.js to C.

Since this is my first real library in any language, it has bound to have errors here and there, so please don’t expect it to be by any means perfect. I have not thoroughly tested the library either, I have only estimated that its outputs are correct, but I will do more extensive testing later.

Anyways, here is the link to the main website: http://mijyn.github.com/libsatcr/index.html, and the source: https://github.com/MiJyn/libsatcr.

I would really appreciate any kind of constructive criticism, even if it has to do with minor style changes, clarification, spelling/grammar errors, etc…


Source: Planet Ubuntu

Joel Leclerc: Some random wallpapers I made a while back

I haven’t made a post in a rather long time, but I have been busy on a few different projects (which I will release soon). For now, I would like share some wallpapers I made in GIMP about a year or two ago. I have released them under a couple different places, but they were mostly either segregated, private, or I forgot the link to it, so now I will finally publish them to a rather more central place :P

Anyways, here they are:

cool_glow_circle

Made using the “flame fractal”

cool_glow_flame_2 cool_glow_flame_3 cool_glow_flame_4 cool_glow_flame_prev cool_glow_hurricane

My personal favourite ^_^

My personal favourite ^_^

Thought this looked a bit like the fluid from The Matrix

Thought this looked a bit like the fluid from The Matrix

Had some fun with the motion blur :P

Had some fun with the motion blur :P

cool_spiral_blue cool_spiral
As you can see, some were variations on others, a few were made with the flame fractal, and most were made using “whirl and pinch” plus a lot of blend modes for layers.

Hope some of you may enjoy them :)


Source: Planet Ubuntu