HNHacker News
TopNewBestAskShowJobs

gregfjohnson

1,544 karma · joined February 8, 2008

submissionscomments
gregfjohnson··on LwIP – Lightweight IP Stack
We used LwIP for a project some years ago, and found a very nice way to do system testing.

The project involved multiple microcontrollers communicating over an internal LAN. They used a small embedded kernel named MicroCOS, with LwIP as the IP stack.

We had cross-platform build tools set up, so we could build our stand-alone microprocessor applications either for native execution or with gcc, compiling to x64 code and executable on developer boxes. In the latter case, we implemented the lowest level link-layer part of LwIP using a mock, that used standard TCP/IP! We wrote a small TCP server and would spool up the micro-controller applications, which would then talk to each other on the developer machines as though they were running inside the actual system.

This setup worked really well, and we used it for years during the development effort for the project.

gregfjohnson··on Why Don't Tech Companies Pay Their Engineers to Stay?
A person close to me works at a law firm. She was feeling a bit stagnant, so she connected with a recruiter. She got a very solid offer with a significant pay bump. She gave her two weeks' notice to her firm, including appointments with the partners. One of the partners asked her for a half hour. They came back with a massive pay raise, and a promotion to partner if she would stay. She was in a state of shock, but then informed the other firm that she was staying at her current firm.

By way of contrast, an engineering firm I am familiar with had an employee who had been there six years, and knew the company's very complex product inside and out, every nook and cranny. He was one of the only people who had such deep understanding of the system that he could fix any issues that might come up, hardware, firmware, software, everything. He gave his two weeks' notice, and then went to a different job. He's a very talented guy, who would command a very attractive offer, but his talent to the current company is vastly greater than his generic value on the market, because of his detailed knowledge of the product. Although he diligently documented his knowledge, the company was still left in a jam after his departure. It would have been great if the company had fought for him the way the law firm fought for the other individual described above.

gregfjohnson··on Founder Mode
I grew up seeing founder mode first-hand. My dad founded Celestron, and he operated just as Paul is describing. At my current company, I see the CEO doing the exact same thing, which gives me great hope. Huge contrast from my previous start-up, for which I have great anti-hope unfortunately. (Current company is Zap Surgical Systems, with Dr. John Adler as the founder.) I've seen John everywhere, all day every day. I've seen him literally on his hands and knees under our robotic treatment table back in the engineering lab, discussing details with a young mechanical engineer. And yeah, we are curing cancer ;-)

To re-iterate: What I believe PaulG is saying is that there is a crucially important phenomenon that we don't yet understand, and naming it will facilitate the process of bringing it into focus so that we can help more companies be successful.

His footnote has a painful resonance: "I also have another less optimistic prediction: as soon as the concept of founder mode becomes established, people will start misusing it."

This is exactly what has happened to the Agile methodology.

gregfjohnson··on How to Know When It's Time to Go
I turn 70 tomorrow, and have been programming for about 53 years. Started a new job about six months ago. I immensely enjoy banging out the code every day. It still feels like a guilty pleasure! "Shouldn't I be doing homework right now rather than creating 3-D worlds algorithmically?" My first language was APL, which I learned in a college computer science course. This hard-wired me to think in functional terms; I personally think Iverson and Dijkstra were saying the same thing, but Iverson said it better: reason about your code from an "outside of time" perspective rather than mentally imitating the fetch-execute cycle of the machine. I view software development as a form of discrete mathematics; inductive reasoning for sequential blocks of code, Pnueli-style temporal logic for concurrent and parallel code. I've learned from some wonderful people how powerful it can be when a team likes each other and gets into a collective flow state. It is a bit like a mental version of quantum entanglement, and it is a very satisfying and meaningful thing when you get there. I've benefited from friends who helped me get that next job, and I've helped friends get their next jobs. About 20 years ago I made a switch to medical device software development. That is a domain that requires dedication to learn relevant mathematics, it is not going to go away, and you become a valued commodity when you have specialized skills and a talent pool that is not too large. And, you get to do things like visit your grandchildren in a NICU and see neonatal ventilators that you helped develop. So, I've been lucky, being able to play all day and do something I love! There are a million different paths through the space of software development; I've tended to traverse the space using the "what would be fun to goof around with on a Saturday" metric.
gregfjohnson··on Ask HN: What was an interesting project you started and finished over a weekend?
Goofing around with the Y combinator, and quines (programs that print themselves): I wanted to see how much a quine written in C could be made to look like lisp-style self application. Worked out pretty well!
gregfjohnson··on Parrots love playing tablet games. That's helping researchers understand them
Heard the following joke a while back, seems pertinent:

Gaia making a mental note: "Hmm. The jury is definitely out on whether it's a good idea to combine large fore-brains with opposable thumbs.."

gregfjohnson··on Fixed-point combinator
One additional comment, regarding the "fac1" functional above:

  >>> fac1 = lambda f: lambda n: ((n > 1) and n * f(n-1) or 1)
If you happened to have a function "my_fac" that calculates the factorial function, and you applied "fac1" above to that function, you would get a new implementation of the factorial function, that calls your my_fac function internally. In other words, "my_fac" is a fixed point of fac1:

  >>> fac1(my_fac)
is the same function as my_fac.
gregfjohnson··on Fixed-point combinator
Here is a way to look at this in concrete terms, using python.

An important class of lambda terms are those for which there is no normal form. In computational terms, these are terms that would cause you to go into an infinite loop if you tried to apply the conversion rules of lambda calculus "until" you reached a normal form (i.e., a lambda term for which there are no beta redexes).

Canonical example:

  >>> (lambda fn: fn(fn)) (lambda fn: fn(fn))
  Traceback (most recent call last):
  ...
  RecursionError: maximum recursion depth exceeded
For many functions, the fixed point turns out to be a variant of this divergent ("infinite loop") expression. Assuming a definition of "+" that preserves divergence, then "infinite_loop" is a fixed point of f(n) = n + 1.

An encoding of the fixed point operator in python is:

  y = lambda Input_Fn:((lambda f: lambda n: Input_Fn(f(f))(n)) \
                       (lambda f: lambda n: Input_Fn(f(f))(n)))
For fun, we will play a little bit fast and loose, and combine standard integer arithmetic with lambda calculus.

Here is a functional whose fixed point is the factorial function:

  >>> fac1 = lambda f: lambda n: ((n > 1) and n * f(n-1) or 1)
Example evaluation:

  >>> y(fac1)(4)
  24
If we use the standard encoding of the integers as Church numerals, two would be represented as:

  two = lambda successor: lambda zero: successor(successor(zero))
The "add_one" function becomes:

  add_one = lambda n: lambda successor: lambda zero: successor(n(successor)(zero))
For concreteness (and human intuition), we can define

  int_zero, int_successor = 0, (lambda n: n+1)
  >>> add_one(two)(int_successor)(int_zero)
  3
What is a fixed point of the add_one function?

  >>> y(add_one)(two)(int_successor)(int_zero)
  Traceback (most recent call last):
  ...
  RecursionError: maximum recursion depth exceeded
gregfjohnson··on Useful Uses of cat
Thoughtful article - thanks. Humorous aside: I recently came across a hilariously named, occasionally useful, related utility: "tac".
gregfjohnson··on The Namingless Programming Language
Completely agree. Reading another engineer's code recently, which had egregiously bad names, the following thought occurred to me: Writing software is like writing poetry. Finding the words that perfectly capture and express the essence of your thinking and the underlying model or theory behind your code is so important. In software as in poetry, one is always on the lookout for that "mot juste".
gregfjohnson··on Momentary fusion breakthroughs face hard reality
A new fusion company name Blue Laser Fusion is working on inertial fusion with new laser technology. Does anyone have information on what they are doing, and what the prognosis is for that company's approach?
gregfjohnson··on Two's complement integers with only sign bit set should be a trap representation
Thanks so much - I was unaware of this clang flag. I just confirmed, it does exactly what I was hoping for!

I suggested that this be an optional flag, not the default behavior. I could see using it for unit-test/static-analysis builds where performance is not the main concern. (I have not looked at the generated assembly or done a performance comparison, but it might be that the -fsanitize=integer flag would slow the generated code down.)

gregfjohnson··on Two's complement integers with only sign bit set should be a trap representation
Here is my favorite example of errors due to overflow:

std::vector<int> vec;

// test for sorted..

bool sorted = true;

for (size_t i = 0; i < vec.size() - 1ULL; ++i)

    if (vec[i] > vec[i+1]) {

        sorted = false;
        break;

    }
I believe the google c++ style guide rues the selection of unsigned integers as the return type of size() in the standard library for reasons like the above. Personally, my preferred behavior would be to have a compiler flag that could be used to enable a trap if unsigned arithmetic resulted in wrap-around, as in the above case when the vector is of length zero.
gregfjohnson··on Tiger moth jams bat sonar (2009)
There’s a fantastic book called “An Immense World” by Ed Yong that covers the incredible range of sensory modalities found in nature. One of the chapters goes into depth on bats and sonar.
gregfjohnson··on Over 2 percent of the US's electricity generation now goes to Bitcoin
If I understand correctly, the computational expense of Bitcoin mining is increased periodically to track any improvements in hardware or software.

The value of Bitcoin is thus supposed to be tied to some underlying measure of value.

We used to have gold-backed currency. Then we went to fiat currency. It seems like with Bitcoin we are going to coal-backed currency.

If nuclear fusion became a thing and energy prices went to near zero, would Bitcoin expand to the point that it was using 99.9% of all electricity?

Personally I think this is a ghastly waste of energy.

gregfjohnson··on Two handy GDB breakpoint tricks
Same. I typically define a function "void bp1(){}" in a common utility file, put "bp1();" where I need a breakpoint, and "b bp1" in gdb. Hacky, sure, but really convenient.
gregfjohnson··on Boehm-Demers-Weiser conservative C/C++ Garbage Collector
This thread brings to mind an issue I’ve wondered about: For hard real-time systems, do people use specialized CPU’s and hardware? Caches can introduce hard-to-predict timing issues. I’m sure there are other aspects of modern hardware that present similar problems; large pipelines? Speculative instruction execution? Does Intel Time-Coordinated Computing address some of these hardware issues? Are there embedded CPU’s from TI, Intel, AMD, etc. that are specifically designed to support predictable and understandable “lockstep” hard real-time time behavior?
gregfjohnson··on The quality of your life is the quality of the people you get to know
Great read for the beginning of a new year. Thank you. Humans have the capacity to become deep and wise. This essay is empirical evidence in support of that assertion! It seems, though, that something has to break for this transition to take place. I lost a friend to cancer when he was in the prime of life. It sent me into a spiral of surreal disorienting despair, and shattered the superficial model of life that I had been unconsciously following. It was the start of a different and deeper way of being for me. Reading this profound and thoughtful essay re-activated my awareness of this sensibility. Thanks for laying open the truth of your life. I hope that you have a good number of good days ahead of you. (To the extent that any growth or positive change happened, I would of course give it all back in an instant for my friend still to be with us.)
gregfjohnson··on Tell HN: Merry Christmas
Merry Christmas all. Thank you for this thread.
gregfjohnson··on Anselm's Ontological Argument: A Guide for the Perplexed
Emmanuel Kant reflected deeply on the ontological argument, as did Godel, Decartes, Spinoza, and Plantinga among others. Perhaps a bit of intellectual openness and a touch of humility would benefit the conversation in this thread? The Stanford Encyclopedia of Philosophy has a lengthy discussion on the history of the ontological argument, together with various attempts to refute it and reformulate it.

I find Kant's refutation most convincing. His claim is: "Existence is not a predicate." My intuition on his point is this. Let's consider the following statement: "Imagine a unicorn, with the property that it happens to be brown." There is an implicit and unstated assertion at the beginning of the above statement, that we are for the moment imagining that that the unicorn exists. We might rephrase as follows: "Imagine for the moment that a particular unicorn exists, and that it has the property that it is brown." Now we attempt to attribute to this unicorn the "property" of non-existence: "Imagine that a particular unicorn exists, and that it has the property that it does not exist." The statement is logically ill-formed, since we assert of a hypothetical entity that it simultaneously has and does not have a "property", namely that of existence. Hence, "existence" cannot be considered to be a property whose presence or absence can be attributed to a hypothetical entity. Kant argues that since Anselm's Ontological Argument depends on this logical fallacy, it is shown to be invalid.

Has anyone evaluated Godel's reformulation of the Ontological Argument to see if it avoids Kant's critique? I can't help but imagine that Godel was aware of Kant's (and others') analysis of the Ontological Argument.

gregfjohnson··on Reality has a surprising amount of detail (2017)
After much initial resistance, I've become a fan of pair programming. When things are clicking, ideas spark back and forth. Frames collide and interfere, bits of partial insight are exchanged, and you and your partner arrive at a solution that would have been impossible for either of you to get to working individually.

There is the famous psychological notion of flow. The thing is, this can happen among multiple people. Think of a lovely choir or orchestra. Or a basketball team where every team member just seems to be reading other team members' minds. The book (and presumably the upcoming movie) "The Boys in the Boat" really emphasizes this and crystallizes this.

As the linked article mentions, the author and his father butted heads for three hours because they were not listening to each other and pairing very effectively! Really good pairing does take work and practice. But when it starts to work there can be moments when it feels like magic. It is a great way to grapple with the myriad of unforeseen "details" that are actually life-or-death critical issues to project success.

gregfjohnson··on How Gödel's proof works (2020)
Fascinating observation, thanks. Relevant to your comment but diverging farther from the original post: Coincidentally, I am taking a beginner's Kabbalah course right now. I wonder if some of the writers of scripture actually used steganography or other word encodings such as the ones you allude to intentionally. One obvious example of word play at the meta level might be Psalm 119.
gregfjohnson··on How Gödel's proof works (2020)
Everyone has their own way of stumbling through to a breakthrough, where suddenly things that had been confusing and complex suddenly seem clear, beautiful, and intuitive.

Here are a couple of thoughts on Godel's incompleteness theorem that helped me get there.

First, a description of the idea; consider the following two statements:

"There exists a formula with Godel number M that has the property that neither the formula nor its negation has a proof."

"Oh, by the way. The Godel number of the above formula is M."

"M" in the above is an actual number. In the first statement, one has an arithmetic expression (i.e., "3 + 4*5 + 12^100000 + ...") that is short but that evaluates to a really large number.

After developing the idea of mapping formulas and proofs of first-order logic to integers, Godel needed to use his new tool to come up with some way to express self reference. (The formula above has to have an embedded arithmetic expression "M" that unwraps and and evaluates to the Godel number of the entire formula.)

Godel devised what we would today recognize as exactly the Y combinator, expressed in first order arithmetic.

This was a shocking realization when it dawned on me, and it enabled me to gain an insight to the magnificent subtlety of Godel's mind.

I am personally comfortable with lisp, functions as first-class objects, lambda calculus, etc., as is certainly the case for many Hacker News readers.

So, at least for me, the above connection helped an awful lot to really understand the heart of Godel's insight.

gregfjohnson··on Easylkb: Easy Linux Kernel Builder
Greatly appreciate the suggestions and pointers! (Not sure how HN orders "reply's", but this is in response to other replys to my initial comment.)
gregfjohnson··on Easylkb: Easy Linux Kernel Builder
Mind. Officially. Blown. Sometimes the coincidental timeliness of things popping up on Hacker News is just weird. u ROCK deepseagirl!

I've recently wanted to start building Linux kernels and play with device drivers again. Wanted to build and then execute on top of QEMU. Downloaded, configured, and built Linux kernel 6.6 following recipes from arch and a few other places. Doing a reasonable .config was a painful process (picking what to include etc.) The kernel build took several hours. The resulting image refused to boot under Virtual Machine Manager, to say nothing of using gdb etc. to interactively debug the kernel.

So, I figured I was looking at a solid weekend of googling, stack-overflowing, swearing, reading kernel Documentation files etc. and finally getting everything set up and working happily.

NOT! The easylkb script did the entire thing completely automatically, culminating in a login prompt on a running virtual machine!! The Linux kernel .config was one of the standard ones I believe, but I hadn't yet found it. The complete kernel build took on the order of several minutes instead of several hours.

There were a couple of minor issues I had with easylkb, which I will share as comments on github.

gregfjohnson··on A software epiphany
The “software as theory” idea is helpful - thanks OP. Right now I’m dealing with some devilishly difficult GPU code, and I now understand that I’ve been working to reverse engineer the authors’ theory from their code. With much effort, I achieved a gratifying epiphany, and the code suddenly became clear! (Perhaps I developed a theory related to but not identical to that of the original authors.) Fortunately, I have an enlightened manager, and he was patient with the “theory building” process. Software degrades to garbage when a series of successive developers apply changes to it without a cogent theory. The process is self-reinforcing; the more degraded it becomes, the harder it is to develop a useful and accurate theory.
gregfjohnson··on Planes, Spheres and Pseudospheres
This brought to mind a cute way to think about the Foucault Pendulum.

The idea is to select a given latitude on Earth, and then imagine a cone that "just fits" that latitude, in the sense that it is tangent to the earth all the way around at that latitude. Draw a line all the way around the cone at the given latitude. Then imagine using a pair of scissors to cut the cone vertically up to its apex, and flattening it out to make a circle that is missing a pie slice.

A single full rotation of the earth would be equivalent to "driving a car" from one edge of the pie slice all the way around the latitude line to the other edge of the pie slice. At the end of the trip, the car will be pointing in a different direction from the one it started, for every latitude except the poles and the equator.

The angular rotation of the car from the start to the end of its trip is the amount a Foucault pendulum would rotate in 24 celestial hours at a given latitude on Earth.

gregfjohnson··on The Example of Seamus Heaney
In this comment thread there are some lovely reflections on human nature, how it manifests in technology development, etc. I had a thought recently, and this might be a place to share it that others might enjoy.

Pair programming is like nuclear fusion. There is the force of electromagnetism that causes nuclei to repel each other. Natural social awkwardness, fragile egos, conflict aversion and other similar issues cause programmers to resist pairing. Under the right conditions of heat and pressure the electro-magnetic force can be overcome, nuclei get close enough to each other, the strong nuclear force takes over, and the nuclei fuse. For programmers, when pairing starts to work well, a sort of flow state can emerge involving multiple people. Ideas start to spark back and forth, idea ignition happens, and somehow the collaboration goes to a new place that would have been entirely inaccessible to each person individually.

gregfjohnson··on How the Ear Works: Nature's solutions for listening (1997)
I just finished a wonderful book that readers of this comment thread may find interesting: "An Immense World: How Animal Senses Reveal the Hidden Realms Around Us" by Ed Yong. The book is a relatively non-technical deep dive into the many ways different organisms sense their environments. The chapters are organized by the senses; in the chapter on hearing, he covers everything from mammals to insects. His discussion of echolocation was amazing: of the many species of bats, there are a number of quite different ways in which they use echolocation. Some bats use quite different chirps for "scan mode" versus "final approach on target" mode. He gives plots of FFT's of the various sounds researchers have captured. I could go on and on about his amazing descriptions of insect vibration sensing, electric eels, taste, sight in its various forms across species, etc. Great read, highly recommended.
gregfjohnson··on WiFi without internet on a Southwest flight
This is why I love hacker news. I was sitting in the waiting area at Long Beach Airport about to board a Southwest flight when I read this article. Did the hack, it worked spectacularly. I didn't have jq installed, but whipped up a python script with 'import json', watched the data stream the whole flight. Thanks a million for posting this!
← PreviousPage 2 of 7Next →