Concurrent thinking

Back when I was a kid, learning about programming in college, I was left with the impression that parallel computing/multi-threading is not easy. 1. We learned about race conditions, deadlocks, semaphores and all that. Once I started working, the idea that multitasking is hard was reinforced by the absence of it in our CAD/EDA tools which surely would have benefited from the effort. 2In recent years, my views on concurrency have finally changed a bit, first via the simplified threading model that Perl provides and more recently through my Android development adventures. A couple years ago, I supported a feature that required nightly crawling of a fairly large directory structure, a three deep tree with ~10,000 files each of which needed to be read and parsed. Normally, it would be ok for stuff to run for an hour or two, but in this case, I had to stop the service that depended on the tree until processing was finished. So I needed to parallelize. When I read a bit more about Perl’s threading model, I was surprised to learn that it’s mostly just forking, except it’s easier to pass data structures between threads/forks. 3. So I created 10 threads, each of which read it’s own subtree and passed back the results of parsing 4 The crawler utility wasn’t rocket science, but it did open my mind’s way of thinking a bit. Multi-threading doesn’t always have to be fraught with danger if you just limit the amount of shared data. Threading may be intimidating, but forking is easy. There are many tasks that lie somewhere in-between. With Android development, I’ve been forced to open up a bit more. Android doesn’t allow network calls from the main UI thread. You have to do it in a separate thread. Android doesn’t allow UI updates from anywhere other than the main thread, so I can’t just do everything in my side thread. 5 As I’ve worked on my SMPTE app, I’ve found concurrency is a nice way to divide the problems I’m trying to solve:
  • the main UI thread. Update the display, respond to buttons
  • a thread that other phones can talk to for syncing. Two+ actually. One waiting for socket requests and one for each accepted connection
  • a thread that reaches out and syncs to a master phone.
  • a thread that computes the current timecode.
  • I imagine I’ll have a thread for generating the SMPTE audio signal.
There’s very little that needs to be communicated between these. It’s really just the stored time adjustment value. In a way, even though I’ll have a bunch of threads, since there’s only one long that is shared, it’s really a bunch of almost independent processes.

  1. did people use the term multi-threading back then?

  2. I do remember that my friend Trey tried to add it to our signal router with mixed success. I don’t believe that effort ever made it into production

  3. forking usually requires you to setup a socket and serialize all your own data. This isn’t hard but I never took the time to write a series of helper routines.

  4. Most of the old slowness was due to the loop: ask for a file, wait for the fileserver, process quickly, ask for another file, wait some more

  5. I also found it interesting that garbage collection in Java happens in its own thread.

I have a better idea of the time

In a previous post, I talked about getting accurate time syncs between Android phones. My main objective has been to learn Android app development and I’ve found the best approach for me (for everyone?) is to implement a project. A SMPTE timecode generator is what I chose.  To develop a mobile app, you have to get confortable with things like:
  • creating a GUI layout based on XML and learning the available controls.
  • understand the main event loop related mechanisms, Activity, in the case of Android.
  • know how to change colors, fonts and sizes
  • how to use icons. The android ecosystem has many icons available but then you have to copy several image files for each icon you want to use to account for the different sized devices.
  • you have to be cognizant of when different system APIs were introduced. I want my app to be runnable on old phones 1
To talk a bit about my SMPTE app, I am almost comfortable with my ability to sync between phones. I considered something like syncing using some sort of audio signal. One master phone could emit a series of blips and the slave phone could emit its own blips and listen to the combination of the two. As suggested like my friend Vanya, I could treat it like a PLL. The child phone would look at the sound it’s hearing and move its own signal forward or backward. I will probably try this as well but I haven’t yet played with Android audio stuff. The approach I’ve taken so far is to use a socket connection between phones. The slave phone sends a kind of ping to the master which responds with its current time value. If the slave does 10 of these in quick succession, one of them is usually within 10ms round trip. I figure/hope that anyone wanting to use an app like mine would have an old wifi router laying around. The display gives the date and time followed by a hundredth counter. So in this picture the four devices are within 5/100 sec or 50ms. IMG_5064 And here’s another with lucky timing. 2/100 sec. IMG_5065 I imagine that some/much of the the differences are due to timing accuracy of the Android system. Updating the display a kind of round about. I have a scheduling thread that calls by callback every 10ms. That callback decides what to display and sends that along to the main UI thread. SMPTE timecode is only as fast as 30 frames per second, so 5ms or 10ms deviation is probably fine. I’m curious to see how/whether things change with the audio output. In that case, I don’t need a timer. I will simply feed numbers into an audio buffer and add more as the buffer empties. Is it harder to get consistency with audio or display timing?

  1. I really like the idea of finding new uses for old phones we’ve just thrown in a drawer somewhere

How do you know you’re straight?

This post has a bunch of footnotes. If you’re reading this via my email newsletter, I strongly recommend you click the title of this post to read it in a web browser. You’ll be able to click each footnote for a popup. It makes for an easier read.  Last week, the US Supreme Court decided in favor of marriage equality for Gays and Lesbians. This issue has been thought provoking to me in a number of ways, so perhaps I’ll write several posts on the overall topic. The thought that sticks out to me the most is “How do I know I’m straight/no gay?” Many opponents to marriage equality try to argue that homosexuality is a lifestyle choice; that one can be “born again hetero”. This post shares some of my life experiences that have led to my opinion that this is a BS argument. When I think of my own exposure to the idea of homosexuality, there are three people in my life who have shaped my opinion more than others. The first of these is a guy in my fraternity pledge class at MIT. I’ll call him TD, but anyone familiar the members of that era will know who I’m talking about. In the early days of knowing him, TD was pretty brash. He said all kinds of crazy and perhaps even offensive stuff. Borderline racist, and not so borderline homophobic 1. As pledges during our freshman year, 2 we didn’t have any say on which rooms we’d live in, 3 and TD and I shared a space for a while. We didn’t get along particularly well. We didn’t fight, but it wasn’t pleasant either. Sometime during sophomore year (maybe junior) TD announced to the house that he’s gay, first by having a brother from a different house spend the night and then bringing it up in a chapter meeting. The house seemed split 50/50 between acceptance/non-acceptance 4. The house had communal showers on each floor. I remember thinking of myself as progressive by telling TD in the shower, when we happened to be in there, that his personal life is his own. After the dust settled, TD was a different person. More relaxed, more aware, happy, fun. As seniors, we were roommates again, this time by choice, and we had great rapport. I wouldn’t want anyone to continue such a conflicted life. There was one conversation from that time that really sticks with me. TD had gone on dates with two different guys and stopped by the house with each. I got to meet his dates and chat a bit. Some days later, I asked TD, “so you gonna go out with X or Y again?” We talked a bit about the dates. One guy was too forward, the other is nice they’ll probably see each other again. What really struck me is that I could have had exactly the same conversation about women. Just change the pronouns. What I learned from TD, is that being gay is not a lifestyle choice. He was a different person after coming out. Furhermore, unless you want to fantasize about your friends’ partners, who your friends date doesn’t have any negative impact on you.  TD has been with the same man for a bunch of years now. TD was active in the fight for marriage equality, but I’m not sure they want to marry. The second person who shaped my views on homosexuality was also in my fraternity. I’ll be a bit more vague on his identity and the reasons why will be obvious in a bit. I’ll refer to him as Bob (since I can’t think of any others from my fraternity with that name) Bob was really fun. Everyone liked him. He dated women. One night we were returning from a night of partying at another fraternity 5 when he mentions that he’s bisexual.  I didn’t think much of it. A couple days later, Bob and I are chatting and the topic comes up again. He tells me he’d got a crush on someone else in the house and he’s not sure how to approach it. We chat about that a bit when I make a side comment, “I’m assuming, in this conversation, that you’re not talking about me”. A couple minutes later, he confesses that I am, indeed, the object of his crush. hmmm. Now what do I say? I’d never before had a guy tell me he was into me. Many of us may think we know how we’d respond in such a situation, but until you’re actually faced with it, you don’t really know. I indicated that I wasn’t interested, but over the coming weeks, he persisted. He was fairly specific and explicit, assuring me there’d be no obligations. These were the kind of advances, that many guys would not turn down if they were coming from a woman. It made me think. In college, I wasn’t really very lucky with the ladies. Like anyone else, a bit of intimacy or human connection would have been really welcome. I seriously considered it. College is supposed to be about exploration and finding oneself. Trying new things. I thought, “why not? I’m an open minded guy”. The problem was Bob doesn’t have the softness that I find appealing in women. Bob has body hair. 6 Bob doesn’t have boobies. Had Bob been more effeminate, I probably would have taken him up on his offers. This was also what solidified in me my confidence about my own orientation. You don’t really know who you are until you find yourself on the edge of some sort of cliff. I am thankful to Bob. Like TD, Bob has also been with the same man for many years. I imagine they will marry if they haven’t already. The third person who has deeply shaped my perspective on homosexuality is a woman I dated while living in Israel. I’ll refer to her as MF. MF and I met on a trip with Intel’s mountain biking club about two or three weeks after my arrival in the country. She’d largely grown up in Connecticut so she was a welcome familiar personality. I gave her a ride home from that trip and we agreed I’d give her a lift in future weeks 7. MF and I quickly realized we got along really well and I soon considered her to be my girlfriend. I met her parents and regularly had Friday dinners with them at their house 8. I got along really well with her parents. Her mom loved me. Not long into our relationship, MF asked me if I’d ever been with a guy. I replied no. She pushed a bit more, “you’ve really never been with a guy?”. I recounted to her my experience with Bob and thought it was odd that she was so persistent about the topic. She then told me that she had been with women in the past and told me of previous girlfriends. I was fine with that. Lots of women have made connections with other women. She tells me “so I’ve dated women and I figured that’s the path I’m on until I met you.” You can’t change who you are, but I didn’t really understand that at the time. I really liked MF. 9. We agreed that we’d give it a shot and see how it goes but I’d need to be patient. Several months of frustration ensued. If not for this obstacle, I would have married her. We got along really well. We had great chemistry. I fit into her family really well. We enjoyed the same activities. Being a compelling partner is not enough to convert someone. You’re gay/lesbian, straight, or something in between, but there’s no changing it. Soon after we broke up, MF started dating a woman with whom she still shares a life today. MF has carried four children that they are raising together. 10 I am thankful to TD, Bob and MF for the ways in which they’ve touched my life. I am happy for them that they’ve come to terms with who they are. I am happy to see that society is placing less pressure on folks to be someone they’re not. Marriage equality in all 50 states is another step in that direction. It’s not a lifestyle choice.   I have thoughts on other aspects on this topic that I’ll likely write about.

  1. A common thing for Mac users to do back then was to redefine system sounds. One of the guys in the house replaced the error sound (for example trying to type when a modal dialog was waiting for ok) with a sound clip of TD saying, “what do you think? I’m some kind of faggot?”

  2. this was in an era when MIT fraternity rush happened two or three days after new freshmen show up on campus. Pledges immediately moved into the house. MIT doesn’t do this anymore and I’m not aware of any other school having such a system. I think it worked well because you could rush without predetermined biases for or against the reputations of each house.

  3. During the first semester, we were each required to rotate between three different rooms, thereby being exposed to more many older brothers

  4. One of the brothers went so far as to say he could no longer use the chapter room to spend the night with his girlfriend. It’d been tainted. The same guy is somewhat religious and I found it humorous that he was using that room to screw the woman he wasn’t married to. In his defense, they did marry and are still together today.

  5. another thing that’s different about MIT (even today?) is that most fraternity parties are open to any MIT student, even members of another house. I believe most other schools (all?) have it such that you only go to parties thrown by your own house.

  6. I’ll note that my dad once referred to me as looking like a wolf 🙂

  7. In Israel, cars were quite expensive to own. Most people that did have cars, got them as a work benefit. Because of this, I got to know Haifa really well. Better than any other city I’ve lived in

  8. In Israel, Friday dinners is something everyone does, does, every week. I should do a post just on that. week. I should do a post just on that.

  9. in the years since I’ve returned to the US, I’ve visited Israel for work a bunch of times. In those visits I probably spent more time with her than my other Israeli friends combined. I also spent most of my first sabbatical with her on a month and a half trip to Kenya

  10. One of my trips to Israel was when she was pregnant with her first son. I’d never touched a pregnant belly before. A couple years later, I visited shortly after the birth of her twins. Sometime during that trip she took a picture of me holding one of them. At the time, I had a thought that made me really sad “this child should have been mine”

Parenting is…

Being a parent of young children gives new perspective. Things you used to think would be gross, aren’t.
In the spirit of a top 10 type of list. Parenting means:
Scooping poop 1 out of the bathtub. Kids are splashing away, getting cleaned up from the day’s activities, when you see a look of concentration. You know what’s about to happen, but by the time you pull your child out of the tub… plop. A turd drops in the water.
On another occasion, the child is pulled out of the water on time only to have a mushy turd land between your toes in your flipflop sandals.
It’s a hot summer afternoon. You’ve got the kiddie pool out, kids are in their swim suits or swim diaper. One of the younger kids, not yet potty trained, is taking a break sitting on your lap, when… what’s that wetness? A swim diaper is not really a diaper. It helps prevent a floater, but they’re not absorbent. In this case, being a parent means that instead of immediately changing your own shorts, you think, “well, my shorts are swim shorts. won’t hold a lot of pee. Will dryout quickly”.
I was at a wedding years ago. A friend was sitting across the table with her younger daughter on her lap. The daughter vomits but mom saw the signs and managed to catch it in her hand.  She calmly deposited the gift on her salad plate, wiped her hand with her napkin and continued as normal. At the time, I was impressed that she wasn’t grossed out, but it seems like such a normal response today.
Being children, there are lots of things that my kids haven’t tasted before. It happens regularly, that they’ll try something and then immediately spit it out. Instead of generating a garbage pile, it’s often easiest to just eat it yourself. What’s a bit of spit and tooth marks within the famiy?
My daughter is toilet trained now, but there was that transitional time. I remember one time, she’d pooped earlier in the day, yet didn’t wipe sufficiently 2. Later in the day, she’s running around in her birthday suit and sits on my lap. Heh, I now have a bit of a skid mark on my pants. Did I immediately change them? Given the theme of this post, I’ll let you guess.
We went car camping a couple weeks ago. Somewhere around  10pm, I hear crying from the tent were the kids are/were sleeping. My daughter is a pretty solid sleeper and only wakes up when she needs to pee. The problem is that she doesn’t really wakeup, staying in a sort of zombie state. I’ve come to learn to just pick her up and take her to the toilet. I bet there are many nights that she never really woke up throughout the whole process. This particular night, she resisted. “Put me down! I don’t need to go potty!”. I don’t really like to just force her to do anything against her will so I hesitated. Eventually, the river begins. The sleeping bags only got a little on them, but some does get on the floor of the tent. I quickly get her out of the tent; thankfully, I still had the door unzipped and we water the grass. Nothing like sleeping with a pee towel under your sleeping bag.
I refuse to have snot nosed kids. Anyone who’s been around kids knows what I’m talking about. A kid’s happily doing their thing with these two nasty, green, gooey snots hanging from their nostrils. I was once at the park where a kid had this going on. I look at the dad with this look of, “so… you gonna do something about that?”.  Nothing. Many/most parents just resolve themselves to this state of affairs. Snot can see unavoidable. Thankfully, there’s the Nosefrida AKA the snot sucker. It’s a tube with a funnel-like thing you jam in your kid’s nose and suck on the other end to vacuum out the green goodness 3. It sounds really gross, but I use this thing more than just about any other device. Being in Portland, I don’t get looks of disgust from other parents as I might in other cities. My 1.5 year old son has actually brought the thing to me to get a bit of relief.
All of these things either happened to me, my wife, or I personally witnessed the event. It’s a fact of life when being a parent, but it’s really not bad. As parents, we are in service to our children. We haul them from event to event. We go through zombie periods of not enough sleep. 4 These are the things we bear because we love our children.
 
 
 
Parenting is…

  1. parenting also means that you call it poop

  2. mom or dad still do most of the wiping

  3. it’s made in such a way to keep the parent from inhaling the snot. That would be gross be gross

  4. usually, it’s more the mom, but dads are affected too

Goofing off and Meeting expectations

The things that are expected of us have a great impact on our performance. Sometimes you have to do what you’re told. Sometimes it’s better not to.
I was comparing notes with my friend Trey about college. The computer science program he went through at Cornell was similar to my college experience. In particular, the class 6.001. (videos of the lectures can be found here) 1. Some other schools offer a variation of this class but either cover it in multiple  semesters or omit much of the material. My point is not that MIT is so much better 2 In fact, I’d say that much of the teaching wasn’t that good. MIT professors get tenure for research and teaching is perhaps a bonus. (note Jeremy Wolfe). The biggest benefit I got out of being an MIT student was the extremely high level of expectation. The class 6.001, which covers more material in one semester than other good schools do in multiple semesters, is the first CS class encountered by students. “We expect you to do this. Figure it out.”
A second example (I’ll have a point eventually). I took a not very good calculus class in a not very good high school. I also spent a bunch of time over the summer before college with my nose in a calculus text. The things I learned lasted a lecture and a half of my first math class in college. “This is what we expect. Figure it out”. 3. A couple weeks into the class Prof Greenspan commented that much of the class didn’t seem to have a good grasp of one of the concepts. He passed out a handout, encouraged us to seek help from the teaching assistants, and then proceeded to continue at the same pace as before. Figure it out.
I’ve tried to maintain a high level of self-expectation throughout my career. Had I gone to a different school, I may have achieved a lower level of overall success only because I may not have learned I’m capable of as much.
Although I’ve often done what is expect of me, there are also lots of times that I do my own thing and that has also served me well. In my programming work, I often came across some unexplained behavior in the compiler or interpreter I was using. Perhaps a library didn’t really behave the way I expected. There is usually a work around to this but most of the time, I found myself compelled to really understand the mystery. More often than not, this resulted in a bit of not-so-useful trivia. Perhaps I’d find a bug. Not always, however, and the totality of the useful stuff I learned served me well and I became a better, more effective programmer overall. I thought of these hunts for the explanation as goofing off. I didn’t really need to know the answer, but I wanted to. The search was fun. This was particularly true about the Perl language, which is used a lot in Intel design. I can think of one person at Intel (a reader of this blog) who is probably as familiar with the ins and outs of Perl as I am. 4
Most people I worked with at Intel didn’t spend nearly enough time goofing off.
So, an example of a contrast. Intel has the best semiconductor process technology. I’d challenge you to find anyone who thinks that some other company can do it better. Intel’s designs are good, but not clearly better that those from other companies. My brother-in-law works in lithography of one of the cutting edge process nodes. 5 He works in a part of Intel that is better than the part I belonged to.
Recently, while hanging out, he asked for help converting an image file into something that JMP could accept. To me this sounded easy. ImageMagick has several conversion possibilities that could serve as a starting point. 6 One these gives something like this:
6,0: ( 1, 1, 1) #010101 srgb(1,1,1)
I removed the # comments and sent him the result for the sample image he gave me. JMP doesn’t like this format. It really wants tabs and really doesn’t want the ()’s.
I challenge you to find anyone in my department that would require more than 2 minutes for remove the ()s and swap the other stuff for tabs. If an interview candidate struggled with this, I’d hope we wouldn’t hire. Again, my BIL is in a leading edge part of Intel in a field that Intel is clearly dominating. To be fair, my department was mostly programmers for whom this stuff is easy but manufacturing involves a lot of automation, repetition,… the stuff that benefits from a bit of code.
I think it comes down to expectations and I’m getting closer to making a point. Before I do, I have another anecdote.
A guy I worked with in design used to be a technician in Intel manufacturing. One of the assignments he was given was a fairly repetitive task. Run a bunch of experiments for a week, taking data and come back with the results. He did this and was promptly asked to do the same thing on a different set of test batches. Fearing he’d jump off or a bridge at the thought, he automated the task and produced the same results in 4 hours, much of which was spent waiting for the computer to finish. With some simple automation, he reduced a task from a week down to half a day. This was not a new task; the old way had been the way for a long time.
On a recent neighborhood camping trip, I was talking to a former Nike manufacturing related engineer 7. Somehow JMP came up and I related these stories to him. “Same thing is true at Nike”.
These are not isolated incidents in an otherwise very capable portion of an industry dominating Intel division.
Intel’s technology development divisions are very high pressure with high results expectation… potentially at the expense of long term individual productivity. I did the file manipulations using Linux based tools but those same things are available on Windows through Cygwin 8. No one in process development seems to have the time or take the time to do what I call goofing off and learning these tools. Short term, there’s usually a way that will be quicker for the task at hand. Getting comfortable with scripting, grep’ing, perl,… takes some getting used to, especially for non-programmers.
High expectations can be wonderful (though it may not feel that way at the time), but they can also bite you. Be sure to spend lots of time goofing off.
Goofing off and Meeting expectations

  1. sadly, MIT no longer offers this class. I really think that’s a big loss. It was a wonderful class. I suspect that part of the reason is that electrical engineering types often struggled with it. My memory of test results is that computer science majors would score somewhere in the high 90 percents while EE types would score closer to 60%. I know a couple folks that switched to mechanical engineering in part because of this. Either way, I think it was one of the two most useful programming classes I took. Algorithms/Data Structs was the other

  2. many of my peers didn’t seem particularly motivated in their majors of choice.

  3. That second lecture of 18.011 (which I don’t see in the current catalog) was taught by Harvey Greenspan using a book he’d written and culminated with a derivation of the  and culminated with a derivation of the Taylor Series expansion of e. One of the mid-term questions expected us to derive the series for Sin-1 (inverse sine) expansion of e. One of the mid-term questions expected us to derive the series for Sin-1 (inverse sine)

  4. Randal Schwartz used to work at Intel. He surely knows more about it than both of us together  used to work at Intel. He surely knows more about it than both of us together

  5. to me, lithography is one of those things that seems like VooDoo. I think: “Really, people do that?”, when I hear about some of it when I hear about some of it

  6. ImageMagick is likely not known to engineers who havn’t done much photography, but the rest of my argument will not suffer from this

  7. much of what they do, like the pistons in some of their sneakers are actually quite difficult to produce

  8. I believe Intel’s internal IT software installer can include cygwin if desired

Updates from the McCoo homestead

The weather’s been nice and the garden is booming.
The Hydroponics are doing well. This was a month ago:
Dutch buckets 1
This is now. A little spindly since they are in the shade of the house for much of the day:
IMG_4932
A month ago:
My Kratky Beds
and now (there are several boxes that were not present in the previous picture):
IMG_4931
Before:
Dutch buckets 2
after:
IMG_4930
 
Last fall, I planted a bunch of tulips in the middle of the lawn, which did well. They are gone now, however they prompted me to not mow that part of the yard. I’ve continued the habit and it’s yielded a nice little meadow. If the whole lawn looked like this, it’d just be overgrown, but surrounded by the manicured putting green that is my lawn, I think it looks nice. My part of Portland tends to not water the grass. I plan on giving the “meadow” some water here and there, especially when emptying the kiddie pool.
IMG_4929
Part of the inspiration for this was the book On Meadowview Street that we’ve read many times to Lydia:

 
The most abundant part of the yard is the bee hives.
IMG_4927
It would be logical to ask why we have three hives. Well, it started with just one composed of the larger boxes. Then I realized how heavy a fullsized hive body (one of the levels of the box) weighs. So I bought a bunch of the shallow ones which still get pretty heavy. I also tried making some myself as a woodworking project. The result is that I have three hives worth of components. Only two of them were occupied through the winter. When I harvested some honey from the right most hive, I noticed that many of the frames had brood (larvae) so I took a risk at moved some of those to the empty middle hive. The bees can raise a queen from some of those brood and build a new hive. Now that it’s a couple months later, it appears to be healthy. Hopefully, they’ll become strong enough to survive.
A couple days ago, I harvest honey from the left most hive, which was the strongest. Here is some of what I got from them; about 4 gallons. These are all quart mason jars.
IMG_4938
My extraction process is pretty simple. Just a 5 gallon paint strainer duct taped to a cut bucket. Most of it strains in a couple days but I’ll likely get another quart over the next month. Note that there are another five frames that are still waiting. I was starting to worry that the duct tape won’t be strong enough to hold the weight.IMG_4934
 
If anyone cares for honey, let me know. If you’re an Intelite, I will get some to JF to be passed along. If you’re somewhere else, give me your address and I’ll mail some.
I’ve also melted/separated the beeswax. Here’s what I’ve accumulated over the past two years. I don’t know what to do with it. I’ve you’d like any or all of it, let me know and I’ll send it to you. Anyone know how to make lip balm? I’ve included a quart mason jar for scale. The middle ones are the more recent ones. Remelting the others should bring back the nice yellow color.
IMG_4939
Updates from the McCoo homestead

Role models and inspiration

It’s been a month now since I left Intel. Life is busy. There are lots of days when I go to the park with the kids not once, but twice. It’s gotten to the point that I’m on the lookout for more parks; can’t just go to the same place day in and day out. As I’ve kept mentioning, I still want to do technical work. I continue to chair the SystemRDL committee and that’s still engaging. Beyond that I have some other programming projects (I do like to write my for loops). I haven’t done much so far, I’m mostly setting up a work environment. Getting a linux box running in the basement, configuring a windowing environment like the one I used at work plus some additions I should have implemented years ago. I’ve installed the Android environment.
It’s all normal pre-work. A slow start, but I’ll be productive soon enough 1. The thing that concerns me a little bit is that I have less access to role models, inspriration, muses. So I figured I’d talk a little about where I’ve drawn from in the past. There are a bunch of sources:
  • Books and discussions around them
  • People online doing cool stuff
  • Code reviews.
  • Serendipitous cubical interactions.
  • CADPax
Books
It hasn’t happened as much in recent years, but the early times of my career felt like a Renaissance of Computer Science. The folks in my work environment were reading lots of books and implementing the ideas found therein. There must have been 15 or more participants in my local circles. Some of the books that come to mind.
  • Code Complete
  • Writing Solid code – written by Microsoft at a time when their products seemed so unstable.
  • Design Patterns 2
  • Modern C++ Design – quite a tough read, but worth it. It reminded me of some of my MIT math classes that were taught from a thin (1/4″ thick) book yet only covered a quarter of the material in it.
  • Effective C++ – The author Scott Meyers visited Intel on at least two occasions. First to consult on some stuff the dept was working on and later to give a talk on Programmer’s Day. From a conversation with him on the second occasion, I was amused to learn that he’s never really been a developer.
Cool online folks
In recent years, I’ve come to value the ideas I get from online personalities. This section warrants a digression to my childhood.
I’ve always been a curious person 3 but, as a kid, I lacked in world experience and hence had trouble filling my time. I can remember one summer, when I basically burned time by watching not so interesting television. Don’t ask my why I didn’t just spend more time reading or at the library. Had Youtube been available, things would have been much more interesting. I would have spent more time tinkering.
Jeri lElsworth is super awesome with a great story. She grew up largely in her dad’s auto service station. She made a living for a while building race cars and later doing circuits. I don’t believe she ever went to school for any of it. As a bonus, she’s from the sticks near Portland.
Dave Jones of EEVBlog and The Amp Hour podcast. I enjoy hearing his frank critiques of various electronic designs. Lots of great real world stuff.
As I’ve mentioned before I enjoy the ATP podcast. Although they talk about Apple stuff (which I am opposed to), they do it in a way that is interesting. It’s good to get a look into how knowledgeable people look at stuff.
Dangerous prototypes I appreciate how a tinkerer put up an open design of his Bus Pirate, was eventually approached by the  Seeedstudio people which became popular and he made a career out of it.
Through links like these, one can get to a ton of others like them.
Code Review
Early in my career, some coworkers came across the only way I’ve seen to do effective code reviews. It goes like this:
  • Print out the code in a line-numbered way such that everyone sees the same numbering
  • Everyone takes an hour to read and markup their copy (we did it on paper, but I’ve found that Code Collaborator can be used for this 4
  • You get together in a room and, round robin, everyone makes an observation.
  • Discussion ensues.
It’s a fairly standard code review thing, but there are some things I find really important:
  • I don’t care if we find actual bugs. Sure, that’s a bonus, but we usually don’t find something earth-shattering. The code is usually specialized and only the author really understands it. The frequency of significant finds is not enough to keep everyone motivated.
  • Personally, I find that coding standards are a waste of time. They always seem to devolve into arguments about where the curlies should go, how much spacing, camelcase,… I have only one universal rule:
    • Be consistent to the rest of the file/function. Just because the placement of the curlies doesn’t make sense to you is not reason enough to be different from the rest of the code you’re modifying.
  • Each reviewer makes comments based on their own experience and hangups. If it’s important enough for them to fixate on it, it must be worth noting and sharing.
  • The real value comes from the discussion. It goes like this:
    • A: on line 27, I don’t like leaving out the curlies on a single statement if.
    • B: really? that adds clutter
    • A: sure but what happens when you add a debug statement two years from how.
    • B: add the curlies then.
    • A: ok. but what if you first make this change, then this other change, then you delete this original line,… you have a bug.
    • B: …. oh.
  • After many discussions like this, the group will come to a consensus:
    • Oh, that’s just something that Miles was bit by years ago, but we don’t agree it’s an issue.
    • You really do want to do A, B, and C.
  • Most important of all, in the end, the owner of the code is a well paid professional, who’s employed to use engineering judgement. The real value of these reviews is to educate each other and improve that collective judgement.
Cubical interactions
I’ve found that I don’t work so well in isolation. I need to talk to people. The people don’t need to be particularly knowledgeable on what I’m doing. I sometimes wonder whether a manikin would work as well. Just the process of explaining is enough to get my juices flowing. There are a couple ways in which the other side needs to be human.
When I worked in Israel supporting mask designers 5 to more effectively use the design tools. There were often times that I didn’t feel like working, so I walked around finding other people to corrupt. We’d shoot the breeze a bit, how are the kids?, going on a vacation?… Eventually, I’d ask them what they’re working on. What are you doing? How are you approaching it? Which commands are involved? Why don’t you do it this other way? Ah, I see why you can’t do it that way. Still why are you using this command. How about this other one? Response: well, that command has this side effect…. Me: I can fix that. We’d talk about what the thing should really do and I was motivated to work again.
Second story. My original manager, Avner, mostly left me alone. He sat in the cube next to mine but we often wouldn’t talk for days. Eventually, he’d come by “your cube has been quiet for a couple days. That usually means you’re cooking up something”. I’d explain what I was working on even though he likely didn’t understand most of it. What he did understand was how I talked about stuff when I wasn’t entirely convinced it was the correct approach. Maybe I just wanted to get it done, but he would zoom in on that. He sensed the chinks in the armor and didn’t let me get away with it. I’d try to explain why doing it the right way would be too hard but the process of explaining often showed me an easier way to do it right.
Of course there are also the people I can always go to for engaging discussion about whatever I’m trying to do.
 
CADPax
Years ago, in the golden age of programming in my department, someone noticed that all of us had our own little library of routines that made our programming lives easier. Code for spawning execution of several jobs, how to do common things in the tool we were working on, ways to make it easier to interact with TCL/SWIG. We got together to figure out a ways to reduce the duplication of effort. Releasing this stuff with the main tool didn’t really make sense. Each small library was too small to justify it’s own sub-tool. So we created an umbrella tool called CADPAx. (packages for the family of CAD tools we all worked on).
CADPax eventually became a pile of stuff I grew to depend on, but that wasn’t the main benefit of the library. Instead, it was the mindset it put me in. The mere act of considering the re-usability aspects of my work made my work better. Doing things cleanly often doesn’t require much more than thinking about it for an extra minute on a regular basis.
 
When done and managed well, the human work environment of a programmer can do a lot help hone the skill, maintain motivation, enable miracles to happen. Now that I’m not at Intel anymore, I need to find replacements for some of these.
  • Please comment with any book titles I should checkout.
  • I’m a good code reviewer (at least I think so), bug me if you’d like to do one.
  • I have one or two prospects for collaborative projects. Let me know if you have an idea.
Role models and inspiration

  1. Robie and I have agreed on a family schedule that gives me the equivalent of a couple solid days to do whatever I want… Garden, programming, lunch with friends. It’s mostly 4 hour chunks.

  2. I’ve had exactly two interviews in my career (in which I was the one interviewed). The second one was with Autodesk about eight years ago. Sadly one of the questions I did poorly on about a design pattern. I supposed that had the culture of discussing books continued around me I might have done better and gotten an offer. In retrospect, I’m glad I didn’t get the job. There’s no way the hiring manager and I would have gotten along. No real way to know

  3. my older sister likes to tell a story from when I was 5 or 6. I had watched my dad build a set of speakers. Soldering and all that. Some time later, I wanted to listen to the radio in my room, but the stereo was in the living room. In the closet’s junk pile, I found a length of antenna wire and one of my dad’s unused speaker drivers and wallah, the music was in my room

  4. you just have to ignore CC’s strong desire to do the standard thing of only reviewing diffs

  5. people who are employed to draw the polygons representing the wires and transistors that make up a semiconductor circuit. At car companies, they be called draftsmen/women.

Do you know what time it is?

 
For the non-native English speakers: what time it is
I’m thinking about writing an Android app that requires several devices to do something at the same time. They need to be coordinated to within about 1/50 of a second. It’s not important that they do this thing at a particular time. It only matters that whatever time they do, it is the same for all of them.
Here are some of the devices I have laying around the house.
  • Two old Motorola XPRTs (never liked em).
  • A Barnes and Noble Nook HD.
  • An HP Stream 8
  • and a Galaxy S5.
In this picture, all of them are running Digital Alarm Clock. Note that they all show a different time. The devices all do “get time from network”.  Clearly not within 1/50th.
IMG_4908IMG_4863
So I tried getting the time from GPS using the app GPS Time. I don’t recommend this app. It crashes every time the phone goes to standby as well as other random time. Still, you can see the times still don’t match. (all the pics are clickable for larger versions). All of the times are different.
IMG_4909
Since the app is so unstable, I figured maybe a different app would do better. Perhaps, the inaccuracy is a problem with the app. GPS Status and Tools is much better. (it’s a very nice app; lots of features) Again, all of the times are different, though I think something wasn’t right on the S5. For a while it had trouble connecting with the satelites; that may be because the battery was low.
 
IMG_4914
So I looked around a bit more and came upon several mentions of NTP (network time protocol). Reading about it, it’s specifically intended to give accurate time to computers. The result is very close. The first attempt at photos 1 had only disagreement only in that the Nook is a bit off. When I re-took the pics, I got this one where all the times are different. 2
IMG_4916   One issue I have with using NTP is that it requires an internet connection. I’d like to be immune to that. My next idea (the one I’m likely to go with) is to connect them all through wifi and have them talk to each other. The question is whether there are any elements in the chain that slow things down 3
So I did some experiments using the simple ping command.
  • Pinging from my desktop to my router yields times < 1ms. Great!
  • Pings to my S5 gives values ranging 9ms-100ms. not so good. 9ms was an outlier. 40ms is more common.
  • Pings to Nook are consistently about 4ms. I don’t run nearly as much on the Nook as the S5.
  • On one of the XPRTS, It’s 6ms-200ms. 60ms seems common.
  • The stream 8 usually pings in 3ms.
hmm. not so promising but perhaps an app can mitigate this. ping is likely not the highest priority thing running. According to this article, 1ms is achievable on Java, but it remains to be seen whether it translates to Android’s Java.
That’s as far as I’ve gotten.
What’s the rest of the app going to do? It has to do with SMPTE Timecode. I want to try shooting some multi-angle video; more than one camera at a time and perhaps separate audio. SMPTE Timecode is what the real studios use. It’s a digital encoding of the current time that’s transmitted to each recording device as an audio track. Video editors like Final Cut or Premiere then can automagically align the footage on the timeline using the recorded timecode signal. The problem is that equipment to do this is expensive. Android devices can be found for cheap. Who among us doesn’t have an old phone or two, just sitting in a drawer? There’s is already a timecode app, but it doesn’t include sync between devices. You’d need to distribute the signal from it to each recorder via some sort of transmitter (something you probably don’t have lying around).
Timecode is at a granularity of 30 frames per second (or whatever the video framerate is). Hence the requirement to be within ~1/50th of a second to give a bit of margin.
Kudus, if you’re a less technical reader and you’ve made it to the end.
 
 
Do you know what time it is?

  1. taking photos of especially the stream 8 was pretty difficult. The reflections were hard to avoid. The ones I’m posting were mid evening.

  2. At this point I’m only scoping the problem. I haven’t written any code yet. I haven’t even written an Android app yet, but this is the project I want to use to learn.

  3. my assumption is that if I have high latencies, this will limit accuracy. I also assume that accuracy will be no worse than the latency. So if the app keeps trying until it gets one with good turnaround time, it’d just use that.

Why write a blog?

A couple notes to those that read these blog posts via the email list
  • the footnotes I use are much easier to deal with in a webbrowser. you click and it pops up right there.
  • in my last post, I linked to a couple youtube videos that got filtered in the email version.
  • The title of the post is a link to the web post.
 So I’ve restarted my blog. I’m also working on getting a podcast going. Why? It’s a bit presumptuous or narcissistic to do so. Why would anyone care? Is it more than an ego thing? Some time ago, my friend Chris R observed that facebook type activity doesn’t make sense to him. Posting assumes that someone cares. At the same time, he hosts a yearly slideshow1 recapping  his adventures. The three that I have been to have been quite interesting and well attended. It’s easy to convince yourself that you have nothing to offer but at the same time have lots you want to offer. So why do I do blog postings? My main reason is the value I put on sharing. I think it’s a blessing when someone shares something interesting with me. I feel compelled to share what I know. “hey! here’s something cool! Maybe you’ll think it’s cool too.” Another reason is that occasionally 2, I get some sort of feedback that people read what I write or that someone listened to something they overheard me say. My words can be worth eavesdropping on. While at Intel, we were expected to write a regular status report listing the things we’ve done since the last report. It used to be weekly, but in recent years, it’s biweekly. Other groups do it monthly. Just about all of these are boring, boring, boring. We write them only because we are compelled to. This is also true for most of my weeklies, the exception being the “random” section. I’ve mentioned this before in this blog. That’s a portion that I’ve attempted to make useful or interesting. A rant, a thought, a neat work thing I learned recently. There were probably 10 people that I knew always read that one section of this one person’s weekly. I’d regularly get a comment, “hey, I tried the trick and it was helpful”, “don’t get Miles started on X”, where X was something I’d ranted about and I hadn’t talked to that person on that topic. It was nice to get the feedback and it was fulfilling to share what I know. But why would anyone feel self-conscious about spilling ones thoughts to the world? Why wouldn’t the world care? A couple reasons come to mind:
  • we’re taught to be modest. Attempts to share knowledge are often equated to showing off. 3
  • facebook culture seems filled with superficial crap. “hey everyone! I’m drinking a latte”. Some people post several times an hour. I mostly avoid it because it’s so difficult to filter through the drivel to get to the good stuff.
  • twitter 4 limits any posting to 140 characters. Anything worth saying surely requires more than 140 characters. This post, without any edits, already has almost 600 words.
So I appreciate the feedback I get from my “fans”, the people who read my weeklies, or blog posts. The people who tolerated and encouraged my questions or commentary at work meetings. It’s because of the little indicators that someone read to the end. It’s because of the blog comments I get 5 I’ve been reading a philosophy  book recently. I haven’t gotten very far; maybe 50 pages. They way I summarize the important parts of it is by way of analogy: when you finish watching a movie, you probably think to yourself “that was a decent movie”, or perhaps “well that was an hour and a half of my life I won’t get back”. When I get to the end of my life, what will I think? Hopefully, it’ll be “that was a good life, well lived” and not, “what a waste”. I bring it up here, because having something interesting to say tells me that I’m doing OK. I can chitchat on many topics. 6 People seem to find it interesting. I think it’s interesting too, I guess that’s why I know it. The internet (da web) is a wonderful place. I wish it had existed when i was a kid 7 Today, I marvel at the things people have put out there. I’m a youtube  junkie. There are podcasts that I devour. There’s nothing you can’t learn how to do with a bit of googling or perhaps posting a question somewhere. This is my contribution to that. 8  

  1. he’s been doing it since the days that this actually involved slides

  2. sometimes more frequently

  3. perhaps this is an artifact of me growing up in a neighborhood where being smart is something many keep low key. Perhaps it’s just a matter of being a teen, but it’s something that’s stuck with me

  4. which I don’t use, haven’t tried, I don’t even have an account

  5. I’m particularly impressed by one comment I got on this blog after three years of not posting. After all that time, she is still subscribed and still reading. It’s especially flattering given how impressive she is herself.

  6. I’ll often comment on stuff I know nothing about. “I have no idea, but if you’d like, I can make up something based on what I do know”. I try to be honest about the basis/source of the things I say

  7. the first time I even heard of web browsing, I blew it off. That was a year or two out of college, when Mosaic was the only brower, before anyone heard of yahoo, netscape, or even infoseek

  8. makes me think of Eddie Murphy’s joke about Johnny Carson’s wife. “Johnny’s worth $300M. What’s she gonna do, go get a job at a boutique? ‘here honey, now we have 300 million and 50 dollars’”