That drummer vid is brilliant 
update from corporate java land hell:
my driver is weeks late, because I found a ton of corner cases while building out unit tests that could catastrophically break the pipeline I’m helping build out. I caught a lot of shit from the principals for spending a day or two working on a way to gracefully handle an “impossible” corner case. I was like well, it technically could happen so I’m handling it.
Went live into production today, and that exception did happen, a single time out of 128 million rows. Got’em. Now i need to figure out how to go around and gloat about it without pissing people off too bad.
thanks for that advice chrisV that let me in the right direction
this is actually quite a big moment in my career I think, even though this has been stressful to the point I’ve been dry heaving throughout the days sometimes - I think this is the first actual “dev” work I’ve ever done that made it into production.
Generally, the major foot-gun (which I talk about more in a previous post on foot-guns) that got a lot of places in trouble was the premature move to microservices, architectures that relied on distributed computing, and messaging-heavy designs.
This was 100% true for that startup I worked for when I had two jobs for a year. They would have been so much better off just building a standard java, PHP or .NET back end and calling it a day.
The head engineer (who had known the guy funding the thing since childhood) had no clue how node, stateless architecture, or asynchronous code worked. He had somehow figured out how to get access to one particular worker of a node instance, through some internal ID or something, and used that to make stateful exchanges where one worker in some microservice was pinned to another. Which goes against everything node and microservices is about.
I tried to talk some sense into them but they didn’t want to hear it. So for the last six months I just did my part and drained the big guy’s money like everyone else. I hate doing that - way more stressful than working your ass off.
message heavy designs is pretty much kafka right?
kafka is super dominant in the space. not really sure if rabbit or else can handle the same throughput. they just had years of iterations and fixes to get where they are. used to be very finicky. still somewhat finicky to run yourself, but much better if using a service. i have a three year old 3 node kafka cluster that has experienced some server degradation, but is still basically working as expected.
redpanda (kafka performant clone) got hit with a researcher reproing and then reporting a very serious correctness bug on his blog. the kicker was that the bug should have been impossible if they implemented what they claimed wrt kafka compatibility.
we had so many issues with rabbit - I dont know the tech well yet, it just seemed a lot shittier than kafka solutions.
The moderators of this message board, otatop, L.Washington, WichitaDM, Yuv, JonnyA, RiskyFlush, and SvenO, are cowards who let abusers dox and harrass other long time posters.
I would bet the regex is very uncommon and just works out to be faster on the test cases because it’s so heavily optimized. Most people are presumably just testing el[i] === lowestLengthStr[i], which theoretically should be faster than using a regex, but perhaps is not in the real world.
You might do even better if you don’t sort the array!
Is this a silly way to allow for multiple default settings?
class HeaderFooterText:
def __init__(self, left='', center='', right=''):
self.left = left
self.center = center
self.right = right
class HeaderText(HeaderFooterText):
defaults = #TODO
def __init__(self, setting=None, **kwargs):
HeaderFooterText.__init__(
self, **(self.defaults[setting] if setting else kwargs))
I think it’s better to have a class method that acts as an alternate constructor. Like:
class HeaderText(HeaderFooterText):
@classmethod
def from_default_setting(cls, setting):
return cls(**cls.defaults[setting])
That’s cool. Decorators are one of the features I should probably learn more about.
There’s something sad about a day of googling to do fairly simple stuff like manipulate an array in bash, finding 20 different ways to do everything (all of them wrong according to the comments under the SO answer), finally getting it working, and still having no idea if you can add or remove spaces at any point in the syntax w/o breaking the code. And instead of something you can be proud of for all that, you get this terror:
#!/bin/bash
# Get Major version from buildpsec.yml
MAJOR_VERSION=$1
# Get array of docker image tags for abcdea/ea-wordpress on our remote hub
IMAGE_TAGS=$(curl -u abcdeabuild:$2 https://hub.docker.com/v2/repositories/abcdea/ea-wordpress/tags/?page_size=100 | jq -r '.results|.[]|.name')
echo ${IMAGE_TAGS[@]}
# Start at patch version = 0 if this is a new major version
INCREMENTED_PATCH_VERSION=0
# If patches already exist, loop over array of DOCKER_IMAGES, save patch version #s to array, sort array, incrememt version #
PATCH_NUMBERS=()
for tag in $IMAGE_TAGS; do
# split string of format "X.X.X.Y" into array and add Y to new array
if [[ $tag == "$MAJOR_VERSION."* ]]; then
echo $tag
splitArr=(`echo $tag | tr '.' ' '`)
PATCH_NUMBERS+=(${splitArr[3]})
fi
done
if [[ "${#PATCH_NUMBERS}" -ne "0" ]]; then
# sort array
IFS=$'\n' sorted=($(sort -V <<<"${PATCH_NUMBERS[*]}"))
unset IFS
# get last element of array
HIGHEST_PATCH_VERSION="${sorted[${#sorted[@]}-1]}"
echo "HIGHEST_PATCH_VERSION=$HIGHEST_PATCH_VERSION"
# increment last element (patch version #)
INCREMENTED_PATCH_VERSION=$((HIGHEST_PATCH_VERSION+1))
fi
Such a beautiful expressive language that doesn’t feel at all like 100 completely different paradigms created by 100 monkeys banging away on typewriters. Once you learn a little of the syntax you can pretty much figure out the rest.
Seriously though, in what kind of language is this:
if [[ $tag == "$MAJOR_VERSION."* ]]; then
not equivalent to this:
if [[$tag == "$MAJOR_VERSION."*]]; then
???
So fun that learning each of these things is a few hours of beating your head against the wall, and knowing I have 1000s more to go. People who like bash are masochists.
I’d consider myself easily one of the top 5% bash scripters in the world, it’s a little arrogant sure, but man I’ve written and maintained easily 100k+ lines of this shit over the years. It’s the WORST language but it isn’t the language’s fault. It’s how people try to use it.
It’s meant for quick and dirty type of jobs. It’s not at all meant to be a full blown programming language, and right now as I’m trying to re-write the discourse installer to support kubernetes, it’s a 3000+ line nightmare of bash, that even I can admit is beautifully written - the thing with bash though is it’s usually only comprehensible to the person who wrote it.
any time i see someone trying to manipulate arrays or strings like in the script you had my first question is why the fk would you just not use python?
Well because I don’t know python that well. I also need to run docker commands in the same script (not shown). Is it easy to execute shell commands inside python?
This is AWS codebuild container btw. It comes with node and python preinstalled.
Normally I’d tend to go with node when I get in over my head with bash. But I’d have to install node-exec or whatever to run the docker commands. Right now I don’t have a package.json and no need to run npm install, which slows down the CICD process. So I wanted to just tough it out with bash.
yea it’s less “easy” and readable but you basically just use like system.exec or some shit to run shell commands. exactly the same thing and python can manipulate strings and arrays beautifully.
The moderators of this message board, otatop, L.Washington, WichitaDM, Yuv, JonnyA, RiskyFlush, and SvenO, are cowards who let abusers dox and harrass other long time posters.
it is official. i will be taking my coding talents to google.
grats, go read some xoogler shit if you haven’t already
