Archive for the ‘Programming’ Category

How I got started programming?

Tuesday, July 8th, 2008


How did you get started in programming?

I started programming when I was 8 or 9…. I started using computers from the Apple ][ & ][e’s that were at Sherman elementary with Apple Basic… After conquering that, I was able to start using a CP/M based system with Dual 8″ floppy’s, and started working on their version of basic…

About a year later, the Timex Sinclair ZX-80 was conquered… For fun, try to make a graphical version of monopoly on the Timex Sinclair… That has to fit within 16K, and runs off the cassette loader….

Other computers followed, but I did not started any serious projects until after switching to White Box PCs… And starting Matrix Technologies…. I started writing Bulletin Board Utilities, and eventually started helping maintain, and develop QuickBBS….

Sadly, due to a variety of issues… Most significantly my development box dying, work overload, and too much stress caused a re-evaluation of my QuickBBS development…


What languages have you used since you started programming?

This is tough. Apple Basic, QBasic, 68xxx Assembly, MS Pascal, Turbo Pascal (one of my favorites), C (Blah!), AppleScript, Python (my favorite). I have forgotten even more languages, including CBasic, QBasic, etc…


What languages do you plan to work on learning?

I keep planning on sitting down and working through Objective-C. But my dislike of C, and lack of free time keeps forcing me to back burner this….


What’s the most fun you’ve ever had programming?

I have had a lot of applications that I have enjoyed programming, even had fun with… The Indigo Security script has been a AppleScript pain, but has been fun in expanding my Applescripting experience…

The Software Licensing software kit that I worked on a few years back was a cross-platform Python bash! Involving ODBC, Windows specific code, Macintosh Specific code, Unicode, and ReportLab (PDF Library) riots… I learned a heck of a lot regarding Unicode, and while frustrating it was really satisfying…


If there is one thing you learned along the way that you would tell new developers, what would it be?

While being cynical, it is something to be aware of. Just because you write your new software package, does not necessarily mean you will be able to make a living off a shareware software package.

Keep programming because of the love of product, and don’t allow yourself to become a slave to a particular project. My 4 year daughter keeps reminding me that there is a world away from the computer. It’s important to be able to get up from the programming chair, stretch your legs, and step away for a few minutes…

Also Document your code! I can’t say this enough… Documenting is the most annoying but needed part of any project. I eventually started a format that I liked, and it has saved me so much time and energy.

Help yourself in the future by adding a sniplet of code in your documentation that demonstrates how to use the function / module / subroutine… While this isn’t immediately helpful, in 6 months, you’ll come back and there maybe a nagging question on how the routine passes data… And the example will be helpful…

- Benjamin


The idea for this post came from Toxic Software’s blog ( http://feeds.feedburner.com/~r/toxicsoftwarecom/~3/329523457/ )….

New Beta of Indigo Security Script (v1.65a)

Tuesday, July 1st, 2008

New Features include:

– Version History

– v1.65 - Added Speech Support

– - Added Speech support for Open Sensor, and Closed Sensor detection.

– - Added Ignore Flag (Alarm Matrix #6 Option)

– - Allows the owner to have the sensor in the list, but to ignore any input from the sensor.

– - Generally used if the sensor is sending out false positives (eg. High Winds, etc)

– - False equals Do Not Ignore. True equals Ignore.


– Speech Controls



property Speak_Alarms : false

property Sensor_Speech_Text : {”Sensor %s has Opened”, “Sensor %s has Closed.”, “Sensor %s Time Out”}

– %s is replaced with the Sensor Name.

property Speech_Voice : “Alex”



Please feel free to send any feedback regarding this to me….



- Benjamin


security sample v1_65A.scpt.zip

Indigo Security Script v1.50A

Wednesday, May 28th, 2008

This is the newest version of the Indigo Security Script…

This now includes code that will check for out of date heartbeats (ie. Defective Units, or low/out of Battery) and either warn via Growl, Indigo Log File, or even Email!

Some of these changes were suggested by Scott Buchanan… And some where added after examining the Battery Dead Notify script from the Perceptive Automation User Contributed Scripts web page.

version 1.5 Changes

- Added Heartbeat inactivity detection (5/28/2008)
- Growl Support for Heartbeat inactivity detection
- Email on Heartbeat inactivity
- Added optional switch (Update_Heartbeat_After_Actions) to allow heartbeat to be updated after every action.

Added the following variables:

- Inactivity_Heartbeat_Watchdog
- Update_Heartbeat_After_Actions
- SE_IBeat_Address
- Send_Email_on_Inactive_Heartbeat

The new properties are:

property Inactivity_Heartbeat_Watchdog : 7200
– The maximium number of seconds before a warning will start appearing for an alarm heartbeat. If you receive an inactivity warning, please check the batteries, and test the contacts. The Deafult is : 7200 seconds = 120 Min = 2 Hrs before a inactivity warning will start logging.

property Growl_Notifications_List : {”Opened”, “Closed”, “Check Alarm”} — List the Growl notifications that you wish to use

– Advanced Settings
property Send_Email_on_Inactive_Heartbeat : false
– Send an email if the security Heartbeats have not been detected within the Watchdog value.

property SE_IBeat_Address : {”example@example.com”, “example2@example.com”}
– Send Email(s) to the following addresses, seperated by a comma.

property Update_Heartbeat_After_Actions : false
– Update the heartbeat after every action. Normal behavior is to not update Heartbeats after an action occurs. This forces the heartbeat to update after every action of the device.

Please feel free to use the script, I have just tested the email functionality…. And I have been using this script for the last few days, without any issues…

security sample v1_50A.scpt.zip

Indigo & FrontRow

Tuesday, April 29th, 2008

Folks,I promised that I was working on this, and here is a screen capture of the proof of concept of Indigo working via FrontRow.

HomeStatus-Frontrow.jpg

What you are seeing right now, is just a display of the status of the devices in Indigo.I still have significantly more work to do on it, including figuring out the best way to handle the storage of the user / server credentials, and other issues…But, we are certainly closer than we were a few days ago.

Security Script for W800RF32 & Indigo

Wednesday, February 20th, 2008

Here’s the v1.00 revision of the Indigo Security Script sample.

The Changes included here are:

* Fixed bug in the Chime code that would not reset the Chime_Last_Sounded_ms value properly.
* Added the date back to the XXXXX_Last_update value.

- Benjamin

Security_Script-100.zip

Security Script for W800RF32 & Indigo

Sunday, February 17th, 2008

Here’s a revision of the Indigo security script sample, that adds GROWL support, X10 Chime support, and the data is stored in a array/matrix.

Please be Kind… This is the first major Applescript that I have done… So any suggestions on improving it, are welcome…

The key to customizing this script, is as follows:

1) Use_Growl, if true, Growl notifications will be broadcast for any Opened / Closed events. If False, no Growl notifications will be sent.

2) The X10 Chime support is activated on a Alarm by Alarm Basis… (See Alarm_Matrix)

3) The Chime can be set to only be activated on a OPEN status change
4) The Chime can be set to not activate until xx minutes have past since the last chime.
(For example, I trigger the chime by opening the door to take the trash out… I don’t
want the chime to go off again until 3 minutes later… That way when I come back in
the chime won’t go off… The Growl notifications & log entries are still created,
the chime just doesn’t go off..)

5) The Alarm’s to monitor are stored in a array…
The array stores the Alarm ID, the English name that you want to use in the
log & growl notifications (NO SPACES IN THE English name!). The Growl notification
flag for each sensor, the chime flag for each sensor, and the Indigo label for the chime module.

– 1 - Device ID
– 2 - English Name,
– 3 - Growl flag
– 4 - Chime flag
– 5 - Indigo Chime Device ID (Label)

Example:

property Alarm_Matrix : {¬
{9, “Test_Sensor”, true, true, “G01 = Remote Chime”}, ¬
}

- Benjamin

Here’s the code ZIPPED…new security sample 2.scpt.zip

And in plain text…

-- 153 is Kitchen Door
--  45 is Garage Door
-- 217 is Dinning Room
property Use_Growl : true
property Growl_Notifications_List : {"Opened", "Closed"}
property Growl_Enabled_Notifications : {"Opened"}

property Chime_Only_On_Open : true
property Chime_Min_delay : 3
-- 1 - Device ID
-- 2 - English Name,
--  3 - Growl Enabled
--  4 - Chime
--  5 - Chime Device ID (Label)

property Alarm_Matrix : {¬
	{9, "Test_Sensor", true, true, "G01 = Remote Chime"}, ¬
	{153, "Kitchen_Door", true, true, "G01 = Remote Chime"}, ¬
	{45, "Garage_Door", true, true, "G01 = Remote Chime"}, ¬
	{217, "Dining_Room", true, true, "G01 = Remote Chime"} ¬
		}

-- Send Growl Notification
on Send_to_Growl(door, action)
	tell application "GrowlHelperApp"
		-- Make a list of all the notification types
		-- that this script will ever send:
		set the allNotificationsList to Growl_Notifications_List
		set the enabledNotificationsList to Growl_Enabled_Notifications

		register as application ¬
			"Indigo Security" all notifications allNotificationsList ¬
			default notifications enabledNotificationsList ¬
			icon of application "Script Editor"

		notify with name ¬
			action title ¬
			door & " " & action description ¬
			door & " " & action application name "Indigo Security"
	end tell
end Send_to_Growl

using terms from application "IndigoServer"
	on Set_Variable(variable_name, variable_value)
		if not (variable (variable_name) exists) then
			make new variable with properties {name:variable_name, value:variable_value}
		else
			set value of (variable (variable_name)) to variable_value
		end if
	end Set_Variable
end using terms from

using terms from application "IndigoServer"
	on decode_security(eventType, device_ID)
		set door to ""
		set action to ""
		set alarm_detected to false
		set growling to false
		set chiming to false
		set chime_device to ""

		repeat with alarmdata in Alarm_Matrix
			if device_ID is item 1 in alarmdata then
				set door to item 2 in alarmdata
				if eventType is sec_SensorNormal_min then set action to "Closed"
				if eventType is sec_SensorAlert_min then set action to "Opened"
				set alarm_detected to true
				set growling to item 3 in alarmdata
				set chiming to item 4 in alarmdata
				set chime_device to item 5 in alarmdata
			end if
		end repeat
		return {door, action, alarm_detected, growling, chiming, chime_device}
	end decode_security
end using terms from

using terms from application "IndigoServer"
	on receive security event of eventType with code devID
		--		if eventType is sec_ArmHome_min then log "arm home (min)" using type "Security Sample"
		--		if eventType is sec_ArmHome_max then log "arm home (max)" using type "Security Sample"
		--		if eventType is sec_ArmAway_min then log "arm away (min)" using type "Security Sample"
		--		if eventType is sec_ArmAway_max then log "arm away (max)" using type "Security Sample"
		--		if eventType is sec_Disarm then log "disarm" using type "Security Sample"
		--		if eventType is sec_Panic then log "panic" using type "Security Sample"
		--		if eventType is sec_LightsOn then log "security lights on" using type "Security Sample"
		--		if eventType is sec_LightsOff then log "security lights off" using type "Security Sample"
		--		if eventType is sec_SensorNormal_min then log "sensor normal (min delay)" using type "Security Sample"
		--		if eventType is sec_SensorNormal_max then log "sensor normal (max delay)" using type "Security Sample"
		--		if eventType is sec_SensorAlert_min then log "sensor alert (min delay)" using type "Security Sample"
		--		if eventType is sec_SensorAlert_max then log "sensor alert (max delay)" using type "Security Sample"

		set alarm_detected to false

		set decoded_data to decode_security(eventType, devID)
		-- door, action, alarm_detected

		set chime_device to item 6 of decoded_data
		set chime_enabled to item 5 of decoded_data
		set growl_enabled to item 4 of decoded_data
		set alarm_detected to item 3 of decoded_data
		set action to item 2 of decoded_data
		set door to item 1 of decoded_data
		if alarm_detected is false then
			-- Unknown Security Device
			log "(device ID " & devID & ")" using type "Security Sample"
		else if alarm_detected is true then
			log (time string of (current date) as string) & " " & door & " " & action
			if action is "Opened" then beep

			-- Send Growl Notification
			if Use_Growl then
				if growl_enabled then Send_to_Growl(door, action)
			end if

			if chime_enabled then
				set last_chimed_ms to value of variable "Chime_Last_Sounded_ms"
				if (time of (current date) ≥ last_chimed_ms + (Chime_Min_delay * 60)) then
					if Chime_Only_On_Open is false then
						turn on chime_device for 1
						Set_Variable(("Chime_Last_Sounded_ms"), time of (current date) as string)
						Set_Variable(("Chime_Last_Sounded_ms"), time string of (current date) as string)

					else
						if action is "Opened" then
							Set_Variable(("Chime_Last_Sounded_ms"), time of (current date) as string)
							Set_Variable(("Chime_Last_Sounded"), time string of (current date) as string)
							turn on chime_device for 1
						end if
					end if
				end if
			end if

			Set_Variable((door & "_last_update"), time string of (current date) as string)
			Set_Variable((door & "_last_status") as string, action as string)

			--log value of variable "SoundChime" as string

		end if
		--log "(device ID " & devID & ")" using type "Security Sample"

	end receive security event
end using terms from

PyWebDAV 0.6

Sunday, September 17th, 2006

Here’s a Python based WebDAV server, that is written in python.
According to the Sourceforge page it is primarily aimed at *Nixes…
But I suspect that it can be used with some minor modifications on
Windows… Certainly I expect no modification for a MOSX based system.

PyWebDAV 0.6: “WebDAV server written in python”

(Via Cheese Shop recent updates.)

Gordon McMillian’s Installer is back, under new management…

Monday, August 21st, 2006

http://pyinstaller.hpcf.upr.edu/cgi-bin/trac.cgi

It is now called PyInstaller, and working towards a v1.2 release…

Python Cheese Shop : pyarticle 0.1

Monday, August 21st, 2006

Python Cheese Shop : pyarticle 0.1: ”

Pythonic way to article handling

Module for handling articles in CMS/blogs/etc: convert articles from various input formats to various publishing formats.

Author: Lukas Almad Linhart
Home Page: http://projects.almad.net/pyarticle
Download URL: http://projects.almad.net/pyarticle/wiki/Download
License: LGPL
Categories
Development Status :: 4 - Beta
Intended Audience :: Developers
License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)
Operating System :: OS Independent
Programming Language :: Python