Saturday, September 4, 2010

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.

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.
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.

Saturday, August 28, 2010

The Hidden Fortress

Today I saw Akira Kurosawa's "The Hidden Fortress" at The Long Now center. I enjoyed it a great deal. It was the first time I had ever seen it, and I think it was neat that I first saw it on the big screen.

I have heard that the two comic characters in this movie were copied into the Star Wars series as C3PO and R2D2. I don't know if this is true one way or the other, but there were some strong similarities.

When watching a movie like this, you can't help but feel that it is a bit... hmm... conventional. I mean this in the best way possible. When watching a movie like this, you feel that a great deal of the plot elements are things that you have already seen in other movies. My question is, was this movie the first to use these elements?  Was "The Hidden Fortress" a first in film? Perhaps it was only a "first" in popular film? When I watch something like this, I recognize that many things will seem derivative because they have become standards of modern cinema. What I want to know is which elements are original? Unfortunately, I would have to do actual research to determine that. Wouldn't it be nice if the film itself were able to answer those questions?

I don't really have anything intelligent to say about this movie. The most frustrating part to me was my curiosity about whether the elements of the film were first, or were already derivative by the time the film was made. I would really like something like hypertext for movies, where you could pause the film, and maybe there would be keywords relating to the scene you are watching, and you could filter through all films and find similar themes.... I don't know. Sounds like a lot of work. I just often find myself wishing that film was more social, interactive, dynamic. I often enjoy being simply passively entertained, but when something honestly interest me, it would be really neat if the film itself allowed me to explore my interest further.

I think there is probably a real market there. The user interest that isn't strong enough to look something up afterwards, but that might be strong enough to engage the person as they are watching the film. Obviously, I have not thought through this idea very clearly, but I nonetheless maintain that it is a untapped desire of the movie viewing public.

Monday, August 23, 2010

Pirahna 3D

I was torn on this movie. On one hand, it is a 3d movie. I see almost every 3d movie. I am kind of an idiot about it. It could be "paint drying.... in 3D!" and I might see it.  On the other hand, it looked really stupid.

I debated for a few days about seeing it. I know there are movies out right now that are more deserving of my attention. I know the plot, characters, acting, dialogue, pacing... everything, will be pretty dumb. I know just thinking about seeing it makes me an imbecile. I know.

yeah, this is going to be deep...

I saw it anyway. What can I say! I have never actually thought of film, in itself, as an elevated medium. I often go to movies with no expectation of seeing truth, beauty, art, or any other higher emotion. Call me a plebeian, but I often go to movies to see action, violence, big breast, bigger explosions, and humor. Occasionally, even romance. 

This movie did not disappoint my lowered expectations. The dialogue was... well, it might have been better as a silent performance piece. plot = characters = acting = "none existent". The pacing was good, in the sense that things occurred in the correct order. But who cares, it was still fun. 

You know they are bad, because their eyes are red!

Why was it fun?

Reason number 1. Boobs. There were a lot of them. At the beginning of the movie, the first pair of boobs we saw had pasties over them. Disappointment. Anger! I said to myself that if something did not happen fast, I was walking to another theater down the hall to re-watch Inception.  A short while later, more boobs later occupied the screen. Relief. Later on there is a lesbian themed scene, where two girls make out underwater to classical music. It is funny, but I can't actually remember what the piece was, though I am certain I recognized it. At this point in the development of our movie, we get full frontal nudity, both head on and from the "bottom". Actually, it was pretty risky for a R rating. Did I mention that this nudity was underwater, AND IN 3D? Hell yes!

Reason number 2. It was 3d, this gives you something too watch on the screen while absolutely nothing in the way of a story progresses. Didn't really care about the rest of the movie too much. All I thought about the rest of the movie was the lesbian underwater scene. Really, this is just getting too awesome. I mean imagine, zero buoyancy breast, floating underwater, lesbian girls making out, in 3D! How do you top that?

Reason number 3. Oh, I guess there was one other cool part of the movie. The "proffessor" in the movie was Christopher Loyd of Back to the Future fame.

There were so many stupid things about this movie. I mean really, listing them is just a waste of both of our time. It is a fun movie if you have someone with you who does no take themselves too seriously. Someone who you can turn too and say "Man, that was a big explosion" or "Whoa, look at those breast" without needing to justify yourself. I would not recommend this for women, men with women, or even someone who has a unisex name. Still, if you can turn your brain off for 90 minutes, it is a fun enough midpoint to your day.

Sunday, August 22, 2010


Note: In order to install this ROM you must have unlocked your evo 4g!

DamageControl is a ROM alternative that gives you two things that I care about:

Android 2.2 - Read about it here
Wireless Tether - Allows you to use your phone as a portable wifi router.

It installs other neat apps, and also purportedly increases performance and battery life, but those aren't as important to me.

Installation was painless (if a little frightening).

  1. Boot into "recovery mode". 
  2. Make a backup. 
  3. Copy the backup to your computer for safety. 
  4. Wipe your phone (not entirely clear why). 
  5. Copy the file from your computer to your phone
  6. Flash your phone with the file.
I also liked how I could "quick mount" my phone onto my computer from recovery mode. In this way, I do not have to reboot the phone every time I want to copy files over. Convenient.

Of course, after flashing you must re-do the whole "new phone" rigamaroll. Set your google account, set logins and passwords again, etc. This does not take that long honestly.

The guys who put this together are really awesome. If you like this, and enjoy having alternatives, you should drop them some loose change.

Monday, August 9, 2010

When it comes to distributions, we aren't all normal

I love a good example of one probability distribution being mistaken for another. A article from the New Yorker is reproduced here. It has a lot of interesting example of moments where conventional wisdom holds that a distribution is normal, when in fact it is a power distribution. I will list two from the article:

  • After the Rodney King beating, officers in the LAPD police department were widely accused of being excessive in their use of force. A commission was formed to investigate the rate of officers who had excessive force charges brought up against them. It was widely believe that the rate of such charges (among officers who had them) would be normally distributed. Not even close. Most officers (in the excessive charge subset) had one charge brought against them, some had a few, but only a very small number had anything approaching a excessive amount. In fact, these few cops had a almost inhuman number of excessive force charges brought against them. It was found that the firing of 44 police officers would dramatically reduce the number of excessive charges brought against the department.
  • Until it was measured,  most researchers assumed that the length of time spent homeless was normally distributed. This was found to not be the case at all. In Philadelphia, the most common length of homelessness is 1 or 2 days. At any time, of all the homeless persons on the street 80% will only be homeless for 2 days at most. The next 10% will be homeless on a episodic schedule. These homeless usually represent drug users who have relapsed. Finally, less than 10% of all homeless on the street will actually be homeless for long periods of time. These represent the homeless most people think of when they think homeless. The physically or mentally disabled, the permanent drunk, etc. 

The point has been made that these top 10% cost the city and state a inordinate amount of money. In fact, in Denver, the most expensive homeless residents average about 15000 in medical care alone. A efficiency apartment in Denver would run at about 4500 a year. Some people are arguing that it would be cheaper just to provide the worst of the homeless with their own efficiency. Then they do not develop things like pneumonia and end up going to the hospital.

Of course, this does not go over well with most people. The idea of providing the homeless guy on the corner with free housing and care while the rest of society is forced to work... Well, it is a hard sell, even if the numbers add up.

My own opinions about homelessness are varied, and to be honest, not that well defined. I do not feel like going into them at the moment. I did not really care about the actual focus of the article (homelessness). This often happens with the New Yorker, as it is a magazine that likes to take a page to say something that could be stated in a paragraph. I often get frustrated with the New Yorker for this reason.

The interesting thing to me was that both of these examples were power law distributions, and not normal distributions. It is amazing how often we just assume a normal distribution when we think "human", when in fact a completely different distribution models the data. Just because height follows a normal distribution, does not mean that all human characteristics will. 

Sunday, August 8, 2010

Ending Poverty, colonial style

The Atlantic has an article "The Politically Incorrect Guide to Ending Poverty" which is worth a read. This actually surprised me because it is a idea I have had for quite some time. Actually, it is a idea that a great number of people have had. It runs as such.

X is a really nasty/terrible/brutish place to live. Y is a well run place/country/corporation. If X were to hand over some small portion of their land as a colony of Y, then Y could run a colony in X. Call Y's colony in X Z. Because Y is so good at running things, it could run Z in X so well that it raises the quality of life and living for all people in X. Everybody wins.

There are of course a lot of details to work out. How autonomous is Z from X? Does Z operate on a completely separate legal code than X? Is Y a government, individual, or corporation? How are the incentives laid out? Will Z belong to Y forever, or does it someday revert to X? Does Z have the right to arm themselves? Many questions, very complicated.

But the idea is simple. If your country truly sucks, if the people are unhappy, if it could not run a lemonade stand without somehow purchasing weapons and jewelry for some despot. Then any change is kind of a good change. Ceding of portions of land, and allowing independent governments to run upon that land, might just be what you need to raise your nation out of its stupor.

The reason I like this idea is that I feel that poverty is often due more to a lack of options (choice) than a lack of basic care/goods/education/whatever. What is the point of saving wealth if your local warlord will take it away from you? What is the point of education if there would be no place to use it? I feel that what poor people really lack is a concrete way to figure out how to "build something up". I like the idea of city states (others might call them colonies) because it gives people choices. I don't want to force anyone to do anything, but I cannot see the harm in giving them a choice.

So, here comes the boy with the lego blocks and imagination! How would I build a city state?

In my mind the most important thing is preservation of wealth. People need to know that they can put their money away, and that there is a reasonable chance that it will be there tomorrow. They need to have the tax implications of making and storing their money be clear and understandable. They need to be confident in the salience of their money. They should feel comfortable leaving their money in the city state. You now have incentives to save, and to think long term.

Second most important thing is contract law. Within the walls of a city state, contract law must be enforced. Anyone who breaks a contract on bad terms is simply incapable of creating a new contract until they resolve the break. Contracts are realistically broken all the time, but usually good faith measures are made to make restitution from the breaker to the breakee.  There should be courts and judges that can quickly and efficiently resolve contract disputes. There should be mediators who can hopefully resolve contractual disputes without even having to go to court. The details are fun to think about but not too important. The important effect should be that if someone creates a valid contract within the city state, they should be reasonably certain that the contract will be enforced. You are now free to do business.

Finally, the third most important thing is the right of security. Within the walls of a city state, I would simply ban all weapons great and small. Tanks, RPGs, rifles, guns, knives, brass knuckles... umm, cowboy spurs... just about anything. I am a fairly pro-gun person, but we are talking about setting up city states in areas where coercion at the end of a rifle is common. No, you check any weapons you have when you enter the city. You agree to do no violence or physical intimidation within the city. If you break these rules, you are banned from the city (permanently if it is a bad offense). The cities own security forces are your only security. You should feel reasonably certain that the security forces are the only armed forces within the city. You should feel certain that your wealth will not be stolen, and that  your contracts will be enforced. You should feel safe and free to do business without needing to worry about the possibility of violence.

Do these city states address poverty for everyone? Absolutely not. Only people who want to and who choose to "use" the city state would actually benefit from them. It would not help the infirm, the disabled, the elderly, the young, and many many more. It would not help many people who need help. I recognize that many people need help who would not benefit from a city state, and I am not making any sort of judgement upon them. But a city state would help some, it would give them a choice where previously there was none. It would help those who can help themselves. It would help those who have the ability and the foresight to build for themselves. I think that would be a pretty good start.

Saturday, August 7, 2010


The Economist has a article "In Search of Serendipity" that reviews the book "The Power of Pull". "The power of Pull" highlights how modern business relies increasingly on fortuitous connections and loose networks of people in order to make decisions and/or connections.

The article make a few interesting points. Foremost, it goes into details concerning what specific things you should do to increase your "pulling power". It also contrast the decentralized "pull style" company to the conventional "command style" company. Lastly, it goes over the specific steps involved in "pulling". All these subjects are interesting, but I am not going to discus them here.

My whole concern with the "Power of Pull" system in general is its reliance on building and causing fortuitous connections in a "high quality network" of people.

My basic problem with the system is that it can be stated as such. "You can significantly increase your chance of a fortuitous connection by connecting to more people in a network, provided the network is a good one". Problem is, it is very difficult to determine when a network is good. We are human, we don't rationalize things at a purely statistical level. I am more likely to want to pick a cool network. I am more likely to want to stick with a network in which I have friends. Worse, once I am in a network, I am likely to adopt the attitudes and beliefs of the people within the network. These factors make me a terribly biased judge as to what is a "good" network.

I am not faulting the system, but I do not see how someone can easily determine quality of a network. I do not really see how you can be aware of the quality of a network before actually joining said network. Finally, once you actually join a network, you will likely become biased towards that network. At that point, you are probably one of the worst persons to ask "Should I join your network?"

I am also curious as to whether a survivorship bias has been accounted for here. The book points out that successful people often have large networks, both in size and number of networks. People who span large or multiple networks are most likely the successful ones. But a great deal more people join and then leave a network without anyone noticing. Are we sure that the net effect of being within a network is on average positive? More importantly, what is the distribution? If it is the case that the benefits are on average positive, and the distribution is normal, the I suppose the average person should join a network. But it could just as soon be a power distribution, where the most connected get great benefits from these networks (kings), many people get some (nobles), and the rest of the network actually derives a negative net benefit from a given network (peasants).

To restate, I think their conclusion is correct. I do believe that modern tools and analysis can be used expand the size of your network. However, my main concern is their reliance on having a quality network, on separating the actionable information from the mundane chatter.

Friday, August 6, 2010

Sprint, Psycho's, and my dirty laundry

I forgot to pay my Sprint mobile phone bill, I waited until the very last day (today) until I paid it.

I did not mean to, I simply thought I had set it to automatically direct withdraw from my checking account. I have everything else on direct withdrawal. I had forgotten that I had not yet set up Sprint on direct withdrawal. Sprint contacted me through a email, notifying me of my delinquency, I paid it. No harm, no foul.

My real annoyance was that about a hour after I paid it I received a phone call from Sprint (a pre-recorded message I assume) telling me that my account was in a delinquency. It informed me in a aggressive and firm male voice that if I did not call them TODAY, my phone service would be disconnected in the next 48 hours and my account would be forwarded to the collection department.

Alright, I know what you are thinking. Your saying, well yes, you paid the bill, but it probably did not clear with them yet. That would be reasonable.

But here is the kicker, I paid using their own phone payment system!

The system was fairly effective, it did not take very long (a few minutes) and it did not cost me anything (extra). However, it evidently did not bother notifying anyone in the collection department that I paid my bill!

I stopped to think a little bit about why getting this call made me so angry, and I figure it must be one of those dirty laundry kind of things. You see, upon paying my bill, when it was between me and the automated collection agent, it felt like Sprint was actually being a friend: making one last heroic effort to remind me to pay my bill before they were "forced" to do something drastic. Psychologically, after doing me the "service" of reminding me to pay my bill, I probably felt a little appreciative. This would have been the perfect time to say something like "Hey, we are all human (well, I am a computer), would you like to set up automatic bill payment?" I would have probably agreed to it.

However, AFTER I pay my bill, to get a call threatening me with collection makes if feel like I was swindled. Did I mistype my credit card numbers? Did my bank deny the charges? I do not know, and the only way to figure out is to call them up and ask. Dammit, to have to call up another human being and tell them that I do not pay my bills on time, not cool.

I think this was the real root of the anger. It was the fact that previously, it had almost felt like Sprint had let me get away with something. I did forget to pay my bill, but some magic helper from Sprint called me up at the last moment and reminded me, so that I could avoid having the embarrassment of having to go to collections. Except I did... Having to call or get called from collections is bad enough, having to call them after you paid a bill makes it righteous. At first it felt like Sprint was letting me get away with something, and then it felt like they were making me air my dirty laundry after I had made restitution's.

In reality, a corporation is made up of many people, interest, and groups. Information is not disseminated in real time. However, from my point of view, they are Sprint. I anthropomorphize them as a single entity. When they treat me well when I am paying my bill, and treat me poorly 1 hour later, it makes them look a little psycho from my point of view. I guess the lesson to be taken from this is that you should be sure your customer perception of you is consistent at all levels of a corporation. That if your customers were to look at your corporation as a anthropomorphized entity, it would seem consistent at all levels of the corporation.

That, and umm... pay your bills on time.

Thursday, August 5, 2010

cell phones and ewaste

Toms Hardware had a pretty interesting article on how they extracted about 3 dollars worth of gold from a old motherboard. It is a very light article, with lots of pictures, I would recommend looking through it.

This got me thinking, is there some resource somewhere that can tell you how to perform chemical processes. Like something that could tell me how to convert one chemical substance into another? Or how to extract one or more elements from a chemical substance? I am thinking of something prolog like where I would basically state the starting substance, state the final substance, and it would then spew out a list of all ways I could do that (if at all).

convert(Lead, Gold) => None // Means that it cannot be done
convert(Carbon Dioxide, Oxygen) => //Would spew out a great number of ways of doing this

I could then filter the results, based on material cost, time, safety, energy, whatever I am interested in.

Just curious about this, I don't have any real use for it. I assume the most readily efficient ways to extract gold from motherboards have already been discovered. :]

Wednesday, August 4, 2010


I went to Ringling Bros and Barnum & Bailey circus at the San Antonio AlamoDome. It was fun enough, though my girlfriend and I both felt underwhelmed afterwards. Now, I hate to be the ass that dislikes the circus, but somewhere along my (very slow) maturation process, I think the circus may have fallen under the category of "things that are fun, but only with children".

On one hand, you have to hand it to them. R.B.B.B has by and large refused to update their acts, which is kind of honorable in its own way. There are tigers, there are elephants, there are clowns, there are jugglers; there's magic, a man gets cut in half, another gets stretched. Things appear, things disappear. It is all very classic, and was very close to the R.B.B.B I remember seeing as a child about 20 years ago.

Now, my memory is far less than eidetic, but I might venture that the music was the only thing that was substantially different at this performance, compared to the one that lives in my memory. The music of this one was... bombastic. There were girls on stage (I was too far to tell if they were clowns) in pseudo cheerleader outfits who chanted things between acts. There was also a fair amount of rap/R-and-B being thrown from the loudspeakers at interval. Personally, I felt the music was garish, but my opinion may be somewhat painted as I really couldn't make out what was being said.

R.B.B.B's circus is still good. It is fun enough to watch. I would recommend spending a little so that you can get seats closer to the front, as being unable to actually make out the performers faces greatly diminishes the show. Still, good time, but probably a lot better if you actually have children accompanying you.

Anyway, I am bored of talking about the circus, lets talk about the tickets to the circus.

TicketMaster. May they burn in hell. If the DOJ would ever get off their arthritic good-for-nothing asses, they would immediately split up TicketMaster for being the anti-competitive monopoly that they so clearly are. Let me break down our "above and beyond the the cost of the tickets" charges.

Facility Charge
US $1.00 x 2
Convenience Charge
US $3.85 x 2
Additional Taxes
US $0.32 x 2
Order Processing Fee
US $4.88
Will Call
No Charge
Total extra charges?
US $15.22

Sweet baby Jesus? The tickets had a base price of $10 dollars, ($8 with the freely available public discount, $3 dollars with a military discount). This means that even if you paid the full price for the tickets (which you shouldn't), the additional fees still add more than a 75% premium to the cost of the ticket! 75 percent!!! If you get any sort of discount, the fees actually more than DOUBLE the cost of the ticket? They call that a convenience fee? How in the world does it work that the people selling the tickets make almost as much if not more than the actual act? How can TicketMasters charges add up to more than the cost of renting the bloody AlamoDome? Just does not add up. Reeks of price manipulation.

You are probably thinking, "Stephen, then don't buy your tickets through TicketMaster, silly". Well there is the rub, you can't! If a venue sells through TicketMaster, then they most likely only sell through TicketMaster. In my experience, for most shows these days, TicketMaster is your ONLY choice when buying tickets. How is this even remotely legal?

Tuesday, August 3, 2010

Starcraft 2

What, nothing to say today Stephen?

Is today the day you got Starcraft 2 for the PC?

Coincidence, I think not.

Monday, August 2, 2010

DSL's vs Functional Languages

Sometimes I struggle with the balancing point between Domain Specific Languages (DSLs) and functional programming. DSL's have a nebulous definition, which seems to depend on the context within which the language is being used. Functional languages are defined just as loosely, and what is and is not functional is a matter of great debate.

For my purposes, I will just define what I mean by a DSL and a functional language. What follows is not strictly THE definition of either of these things, but really, who cares.

A DSL is a language that hides a great deal of the inner workings from you in order to allow you to very succinctly and clearly specify something. In my mind, a DSL does a great deal of "magic" behind the scene to make programming very easy for you. Flavor wise, a DSL should allow you to specify a solution to a problem in the minimal (most terse) form. It should deal almost exclusively with pure business logic, as everything else is being handled "behind the scenes" by the DSL itself.

A functional language is a language that allows functions as first class objects. That allows lambdas and closures. Where functions are pure (side effect free). And, although not stricly true by definition, that does not allow modification of state without safety (that was some hand waving). Functional approaches like to keep the data visible, most every change in the program should be the result of a function call. Ideally, I can see the value passed to a function, and I can see the result returned from a function. This can be extremely useful in development, as it makes it trivially easy to determine where a error occurred: simply look for where the value was first incorrect, and determine where said value came from. The function that generated the first in error value is guaranteed to contain the code that generated the error, assuming the functions are pure.

Sometimes though I feel a domain specific approach and a functional approach are somewhat at odds. You see, the functional approach wants to keep everything as a immutable and visible data structure. Because a functional language is immutable and because functions themselves are side effect free,  one does not spend much time "hiding" details. Because of these constraints however, everything that the function needs to have to generate its result MUST be passed in as a argument. This can often result in passing a great deal of information to a function, which is verbose. DSL's, in my mind, are almost the opposite. A DSL attempts to hide a great deal of information that it silently provides to the function.

As an example, let us say that I had a function that required 10 argument when it was called (This would be a good example of a "bad code smell", but let us ignore that for now). With a functional design, you just pass in all 10 arguments. With a DSL design, you only pass in 2 and the DSL passes in the other 8. This isn't really how DSL's work, but I think it illustrates my point. The advantage to the functional is that you get to see everything that is going into the function through the arguments. The advantage to the DSL is that it is extremely terse. The simple difference is the number of arguments, but the implications of this example somewhat illustrates the difference in philosophies between these two approaches.

How can these two design approaches meet? A functional approach is attempting to make the "state" of the program viewable at all levels, no data should be hidden. A DSL approach is attempting to "hide" as much of the program as possible, such that the programmer only needs specify the actual business logic to get a working program. I am not saying that this is a insurmountable problem, simply that it is something I have been thinking of lately. How can I combine the power of a functional language with the terseness and specificity of a DSL?

Sunday, August 1, 2010

Side Effect Free Friday

What would you do if your life was completely unstructured? If you were able to put it together however you see fit, in whatever order you feel is best? I am also going to specify that you must have a job of some sort, as realistically most everyone needs a job.

Here is my optimal schedule, it is very simple. It is basically directed at the lone self employed worker.

Monday through Thursday
Do new work. This is the time for the act of creation, the filing of papers, the building of widgets, the finding of customers, the writing of code. Only definition is that it actually causes things to happen (has a side effect). This is the time you spend doing the things that most people call work. Do whatever you can to generate more value for your company. Do not spend too much time optimizing yourself away, or planning things far in the future, or worrying about whether the work you currently do is the best use of your time. Instead, just work. Pick a task that needs doing (you have a list of them right?), and do it. To make Friday easier, for every task, write down what you did, how long it took, what the side effect of doing the task was, and any other Notes. As an example "Filled my tax return : 14:00 to 17:00 on April 14 2010 : My taxes are now filled : I feel burned out". Keep doing this until Friday.

Improve the fashion in which you work. This is really imperative. If you do not take some time to actively think about the fashion in which you work, you will never improve at work. You should attempt to review all the work you did for the past Monday through Thursday, and ask yourself if there is a better (defined however you see fit) way for you to do some part of it. Look through the list of task you did. Remember how you felt before, during and after each task? Was there some tool you wish you had as you did the task? Did something seriously bother you as you did it? Ask yourself personal questions. Could I have done that work more quickly? With fewer errors? In a way that made me more happy? In a environment that I enjoyed more? Around people I respect? With something to look forward to later in the day? Anything. There are no bad ideas. If something comes to mind, it is probably at least somewhat important to you. This would be the time to learn new tools, to go to a related seminar, to re-structure your environment so that future work is easier, move your table so that you have a better view out the window, fix that noisy fan. A guitar creator might learn about a newly invented tool. A operations manager might review video feed to determine what makes employees happy. A programmer might restructure old code to make its intent and purpose more evident, so that future work with that code is easier. Remember that most work is as much a emotional as mental game. Be sure to spend as much time trying to make work pleasant as you do maximizing efficiency. 

I call it Side Effect Free Friday because it should have no immediate effect. Friday should not be spent "working". There should be no "side effect" to what you did. No outside entity should be able to see anything happening at your workplace. On Friday, you should not be generating revenue, clinching new customers, or anything of the sort. Friday is for reflection. In the same manner that you can think about your own thinking (which might be either meditation or philosophy, I am not really sure), you should spend Friday thinking about working. To be clear, not thinking "I should be working" but thinking "How can I improve my work". It is important that you set a specific time and place for this activity, as it is the activity that will pay the greatest dividends.

Consider, if you only improved the manner in which you work by .5% every Friday (a low number I would guess). By the time 40 weeks rolls around, your efficiency per unit hour would be close to 25% higher. At that time, you are already making up for the fact that you "take" every Friday off to think about work.

But the benefits are greater than that. You are also taking the time to make sure that you are current in your field. You are making yourself happier (which radiates to your family, friends, and others). For every Friday that you spend "side effect free" you make it such that actually going to work is a little less painful.  Reduced resistance to going to work will allow you to trudge through long projects or high workloads without burnout. Heck, no promises, but you may even like going to work.

Another effect is that it will allow you to more clearly figure out what it is that is making you unhappy. When there are too many painful stimuli, it can be difficult to differentiate one from another. You might think your stress is caused by a uncomfortable chair, or a flickering halogen, when in fact it is the client you are currently working with. If you had taken the Friday off and fixed the chair and halogen, you would know it was the client that is your problem!

Finally, Saturday and Sunday are your time. Don't work on them. They are for your projects, hobbies, family time, whatever. Life is long, but it is finite. Saturdays and Sundays are for defining yourself as a human being, for differentiating yourself from others.

This schedule is for the self-motivated worker, it would not work if you work on something for which you have no passion. It will not work for a great number of fields. Some fields are already so optimized that it is unlikely that giving Friday over to "self reflection" would lead to any gains. However, it works for me, and it just might work for you as well.

Saturday, July 31, 2010


Vimium is a extension for Google Chrome that allows you to navigate web sites using nothing but your keyboard. It works fairly well, it is based on Vim. I am actually more of a emacs kind of guy (if anything) but I have had no real trouble with it.

I am still playing around with Vimium, but so far it works fairly well. As I play around with it more, I may choose to re-bind some actions to key-bindings that I find more intuitive.

Probably the coolest feature is the ability to click links using nothing more than your keyboard. Basically, when you press the (default bound to) 'f' key, one or more characters show up next to each link. If you type the character that matches the given link, it is as if you clicked said link. This is pretty neat, and I could see this alone as being one of those features that you would miss deeply once you get the hang of it. And yes, before you ask, to open a link in a new tab just type 'F' instead of 'f'.

My biggest problem is getting out of object that have focus. An example of this is the HTML text area within which I a typing this blog post. If keyboard input is writing characters to the screen, Vimium does not work. At this moment, with my character in the text area field, if I press 'f', it does not issue a Vimium command (defaults to showing a list of links): instead, it just types the letter f. Now obviously, I like being able to actually type. It would be pretty nice though if Vimium had some sort of "Vimium" key that allowed me to indicate to Vimium that I wish for the following things I type to be a Vimium command, and not to be interpreted as keyboard input. Either that or I could just switch from Vimium mode to regular keyboard mode.

Overall though, Vimium is a pretty neat piece of software. I like not having to take my hands off the keyboard, I think the link clicking mechanics are pretty darn neat, and I appreciate the fact that I can always re-bind the commands to things I find more intuitive if I so desire.

Cool tool.

Friday, July 30, 2010

Unlocked Evo 4g

I am unlocking my HTC Evo 4g (from Sprint) for one simple reason...

This is far from scientific, but it seems that some apps (Sprint Zone, Some sort of Sprint football thing, Qik, footprint, news, Amazon MP3) are started automatically. By manually killing these apps using "Advanced Task Manager" android app, I can recover almost 30 megs of memory on my phone! I said to myself, "Man, this is a hassle to have to kill these apps manually every time, lets just uninstall them."

Fail. These specially installed apps cannot be removed. Sprint, in their infinite wisdom, has chosen to bundle these apps PERMANENTLY onto the phone. The arrogance is just amazing. Now I am angry.

Ok, dammit. 2010 check! Get it through your heads! I don't mind so much having apps that come loaded with my system, I get it, you want to gain traction for your in house applications. I mean, it is a little cheap, but whatever. However, let me uninstall them! Worse, don't make them start up every time I start the damn phone! This seriously makes you look like an ass. It reminds people of their worthless Dell system that came pre-loaded with an inordinate amount of spy/pay-ware. Android is supposed to be a open platform, don't hamstring it by fragmenting it at every opportunity. I am supposed to be able to uninstall apps on my own phone!

I rooted my phone using Simple Root OTA. Everything worked perfectly, only thing that was different than instructions was I had to "Factory Reset" my phone BEFORE I could begin step 1.

Well, I (think I) rooted my phone, it is basically identical to my old phone at the moment, except it has a few additional programs. I don't exactly know what to do with it yet. I guess I will have to look at the available custom Roms and play with the device before I know where to go next. Still, exiting.

Thursday, July 29, 2010

Design vs. Content

I spent the past few days working on a solution that allows a designer to easily add/remove CSS class name(s) to any HTML element. My goal was to give a designer the ability to fully specify both the .css file itself, as well as (easily) mark up the HTML with whatever CSS class names were desired. I called my father and told him about it, he replied that it was not useful, as it was not how designers (people who style HTML content) are accustomed to working.

My vision was such. A DEVELOPER should design the whole web site, including a blank CSS file, would not even touch the CSS class properties: that is the DESIGNERS job. I had visions of being able to hand the logically/structurally complete site over to a designer, saying "Do what you will shall be the whole of the law" (Translation: modify the empty .css file I included for this site, and assign whatever class names you want to any of the sites HTML structure). Evidently, this is not at all how design work is conventionally done. Designers expect you to have class and id annotations that clue them in to how they should structure the content. Maybe it was naive, but this surprised me. This was of course disheartening news (wasted time), but it was also surprising. In my mind, I had pictures of designers being the artsy sort, who would not want to have the content "structured" by me. They would want the ability to "structure" the content however they see fit: they would love the freedom to be able to add class names to the HTML without needing to consult me.


  • I did not want to have to work closely with the designer. I wanted to have the ability to simply hand the product to them and say "show me what you can do". I realize that this would be a iterative process, that I pictured that I would only have to say "This I like, this I do not". I wanted to minimize my interaction to nothing more than giving my approval or displeasure with things that have been done. Put succinctly, I wanted to only interact with them on the result of the process, not have to work with them on the process itself.

    Frankly, what I want is irrelevant. If designers are not accustomed to working with such freedom, you are doing a disservice to your site in forcing them to work in a fashion in which they are unaccustomed.

  • As a programmer, I am acutely aware of modules/namespaces/whatever collisions. If I am defining things in the class of elements, and the designers is as well, how do we keep from stepping on each others toes? Simplest solution as I saw it was to not use the class property at all, and simply allow free range to the designer to modify it as they wish.

    Realistically, if you are working closely with a designer, this probably isn't as big a deal as I make it out to be. Of course, notice the words "working closely with the designer", that is precisely what I did not want to do.

  • This is pedantic, but is the class attribute of elements actually supposed to be used as markup? To me, the class property is supposed to be used purely for style, not for setting a property within a div. This is not a popular opinion at this time, and there are plenty of examples of web sites that use the CSS as a form of markup, that is, as something that might effect the business logic of the executing program on the web site.

    I can fully see why many web sites use the class names of elements for the purpose of both styling and markup. The DRY (Don't Repeat Yourself) is a pretty darn good rule. You only want to write the markup once, you have to write it in the class property if you want the css to use it, so why would you write it twice if it is already in the class property? Unfortunately, I do not have a good answer to this. It does not seem right, but it is what it is.

What do others think? Clearly, a clean separation of style and content does not currently exist in HTML. You have developers that work on generating the correct content, and you have designers that work on the styling of things, but the fact is that they often have to interact (often to a great degree) at some point. Would it be possible to design a system that would allow designers to do their jobs without ever needing to talk to developers? Where the designer, given that the content was finalized, had complete and total domain over the design? Is this even desirable?

Wednesday, July 28, 2010


I started this blog for three reasons.

1) I would like to become better at writing. I have a tendency to write things in a rather factual (and boring) fashion. I would like to work on my ability to communicate succinctly, without ambiguity, and in a entertaining fashion.

2) I would like to increase the chance of random encounters with people who might be interested in the same things I am. Actively searching for (or even just hoping to run into) people who are like yourself is a high energy activity. Posting a interest of yours, and allowing people to contact you, is considerably less consuming. If I blog about something, and another person comments on it, it is a opportunity to connect with that person.  I look forward to that.

3) It gives me a sense of history. It allows me to view where I was and what I was thinking across a timeline. Probably not terribly interesting to other people, but I feel that it might help me. Specifically, to identify points in my life where I am repeating myself. And perhaps to also allow me to organize my thoughts more effectively.