Posts

Stop Thrashing About, Start Focused Debug Instead

Image
  Still tossing and Turning ? This will be a boring post because it's about me working through a debugging session after having emotionally 'thrashed about' instead of rationally dealing with the problem I think I'm facing. Embarassingly, I suffer from a tendency to seek quick fixes to my coding issues by means of trial and error guess work in place of  inserting proper debugging code  and seriously analyzing the situation. So below is a test run output where my initial understanding is that I forgot to unpack the lists output by one of my functions and I forgot to therafter join the nested text elements embedded inside one of my lists. Is this first blush assessment of the situation correct? Answer appears below the image...  No. That's not what's going on in the code that produced the above output. I'd forgotten where I last left off.  It was late at night. I was tired. I didn't leave behind progress notes for myself. I had changed the plan so that I...

Quickie Python coding tip #1123

Image
 Idea: Use dictionary syntax as a comment So here's a quickie tip that I came up with: Use the Python dictionary assignment in a comment to describe which option number to use In this example, one of the nested sub-lists of a main list is to be replaced See the below code for sublist_replacement The pick number is described by a comment containing a dictionary assignment [Born to be alive side music ( here )] One place where replacement will occur is in the generated generic help menus of the below form: MORE TO EXPLORE Book = The Python Tricks Digital Toolkit Medium = Python Decorators, Generators, etc.

It Don't Come Easy ... Despite Having Done It For This Long

Image
You would think that after more than a year of climbing up that Python learning curve, coding would come more naturally to me, with fewer mistakes and fewer night sweats and better understanding of how to name functions !. Sorry. Not true.  It still don't come easy ... despite my having done it for this long.   Stupid, stupid mistakes. I make so many mistakes. You can't see it here, all the hours I spent tracking down each error and fixing it. A missing comma here, a missing space there. And impatient arrogance on my part in not studying the error messages more fully but rather jumping to unwarranted conclusions when closer examination would have pinpointed the error earlier. What I discovered more recently is that I'm hampering my ability to think clearly about the functions I write because I'm naming them as actions (verbs) when the end product is actually a data structure and not a performance !!! Below is a not so recent output, ending with testing of what I initial...

Absent and Ashamed

Image
I've been ABSENT from my posts for a quite awhile.  The underlying reasons include: Shame, Embarrassment, Fear of failure, Dopamine entrapment, ... and more Blogging was supposed to be my Great Motivator (a.k.a. "Enabler" -- see Justin Sung mega lecture at ( this time point )) But instead it has back-fired. I did not move forward with my Xpander project. I watched Youtube dancing "shorts" ( Born to be Alive ) -- a great time killer. I worried about failing in tackling my next step. I pursued other topics, including bookmark hoarding and mechanical DIY projects. All this even though I had solved the RICH print out problems (see here for example) The bottom line: I'm human and flawed just like everybody else. Maybe instead of The Mythical Man Month , they should have written a book called: The Mythical Rational Programmer ? But there is a video called  The Myth of the Genius Programmer Don't let the perfect be the enemy of the good Or the good be the ene...

Mental and Physical Ergonomics

Image
When applying Xpander attributes to a word processing package, I think I (we?) should be considering both the mental (cognitive) aspects of our chosen hot key schemes as well as the physical (trained fingering sequences) aspects of those schemes. As an example, for the expanded features of the Shift key: The number of consecutive taps of the key and their consequences could be as follows: (0) = n/a (1) = conventional cap of next one alpha-numeric character (color code = green?) (2) = cap of next word (ends with detection of a space)    (color code = yellow?) (3) = cap of sentence (ends with  detection of a terminate  punctuation)  (color code = red?) (4) = revert back to (0)  (color code = temporary blank white ??) So -- a progressive stepping up a hierarchy of: char, word, sentence, ... paragraph? See link to wiki on keyboard layout and conventional functions here What alternate characters / actions should we invoke with multiple pre-fix taps of the A...

NOT ACCEPTABLE: The code works. IDK Why?

Image
This situation is  NOT ACCEPTABLE:    My revised code finally works, I Don't Know [IDK] why. It's a frustrating conundrum. This is why I stopped posting recently. It was because I couldn't get a supposedly "simple" little feature of Python to work. The little feature involved "printing" a backspace character (\b). In other words, sending a command to my output console via the RICH module (and via Pycharm) and thus erasing the last character typed. For a long time I couldn't get it to work. I didn't realize the tutorials had fed me another white lie. Here's the back story: Part of the revised design for my XPANDER project is to have a double tap of the Shift key function as a Caps Lock. When the user taps a first time, an erasable alert pops in to say how many times our user has hit the Shift key. Once and it's a normal one time char shift. Twice and it's a Caps Lock. Three times and we're back to unshifted. (Or 3x could do someth...

The Problem and The Passion: Pursuit to the Bitter End

Image
  Charleton Heston might have called this post "The Agony and the Egg-thingy on my Face" (instead of 'and the Ecstasy') At the end of the day all I got for my unrelenting efforts was a " Hello World " printed in red on my Python output console. ( Actually it wasn't day's end but rather an all-nighter ) You might ask why I am devoting a whole ( boring ) TLDR post to such an uninspiring outcome? Well, it's beca u se there are useful morales to be drawn from this long tale about the woe and the un-woke work that went into the all-night unraveling of the puzzle: Why was  the RICH module (a.k.a. library) not initi a lly producing any colors on my output screen  (a.k.a. Pycharm "console" frame) .  [fyi: "TLDR" = Too Long to Directly Read ] Turns out the problem was  not in my Python code but rather  in the configurations of the Pycharm IDE I'm using,. [fyi: "IDE" = Integrated Development Environment ] At times, I pr...