TruerWords Logo
Google
 
Web www.truerwords.net

Search TruerWords

This is one of my journal's many "channels."
This chanel only shows items related to "Technology."

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 );
  }
  
Thursday, October 6, 2011

The Friends We Never Meet

I have so many things I'd like to say about last night's news. So many people with a more direct connection to Steve Jobs are saying their piece right now that my saying anything at all feels a bit silly.

So be it. I'll keep this short.

My connection was nearly life long — 30+ years — but very indirect. I saw him in person once, but never met him. My first mac was a 512 Ke in late 1985 or early 86, but I fell in love with the 128 when I saw it at a computer store sometime in 1984. MacPaint was on the screen, and someone had drawn an elephant.

For years I'd been programming in basic on a TI 99/4A, then on various Commodores. Seeing my first mac was like... something from the future. Mind boggling, even for an eleven year old.

Anyway, we all knew this day was coming. For most, since the the resignation in August. For others, since the WWDC. That was mine. I'd been watching his stick figure's shaky walking on the stage for at least an hour, saddened at how thin (gaunt) he was…

Then came the moment that told me he was resigned and knew his end was coming. He was talking about how much he loved the company he had built, and his voice cracked, and his eyes got shiny, and he looked very old and frail and sad.

I've watched people — friends — die from cancer. It's horrible. And I saw in his face that he knew, just like they knew.

There's so much more I'd like to say. Comparisons with exceptional people I respect from history and how rarely and brightly their lights shine, so rarely that we can name many of them even hundreds or thousands of years later. Or the fleeting nature of life, and how important it is that we do our best with what time and resources we have.

But mostly, since I learned in a text message from Corinne that "Steve Jobs died", I've been thinking about friends we never meet. People we interact with every day but in a very one-sided way, and how they can be important to us without them ever knowing it.

And how it hurts to lose them, even if they were never really there.

Monday, September 12, 2011

The New BostonGlobe.com

I'm beyond impressed with the new Boston Globe web site. It's the best I've ever seen. Congrats to @beep and the rest of the designer/developer team. As +Craig Hockenberry said on Twitter, other newspapers are going to look at it and either realize they need to imitate it, or they'll keep dying.

If you have a big monitor, resize your browser window from very narrow through to full screen. Go very slowly, and watch as the layout adapts to the new size, every step of the way. The images resize, the number of columns will change from 1 to 2 to 3, each column's width changes... it's brilliant.

(What I've mentioned here is just the first-glance stuff. Look around, the attention to usability and detail is intense.)

Friday, February 11, 2011

Web Development Class with Ethan Pride

For a few months now I've been teaching Ethan how to develop a web site, including HTML, CSS, JavaScript (soon), and content management systems.

We meet once a week.

(This post was a demonstration for him on the benefits of a CMS.)


May, 2017
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 31  
Apr  Jun


RSS: RSS Feed

Channel RSS: RSS Feed for channel

TruerWords
is Seth Dillingham's
personal web site.
More than the sum of my parts.