Below you will find pages that utilize the taxonomy term “Programming”
2024 Programming EOY
This year was a bit light on programming. I was focused a lot on gaming, cooking, and Tabletop Gaming. (No surprise if you’ve been reading my December blog posts) I constantly found myself desiring to code and I definitely had a few ideas - like a utility to extract EXIF data out of my images for use in Hugo. But when I would sit down at my computer I often found myself preferring to play Cities: Skylines II or Against the Storm. (More on that when I post my EOY video game post) As per usual, let’s go month-by-month (after the first quarter that is)
Advent 2024 Day 04
Time once again to review my Advent of Code solutions! The GitHub repo with all my solutions can be found here. Also featuring the latest die or dice from the Dice Envy Advent Calendar; scroll below the AoC code to see today’s die.
Advent of Code
Today I did not attempt the advent of code problem. It involved solving a word search in which there could be overlapping words as well as, if I read it correctly, multiple words starting from the same place. I’m guessing it’s to be done with a depth-first or breadth-first search in which you kill off searches if you can’t continue. I know these sorts of problems present themselves every year, but I never have time to learn during the AoC period (with work, life, and Christmas in the way) and I never make it a priority to relearn (I was taught this back in undergrad). So rather than waste my time on something I know that I won’t know how to do, I’ll save it for another time - maybe when I’m taking time off closer to Christmas/New Years Day.
Advent 2024 Day 03
Time once again to review my Advent of Code solutions! Also the latest die or dice from the Dice Envy Advent Calendar; scroll below the AoC code to see today’s die.
Advent of Code
As the years have piled on, Eric Wasl has thrown in references to past years’ problems. However, as of day 3 we now have 2 references (perhaps that’s what the historian story line is about). Day 02 had you visit the location of 2015 Day 19 and today visited the location of 2020 Day 2 (my first year doing Advent of Code!) The only thing I’m slightly worried about is if this signals that this year will be a grand finale for the annual event.
Advent 2024 Day 02
Time once again to review my Advent of Code solutions! Also the latest die or dice from the Dice Envy Advent Calendar; scroll below the AoC code to see today’s die.
Talk Python Bits
Michael Kennedy from the podcasts Python Bytes and Talk Python has recently written a couple blog posts that I wanted to highlight here. First up is his post about rewriting the Talk Python site in Quart (aka async Flask). Three and a half years ago I wrote about realizing that it’s not about Django vs Flask vs FastAPI, but actually about finding the right framework for your workload. I didn’t completely state my current thought process in that blog post, but I was pretty close to the advice I currently give. If you want a Python-based site that needs CMS features and you don’t want to have to reinvent the world, Django is your framework. If you are making websites where you want to be in control of every puzzle piece, then you want flask. You only bring in what you need. And if you’re writing REST API based site (controversy about whether REST truly is REST aside), you want FastAPI. Well, I respect Michael Kennedy’s opinion on this matter for a few reasons:
Advent 2024 Day 01
December has finally arrived and with it my favorite activity of the month - Advent of Code! I also wanted to give myself a fun little present this year, so I bought the Dice Envy Advent Calendar. Every day I’ll get a fun new die (or dice!). Scroll below the AoC code to see today’s die.
Advent of Code
Let’s start off with Advent of Code. This year I haven’t done any of the Advent of Code problems ahead of December so I was a bit rusty. One is not often using the same algorithms or libraries for Advent of Code as one does for everyday programming. I started off with Python since that’s my most comfortable language. First you can head over to today’s page to see the prompt. If you’re not solving the problems yourself, you won’t be able to see the prompt for part 2, so in summary:
The Political Reading of If You Give a Mouse a Cookie
This morning I was listening to one of my favorite podcasts, Decoder Ring. The most recent episode had a very interesting title: If You Give a Mouse a Cookie…Will he want a Welfare check? I don’t remember this book from my childhood, but I do remember reading this one (and others in the series) to my kids. The podcast explores the fact that, starting around 2015, this book started to become known by conservatives as an allegory against the welfare state. While this podcast episode eventually interviews the author and confirms this was not her intention, I can certainly understand how the book could be read that way. It’s a great example of how art (literature, movies, images, music) becomes “property” of the culture once the creator releases it into the world. In many ways it doesn’t matter what the creator wanted (although I always find that fascinating), but what the culture does with it.
Programming Jan-April 2024
This year started off pretty light when it came to programming because I’ve been addicted to the video game Against the Storm since last winter. But I eventually started working again on various projects - some old and some new. I didn’t do any programming in January, so we’ll start in February.
February and March
Over these two months I worked on my replacement for web access to my Taskwarrior TODO list because Inthe.am had shut down. In February I got the podman containers set up - one to run the taskd server and one to run the website I’d coded up in Flask. In March I had to write some rudimentary Javascript to get the website to highlight the selected tab (Overdue, Today, This Month, etc). The rest of the interactivity on the site works using HTMX, letting me focus on Python instead of Javascript, but I just wasn’t able to get that part of the site to work without a tiny bit of Javascript. I also added some fixes because the date/time widget assumes UTC. Of course, now that I have it all working correctly and get lots of use for it (especially when I’m at work and I want to quickly get something out of my brain’s short-term buffer), Taskwarrior went to 3.0 which completely changes the way the program works, the API, and the way syncing works. I think in the end it’ll be for the best, but it’s annoying that I need to figure this out. That may involve finally learning how to use PyO3 to interact with Rust or re-writing part of my backend in Rust. We’ll have to see where that goes.
A few thoughts on Programming languages
Just a few thoughts on programming languages that have been rattling around in my head this week, but which don’t each merit a full blog post. The main theme is that the culture behind each programming language leads to some interesting choices, as is the case with spoken languages.
This week I started learning how to program in Rust. Even though I’m using the project-based Command-Line Rust to learn, the author still went with the traditional “Hello, world!” project for the first intro to the language. I was also working on a Go project last week and so it immediately stood out to me that (at least as taught by this author) Rust has the print! macro that allows you to succinctly print to the command line. By contrast, Go requires importing fmt before you can print. This was the first topic that was swirling around in my head this week. What makes language designers choose whether printing output (one of the most basic things a program can do) is built-in or requires an import. I even remember back when I was learning Java in undergrad (I think it was Java 1.8, but I don’t remember) we had to use the savitch library just to get program input (another very basic computer program concept). As I thought about it, I wondered if it has to do with thoughts around compilation and whether the language designers think you’re mostly making user-interactive programs or libraries? It makes sense to me that scripting languages like Python, Ruby, and Perl would have print built-in since you always have to have the interpreter along with you, so all the basics should be there. (The original Batteries Included Python promise, for example) But perhaps the Go developers thought you wouldn’t always be printing to the command line so a more efficient binary could be compiled by forcing you to import the functionality? I’m not entirely sure.
Review: If Hemingway Wrote Javascript
If Hemingway Wrote JavaScript by Angus Croll
My rating: 3 of 5 stars
The intro mentions the natural language nature of Javascript. I wonder if the book had been concieved a few years later if it would rather have been Python or Ruby - both of which are way more like human language than Javascript.
The book is fun and I mostly get it, but to truly get what the author is doing here, I think you would need to be a Javascript dev. The whole point is that the author is nerding out not only on the writing style of the authors they have chosen, but also converting that into Javascript coding styles. As someone who programmed in many languages, but hasn’t touched Javasscript in the the mid-90s, a lot of the elegance of this book is lost on me.
Programs used for Programming in 2023
I didn’t really use any new programs this year. I just continued expanding on programs I’ve used in the past.
Python
For Python I continued to mostly use Pycharm. I’ve spoken about it for the past few years, but JetBrains continues to add features that make it easier to work with Python. For example, this year they added a model explorer to have better visibility into your models in Django. They also make running development servers for Django, Flask, and FastAPI a breeze. (Including restarting the server after every save).
My 2023 Programming Progress
In 2023 I just didn’t have the urge to do as much programming as in years past. I felt more of a tug towards video games, reading, and baking/cooking. So this recap will be quite a bit shorter than usual. A couple upfront themes and ideas: The programming was essentially Go and Python. I started reading a book about Julia, but didn’t do any new programming in Julia. I mostly worked on new code vs maintaining older code.
Programming Update: March 2023
In March I continued to work on my programming projects as well as a little more Advent of Code.
Things started off with me finishing up my dreamhostapi and Dreamhost_DNS_Go projects in Golang. I got the API working under all the conditions that I need and I worked on both the output of the program and the logging. It now functions quite well for me to keep my dynamic DNS URLs up to date. My next step is something I’m going to do in a few of my cron scripts - have a separate JSON log that could be interpreted so that I could either have a daily email to let me know that the scripts all ran correctly or so that I can load them into Prometheus/Grafana to see on a dashboard how all my scripts are doing.
How Go Helped Save Healthcare.gov!
I recently used Mastodon to ask for recommendations for Go podcasts and one of the suggestions was Go Time. One of the recent episodes in the feed was a rerun of an older episode about " How Go helped saved HealthCare.Gov". This was extra interesting to me since I wrote my Master’s Special Project on Healthcare.gov. (I haven’t read it in nearly a decade, so I don’t know if it’s cringe-worthy at this point). The episode had on one of the programmers who helped get things back on track for the site. It was incredibly informative about the problems that led to the site not being responsive enough and how they were able to help fix it without scrapping the entire site. No matter what side of the political spectrum you’re on or if you’re even an American, the episode is fascinating for understanding how things can go wrong even when everyone has the best intentions and how to fix a large, complex code base.
Programming Update: Jan 2023 and Feb 2023
January
January was a relatively light programming month for me. I was focused on finishing up end of year blog posts and other tasks. Since Lastfmeoystats is used to generate the stats I need for my end of year music post, I worked on it a little to make some fixes. The biggest fix was to change the chart titles not to be hardcoded. I didn’t realize it until I was reviewing my blog post, but I had hard-coded the year when I first wrote the code a couple years ago. I also changed the limits on some of the data I was collecting so that I could do more expansive trending for my overall stats.
2022 In Programming
I started off the year mostly working on Python projects. For January and February I finally started making some great progress with understanding modern web frameworks and use of CSS frameworks rather than rolling my own. This not only helped with the Prophecy Practicum project, but would form the backbone to a lot of coding this year. I also wrote a utility to tally up my videos for my end of year video game roundup, saving me literal hours of time. As you can read from following the link above, I also worked on my long-running Extra Life Donation Tracker code.
Programming Update: December 2022
December was wholly dedicated to solving the Advent of Code 2022 problem set. Our job was to help the elves trek through the jungle to get magical starfruit. It was a lot of fun to do it live once again! This year I also had experience from the previous years (both live and on my own pace) that gave me the skills to solve some of the puzzles, including some puzzles that were variations on themes I’d seen before. In the end, I collected 36 stars, near my average for number of stars collected during AoC. Between work, family commitments, my programming and problem solving skill levels, that’s about the most I can usually do during the live period in December.
Software I used for Programming in 2022
Python
This year I really worked a lot on Python web technologies so I came to appreciate all the work that the JetBrains team does to make all the little things (like running Django test server commands) incredibly easy. I essentially did all my Python development in Pycharm. I’ve had access to the paid JetBrains suite because of the work I’ve done for my open source project: Extra Life Donation Tracker. Since development has slowed a bit on there, I may not be able to renew the subscription. If that’s the case, there’s a big chance that I’ll start saving up some money for a Pycharm Professional license. The only real exception to using Pycharm for programming was when I was editing code on a server. There I would use vim or nvim (more on that later).
Programming Update: Nov 2022
November was not a huge programming month for me. On the weekends I was a little more focused with family stuff and videogames. But I did manage work on a couple projects.
Ever since 2010, I’ve been been using Python to automatically post my top 3 artists to Twitter. In 2020, it even became my first package on Pypi. With activity picking up on Mastodon, I ported the code over to that site. I also used the opportunity to clean up the code bit to my more modern coding standards. I haven’t created a package yet, but may soon enough.
I also did some work on my Extra Life Donation Tracker. I’d pulled out the API so that others could build on it, but, as a result, I was creating a Team object from the API rather than the inheritance version. I did a workaround to make it work, but I’m going to have to work at the code a bit more to make it less clunky.
Programming Update: October 2022
As October came around, it was time to get ready for Hacktoberfest. I’ve been participating for the past few years and I love the fact that DigitalOcean supports this project which gets more people to contribute to free and open source software.
In the past, I’ve often contributed to my Extra Life Donation Tracker. Since the program is pretty mature at this point, most of the issues I have would have taken me too long, especially with how busy I’ve been with non-programming projects lately. So I dedicated my efforts to helping with some quality of life issues for the Prophecy Practicum (Django Version) that I’ve coded up for my friend.
Programming Update: Sept 2022
This month I wanted to practice Go outside of Advent of Code puzzles. So I decided I would port over my Dreamhost DNS updating script from Python to Go. This would have the advantage of being a compiled program. Every time I update Python on my system, the virtual environment points to the wrong Python version and my program breaks. But, boy is parsing JSON in Go (at least with the built-in JSON tools) a real pain in the butt. I have to make a struct to hold and parse the data, but it comes back from Dreamhost as a 1-key dictionary holding an array of dictionaries. After a few hours of trying to figure out how to get Go to parse the JSON I was still unable to get the struct right. I may do a little debugging to see if I can figure it out before searching for any simpler JSON libraries.
Programming Update: Aug
August was a programming-filled month for me. It focused entirely on Python and I mostly continued working on established projects. Let’s jump in!
Amortization
I wanted to re-calculate the amortization table for my home loan for the first time in about a year. As a refresher, I created this program (vs using Excel or an online form) because we are not consistent in the amount of extra principal payments we make. For example, if I get a bonus at work, I might throw all of that bonus into the loan payment. So this program takes variable extra payments into account when creating the amortization table.
Programming Update May-July 2022
I started working my way back towards spending more time programming as the summer started (in between getting re-addicted to CDProjektRed’s Gwent).
I started off by working on my btrfs snapshot program, Snap in Time. I finally added in the ability for the remote culling to take place. (My backup directories had started getting a LITTLE too big) I also added in official text log files so that I wouldn’t have to rely on my cronjob log file hack.
Programming Update: March/April
In March I went back to Advent of Code 2016. In an effort not to get stuck, I decided to go as far as I can in Python before going back around and working on the other languages. So I did days 6 and 7 in Python. Overall, relatively easy Regex problems.
And that’s it. It was not a big month for programming. I mostly focused on playing with the kids and cooking. May/June are looking like they’re going to contain quite a bit more programming, at least relatively speaking. I’m hoping to both get back to work on some of my projects and also get back to Advent of Code.
Programming Update: January/February 2022
I started off the year not expecting to do much programming. Compared to some months in 2021, I barely programmed, but I did end up programming much more than I expected. Let’s take a look at what I worked on in the first sixth of the year.
Python Programs
End of Year Video Games Helper
Coming off of last year in which I finally used Python to pull my last.fm data and create graphs, I decided to do the same for my End of Year Video Games blog post. I haven’t posted the code to Github, but here it is:
Best thing I've ever learned from @PythonBytes
I’ve learned a lot of great tips and about a lot of awesome packages (hello, rich), but the best thing I’ve ever learned isn’t even Python specific. The most recent episode mentioned https://regex101.com and I don’t think I’ll ever again find myself banging my head against the wall when my regex isn’t working! Thanks @mkennedy !
Software I used for Programming in 2021
Overall, there was a continuation of trends from last year with just a few changes.
Python
Pycharm
PyCharm has continued to be my IDE of choice for Python programming. The devs haven’t been resting on their laurels, either. Recently they added some extra features to support FastAPI. And they also added some features that I don’t 100% understand that make it easier to test against fake HTTP endpoints. It’s really awesome and definitely worth the price if you program primarily in Python. As I predicted last year, its git features ended up making GitQlient and Git Kraken (on Linux) more or less obsolete for me.
My Programming Projects and Progress in 2021
As I did last year, I’d like to take a look at how well my predictions matched up to what ended up happening:
- Working on my Extra Life Donation Tracker: Yes! I made a bunch of releases last year to fix various bugs for my users. I also finally broke out the Donor Drive Code into its own project so that my code could be used as the basis of non-Extra Life Projects
- Moving Prophecy Practicum to Django: Yes! I did this and my colleague has been using it for about 6 months now. I have some quality of life issues to fix that will help me get better at Django and maybe CSS.
- Redoing flickr views project: Nope. Completely forgot about this.
- Progress on my Unity Game - Eric’s Comet Cleaners - None.
- Learning new programming languages: Yes! Haskell and Go, through Advent of Code problem solving. Also got better at Ruby and Perl.
- Electronics: Some Adaboxes, but no work on my BBQ ThermostatKids: A little more Scratch with the twins. No “real” programming languages with Scarlett.
Compared to last year I had 10 more commits to Github. Pretty consistent!
Programming Update: November/December 2021
In these last two months of the year I only worked on Advent of Code.
November
In November I worked through part of the 2016 problem set. I didn’t get too far because of how many languages I was doing at this point. Eventually I decided to allow myself to get a bit further in Python and then catch up with the other languages. Whenever I’d get stuck I’d go back to the other languages. Overall, once I’d figured out Python - Ruby, Perl, and Golang would be pretty easy. Haskell would still be hard, but I started getting the hang of it near the end of the month.
Programming Update: September / October 2021
Across both September and October I got a decent amount of programming done. I just about finished the Learn You Haskell for Great Good book (got up to just before Monads) and started Head First Go. Once I had enough Go language to get started on AoC, I knew I’d be ready for the 2016 problem set. Let’s get into the nitty gritty!
Python (not Advent of Code)
Impractical Python
I finished chapter 11 which contained my old friend the Monty Hall Paradox. I’ve had a version up on my site for a very long time based on a PHP tutorial in Linux Format Magazine. This time I was able to code it in Python as well as creating a GUI version. Chapter 11 also touched upon The Birthday Paradox.
Completing Advent of Code 2015 with 3 Programming languages
Throughout the spring and summer of 2021 a few of the times that I mentioned on the Advent of Code subreddit that I was doing the 2015 problem set in all 3 languages, some folks said they’d be interested in a writeup on the experience. Now that I’ve finally finished 2015 (my first set of 50 stars!) it’s time for that writeup. Before I continue, I’d like to thank everyone on the subreddit who has helped me. I have a README.md for each day’s problem and you’ll find my thanks to those who helped me within those READMEs here in my repo.
Programming Update for July and August 2021
I didn’t do much coding in July, so I decided to combine the July and August wrap-ups.
Python
Dreamhost Dynamic DNS
I decided to clean up and update some code that uses the Dreamhost API to allow for Dynamic DNS. I cleaned up the logging output so that I could figure out why it was sometimes deleting one of my domains rather than just updating the IP. The original programmer had it printing out to the terminal. I used the logging package to send logs out to a file. While I was improving the logging, I also decided to use f-strings to make it more obvious what was going into the output string.
Programming Update for June 2021
June was mostly Python, although I did do chapter 1 of Scratch 3 Games for Kids with Sam. He really, really enjoyed it and I anticipate doing the challenge problems and maybe chapter 2 in July or August.
Books
I read the intro and first couple chapters of both Flask Web Development, 2nd Edition and Data Visualization with Python and Javascript, both from a recent Humble Bundle. The Flask book may be useful for learning more about creating a non-Django site and, even if I mostly stick with FastAPI, it should provide some concepts that are applicable across both frameworks. With the data visualization book, I would love to use that to better visualize my annual Last.fm stats.
Programming Update for May 2021
Advent of Code 2015 Problem Set
Day 10
There’s a lot to be said for doing the Advent of Code in December along with a few thousand other programmers. It’s fun to be part of something with others and you get to all the neat and wacky solutions that others come up with.
On the other hand, going at my own page with the 2015 problem set allows for interesting little coincidences to form. What I did one day (when I was at about Day 7) was to go through all the remaining days and write some first impression ideas at solutions. This got my brain thinking about what I needed for each day. One day, before getting to the Day 10 problems, I was idly flipping through the book Learn You a Haskell for Great Good! As I was trying to decide if it would be one of the languages I’d add for 2016. I ended up coming across a built-in library that would have made solving Day 10 a real breeze. Day 10 is the Look and Say sequence. I’m sure by paying close attention to that Wiki entry I could have figured out an algorithm. But, basically I just needed to group together each repeated number and then I could take the length of that list/array to find out how many numbers. That becomes part of the new number. Unfortunately, as far as I could see, that functionality was not built into Python. So my Python code looked like this:
Programming Update for April 2021
I had a lot less variety in my programming month, but still had a lot of fun doing it. In fact, Programming consumed most of my leisure thoughts. More about why I was doing it below, but I’ve been reading Programming Perl as well as skimming through Introducing Go and Learn You A Haskell for Great Good!. Ever since some folks used Haskell during last year’s Advent of Code and this guy’s videos that I mentioned in an early 2021 blog post, I’ve been very curious about the language. In fact, at this point I’ve decided that Go and Haskell will be the next two languages I learn.
Mozilla's Legacy
A few days ago I read this article over at Tech Republic about how, Mozilla’s greatest achievement is not Firefox, but the Rust programming language. They point to Firefox’s declining numbers in the face of Chrome and Chromium-based browsers and I’m inclined to agree with the author. There is, of course, a kind of poetry to this. Although Netscape was one of the first dot-com companies and beat Microsoft to the punch at creating the first mainstream web browser, it’s not Netscape Navigator which is its greatest legacy. Instead it’s spinning off into Mozilla and, the most poetic part, the creation of the Javascript programming language. (Javascript was written in just a week and a half and this episode of Red Hat’s Commandline Heroes podcast does an excellent job documenting it)
Programming Projects: March 2021
I started off the month thinking it was going to be Python heavy and ended up doing a lot more micro-controller programming. To be fair, I was mostly programming in CircuitPython, but it definitely came out of nowhere.
Python
Civilization VI Webhook in FastAPI
Last month I created a webhook program in Flask to generate notifications when it was someone’s turn in our multiplayer Civilization games. When I posted about it on reddit, someone suggested that I would be better off using FastAPI instead of Flask. I’d been hearing about FastAPI for months on Talk Python to Me and Python Bytes, but I always got the impression that it would only be useful if I was writing my website to be async.
My Extra Life Donation Tracker reaches v6.0 (feature complete)
This is my seventh year raising money for Johns Hopkins Children’s Center via the Extra Life gaming charity. When I started back then I was brand new to streaming or recording video game play. In fact, just a few years before that I hadn’t even understood the point. I found out that you could somehow display your progress towards fundraising on your screen while you played. I had no idea how to do that and, at the time, I’d only done commandline programs. So I found bfinleyui’s web-based program. I set up XSplit (which I was using at the time) to capture the web pages and was able to have a great first year. The following year he created an app with Adobe Air that was even better. The GUI for this app would become the inspiration for ElDonationTracker; what I aspired to eventually build. My first commit to the repo for ElDonationTracker was that year. I was exploring how to get the API data via the commandline, but I wasn’t too hurried because I had the Adobe Air app. Unfortunately, the following year Adobe killed Adobe Air. So it was now time for me to try and make my own app. Unfortunately, I’d never done GUI programming before and my experiment with the TKinter GUI framework didn’t quite work.
Programming Jan/Feb 2021
I was pretty busy programming at the start of 2021 across a few different languages. Let’s jump right in!
C#
I’m nearing the end of the GameDev.tv online RTS course, and it’s been a lot of fun. Since last time we added player colors to the units, a minimap that can be used to move around the screen, new units, and a Lobby UI. I’m a few lessons away from being able to create binaries I can use to play online with others or via Steam.
Programming in the first two weeks of 2021
It’s been a pretty busy 2 weeks. I’ve basically either been finishing up end of year blog posts or programming. Let’s jump in!
Extra Life Donation Tracker
I have the 5.3 release of my Extra Life Donation Tracker. I had a few minor refactoring goals for that release, but also a few user-facing enhancements. I added in the ability to grab the user’s avatar as well as their team’s avatar. They can now use that as an input in either XSplit or OBS. During these two weeks I also fixed a user-reported bug on crashes if a donor had emoji in their name. Oh emoji, you’re the bane of my programming existence!
Software I used for Programming in 2020
I last wrote about the software I’m using while programming back in March. I think at the time I was thinking of writing quarterly updates, but my preferences didn’t change with that much regularity. I decided to make it one of my annual posts instead. So here is the software I used in 2020 to program.
Python Projects
PyCharm
For my Python projects I transitioned fully to PyCharm Community Edition. I documented my reasons for moving towards Pycharm in this post with a followup here. As I was writing this, I learned of a Real Python guide to Pycharm that taught me a few things I didn’t know about how to make better use of PyCharm. PyCharm has made Python programming a real joy. For any libraries I have imported (or standard libraries), it provides excellent code completion as well as context for function or method arguments that saves me time vs looking it up in documentation. The git integration is also great and I’ve recently started exploring usage of the lower git window which may make GitQlient obsolete for my Python projects. I haven’t made the best use of the debugger yet, but I’m slowly learning how to take advantage of it in my larger projects. If you’re a Python programmer I can’t imagine a better IDE. I did have access to Pycharm Professional for a while in 2020, but I wasn’t doing any Flask or Django work, so I didn’t really notice anything useful over the community edition.
My Programming Projects and Progress in 2020
Back in 2019, when I did my programming retrospective I made a few predictions. How did those go?
- Work on my Extra Life Donation Tracker? Yup! See below!
- Write more C++ thanks to Arduino? Not so much.
- C# thanks to Unity? Yes, but not in the way I thought. I only did minor work on my game, but I did start a new GameDev.tv class.
- Learning Ruby? Well, I wouldn’t necessarily say I learned Ruby. I did finish the book Ruby Wizardry and I took copious notes. But until I do some practice - maybe via some code katas, I don’t think I’ll have solidified it in my mind.
- 3D Game Dev? Nope, not really.
- Rust and Go? Not even close. Although I did make sure to get some books on the languages.
So, what happened? On the programming front, I wanted to continue my journey to truly master Python after having used it at a surface level for the past 15ish years. I dedicated myself to doing the Python Morsels challenges (more on that below) and working through various Python development exercises. Outside of programming, the time I had off from COVID was used to play with my kids and they wanted to play lots of video games. So we took advantage of having way more time than usual to do that. So a lot of my goals slipped. We’ll get to 2021 predictions at the end, so let’s take a look at 2020!
The Right Programming Language can make a big difference
Recently I came across this video where a programmer solves the same problem in 6 different programming languages:
What’s incredibly beautiful are the Haskell and APL solutions. Whereas every other language requires multiple lines, Haskell solves the problem in just one line. And APL is just a few symbols.
Here’s the same guy solving a problem from the Leetcode challenge in a few languages. Once again, it’s pretty neat how the elegance of the solution varies across languages:
Programming Update
C#
Back when I was doing GameDev.Tv’s Unity 2D class, I really wanted to know how to do multiplayer games (I also wanted some better support on using Xbox/PS3 remotes in games). Well, this year they released their Multiplayer class. So, naturally, I bought it up. I started working on it, resulting in two Github Repos. In the first section we were learned the basics of the Mirror add-on. I’m currently working through the second section, where we will create a basic RTS. I haven’t reached a real differentiation point from the GameDev folks. That may come later after we get past the basics.
Followup On Unity and JetBrains Rider on Fedora
As you recall from the previous blog post, I’d installed Unity and JetBrains on my Fedora 32 computer via Flatpaks. I was going to use them for the Unity Multiplayer course I was taking on Udemy. Unfortunately it was an immediate fail and in lesson one after they have me install a new inputs library and restart Unity, it would always crash upon loading the file. I’m currently installing Unity 2020.1 on my Windows computer where I don’t expect to have that issue. Assuming I don’t, then it’s a big fat nope on using Unity on Fedora via Flatpak (at least for this class). Which, to be fair, is not on their supported OS list - which is only Ubuntu and CentOS 7. (And the latter for movie-making)
Unity and JetBrains Rider on Fedora via Flathub
As I mentioned last year in my 2019 in Programming post, I created a bunch of 2D games in Unity by following along with the Gamedev.tv classes. I would watch the videos on Linux and jump over to my Windows computer for the programming, learning how to use SourceTree and Microsoft Video Studio in the process. But for some reason, going back and forth with the KVM when running Unity would sometimes freeze up the Windows computer. So when I saw someone on Fedora Planet running Unity Hub, I thought I’d see if there was a Flatpak - and there IS! Also, I’ve fallen in love with JetBrain’s Pycharm, so I thought I’d go ahead and use their game dev IDE, Rider. ( There’s a Flatpak for that, too!) So, let’s see how well this works!
PyGame 2.0 is out!
I just found out today that PyGame 2.0 was released yesterday, on the 20th anniversary of the software. One of the first steps I took with Python was a series of games I made from tutorials in Linux Format Magazine. On Github I’ve got my shifter game and my Space Invaders clone. The shifter game is a little wonky since I haven’t touched the code in over a decade. But I was able to make the one shift needed to make the Space Invaders clone work on Python 3. So you can enjoy those and celebrate that PyGame development has picked up steam again.
What I've been up to in Programming: Python
Selenium for Automated Pool Signup
Spent the last week debugging that script. Turns out the key to getting it to run in cron is to add export DISPLAY=:0 && before your command. That’s because Chrome will not launch without a display to send Chrome to.
Python Morsels
The most recent Python Morsels exercise was to figure out if a number was a perfect square. Trey began his problem statement this way: “This week I want you to write a function that might seem simple at first, but there’s a number of ways to solve it.” It definitely took some out of the box thinking for me to figure out how I was going to solve the base case. The math.sqrt() function returns a float so that it can give answers for non-perfect squares. So I kept thinking and I realized that any perfect, non-complex square root must be an integer. So I came up with the conditional to return. (And after all this Pythonic learning, I’ve learned not to evaluate for truth and then return a variable. Just return the evaluation)
Last Few Days in Programming: Lots of Python
Been quite busy with Python, keeping me away from other pursuits, like video games. (Although the kids have been requesting Spelunky 2 whenever it’s time to hang out with them)
Extra Life Donation Tracker (eldonationtracker)
For my Extra Life Donation Tracker I pushed out a new release, v5.2.2. A user of my program (man, I never get tired of how awesome that is!!) had wholly anonymous donors which was causing an issue I thought I’d handled. But it turns out that the folks that run the Donor Drive API are a little inconsistent in how they handle that in the donor endpoint vs the donations endpoint. So I pushed that fix out and now things should be dandy for game day (about 2 weeks away!!)
Last few weeks in Programming: Python, Ruby
You may notice it’s been a while since I last wrote about programming. Well, a lot of the programming I was doing with the kids was due to having more time on my hands thanks to COVID. With Scarlett back in school full-time, there’s a lot less time for that as we focus on making sure she gets the most out of her education as well as teaching the twins to make up for not being in preschool this year. This has left me with reduced time for all my projects and entertainment (games, TV, and reading). Up until now that has meant the programming was put off to the side - kind of. Because I’ve been loving my exercises from the Python Morsels website and I’ll be talking about that when I get to the Python section. But first up, Ruby!
Last Week or So of Programming: Python, CircuitPython, Scratch, Arduino, and MakeCode
Because I’ve been busy with programming and other tasks (including getting re-addicted to Cities: Skylines), I’ve got a roundup from about the last week or so in programming.
Python
Python Morsels
I got the mid-tier of the Pycharm Humble Bundle which came with a bit of a subscription to Python Morsels. Every week Trey Hunner, a Python trainer, sends subscribers a problem to solve along with a few bonus questions to deepen the learning. Here’s what I’ve loved so far:
Last Few Days in Programming: Python and Arduino
Python
Spent the last few days finalizing the 5.0 release of my Extra Life Donation Tracker and then pushed ahead to get version 5.1 out. Here’s the PyPi page if you want to use it for your Extra Life live streams.
Arduino
I got back to my BBQ Themostat project and did some minor programming while trying to figure out how to run a computer case fan. So far I’m still working on the wiring aspect of this part of the project, but some folks on reddit did point out that part of my problem was getting a pair of my BJT connections mixed up.
Today in Programming: Microsoft MakeCode
With the twins, I messed around with a Neopixel strip. Not sure what I’d do with one in a future project, but at least I know how to program it in MakeCode now. Our project:
Messing around with the Neopixels Strip
Today in Programming: Microsoft MakeCode
Since I’ve been making a lot of great progress programming with the kids in Scratch, I bought some Circuit Playground Expresses to program with the kids. The Circuit Playground Express can program in Arduino’s C dialect, CircuitPython, or Microsoft MakeCode, which uses blocks like Scratch. Today Scarlett and I made our first useful bit of code, a digital spinner we called The Sibling Chooser. Here’s the code, and you can see that it is indeed like Scratch:
Today in Programming: Python
I noticed that something had gone screwy with the Raspberry Pi 1B in the garage that was monitoring the garage door. I restarted it and discovered that last time I was coding and working on making it more robust if it had a temporary lapse in WiFi (so it wouldn’t crash), I’d created a little error. Fixing that error led me to realize that my new code for robustness had introduced an unfortunate artifact in that it would pass a status of “unchanged” to MQTT. So I fixed that. Code’s now in a good place. I just need to add a few more config options to make it more usable for others who aren’t me. Then I’ll make another release.
Raspberry Pi Zero W for new Projects
The next project I wanted to work on was to see if maybe my environment monitoring might be slightly more reliable with a Raspberry Pi than with an Arduino. So I wanted to do some comparisons. For my bathroom IoT project, I am using:
- Arduinio MKR Wif i 1010 - $32.10
- Arduino MKR ENV Shield - $34.40
- 5V 2.5A power supply - $7.50
That’s a total of $74 before taxes and shipping. To get the same measurements on the Pi platform I went with:
Yesterday and Today's Programming: Scratch
Stella’s Project
Because last week was busy with house projects, this week I continued the ocean/water-themed programming from the Raspberry Pi Foundation. The first project was a game I made with Stella (her first computer game creation), a boat race in Scratch. While we mostly stuck to the tutorial, we did partake in the challenges, including adding a shark and figuring how to have background music (which Stella chose on her own). That turned out to be really tough as my attempts to figure out how to use the loops led to stuttering. Eventually I figured it out and you can see what I did, the rest of the code, and how the game plays by watching the video below:
Today's Programming: Scratch and Python
Scratch
Starting off with this code from the Raspberry Pi foundation, Sam made his first ever video game. I then modified it so the shark would close his mouth when he eats the fish and added a sound at the end when a score of 5 was reached. Here’s a video of Sam playing his game:
Python
For Python I continued to work on writing unit tests for my Extra Life Donation Tracker. Doing so helped me find a few bugs and a few functions that I was able to combine to reduce the code complexity. Overall, this has been a very productive phase for the project, even if it has been very frustrating figuring out how to mock out certain functions like those reaching out to the net or those writing to disk. Depending on what I can do with some help that someone offered me on reddit, I will either go back to the extralife_io.py file to try and finish that one up or I may declare unit testing completed for now and tackle that later when I’ve learned even more about how Python works and how to test it.
Last Three Days of Programming: Python
I’ve mostly been working on version 5.0 of my Extra Life Donation Tracker. Since I adopted the Semantic Versioning principle for the project, an API change means a major version change. I’ve been taking everything I’ve learned about Python programming from 2019 and 2020 and tried to make my code both more Pythonic and more sophisticated. I’m also trying to move towards 100% code coverage. That is to say, I’m looking to try and make sure every line of code is covered by a test. While 100% test coverage doesn’t guarantee perfect code (after all, the test itself could be flawed or I might not be considering corner cases), striving for it usually has a few benefits:
Today's Programming: Ruby and Python
I don’t know how long I intend to keep doing this, but I decided I wanted to document my programming as I went along. So yesterday I worked on Scratch and here’s today’s entry.
Ruby
A while ago I got a bunch of kids’ programming books in a Humble Bundle. I tried showing Ruby to my oldest, but I did it one year too soon (she wasn’t yet reading as well as she is today and couldn’t type as well as she can today) so for now she’s not into programming. But I was curious to see how it was presented since the book uses a story to present it (quite different from the Python book in the same bundle). Went through chapter 2 today and, so far, it seems that Ruby is pretty readable like Python is. That said, I’m not sure puts makes more sense than print, but maybe if I delve into the history of Ruby, I’ll understand why it’s puts? The author of this book uses snake case for variable names. I wonder if that’s because it’s the Ruby standard to use snake case instead of camel case or just to make it easier for the kids following along. I *did* really like the built in next and pred methods on numbers. Definitely more readable than a var++ or var = var + 1. Or rather, if you don’t have decades of programming experience (as I do), I think it’s just a faster bit of cognition to see var.next and understand it vs the older ways of doing the same thing.
Today's Programming: Flowers in Scratch 3
First of all, if you’re a Linux user and would like an offline version of Scratch 3, you can get it from https://scratux.org/. They make binaries for a few Linux distros plus an AppImage which works on any of them. On the Raspberry Pi Blog I saw that this week was about making art on the computer. So Stella and I went through the tutorial for making flowers in Scratch. Here’s what the code blocks looked like:
Coming Full Circle: Contributing to the Python Project Matrix-Nio
Somewhere around 15 years ago, I started learning Python because I’d gotten deep into genealogy and started using the free and open source project Gramps. As I was also pretty deep into free software (somewhere around that time I became a supporting member of the FSF for a few years - and I think my smile.amazon.com still donates to them) I got interested in the idea of helping projects by contributing code. Python seemed like it wasn’t too hard to learn (compared to C++), so I started learning. I never did end up contributing to Gramps as I found GUI programming incredibly hard. In fact, it was something like 6 years ago before I created some useful GUIs (that weren’t copied out of tutorials) and only last year that I started making good, competent GUIs using the QT toolkit.
My Photostats Python Program
11 years ago (HOLY MOLEY WHERE DOES THE TIME GO?!?) I wrote about Jeffrey Friedl’s LR Stats plugin. As you know if you’ve been around my blog for a while, I love stats! It’s the biggest reason I do my end of year posts with my music, reading, and video game stats. Well, I haven’t used Lightroom for a few years now, and for some reason I was inspired this past weekend to recreate this ability. So I started on photostats, which will present a lot of the same stats that his Lightroom plugin does. On the plus side, my Python program is app-agnostic!
PyCharm 1 week Update
I’ve been using PyCharm for about a week now across a couple projects. I’d like to note a few things I’m really enjoying:
- PyCharm is aware of your venv config and you can use it to pip install new packages. Ok, so pip is easy to use for installing. But it also provides a quick at-a-glance view of the packages you’ve installed and their versions - and I find it easier to view than a pip freeze.
- I know KDevelop has this for C++, but it doesn’t really have the same support for Python - being able to run my Python files from within PyCharm as well as being able to run the debugger from within PyCharm is like how new cars unlock for you when you get close. It’s not necessary. It’s not even that huge of an improvement. But it’s a quality of life thing that you miss when it’s not there.
- PyCharm is very smart about git. With KDevelop, I could add files withink the GUI (which is nice for making sure the project is aware of the file and provides a quick visual cue). But then I had to remember to git add it (either in the GUI or on the commandline). With PyCharm, every time I add a file through the GUI, it asks me if I want to add it to version control.
PyCharm asking if I want to add the new file to source control
Programming Tools Q12020
I decided to document the tools I’m using for development since the various programming subreddits I frequent always have someone asking what tools they should be using.
IDEs/Editors
Linux
As I wrote in September, I’ve moved to using KDevelop for my larger projects.
KDevelop
Its built-in Python parser (working with flake8) has helped me find a lot of issues before getting to the stage of running flake8. The GUI for pushing commits to git has been very helpful in helping remind me what has changed and even (sometimes) noticing something I forgot to add to git. Its project-wide search has been invaluable when refactoring or renaming functions/classes. When it comes to large, complex programs, it’s hard to beat KDevelop when using KDE. That said, it’s only recently that the developers have started focusing away from being only a C++ editor and as you’ll see at the end of this blog post, for my Python workflow, I might be switching away.
Hey, Pycharm, hey.
Back in September I wrote about moving to KDevelop for my larger Python projects and also staying with Kate for my smaller projects. I’ve REALLY been enjoying all the features as I work on more and more complex packages involving lots of files. But for a few episodes of Python Bytes now (and/or maybe Talk Python to Me - they share a host) they’ve been talking about how awesome it is to use an IDE that has a Python debugger built in. It may be that KDevelop has that ability (I’m pretty sure it does for C++), but I’m not sure. I am nearly certain that Pycharm does have a debugger built-in. A while ago I’d set up the Pycharm COPR repo on my laptop. I tried playing with it a little at the time, but I was coding on a very small project without a venv, so things didn’t work out well. (Pycharm is pretty opinionated about the way a Python project should work)
EL Donation Tracker (v4.1.1)
It’s been 5 months since I last wrote about ELDonation Tracker, my software for tracking Extra Life donations for use during a livestream or VOD. I’ve been quite busy since then! First, I used Github pages to make a site for the software to make it a little easier for those who are just users and don’t intend to do any development. They don’t have to navigate Github to try and figure out how to get the program and use it. Then, by reading Serious Python I learned about Sphinx, which can automatically create documentation out of your docstrings. I also learned that all these “readthedocs” pages I’d seen springing up with all the projects I care about were leveraging the fact that readthedocs.io will use your Sphinx documentation to create hosted documentation. So now I have some great documentation for my software. Finally, it’s my SECOND bit of software to go up on PyPi:
QGit vs GitQlient
I wrote about GitQlient a while ago. A few days ago I got a GitHub notification that GitQlient had finally reached 1.0. Consequently, the author created an Appimage version of the client so I was finally able to try it without having to compile on my own. As I started taking screenshots for blog post, I realized that the points I wanted to make would be more easily made if I could show them via a video, so I made a video comparing the two.
My first PyPi Package!
I was reading Serious Python by Julien Danjou as well as looking through other Python repos when I realized that my Extra Life Donation Tracker repo was a mess. (It’ll be different by the time you read this, but here’s how it looked at the time) After learning about how things should be structured and reading Mr. Danjou’s book about how I could use Sphinx to auto-document my code, I decided to undertake the challenge. However, there was a lot to learn and this code is used by many others for their Extra Life campaigns. I wanted to start off with much simpler code, so I started off by packetizing my lastfm-twitter code. It was a fun journey over the last week or so as I learned how to restructure my code and auto-document. (I also learned a lot about how to use Drone CI, which I’m using for my home projects that aren’t on GitHub) As the final lesson, I taught myself how to create a package for PyPi via Drone CI and so, I now have a PyPi package that anyone can import with pip!
Getting rid of some old Java textbooks
I had been hanging on to these books in case I ever found myself wanting to do some Java programming. But as I’ve come to learn (mostly because of Python, but also through following the Perl 6 saga), languages change and evolve and so a couple books from nearly 20 years ago probably won’t be more useful than a newer book or a good Google search.
Cornell’s CS101 class textbook back when I was a freshman
I don’t remember what class this was for, but Cornell sure loved Java back then.
What I want in #CircuitPython2020
Over on Adafruit they asked the community, " What do you want from CircuitPython in 2020?" What’s CircuitPython? It’s a subset of Python that’s meant to run on embedded processors. Essentially I could use it (on compatible boards) in place of Arduino’s subset of C++ or TinyGo. As you know if you read my 2019 in Programming post, I love programming in Python and I love making GUIs with Qt. With Adafruit’s PyPortal, I was looking at making a GUI interface for some usecases here, but from what I can find on Adafruit’s tutorials THIS is how you make GUIs. Ugh! I mean, it’s kind of in the whole DIY spirit to make your GUI out of basic elements like circles, squares, and triangles. But, since Qt is available for embedded devices, I’d love to be able to use Qt5 Designer and pyuic5 just as I do with regular Python to create awesome GUIs for my CircuitPython projects (when they have a fully-featured screen, of course).
2019 In Programming
This was a VERY busy year for my coding. This year I had over 769 commits to GitHub; my previous best was 58 in 2014. The commits were very unevenly distributed. If you look at the graph of my commits, outside of a busy week in January and another in May, I didn’t really start coding until August.
GitHub activity graph
But perhaps commits to GithHub isn’t the best metric. If you look at what I accomplished in the second half of 2019, I worked on an incredible number of projects.
BBQ Thermostat Project: First Live Test
This is copied over from my Hackaday.io page.
BBQ Thermostat: Arduino MKR 1010 and Therm Shield measuring temperature during a smoke
Today I was smoking a turkey so I figured it was a good time to do a live test of my project. There was good news and bad news. I think it’s illustrated quite well by the following graph:
Grafana graph of my BBQ Thermostat while measuring the smoker temp
Unity 2D Game 6: Tilevania
The sixth, and final, game of the Udemy class on Unity 2D was a tileset Metroid-Vania game which the instructors named Tilevania. I never played Metroid and maybe only played Castlevania once, but its legacy does persist in some newer games like Spelunky.
Tilevania in the Unity UI
This was the closest I’ve come to making a Mario clone. My favorite part of the development process was creating the tile editor rules that allows me to drag around the tiles for the foreground and have it automatically determine if it should be a grass piece, dark, or full of rocks. As usual with the games we used to learn concepts for the course, there is a lot left to do to make a fully-fledged game. I made note of a few items in the tickets on the Github page.
Unity 2D Game 5: Glitch Garden
The fifth video game I made in Unity was another clone of a game I spent a lot of time playing, this time as an adult - Plants vs Zombies.
Glitch Garden during development
For comparison, here’s Plants vs Zombies:
Plants vs Zombies
and here’s my finished Glitch Garden:
Glitch Garden
We learned a lot of techniques and reinforced even more, but the biggest thing I learned was how to do Sprite Sheet animation. Having done bone-based animation in Blender years ago, I have to say that in comparison, sprite sheet animation is easy-peasy. The tradeoff is less flexibility - you only have what your artist drew (or you bought or got for free online), but it essentially automates everything about animation.
Git gets interesting
This used to look pretty regular. Just two parallel lines with the devel branch connecting into the master branch here and there. But then I merged master into devel because I added issue templates on the github website directly into master. Things got….interesting….
Here’s the before (but a few weeks ago):
git before merging master to devel
Here’s what it looks like now:
git after merging master into devel
Unity 2D Game 4: Laser Defender
The fourth game we worked on was another game that I spent a lot of my childhood playing. We made a Galaxian/Galaga clone:
Laser Defender - a Galaga Galaxian clone
My mom’s youngest brother had a Nintendo and lots of arcade ports. When I was young he lived in the condo above my grandmother’s condo and whenever we’d go visit her, I’d ask if I could visit him so we could play games. The game I loved playing the most there was Galaga because of the frantic pace.
Unity 2D Game 3: Block Destroyer
My journey through 2D game development using the Unity engine continued with our third project: a clone of Brick Breaker or Arkanoid. In case you’ve never seen it before, this is Arkanoid:
Arkanoid
It’s got a pretty important legacy, Breakout, the version that Atari created, was an important stepping stone for the two Steves of Apple (Steve Jobs and Steve Wozniak).
So it makes sense that this would be one of the games we would use on our learning journey. This is what my first level looks like:
Discovering new git GUIs
When I wrote about checking out KDevelop, I mentioned that it was due to a blog post by the Kate developers about how to evolve Kate going forward. Last night I came across a new article in the same vein in which they looked at potential git GUIs to use from within Kate. In my KDevelop post, I mentioned that I use QGit, but it can look a bit small in the screenshot of my 3 monitor desktop. So this is my typical QGit setup:
Learning how to make 2D Games in Unity
I’ve been playing video games since I was somewhere around 5 or 6 years old and got a Nintendo Entertainment System for my birthday from one of my aunts. I also inherited a Tandy computer from my dad when I was younger. We had a bunch of edutainment games - like this Sesame Street game (that unfortunately a quick search on Google Images does not turn up) where you had to suck the Tweedles (bugs from Ernie’s flower box) to solve math problems. I also, and I’ve mentioned this before in several places on the net, learned to program from a book on BASIC and made myself a bunch of simple games, including Madlibs clones.
New Release (v1.9.3) of my Extra Life Donation Tracker Software
I’m getting really close to finally getting this program to where I wanted it to be 4 years ago. My most recent release adds in the Team info to the GUI (and the previous release, which I didn’t blog about added team info in general). I’m getting feature requests and bug reports and all those kinds of encouraging things that make people want to provide programs for others. Also new as of a couple releases ago is the fact that I’m using Github’s CI (called Github Actions) to produce binaries for me that I can attach to releases to make it easier for folks to use the software.
BBQ Thermostat Project
I recently started an electronics hacking project to build a thermostat for my Weber Smokey Mountain. You can find details at Hackaday.io, but if you’ve been here long enough you know that I don’t trust other sites to continue to exist. (It’s why I copy my book reviews over from Good Reads). As of right now I’ve got the board able to read temperatures from a thermocouple that I send, via WiFi, to an MQTT broker. Then, via Python I take subscribe to that MQTT topic and put it into InfluxDB. From there I use Grafana to graph it. Here’s an early beta where I was trying to make sure it was working from end-to-end:
My First Pull Request to a project I don't own!
When MakeMKV added a new requirement for ccextractor, allowing it to grab subtitles that are encoded on the DVD or Blueray as Closed Captioning instead of subtitles, there wasn’t a package available for Fedora. (There is now, but at the time where wasn’t) So I wanted to make an RPM that I could host on Fedora’s COPR for others who needed the package. There was a problem with their shell script for building RPMs. At the time I just kept hacking away at it until I was able to build RPMs. But I didn’t think about how the manual process wouldn’t be sustainable as changes were made to CC Extractor. They weren’t having releases too often, so I didn’t worry about it. But then they made a new release and I knew that this time, having leveled up on my git-fu, I would try and figure out how to fix that problem and submit a pull request.
Addendum to my KDevelop Post
A couple days ago, I wrote about giving KDevelop another look and posted it to reddit’s r/kde. In my post, I’d said it was annoying to have to configure the color schemas per file. Someone commented on the subreddit that if you use the View->Schema menus it’s per file while if you go into Settings->KDevelop settings you can change it for all files.
As a side effect I explored the same options in Kate and set it up like this:
Moving to KDevelop for my larger Python Projects
When I first started programming it was just at the prompt of my Tandy computer. Then it was in the QBasic text editor on the IBM computers at school. But when I started programming again with “real” languages, I ended up going with Emacs. Although I was first annoyed at the way commands like save were prefixed, it became my favorite editor. I think that was partially because of diving headfirst into the free software movement and partially because I didn’t like vi’s different modes and how annoying that made things if you didn’t realize you weren’t in the text entry mode. Eventually, I moved on to Kate because I love KDE (been running it as my main desktop for over 10 years now) and I loved the features it enabled. Also, since vi (or vim) is found EVERYWHERE while Emacs usually requires installation, I ended up switching to vi whenever I’m ssh’d into a computer. If you add plugins like powerline, it can be pretty awesome to use. Even on my desktop if I’m editing /etc/fstab I’m more likely to pull up vi than the weight of KDE (not that it takes up THAT much RAM).
New Release of my Extra Life Donations Tracker Software
After a bit more work since my 21 July post, I’ve finally reached what I can consider to be beta status for the GUI. Things have matured to the point where it works well on both Linux and Windows and I’m now using it every time I game. I created a bunch of issues on Github to track new features I want to add in order to get to what I think will be a 1.0 release. I’m excited at the progress I’ve made and that the software continues to have interest. As always, the code is available on Github. Here are videos on how to use the GUI:
New Release of my Extra Life Donations Tracker Software
If you follow the blog, you remember I’ve been working on a GUI for the donation tracker. Part of making that work involved changing the code to be object oriented. Also, it required moving the user-defined configs to be moved out of the main code. I’ve done that and finally tested that it works (I had a silly bug involving a typo that I had to correct) and merged the code into master over on the github repo. The new code required a change in the directions, so I made new instructional videos to go along with those changes:
My Extra Life Donation Tracker gets a GUI Part 1
Three years ago I created ELDonationTracker to use the Extra Life API to provide donation alerts on my screen while I’m streaming or recording games. About a year and a half ago, I actually had to start using it because the previous donation tracker I’d been using stopped being maintained. Since then I’ve been steadily improving it, but there’s still a bit of functionality for the alerts when someone donates that I was missing by running a commandline utility. A year ago I tried creating a GUI with Tkinter, but I just found it too hard to figure out. What I really wanted anyway was to do it in QT or QML. A few months ago I saw that it appeared the company being QT was going to finally take Python seriously. While looking up some tutorials on PyQT I found out that I could use QT Designer to do a WYSIWYG design and then a simple utility to convert it to Python code. Since designing GUIs is a real drag and takes away time from doing the coding to make the GUI work, I was jazzed. So I threw this together over a couple days, copying the interface from the program that was no longer maintained:
Creating Nice-Looking Buttons in QML on KDE
Back in October I created a GUI for my Python amortization table program. One of the things I lamented was that the buttons in QML look like crap. I want my buttons to look like buttons, not blue patches no a white screen. I don’t really know what made me look, but yesterday (during the No Snow Snow Day) I was looking through the file system and it turned out I had Plasma Components installed on my system. So I added
My Second Ever Useful GUI Program
A while ago I wrote about my first ever useful GUI program. And in one of the series of posts that followed I explained that the reason I hadn’t made a useful GUI program before now is because all the typical stuff has already been made over and over. We don’t need any more tetris clones, word processors, or music programs. Recently I had reason to create my second program. A while ago I created a an amortization calculator in python which you can find here.
Developing My First Plasmoid: The QML Code
Back in February I posted the code to the data engine I developed for my plastmoid. At the time I’d wanted to clean up my plasmoid before posting it on here, however, I’ve become stuck on a key feature so I was hoping that maybe by posting the code I could get some help. (As well as provide an example to others)
First of all, plasmoids need a certain structure to the folders. Here’s what mine looks like:
. ??? contents ? ??? ui ? ??? Button.qml ? ??? Button.qml~ ? ??? content ? ? ??? ItemDelegate.qml ? ? ??? ItemDelegate.qml~ ? ??? flickrhelpers ? ? ??? addtogroup.py ? ? ??? addtogroup.py~ ? ? ??? removefromgroup.py ? ? ??? removefromgroup.py~ ? ??? flickrviews.py~ ? ??? flickrviews.qml ? ??? flickrviews.qml~ ? ??? test.qml~ ??? metadata.desktop ??? metadata.desktop~
Developing my first plasmoid: The Data Engine (in python)
I figured it’d be neat to show you how my plasmoid works so you could use it when developing your own plasmoids. Here’s the main.py of my data engine. The indentation is off, in case you try to copy and past this in.
Here are the imports:
from PyQt4.QtCore import * from PyKDE4.kdecore import * from PyKDE4 import plasmascript #for flickr import views
Those are pretty standard. The last one is the part of my engine that interacts with flickr. Right now I have some work to do to get that presentable, but all you need to know is that it outputs XML to this main part of the data engine.
Developing my first plasmoid part 3
I did it! I have created my first ever useful GUI program. After all these years of thinking that all the useful GUIs had already been invented - I found an itch to scratch. And here’s how the final, working version looks:
[caption id=“attachment_5357” align=“aligncenter” width=“310” caption=“flickr views plasmoid completed!”] [/caption]
And so there it is! I was actually surprised that this last little bit of the program wasn’t as hard to finish up as I thought it would be. So, as currently implemented, when the plasmoid loads up it makes the data engine fill itself. Once that’s complete you can click on the buttons along the top to load up all the photos from that group that are ready to be promoted to the next group. Clicking on a particular photo loads up the small thumbnail. View on flickr allows you to jump to the website in case you want or need to do that. Originally I implemented it so that if the next part was hard, I’d at least have the functionality of the command line version of this software. Then came the new part that happens to be easier in a GUI than on the commandline. You can add the photo to the next group and remove it from the current one. The reason I did it that way was so that if the photo couldn’t be added to the next group, it wouldn’t be removed from the current one. I tested it first with a fake group and then the real thing and it works fine. Before I post the code for my data engine and plasmoid, I have some cleaning up to do. I also need to add in a bit more functionality for robustness. After that, if I’m going to make it so that anyone can use it (and post it on kde-look.org), I will need to do some extra work. So that’s version 0.1. For version 0.2 here’s what I’d have on my TODO list:
Developing my first plamoid Part 2
OK, so it’s been a year since I last blogged about working on this program. I tried working on the data engine in August and then got stuck right around the time I started my first semester of grad school so I had to drop it, even though it got stuck in my head and I was thinking about it for weeks until the light bulb went off. I wrote my idea and just had the idea to work on it recently. I have to say that, overall, QML is pretty awesome for making a quick GUI. I’ve always struggled with GUI code, but with QML I was able to put together a quick GUI in about 20 minutes. Now, don’t judge QML too harshly because my plasmoid looks ugly. It looks ugly because I just put together the minimum GUI to implement grabbing data from my Data Engine. Once I get everything working right, I’ll fix it up. After all, GUIs are really so easy in QML that it can be the icing on the cake in the end.
Developing my first plasmoid Part 1
I have three main hobbies: photography, my webcomic and programming. After spending a year working on my 365 Project, I’ve been taking a lot less photos as that part of my brain takes a break. After working with Dan to get the story for INM worked out through May of this year and working on strips that will appear this March, I wanted to take a bit of a break from that. The one bit of code I wrote for myself that I use on a daily basis is my flickr views code.
Programming to the Rescue: Amortization Automation
What I love about programming is the instant feedback. In most programming languages, after you set up a framework for the barest bones of a program you can then run it at every step of the way to confirm that you are moving towards your goal. What I love second-most about programming is the fact that I am using my computer to solve a problem and free myself from tedium.
365 Graph
Today I worked on a python program to create a graph of the views of all my photos in my 365 Project set. Here’s the result: (click for full size)
[caption id=“attachment_2937” align=“aligncenter” width=“300” caption=“365 Project Views Graph”] [/caption]
I was curious how they stacked up and I wanted to see if I could detect any patterns. Except for a few outliers, they’re mostly below 50 views per photo. I also expected to see more views after I started adding my photos to more 365 photo groups, but this is not the case. There do appear to be clusters of views. In other words, one highly viewed photo seemed to lift the ones by it. That one huge outlier is my photo making fun of causes of the swine flu. The other big one is my Heroin Chic photo, no surprises there. It was fun to create this and I learned a new python module. Also, even though it probably took me a bit more time to program than to do it manually, it will now automatically generate whenever I want, and that’s worth the time it took.
Why there are over 2 dozen music players
People often groan when they hear of someone making another game of Tetris, Window Manager, or audio program. After all, people ask, “Do we really need another? Why can’t you just contribute to fixing annoying bug X in gTetris/KDE/xmms?” I’ve always been on the side of the argument that said - “So what! They’re doing it for free. Not only that, but they’re not getting paid for this. It’s their hobby. So you can’t tell them what to make. If they don’t WANT to help Amarok, then leave them alone. Don’t download their program and they will eventually lose interest.” I’ve never been one for telling people what they should do in their spare time. (Not in any serious sense, anyway)
Moonlight - what's the big deal?
Hardly a day goes by that I don’t see an article on Linux Today about Moonlight and what a horrible person Miguel de Icaza is. So I thought I’d go ahead and do some exploration of what’s going on with Moonlight and Silverlight. First of all, what’s Silverlight? Check out the Silverlight article on Wikipedia. Basically, Silverlight is Microsoft’s answer to Adobe’s Flash. MS is pretty peeved they haven’t been able to get people off of PDF and onto their own format. They waited way too long while the rest of us realized that PDF is great if you want to make sure that the document you create is displayed the same way on everyone’s computer regardless of the fonts they have or which version of Office they have installed. (Or if they even have office installed)
My Latest Procedural Art
More math-based art, but I really like how this came out a LOT better than my experiment with Fibonacci. Check them out!
Tight Cornell Archemedean Spiral by DJOtaku, on Flickr A really tight Archemedean Spiral featuring my photos tagged with Cornell
Portrait Archemedean Spiral by DJOtaku, on Flickr An Archemedean Spiral based on my Portrait Photos
My latest Procedural Art Experiment
I think that nearly everyone who has ever learned about the Fibonacci Sequence is fascinated by how quickly it grows. I wanted to illustrate that, so I created this collage with some modifications to J im’s makeCollage.pl script. The rules were that each picture takes the place of a number on the Fibonacci Sequence and is displayed that many times. Of course, I skipped Fibonacci number 1, which is 0. No point in having a picture show up 0 times. So the first picture is shown once, as is the second. Then two times, then three, then…..
Procedural Art
edited to add the tags I used
That collage was created by a program. I certainly don’t have the patience to arrange all of those photos one-by-one!I told the program to download all of my pictures tagged with Eric Danny David and Danielle and create this collage.
But does that make this any less of a work of art? I think the answer is no. The artwork was just created procedurally instead of visually. To argue that this is less artful is to say that the The Lion King isn’t art because the wildebeast scene was created procedurally. Of course, in this situation I don’t see myself as the artist, but the guy who wrote the program is the collage artist. It’s his procedures which created the art. His name is Jim Bumgardner and he’s a really nice guy who helped me fix up the script. I copied it from his book, Flickr Hacks, but unfortunately, as the code he relied on has changed, it didn’t work as posted. In fact, here is the fix you need in his program, makeCollage.pl :
More Flickr Hacking
Over the last two days, between playing Portal and Age of Empires III (both of which are…awesome!), I’ve been doing a little more flickr hacking. This is very closely related to my previous Flickr program where I checked if my pictures were ready to be moved into the next views groups.
This time I wanted to see which of my photos were not in any groups. So in the case that I’ve missed putting a photo into the 25 views groups because it’s a few pages back and I really don’t have time to go back through all of my photos to find the pictures to put into the groups. I tried that once and it was excrutiatingly slow - even slower than figuring out if it was time to graduate my pictures out of the views groups. So here’s the output of my current program:
Viet Zodiac Makes Top 10 on Google!
My Vietnamese Zodiac program is on the first page of Google when you search for the term! In fact, that about 24 people have come to my site looking for that from a search engine as of 29 February! That’s exciting because I know a lot of people don’t look past the first page of search results in Google.
Flickr Views Program
I forgot to post this about 1 or so weeks ago when I finsihed up the script. So here’s how the output looks on my flickr views program:
Now my next step is to put it on the web. However, the Python API I’m using doesn’t do web-based program authentication. It also doesn’t handle multiple user authentication, which I’d eventually like to do. Right now I’m thinking of porting it to Perl or PHP. I’ll keep you posted.
Hacking Flickr
So, thanks to a problem I had with rigging up Nick in " Sugar", I’ve temporarily lost interest in animation. This happens to me all the time, and I think I’ve mentioned it before in previous blog posts that I’m too lazy to look up before that I tend to gain and lose interest in my hobbies. For example, I haven’t touched the Wii since I beat Mario Galaxy during Christmas and until this recent problem with “Sugar” happened, I hadn’t done any programming in about a year. Even my interest in photography has ebbed so much that I let my subscription to Digital Camera Magazine lapse.
First GUI Program! (I think)
I’m pretty sure this is the first GUI program I’ve ever gotten to a useful state. No source code yet, as a lot of the buttons don’t work, but the basic functionality does. It’s a GTK-based RSS reader. I did it based off of code in LXF# 91. They called theirs Chomp. Since Mono is Spanish for monkey, I called mine Monkey Bites. Enjoy some screenshots.

Second Mono Project in the bag
It was another toy program, although a bit more useful than last time. It reads through a directory and recurses through subdirectories to fine all txt files and builds up a cache. Then it searches those for any text you want to search for.
Perhaps I missed a subtlety, but it appears to only search on one character searches as opposed to a whole word.
Next issue begins a real program - an RSS reader. Since I have that issue, I think I’ll do it tonight and then turn in for the night.
Hello Bill
Just tested and, yes, for the small, uncomplicated Hello World program it works just fine on Windows XP. I just had to install .NET. (It took about 10 minutes….I don’t know why)
Introducing my SECOND CGI program: Eric's BlogRoll
You can find it here or on the right-hand side under “My pages”. This is a program that’s been in my head for about four days and which I spent most of yesterday working on until I realized I was going down the wrong path. Ah, but I’m getting ahead of myself. This program is my attempt to bridge the borders which artifically divide us in the blog world, while also providing myself with a convinience. The page, if you haven’t visited it yet, displays blogs from my blogroll all on one page. Live Journal, a blogging site, allows you to do this, but only with other LJ users. Similarly, Tripod blogs allow you to do it only with other Tripod users. However, they failed to appreciate the power of hacker bloggers, such as myself.
Use Minix....create a free OS?
As we all know, Linus Torvalds created Linux out of his frustration with the lack of features in Minix, a teaching OS meant to duplicate a POSIX-compliant Unix system. Well, as a great followup to Saturday’s Post, why not check out Minux yourself? A new group has begun developing Minix3, in the hopes of getting into a niche somehwere between FreeBSD and Linux: tiny, old computers. All you will need is the VMWare Player and Minux source. Typing root at login gets you in without any passwords. Tinker with Minux3 and tinker with a bit of history. It’s not EXACTLY the version Linux used, but it’s still pretty darned cool!
Two Programming Firsts! (for me)
It took me the better part of about 2 hours to figure out how to get everything to work correctly, but I am finally done with my program, GNaughtyNice. It figures out how naughty or nice a word is by using the Google search API and searching once with the porn filter on and once with it off. You can access this great feat of programming at http://server.ericsbinaryworld.com/GNaughtyNice.html
I think it’ll probably make a pretty god party game. You also need a Google search API key because I only get 1000 searches which could get used up quite quickly if this were to become popular enough.
My first project on Freshmeat!
Frustrated with the lack of an easy way to create a video DVD on Linux, I decided to write a program to do just that! I wrote a program that will generate the dvdauthor.xml file needed to create the video DVD. Then I realized that if I had been so frustrated, perhaps others were too, so I created a project on Freshmeat.net.
Check out my project! Pydvdauthor
Yay for Monkeys!
The title of this post is, of course, a play on words. The company Ximian has developed Mono, an open source competitor to MS’s .NET. Mono is spanish (and probably latin) for monkey. The reason I’m excited is that according to Gnomedesktop.org, Fedora Core 5 will have mono! This means we’ll get great new programs being coded in Mono such as F-Spot, a photo organization program, and Beagle, an AMAZING search tool on par with the search tool in the latest Macintosh. Basically, it indexes the file system in such a way as to be able to look through not only filenames, but also tags in photos, music, and documents. Beagle even searches through AIM logs created by Kopete and Gaim. But the COOLEST thing is that, unlike the search in Windows which takes forever, this is instantaneous since it’s always indexing your computer. In fact, there are demos you can see by clicking on the beagle link on the right-hand side of my blog, that show a search being conducted and as the author write stuff in his IMs, it appears in the search. I can’t wait for this to be available to us Fedora users!
My Monty Hall PHP Script
Well, actually, it’s not mine. It was a script in Linux Format Magazine a few issues ago. As hobbyists have done since the beginning, I copied the code down to see it actually work.
First the background on Monty Hall. Here it is from Wikipedia.com:
The Monty Hall problem is a puzzle in game theory involving probability that is loosely based on the American game show Let’s Make a Deal. The name comes from the show’s host, Monty Hall. In this puzzle a player is shown three closed doors; behind one is a car, and behind each of the other two is a goat. The player is allowed to open one door, and will win whatever is behind the door. However, after the player selects a door but before opening it, the game host (who knows what’s behind the doors) must open another door, revealing a goat. The host then must offer the player an option to switch to the other closed door. Does switching improve the player’s chance of winning the car? The answer is yes — switching results in the chances of winning the car improving from 1/3 to 2/3.
Bash Shell Scripting
One of the best things about Linux is the ability to write shell scripts. These are most often used as utility programs to do repetitive tasks for you. I just wrote my first one on Sunday and here it is followed by commentary.
#!/bin/bash echo "starting xchat..." xchat& echo "starting Gaim..." gaim& echo "starting Thunderbird..." thunderbird& echo "starting Gkrellm (docked)..." gkrellm -w& echo "starting 2 instances of Eterm (transparent, no buttonbar, no scrollbar)" Eterm -x --scrollbar=0 --buttonbar=0 --trans& Eterm -x --scrollbar=0 --buttonbar=0 --trans&
Two down....three to go
Today I finished up yet another class. The first one I finished up was a project where I was conducted a study for the School of Electrical Engineering to switch over to Linux and open source alternatives. I also published my study as my first publication at Lulu.com. It was great to have one class out of the way, especially one which was such a joy to participate in.
Today I wrapped up another favorite class, microcontroller design. As my faithful readers know, I’ve been providing the source code to each of the labs we completed during the semester. Well, today my group demoed our final project to our professor and TA. They were quite impressed with the progress we had made on the code, despite its limitations. Our final project, a web server on a microcontroller, was a lot of fun to work on. There were a lot of frustrating times, but it’s the good kind of frustration that motivates one to try as hard as they can to get around the problem. One of my favorite taks is to participate in design and debugging, trying to get my design to work because I know it *should* be working, so what did I forget? Was it simply a semi-colon? Was it something more significant, some kind of oversight? It was hard sticking to the project and keeping Rich from rewriting it from scratch, but I think we had a much better product because we sat through all of our problems and figured out what the original author of the source code we were basing it off of had done. After all, in a real work environment you have to figure what the previous guy did. There is no time to rewrite the code, no matter how awesome you are at coding. I will be posting the code and my report soon, probably over the next few days. I invite and challenge anyone out there to work on the code and make it more robust and reliable, there is PLENTY of room for that. You just need an Atmel Mega32 and STK500 development board. (As well as the computer on which one does the programming)
More Atmel Code available!
I have posted the latest code from the work Rich and I have done for our microcontroller class at Cornell. We are releasing all of our code under the GPL license so feel free to use it, modify it, and have fun with it. The code is modified C code and assembly language for the Atmel Mega32 chip running on an STK500 board. It should be easily available from Atmel or perhaps your local electronic hobbyist shop.
A few updates and notes
If you go to my main page, you can see where I have added a new section, C code from a class I’m taking this semester. We’re making a lot of really cool designs based upon the Atmel CPU, which is readily available for those who like to tinker. I’ve put up my first project, a reaction time tester. It has the user push a button, waits approximately two seconds plus a random amount to keep the user from guessing, and then displays the user’s reaction time. It also keeps the user from cheating by detecting if they are holding the button down.