Programmer Mike

Mike takes to heart the adage that ideas are f***ing worthless without action.

Monday, June 28, 2010

Fighting the demons

I've been sick... my temperature got up to 101.8 degrees F at one point.... so I've been out of it.  I'm finding it fun to get back into programming, but the bitgrid project is making me realize quite a few things about myself. It takes a few minutes to add a new feature, but the hardest part is starting.... there are many temptations and diversions, as always.  Those are the biggest obstacles, at least in this project.

I'm using Delphi 5... something old and comfortable. I'm writing quick and dirty code, and making use of Mercurial source control to allow me to experiment freely. It's quite liberating. I've got no real inertia to overcome at this point except that which I provide myself.  It's this type of project that provides the best opportunity for introspection, and I intent to use it.

This hobby project will help in many other places.

Thursday, June 24, 2010

Using Google code for the first time

I've created a Google Code project - bitgrid-sim to support my BitGrid idea by providing a simulator for people to wrap their heads around.  It's really basic, but it gets the job done.

I was able to figure out how to get TortoiseHg on my windows boxen to sync with each other, and I've even managed to get everything pushed to the BitGrid-sim mercurial repository at Google.

It is SO nice having a safety net to catch me if I really screw things up. This is making programming fun again!

Pascal based operating system?

I found a google code project which is intended to create an operating system in the Pascal programming language.... it should be possible to leverage it to make a VERY small virtual appliance for VMware, and my CABsec ideas as well.

If I get time, I'll look into it more.

Saturday, April 24, 2010

An eye opening experience at APCU

I owe a special debt today to Conrad Weisert, who showed me the full potential of object oriented programming in C++ today. His use of the object oriented paradigm to handle many of the corner cases ahead of time when dealing with quantities such as money, time, and even electrical units really impressed me.

He's written a book about the subject, which I intend to purchase. I'm even willing to look past the Case Sensitivity of C++ now that I've been enlightened.

Friday, April 09, 2010

Dusting off the cobwebs

I've managed to dust off some of the cobwebs, and get this laptop and my desktop at work to sync using TortoiseHg, which is a Windows GUI for Mercurial. Getting used to a distributed source control system wasn't too bad, especially because I'm the only programmer so far.

I've pulled the code for my capabilities demo across, and have been tweaking it a bit. The demo itself is rather basic, so it needs a lot of work to be a useful teaching tool. The key take away is that a capability in cabsec speak is just a key.

I also looked into Delphi 2010, and have no way of justifying the $1000 price at this point in time, especially since it's not functionally better than Lazarus/FreePascal for me at this time. I was loading JPEGs into an image, and found it still uses the same lame methods as Delphi 5.


Tuesday, July 28, 2009

getting back into it... day 4

I installed PyScripter (written in Delphi) and my productivity went way up now that I have a good debugger. I've now passed my unit tests for the first time. I feel I'm now on my way to becomming a python programmer, slowly but surely.

Installed same tools on my work machine, and did my first sync. I expected the contents on the C:\wave folder of obsolete to be updated... but that's not how a distributed system works... you then tell it to sync the changes on that machine to the tip... which prevents a ton of headaches... a much saner way to go.

I edited the ignore options on Tiny, now we don't care about the .pyc files.

I've deliberately made a bad edit and commit and reverted it... works well!

I'm feeling pretty good about this.

Monday, July 27, 2009

getting back into it... day 3

Today I decided I needed a debugger... since I'm not really up on the syntax of python (lists look like tuples look like arrays to me)... I was really lost... it took about an hour to digging around to decide on PyScripter to be my IDE. I don't want to get tied into a product I can't afford, so I took a pass on Komodo from ActiveState.

I've managed to finally deduce what I was doing wrong, and pass one of my trivial unit tests... the code now looks like this:



--Translate01.py
"""Translates internal representation to and from xhtml"""

#define Exceptions

class HtmlError(Exception): pass
class invalidHtmlError(HtmlError): pass

#Define escape mapping
htmlCharMap = [('>', ">"),
('<', "<")]


def toHtml(x):
"""convert x to html string"""
return x

def fromHtml(s):
"""convert html string to internal representation"""

result = ''
index = 0
while index < len(s):
foundat = -1
i = 0
for ascii,html in htmlCharMap:
if (foundat < 0) & (s[index:index+len(html)] == html):
foundat = i
i += 1
if foundat >= 0:
ascii, html = htmlCharMap[foundat]
result += ascii
index += len(html)
else:
result += s[index]
index += 1
return result

Translate01_test.py:
"""Unit test for translate01.py"""

import translate01
import unittest

class KnownValues(unittest.TestCase):
knownValues = ( ( '', ''),
( 'x','x'),
( '>','>'),
( '<','<'),
( 'this is a test','this is a test') )

def testToHtmlKnownValues(self):
"""ToHtml should give known results with known input"""
for s1,s2 in self.knownValues:
result = translate01.toHtml(s1)
self.assertEqual(s2,result)

def testFromHtmlKnownValues(self):
"""FromHtml should give known results with known input"""
for s1,s2 in self.knownValues:
result = translate01.fromHtml(s2)
self.assertEqual(s1,result)


if __name__ == "__main__":
unittest.main()

About Me

My photo
Munster, Indiana, United States
I fix things, I take pictures, I write, and marvel at the joy of life. I'm trying to leave the world in better condition than when I found it.