I have been thinking about Lisp, AJAX, and PHP recently. I know the link is tenuous if not non-existent, but bear with me. I think I could define some Javascript object types (think table/form objects) at runtime.
I think I would like the Lisp part of the code generator to take the following form...
(jdeftype jstring "String")
(jdeftype jbool "bool")
(jfunc myfunc "private void" "MyJsFunction" ((jstring strarg) (jbool boolarg))
(...commands that evaluate to JavaScript code...))
When it comes to passing arguments in I think a script tag may look like this...
script type="text/javascript" src="/lisp-bin/lispgen.lisp?genfunc=funcname&arg=value"
I think this would be useful for generating a table type object (think .net DataGrid) that I can create base types for through generated JavaScript. If I make it configurable enough I can define all of its behavior through src="..." arguments. I would then be able to invoke the object and use its methods and operators as defined by the Lisp output.
Once I manage to get an application stable I could generate the JavaScript and save it to a static file. At that point I could change all of the references of the generated lisp to the static JavaScript files. This may involve more interesting code...
I don't know if this will work. I don't know if it's even sensible. I do know it is something I should at least try.
Debug a general code generator that has many useful base object types and you should be able to build with those objects fairly quickly.
Shaun
Tuesday, May 23, 2006
Saturday, May 20, 2006
The Great Divorce
Yesterday I bought a copy of The Great Divorce by C.S. Lewis. I read it this afternoon and found it very interesting. What really impressed me was how easy it is to let pride keep us from advancing in life.
There was someone who kept talking about how they never asked anyone for anything and took care of themselves. They said "I'm not asking for anybody's bleeding charity." To which the response came, "Then do. At once. Ask for the Bleeding Charity. Everything is here for the asking and nothing can be bought."
This makes me think of Isaiah 55:1: "Ho, every one that thirsteth, come ye to the waters, and he that hath no money; come ye, buy, and eat; yea, come, buy wine and milk without money and without price."
Another line I took note of was, "I am not trying to make any point, I am telling you to repent and believe." This was said to someone who was resisting the truth. Not just the relativistic "my truth may not be your truth" type of thing, but THE actual truth about the nature of the universe.
How many of us resist understanding things as they are? It is an uncomfortable thought for many people that there might actually be one authoritative truth. That would mean someone is going to have to be wrong.
We see the indication that there really is an authoritative truth when we read in Philippians 2:10-11: "That at the name of Jesus every knee should bow, of things in heaven, and things in the earth, and things under the earth; And that every tongue should confess that Jesus Christ is Lord, to the glory of God the Father."
(Variations of this appear in Isaiah 45:23, Romans 14:11-12,Mosiah 27:31, and D&C 76:110 and 88:104)
There is nothing better than when something gets you thinking about the world around you. I think a lot of things about the world that I just can't share with others right now. However, that's more based on the fact that What You Can't Say can speak volumes about what things may need to be examined.
Shaun
There was someone who kept talking about how they never asked anyone for anything and took care of themselves. They said "I'm not asking for anybody's bleeding charity." To which the response came, "Then do. At once. Ask for the Bleeding Charity. Everything is here for the asking and nothing can be bought."
This makes me think of Isaiah 55:1: "Ho, every one that thirsteth, come ye to the waters, and he that hath no money; come ye, buy, and eat; yea, come, buy wine and milk without money and without price."
Another line I took note of was, "I am not trying to make any point, I am telling you to repent and believe." This was said to someone who was resisting the truth. Not just the relativistic "my truth may not be your truth" type of thing, but THE actual truth about the nature of the universe.
How many of us resist understanding things as they are? It is an uncomfortable thought for many people that there might actually be one authoritative truth. That would mean someone is going to have to be wrong.
We see the indication that there really is an authoritative truth when we read in Philippians 2:10-11: "That at the name of Jesus every knee should bow, of things in heaven, and things in the earth, and things under the earth; And that every tongue should confess that Jesus Christ is Lord, to the glory of God the Father."
(Variations of this appear in Isaiah 45:23, Romans 14:11-12,Mosiah 27:31, and D&C 76:110 and 88:104)
There is nothing better than when something gets you thinking about the world around you. I think a lot of things about the world that I just can't share with others right now. However, that's more based on the fact that What You Can't Say can speak volumes about what things may need to be examined.
Shaun
Wednesday, May 17, 2006
America: Freedom to Fascism
I just went to a screening for a film called America: Freedom to Fascism. I've heard many of the things that are in it before, but I haven't seen them all put together so well. This is going to be released in a couple of months and when it is you should see it. Yes, you, the person reading this blog post. Much of this was put together by Tim Costello and he said that while he can't make copies of the DVD used in tonight's presentation he can show it to small groups.
What I came to after tonight was that we are in serious trouble in our country. We are now living in a police state. Just last week I was searched by government security that had no probable cause. When I asked how it was constitutional they said I had agreed to it by entering the place I was in. That sounds bad until I mention I was at the airport trying to get to my plane. Suddenly it's ok that security patted me down and that I had waived my right (not by choice) to no longer be safe from unreasonable search and seizure.
Now for a message to Pete Ashdown... Pete, I am going to support you because I am trusting that you will go into the senate and uphold the Constitution. If you do that you will be a rare man indeed. You will be a real representative of the people of Utah. Orrin Hatch is no such representative.
I would just like to finish by saying that no matter what our political affiliation is we need to stop being divided by the apparent differences between the two major parties and start focusing on what it takes to be real Americans. That is pay attention and be careful who you are paying attention to. Check facts and find people who will disagree with you using arguments that are better formed than "I don't believe that".
We must all do our part if we are to be free. What are you doing?
Shaun
Update:
Last night there was an announcement for someone who would be speaking about secret combinations. The speaker saturday night is a decendant of the Rothschild family.
Saturday May 20, 7-10 PM
SLCC Larry H. Miller Campus
9750 S. 300 W. Sandy
Free Enterprise Building, room 101
What I came to after tonight was that we are in serious trouble in our country. We are now living in a police state. Just last week I was searched by government security that had no probable cause. When I asked how it was constitutional they said I had agreed to it by entering the place I was in. That sounds bad until I mention I was at the airport trying to get to my plane. Suddenly it's ok that security patted me down and that I had waived my right (not by choice) to no longer be safe from unreasonable search and seizure.
Now for a message to Pete Ashdown... Pete, I am going to support you because I am trusting that you will go into the senate and uphold the Constitution. If you do that you will be a rare man indeed. You will be a real representative of the people of Utah. Orrin Hatch is no such representative.
I would just like to finish by saying that no matter what our political affiliation is we need to stop being divided by the apparent differences between the two major parties and start focusing on what it takes to be real Americans. That is pay attention and be careful who you are paying attention to. Check facts and find people who will disagree with you using arguments that are better formed than "I don't believe that".
We must all do our part if we are to be free. What are you doing?
Shaun
Update:
Last night there was an announcement for someone who would be speaking about secret combinations. The speaker saturday night is a decendant of the Rothschild family.
Saturday May 20, 7-10 PM
SLCC Larry H. Miller Campus
9750 S. 300 W. Sandy
Free Enterprise Building, room 101
Sunday, May 14, 2006
One man show
I think I've come to a point where I want other people to work with again. In the last 2 years I have been working in places where I'm the only one who can do things. It's made me more self reliant, but at the same time it's nice to have people to bounce ideas off of. It's also nice to have someone who is smarter than you at something.
Working alone can become a problem. I don't have anyone who is going to challenge my assumptions (bad thing). I don't have anyone suggesting better ways of doing things (bad thing). I follow what best practices I know, but there are probably others I don't know that I should follow (bad thing).
What I'm trying to say is I can't do everything alone. I don't want to try. I want to work with others to make something great. That said... Anyone looking for a hacker? I do Windows/Linux administration and programming.
And no, I don't want to be the only one in your IT department.
Shaun
Working alone can become a problem. I don't have anyone who is going to challenge my assumptions (bad thing). I don't have anyone suggesting better ways of doing things (bad thing). I follow what best practices I know, but there are probably others I don't know that I should follow (bad thing).
What I'm trying to say is I can't do everything alone. I don't want to try. I want to work with others to make something great. That said... Anyone looking for a hacker? I do Windows/Linux administration and programming.
And no, I don't want to be the only one in your IT department.
Shaun
Saturday, May 13, 2006
Greetings from the Democratic Convention!
I'm sitting in the Pete Ashdown booth using his wireless internet connection he is providing. Pete has a device that receives a wireless internet signal and shares it on a publicly available access point. This is a fine example of a candidate who has a clue about technology.
I wish I could do more to support the Ashdown campaign, but as it stands I don't have enough money and things keep taking my time. Though, for what it's worth I will always suggest that supporting Pete Ashdown is a good move.
More later when I get a chance.
Shaun
I wish I could do more to support the Ashdown campaign, but as it stands I don't have enough money and things keep taking my time. Though, for what it's worth I will always suggest that supporting Pete Ashdown is a good move.
More later when I get a chance.
Shaun
Friday, May 12, 2006
Gone too long
Last week was pretty exciting. Thursday I talked to my uncle about some networking he needed done. We decided that I would drive up on Saturday with my cousins, do everything Monday and Tuesday, and fly back Tuesday night.
As trips go it was nice. I was going to go camping last weekend to get out for a while. The goal was to get out of town. I think Seattle was a nice step up from that. It was really nice to spend some time doing something different. At least similar things in a different place.
Since my last post I've made more enhancements to my condorcet vote counter. I also got a DDR pad and an adapter to use it with Step mania. Playing it is a fine way to realize just how out of shape you are.
I think that about covers everything since my last post. Hopefully I'll have some new interesting code to write about soon. That part is always fun.
Shaun
As trips go it was nice. I was going to go camping last weekend to get out for a while. The goal was to get out of town. I think Seattle was a nice step up from that. It was really nice to spend some time doing something different. At least similar things in a different place.
Since my last post I've made more enhancements to my condorcet vote counter. I also got a DDR pad and an adapter to use it with Step mania. Playing it is a fine way to realize just how out of shape you are.
I think that about covers everything since my last post. Hopefully I'll have some new interesting code to write about soon. That part is always fun.
Shaun
Monday, May 01, 2006
Condorcet Voting
Recently I have been interested in the Condorcet method of counting votes. More specifically the Schulze method. I find ranking based systems that can produce a clear winner in a single round of voting interesting. I'll let you do most of the background reading on Condorcet himself. What I really wanted to write about is my progress in making a condorcet vote counter in Common Lisp.
If you've been reading you may have noticed I've been learning lisp recently. This means I've spent more time figuring out something pretty simple and my coding style may leave somewhat to be desired. That said, on to the code...
The first thing to look at is the elections list. This is where my style must be called into question. I don't know how to use remove-if-not such that it returns a setf-able place in the main struct.
The macro and function are pretty straight forward. I use the macro to get the label (:ab, :ac, or :bc). I then reference by the label to get a setf-able place in the elections list for doing the setf on the vote count.
It's a good first step. Presently I can just do (incvote elections :[winner] :[loser]) and it will increment the vote count for the winner candidate.
My next step will be to take a list in the form of (:b :c :a) and apply the votes to the pairwise elections in the elections list by way of Condorcet counting.
Stay tuned for more fun.
Shaun
If you've been reading you may have noticed I've been learning lisp recently. This means I've spent more time figuring out something pretty simple and my coding style may leave somewhat to be desired. That said, on to the code...
Please forgive the indentation. If anyone knows how to get blogger to accept the HTML to do code listings please tell me. The obvious ones don't seem to work.
(setf elections '(:ab (:a 0 :b 0 :label :ab) :ac (:a 0 :c 0 :label :ac)
:bc (:b 0 :c 0 :label :bc)))
(defmacro election-pair-label (elec var1 var2)
`(getf (car (remove-if-not
(lambda (x)
(and (not (atom x))
(not (eq (getf x ,var1) nil))
(not (eq (getf x ,var2) nil )))) ,elec)) :label))
(defun incvote (list winner loser)
(let ((lbl (election-pair-label list winner loser)))
(setf (getf (getf list lbl) winner) (1+ (getf (getf list lbl) winner)))))
The first thing to look at is the elections list. This is where my style must be called into question. I don't know how to use remove-if-not such that it returns a setf-able place in the main struct.
The macro and function are pretty straight forward. I use the macro to get the label (:ab, :ac, or :bc). I then reference by the label to get a setf-able place in the elections list for doing the setf on the vote count.
It's a good first step. Presently I can just do (incvote elections :[winner] :[loser]) and it will increment the vote count for the winner candidate.
My next step will be to take a list in the form of (:b :c :a) and apply the votes to the pairwise elections in the elections list by way of Condorcet counting.
Stay tuned for more fun.
Shaun
Subscribe to:
Posts (Atom)