Posts

NOT ACCEPTABLE: The code works. IDK Why?

Image
This situation is  NOT ACCEPTABLE:    My revised code finally works, But I Don't Know [IDK] why. It' a frustrating conundrum. This why I stopped posting recently. Because I couldn't get a supposedly "simple" little thing to work. The little thing was that of outputting a backspace (\b) to my output console via the RICH module (and via Pycharm). Here's the back story: Part of the plan for my 'expanded' 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 he's hit the Shift key. Three times and we're back to unshifted. Problem was, RICH wasn't outputting the backspace command to the console. ... TO BE CONTINUED ( Click on below image to see larger version of the console output )

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

Now Where Was I ? (Or What am I doing in these sidetrack rooms?)

Image
So where was I ? To be honest, I am presently supposed to be re-drawing the flow chart for my abbreviations Xpander project. And supposedly also adding the pre-fix controls part. As well as initializing the consecutive -taps counters for the pre-fix controls (e,g, Shift, Ctrl, Alt, Menu, Windows = SCAMW) and for the post-fix controls (e.g., P3 and P4) But instead I find myself playing around with some distracting code (below) that flashes colorful boxes across the console screen. [ Note to self : Learn how to use Python Rich text module, for example here ]  [ Note #2: I did start the flow chart, see far below ] It's not all for naught though. A small part of it is meant to support the pre-fix control responses where a small helper message pops out but soon thereafter disappears in response to the c onsecutive-taps counters for the prefixes (SCAMW) being non-zero (meaning the user has hit the pre- or post-fix control keys one or more consecutive times). The helper message tells the ...

Change of Plans / Change of Perspective

Image
Did I start my initial storyboarding for my "Xpander" Project ( here ) from a Middle-out  Point of View (mo-POV) rather than from a Bottom-up (bu-POV) one and did that starting point cause me to miss some vital concepts that should have been obvious if I had focused on the bottom rung, physical layer instead of jumping to a higher, abstracted level (i.e., physical key presses converted into symbolic characters) ? Seems to be so ... I should have started with keyboard layout and  the raw basics of a user's fingers pressing down on specific keys of the keyboard according to some sequence and timing, and perhaps holding down one or more of the keys for respective times and then finally releasing them perhaps all at once or according to another sequence. Then I would have perceived the possible permutations. I did not. [ edit insert : Wikipedia has cool page re IBM keybd here ] In general, keys such as SHIFT, CTRL, ALT, WIN, MENU act as pre-fix commands that are activate...

Back to Basics after My Code Chokes from Bloat

Image
Do you remember these ? Humility. Simplicity (KISS) Frugality.  They are some of the principles we are taught to keep in mind as we add more and more code to our projects. Alas. I strayed off this trail-marked path. And now my initial Xpander project modules are crashing during compilation due to a host of never ending syntax errors. So it's time to start all over with a clean slate. Back to Basics. Return to Roots. A New Beginning. But wait. I hear that "UV" is the superior way to launch a new project. How do you install and use UV as a beginner?   ( <-- YouTube search results)     ^^^-- Astral install site here     ^^^-- TwT's answer here     ^^^--  Corey Schafer's  answer here     ^^^-- Josh's answer here     ^^^-- Indently search results ::: UV here (includes TOML)     ^^^-- How to Use UV in PyCharm Shaw ::: The Fastest Way to Install (and Use) Python Indently's advanced UV commands here LATER IN TI...

Typewriter Echo Mode for my Xpander Project (a.k.a. 2nd OOP project)

Image
So far I've been operating on the premise that my expandable text (that which is to be expanded by the Xpander module) is going to come in from a pre-existing file. However, another use case is that where the user is inputting original text via the keyboard and expects to see his/her keystrokes immediately echoed on the console. In that case, I will need to send each keystroke to two two different destinations: (1) first to the console and (2) secondly to my three parsing buffers (Buff_0, Buff_1 and Buff_2). If an abbreviation expansion is triggered by the incoming text, I will have to erase part of the text on the console and replace it with its expanded counter part.   I don't remember if there is a clear-current-console-line escape code that will work on my computer's console. Time to go back and research the issue. ... TO BE CONTINUED I should storyboard the plan per own advice about storyboarding before coding: I only need one function, not a bunch of instances as was...

Enough Goofing Off (in a Dopamine Hole), Time to Dive into Hard Tasks Again

Image
This post is part of a showcase of how a " story board " is invaluable in helping to develop the code (e.g. Python) for implementing the desired outcome. [more on storyboarding ( here ),  ( here ), and  ( here )] In my previous post ( here ) I took a pass at explaining my below, "partial" flowchart for my "Xpander" project.  Now it's time to explain the details, this again happening well BEFORE writing any of the corresponding Python code. (click on the image to enlarge it, back a page to return to here) (or get image separately  here ) Just to recap the overall scheme:     (a) First,  I decided I was going to parse the incoming text into three buckets, or buffer "lists" (as I will be implementing them). The decision of which buffer to dump the next incoming piece of text into is performed by a three state, sequential state machine having states S0, S1, S2 and then looping back to S0. [Post script: A new idea just came to me : Add a f...