Notes

Thursday is somewhat more fun when you take off Wednesday πŸ˜€

Nice morning, I would have probably ridden in had I had my lock and wasn’t bringing my laptop back into the office.

That sun β˜€οΈ is nice streaming in through the bus 🚍 windows. All night into the morning I was feeling a bit achy and I didn’t sleep well πŸ’€ for no reason in particular, maybe it was the screen time I spent into the evening at the library. Honest I wasn’t abusing caffeine β˜• yesterday, just had my usual percolator pot of coffee and none of caffeine pills or the office coffee. I’ve been having some issues with the jitters lately plus I didn’t want to get so jacked up while my big jacked up truck was getting inspected. πŸ›»πŸ”

I was noticing in a picture of my bike 🚲 I took on Saturday that my lock πŸ”’ was missing so that cuts the search πŸ” area down on Saturday. I plan to get out and look early Saturday morning. Going to be cool but by then it looks the rail trail should be mostly free of ice. ⛸️ Riding in this morning probably still would have meant hitting some ice, though probably not the rough crap I was riding on day. I actually think I remember taking the lock off and putting it in the basket which probably means it’s at home, 🧺or maybe in my truck. If not, if I need to replace it’s I’m just going to go with a heavy security chain and a standard lock – I don’t park downtown any more and I’m less worried about theft at my suburban office where the bike rack is clearly visible to security.

Glad my car inspection is done. πŸ˜€ No costly mandated repairs required at least right away. πŸ”§ They didn’t flag anything at all. It’s good, I should now be able to get away at least after Christmas, though I’m also thinking I might do a day trip or an overnight before Christmas. I am going to take off the week after Christmas, I’m considering going out to the Finger Lakes but I’m not fully decided on that point. It’s kind of a long trip, and thw weather can be dicey this time of year.

No SQL Databases

If you ask me, I tend to think No SQL is a lot of hype – no relational databases as they are called are old as computing and data structures, and are the kind of thing you learn about in an elementary data structures class in college where they teach you about things like C structs and pointers. Key value stores aka hash tables are basic components   of most modern programming languages like Python, R and C++.

It’s not to say that the don’t have a roll – indeed many implementations of such data structures are much faster, secure and efficient than any one person could construct with a few lines of C code. But revolutionary? Worth the hype? No. No SQL isn’t going to replace SQL and relational databases anytime soon.

Code, Code, Code

If you want to be good at something, you have to constantly do it, practice.

One of the reasons I’ve not been as much blogging lately is because I’ve been spending so much time studying C/C++ coding, along with some Rust programming, along with other supporting languages like DuckDB and SQL. A lot of it is just watching videos and reading, though I know the thing I have to do more is sit down and write actual code. The problem is that C/C++ doesn’t provide a natural path for developing content for the blog, and that many of the projects I can up with in C aren’t obvious what to turn them into actual products. Part of it is finding libraries that are useful, and using them to generate good interesting content.

R is my usual standby, but I know while R is handy for coding, and I like many things about that language, it’s no C/C++ when it comes to writing professional software, building things made to last. R is great for quick one-offs, the kind of throwaway content for the blog, but it’s not as great for things you are building to last for decade, or run quickly in a production environment. But between my personal use of R and at work, it’s such powerful tool.

A Bash Script for Geocoding Addresses in New York State

If you are on your typical Linux or Unix server you probably have everything you need to run this script such as cURL and sed, except for possibly for jq which was on my home computer but has no dependencies and can be easily installed on most Unix servers by just compiling the source code.

#!/bin/bash
url="https://gisservices.its.ny.gov/arcgis/rest/services/Locators/Street_and_Address_Composite/GeocodeServer/geocodeAddresses"

query=''
i=1
while read -r LINE; do
	LINE=$(echo $LINE | sed -e 's/"//g')

	if [ $i -ne 1 ]; then query+=","; fi

	query+=$(printf "{ \"attributes\": { \"OBJECTID\": %s, " $i)
	query+=$(printf "\"SINGLELINE\": \"%s\" } }\n" "$LINE")

	if [ $i -eq 1000 ]; then 
		query="{\"records\": [ ${query} ] }"

		curl -s -F f=pjson -F outSR=32768 -F addresses="$query" $url |
			jq --raw-output '.locations |= sort_by(.attributes.ResultID) | .locations[] | [.address, .score, .attributes.Match_addr, .attributes.ResultID, .location.x, .location.y ] | @csv'
		i=1
		query=''
	fi 
	
	((i++))
done < /dev/stdin

# handle remaining records
query="{\"records\": [ ${query} ] }"
curl -s -F f=pjson -F outSR=32768 -F addresses="$query" $url |
	jq --raw-output '.locations |= sort_by(.attributes.ResultID) | .locations[] | [.address, .score, .attributes.Match_addr, .attributes.ResultID, .location.x, .location.y ] | @csv'