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.
Mike takes to heart the adage that ideas are f***ing worthless without action.
Thursday, June 24, 2010
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.
--Translate01.py
Translate01_test.py:
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()
Saturday, July 25, 2009
getting back into it... day 2
I've downloaded and installed TortiseHg for Windows (I'm running XP on my netbook) and I've done my first few tests with it... it's pretty nice. I've used TortiseSVN in the past, so I kind of knew what to expect. I chose TortiseHg and Mercurial because it's the version control system that Python is going to use in the future, so that's good enough for me. I don't have the experience or time to get it, so I'm going with the crowd on this one for now.
I added some test cases, now my code doesn't pass. Here's the current version of the testing unit:
"""Unit test for translate01.py"""
import translate01
import unittest
class KnownValues(unittest.TestCase):
knownValues = ( ( '', ''),
( 'x','x'),
( '>','>'),
( '<','<') )
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()
Friday, July 24, 2009
Shaking off the cobwebs, getting back into it
I've got some programming ideas, inspired by previous efforts and the most recent lessons learned from Google Wave, I'm going to start a python project to handle translating source code (specifically pascal code) bidirectionally to object code and symbol tables.
My main programming exerience is in Borland's Delphi 5, which suceeded a number of years using Turbo Pascal 7.0 under DOS. So, these new languages like Python, etc al. are a bit odd to me, but I really like the power of the built in dictionaries, tuples, etc.
I'm using an old build of Active State python (2.5.1) which I'll be updating. I managed to write a few modules with very trivial amounts of code, cribbing heavily from "Dive into Python" by Mark Pilgrim.
Here it is... ALL of it...
Translate01.py:
"""Translates internal representation to and from xhtml"""
#define Exceptions
class HtmlError(Exception): pass
class invalidHtmlError(HtmlError): pass
def toHtml(x):
"""convert x to html string"""
return x
def fromHtml(x):
"""convert html string to internal representation"""
return x
Translate01_test.py:
"""Unit test for translate01.py"""
import translate01
import unittest
class KnownValues(unittest.TestCase):
knownValues = ( ( '', ''),
( 'x','x'))
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()
It actually runs.... and tests ok... (because it's trivial right now)
PythonWin 2.5.1 (r251:54863, May 1 2007, 17:47:05) [MSC v.1310 32 bit (Intel)] on win32.
Portions Copyright 1994-2006 Mark Hammond - see 'Help/About PythonWin' for further copyright information.
>>> ..
----------------------------------------------------------------------
Ran 2 tests in 0.000s
OK
So.... I'm on a journey... and I just took the very first step... a thousand miles to go. ;-)
Subscribe to:
Posts (Atom)
Blog Archive
About Me

- Mike Warot
- 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.