TruerWords Logo
Google
 
Web www.truerwords.net

Search TruerWords

Welcome
Sign Up  Log On
Thursday, April 30, 2015

Creating Great Mobile Apps! (snark)

The following is a re-post of something I said on Facebook just over a year ago. The topic came up today in a conversation on Twitter so I figured it was time to move it to here where others can see it.

Written after Twist went under.


How to create a great mobile (iPhone/Android) app in the current business climate:

  1. Go to school, fail math. HARD.
  2. Have an idea for a cool product.
  3. Get your programming buddies together, create a demo.
  4. Optional: Show it to a venture capitalist. Get lots of money to grease the skids for the first release.
  5. Finish the app.
  6. Release the app. Make it free for everybody. You'll make it up in volume! (See step 1.)
  7. Get lots of users.
  8. Wonder why you're not yet profitable.
  9. (Optional) Get more money from the vulture capitalists!
  10. Spend lots of money on marketing.
  11. Spend lots of time on a big update that makes the app prettier and funnerer.
  12. Wonder why you're still not profitable!
  13. Go out of business. Disappoint the millions of users who would have paid for your app had you let them.
  14. Blame the system. The app store. The market. The business climate. Never consider your own utter failure at math, because who needs math when you have millions of customers ^d^d^d^d^d^d^d^d^d users!
  15. Return to step 2, wiser and stronger for your failure, to create an even better business based on a free app (in a completely different space).

This just keeps happening.

Saturday, April 11, 2015

Swift Spirals

Yesterday on Quora a particular Math question caught my attention and fired up my imagination. I've already linked to it, but here's how the question was worded:

Four persons K, L, M, and N are initially at the four corners of a square of side 'd'. Each person now moves with a uniform speed of 'v' in such a way that K always moves directly towards L, L directly towards M, M directly towards N and N directly towards K. At what time will the four persons meet?

(Why say they are people and then not give them real names? I thought that was funny.)

Let me rephrase the question. Four people (or uh... dots) are at the corners of a very large square. They're all going to move at the same time, and keep moving until they touch. Each person moves toward the person at the next corner of the square in the clockwise direction. (So the person at the top left moves toward the person at the top right.)

I didn't care about the actual question there at the end, "at what time will the four person's meet?" I was just interested in the path they would each travel, the shape it would form.

Now keep in mind that each person is always moving towards the next person, not towards the corner where that person started.

It was obviously going to be a spiral in toward the center. Could I write a program that would simulate this travel?

Yes, I could! Here's an Xcode Playground file (written in Swift) that demonstrates the whole thing. It's not fancy, but it does show the spiral being drawn and I've kept the math self-contained in a couple of functions.

Update

Here's the same thing in some javascript, running in the browser.


  var graphSide = 500.0
  
  function sqrx ) {
      return ( x * x );
  }
  
  var Point = functionxy ) {
      this.x = x;
      this.y = y;
  };
  
  // thanks to my buddy Pythagoras
  Point.prototype.distFromPoint = functionpointB ) {
      return Math.sqrt(sqr(pointB.x - this.x) + sqr(pointB.y - this.y));
  };
  
  var actorA = new Point00 );
  var actorB = new PointgraphSide0 );
  var actorC = new PointgraphSidegraphSide );
  var actorD = new Point0graphSide );
  
  var distToMove = 2;
  var lineWidth = 2.0;
  
  var canvasctx;
  
  function initSpirals() {
      canvas = document.getElementById"spiralCanvas" );
      canvas.width = graphSide;
      canvas.height = graphSide;
      ctx = canvas.getContext("2d");
      
      document.getElementById("runButton").addEventListener("click"runButtonClickedfalse);
      document.getElementById("resetButton").addEventListener("click"resetButtonClickedfalse);
  }
  initScripts.push(initSpirals);
  
  function reset() {
      actorA = new Point00 );
      actorB = new PointgraphSide0 );
      actorC = new PointgraphSidegraphSide );
      actorD = new Point0graphSide );
      
      var canvas = document.getElementById"spiralCanvas" );
      var context = canvas.getContext("2d");
      
      context.clearRect(00canvas.widthcanvas.height);
  }
  
  function runButtonClickede ) {
      reset();
      window.setTimeoutincrementWalkers0 );
  }
  
  function resetButtonClickede ) {
      reset();
  }
  
  // find a new point on the line between a and b
  function moveFromAToBpointApointBdist ) {
      var dist_total = pointA.distFromPointpointB );
      var newX = pointA.x + ( ( dist * (pointB.x - pointA.x) ) / dist_total )
      var newY = pointA.y + ( ( dist * (pointB.y - pointA.y) ) / dist_total )
      
      return new PointnewXnewY );
  }
  
  function moveAndDrawFromAToBpointApointBdist ) {
      var dest = moveFromAToBpointApointBdist );
      
      ctx.moveTopointA.xpointA.y );
      ctx.lineWidth = lineWidth;
      ctx.lineTodest.xdest.y );
      ctx.stroke();
      
      return dest;
  }
  
  // incrementWalkers is its own function so that we can see the 
  // image updating in an animated fashion. If it was just done in 
  // a loop, then all we'd see is the finished product.
  function incrementWalkers() {
      if ( actorA.distFromPointactorB ) < distToMove * 1.001 )
      {
          return;
      }
      
      // draw lines from old to new locations
      var destA = moveAndDrawFromAToB(actorAactorBdistToMove);
      var destB = moveAndDrawFromAToB(actorBactorCdistToMove);
      var destC = moveAndDrawFromAToB(actorCactorDdistToMove);
      var destD = moveAndDrawFromAToB(actorDactorAdistToMove);
      
      // update actors with new locations
      actorA = destA;
      actorB = destB;
      actorC = destC;
      actorD = destD;
      
      lineWidth = lineWidth * 0.99;
      
      window.setTimeoutincrementWalkers0 );
  }
  
Friday, December 26, 2014

More Tragedy, Status Update

A lot of Corinne's friends have heard by now that Shane's cousin (same age) was killed on Christmas Eve, down in the Lancaster, PA, area.

A very good friend just called me to see how we were handling things, considering our history with Shane; so it seems like this would be a good time to clear things up as best I can.

Stephanie Kilhefner was Shane's cousin on his Dad's side (his father's brother's daughter). She had two kids. Her husband turned himself in and confessed to everything yesterday. I'm not going to offer any details, or even links to the story, but I've already given enough info that you can google it if you want to be grossed out.

(We hear about stuff like this in the news all the time, but it's grosser when it's closer.)

To answer the main question being asked by the friend that called: we're ok. I knew of this cousin but had never met her. Corinne knew her and was friends with her on Facebook but hadn't seen her since before we met, so it's probably been twenty years.

There's nothing "good" about this. There's no "phew, that's a relief." What we have here is another Kilhefner tragedy, the third big one (that I'm aware of) in the last eleven years.

So we're hurting for them. We know their pain, we're intimately familiar with it, and we're reminded strongly of it. But we're not living it ourselves right now, except vicariously.

Thursday, November 13, 2014

Primary Colors

We had Lauren Monday night. That's wonderful! Her parents have been really generous lately about letting us spend time with her.

She's in second grade now, and what was not so wonderful was her homework. It was a reading-timing test. (As in, time her for a minute to determine how much of this essay she can read.)

The essay was the problem. It was all about how Red, Yellow and Blue are the primary colors. "They're called the primary colors because you can make any color with them."

It's simply not true. It's not even close to true. The primary colors are Cyan, Magenta and Yellow. Mixing pigments of those pure colors, you can make any other color in the visible spectrum. In fact, you can even make red (magenta and yellow) and blue (magenta and cyan), which are not actually primary colors.

You can't make magenta or cyan with those fake primary colors. No mixture of red, blue or yellow will give you either magenta or cyan, because magenta and cyan are actually both primary colors. You can't really make a pure green because green is actually cyan and yellow, not blue and yellow.

It is possible to cheat a little with crayons (and perhaps ONLY with crayons), because you're not really mixing the colors so much as layering them, so the top color becomes dominant. You still can't make magenta or cyan.

The funny thing is that even people in the printing/prepress business get confused about this. Everybody in the business knows the the 4-color printing process uses CMYK (cyan, magenta, yellow and black inks), yet many still think of red and blue as primary colors, because that's what they were taught in primary school.

I don't mean to claim this is a big deal, but it's an example of the kind of thing that gets under my skin. Kids are taught one thing that's absolutely untrue, and then anybody who ends up in a line of work or hobby that requires an understanding must be RETAUGHT the very most basic points because they've been misled their whole lives.

Incidentally, the same is true about the Bible. People are told what it says and means by other people who are just repeating what still other people have told them. When teaching someone, a huge amount of time has to be devoted to easing the student over and through those misconceptions which aren't their fault at all.

Thursday, October 16, 2014

What, Now? Wow. Ow.

My brother Jed came back East from BC for two weeks with his new family in tow, two weeks ago. We stayed at Steve Davis's house Tuesday night so I could drive them all to the airport before sunrise, Wednesday morning.

Stop-and-go traffic all the way to the airport, starting at 6am?! That's just wrong.

Jed Dillingham and Family

It was very hard to say goodbye to them all. Alycia is Jed's perfect counterpart, 4yo Michael is nearly his perfect clone (but cuter than he ever was), 4yo Rachel (M's twin) is quiet and sweet and very smart, and Gracie is curious, cuddly and learns to say new things faster than the parrots do. And repeats them more. Except for a very brief visit less than two years ago for Gil Riley's funeral, I haven't seen Jed in seven years, and I'm not ashamed to admit that I cried on my way back to Steve's house after saying goodbye at Logan.

Steve and I ate breakfast on their front porch and then dressed for the ride. It was to be surprisingly warm, and had rained a bit the night before so we were expecting more humidity. Before we left, we swapped my tires for the new ones I'd brought with me, then we were off.

3.7 miles into the ride, I was pulling and we were making a right. I remember thinking that it was nice of Steve to have the roads re-surfaced for our ride, and was going to say something like that to him eventaully. No, really, that's the last thing I remember about the ride. The next thing I remember is a very brief flash of the inside of an ambulance. "Huh, what's that now? Did I ride right into the back of an ambulance?" Then some jumbled stuff, and people repeatedly asking me stupid questions like, "What's your birthday?" and, "Who's the president?" over and over again. As if the president knows my birthday. Silly.

Corinne was there, somehow. It was like magic! She was ninety minutes away, at home. Probably cooking something delicious, hopefully thinking about me, definitely missing me! Then suddenly people are asking me too-repetitive questions and she's there in the room, in the background. Not sure how that happened.

I remember being put in a CT scanner. Then suddenly I was out of it again. Pretty sure there are two meanings there! I remember asking for water, and being told NO. Then being given water in the form of ice. Whatever, it's water. Why'd you say no? Now your pants are on fire!

I told them they wouldn't find anything looking my head with that thing. Clearly I was right.

Shots and other violations? Plenty. They put an IV in my left arm. "Just for fluids." At some point I pointed out something pointedly obvious, and they agreed with me and detached it because I'm a genius, and they let me have more not-water-because-it's-ice. And a tetanus shot in my right arm that I barely felt. The local anesthetic shot in the skin next to my eye so skinny doctor could put stitches in my eyelid? Most painful part of the day and I still haven't forgiven her. Not sure how injecting a cocktail of lemon juice and burning gasoline into my skin is supposed to numb the pain, but I was Mr. Tough Guy and didn't let on that my inner child was now hiding behind the headboard in his room and moaning in delirious, tortured agony. Bad doctor.

She said she liked me, though, because I was… something. Funny? Sassy? Steve, help me out here, I can't remember. Probably not funny, nobody thinks I'm funny.

What, Now?

Oh, I called this "tally," so here's my tally of momentos (keepsakes, even) from my shortest ride of the year:

  • Road rash all over the right side of my face: next to my eye, on my nose, my cheekbone, my lip and my chin.

  • Four or five stitches on my right eyelid. Skinny doctor was soooo confident that I won't have scars like I got from the other stitches in my childhood. Yeah, I'm going to be disfigured for life.

  • Black right eye.

  • My ears are so small and tucked in close to my head that the road just couldn't reach them. Undamaged! You missed a spot, so maybe next time, suckah! Nyah nyah!

  • Bruise and road rash on my right shoulder and right forearm just below the elbow. The bruise on my right shoulder is deep, moving that arm generates funny noises from my mouth. Odd, huh?

  • Scraped all the primary knuckles on my right hand.

  • Matching holes at the middle knuckles of both thumbs. Nobody can figure that one out, so I'm guessing I was sliding along the ground with both thumbs up like the Fonz (as he jumped the shark).

  • What feels like a watermelon stuck to my right leg just below the hip. It's not actually a watermelon, it's just a giant bag of hurt. The hospital was fresh out of real watermelon.

  • Road rash on my right knee.

  • A bruised and dislocated rib on — wait, can you guess? — the right side. Bruised as in "huh, that hurts to touch it, but not like it's broken. I know broken!" Dislocated as in, "I don't think it's supposed stick out from my sternum like that. And when I cough it hurts worse than the watermelon!" No external bruising there, though. Ellyn says it's because of all my rolls of fat. (I got those from the almost 3,000 miles of cycling this year.)

How did it happen?

How does anything happen, really? Forces interacted with masses at surfaces, and effects were generated.

In this case, I went around a corner, slid on a new crosswalk wet with rain, and the bike hit the ground. Me, too!

Steve went down behind me, even though he "strongly affirms" (he never swears) that it's not possible for him to lose traction with his diamond-spiked, sticky-as-bug-trapping-spider-silk tires. Which means he saw me go down and did what any friend would do and ran me over, then fell halfway across and kicked me in the eye with his cleats. He got a booboo on his right knee and right elbow. The poor guy.

Note that I have no memory whatsoever of the crash as it actually happened, so I'm trusting Steve's recounting of the story… which conveniently did not include anything about running me over and kicking me, nor him getting a ride home with the very pretty police officer that was directing traffic just up the road. So I probably made that all up.

So, congratulations! Now you understand what happened yesterday at least as well as I do.


April, 2015
Sun Mon Tue Wed Thu Fri Sat
  1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30  
Dec  May


RSS: RSS Feed

TruerWords
is Seth Dillingham's
personal web site.
Truer words were never spoken.