Behind the Scenes

Going to need a bigger boat.

Posted on

I was planning to do a follow-up post with my list of projects from Evernote. That would be easier said than done. The attached image shows some, but not all of my lists. Instead of overwhelming you with all of this nonsense. I’m going to dig in on my own and pick a few to expand on. Also, there are probably quite a few items on here that aren’t even going to make sense to me. This will be a good culling exercise.

In the meantime, I was trying to come up with a Python script for playing Spider Solitaire. I play on my iPad and I’m usually pretty good at solving the puzzles (up to three suits). When I get stuck, though, it really feels like I’m spinning my wheels. I don’t know if I want to calculate the probability of a given move being useful, or maybe just keep track of the choices I’ve made so I don’t make the same ones again? Or maybe this isn’t a problem that lends itself to Python. I’m sure I can find something better to do.

Behind the Scenes

New Project: Conversational Python

Posted on

As I’m trying to learn Python, I try to go to coding Meetups and other events. When I go, however, I’m hit with so many things that I don’t understand that people are discussing so casually. It makes me feel like I’ll never get there. Meanwhile, the coding books and tutorials move so slowly and helpfully through the fundamentals that I fear the two will never meet up.
For that reason, I’m making a point of writing down and looking into any concept that I don’t get. The plan is to build an e-learning module to go along with a code-learning plan, but it’s also for me.

My first real attempt was today. I listened to the first half of Talk Python to Me Ep. #153 with Nick Coghlan. Every time I started to get lost, I paused the feed and wrote down what I didn’t understand. Often phonetically.

The following partial glossary is just from the first half of the podcast. Maybe I will get to the rest tomorrow.

My messy notes

PEP: Python Enhancement Protocol

wire protocol structure using destruct(?) module to construct messages to send them back and forth.

ordinary squelchers don’t work in HF. Have to do signal analysis to detect voice.
Squelcher: An electric circuit that cuts off a radio receiver when the signal is too weak for reception of anything but noise.

C Programming for the DSP but we didn’t have a proper test harness; just a C application
DSP: Digital Signal Processing

next level of integration testing

control and orchestration language

Python unit test module

I-fall(?) [extreme programming; test driven development]

It’s Dave Beazley’s fault… SWIG existed. C++ driver ran on host. Used to talk to DSPs.
SWIG: a tool for building C/C++ extensions to Python.

Wrote one .i file for SWIG to wrap the production driver

Can express more simply in Python code than in production code. Tests in Python express your intent, then it doesn’t matter what your production code is.

Open source supply chain managment

Anything it didn’t do, I just added a library. Doing a lot with CORBA distributed communication protocol.

request brokers: In distributed computing, an object request broker (ORB) is a middleware which allows program calls to be made from one computer to another via a computer network, providing location transparency through remote procedure calls.

Used for test automation, hardware simulators, web app dev dating from the CGI days – which is actually how we wrote the original distributed system orchestration. Which you now mostly see in things like Ansible and Salt and Python wrappers around Docker and Kubernetes.

Micro controller code where your Python program almost is the operating system – wire your lambda expressions directly to hardware interrupts.

Origins in ABC research language (to teach people to think computationally). Base layer of imperative procedural programming (how humans think; doesn’t scale)

privileged access

interpreter can do things that ordinary python code can’t.

syntactic sugar – make sure there’s a procedural equivalent

Web frameworks, gui libraries, scientific stacks

Ansible: Python had been part of Linux distributions almost from the beginning. So sys admins started doing admin scripting.

Procedural model; move to declarative model further up the stack

random forest

deep learning

sql alchemy (watch talks about its design)

In computer architecture, cache coherence is the uniformity of shared resource data that ends up stored in multiple local caches.

Tcl/Tk: Tcl is the short form for ‘Tool Command Language’ and Tcl Tk is the term used for referring to the toolkit available for this programming language.

GNOME: a desktop environment composed of free and open-source software that runs on Linux and most BSD derivatives

AIX (Advanced Interactive eXecutive, pronounced /ˌeɪaɪˈɛks/[3]) is a series of proprietary Unix operating systems developed and sold by IBM for several of its computer platforms.

PIP

Sourceforge

IDLE (in standard library)

QT as a C++ wrapper tried to use native widgets when it could

GTK emerging as way Linux distros would do desktop

Microsoft Foundation Class Library (MFC) is a C++ object-oriented library for developing desktop applications for Windows.

WX Python, WX Widgets, PY QT

Unresolved fight between QT and GTK on Linux

GTK’s efforts to support anything cross-platform isn’t really a thing. Linux/Unix equivalent of Win32 API. Not really cross-platform because it doesn’t delegate to platform-native stuff when you’re running someplace other than Linux. And that (native widgets) is what it takes to make your app look like it belongs.

(tuned out for a bit here)

Android on Dalvik layer (of Linux)… Java Runtime?

Electron JS, Cordova, Ionic, all the other frameworks

Phoenix Project, WX Python 4.0.

(halfway through at this point and enough to be going on with)

 

Behind the Scenes

Shawl Math

Posted on

I had a phone call with a potential employer the other day and I found myself trying to explain one of the ways that I use my mathematical and forecasting skills in a situation where someone else might not recognize the opportunity. They make perfect sense in my head, but sound a little bit rambling when I try to explain them. Putting these instances in writing, with examples and diagrams, can only help. The example that came up on the phone was from my time with Mochimochi Land, and I’ll cover that in a future post. Today, I’ll stick to something more current.

I recently started knitting the Nurmilintu shawl out of some beautiful gradient yarn. The wedge shaped shawl alternates between solid garter stitch and panels of lace. When I finished the first garter section, I still had quite a bit of yarn left. In general, that’s a good thing, as it’s better to have too much yarn than not enough. In this case, however, failing to use all of the yarn would mean not using what I considered to be the prettiest color at the end of the gradient. So, last night, after finishing the first section, I stopped, weighed my yarn, and made adjustments using a Google spreadsheet. (I miss Microsoft Excel, but can’t justify the expense.)

The first step was to count the stitches in the shawl. It starts with a cast-on of four stitches. On odd rows, there’s an increase at the beginning of the row and a decrease at the end. The stitch count doesn’t change. On even rows, there’s only the increase at the end of the row and the stitch count increases by one. So, every pair of rows, the stitch count increases by one. The instructions are to repeat these rows until there are 79 stitches. 75 repeats (150 rows) will accomplish this. Using the geometric formula for the area of a trapezoid, the total number of stitches is:

(150 rows) * (4 stitches + 79 stitches) / 2 = 6,225

Making the same calculations for each section, I ended up with a total of 20,720 stitches. So, the first section of the shawl represents 30% of the stitches. Weighing what was left of my 100g skein of yarn, I found that it was only 25% used up.

My first thought was to add an additional section, as suggested by the pattern. I was able to try this out on paper. Each garter section after the first is 36 rows long (+18 stitches) and each lace section is 18 rows (+9 stitches). This would increase the total to 29,225 stitches and that would mean that I was only 21% through the pattern with 25% of my yarn gone. So, not an option. Instead, it made sense to increase each section.

If my first section (6,225 stitches) took 25g of yarn, then 100g of yarn should get me 24,900 stitches. I set my calculations up in a spreadsheet, multiplying each row length by the same factor and then adjusting that number to get close to 24,900.

  • First of all, I added two more rows at the end to account for binding off the stitches. Three might make more sense, as it’s important to bind off a lace project very loosely.
  • Secondly, while the garter sections can be any length, the lace sections need to follow a chart. This limits them to a repeat of six rows.

If I needed these calculations to be more robust – for example if this blog post results in a lot of knitters asking me to make custom pattern adjustments – I would set this up with a bit of code and/or formulas. As I only needed this answer once, the sheet is set up to require a little trial and error on my part to get to the optimal number. Once I knew that the adjustment would be small, I hard-coded the number of lace rows at 18 and then recalculated the adjustment for the garter rows only. When I was happy with the closeness of my number, I replaced the calculated row counts with the next-lowest even integer.

It’s also important to remember that knitting is pretty variable in practice and the amount of yarn I’m using can vary. For this reason, I tried to keep the estimated stitch total well under 24,900. I also calculated how much yarn should be left in the skein at the end of each garter section. That way, I can check and adjust my estimates as the project continues, and I’ll be more likely to succeed in using all of the blue yarn without running out.

Works In Progress

External Motivation for the win! (Weather Project, Day 1)

Posted on

I ran across a really appealing job posting today. Among other things, however, it requires a writing sample. My technical writing skills have always been pretty solid, but it’s been some time since I’ve had to write anything. And most of my writing was so full of confidential information that it wouldn’t be of use even if it was current.
I decided that the best way to generate some current, relevant writing is to start a new project. I have lots of ideas I’d like to explore, but I’m going to keep it simple and do a study of the weather.
The idea I’ll be exploring is that Chicago doesn’t have much of a fall and spring. It’s something that we say all the time around here, but how true is it? How much Confirmation Bias is actually at play? I mean, nobody makes this complaint on a seventy degree day.

ChTemp
The first thing I need to do is to find a database. This is all the more reason to start with a weather-related project. There’s plenty of information out there for the taking. NOAA has data at surprising amounts of granularity. That’s where I plan to start.
In the past, I’ve done most of my analysis in spreadsheets, but that’s not going to cut it here. I tried to import just one year of NOAA data into Google Sheets and it wouldn’t even open. It’s time to move on to something real. I’ve done a great deal of SQL training, but I have yet to put it into practice. I’m downloading PostgresSQL and doing a quick training session to learn how it ticks, then I should be able to at least begin my analysis in there.
Beyond the technical aspects of the project, I need to spend some time defining my project. When I say that Chicago doesn’t have Spring and Fall, I’m not talking about the calendar or the position of the sun in the sky. What I’m saying is that it feels like we go directly from cold weather to hot weather and back to cold without many days in between. How am I defining cold? How am I defining hot? These are subjective measures. There are some who consider fifty-five to be downright balmy and others who need a jacket as soon as it drops below seventy.
Once I’ve defined my temperature range, do I count a day as spring- (or fall-) appropriate if the day’s mean temperature is in range? Or do the high and low need to be in that range as well? Is a chilly morning enough to disqualify an otherwise perfect spring day?
Finally, how many good days is enough to feel as though we’ve had our smooth, seasonal transition? Three full months would be the ideal, but that might be a bit inflexible. Is there an acceptable number, or should I be comparing to the seasonal transitions of other cities? Nearby cities? Cities known for their stable, clement weather?
Additionally, even though it’s not directly part of this question, it might be interesting to compare contemporary results to those of 10, 20, or more years ago. Just in case people are nostalgic for the seasons of their youth.
I plan to get my database up and running first, so I can dig into the NOAA databases and see what I have to work with before I finish designing my questions. I’ll keep posting here as I fine tune things.