Friday, October 11, 2013

Phonegap Diaries: Intro to 24 Challenge

Introduction

In order to get started in mobile development I appropriated a popular math game called "24" (I call mine "Twentyfour Challenge". Google play. iTunes store) and turned it into a native Android application (this was very unoriginal as there are many versions of this game out there).

Doing this required climbing a steep learning curve as there is a vast, new API to learn.  But at least I could program in Java using the familiar Eclipse IDE.  I released my app to Google Play store last December (2012).

But wouldn't it be great to re-write Twentyfour Challenge as a portable HTML5 / javascript application?  I decided to do this in the summer (2013).  I also decided to write a summary of my experience doing this re-write.  I call these the "PhoneGap Diaries." 

Here are the topics covered:


Friday, June 14, 2013

Don't Stand So Close to Me


I have this recurrent dream. A hot, female undergraduate is asking me what she has to do to boost her grade at the end of the semester. We're alone -- older male teacher and young female student. There's even background music to this scene and it's "Don't stand so close to me" by The Police. But I am getting ahead of myself. Let's start at the beginning of the semester.

The C++ course was not what I wanted to teach. But the assistant dean asked me just that, and it's best for an adjunct teacher to never say "no" to a course offering. So I find that there are 24 students enrolled including one female. This heavy imbalance is not unusual as the computer industry is male-dominated. Since it was the Spring semester I could count on most of the students being in their early twenties. For some reason the older, and frequently ex-military, students take my class in the Fall. I can't explain why the older students appear in the Fall, while the younger students come out in the Spring, but an attitude difference is readily apparent. The younger students just treat their college courses like high school courses as in "what is the least amount of work I can do to get a good grade?" The older students want to learn something in order to get a job.

This Spring my male dominated roster showed a wide range of programming skills. Some were decent programmers already, while others were unprepared having bluffed their way through the prerequisite courses. Most were in the middle.

In the decent programming skills group was Vince who proclaimed out loud the first class that he had eight years of programming experience. This programming veteran looked like a caricature right out of Mad Magazine having a pimple-laced face and wildly angle teeth. He talked boastfully about all of his experience setting up servers and compiling open source programs with his custom changes. The trouble was that Vince just did not want to listen to my lectures and do my assignments.

Also in this decent programmer group was Dan. Now Dan is my all-time favorite student. But it's not because he worked the hardest or got the best grades. It's because Dan always listened to my lectures and he always nodded in agreement to whatever I said. I would look around the classroom and see that students were either looking at me with no expression or staring at their computer screens. Dan was the one student I could count on to be paying attention and nodding affirmatively at all times. What a way to send positive energy back to the teacher.

Let me use Ross as an example of one of the bluffers in the class. Ross always came in about 15 minutes late to class. Since I make all of my announcements at the beginning of class this means that he never heard a single announcement. He would do the least amount of work possible, yet was always seeking extra credit for anything and everything. I had to continually extend the deadlines for quizzes and assignments for him because he never turned anything in on time.

The solo female, Amanda, was definitely in her early twenties. She kept to herself and browsed the internet while I was lecturing. I can always tell when a student is on Facebook or doing e-mail. The student's face is just locked on the screen with fingers tapping on the keyboard. They are definitely not paying attention to me. Why should they? My years of programming expertise just can't make up for my monotone voice. And if you’re not into programming, this stuff is boring.

I know I can do something about this. I can use the teacher control software to put my screen on all of the students' computers. I don't do this for a couple of reasons. It would piss them off so that they hate me more. Or, they would just switch to their smartphones and continue to ignore me.

Well the middle of the semester comes around and I give my open-book midterm exam. I think it's really easy, but then again I know this stuff inside-out. I'm amazed at how poorly some of my best students do on the midterm. Did they coast because it's an open-book exam? Did they just fail to study? I'll never know.

As the course drags on I notice that Amanda hasn't showed up for weeks. She hasn't dropped the course but she's behaving like she has. I send an e-mail to her as I would for any student who's acting like he/she is done with the course. No reply.

Well it's a week before finals and I finally scan the student's grades. I can see that Amanda is at the bottom having done about half of the assignments and half of the on-line quizzes. To my surprise she sends me an e-mail the same day and says she wants to meet me during my office hours. I agree and set a time for us to meet.

She shows up wearing exercise clothes: skin-tight nylon stuff that shows off every curve in her very curvy body. She sits opposite to me and says "Is there anything, I mean anything, I can do for extra credit?"

Now I'm getting nervous for a couple of reasons. One is that another adjunct might walk into the shared office where we are alone. The other is that I'm not exactly sure what she's willing to do for "extra credit."

So I say, "Amanda, did you ever hear of Riemann's zeta function? It's a pretty simple polynomial function but it's amazingly complex when its domain is the complex number system."

Amanda looks at me with utter non-comprehension as if I were speaking Greek to her. Greek, that's funny because the zeta function is stated with many symbols from the Greek alphabet.

"Well the zeta function expands to an infinite polynomial and like any polynomial we're interested in where there are zero values."

Now Amanda has started to lick her lips and blink her eyes to try to distract me, but I'm getting excited because I think I'm explaining the zeta function so well.

"Mathematicians have found many of the non-trivial zeros of the zeta function and since the domain is complex numbers the zeros have a real and an imaginary part. For all of the non-trivial zeros found thus far it's true that the real part is equal to 1/2. Isn't that amazing?"

Now Amanda is looking at me with serious confusion in her eyes like, "What the hell is this guy talking about? He must be hopeless."

"Okay, of all the non-trivial zeros found thus far the real part is equal to 1/2 -- but is this true for all possible non-trivial zeros? The assertion to the positive is called the Riemann Hypothesis and it hasn't been proven or disproven for over 150 years. What do you think?'

Amanda answers, "I think I don't understand. Besides what does this have to do with getting extra credit for the course?"

"I understand your confusion. I didn’t make clear the distinction between trivial and non-trivial zeros. The trivial zeros turn out to be all of the negative even integers like -2, -4, -6, etc. That's a consequence of the fact that zeta value of the quantity one minus s (e.g. z(1-s)) equals a value that has the sine function as a multiplicative factor and the value of that sine function is zero precisely at those negative even integers."

Amanda says, "I still don't understand. What can I do?"

"Well I was thinking that if you contributed to solving the Riemann Hypothesis, even a small contribution such as a tangential theorem, then I couldn't help but give you an A for the course."

Amanda left without a word.

I call out after her, "Did I say something wrong?" And she didn't ever stand close to me.

Tuesday, April 30, 2013

My Second Sprint Triathlon

Glutton for punishment or dedicated athlete? I won't know until my sports obituary is written, if it ever is. Anyway I completed my second UMLY Sprint Triathlon last Sunday in 1 hour 35 minutes and 55 seconds -- a four minute improvement over 2012.

2012 2013
Swim 13:00 13:07
Transition 1 5:27 5:20
Bike 44:17 41:44
Transition 2 2:38 2:33
Run 34:38 33:12
Total 1:40:00 1:35:55


The best way to contrast this year with last year is what I did not do while training.

2012 2013
Taught at 2 locations Taught at 1 location
Trained for 4 months* Trained for 2 months
Worked at Vanguard
Argued with my boss**

*The intense training left me irritable at work.
**My boss was himself an irritation.

I bought a new bike (GT Tachyon 3.0) and while shopping I was amazed by all of the categories of bikes there are (road, fitness, hybrid, mountain, comfort, etc.) let alone the various brands. I bought a fitness bike which has straight handlebars because I hate the curved handlebars that force you to bend over. The new bike worked great as I did not dismount once and pedaled up two very steep hills.

I started the 5 km run same as last year. My legs and buttocks were tied in knots and I had no desire to run. But again I recited the runner's mantra "put left foot in front of right foot, put right foot in front of left foot, repeat" and finished the race.

So in 2013 I improved my time over the previous year by 4%. If I keep this up for the next 25 years I will finish in no time!

Kudos to the Y and all of the volunteers who made this an amazing event. The Y closed the 50 m outdoor pool to get it warmed up (literally) for the race. The signage over the 13 mile course was excellent. And the cheering was motivating.

Wednesday, November 7, 2012

Two Hours as a Poll Greeter

I have never volunteered to work for a political party in my life -- until last night.  Since the media kept insisting that the 2012 presidential election was razor close, and because Romney started advertising heavily in Pennsylvania, I decided to respond to an email request to canvass Democratic voters on election day.

So reluctantly I called the organizer and offered two hours of volunteer work.  She said she didn't need any more canvassers.  Rather she needed a poll greeter to hand out sample ballots.  "Okay, I can do this," I thought.

So I showed a little early to overlap with the previous greeter.  He was there with his wife and granddaughter.  He showed me how easy it was to simply ask the incoming voters, "do you want a sample ballot?"   And he instructed me to thank the voters as they exited.

I thought, "boy, even I can do this." And so I did.  Some people politely accepted; some said "no thanks," and some were hostile when they saw the Obama sticker that I wore on my jacket.

My jocular coworker started chatting up his female Republican counterpart.  She was a local Republican committee woman.  She mentioned her name and I was surprised that her last name was Martinez.  Surprised, because she did not look one bit Hispanic.  Later she mentioned that her husband was Cuban and that his parents actually fled Cuba.

Fairly soon I was on my own handing out the sample ballots and thanking the voters while they were leaving.   My counterpart seem to wait until I went first, then she would offer a Republican sample ballot.   Most people accepted both ballots out of politeness or perhaps a desire not to indicate their preference.  Some people gave one of us the evil eye when they realized who we supported.

This pleasant stalemate continued until another female Republican greeter showed up.  The first thing she said to her colleague was "do you know the Communist Party has endorsed Obama?"  She made a loud stink out of this hoping to draw others into the conversation but there weren't any takers.  She also had a hand bell that she would ring as people walked by advising them to "vote right, vote Republican."

Now my timid excursion into politics was raising my ire.  But I'm not a talker and besides what could I say to this wingnut?  I just kept handing out my sample ballots and for every one that was accepted, Lady Wingnut forcibly thrust her counterpart upon the hapless voter.

Now we both were able to identify people we knew as friends and neighbors.  Lady Wingnut spotted a woman with two children as they approached.  She said to her colleague, "that's one of my neighbors."  She greeted the woman and asked, "will you consider voting for Romney and the Republicans?"  The woman replied, "No, I want to keep my vagina."  Then she quickly ducked into the building.

Now even I was surprised by what I heard and so was Lady Wingnut.  She asked her colleague, "did she say what I thought she said?" Answer "yes."  "Well, I know why she said that -- she's a teacher!"

That was probably the highlight of the evening for me but I want to recount another incident.  A couple who looked vaguely familiar to me from church accepted my ballot.  The middle-aged woman showed me the ballot and asked whether it was necessary to fill in all of the ovals in order to cast her Democratic vote.  I explained that she could vote along party lines and just fill one oval.

A few minutes later the woman emerged.  She wanted to know why the names of the Republican candidates were listed before the names of the Democrats.  I looked at my sample ballot which listed the candidates in this order: Republican, Democrat, Green, Libertarian.  I told the woman "I have no idea why they are listed this way."  So I figuratively crossed the aisle to see the Republican sample ballot.  It listed only Republicans.  A neat lesson in open-mindedness.

Wednesday, October 10, 2012

A Tenuous Analogy

Let me offer you three words -- inaccessible, hardship, and beauty -- and ask you if there's anything that can tie these words together. Based on my experience there are two seemingly unrelated topics that come to mind: Antarctica and higher mathematics. I was introduced to the latter as an undergraduate math major over forty years ago and again as a graduate student just a few years ago. As for Antarctica I learned about the heroic age of exploration in the 1980's, and had the fortune to visit the continent in 2010.

Inaccessible - unreachable, remote, unattainable.

Many people consider higher mathematics as inaccessible. Certainly you need an aptitude for it, but it does exist. In 2008 over 1,360 Phds* were awarded in mathematics in the United States. The interior of Antarctica is nearly inaccessible. You have to be well-prepared and well-motivated to go there. However, around 1,000 people winter in Antarctica every year including 50 at the Amundsen-Scott South Pole Station.



Hardship - a condition that is difficult to endure; suffering; deprivation.
There's no doubt that the exploration of Antarctica involved hardship. Consider the tragic ending to Robert Falcon Scott's expedition to the South Pole in 1912. I can't cite a case of death while exploring mathematics, but certainly there have been nervous breakdowns and possibly suicides.

The one thing math researchers and explorers have in common is the intense need to know the unknown. Apsley Cherry-Garrard, a member of Scott's support team, had this to say about polar exploration:
Polar exploration is at once the cleanest and most isolated way of having a bad time which has been devised... There are many reasons which send men to the Poles, and the Intellectual Force uses them all. But the desire for knowledge for its own sake is the one which really counts and there is no field for the collection of knowledge which at the present time can be compared to the Antarctic. Exploration is the physical expression of the Intellectual Passion.

I think you can substitute "mathematic exploration" for "polar exploration" and maintain the meaning of the quotation.

Beauty - the quality present in a thing or person that gives intense pleasure or deep satisfaction to the mind, whether arising from sensory manifestations, a meaningful design or pattern, or something else.

I can attest to the beauty of the Antarctic Peninsula. The snowscapes are gorgeous; the icebergs are magnificent. Many mathematicians, scientists, and engineers laud the beauty of mathematical forms that contain deep symmetry and internal elegance.


Here are mathematician Bertrand Russell's words on this kind of beauty:


Mathematics, rightly viewed, possesses not only truth, but supreme beauty — a beauty cold and austere, like that of sculpture, without appeal to any part of our weaker nature, without the gorgeous trappings of painting or music, yet
sublimely pure, and capable of a stern perfection such as only the greatest art
can show.

Here substitute "icebergs" for "mathematics" and again the meaning is preserved.

It would be silly to suggest that a heroic polar explorer would make a good mathematician or vice-versa. I count myself as neither an explorer nor a mathematician, yet I am fascinated by both species. The best I can do is explore words, make an analogy, and hope the analogy works.

*Phd's awarded in the United States in mathematics and statistics in 2008.












Tuesday, May 1, 2012

My First Sprint Triathlon

I finished at precisely 100 minutes -- five minutes more than I had hoped.  Actually at one point I thought I could finish around 85 minutes but I'm getting ahead of myself.



I'm talking about the 2012 Upper Main Line Y triathlon consisting of a 450 m. swim, 10 mi. bike ride, and 5 km. run.  I had been thinking about doing this for over a year before I convinced myself I could do it.  I trained for four months prior to the event during which I:
  1. Spent $400 fixing up my 40 year-old Schwinn LeTour bike that I did not use.
  2. Crashed same bike two weeks before the race and escaped with minor scratches.
  3. Felt exhausted and cranky at work most of the time.
  4. Lost 5 lbs. while eating unconstrained amounts of food.
I started training at the beginning of 2012 by doing gym triathlons - swim indoors, bike on a spinner, and run on the treadmill.  I never did the full distances but felt confidant I could do 12/32/31 minute splits.  With 10 minutes for both transitions I would finish in 85 minutes and win my age group (based on the previous year's results).  Then I started training outdoors and realized that the 50 m. pool, the hills on both the bike and running course, plus the wind added a real difficulty factor to the endeavor.  Fortunately I realized this before the event and decided to relax and enjoy the event.

Here are my splits as per my Ironman watch.

Swim13:00
Trans #15:27
Bike44:17
Trans #22:38
Run34:38

It was a perfect day -- temperatures in the 50's to 60's, brilliant sunshine, low humidity.  Because the swim event was in the outdoor 50 m. heated pool, the 300+ participants were divided into groups and each group started only after the previous group completed their swim (every athlete wore a timing chip which was tracked by computer).  This resulted in a nice, peaceful competition of athlete vs. self instead of athlete vs. crowd.

The swim was fun, the bike ride was challenging as I had to walk my bike up the two steepest hills.  The run was dreadful.  After finishing the bike ride I did not want to run 5 meters let alone 5 kilometers.  But following the mantra of "put one foot ahead of the other, now REPEAT" I muddled through the run.

Then it was over.  Later in the afternoon I slept exactly as long as I had competed.  Amazing how things balance out.

Saturday, March 3, 2012

Career Moments

You’re Only Doing One-Third of What We Want

This blog entry starts with my six month contract as a computer science teacher in the early 1980s. I had an altruistic impulse to teach, but I wasn’t willing to bet the ranch on it. So even though I was considered a full-time teacher at Penn State Brandywine Campus two days a week, I continued to work part-time at Burroughs three days a week.

The number of students (around 30) in my first class surprised me. I asked one student why an introductory programming class was so popular. He said he thought it was because a computer-programming course was easier than the alternative math course. I immediately grew doubtful of my new career.

During this six month stint I worked about 60 hours per week. I received no help whatsoever from the administration or the staff. In fact when I asked a secretary how much lead time she needed to type materials for me she responded “two weeks. "

I was operating on about two hour lead-time.

At the end of the first semester I ran into the dean who hired me, and the first thing he said was “Bob, you’re only doing one-third of what we want you to do?” I said, “Whaat, please explain?” “Well we expect all of our faculty to excel in teaching, to do research, and to perform community service."

And it’s not like the students themselves were appreciative. I had to deal with them cheating a lot. When I received the their feedback forms after the semester one said: “Monotone voice, change it!”

I went back to systems programming after that.

Do I Have to Answer That Question?

One day at Burroughs I received a phone call from a recruiter. Usually I don’t give these headhunters the time of day, but this one mentioned a startup company. It was either intrigue or boredom but I decided to interview. Then I was hired to write compilers which I had been doing for about six years at Burroughs.

The company was a small startup in Lawrenceville, NJ. The CTO was a charismatic engineer named Robert Knight. The CEO was a wealthy businessman, Charles Lombardo, who provided most of the company’s funding. Somehow, maybe because Lombardo’s wife worked on Wall Street, our tiny company, MultiSolutions Inc., actually went public. Even though they actually did not have a product or a revenue stream.

The product, under development, was an Operating System called S1. The marketing department used the slogan “Unix is a dinosaur, MS-DOS is a toy.” This was in 1984 and it was true that there was an opportunity for a new OS in the marketplace.

To kill any suspense, the OS never caught on. But I did have an interesting experience giving a deposition to an SEC lawyer at the Federal Building in NYC. The cause for this was a disgruntled employee who was fired from MultiSolutions. He decided to call the SEC and tell them that statements in the company’s IPO were false. Statements like we had a Pascal, a Fortran, and a COBOL compiler ready to go.

Well I was responsible for writing the Pascal compiler so I was asked to testify as to my competency in compiler writing. I was represented by a company-provided attorney who previously worked for the SEC. When the SEC lawyer asked his fourth question, my lawyer says “he doesn’t have to answer that.” “Yes, he does,” says the SEC lawyer. “No, he doesn’t” says my lawyer.

This continued for the next few questions and for about 20 minutes. I was perfectly willing to answer the question asked, but my lawyer wouldn’t let me. I was practically getting whiplash looking back and forth between the two lawyers.

My ordeal ended pretty quickly. Later the SEC dropped the charges against MSI.

Why Are They Shooting At Me?

I had a lot of different jobs at Burroughs which became Unisys (MultiSolutions was in the middle of this). At one point I was in the LINC product group. LINC was a rare software success at Unisys coming from the Burroughs side. It was a 4GL and 4GLs were popular right before the computing world when fully client-server.

This was in the early 1990s, which was also a time when CASE (Computer Aided Software Engineering) tools were popular. My department was experimenting with CASE tools that could be used to generate design inputs for a LINC system.

The second surprising thing about LINC was that it was developed in Christchurch, New Zealand. I was sent down to Christchurch to demonstrate some of these CASE tools along with Unisys marketing managers.

I was really impressed with the LINC headquarters. It was specially-built, four-story glass-skinned building where it stood out from the drab business buildings on the outskirts of Christchurch.

They showed me a room on the first floor where I could work rehearsing my presentation and demo one last time. Then out of the clear blue, I hear a loud pop and see a round hole punched through window about two feet from where I sat. I ran out of the room, right into a crowd of people who heard this and came to see what had happened.

I heard a female say “well he’s done it again.” I’m thinking “someone shot at the building again?” but when I turned and looked through the window I saw a workman pulling a mowing harrow across a field about 50 yards from the building. This guy was hauling ass so he could finish as quickly as possible. He was also catapulting stones from the field in the process. Apparently he had done this before.

Don’t worry, Bob, they’re really not shooting at you. They're only slinging high velocity stones in your general direction.

Will It Work?

I left Unisys to work at Vanguard. I worked hard to develop marketable skills in order to be able to change jobs in my mid-forties. I earned Microsoft Solutions Developer status right at the time Vanguard decided to abandon OS2 and switch to Windows NT.

As the technical leader of this migration effort I was very busy. I was not a shill for Microsoft products, but I was a supporter. After all, Microsoft was all that I knew.

The first effort was just to port some of the major client server apps to Windows. At the same time some new projects were getting underway including Defined Benefits Front End. This was a C++ project and I basically had nothing to do with it. It was a client server app with data coming from the mainframe. The path to the data involved Sybase (Sybase was a hot product at the time) middleware along with MS Open Database Connectivity (ODBC).

This all sounds rather bland but it put me in the hot seat one day. I was invited to a meeting with many Vanguard principals and my manager at the time. I really didn’t know why I was invited until they started discussing whether ODBC over Sybase middleware was going to work. I finally realized that my manager’s ass was on the line so when he was asked “will it work?” he immediately turned to me and demanded to know “Bob, will it work?”

Remember, I had nothing to do with the project. I also did not know that there was a Sybase consultant (remember I did say that Sybase was hot) running around whispering in manager’s ears “it will not work.”

Since I wanted to exit the room wearing my head I looked my manager in the eye and said, “Yes, it will work.” That’s when I stopped respecting that manager who, incidentally, did not last there nearly as long as I did.