Posts

Rust's Other Super Power

Image
If you can't prototype, you can't release prematurely. Memory safety. That's the super power that launched Rust into the minds of modern developers.  Wired describes the popularity of Rust as a "viral secure language," lauding its resistance to buggy memory conditions known as "out-of-bounds access," and "reuse of memory after free."  And yet... I find myself lukewarm to the language. While memory insecurity is a problem, it is not an existential one. Indeed, the problem has largely been addressed in C++ with Resource Acquisition Is Initialization ( RAII ) which uses the symmetry of constructors and destructors for resource allocation and de-allocation.  As for accidentally reusing freed pointers, setting them to NULL after a free neutralizes any downstream threats, but this defensive practice has been largely ignored or forgotten.  The real quandry is finding developers with the interest, patience, and care to actively manage memory, and Rus

The Collatz Conjecture Python Plot

Image
  No, it is not an evil plot. This chart is just another example of how easy it is to do fun things in the Python language. Revisiting the  Collatz Conjecture , I've updated the python code to plot a chart of the hailstones.  If you haven't already done so, you will need to install the Matplotlib in your python environment.  First install pip, then install matplotlib.  The -U option means upgrade dependent packages to the latest version: python -m pip install -U pip python -m pip install -U matplotlib For more information, go to the  matplotlib website . Below is the updated code: #!/usr/bin/python3 from  matplotlib  import  pyplot  as  plt def   even (n):      return  n/ 2 def   odd (n):      return   3 *n+ 1 n =  int ( input ( "Enter a number: " )) peak = n count =  0 hailstones = [] hailstones.append(n) while  n >  1 :     count +=  1      if  n %  2  ==  0 :         n = even(n)         hailstones.append(n)      else :         n = odd(n)         hailstones.appen

My Retina Display Is Ghosting Me

Image
  We've been together since 2014. A few of years ago, my 27-inch retina display began ghosting me.  Open applications, desktop icons, and the dock left a residual image, and while the screen saver eventually cleared them, the ghostings happen much more quickly now.  Is it time to end the relationship and upgrade to the new  Apple Studio display ? Fortunately for my wallet, not yet.  I was able to fix this in the display settings. First, I recalibrated the display to avoid the native white point, setting the color temperature to a cool blue -- anywhere from 7000K to 9500K.  Second, not wanting to see Smurf all day, I went to the Night Shift settings and filtered out the excess blue by adjusting the slider to a warmer temperature... that is, until the colors looked natural again.  Last, I created a custom Night Shift schedule to have it on 24 hours a day.  Evidently, being at, or near, the native white point leads to "burn-in." This solution could limit the color gamut, and

A Market Guardrail named Limit Up Limit Down

Image
  Stocks trade faster and more frequently than ever before, and make volatile price action inevitable.  There are, however, guardrails in place to protect the trader, and one of them is known as Limit Up Limit Down, or LULD. Back in 2012, the SEC approved a National Market System (NMS) plan to limit price variability to a specific range. The range, or price band, is governed by statistical measures, a stock's tier and reference price, and the time of the trade; prices are markedly volatile near market open and market close. To see the specific rules, visit the Limit Up Limit Down website . While at the NYSE, I had the privilege of working on this project. It wasn't easy. The scope spread across multiple systems and multiple teams. The specifications -- like all projects -- were ambiguous at first, and needed several iterations.  Questions arose, such as what happens to the reference price if a trade was cancelled, corrected, or flagged as an error?  We were careful during rollo

The Nuphy Air75: It Clicks

Image
  Mechanical keyboards offer aural and tactile feedback that, for some, make them a joy to use.  For others, they are just another choice in the world of scissor switches and membranes. I fall into the former category, having pretty much grown up with the well regarded IBM PC Mechanical Keyboard .  I ordered my Nuphy Air75 with clicky blue switches which are the loudest and most mechanical in sound and feel. Avoid, if you have a roommate or an officemate. Get, if you miss the IBM PC keyboard. For the uninitiated, switches on mechanical keyboards typically come in three varieties: red, brown, and blue. Red switches feel the most linear and are the quietest. Brown switches sit between red and blue, and are described as tactile, with an engagement point that needs just a tiny bit more force to overcome.  Blue switches were the easy choice for me, but ideally, it would be best if you could test these switches in person. The Nuphy Air  comes in three sizes: 96, 75, 60.  The numbers correspo

Not A Martian, Elon Is All Too Earthling

Image
A fun narrative has Elon Musk really being from Mars and badly wants to go home. In my imagination, I add that Elon, having watched the movie E.T. , realizes that if he directly sought the help of space capable governments, he would likely be captured, imprisoned, and eventually dissected. Clever Martian that he might be, Elon would parallel the real life story of One Red Paperclip , where one man started with a single red paperclip and through 14 trades, ended up with a two story farmhouse. And so goes Elon, first with Paypal and selling it to eBay for more than a hundred million dollars, then using that fortune to start SpaceX (2002) and Tesla (2003), and later Starlink (2015), all in the hopes of amassing enough money and technology to get him home. Also in my fevered imagination, Elon is BFF with Bernie Sanders and AOC, because addressing the looming menace that is climate change is really that important. That they approach the climate threat from opposite ends -- private business

Sometimes The Math Doesn’t Add Up. And Sometimes, It Does

Image
It just don't add up! Cartoon math isn't meant to add up. Here we see a dog number crunching, trying to determine why a cat is running away from two mice, and running towards him, a dog, to be "massacred."  Furthermore, the mice are disgusted by cheese, and run toward the cat to be eaten by him. The dog, reading the results on his Acme adding machine, exclaims "It just don't add up!" and then runs toward a dog catcher, hoping to be caught.  In contrast, real world math is meant to add up, but doesn't always, and when it does, it's kinda', sorta', maybe. Federal Reserve Chair Jerome Powell said as much  (see time index 46:45) while at the Cato Institute to discuss inflation and monetary policy:  " Economics is not physics. There isn’t any specific temperature in which the economy boils over... and when that happens it takes many years of analysis, discussion, and debate to reach general agreement on why that's happened. " B