Brett Allred Prelude in C#

11Apr/130

Web Server Basics

The job of a web server is to accept http requests and serve up http responses  (see http request response basics).  There are number of different web servers out in the world but the basic concepts are the same among them all.

When a request comes in to the web server, the Host header is examined and the request gets routed to the correct internal server.  Host based routing is what allows a single web server to host multiple websites.

When the internal server responsible for the website receives a request it has to make a choice.  First, it needs to see if the request is for a static file that exists on the web servers hard drive.  This could be an html file, javascript file, image, movie, etc.  If the static file exists it will return file to the client.

If no file exists, the web server can be configured to forward the request to another application for request processing.  If you are building a web application then the request gets forwarded to your application.  Your application can then examine the request and decide how to handle it.  This could involve saving items to a database, communicating with 3rd party web services, or rendering dynamic html views.

Web application frameworks have been built to make the process of handling request easier and creating custom web applications easier.

 

Filed under: General No Comments
9Apr/130

HTTP Request Response Basics

Passing NotesAt the most basic level, the internet works like two kids (a boy and a girl) in a class room passing notes between each other.

First, the boy writes down his question on a small piece of paper, folds, it up, labels it to the girl, and passes it down the isle. The note hops from person to person until it reaches the girl for whom it was intended.  The girl then takes out a small piece of paper and replies to the boys question and delivers it back to him in a similar manner.

Similarly, when you want to get information from the internet, you create a small message,  label it to a server, and send it out.  It hops from computer to computer until it reaches the server.  The server opens the message, reads it, and then responds in a similar manner.

Because computers aren't as intelligent as people, we have to define the exact format of the message to be sent.  This ensures the computer will know how to properly read the information contained in the message. The HTTP protocol defines this message format.

In HTTP communication there is always a request and a response.  Like our example above, the boy requests something of the girl and she responds.  Likewise, a web browser will make a request and a server will respond.

Here is a sample http request for https://www.google.com

There are three sections to an http request:

1) Request Line - This is the first line of the request.  It specifies the request method (GET, POST, PUT, DELETE, etc), the resource, and the protocol used.  It ends with CRLF (that is, a carriage return character followed by a line feed character)

2) Headers - Next are the headers.  This is a way to pass information to the server about the request.  There is one header per line.  Each line ends with a CRLF.

3) Body (optional) - Information can also be  sent the the server in body. The body is distinguished from the headers by an empty line. In the sample request above there is not body.

The HTTP protocol also specifies the format of the response from the server to the client. The response format is very similar to the request format.

1) Status Line - This is the first line of the response.  It specifies the the protocol used and the http response code.  It ends with CRLF

2) Headers - Next are the headers.  This is a way to pass information to the client about the response.  There is one header per line.  Each line ends with a CRLF.

3) Body (optional) - Information can also be  sent the the client in body. The body is distinguished from the headers by an empty line.

When doing web development, it helps to understand this concept.  When trouble shooting problems with your web site you can use various tools to examine the client request and server response.  My particular favorite are the web developer tools in the Google Chrome web browser.  By opening the developer tools you can view the network tab to examine requests and responses.

 

 

 

 

 

Filed under: General No Comments
4Nov/122

Startup Weekend Ogden – Pitches

This week was another stellar startup weekend.  Lots of energy, lots of great ideas.  Here is a summary of all of the great ideas that came out of this weekend.

Mustache Monitor - www.mustachemonitor.com

"Mustache Monitor is an iOS app to document daily stache production and create an animation of your incredible journey through Movember. What's better then having a robust stache? Sharing it with the world."

Comments: Coolest

Geo Fetch Apphttp://geofetch.com/

"GeoFetch is a GPS outdoor adventure app motivating people to complete challenges and compete with friends for rewards; creating a fun social interactive platform."

Comment:  Geekiest

Free Birthday Food - http://freebirthdayfood.com/

"Everybody has a birthday. Everybody loves food. Let's bring them together in joyous harmony all month long."

Comment: Best Validation

Get Epic Music - http://getepicmusic.com

A place to find "epic" music to use in your home videos.

Comment: Best Pivot

Sunrise Sunset - http://sunrisesunsetcalendar.com

An app to know the sunrise sunset time without an internet connection

Comment: Best Utility

Wedding Address Book - http://www.weddingaddressbook.com

An easy way to collect addresses from your wedding using your facebook friends.

Comment: This was my team

Speak Now - http://www.speaknow.me

Collect positive feedback from your customers

Comment: Funniest Intro

GoFFiti - http://www.goffiti.com 

Leave Your Mark! You can upload your mark at any geo-location point on the planet. Simply create or upload your personal “tag” through your user profile settings. When you access a geo-location point, you can quickly post your “tag” for other GoFFiti users to see at that point.

Comment: Best Cross Platform App

Bazookaguys - http://www.bazookaguys.tk

Indy Game.

Comment: Awesome!  Plain and simple.

Vinny

Get Values on used cars

Comment: Tons of cool data aggregation

Print Badger - http://www.printbadger.com

Easy way to print badges for events

Comment: Most likely to succeed

Bucketlist - http://bucket.onfirst.com

Find cool places to travel

Comment: Most awkward opening

Clip MD

Way to share medical related material

Comment: Technical Fail but looked interesting

Kitchen.ly

airbnb for food.

Comment: Could be huge

Funding My Team - http://www.fundingmyteam.com

Help kids raise money for their sports team

 

Attendee Best of Show BAZOOKA GUYS!

 

Judges Vote

#1 - Kitchen.ly

#2 - Print Badger

#3 - Sunrise Sunset

Filed under: General 2 Comments
7Aug/120

Visual Studio 2003 – Can’t Open Project File

This morning I was working on an old solution in VS2003.  When I opened it up I got an error that said project failed to load.  The fix was pretty simple.  I opened up the .vcprog file in a text editor (Sublime Text 2) and went down to the Assembly References section. and  deleted all of the assembly references. Then I  re-loaded my project, added the assemblies again and all was good. Build Works !

Filed under: Visual Studio No Comments
23Jul/120

Two Cows to Tell it All…

SOCIALISM

You have 2 cows.
You give one to your neighbour.

COMMUNISM
You have 2 cows
The State takes both and gives you some milk.

FASCISM
You have 2 cows.
The State takes both and sells you some milk

BUREAUCRATISM
You have 2 cows.
The State takes both, shoots one, milks the other and then throws the milk away.

TRADITIONAL CAPITALISM
You have two cows
You sell one and buy a bull.
Your herd multiplies, and the economy grows.
You sell them and retire on the income.

VENTURE CAPITALISM
You have two cows.
You sell three of them to your publicly listed company, using letters
of credit opened by your brother-in-law at the bank, then execute a
debt/equity swap with an associated general offer so that you get all
four cows back, with a tax exemption for five cows.
The milk rights of the six cows are transferred via an intermediary to
a Cayman Island Company secretly owned by the majority shareholder who
sells the rights to all seven cows back to your listed company.
The annual report says the company owns eight cows, with an option on one more.

AN AMERICAN CORPORATION
You have two cows.
You sell one, and force the other to produce the milk of four cows.
Later, you hire a consultant to analyse why the cow has died.

A FRENCH CORPORATION
You have two cows.
You go on strike, organize a riot, and block the roads, because you
want three cows.

AN ITALIAN CORPORATION
You have two cows, but you don’t know where they are.
You decide to have lunch.

A SWISS CORPORATION
You have 5,000 cows. None of them belong to you.
You charge the owners for storing them.

A CHINESE CORPORATION
You have two cows.
You have 300 people milking them.
You claim that you have full employment and high bovine productivity.
You arrest the newsman who reported the real situation.

AN INDIAN CORPORATION
You have two cows.
You worship them.

A BRITISH CORPORATION
You have two cows.
Both are mad.

AN IRAQI CORPORATION
Everyone thinks you have lots of cows.
You tell them that you have none.
Nobody believes you, so they bomb the crap out of you and invade your country.
You still have no cows but at least you are now a Democracy.

AN AUSTRALIAN CORPORATION
You have two cows.
Business seems pretty good.
You close the office and go for a few beers to celebrate.

A NEW ZEALAND CORPORATION
You have two cows.
The one on the left looks very attractive.

A GREEK CORPORATION
You have two cows borrowed from French and German banks.
You eat both of them.
The banks call to collect their milk, but you cannot deliver so you
call the IMF.
The IMF loans you two cows.
You eat both of them.
The banks and the IMF call to collect their cows/milk.
You are out getting a haircut.

Filed under: General No Comments
19Jul/120

An Excerpt from Atlas Shrugged – The Story of the Twentieth Century Motor Company

“Well, there was something that happened at that plant where I worked for twenty years. It was when the old man died and his heirs took over. There were three of them, two sons and a daughter, and they brought a new plan to run the factory. They let us vote on it, too, and everybody— almost everybody— voted for it. We didn’t know. We thought it was good. No, that’s not true, either. We thought that we were supposed to think it was good. The plan was that everybody in the factory would work according to his ability, but would be paid according to his need. We— what’s the matter, ma’am? Why do you look like that?”

“What was the name of the factory?” she asked, her voice barely audible.

“The Twentieth Century Motor Company, ma’am, of Starnesville, Wisconsin.”

“Go on.”

“We voted for that plan at a big meeting, with all of us present, six thousand of us, everybody that worked in the factory. The Starnes heirs made long speeches about it, and it wasn’t too clear, but nobody asked any questions. None of us knew just how the plan would work, but every one of us thought that the next fellow knew it. And if anybody had doubts, he felt guilty and kept his mouth shut— because they made it sound like anyone who’d oppose the plan was a child-killer at heart and less than a human being. They told us that this plan would achieve a noble ideal.

Well, how were we to know otherwise? Hadn’t we heard it all our lives— from our parents and our schoolteachers and our ministers, and in every newspaper we ever read and every movie and every public speech? Hadn’t we always been told that this was righteous and just? Well, maybe there’s some excuse for what we did at that meeting. Still, we voted for the plan— and what we got, we had it coming to us. You know, ma’am, we are marked men, in a way, those of us who lived through the four years of that plan in the Twentieth Century factory. What is it that hell is supposed to be? Evil— plain, naked, smirking evil, isn’t it? Well, that’s what we saw and helped to make— and I think we’re damned, every one of us, and maybe we’ll never be forgiven. . . .

“Do you know how it worked, that plan, and what it did to people? Try pouring water into a tank where there’s a pipe at the bottom draining it out faster than you pour it, and each bucket you bring breaks that pipe an inch wider, and the harder you work the more is demanded of you, and you stand slinging buckets forty hours a week, then forty-eight, then fifty-six— for your neighbor’s supper— for his wife’s operation— for his child’s measles— for his mother’s wheel chair— for his uncle’s shirt— for his nephew’s schooling— for the baby next door— for the baby to be born— for anyone anywhere around you— it’s theirs to receive, from diapers to dentures— and yours to work, from sunup to sundown, month after month, year after year, with nothing to show for it but your sweat, with nothingin sight for you but their pleasure, for the whole of your life, without rest, without hope, without end. . . . From each according to his ability, to each according to his need. . . .

“We’re all one big family, they told us, we’re all in this together. But you don’t stand, working an acetylene torch ten hours a day— together, and you don’t all get a bellyache— together. What’s whose ability and which of whose needs comes first? When it’s all one pot, you can’t let any man decide what his own needs are, can you? If you did, he might claim that he needs a yacht— and if his feelings is all you have to go by, he might prove it, too. Why not? If it’s not right for me to own a car until I’ve worked myself into a hospital ward, earning a car for every loafer and every naked savage on earth— why can’t he demand a yacht from me, too, if I still have the ability not to have collapsed? No? He can’t? Then why can he demand that I go without cream for my coffee until he’s replastered his living room? . . . Oh well . . . Well, anyway, it was decided that nobody had the right to judge his own need or ability. We voted on it. Yes, ma’am, we voted on it in a public meeting twice a year. How else could it be done? Do you care to think what would happen at such a meeting? It took us just one meeting to discover that we had become beggars— rotten, whining, sniveling beggars all of us, because no man could claim his pay as his rightful earning, he had no rights and no earnings, his work didn’t belong to him, it belonged to ‘the family,’ and they owed him nothing in return, and the only claim he had on them was his ‘need’— so he had to beg in public for relief from his needs, like any lousy moocher, listing all his troubles and miseries, down to his patched drawers and his wife’s head colds, hoping that ‘the family’ would throw him the alms. He had to claim miseries, because it’s miseries, not work, that had become the coin of the realm— so it turned into a contest among six thousand panhandlers, each claiming that his need was worse than his brother’s. How else could it be done? Do you care to guess what happened, what sort of men kept quiet, feeling shame, and what sort got away with the jackpot?

“But that wasn’t all. There was something else that we discovered at the same meeting. The factory’s production had fallen by forty per cent, in that first half-year, so it was decided that somebody hadn’t delivered ‘according to his ability.’ Who? How would you tell it? ‘The family’ voted on that, too. They voted which men were the best, and these men were sentenced to work overtime each night for the next six months. Overtime without pay— because you weren’t paid by time and you weren’t paid by work, only by need.

“Do I have to tell you what happened after that— and into what sort of creatures we all started turning, we who had once been human? We began to hide whatever ability we had, to slow down and watch like hawks that we never worked any faster or better than the next fellow. What else could we do, when we knew that if we did our best for ‘the family,’ it’s not thanks or rewards that we’d get, but punishment? We knew that for every stinker who’d ruin a batch of motors and cost the company money— either through his sloppiness, because we didn’t have to care, or through plain incompetence— it’s we who’d have to pay with our nights and our Sundays. So we did our best to be no good.

“There was one young boy who started out, full of fire for the noble ideal, a bright kid without any schooling, but with a wonderful head on his shoulders. The first year, he figured out a work process that saved us thousands of man-hours. He gave it to ‘the family,’ didn’t ask anything for it, either, couldn’t ask, but that was all right with him. It was for the ideal, he said. But when he found himself voted as one of our ablest and sentenced to night work, because we hadn’t gotten enough from him, he shut his mouth and his brain. You can bet he didn’t come up with any ideas, the second year.

“What was it they’d always told us about the vicious competition of the profit system, where men had to compete for who’d do a better job than his fellows? Vicious, wasn’t it? Well, they should have seen what it was like when we all had to compete with one another for who’d do the worst job possible. There’s no surer way to destroy a man than to force him into a spot where he has to aim at not doing his best, where he has to struggle to do a bad job, day after day. That will finish him quicker than drink or idleness or pulling stick-ups for a living. But there was nothing else for us to do except to fake unfitness. The one accusation we feared was to be suspected of ability. Ability was like a mortgage on you that you could never pay off. And what was there to work for? You knew that your basic pittance would be given to you anyway, whether you worked or not— your ‘housing and feeding allowance,’ it was called— and above that pittance, you had no chance to get anything, no matter how hard you tried. You couldn’t count on buying a new suit of clothes next year— they might give you a ‘clothing allowance’ or they might not, according to whether nobody broke a leg, needed an operation or gave birth to more babies. And if there wasn’t enough money for new suits for everybody, then you couldn’t get yours, either.

“There was one man who’d worked hard all his life, because he’d always wanted to send his son through college. Well, the boy graduated from high school in the second year of the plan— but ‘the family’ wouldn’t give the father any ‘allowance’ for the college. They said his son couldn’t go to college, until we had enough to send everybody’s sons to college— and that we first had to send everybody’s children through high school, and we didn’t even have enough for that. The father died the following year, in a knife fight with somebody in a saloon, a fight over nothing in particular— such fights were beginning to happen among us all the time.

“Then there was an old guy, a widower with no family, who had one hobby: phonograph records. I guess that was all he ever got out of life. In the old days, he used to skip meals just to buy himself some new recording of classical music. Well, they didn’t give him any ‘allowance’ for records—‘ personal luxury,’ they called it. But at that same meeting, Millie Bush, somebody’s daughter, a mean ugly little eight-year-old, was voted a pair of gold braces for her buck teeth— this was ‘medical need,’ because the staff psychologist had said that the poor girl would get an inferiority complex if her teeth weren’t straightened out. The old guy who loved music, turned to drink, instead. He got so you never saw him fully conscious anymore. But it seems like there was one thing he couldn’t forget. One night, he came staggering down the street, saw Millie Bush, swung his fist and knocked all her teeth out. Every one of them.

“Drink, of course, was what we all turned to, some more, some less. Don’t ask how we got the money for it. When all the decent pleasures are forbidden, there’s always ways to get the rotten ones. You don’t break into grocery stores after dark and you don’t pick your fellow’s pockets to buy classical symphonies or fishing tackle, but if it’s to get stinking drunk and forget— you do. Fishing tackle? Hunting guns? Snapshot cameras? Hobbies? There wasn’t any ‘amusement allowance’ for anybody. ‘Amusement’ was the first thing they dropped. Aren’t you always supposed to be ashamed to object when anybody asks you to give up anything, if it’s something that gave you pleasure? Even our ‘tobacco allowance’ was cut to where we got two packs of cigarettes a month— and this, they told us, was because the money had to go into the babies’ milk fund. Babies was the only item of production that didn’t fall, but rose and kept on rising— because people had nothing else to do, I guess, and because they didn’t have to care, the baby wasn’t their burden, it was ‘the family’s.’ In fact, the best chance you had of getting a raise and breathing easier for a while was a ‘baby allowance.’ Either that or a major disease.

“It didn’t take us long to see how it all worked out. Any man who tried to play straight, had to refuse himself everything. He lost his taste for any pleasure, he hated to smoke a nickel’s worth of tobacco or chew a stick of gum, worrying whether somebody had more need for that nickel. He felt ashamed of every mouthful of food he swallowed, wondering whose weary night of overtime had paid for it, knowing that his food was not his by right, miserably wishing to be cheated rather than to cheat, to be a sucker, but not a blood-sucker. He wouldn’t marry, he wouldn’t help his folks back home, he wouldn’t put an extra burden on ‘the family.’ Besides, if he still had some sort of sense of responsibility, he couldn’t marry or bring children into the world, when he could plan nothing, promise nothing, count on nothing. But the shiftless and the irresponsible had a field day of it. They bred babies, they got girls into trouble, they dragged in every worthless relative they had from all over the country, every unmarried pregnant sister, for an extra ‘disability allowance, ’ they got more sicknesses than any doctor could disprove, they ruined their clothing, their furniture, their homes— what the hell, ‘the family’ was paying for it! They found more ways of getting in ‘need’ than the rest of us could ever imagine— they developed a special skill for it, which was the only ability they showed.

“God help us, ma’am! Do you see what we saw? We saw that we’d been given a law to live by, a moral law, they called it, which punished those who observed it— for observing it. The more you tried to live up to it, the more you suffered; the more you cheated it, the bigger reward you got. Your honesty was like a tool left at the mercy of the next man’s dishonesty. The honest ones paid, the dishonest collected. The honest lost, the dishonest won. How long could men stay good under this sort of a law of goodness? We were a pretty decent bunch of fellows when we started. There weren’t many chiselers among us. We knew our jobs and we were proud of it and we worked for the best factory in the country, where old man Starnes hired nothing but the pick of the country’s labor. Within one year under the new plan, there wasn’t an honest man left among us. That was the evil, the sort of hell-horror evil that preachers used to scare you with, but you never thought to see alive. Not that the plan encouraged a few bastards, but that it turned decent people into bastards, and there was nothing else that it could do— and it was called a moral ideal!

“What was it we were supposed to want to work for? For the love of our brothers? What brothers? For the bums, the loafers, the moochers we saw all around us? And whether they were cheating or plain incompetent, whether they were unwilling or unable— what difference did that make to us? If we were tied for life to the level of their unfitness, faked or real, how long could we care to go on? We had no way of knowing their ability, we had no way of controlling their needs— all we knew was that we were beasts of burden struggling blindly in some sort of place that was half-hospital, halfstockyards— a place geared to nothing but disability, disaster, disease— beasts put there for the relief of whatever whoever chose to say was whichever’s need. “Love of our brothers? That’s when we learned to hate our brothers for the first time in our lives. We began to hate them for every meal they swallowed, for every small pleasure they enjoyed, for one man’s new shirt, for another’s wife’s hat, for an outing with their family, for a paint job on their house— it was taken from us, it was paid for by our privations, our denials, our hunger. We began to spy on one another, each hoping to catch the others lying about their needs, so as to cut their ‘allowance’ at the next meeting. We began to have stool pigeons who informed on people, who reported that somebody had bootlegged a turkey to his family on some Sunday— which he’d paid for by gambling, most likely. We began to meddle into one another’s lives. We provoked family quarrels, to get somebody’s relatives thrown out. Any time we saw a man starting to go steady with a girl, we made life miserable for him. We broke up many engagements. We didn’t want anyone to marry, we didn’t want any more dependents to feed.

“In the old days, we used to celebrate if somebody had a baby, we used to chip in and help him out with the hospital bills, if he happened to be hard-pressed for the moment. Now, if a baby was born we didn’t speak to the parents for weeks. Babies, to us, had become what locusts were to farmers. In the old days, we used to help a man if he had a bad illness in the family. Now— well, I’ll tell you about just one case. It was the mother of a man who had been with us for fifteen years. She was a kindly old lady, cheerful and wise, she knew us all by our first names and we all liked her— we used to like her. One day, she slipped on the cellar stairs and fell and broke her hip. We knew what that meant at her age. The staff doctor said that she’d have to be sent to a hospital in town, for expensive treatments that would take a long time. The old lady died the night before she was to leave for town. They never established the cause of death. No, I don’t know whether she was murdered. Nobody said that. Nobody would talk about it at all. All I know is that I— and that’s what I can’t forget!— I, too, had caught myself wishing that she would die. This— may God forgive us!— was the brotherhood, the security, the abundance that the plan was supposed to achieve for us!

“Was there any reason why this sort of horror would ever be preached by anybody? Was there anybody who got any profit from it? There was. The Starnes heirs. I hope you’re not going to remind me that they’d sacrificed a fortune and turned the factory over to us as a gift. We were fooled by that one, too. Yes, they gave up the factory. But profit, ma’am, depends on what it is you’re after. And what the Starnes heirs were after, no money on earth could buy. Money is too clean and innocent for that.

“Eric Starnes, the youngest— he was a jellyfish that didn’t have the guts to be after anything in particular. He got himself voted as Director of our Public Relations Department, which didn’t do anything, except that he had a staff for the not doing of anything, so he didn’t have to bother sticking around the office. The pay he got— well, I shouldn’t call it ‘pay,’ none of us was ‘paid’— the alms voted to him was fairly modest, about ten times what I got, but that wasn’t riches. Eric didn’t care for money— he wouldn’t have known what to do with it. He spent his time hanging around among us, showing how chummy he was and democratic. He wanted to be loved, it seems. The way he went about it was to keep reminding us that he had given us the factory. We couldn’t stand him.

“Gerald Starnes was our Director of Production. We never learned just what the size of his rake-off— his alms— had been. It would have taken a staff of accountants to figure that out, and a staff of engineers to trace the way it was piped, directly or indirectly into his office. None of it was supposed to be for him— it was all for company expenses. Gerald had three cars, four secretaries, five telephones, and he used to throw champagne and caviar parties that no tax-paying tycoon in the country could have afforded. He spent more money in one year than his father had earned in profits in the last two years of his life. We saw a hundred-pound stack— a hundred pounds, we weighed them— of magazines in Gerald’s office, full of stories about our factory and our noble plan, with big pictures of Gerald Starnes, calling him a great social crusader. Gerald liked to come into the shops at night, dressed in his formal clothes, flashing diamond cuff links the size of a nickel and shaking cigar ashes all over. Any cheap show-off who’s got nothing to parade but his cash, is bad enough— except that he makes no bones about the cash being his, and you’re free to gape at him or not, as you wish, and mostly you don’t. But when a bastard like Gerald Starnes puts on an act and keeps spouting that he doesn’t care for material wealth, that he’s only serving ‘the family,’ that all the lushness is not for himself, but for our sake and for the common good, because it’s necessary to keep up the prestige of the company and of the noble plan in the eyes of the public— then that’s when you learn to hate the creature as you’ve never hated anything human.

"But his sister Ivy was worse. She really did not care for material wealth. The alms she got was no bigger than ours, and she went about in scuffed, flat-heeled shoes and shirtwaists— just to show how selfless she was. She was our Director of Distribution. She was the lady in charge of our needs. She was the one who held us by the throat. Of course, distribution was supposed to be decided by voting— by the voice of the people. But when the people are six thousand howling voices, trying to decide without yardstick, rhyme or reason, when there are no rules to the game and each can demand anything, but has a right to nothing, when everybody holds power over everybody’s life except his own— then it turns out, as it did, that the voice of the people is Ivy Starnes. By the end of the second year, we dropped the pretense of the ‘family meetings’— in the name of ‘production efficiency and time economy,’ one meeting used to take ten days— and all the petitions of need were simply sent to Miss Starnes’ office. No, not sent. They had to be recited to her in person by every petitioner. Then she made up a distribution list, which she read to us for our vote of approval at a meeting that lasted three-quarters of an hour. We voted approval. There was a ten-minute period on the agenda for discussion and objections. We made no objections. We knew better by that time. Nobody can divide a factory’s income among thousands of people, without some sort of a gauge to measure people’s value. Her gauge was bootlicking. Selfless? In her father’s time, all of his money wouldn’t have given him a chance to speak to his lousiest wiper and get away with it, as she spoke to our best skilled workers and their wives. She had pale eyes that looked fishy, cold and dead. And if you ever want to see pure evil, you should have seen the way her eyes glinted when she watched some man who’d talked back to her once and who’d just heard his name on the list of those getting nothing above basic pittance. And when you saw it, you saw the real motive of any person who’s ever preached the slogan: ‘From each according to his ability, to each according to his need.’

“This was the whole secret of it. At first, I kept wondering how it could be possible that the educated, the cultured, the famous men of the world could make a mistake of this size and preach, as righteousness, this sort of abomination— when five minutes of thought should have told them what would happen if somebody tried to practice what they preached. Now I know that they didn’t do it by any kind of mistake. Mistakes of this size are never made innocently. If men fall for some vicious piece of insanity, when they have no way to make it work and no possible reason to explain their choice— it’s because they have a reason that they do not wish to tell. And we weren’t so innocent either, when we voted for the plan at the first meeting. We didn’t do it just because we believed that the drippy old guff they spewed was good. We had another reason, but the guff helped us to hide it from our neighbors and from ourselves. The guff gave us a chance to pass off as virtue something that we’d be ashamed to admit otherwise. There wasn’t a man voting for it who didn’t think that under a setup of this kind he’d muscle in on the profits of the men abler than himself. There wasn’t a man rich and smart enough but that he didn’t think that somebody was richer and smarter, and this plan would give him a share of his better’s wealth and brain. But while he was thinking that he’d get unearned benefits from the men above, he forgot about the men below who’d get unearned benefits, too. He forgot about all his inferiors who’d rush to drain him just as he hoped to drain his superiors. The worker who liked the idea that his need entitled him to a limousine like his boss’s, forgot that every bum and beggar on earth would come howling that their need entitled them to an icebox like his own. That was our real motive when we voted— that was the truth of it— but we didn’t like to think it, so the less we liked it, the louder we yelled about our love for the common good.

“Well, we got what we asked for. By the time we saw what it was that we’d asked for, it was too late. We were trapped, with no place to go. The best men among us left the factory in the first week of the plan. We lost our best engineers, superintendents, foremen and highest-skilled workers. A man of self-respect doesn’t turn into a milch cow for anybody. Some able fellows tried to stick it out, but they couldn’t take it for long. We kept losing our men, they kept escaping from the factory like from a pest-hole— till we had nothing left except the men of need, but none of the men of ability.

“And the few of us who were still any good, but stayed on, were only those who had been there too long. In the old days, nobody ever quit the Twentieth Century— and, somehow, we couldn’t make ourselves believe that it was gone. After a while, we couldn’t quit, because no other employer would have us— for which I can’t blame him. Nobody would deal with us in any way, no respectable person or firm. All the small shops, where we traded, started moving out of Starnesville fast— till we had nothing left but saloons, gambling joints and crooks who sold us trash at gouging prices. The alms we got kept falling, but the cost of our living went up. The list of the factory’s needy kept stretching, but the list of its customers shrank. There was less and less income to divide among more and more people. In the old days, it used to be said that the Twentieth Century Motor trademark was as good as the karat mark on gold. I don’t know what it was that the Starnes heirs thought, if they thought at all, but I suppose that like all social planners and like savages, they thought that this trademark was a magic stamp which did the trick by some sort of voodoo power and that it would keep them rich, as it had kept their father. Well, when our customers began to see that we never delivered an order on time and never put out a motor that didn’t have something wrong with it— the magic stamp began to work the other way around: people wouldn’t take a motor as a gift, if it was marked Twentieth Century. And it came to where our only customers were men who never paid and never meant to pay their bills. But Gerald Starnes, doped by his own publicity, got huffy and went around, with an air of moral superiority, demanding that businessmen place orders with us, not because our motors were good, but because we needed the orders so badly.

“By that time, a village half-wit could see what generations of professors had pretended not to notice. What good would our need do to a power plant when its generators stopped because of our defective engines? What good would it do to a man caught on an operating table when the electric light went out? What good would it do to the passenger of a plane when its motor failed in mid-air? And if they bought our product, not because of its merit, but because of our need, would that be the good, the right, the moral thing to do for the owner of that power plant, the surgeon in that hospital, the maker of that plane?

“Yet this was the moral law that the professors and leaders and thinkers had wanted to establish all over the earth. If this is what it did in a single small town where we all knew one another, do you care to think what it would do on a world scale? Do you care to imagine what it would be like, if you had to live and to work, when you’re tied to all the disasters and all the malingering of the globe? To work— and whenever any men failed anywhere, it’s you who would have to make up for it. To work— with no chance to rise, with your meals and your clothes and your home and your pleasure depending on any swindle, any famine, any pestilence anywhere on earth. To work— with no chance for an extra ration, till the Cambodians have been fed and the Patagonians have been sent through college. To work— on a blank check held by every creature born, by men whom you’ll never see, whose needs you’ll never know, whose ability or laziness or sloppiness or fraud you have no way to learn and no right to question— just to work and work and work— and leave it up to the Ivys and the Geralds of the world to decide whose stomach will consume the effort, the dreams and the days of your life. And this is the moral law to accept? This— a moral ideal?

“Well, we tried it— and we learned. Our agony took four years, from our first meeting to our last, and it ended the only way it could end: in bankruptcy. At our last meeting, Ivy Starnes was the one who tried to brazen it out. She made a short, nasty, snippy little speech in which she said that the plan had failed because the rest of the country had not accepted it, that a single community could not succeed in the midst of a selfish, greedy world— and that the plan was a noble ideal, but human nature was not good enough for it. A young boy— the one who had been punished for giving us a useful idea in our first year— got up, as we all sat silent, and walked straight to Ivy Starnes on the platform. He said nothing. He spat in her face. That was the end of the noble plan and of the Twentieth Century.”

Rand, Ayn (2005-04-21). Atlas Shrugged: (Centennial Edition) (pp. 660-661). Penguin Group. Kindle Edition.

Filed under: General No Comments
6Jul/120

.gitconfig – Configuration Settings w/ P4Merge & P4Diff

[merge]
keepBackup = false;
tool = p4merge

[mergetool "p4merge"]
cmd = p4merge "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
keepTemporaries = false
trustExitCode = false
keepBackup = false
[diff]
external = p4diff

[difftool "p4diff"]
external = '"C:/Program Files/Perforce/p4merge.exe" "$LOCAL" "$REMOTE"'

Filed under: General No Comments
7Jun/120

Best Line from NDC OSLO Keynote

"If you start a project and the first thing you are worrying about is your database schema or what backend technologies you are going to use, you are solving the wrong problem. You are solving your problems, not your users problems. You are going to think about the users last."

Filed under: General No Comments
4May/121

MVC4 with StructureMap

So I fired up MVC4 today excited to get started with APIController.

As usual the first two nuget packages I loaded were RavenDB and StructureMap.  I noticed that there was a nuget package for structuremap called structuremap.mvc4 which said it worked out of the box with MVC4 Api Controllers.

It didn't. :(

I kept getting Activation Exceptions like:

Activation error occured while trying to get instance of type IHttpControllerFactory, key ""

After a little research here is how I solved it and what I learned.

In MVC3 we were given an new interface IDependencyResolver which lives in System.Web.Mvc.  By implementing this interface , our IOC container could plug directly into the framework as follows:

With MVC4 there is a second resolver which needs to be configured using:

Where this gets a little confusing is that this also takes an IDependencyResolver but NOT the one which lives in System.Web.Mvc.  It needs to IDependencyResolver which lives in System.Web.Http.Services.

The interfaces are identical, they are just in different namespaces.

StructureMap has a built in ServiceLocator called StructureMapServiceLocator which is the default when using the nuget package.  I could not get this to work.

Instead I used a little adapter class from Phil Haack's Blog 

which looks like this:

Now you can modify the second service resolver to use this adapter class

With the nuget package, this all lives in the App_Start\StructureMapMvc.cs Here is the finished version

Filed under: ASP.NET MVC, General 1 Comment
16Apr/121

The Countess and the Impossible

No one in our Utah town knew where the Countess had come from; her carefully precise English indicated that she was not a Native American. From the size of her house and staff we knew that she must be wealthy, but she never entertained and she made it clear that when she was home she was completely inaccessible. …

The Countess always carried a cane; not only for support but as a means of chastising any youngster she thought needed disciplining. And at one time or another most of the kids in our neighborhood seemed to display that need. By running fast and staying alert I had managed to keep out of her reach. But one day when I was 13, as I was shortcutting through her hedge, she got close enough to rap my head with her stick. ‘Ouch!’ I yelled, jumping a couple of feet.

‘Young man, I want to talk to you,’ she said. I was expecting a lecture on the evils of trespassing, but as she looked at me, half-smiling, she seemed to change her mind.

‘Don’t you live in that green house with the willow trees in the next block?’

‘Yes, ma’am.’

‘Do you take care of your lawn? Water it? Clip it? Mow it?’

‘Yes, ma’am.’

‘Good. I’ve lost my gardener. Be at my house Thursday morning at seven, and don’t tell me you have something else to do; I’ve seen you slouching around on Thursdays.’

When the Countess gave an order, it was carried out. I didn’t dare not come on that next Thursday. I went over the whole lawn three times with a mower before she was satisfied, and then she had me down on all fours looking for weeds until my knees were as green as the grass. She finally called me up to the porch.
‘Well, young man, how much do you want for your day’s work?’

‘I don’t know. Fifty cents maybe.’

‘Is that what you figure you’re worth?’

‘Yes’m. About that.’

‘Very well. Here’s the 50 cents you say you’re worth, and here’s the dollar and a half more that I’ve earned for you by pushing you. Now I’m going to tell you something about how you and I are going to work together. There are as many ways of mowing a lawn as there are people, and they may be worth anywhere from a penny to five dollars. Let’s say that a three-dollar job would
be just what you’ve done today, except that you would do it all by yourself. A four-dollar job would be so perfect that you’d have to be something of a fool to spend that much time on a lawn. A five-dollar lawn is—well, it’s impossible so we’ll forget about that. Now then, each week I’m going to pay you according to your own evaluation of your work.’

I left with my two dollars, richer than I remembered being in my whole life, and determined that I would get four dollars out of her the next week. But I failed to reach even the three-dollar mark. My will began faltering the second time around her yard.

‘Two dollars again, eh? That kind of job puts you right on the edge of being dismissed, young man.’

‘Yes’m. But I’ll do better next week.’

And somehow I did. The last time around the lawn I was exhausted, but I found I could spur myself on. In the exhilaration of that new feeling I had no hesitation in asking the Countess for three dollars.
Each Thursday for the next four or five weeks I varied between a three- and three-and-a-half-dollar job. The more I became more acquainted with her lawn, places where the ground was a little high or a little low, places where it needed to be clipped short or left long on the edges to make a more satisfying curve along the garden, the more I became aware of just what a four-dollar lawn would consist of. And each week I would resolve to do just that kind of job. But by the time I had made my three- or three-and-a-half-dollar mark I was too tired to remember ever having had the ambition to go beyond that point.

‘You look like a good, consistent three-fifty man,’ she would say as she handed me the money.

‘I guess so,’ I would say, too happy at the sight of the money to remember that I had shot for something higher.

‘Well, don’t feel too bad,’ she would comfort me. ‘After all, there are only a handful of people in the world who could do a four-dollar job.’

And her words were a comfort at first. But then, without my noticing what was happening, her comfort became an irritant that made me resolve to do that four-dollar job, even if it killed me. In the fever of my resolve I could see myself expiring on her lawn, with the Countess leaning over me, handing me the four dollars with a tear in her eye, begging my forgiveness for having thought I couldn’t do it.

It was in the middle of such a fever, one Thursday night when I was trying to forget that day’s defeat and get some sleep, that the truth hit me so hard I sat upright, half choking in my excitement. It was the five-dollar job I had to do, not the four-dollar one! I had to do the job that no one could do because it was impossible.

I was well acquainted with the difficulties ahead. I had the problem, for example, of doing something about the worm mounds in the lawn. The Countess might not even have noticed them yet, they were so small; but in my bare feet I knew about them and I had to do something about them. And I could go on trimming the garden edges with shears, but I knew that a five-dollar lawn demanded that I line up each edge exactly with a yardstick and then trim it precisely with the edger. And there were other problems that only I and my bare feet knew about.

I started the next Thursday by ironing out the worm mounds with a heavy roller. After two hours of that I was ready to give up for the day. Nine o’clock in the morning and my will was already gone! It was only by accident that I discovered how to regain it. Sitting under a walnut tree for a few minutes after finishing the rolling, I fell asleep. When I woke up minutes later the lawn looked so good through my fresh eyes and felt so good under my feet that I was anxious to get on with the job.

I followed this secret for the rest of the day, dozing for a few minutes every hour to regain my perspective and replenish my strength. Between naps I mowed four times, two times lengthwise, two times across, until the lawn looked like a green velvet checkerboard. Then I dug around every tree, crumbling the big clods and smoothing the soil with my hands, then finished with the edger, meticulously lining up each stroke so that the effect would be perfectly symmetrical. And I carefully trimmed the grass between the flagstones of the front walk. The shears wore my fingers raw, but the walk never looked better.

Finally about eight o’clock that evening … it was all completed. I was so proud I didn’t even feel tired when I went up to her door.

‘Well, what is it today?” she asked.

‘Five dollars,’ I said, trying for a little calm and sophistication.

‘Five dollars? You mean four dollars, don’t you? I told you that a five-dollar lawn isn’t possible.’
‘Yes it is. I just did it.’

‘Well, young man, the first five-dollar lawn in history certainly deserves some looking around.’

We walked about the lawn together in the last light of evening and even I was quite overcome by the impossibility of what I had done.

‘Young man,’ she said, putting her hand on my shoulder, ‘what on earth made you do such a crazy, wonderful thing?’

I didn’t know why but even if I had I could not have explained it in the excitement of hearing that I had done it.

‘I think I know,’ she continued, ‘how you felt when this idea first came to you of mowing a lawn that I told you was impossible. It made you very happy when it first came, then a little frightened. Am I right?’

She could see she was right by the startled look on my face.

‘I know how you felt because the same thing happens to almost everybody. They feel this sudden burst in them of wanting to do some great thing. They feel a wonderful happiness, but then it passes because they have said, No, I can’t do that. It’s impossible.” Whenever something in you says It’s impossible,” remember to take a careful look. See if it isn’t really God asking you to grow an inch, or a foot, or a mile that you may come to a fuller life.’ …

Since that time some 25 years ago when I have felt myself at an end with nothing before me, suddenly with the appearance of that word ‘impossible’ I have experienced again the unexpected lift, the leap inside me, and known that the only possible way lay through the very middle of the impossible” (Richard Thurman, The Countess and the Impossible,” Reader’s Digest, June 1958, pp. 107–10).


Filed under: General 1 Comment