Gray_code_element

Thursday, November 19, 2009

Jeremy Bentham: What is your ethics good for?

Jeremy Bentham (1748-1922) wrote on ethics. He proposed the utilitarian framework for developing ethics. In his Introduction to the Principals of Morals and Legislation, he begins by developing a justification for a utilitarian framework. Basically, the justification goes like this: It only makes sense to build ethics based on what will benefit mankind.

He then goes on to assert that utilitarianism is the best ethical framework because it is useful. He goes on to challenge the validity of other ethical principals by asking "what is it that the other principals can be good for?".

What other principals was he challenging? Well, some of the ethical ideas up to that time are:

Virtues ethics promoted by Aristotle and Plato propose you are supposed to nurture the virtues or moral character. Aristotle argues that you should be virtuous because when you really think about it, it is better in the long run. If you are not pursuing virtue, then you are allowing vice to control you, and vices (lying, cheating, drunkenness) will end up destroying you. Interestingly enough, the defense that Aristotle had for virtue ethics is that it is "useful" in the long run.

Divine Command ethics promote obeying the laws that God has given us. The immediately apparent reason to obey these laws is that they are supposed to improve your standing with God (evangelicals would say that it is not obeying the laws that improve your standing with God, but rather it is believing in Jesus, but it is all part of obeying the what God has commanded). However, there is a more subtle underlying reason for obeying these laws. If God created the universe, then He should know best what kind of behaviors result in the most long term benefit for us human (ie: what is the most useful).

It is interesting to think more about Jeremy Bentham challenge to Virtue and Divine Command ethics. His challenge is that they are not useful - or that usefulness is not their primary principal. I have countered that argument by showing that Virtue and Divine Command ethics are useful.

However, something subtle is happening here. I am playing by Jeremy Bentham game. That game is that we will evaluate anything based on its usefulness. Sure I can show that Virtues or Divine Command is useful, but is that the point?

I think that 2000 years ago, when Divine Command ethics were in full force people did not pursue it because of its "usefulness". There was also something about a mystery and fear of God. I also think that with Virtues ethics, they were not pursued because of their usefulness, but there was a value in society of being virtuous.

That fact that Jeremy Bentham can make use feel so convinced about the superiority of Utilitarianism over other ethical frameworks is an indication of how we value "usefulness" above everything else. I am sure as you are reading this you are asking: What is the point? Either it is useful or it is not. But that is exactly the point! Where has gone things like appreciating beauty for the sake of beauty, or appreciating spirituality just for the sake of a connection with the divine, or giving of yourself to someone else just for the sake letting go of your self and helping someone else out. All of these get lost when we strictly look at things based on the usefulness to ourselves.

I am glad that Jeremy Bentham wrote the challenge that he did because it is a wake-up call to myself. Am I going to make decisions based solely on the usefulness to myself, or am I going to dig deeper?

Monday, October 26, 2009

Good Solidworks resources

Lennys SolidWorks

XML Extractor


Sub PullFromInternet()

'The web address at which xml is stored
URL = "http://jjh.virtual.vps-host.net:8080/restdemo/services/customers/0"

Dim HttpReq As Object

'Declare the request for information over the internet
Set HttpReq = New WinHttpRequest

'Specify the type of HTTP request
HttpReq.Open "GET", URL, False
'or use GET instead of POST

'Specify the type of content that can be recieved
HttpReq.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"

'Send the actual request
HttpReq.Send
'HttpReq.send postmydata
'Note - if using GET set postmydata to ""

Dim response As String
Dim tag As String
Dim data As String
tag = "address"
response = HttpReq.ResponseText

MsgBox (extractor(tag, response))

End Sub

Function extractor(tag As String, response As String) As String
Dim tagLength As Integer

Dim mypos As Integer
Dim myposEnd As Integer
mypos = InStr(1, response, "<" & tag)
myposEnd = InStr(1, response, "<" &"/" & tag)
tagLength = Len(tag) + 2
Dim address As String
extractor = Mid(response, mypos + tagLength, (myposEnd - mypos - tagLength))

End Function

Just in case you thought that seeing is believing

Parsing XML in Visual Basic

Once I recieve the XML from a REST web servce, I need to be able to extract the useful information about of the XML document. Some useful links along that line are:

Sunday, October 25, 2009

Calling a REST Service from VB

I did not have much luck calling the Yahoo REST service, so I created my own web service using the MyEclipse tutorial and tested it out. The VB code to call the REST service is as follows:


Sub Macro1()

url = "http://jjh.virtual.vps-host.net:8080/restdemo/services/customers/0"

Dim HttpReq As Object
Set HttpReq = New WinHttpRequest

HttpReq.Open "GET", url, False
'or use GET instead of POST

HttpReq.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"

HttpReq.send
'HttpReq.send postmydata
'Note - if using GET set postmydata to ""

MsgBox (HttpReq.responseText)

End Sub

Now the next challange is to get the Microsoft XML parser working.

Thursday, October 22, 2009

How to Post and Get from HTTP using VB6

Thanks to some help from Doc's Coding, I was able to get Microsoft Excel 2000 to do a GET request.

I had to add a reference by going to Tools|Reference, then select Microsoft winhttp service version 5.1

Then I added the following code:


Sub Macro1()
'
' Macro1 Macro
' Macro recorded 22/10/2009 by John Hufnagel
'
url = "http://www.google.ca/"
postmydata = "variable=data&variable2=data2"
Dim HttpReq As Object

Set HttpReq = New WinHttpRequest

HttpReq.Open "POST", url, False
'or use GET instead of POST

HttpReq.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"

HttpReq.send postmydata
'Note - if using GET set postmydata to ""

MsgBox (HttpReq.responseText)

End Sub

Now that I have the basic GET working, the next challange is to make a Yahoo! Web Service REST Call

Friday, October 16, 2009

Are Upper and Lower control limits the same as tolerances

I was teaching about Statistical Process Control (SPC) and control charts today and a student asked an interesting question: Are the upper and lower control limit the same as the design tolerances on a manufactured part?

The answer is that they are not the same: the upper and lower control limit are based on the statistical information obtained from observing the process, while the design tolerances are what the designer wants to achieve.

This leads to the next question: what is the relationship between tolerances and upper and lower control limits? This hits on the core philosophy behind SPC. Traditionally people like to inspect quality into a part. To do this, every piece must be inspected and the rejects discarded - there is no thought put into the process that created these rejects. It can be a lot of cost and time to inspecting every part. In some ways it is easy to image every manufactured part being inspected, but what about services? Quality is also important in service. How can each service be inspected before it is delivered? Lets say the service is a bank teller. It is completely unfeasible for a third person to inspect every thing the teller is doing before the service is actually rendered to the customer.

This is where SPC comes in. SPC is not about inspecting every single part to see whether or not they are in tolerance, rather SPC is about monitoring the process and improving the process so that the process will automatically provide the desired quality. In other words, with SPC the process can be improved so that the upper and lower control limits fall within the desired tolerance.

This is a radically different way to look at manufacturing and servicing processes. With the old way of inspecting every part, people continually work in fear about ever making a mistake. The fear of an error is the predominate thought on their mind.

With an SPC controlled system, the focus is on trying to understand the process, where there is potential errors or defect (deviations from the desired outcome), and improving the process so the desired outcome can be achieved more predicatably.

Tuesday, October 13, 2009

My Alter Ego


I was watching the football game yesterday between Calgary and Montreal. The announcer kept talking about John Hufnagel, the coach of the Calgary Stampeders. It is nice hear my name on TV even if the Stampeders lost.

Thursday, October 8, 2009

Drop Down Menus

Drop down menus on web pages add an elegant style to the presentation, but they can be very quirky. Commonly, the menus are build with lists and using CSS that control the visiblity of list items based styles estalished for the the hover property in CSS.

Another method that I have seem demonstrated quite eligently at The Ojibway Club is to use a combination of tables and divs. That site was developed by The Big Brain.. The source code for that page shows a very clean layout of the menus. This was created with Joomla in conjunction with a third party joomla menu system.

y bar

y + hold Alt, type 0773