&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: , , , , , ,

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: , ,

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: , ,