&ot Journeys' End

Journeys' End

We walk many paths, many roads
Till death halts our steps.
Every day a new adventure,
A new journey of self discovery.

20080716

unoffical libfg repository

I have set up an unofficial git respository for libfg patches and new swig generated python interface, as Gavin Baker (the author) appears to be busy with other things. This is a maintance only repository as far as libfg goes - I don't plan on adding any more features (since all the ones I need are there already). I will however work to produce a more pythonic interface to libfg, as the swig generated interface is a straight port of C api into Python.

Currently the repository contains the following fixes and enhancements:

  • RGB565 and RGB555 patch by Adalbert Prokop
  • fg_new_compatible_frame patch by echoline
  • mmap fix by me
  • swig generated Python interface by me

If you have a patch against libfg, please post it at the libfg project's page first, and then to me if Gavin does not respond. I do not intend to take over development of libfg, and it is my hope Gavin will in the future make this obselete/redundant.

Cheers,
Steve

Labels: , , , , , ,

20080705

Another holiday, another webapp

Thats right, another webapp! This time using google's app engine, so feel free to abuse it, somewhat :P

Rank'em is its name, and it basically lets you create a collection of Things then allow other people to rank each Thing against each other, producing an overall ranking of Things.

Have fun and let me know what can be done better.

Cheers,
Steve

Labels: ,

20080618

Personification of Programming languages 2

An follow up on the last round of language personifications, this time contributed by brett.

PHP

The crazy party girl you meet at Uni; she's easy to get along with at the beginning; she reminds you of other girls you've known before and hey, its a bit of fun; you're only young once. But after knowing her a few months the cracks begin to show; she's pretty inconsistent and while she tries to do favours for you and help you out, she ends up making it more complicated than it needed to be. The whole time you're with her, you have this sneaking suspicion that maybe you'd be better off with Perl, even if she's harder to speak to.

Javascript

The late bloomer; in high school she was pretty dorky; she couldn't do very much and while she might have spent time in different social circles, she could never really fit in. But now the puppy fat has dropped away and she's revealed herself to be one hell of a girl. She can do things you never would have expected a few years ago and suddenly she's the life of the party, appearing in places you never would have expected and doing things that make your jaw drop.

bash

The fat chick you picked up at that party, only because you were drunk and horny. You'd never tell your friends about it, but it got the job done, so to speak.

QBasic

Your first girlfriend in highschool. You were so nervous you didn't even end up kissing.

Many thanks again to brett for sharing these with us :-D

Cheers, Steve

Labels: ,

20080428

{} I <3 thee

Firstly, I am the kind of guy who likes tabs over spaces, because I don't like forcing my particular preferences on to other people. To wax poetic, I like to give other people the freedom of choosing how they want their code indented. This of course brings me into the firing line of python programmers, for whom the 4-spaces-per-indentation-level is equivalent to the Ten Commandments handed down from Mount Sinai. Officially, python doesn't care, but thats like saying officially the Church accepts evolution.

I was editing a working python file written by some one else today, and wanted to convert it to tabs (yes yes, I know all about leaving files as I found them etc. Silence). So I ran unexpand -t 4 on the file. This simply replaces 4 spaces with one tab. This should have given me a working and correct python file though now indented with tabs. Naturally (Moore's law and all) this is not happened. The newly tab-indented file was riddled with errors because the original file was not indented properly so the simple conversion did not work. And as I go about fixing the errors python threw at me, I realised to my horror that information about the structure of the code was corrupted. Because python interprets code structure based on indentation, if your indentation is incorrect, your code is incorrect.

In comparison, a brace using language like C would have made the corrections trivial, because the braces explicitly specify the code structure. Python's argument that everyone indents anyway and thus braces are redundant is flawed - braces are not redundant because braces represent the separation of content from presentation, something that has been hammered into developers. In ignoring this, python has allowed a new class of errors - changing the appearance of code will now change the function of the code. I really can't see how this is a good thing.

If nothing else, python's integration of presentation and content, and thus presentation and program correctness makes it a far less robust language than brace using languages. Less robust in that a mangled python file is unrecoverable unless you actually read the code to figure out its structure, and that incorrectly transcribed python will likely run anyway with no syntactic or runtime errors.

Consider for example, the following code:

for n in names:
    foo(n)
    bar(n)

If you were transcribing the code and accidentally did not indent bar(n), the code now does something complete different yet no syntax or runtime error will be thrown. Now if the above code used braces, then it would have no effect. And if you forgot the brace, a syntax error will be thrown.

To be fair, python is a lovely language, and I do love it and use it extensively. Whitespace-as-syntax stance appeared at first to be a great idea, and one which now appears to be short sighted and naive. If nothing else, at least an interpreter which disallows incorrect space-indent files, that way tab->space and space->tab conversions would work correctly all the time.

Let me now put on my flame retardant undies, and you can flame away

Cheers,
Steve

Labels: , , , ,

20071231

html2pml

I was tired of converting all my HTML ebooks to rtf, then to pdb using Palm Doc Converter only to lose all the nice touches like bold, italics and headings. Since there didn't seem to be a HTML to PML converter for OS X, I wrote one to get more practice in python.

html2pml.py will convert basic HTML file to a PML file suitable for use with DropBook to be converted into a proper Palm ebook. I must stress the basic part - it only does stylistic conversions at the moment. I have no need for tables or links, so I didn't write them in. It does however do what I want - preserve bold and italic attributes, headings, and also translates some non-ascii characters into PML Extended Character Set, and to plain ascii where not possible.

This small python script is released under GPLv2, license is attached. If you find it useful, need more features, or have comments/suggestions, let me know!


Cheers,
Steve

Labels: , ,

20071213

Computing Oddities

Two strange and weird things happened to me recently. One is my /dev/null disappearing from leopard!

A large number of programs, both Cocoa and *nix relies on /dev/null being present. As you can see I could not gain root privileges, and thus could not recreate /dev/null (character device, 3,2). I had to in the end reboot and /dev/null was recreated.

Second strange thing is when I created a self-signed certificate for use with apache2 (for anonshare). I created it with openssl specifying 36500 for -days. The result is an certificate with expiration date in the past!

I am not aware of any X.509 specification regarding the number of days a certificate can be valid for, so I wonder - is this a bug in openssl?


Cheers,
Steve

Labels: ,

20071122

Personification of Programming languages

The following personifications of programming languages came about while I was discussing various languages with my friends. Basically we started off with a description or sentence about a language, and I personified. In spirit it is the OS-tans but for programming languages

C

"Very fast, good at a few things, sucks at everything else". An autistic girl who is very good at maths. You will also need to keep sharp objects away from her because she is happy to run with scissors, so to speak. Does exactly as you tell her, even if it means grievous harm to herself or others. Needs to be kept in a padded room to avoid hurting herself and others.

C++

"I don't want code in it, but I can't help but like it". A girl who is so pretty you can't help but like her. Unfortunately she is also bat-shit insane, and will scratch your eyes out.

Python

"Very flexible, does everything easily and without complaint, but slow as hell". A girl who is flexible and easy going. Can do complicated contortions easily, an absolute joy to be with. Only thing is she is a bit thick.

Java

"Overtly verbose, unnecessarily strict, but pretty fast". She is one of those girls who you need to constantly buy gifts for in order to keep her satisfied. She will also continually talk non-stop about a variety of things, most of them inane. However she is of average intelligence and comes with a lot of accessories by default.

ASM

"Its like C, only dumber". Well thats it really. ASM is C-like, but even more autistic and a bit more dangerous.

Perl

"Well, its perl". Ah, perl. Perl is a girl like python, except she doesn't speak your language, and you don't speak her language. Over time the two of you have worked out a pidgin language which is a mismush of sign language, latin, french, foot stomping, hip gyrations, eye rolling, tongue poking, and so forth. No one else knows what you and perl are saying, and sometimes you don't even know what each other is saying and can only make wild guesses.

Thats all I have for now, will update when I have more to write :-)


Cheers,
Steve

Labels: ,

20071104

Now you can all look and see how much I suck

Mactorii is now open sourced! GPLv2 for the curious. I haven't cleaned it up at all, which means be prepared to stab your eyes out with rusty fork after viewing the source. James told me not to bother, "cause then you will never release it". So blame James, its his fault/.


Cheers,
Steve

Labels:

20070809

JAPH

Not my work, I don't have that kind of perl-fu
not exp log srand xor s qq qx xor s x x length uc ord and print chr ord for qw q join use sub tied qx xor eval xor print qq q q xor int eval lc q m cos and print chr ord for qw y abs ne open tied hex exp ref y m xor scalar srand print qq q q xor int eval lc qq y sqrt cos and print chr ord for qw x printf each return local x y or print qq s s and eval q s undef or oct xor time xor ref print chr int ord lc foreach qw y hex alarm chdir kill exec return y s gt sin sort split

Cheers,
Steve

Labels:

20070716

Introducing SETerm

To learn a bit about using XCode, program in Objective-C using Cocoa and play with bluetooth and my phone, I wrote a simple bluetooth serial terminal. It simply connects to my phone (or any bluetooth device), opens a communication channel, and lets you send characters through it as if it is a serial connection. With my phone, this allows me to do pretty much everything that - list, read, send SMSs, contacts, check battery status, signal strength, etc.

Nifty! Here is a picture:

Download it, give it a whirl. I will one day update it to use Core Data so it handles SMSs and contacts in a nicer way then dumping out as text.


Cheers,
Steve

Labels:

20070414

Writing fitting functions for lmfit

lmfit expects fitting functions with prototypes in the form:

double function_name(double, double *);

For example:

double sin_fit(double t, double * p)
{
return p[0] + p[1] * sin ( 2 * M_PI * ( p[2] * t + p[3]));
}


Note that while lm_minimize takes a pointer to an array of parameters, it may not always pass that pointer to the fitting function. Because of this passing fixed parameters to the fitting function using the 3rd argument will yield incorrect results. For example, the following code is wrong:

double wrong_fit(double t, double *p)
{
return p[0]*p[0] + p[1];
}

....

double p[2];

p[0] = 1;
p[1] = magic_number;

...

lm_minimize(..., 1, p, ..., ..., ...., ...);

Here the fitting function wrong_fit relies on a fixed parameter p[1] which it expects to contain the value magic_number. However it will be passed such a p that only p[0] has a valid value and p[1] is undefined. This will lead to incorrect operation.

To work around this, you can use global variables, as follows:

double magic = magic_number;

...

double right_fit(double t, double * p)
{
return p[0]*p[0] + magic;
}

....

double p = 1;

...

lm_minimize(..., 1, &p, ..., ..., ..., ...);


Cheers,
Steve

Labels: ,

20040714

Downloads

Here is a summary of some stuff I wrote for one reason or another. Source is provided where I am not overly embrassed by the code :) Please submit bug reports etc by commenting on this entry :)
  • html2pml Converts simple html to pml Features
    • Works where python is available
    • Works pretty well :-)
    • Preserves bold and italic
    Download
  • lagrange polynomial solver Attempts to fit a lagrange polynomial through the give data points using the matrix solver library, which has also been updated to be cleaner and better. Features
    • Small
    • Works :D
    • Portable to almost everything under the Sun
    • Outputs in a format that can be easily pasted into mathpad or matlab for plotting
    Download
  • ictor An OISC interpreter written in C as a base for obfuscation excercise. Features
    • Small
    • Fast
    • Portable to almost everything under the Sun
    Download
  • arp-deny A quick program I wrote to make life easier when I need to do MAC based filtering on my wireless netbsd 1.6.2 router. It simply prints to stdout IP/MAC mapping in a format suitable for use with arp -f taking in to account allowed hosts etc. This was used in my efforts to create a wireless router using netbsd. Features
    • Command line based
    • Easily scriptable
    • Works!
    Download
  • reverse-vw Another basty hack I wrote one late night/early morning after ruxcon. Reverses austnet's vw about generation of possible hostnames from a given format string, then creates the vw string using austnet's hash function. When collisions are detected, the generated hostname is looked up via dns to make sure its not a false positive. It must be noted false positives are possible, even if the hostname resolves. Only works in *nix! You will need to modify source to compile under windows. Features
    • Command line based
    • Flexible format string
    • up to 8 numerical replacements
    • DNS lookup to reduce false positives
    Download
  • myroom[2] My first 2 game, simple break-out-of-room style puzzle. Features
    • Makes you hate me
    • Opengl accelerated
    • In game console
    • GlUT library for portability
    Download
  • mp3Organiser A Visual Basic program for oganising your (massive) mp3 collection :) Features
    • Sorts files into directories based on specified fields of ID3v1/2 tag
      • Sorts incrementally by artist/song/genre/album/etc, in any order
    • File renamer to rename songs based on ID3v1 tag information
      • File renamer supports format strings to create your own combination
    • ID3Tag removal utility to remove ID3Tags
      • Can be applied to entire directories
    • ID3Tag Editor with single and multiple file support
      • Can add id3v1 tags to files that doesn't have them
    • Very cool busy animation :)
    • Extensive online documentation included
    Download
  • n30n A visualisation I wrote for a friend's band. Started off as a particle engine, then had motion blurr, scripting, and sound recording added to it. Can you say feature creep? :P Features
    • Opengl accelerated
    • Scripting support
    • Motion blurr
    • Induces motion sickness in some ;)
    Download
  • matrix solver Update 7/5/2005 - solves for parametric matrices. Update 4/5/2005 - proper detection of the nature of solutions, code clean up, as well as fixing the infinite loop that occurs for certain matrices. A simple program I wrote after learning about matrixes. It performs Guassian elimination on a given matrix, then uses what I considered a very elegant loop to perform back subtitution to solve the system of equations where a solution exists. Features
    • Command line based
    • Detects unique, parametric solutions, as well as no solutions
    • Prints unique and parametric solutions
    • Works! :)
    • Will print out working
    • Small
    Download
  • img2text A basty hack I wrote one late night/early morning after seeing a image represented by letters of different colors in html. It could use more work, using an index system with CSS for example to drastically reduce the size of the produced HTML. W3C compliant html would be nice too :) Only works with tga images! Features
    • Command line based
    • (Auto)scaling
    Download

Labels: , ,