This is one of those late night thoughts, so forgive it if it is stupid.
In terms of structure, and complexity, programming has moved forward significantly. We have many new and exciting control structures that (arguably) help us to tackle greater levels of complexity. While individuals may disagree about exactly which control structures (observers, callbacks, object oriented programming, functional programming, event based programming, whatever) actually advance us, I think most agree that the level of abstraction that a programmer can deal with has gone up from the level it was in the past, thanks in large part to these control structures.
However, in terms of relatedness, that is, interaction of a programmer to his program, very little has been done. By and large, it is still just entering text. I will expand.
There is the physical act of programming a machine. This is done by entering text, executing/compiling said text, and observing the result. This has been the same for quite some time.
However, programming is not just about entering text. It is also about setting up a rhythm such that you can work. Finding a flow, that is, being interested and alert enough to tackle the next problem. This is more difficult than it sounds. Writers find flow when they are relating to their characters, when the plot interest them, when the story is intiging. Programmers constantly have jump from one idea/module/structure/file to another. These context switches are interruptions, and make it difficult to find flow. If you could "relate" somehow to the next bit of work, you might have a easier time switching to it.
Because all I do to get my program to work is enter text, I relate to my program as text. But does this have to be the case? Is there some other way I could relate to my program? Perhaps we could anthropomorphize aspects of programming? Maybe individual modules of code could be "skinned" in some way such that they appear to be sick or healthy (depending on how many unit test they pass). Or maybe they appear confused when they aren't properly commented? Or walk around unbalanced when their code blocks don't align very well? How about bloated when a function gets too large?
I am aware that these ideas seem kind of stupid, and perhaps they are individually, but I think they point to the theme I am trying to get at. Simply stated, it is, "Can we make programmers care more about their programs if we present the program in such a way that programmers relate to them?" Currently programmers are forced to interact with pieces of text. If we could transform this text into something that could be more easily related to, anthropomorphize, or compete upon, then that would seem to be a good thing.
What your eyes physically view are only tiny little pinpricks of what you think you can see: your brain fills in a great deal of the detail. Similarly, you imagination can fill in a worlds of details, as long as it is given a few things to run with. If we could just give a few things to spark [interest/ a competitive streak/ a completionist desire] from the source code that we program, I think we could significantly increase the diligence and care that people put towards creating software.
Unstructured
Musings, projects, whatever, best to just think of it as a brain dump...
Friday, May 20, 2011
Thursday, May 19, 2011
Inline examples
Part of the purpose of this blog is to show by example what I am doing every day. A lot of these examples involve building a simple web application. I really hate it when I go to a site where they are building some web something or another, and there is no live example of what they are talking about. Code and images of what you are doing are great and all, but a working example is the proof. In the past, the best I could do example-wise was to provide a link to the example. What I really wanted was to provide a actual inlined "window" into the example. Such that the example and the blog are all on the same page.
When I started this up, I though this was going to be very hard. Turns out it is super easy with iframes! Basically, a iframe allows you to create a inlined window to another page within your page. This other page can even be from another site!
I really have no idea what the cross browser security implications are of this. I don't really care as I own both this blog and the site that I am inlining to, so I can be reasonably certain that there is nothing fishy going on.
So, without further ado, here is a iframe example of a page on a different site (that I own) that contains a picture of a kitten. I am going to go back and switch my previous pages to use this inlined form, and from now on I will be posting my examples in the inlined form.
Labels:
iframe inline examples
Wednesday, May 18, 2011
Bulk upload your Sproutcore projects to Google App Engine
As I am working on this blog, I have decided that I am spending too much time getting my Sproutcore code formatted and looking good for Blogger. To my knowledge, I can't really host a project on Blogger. The best I can do is provide a link to the project so that you can look at it. Maybe at some point in the future I can figure out how to use a IFrame (or something) to give a windowed view of the days project code from within Blogger. That would be neat, but one step at a time.
So I am hosting my code on the Google App Engine. Anyway, my only goal for today is to write a small script that will:
- Look through every directory in the directory within which this script is run, for each directory (assume each directory is a sproutcore directory):
- Look at the age of the directory itself
- Look at all the files in the directory, are any files more recent than then age of the directory?
- If any file are more recent than the directory, then re-build this sproutcore project
- For each project, copy the files over that are necessary for Google App Engine
- Touch each directory so that it is now younger than all files within it
- Copy a few other things over that are necessary for Google App Engine
- Upload all the files to Google App Engine
- Done
Labels:
app engine,
python,
sproutcore
Tuesday, May 17, 2011
A expandable editable list in Sproutcore
This is a continuation of yesterdays code.
Yesterday I built something that allowed one to have a list of items in a list wherein one and only one item could be expanded in said list. Today, I am going to expand and refine upon that idea. Specifically, I am building a list of items, where each item is a bit of editable text. Because each item is a bit of editable text, the vertical height can vary depending on how much text is entered.
Side Note: Sproutcore has the concept of a lazily loaded view container. This is very cool. It allows you to have a list of items that might contain hundreds of thousands of items, but only end up loading the ones you actually see. The catch is that each item needs to be equal in height, because the list calculates which views to display based upon the distance of the currently scrolled view area from the top. Because of this, the list being built today will not really work with lazy loading. This is because each view item in this list does not have a standard height. This really is not a issue if you are dealing with a small list of items, but it is something to keep in mind if you tried to use today's list with a huge list and using lazy loading.
What do we want?
A list, maybe 10 items or so, where each item in the list is a piece of text. Clicking on any item in the list will cause it to become editable. When editable, a item switches to a html textArea, and focus is placed in the textArea. This is a special textArea that resizes depending on how much text you put in it. Clicking outside of the editable item at any time causes it to switch from our textArea back into regular text. The size of the textArea should be roughly comparable to the size of the text when focus is removed. This allows people to gauge what their text will look like when they are done editing.
Work In Progress
Labels:
javascript,
programming,
sproutcore,
ui
Monday, May 16, 2011
A expandable list in Sproutcore
Sometimes you may want to have a scrollable list of items, where each item contains summary information and detailed information. However, each item in this list has a limited amount of screen area in which to display its information. Therefore, for each item (row) in the list, you only display the summary information. But how do you display the detailed information? There are at least 3 solutions to this problem:
- When a user clicks for more information on a particular list item, take them to a different page with more information on said item.
- Have the screen split into X and Y. X displays the list of items, Y displays the detailed information for a item. As you select a different items in X, Y is updated to reflect the selected item's detailed information.
- Expand the summary information into the detailed information in the list itself.
This is a attempt at solution 3. It should be stated that this solution will only work in the event that there is not too much extra information in the "detailed" view. If there is too much information, you will have to pick another solution: perhaps 1 or 2?
Lets define what we want.
I want a list where I can select 1 and only 1 item from the list, and have that item expanded to give me more information. If a item is already expanded, and I click to expand another item, the current expanded item will un-expand, and my selected item will expand. I can also "unexpand" a expanded item manually. Because only 1 item can be expanded at a time, I can just set a global variable to remember which item is expanded. I am in no way recording on the server which item I have expanded, so if I reload the page, a previously expanded item will no longer be expanded. Takeaway message from all this is that only 1 item will be expanded at a time, and I am only recording the expanded item in transient memory.
WORK IN PROGRESS. THE TEMPLATE SYSTEM ON SPROUTCORE IS NOT REALLY READY YET, I AM RE-DOING THE CODE, IN THE OLD WAY. :[
Labels:
javascript,
programming,
sproutcore,
ui
Saturday, September 4, 2010
Effectiveness of mathematics
http://www.dartmouth.edu/~matc/MathDrama/reading/Wigner.html
I ran across the above essay a few days ago. I read for content the first time, and detail the second. At the bottom of the essay it basically concludes that all 4 explanations, even if they were allowed to combine their evidence, would still not be enough to explain the “unreasonable effectiveness” of mathematics.
I ran across the above essay a few days ago. I read for content the first time, and detail the second. At the bottom of the essay it basically concludes that all 4 explanations, even if they were allowed to combine their evidence, would still not be enough to explain the “unreasonable effectiveness” of mathematics.
I saw no mention anywhere in the article that one must be a mathematician (or even mathematically inclined) to guess a solution to the “unreasonable effectiveness” of mathematics. So my guess goes as such.
Mathematics is built up from a set of givens. These givens are not proven true or false beforehand, they are simply givens. Laws of mathematics are built up by combining these givens. The more observably correct laws that can be built up from any set of givens, the more likely it is that some (or even all) of the givens are true. If you are ever able to construct a law that is provably false, and you could prove that all the laws that this provably false law reference are correct, then you know that some given that “builds up” to one of these laws must be incorrect.
Mathematics, is different from other science in the sense that it is extremely extensible. The language can be extended by simply creating a new syntax, and extending a particular law/property/invariant without breaking any existing laws/properties/invariants. If the new extension “fits” within the set of existing laws, then does that make it true? Well no, but if the new extension does not break anyone else, then there is a higher possibility of it being true.
My guess is that mathematics is so unreasonably effective because it is so amazingly extendable. We simply create new mathematics every time we need mathematics to cover something new. New distributions for new types of probabilities, moving from scalars to vectors to tensors for physics, it just keeps getting added on. Mathematics is effective because mathematics is based on symbolic manipulation, which is extremely flexible.
The interesting thing to note is how rarely we hit contradiction. Perhaps this points to just how limited (and hopefully not missguided) humanities mathematical understanding is. Picture the set of givens as the root of a tree, and the laws as branches coming out of the root (it has not trunk). Some laws are built using other laws, without even directly referencing a given.
As invariants are added, the chance that another invariant will cause a contradiction to some existing invariant increases. The fact that we can still “easily” add new invariants to the tree seems to indicate that we are not even close the the “final” number of invariants.
So my guess is that mathematics is effective because it is based on symbolic manipulation, which is probably the most extensible thing humanity has ever invented, and because the “tree” of mathematics is very small, and adding new “leaves” to it is still very easy.
Mathematics is built up from a set of givens. These givens are not proven true or false beforehand, they are simply givens. Laws of mathematics are built up by combining these givens. The more observably correct laws that can be built up from any set of givens, the more likely it is that some (or even all) of the givens are true. If you are ever able to construct a law that is provably false, and you could prove that all the laws that this provably false law reference are correct, then you know that some given that “builds up” to one of these laws must be incorrect.
Mathematics, is different from other science in the sense that it is extremely extensible. The language can be extended by simply creating a new syntax, and extending a particular law/property/invariant without breaking any existing laws/properties/invariants. If the new extension “fits” within the set of existing laws, then does that make it true? Well no, but if the new extension does not break anyone else, then there is a higher possibility of it being true.
My guess is that mathematics is so unreasonably effective because it is so amazingly extendable. We simply create new mathematics every time we need mathematics to cover something new. New distributions for new types of probabilities, moving from scalars to vectors to tensors for physics, it just keeps getting added on. Mathematics is effective because mathematics is based on symbolic manipulation, which is extremely flexible.
The interesting thing to note is how rarely we hit contradiction. Perhaps this points to just how limited (and hopefully not missguided) humanities mathematical understanding is. Picture the set of givens as the root of a tree, and the laws as branches coming out of the root (it has not trunk). Some laws are built using other laws, without even directly referencing a given.
As invariants are added, the chance that another invariant will cause a contradiction to some existing invariant increases. The fact that we can still “easily” add new invariants to the tree seems to indicate that we are not even close the the “final” number of invariants.
So my guess is that mathematics is effective because it is based on symbolic manipulation, which is probably the most extensible thing humanity has ever invented, and because the “tree” of mathematics is very small, and adding new “leaves” to it is still very easy.
Tuesday, August 31, 2010
The Egg
I read the above short story a few years ago and liked it, I re-read it recently.
Do you ever find yourself hoping there is a God, an afterlife, all that stuff... but simulatenously hoping that it is a little different then established religion prescribes? Me too! Lets be clear, I am a romantic, and hope that there is a God. Rationally, I don’t really believe it, but I hope that it is true nonetheless.
Do you ever find yourself hoping there is a God, an afterlife, all that stuff... but simulatenously hoping that it is a little different then established religion prescribes? Me too! Lets be clear, I am a romantic, and hope that there is a God. Rationally, I don’t really believe it, but I hope that it is true nonetheless.
I have said that I am agnostic since I was 12 or so. When I was young, I had a friend who was quite religious. He disagreed with my break with faith (not that it was ever all that strong). I told him that if I died, and found myself burning on the floor of hell, I would cry tears of joy knowing that there was something “more” to all this. That there was a God, an afterlife, and (hopefully) a reason for everything. It is a wonderful idea. Unfortunately, I just have difficulty rationally accepting it.
I have thought about it quite a great deal, and one of my biggest breaks with the idea of God was understanding why he would allow suffering in this world. I needed to make up a reason that there could be a God AND suffering. I spent some time thinking about it. The only real solution I could dream up was that God is not in fact all knowing. Perhaps he never said he was, we just assumed. Once I groked this, I found the idea that God may not be all knowing to be a great relief. I am quite uncomfortable with the idea that God might actually be all knowing, and still choose to let humanity suffer in the fashion it does. If he did know everything, understood the ramifications of all his choices, had full comprehension of the breadths and depths of... well... everything. Well, I mean really, that would just kind of make him an ass in my book. What purpose does it serve to make us suffer, other than to pleasure him?
However, what if God is not all knowing? He may be very smart, and very knowledgeable, or whatever, but not COMPLETELY all knowing, then I suddenly get it. I understand why there is suffering. I believe he is doing the best he can, I believe in him because he is the best qualified to lead us. I know that he is not always right, but he does his best, and he is our best. That would be a comfort. That is a God I could really get behind, it would make sense to me. I made up this idea (I am sure others have as well) about how there could be a God and suffering more than a decade ago, it is my personal story for why things are as they are (other than the great void :] ).
Warning: Spoilers Below (Why don't you read the story first?)
Ok, so back to this story. I like this story because it is a completely different explanation of the ethical problems with a all knowing God allowing suffering. One that explores a possibility I had never even imagined. In this story, there is suffering in this world because God is not in charge of it, we are. We are “fetus” Gods that are going through the lessons in life necessary to become God in our own right. God is our father, all of humanity is the God child, life is the training necessary to become as wise as our father.
A new idea! In short story form! You can’t really ask for more. A new explanation about how a all knowing God would allow suffering. You do not run across that every day. Regardless of whether it is true or not, worth reading, worth remembering.
Subscribe to:
Posts (Atom)