Thursday, May 21, 2009

Something for a web editor!

ok, i finished Fable: The Lost Chapters last night as a goody-two shoes with a halo round his head and ghostly butterflies who tossed Jack of Blades' mask away. and i have a mild headache. since i finished it (finally!), it's off my computer. maybe until i get bored again. but that's not what this post is about.

i have recently developed a strange condition called a 'conscience'. meaning i currently kick against the order of the day here in Nigeria, where pirated software and software license violations abound. for the most part, anyway. somehow, the old "i can't afford it" line seems old and worn to me (even though it's basically true for me anyway — some weeks back i was ranting about how some stock photography @ 100USD+ would cripple me financially). at least for now — maybe this time i won't be able to suppress my conscience again.

being an on/off software developer, i agree wholeheartedly that software developers should receive something for their efforts. and that's why i praise open source developers. the time and devotion needed to complete any software project is appalling. to continue development when you're not getting paid for it is praiseworthy. so i moved toward using freely available software (mostly open-source) for most of my work, including web development. unfortunately, since i'm getting older (and hopefully wiser), i lean more toward RAD ways and means, including WYSIWYG. since i'm not currently using Dreamweaver, and my web development tools of choice are of an 'edit source then preview' variety, i miss the design view of Dreamweaver. i've literally forsaken a project because i've no interest in hand-editing XHTML. so if anyone can recommend a non-sucky design-view-type freely available web editor, i'd be glad. i might even give something for it. definitely not my kingdom though. it may be small, but it's still quite valuable. well then, later.

Tuesday, May 19, 2009

First 'useful' Python script

here's my first 'useful' Python script. it converts a Crosswire SWORD IMP file to the XML needed by OpenSong scripture files. if this is useful to you, please let me know. and please use, don't abuse. you can download it here. full source code available below, and you'll obviously need Python to use it. Want to try it out? Grab a SWORD module (raw ZIP only, please!, convert it to IMP by following these instructions as far as creating an IMP file is concerned, then use my script.

# imp2opensong - converts a SWORD IMP file to an OpenSong XML file
# author: lewzscruz
# date: 18-May-2009
# license: public domain, i guess. use, don't abuse
# version: 0.2 ('cause i only tested with one source file!)

def strip_markup(line):
    '''Strips ALL markup from a line'''
    temp = line

    while True:
        # get first opening angle bracket
        open_angle_pos = temp.find('<')

        # quit if there's none
        if open_angle_pos == -1:
            return temp

        # get first closing angle bracket
        close_angle_pos = temp.find('>', open_angle_pos)

        # strip out the markup
        temp = temp[:open_angle_pos] + temp[close_angle_pos + 1:]

# prompt for input and output files
sourcefile = open(raw_input('Where is the input file? '))
destfile = open(raw_input('Where should I put the output file? '), 'w')

# start writing
destfile.write('<?xml version="1.0" encoding="utf-8"?>\n')

old_book = current_book = ''
old_chapter = current_chapter = ''
verse = ''

while True:
    # read lines till EOF
    line = sourcefile.readline()
    if line == '':

    # trim the newline
    line = line[:-1]

    # don't do empty lines,
    # empty verses will be handled below
    if line == '':

    # and 'useless' lines
    if line.startswith('$$$['):

    # if we have a 'control' line
    if line.startswith('$$$'):
        # get the colon's location in the line...
        colon_pos = line.rfind(':')

        # ...and that of the space between the book name and the
        # chapter and verse
        lastspace_pos = line.rfind(' ')

        # we know what book we're in...
        current_book = line[3:lastspace_pos]

        # ...the chapter...
        current_chapter = line[lastspace_pos + 1:colon_pos]

        # ...and the verse!
        verse = line[colon_pos + 1:]

        # if we changed books on this line,
        if old_book != current_book:
            # and we didn't just start,
            if old_book != '':
                # close the old chapter and book

            # start a fresh book
            old_book = current_book
            old_chapter = current_chapter = ''
            destfile.write('<b n="%s">\n' % (current_book,))

        # if we changed chapters,
        if old_chapter != current_chapter:
            # and it's not the beginning of a book,
            if old_chapter != '':
                # close previous chapter

            # start a fresh chapter
            old_chapter = current_chapter
            destfile.write('<c n="%s">\n' % (current_chapter,))

        # output real verses (there are fake ones in the source file),
        # including empty ones
        if verse != '0':
            # get the next line and strip the newline
            nextline = sourcefile.readline()[:-1]
            # output it, stripping any markup and whitespace
            destfile.write('<v n="%s">%s</v>\n' % (verse, strip_markup(nextline).strip()))

# finally, close the last chapter of Revelation,
# Revelation itself, and the Bible

# thanks for all the fish!

Thursday, May 14, 2009

I want my mommy…

…or so i'd like to say. But i can't. It's been over 5 years since my mom passed on. And since i'm not comfortable with the idea of talking with the departed, i'll just rant.

Mom should have been 50 today. My dad was telling me last night that if she was still here, he'd have organized a suprise party for her (she didn't like people making a fuss about her :)

ever since that day in January 5 years ago, we've done what we could to get along without her. And been rather successful at it. But sometimes, we crack. Like last night, when Dad's voice broke for a few seconds leading prayers. Or when i'm feeling particularly cut off from humanity. Or Dad's saying something crazy & i'm looking for someone to tell, "please come & take your husband!" (happens quite often actually XD). Anyhow, i'm about done here. We miss Mom. And we're grateful for the time we had with her.

Sunday, May 10, 2009

I hate software license agreements

today's rant started rather simply. i'd set my Facebook language to Pirates (English)— rather fun by the way, info courtesy Dade — and wanted to show some notifications I'd gotten via Twitter. I wanted something a little more than (Alt-)Print Screen, and could do some basic editing in it. I've used Techsmith's software offerings before, and they have a free lightweight screencap utility called Jing, and i decided to use that. then the fun began. i decided to actually read the license agreement for Jing, and by the time i got to the third paragraph i was tired of reading, for a couple of reasons:

  1. the agreement is especially verbose. not a big surprise there. just one more reason for me to hate lawyers and the law in general. developers like to adhere to the KISS principle. why can't lawyers — at least when dealing with unlearned mortals?
  2. the agreement looked like one gigantic wall of text (can you say gibberish?). call me lazy or stupid, but i finally agree: san-serif typefaces are much better for reading long blocks of text. the serifs just tend to drive you crazy. whenever i author on this blog, everything looks like a Matrix screen, so i tend to just concentrate on the part i'm just typing. sometimes i don't even pick up typos and whatnot because it's just plain hard to read (you get brownie points if you guess that the text is in a serif typeface, extra if you know that it's in a monospaced serif typeface. monospace has come to stay, but i'm beginning to think that monospace+serif = very bad idea.

i still don't know if the license asks me to murder my mother. and quite frankly, i really don't care. must it be so difficult to get software to use? even freeware? if i'm a measure of most people, license agreements are far too wordy and verbose to be of much interest/use to the people it affects the most. and i've no doubt in my mind that that is exactly what the lawyers want. did i mention i hate lawyers already? are you trying to help people or set traps for them, for crying out loud? i eventually installed Jing — without completing the license agreement — only to find that my internet was insane again and would not resolve Jing's mothership, the website. and since it's a new install, Jing didn't work. after uninstalling Jing and googling, i found Bug Shooting, another free screen capture software that has a smaller installer and a more readable license agreement. yes, it appears to lack a feature that Jing has and i'm used to — auto-capturing a window (you have to manually select the window area yourself), but i think that's not such a big problem if i can actually use the software, and it doesn't get in my way. Disclaimer: Jing is actually quite good. i've used it a bit, but i recommend you getting the not-free, but better-featured (and in my opinion, much better-behaved) Snagit if you can afford it. it probably worth the cash you'd fork out for it. i once got a free licence, but i wasn't in the mood for hunting it down where i'd backed it up.

anyhoo, here are screenshots of the respective license agreements for Jing and Bug Shooter. decide for yourself which one's easier to read (screenshots taken with Bug Shooting. and i still had to launch the GIMP to make the edits i wanted. picture i wanted to upload is here).


Bug Shooting

EDIT: double-clicking the Bug Shooting icon in the taskbar takes a screenshot of the currently focused window

Friday, May 08, 2009

Building Bridges

I have my own little world, Surrounded by my toys and my dreams, I'm often occupied, Tinkering away, In my little bit of earth. One day I spied someone, Curiosity ate at me, I wanted to meet them, But they were in their own world. I had blocks you know, Toys I treasured, So many of them, But my growing wonder At the sight of another Could not be denied. I got to the edge of my world I leaned and stretched as far as I could Yet my arms and legs fell short. I wanted to weep, run away and give up, saying I had tried. Then a thought came to me "Build a bridge" "What with?" "Your valued toys" I fought the idea "What? Give up my toys?" "Start while they're still there" So I dropped one block, not sure it would stay. To my surprise, it hung in the air, and never did sway. I built a little bit more, then gingerly stepped, to see if it would hold, I i decided to step on it. Once again wonder filled me As my toys did hold my weight And I let go of my land. Since then I've built some more bridges, Some I've completed, and seen other worlds, Some never reached the other world, Since my desire turned cold. It was a day like any other, I was tinkering again, Somewhat older, hardened, much colder Concealing my pain. But you looked like the sun that parted the dark clouds, I felt a stirring, like a coming to life, and somehow some warmth flickered in this cold heart again. So I wanted to meet you, But my toys would not do. For as far as they could go, I'd already built. All I had left were my dreams, very precious and few, If I were to use them, then what would I do? But love pushed me forward, In tears did I build, For it counted you worthy To walk over my hopes. At last I have finished, This bridge of my heart, The causeway is narrow, But it plays its part. I hope to welcome you To my world, and live in yours But as I escort you, Yeats will inspire my lips and my only desire: "HAD I the heavens embroidered cloths, Enwrought with golden and silver light, The blue and the dim and the dark cloths Of night and light and the half light, I would spread the cloths under your feet: But I, being poor, have only my dreams; I have spread my dreams under your feet; Tread softly because you tread on my dreams."