Sunday, July 18, 2010

setting up iburst driver for ubuntu 8-10 intrepid ibex

http://blog.hostinghabitat.com/2009/02/iburst-usb-modem-installation-tutorial.html

ibdriver (iburst driver) for ubuntu 10.04

Driver for 2.6.28 kernel

Patch from 2.6.28 to 2.6.31:
option 1
option 2

Saturday, July 17, 2010

yapyfin.py Python Yahoo Finance Client

Yahoo Finance exposes a large amount of historical US equity data via their html api. The python code below downloads the open-high-low-close-adjclose-volume data for British Petroleum (BP) = stock ticker symbol BP, between 1900/01/01 and 2010/07/18, to text file BP.csv

import httplib
httplib.HTTPConnection.debuglevel = 1
import urllib

def enc_quote(ticker, fromY, fromM, fromD, toY, toM, toD):

quote = dict()

quote['s'] = ticker
quote['a'] = fromM
quote['b'] = fromD
quote['c'] = fromY
quote['d'] = toD
quote['e'] = toM
quote['f'] = toY
quote['g'] = "d"

return urllib.urlencode(quote)

url_stem = 'http://ichart.yahoo.com/table.csv?'
quote_tokens = enc_quote('BP', '1900', '01', '01', '2010', '07', '18')
url = url_stem + "&ignore=.csv" + quote_tokens

f = urllib.urlopen(url)
body = f.read()
f.close()

try:
f = open('BP.csv', 'w')
f.write(body)
f.close()
except Exception, err:
print('ERROR: %s\n' % str(err))

Thursday, July 15, 2010

PyMSSql - import _mssql - ImportError: DLL load failed: The specific module could not be found

under windows xp pro,
When attempting to import pymssql.py,
I experienced the following error:


"
import _mssql
ImportError: DLL load failed: The specific module could not be found
"

So this is all a bit cryptic, but after googling, which suggested using a windows diagnostic tool [ProcessMonitor] to locate the failing process, it turns out that what is missing is an (accessible) copy of 'mscvr71.dll', which can be downloaded off the net, and should be copied to 'c:\windows\system32\', or 'c:\windows\system\' if running 64bit windows.

you then need to run 'regsvr32 msvcr71.dll' from the command line, in the directory that you copied the dll to.

cant find entrypoint

if you get a 'cant find entrypoint' type error message, its actually still all ok, pymssql should run just fine by that point.

Tuesday, July 13, 2010

Sunday, July 11, 2010

Python Client Consumes WCF Web Service


End-Point = ABC
- Address
- Binding
- Contract

WSDL Components

definition
    types
    message
    portType = interface implementation
        operation
            input
            output
    binding = abstract interface
        operation
            documentation
            input
            output
    service
        wsdl:port (name, binding)
            x:address (location)

 
Example Publicly Accessible / iNet WSDL

GlobalWeather.com
- http://www.webservicex.com/globalweather.asmx?wsdl

wsf.cdyne.com
- http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL

thomas-bayer.com
- http://www.thomas-bayer.com/axis2/services/BLZService?wsdl
 
External Links

- Make a SOAP client with Python
- StackOverFlow - How can I consume a WSDL (SOAP) web service in Python?
- SourceForge - Python Web Services Project

Thursday, July 1, 2010

RSA ID Number Check-Sum Algorithm

infomation sourced from this site.

13 digit South African Identity Numbers have the following format

{YYMMDD}{G}{SSS}{A}{Z}

YYMMDD Date of birth
G Gender: 0-4 = Female, 5-9 = Male
SSS Sequence No. for DOB/G combination.
C Citizenship: 0 = SA, 1 = other
A generally, but not strictly = 8, 9
Z CheckSum Digit

Calculation of Checksum Digit = Z

A = sum of digits in odd position (excluding last checksum digit)
B = sum of all the digits of the product of 2 and the number formed from the original be removing all the odd digits
C = A + B
Z = 10 - (second digit of C)