STANDARD DISCLAIMER

Everything in this blog is my opinion and does not in any way, shape, or form represent the opinion or officially stated position of Microsoft, Google , or Kim Jong Il
this is fairly obvious when one considers I have no official capacity in any of these organizations.

Thursday, May 30, 2013

There is no way this happened randomly

One of the things I hear often re the universe , creation et al is the standard “There is no way this happened randomly just look around you man LOOK I SAY ! fractal clouds and cauliflower florets”

Which is all well and good and I am not going to debate the god superstition here however sometimes  its nice to look at the power of random( warning some minimal math and coding involved but you should be able to skip and skill get the flavour of what I am saying ) Editors Note Yeah Maybe

So let us start with a triangle . You know the things that aren’t squares rectangles or circles or anything other than triangles. So we have something like this

                            A

Bimage C

 

Cool Eh !

Now assume there is a point far far way somewhere in the universe . Now roll a perfectly fair die. Here is what we are going to do .

If the die shows up a 1 or a 2 we are going to pick a point halfway between the original point and A and color the midway point blue

if the dice is 3 or 4 then pick halfway between the current point and B and color it red

if the dice is 5 or 6 then pick halfway between the current point and C and color it green

Please note that the numbers on the dice are not relevant All we are doing is randomly picking one number from 3 where all 3 numbers are equally probable to occur in our random picking.

With me So far?

So lets say we rolled a 1 a 3 and a 6. After 3 attempts our triangle with dots ( in  G minor :-) ) now looks something like

image

AS the avid and observant readers will have figured out by now : you keep rolling the dice and the colours just randomly start filling up the triangle . On obvious point to note is that once a dot lands inside the triangle all further dots will lie inside the triangle too.There is nothing clever about this , since we are always computing half way point to each edge point we stay within the boundary of the triangle

 

So at his point we have this really clever way of randomly dumping dots on a triangle and really you can get any kid with a crayon and paper ( or wall ) to do this

 

But lets say we run this process a million times ( computers are pretty good at that source code later ). SO a million dots of the primary colours randomly placed over the screen. What do we expect the resultant picture to look like? Anyone?

Well my guess was this amorphous blob of black or gray or maybe even some weird mixing of colours or whatever but definitely almost no structure . And if we ran the program again well this time would get totally different dots of course so like some other random scribbling

 

 

I’ll spare you the suspense . HERE IS WHAT YOU GET EVERY SINGLE TIME NO MATTER THE ORDER OF THE DOTS

 

PRETTY EFFING COOL EH!

Pseudo code in the link…

 

Finally if you have more than a passing knowledge of the math needed to understand Fractals or affine transforms or IFS etc and you know who Michael Barnsley is please spare me everything that is wrong with my simplified explanation :-)

IT still always gets me all excited when a random dice roll can get us this . Maybe this is what the rest of the world is talking about when they talk about a “spiritual experience “

SIERPINSKI YEH TUNE KYA KI

 

image

OH YEAH!

You can generate this in code really easily

Start with a type

internal class VInfo
    {
        public int x;
        public int y;
        public Color c;
    }

int width = 2000;
int height = 1000;

Initialize thusly

Veritices[0].x = width / 2;
Veritices[0].y = 0;
  Veritices[0].c = Colors.Blue;
  

Veritices[1].x = 0;
Veritices[1].y = height;
  Veritices[1].c = Colors.Red;
  

Veritices[2].x = width;
Veritices[2].y = height;
  Veritices[2].c = Colors.Green;

So at this point you have the triangle set up right .

Now just run  a loop somewhere like so

Random r = new Random();
            Random InitPoint = new Random();
            VInfo pCurrent = new VInfo();
            pCurrent.x = InitPoint.Next(1000);
            pCurrent.y = InitPoint.Next(1000);

for (int i = 0; i < 10000000; i++ )
            {
                int p = r.Next() % 3;

                pCurrent.x = (pCurrent.x + Veritices[p].x) / 2;
                pCurrent.y = (pCurrent.y + Veritices[p].y) / 2;
                setpixel( bits,pCurrent.x,pCurrent.y,Veritices[p].c);

            }

So all you are doing  is getting a random point computing the halfway point between the random point and the vertices you need to and setting the pixel to that colour  AND…. repeat

Its really quite amazing how this simple random process can generate that image…

Sunday, May 12, 2013

But But they are stealing my hard earned money

 

This whole notion of how taxation equals theft and you know “hard earned money” just drives me nuts. IT IS NOT THEFT TO PAY YOUR TAXES

Libertarians love to drool on and on about you know contract law etc, well here's is the implied contract when you become a citizen of this country , YOU HAVE TO PAY TAXES, AND ELECTED LEGISLATORS GET TO DECIDE HOW MUCH THOSE TAXES ARE AND HOW THEY SPEND THAT MONEY

Your choices are

i) go to a jurisdiction that has no taxes, Dubai for example

ii) participate in the electoral process by electing people who agree with you in terms of tax rates and how your tax dollars should be spent

I happen to think that abstinence only education or creationism or the war on drugs or the war in Iraq  or no bid contracts to Halliburton or the house GOP spending money on defending DOMA or drug testing welfare recipients are all ABSOLUTELY HORRENDOUS, NO RETURN VALUE, ways to spend our money and so you wont find me in general voting for candidates or parties that support these positions

But it’s not theft. They did not steal my money . I would have to pay those taxes no matter what and you what I am just fine with that. That was the contract I signed on to when I got here , that I would pay taxes

Insisting that taxes are theft is like saying the cable company is stealing from me because you know I did not like every single hour of programming on every channel .

Just like you get to not like some programming you get to not like ( and or rant about )certain expenditures , AND you get to participate in whatever legal fashion you choose to change the laws so as to change govt. spending ( for example WA state just made weed legal , yes yes yes CO here’s looking at you too :-) ). But enough with the Theft bullshit already!

Morons !

Monday, October 15, 2012

Threnody A tale in three or more parts

Chapter 2 : Iran

 

The Story so far

Blonde Was amazed at the quality of Dawlish’s intel. How the hell had the old man figured out Iran. Security had been air tight . Who the hell could have talked ? Dawlish was droning on in the background about “procedural violations”  and “breaches in the code of conduct “.
Blonde took a deep breath, his legendary powers of concentration coming to the fore
“There is just one thing Home Secretary”
“Cant it wait 007 I am just moving to the alliterative crescendo of my denunciation now “
“Sadly no , I fear I have found the fatal flaw in your argument about Iran “
“Really” ? “Oh yes most certainly”, “Are you sure 007”.” I think so Dawlish” “Well I cant wait to hear it then” “I was never in Iran last year”
The phone rang , it was the Imperial March from Star wars of course. Blonde was mildly interested at the coincidence , it was his habit to play this at his flat just before he undressed for the ladies.
“M here, I see hmm are you sure , this has been verified. Very well ”
“Gentleman an international crisis of incredible proportions has arisen , I fear this review will have to wait , Blonde your country needs you again “
“Blonde!”
“BLONDE !!!!”
“Oh sorry chief I was thinking about the time when Princess Leia… er never mind”
“What is the crisis dear lady” Lord Dawlish croaked
M took a deep breath . “ 14 hours Samsung and PSY ( gangnam style) and some other unknown entities successfully lobbied the govt of South Korea to retaliate for the whole rectangular button thing. The Koreans have now copyrighted and patented the use of the word baby in a pop song.  While no confirmation exists there a strong rumor that the North Koreans are planning to retaliate  against South Korea for thinking of this first by copyrighting about 50% of all rap video finger gestures or all of sign language no one is sure which yet “
Blonde smiled his incredibly lazy languid  yet strangely attractive smile. “You find this funny 007” Lord D snapped angrily.
“Well clearly the North Koreans don’t understand what retaliation means now do they” Blonde chortled
“That may well be 007” M said “ but have you considered the scope of this tragedy, if the South Koreans win this lawsuit it will be the end of civilization as we know it !!!!”
“oh come now chief isn't that a little..”
“The end I say , have you seen the modifications to the Brittany Spears song , that the Koreans have proposed “
Oh “person aged less than 5” “person aged less than 5”
Oh “person aged less than 5” “person aged less than 5”
Oh “person aged less than 5” “person aged less than 5”
Oh “person aged less than 5” “person aged less than 5”
How was I supposed to know
That somethin' wasn't right here
Oh “person aged less than 5” “person aged less than 5”
I shouldn't have let you go
And now you're right out of sight yeah

Lord Dawlish staggered to pour himself a drink,  “Blonde you must fix this “
“How”
“M?”
M sighed “ He’s right you know 007 you need to fix this “
“Yes but How”
“The key of course is Apple , or samsung or PSY or the WTO hearing next week in Doha”
“Where do you think you should start ?”
Blonde thought hard and long
“I am going to start in Brazil” he announced
“But but but …”
“Precisely Lord D , you are smarter than I thought , it is about butts after all “ I am a guest judge at the http://www.missbumbumbrasil.com.br/candidatas/


Next Time “ Brazil”

Friday, August 17, 2012

Parasites all

PARASITE :

  • from the ancient Greek , a person who received free meals in return for amusing or impudent conversation
  • Latin : parasitos, “person who eats at the table of another”

 

So suppose you worked at Microsoft( Editors Note: The editors wish to categorically and absolutely deny  any liability whatsoever , if you should suffer temporary and or permanent damage by playing around with the authors hypothetical's ), now imagine if you will , that one fine day you happen to be interviewing a candidate for the position of  Software development Engineer( what it happens , people still want to work for MSFT you know !). Say your interview goes thusly

You : smiling genially to break the ice “ So tell me , my dear fellow, why do you want to work for Microsoft”?

Candidate : Leaps to his feet and gesticulates like a mad man and start tearing up little pieces of paper and flinging them hither and thither “Microsoft is the world’s most evil corporation, it murders innovation and little babies, it stifles all competition and water boards all open source projects, further more MSFT shamelessly copies APPL ( blessed be his name and blessed be his works ) , MSFT is responsible for global warming the Rwandan massacre and , this is not that well known , but Dancing with the Stars(DWTS) too”. Deep Breath!! “Also they sell the worst products in the world causing death, doom, destruction, despair, war, famine, genocide and  oh they make their employees work on Saturdays sometimes,  and they STACK RANK !!!!!!

You :  “Ah er yes ( DWTS  hmm that is problematic ) so hmm yes so but yes ah ha and so also.!!! Hmm , so why er software development my dear fellow

Candidate “I will do absolutely nothing as an SDE write no code whatsoever thus fixing Microsoft.”

You : “Hmm yes I see what you mean , well er that is say do you mind while I dial security old boy”

I leave it as an exercise to the reader on whether “candidate” was offered a job.

In fact all of us even if we are somewhat gray matter challenged and oh I don't know from Kentucky or Louisiana or some such “Darwin Denier State” would probably conclude that said candidate was unlikely to be offered a job

In other News! Generic Tea Party candidate stump speech

I hate Govt , Govt. is the problem , Govt causes tooth decay, depression, rape, incest, war, drug addiction, abortion, traffic jams, unemployment, marital infidelity, bad beats at poker, BLAH, BLAH, BLAH. WE SHOULD ALL HATE GOVT , GOVT SHOULD NOT EXIST I DO NOT UNDERSTAND MATH OR THE DEBT CEILING , all i know is govt very very very bad.

PLEASE GIVE ME  A GOVT JOB WITH GOVT BENEFITS.

and please do this every two years

Thank you

PS: Down with the govt you know it causes Down Syndrome right

PPS : Cutting taxes will fix tooth decay, depression, rape, incest, war, drug addiction, abortion, traffic jams, unemployment, marital infidelity, bad beats at poker, BLAH, BLAH, BLAH.

WTF!!!

I cannot think of any other place where claiming to hate the job and the institution you are applying for qualifies you the job!! You know, there is somewhat of an honest debate to be had about what the role and size of the govt should be but I don’t think its too much to ask, that if you are asking for a taxpayer funded govt job , the least you can believe in , is govt.!!!!

I mean look at that clown Ron Paul ( the so called intellectual force behind the libertarian wing of our August legislative body) about 22 or 24 years in congress drawing a salary and sucking at the taxpayer teat for all those damn years and what have we got in return from him ??

NADA ZIP NOTHING !

ONE FUCKING PIECE OF LEGISLATION PASSED. JUST ONE . The bill allowed for a federal customhouse to be sold to a local historic preservation society ( I cannot understand how this was not a law all these years and how we managed without it ). In 22 years !!!!!.  I mean come one why is this guy being paid a salary again ?

Imagine if you will if you hired a software developer who for the first year wrote 0 lines of code. LIKE NONE. His review would probably go something like this

You : “You wrote 0 lines of code this year”

Hapless Employee  : “Well um this company is evil and the cause of all problems you know so…”

You : YOU’RE FIRED YOU MORON AND DONT COME BACK !!!!

IF you are Paulite apparently the conversation goes something like this

 

You : “You wrote 0 lines of code this year”

Ron Paul inspired Hapless Employee  : “Well um this company is evil and the cause of all problems you know so I added no new bugs”

You : wow I mean wow that’s is deep fantastic no bugs amazing here have some stock awards and an awesome raise and anything else?

 

I am just sick of these assholes, seriously ! Do the fucking job you are paid to do, you are legislators, legislate. !! What is so hard about that .  !!!!!!!!!!!

 

 

Friday, July 27, 2012

Threnody a tale in three or more parts

Some where in London, July 2012

Richard Blonde( Blonde Dick to his friends just Blonde to others)  stood up and stretched. He was in a thoughtful mood which was strange for him . 20 Years !!!. 20 Years of loyal service to his Majesty’s Secret Service , from the mountains of Afghanistan to the rides of Disneyland , Blonde had seen it all ( well almost everything he never had seen M naked yet which was probably a good thing ) and now to be reduced to this !!
“Damn it this was getting positively maudlin” , Blonde told himself. Chin up old boy you’ve dealt with far worse , but that sinking feeling in his innards would not go away . He stared at his watch again , “she sure was taking her time” he thought .
Some where in London, Adjacent Room July 2012

The “She” in question was Lady Margret Bernadette  Ysobel Cunningham the current head of the MI 6.4.002.332  ; known far and wide as “M” . Her friends would have called her Margret but owing to the fact that she had no friends this was not a problem. M literally had seen everything included herself naked. That experience was still costing her a fortune in therapy especially because every time she opened  up to a therapist she had him killed.
“Send him in funnymoney”
Blonde strolled in , years of training making his gait seem almost panther like. “You know Lord Dawlish Blonde”. “Home Secretary a great pleasure “. “Thank you 007 a grave business this “
“Indeed”
“Yes someone seems to have killed Dr. Phil and I think..”
M cleared her throat , there was no doubt who was in charge, “Shall we begin gentlemen, we are gathered here today as required by subsection 4 Para 3 of the amended  MI6 code of conduct act”.
“As such I must now inform you Mr Richard Blonde that your annual performance review is underway”
Blonde sucked wind no matter how often he had told himself this would never happen…..
“You know how much  I prefer brevity Blonde so I will just say it , one the new improved ( M rolled her eyes)  performance metric scale ( PMS) where 1 indicates  excellence of the highest order and 5 requires a level reclassification hearing, you Blonde are a 5”
Blonde swore an oath and in one smooth motion moved to kill Lord Dawlish with his bare hands but in the end his training won out and he contented himself by turning a cartwheel.
“How could this happen Chief”?
The Home secretary interjected, “there is this thing called the calibration curve you see and we find..”
“One more word Lord Dawlish….”
“That will be enough Blonde” M growled, “The number is final and locked up we are here to discuss whether you are to be reclassified  as a Single O agent
Blonde could not believe his ears, his legs almost gave way. “Single O” was the  worst classification possible in this business.  You could not kill anyone on weekends , on weekdays you could not kill anyone after 5 PM 6 with DST. Your had to have your martinis stirred, you were not allowed to have sex with the hot chick and YOU HAD TO BANG the hot chicks fat or ugly friend( sometimes both ). It was a nightmare
Training will tell though , from the depths Blonde stirred, “I demand an administrative review”
“That is your right Double or Single Oh Seven ,  Lord Dawlish if you would please”
“Certainly dear Lady , well Blonde in the first place there is the question of your visibility “
“I AM A SECRET SERVICE AGENT SECRET SECRET !!!”
“Yes maybe but also you have been submitting all your status reports in the wrong format “
“WHAT !!!”
“And finally there is the issue of Iran last Year”
Iran!!! Consummate professional that he was Blonde’s expression did not betray a thing but his heart started racing
“Yes Iran”

Next Time “ Iran”

Wednesday, July 25, 2012

Case Study for MBA interns

Player A is writing an App in his spare time hoping to strike Instagram like success. To hedge his bets however he has also purchased a lottery ticket .

Player B is a bit of a radical and has chosen a completely different strategy. He has bought two lottery tickets.( I know right !!)

Please answer the following questions

 

  1. Who is more likely to succeed amongst the two players
  2. Who is more likely to get laid
  3. Where is player C
  4. Explain why in your opinion player D can never exist
  5. Are A and B playing the same game. If not which game would you prefer to play . Argue passionately against your preference
  6. Sing your argument to the tune of any lady gaga song before she assumed the name Lady GaGa
  7. With reference to Q 1) do you think your answer would have  been different if the players were on the island on Lost
  8. Are you sorry you are still reading
  9. Now?
  10. Seriously!!!