Posts

Showing posts with the label Software

Artificial Intelligence: To Boo Or Not To Boo 💀

Image
Technology inflection points are led by the young. Not so with artificial intelligence, as the young  boo their pro-AI commencement speakers . Meanwhile, the mature and serious embrace and invest in AI with unsettling fervor and unfathomable amounts of money. Past inflection points include the microcomputer, the internet, and the smartphone, and all were led by a young cohort ready and willing to build, tinker, and program. These technological changes and advances were not booed. I cannot dismiss the youthful reaction. I cannot boo AI either. I can try, however, to understand my inner conflict. Where AI Thrives: The Closed System One revealing experiment asked Can an LLM Solve a Murder Mystery?  The whodunnit used was Edgar Allen Poe's The Murders in the Rue Morgue  but was revised with new twists and a different ending. The changes were needed because the LLM very likely had already trained on the book.   Did the LLM solve the mystery? In a word, Yes. From the ...

😦 The Real CrowdStrike Flaw Was In Deployment

By now, most of you are familiar with the story of CrowdStrike and the resulting worldwide outages. The initial, and angry, responses were along the lines of "Where are the devs? Where was QA?" As it turned out, the actual patch, or software code, was fine. The problem was in the config file  that governs the behavior of the patch.  Being flawed, it triggered the Microsoft Windows' blue screen of death. In a variation of "Who Watches The Watchers," the config file was indeed tested, but CrowdStrike's testing system was unknowingly broken.  The config file passed when it shouldn't have. Nothing is perfect all the time, but what would have mitigated the fallout would have been a gradual or staggered rollout of the config file instead of the apparent "big-bang" release to all machines at once. The staggered rollout is an old and reliable technique. I can think of 2 reasons why it might have been forgotten or abandoned: inexperience or over-confide...

Raspberry Pi Swap Space

Image
Who took my slice of pi ?   Sometimes I ask myself that while looking in the fridge. This time, I am looking at the  top  command and see nearly a quarter of the reserved swap space in use.  The question is purely academic, and spurred by curiosity, I wrote a bash script to learn the answer. The script, swapid,  searches through the process list, identifies the process name and amount of swap used, and then sorts the output by swap size.  With Linux, processes can be viewed and interrogated like a file system. Run $ ls /proc and you'll see it sprinkled with subdirectories named with numbers. These numbers correspond to process ids. Inside each of these subdirectories is a file named status , and running  $  cat status reveals a bunch of process information. At this point, it's simply a matter of using  awk and   grep   to pick out the attributes of interest; in this case, "Name" and "VmSwap." Output is written to the /tmp di...

MR2 Check Engine

Image
Shown here is the 1991 Toyota MR2. Thanks to the mechanical skills of a family enthusiast, it purrs, growls, and turbo whistles like a dream.   My hardware ability doesn't go much further than oil changes. Rather, my expertise is in software, and I wrote an app for Android and iOS to diagnose the flashes of the check engine light. This second generation MR2 predates the OBD2 connector, a standard used to diagnose engine, transmission, and emissions problems quickly and easily. Instead, we have a flashing check engine light which needs some deciphering, followed by a lookup in the service manual. Basically, you count flashes to arrive at fault code number. A short pause (~1.5 seconds) indicates the start of the next digit. A medium pause (~2.5 seconds) indicates start of the next fault code. And a long pause (~4.5 seconds) means the sequence has ended and will repeat. The video below corresponds to the codes 41 and 51. Using the the MR2 Check app and selecting the 3S-GTE engine...

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   ...

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 d...

My Intersection With Artificial Intelligence

Image
  The car in front of me misjudged a traffic light and stopped in the crosswalk. Braking early, I left a gap should the driver wish to back up. Then I wondered, would an autonomous vehicle extend the same courtesy? But I'm getting ahead of myself. Before being courteous, autonomous driving has yet to master the rules of road. There are two prevailing approaches: solve for general AI or use geo-fencing.  The former, pursued by Tesla, is harder to achieve but will make autonomous cars capable of driving on almost any road. The latter, used by GM Cruise and Alphabet Waymo, is easier to achieve, but restricts autonomous cars to certain locations. GM Cruise is already accepting fares for its driverless taxi in San Francisco. The service, however, is bound by both time and space, allowed only to run between 10pm and 6am (lighter traffic) and within a 7x7 mile area. Choices and trade-offs such as these are common when planning and building a future. Thirty years ago, Apple introduce...

Integer Overflow And Underflow

Image
Q: When is optimization sub-optimal?  A: When it creates an Android bug that crashes your phone during a call to 911. Details of the bug can be found in Ars Technica , but I want to focus on the integer overflow/underflow that caused the crash: return account1.hashCode() - account2.hashCode(); Nevermind the variable names and the invocation of hashCode() . The problem is subtracting without looking, and returning a number that might be too large or too negative for the program to handle. Google corrected the code by using the Java compare() method: return Integer.compare(account1.hashCode(), account2.hashCode()); which limits the return values to -1, 0, or 1, indicating account1 is less than, equal to, or greater than account2, respectively. This raises two questions: "Why did the original code use subtraction?" and "Wasn't this tested?" Addressing the first question, I've seen overflows and underflows before, and even wrote about them in Space, Time, and I...

Bookshelf: UNIX A History and a Memoir

Image
  A man page will give you, in black and white, specific information about UNIX. Brian Kernighan's new book adds color and depth about UNIX you won't find anywhere else. I'm not a gray beard (yet), but I imagine they would plow through the book knowingly, but at the same time, learn a few things. Those new to UNIX -- recent college grads or those experimenting with Raspberry Pi -- would be better off starting with Chapter 8 which describes more relatable events and the descendants of UNIX, including Minux and Linux. It's when they start to ask questions like "Where does UNIX come from?" and "Why is Gamora grep?" that they should start from the beginning: Bell Labs, 1969. Kernighan opens with a birds-eye-view of Murray Hill New Jersey, zooms in on the buildings, the offices, the significance of Center 1127, and offers a brief look at some of the key players there. As I progressed through the book, the two factors that made UNIX not just possible, bu...

Pointers Don't Create Memory Bugs, Programmers Do

Image
After parking your car, you: a) engage the parking brake b) engage the parking brake only if you are on a hill c) what’s a parking brake? Any answer other than "a" suggests that you, as a programmer, don't park your pointers after you free them. ZDNet recently published a couple of articles about  Chrome  and  Microsoft , reporting that 70% of all their security bugs were memory safety issues. That weighty number was made heavier coming from companies where resources are abundant and developers are first class citizens. I can only imagine the bug count is higher in companies where budgets are tight and developers are support staff. The article continued, describing C and C++ as "memory unsafe" languages, and attributing hackers with increasingly sophisticated attacks.  I even found myself reconsidering my  Symmetry post, where I insisted memory can be managed if you cared enough: common mistakes such as memory leaks and buffer overruns . . ...

Bookshelf Classic: The Art of UNIX Programming

Image
Rules are made to be broken , so the saying goes. The Art of UNIX Programming isn't exactly a rule book.  Rather, it explores the philosophy and culture behind UNIX -- its strengths, weaknesses, patterns, and associated tools.  First published in 2004, it is still relevant today and essential reading for server side developers. As for rules, in my career writing software, I may have broken two.  The first was using threads. I felt a little panic when I read the section titled  Threads -- threat or menace? It was in the early days of threads, and I had already implemented a threaded server. Did I make a mistake? Could I have done a better job with UNIX processes and IPC ?  Raymond argued that the complexity of threads outweighed their advantages.  Performance gains were lost to data locking and synchronization.  Abstraction was compromised because you needed to know the internals to prevent deadlock.  Threads were not portable. These...

What Would Artificial Intelligence Do?

Image
AI would stop the car in the straightest, shortest, possible line.  That would be my answer to the  trolley problem  which asks an autonomous vehicle to chose between hitting a pedestrian or avoiding a pedestrian by veering off a cliff and taking you, the occupant, with it. In the same vein as "Who would win in a fight, Hulk or Superman?" the trolley problem is entertaining but doesn't produce practical answers. As Jason Hong laments in the link above,  "... the problems are framed such that the autonomous vehicle is the only entity with any agency. Or to put it more simply, pedestrians are completely passive and won't try to dodge oncoming vehicles." Anyone who has done the " hallway dance " would readily agree with Mr. Hong.  Indeed, my wife recounted an accident in her youth when she hit a goat with her car, doing precisely this dance. We should, instead, focus on long-range embedded road sensors to detect wayward pedestrians, and br...

Post Processing: Swift, Kotlin, Team Scaling Fallacy, Levandowski

Image
 When I wrote  Programming Languages I've Loved and Hated , it came from the heart.  In contrast, the  Tiobe Index  ranks the languages from the head, and is based on hits from a search query .  As of August 2019, Java reigns at #1, followed by C, and then Python.  The rankings did not surprise me, and at least 2 of my favorite languages made it into the top 3.  C++ came in 4th. Swift (iOS) and Kotlin (Android), being specialty languages for the mobile space, were further down the list.  Swift came in at #18, but Kotlin disappointed, coming in at #45. Nevertheless, as iOS and Android users grow,  the popularity of Swift and Kotlin will likely follow. The name Swift is easy to fathom.  The language speeds up iOS development (compared to using Objective C), and it also runs respectably fast.  The Kotlin designation is rather opaque, but being a derivative of Java, Kotlin was named after an island near St. Petersburg under the...

LuldCalc For Android

Image
LuldCalc is now available for Android. Learn more about Limit Up Limit Down here:  http://www.luldplan.com See our privacy policy: https://www.ytechnology.com/p/luldcalc.html The app is now available on Google Play:

LuldCalc version 1.1 Available

Image
Version 1.1 is available for downloading at the app store.  The changes are cosmetic: contrast and readability have been improved, and the icon has a cleaner design. More info about LuldCalc can be found here:  https://www.ytechnology.com/p/luldcalc.html