- The latest development in the evolution of the Refcards-System is the creation of a primitive interface;
- Now I can add records to my SQLite3 database through an interface;
- The interface has a button called "Add entry" which upon clicking adds the text ("gets" it) from the Entry and Text widgets in the interface and adds them ("INSERTs" them) directly into the database;
- I've been using Tkinter to create the interface ("frontend") and SQLite3 in Python for the database ("backend");
Thursday, September 27, 2018
Wednesday, September 26, 2018
Tkinter Text Widgets in Python
- I have been working hard on my Refcards-System idea, in Python;
- I want it to be a simple database with simple interface where you can add records to a given table and then view your "notes" or "Refcards";
- The idea is to have a GUI to flip through Refcards in the database;
- I want it to be a simple database with simple interface where you can add records to a given table and then view your "notes" or "Refcards";
- The idea is to have a GUI to flip through Refcards in the database;
Thursday, June 21, 2018
The Refcards-System Redux
18:52 2018-06-21
- As you may know, I have been working on my "Refcards-System" for years now. I haven't made much progress, but I still have made some progress;
- This latest iteration is all about "writing" to a .csv file; the idea is that a .csv file can be "imported" into a relational database or else opened up as an "Excel" file, making it rather interoperable;
- So what we have is simple. First I create the "filename" using some magical "time" module tricks. I want the filename to basically be the current timestamp, + the .csv file ending;
- Then basically I create the first "row" which are the "fieldnames" in the .csv file, and then I write the second "row" which is my content;
- Notice that I am using "raw_input", in Python that allows me to enter text directly into the file, with a prompt;
- The point is really to have content in .csv format, which is portable, interoperable, and lightweight as well. It's also a format that has withstood the test of time.
- As you may know, I have been working on my "Refcards-System" for years now. I haven't made much progress, but I still have made some progress;
- This latest iteration is all about "writing" to a .csv file; the idea is that a .csv file can be "imported" into a relational database or else opened up as an "Excel" file, making it rather interoperable;
- So what we have is simple. First I create the "filename" using some magical "time" module tricks. I want the filename to basically be the current timestamp, + the .csv file ending;
- Then basically I create the first "row" which are the "fieldnames" in the .csv file, and then I write the second "row" which is my content;
- Notice that I am using "raw_input", in Python that allows me to enter text directly into the file, with a prompt;
- The point is really to have content in .csv format, which is portable, interoperable, and lightweight as well. It's also a format that has withstood the test of time.
Sunday, March 11, 2018
Idiomatic Random Thoughts
I've been practicing my Python again. I am working on a Python version of an old boardgame called Stock Ticker. I had a breakthrough after thinking about it for 2 years. Right now, though, I'm just goofing off. This is imaginary code for the use of a random_thoughts module.
I've been watching videos of Python masters teaching their great wisdom. Of note is the work of Raymond Hettinger. I've learned a lot from watching him talk about writing beautiful Python code. I am only 7 years or so into my Python practice, so I'm not yet an expert. I am entering into the "intermediary" territory, though, because I can read almost any Python code and pretty much know what it's doing, and I can write code to solve problems I encounter every day. I still can't write a packaged app, a full-blown executable, with interface and everything. But I am beginning to truly understand Python, which is still a big accomplishment for me.
My dream is to think Pythonic thoughts. I want to turn my thoughts into mathematical expressions, and be able to execute them using Python as a programming language. Hence the thought experiment on the random_thoughts module. It's not really good Python code, but it's a start. The idea is that there would be a function I could use to turn my thoughts directly into idiomatic Python.
I've been watching videos of Python masters teaching their great wisdom. Of note is the work of Raymond Hettinger. I've learned a lot from watching him talk about writing beautiful Python code. I am only 7 years or so into my Python practice, so I'm not yet an expert. I am entering into the "intermediary" territory, though, because I can read almost any Python code and pretty much know what it's doing, and I can write code to solve problems I encounter every day. I still can't write a packaged app, a full-blown executable, with interface and everything. But I am beginning to truly understand Python, which is still a big accomplishment for me.
My dream is to think Pythonic thoughts. I want to turn my thoughts into mathematical expressions, and be able to execute them using Python as a programming language. Hence the thought experiment on the random_thoughts module. It's not really good Python code, but it's a start. The idea is that there would be a function I could use to turn my thoughts directly into idiomatic Python.
Friday, March 31, 2017
Modulations, Modulations, Modulations
Here is yet another experiment in generating noisy images. This time the pattern is obvious, regular. The point of all this is to start with noise and modulate the noise until I get something "visually interesting." Below the code I wrote to generate the image is the resultant image itself.
![]() |
| Noise field by A.G. (c) 2017. All Rights Reserved. |
Monday, March 27, 2017
Code Reading
I just wanted to say that when I'm in the coding mood/mode, I like to do an insanely large amount of code reading. I go on Github or look at Github Gists, or look at code on-line in tutorials and quickstarts. It's really what helps me the most in learning to code in Python, which I've been doing for a good 6 years now.
There's a whole other side to what I just said that I won't go into too many details about. Suffice to say that I believe in a kind of New Documentation where the purpose of documenting code is precisely for the ambient code-reader who happens to stumble across the code doing searches on the web or on Github.
Think of it this way. If you're writing code that's going to be read by yourself or your team members, you can get away with documenting less or maybe not even at all. But in the open source universe, you have to think of an indeterminate number of people who might read your code 5 or 10 or 50 or 100 years later. So it's important I think to be very "literate" in one's documentation.
You can never take for granted that future code-readers are going to know what you were trying to do, even if they can get your code to work. One thing I learned is that you have to UNDERSTAND the code, how and why it works, along with what it's purpose is. I can write a Python script that does exactly what I needed it to do and yet not fully understand it because I'm just basing my coding on idioms I learned and stuff I saw other coders write in my code-reading experience.
It's tantamount to saying something and not truly understanding it. You can still get the point across to an audience, but what's the point if you don't even fully understand what you are saying? A wise man once told me to only ever speak about what I have knowledge of. I think it should be the same thing with code. Use restraint. Only write code about what you understand and have knowledge of.
I find code-reading a great passtime. I can almost never get the code to run on my machine, but I see how the problem was solved, or at least one possible avenue. Often I find the code very ugly and hard to read, and that's when I go back to the basics and make sure I know what I'm doing when I write code.
I think that a certain responsibility comes from being able to code, just as one has the responsibility to watch what one says when one is speaking. Think before you open your mouth, or before you code something.
There's a whole other side to what I just said that I won't go into too many details about. Suffice to say that I believe in a kind of New Documentation where the purpose of documenting code is precisely for the ambient code-reader who happens to stumble across the code doing searches on the web or on Github.
Think of it this way. If you're writing code that's going to be read by yourself or your team members, you can get away with documenting less or maybe not even at all. But in the open source universe, you have to think of an indeterminate number of people who might read your code 5 or 10 or 50 or 100 years later. So it's important I think to be very "literate" in one's documentation.
You can never take for granted that future code-readers are going to know what you were trying to do, even if they can get your code to work. One thing I learned is that you have to UNDERSTAND the code, how and why it works, along with what it's purpose is. I can write a Python script that does exactly what I needed it to do and yet not fully understand it because I'm just basing my coding on idioms I learned and stuff I saw other coders write in my code-reading experience.
It's tantamount to saying something and not truly understanding it. You can still get the point across to an audience, but what's the point if you don't even fully understand what you are saying? A wise man once told me to only ever speak about what I have knowledge of. I think it should be the same thing with code. Use restraint. Only write code about what you understand and have knowledge of.
I find code-reading a great passtime. I can almost never get the code to run on my machine, but I see how the problem was solved, or at least one possible avenue. Often I find the code very ugly and hard to read, and that's when I go back to the basics and make sure I know what I'm doing when I write code.
I think that a certain responsibility comes from being able to code, just as one has the responsibility to watch what one says when one is speaking. Think before you open your mouth, or before you code something.
Subscribe to:
Posts (Atom)



