Programming

I’m constantly amazed at what a beautiful piece of software Kubernetes is, but my god it has some annoying things about it. For instance when you ask for a list of events, it gives them back in random order.

I am trying to write a piece of a script that gets events from the last N minutes. I thought it’d be easy but it’s surprisingly annoying.

3 hours chasing down a really severe bug in a script, that I discovered because I tried to add a variable assignment and an echo to it. Literally like 3 lines that shouldn’t have broken anything and the script imploded.

My boss wrote the script and it turns out the root cause was because he declares all his variables as global scope instead of function scope and the variable i had named broke two other functions that also had that variable.

He wrote our style guide and insists we always use local variables in bash scripts, which is good practice. Unless he writes one.

Now I gotta figure out a delicate way to tell him this script is terrible and probably needs to be entirely refactored which will take me a week…

1 Like

lol I broke the news.

my boss, king of the backhanded compliment: “I just want to tell you that you’re not the smartest, brightest, or fastest person I have ever worked with, but you by far have the best attitude and are the most positive of anyone I’ve worked with”

So I guess I have that going for me .

5 Likes

We’ve got one asshole at my work that tries to blame people when they fuck up. Gets real old quick

And jmakinboss sounds like a complete jackass

Tech bro’s, I would appreciate your informed opinions here:

It’s a bit outside my area of expertise but it seems plausible to me. I guess one thing I’d ask is if you know for sure that Redis is the bottleneck. Also, do you have easy options for scaling that up before election day?

OK here’s one. We have our “services” that is a collection of rest endpoints mostly, simple get info from db return json as usual. The top end webserver proxies to the services.

I was tasked with creating a “tinyurl” style feature i.e. a user hits a button on a page it makes a request to services, generates a random small string, saves it in the DB, returns the string to the UI.

Now what do we do with the get request for that tinyurl? There’s a bunch of options here:

  • Have the UI do a loading state while it sends an ajax request to the proxy then to the services then does a JS redirect when it comes back.

  • Have the proxy handle that and hang the UI while it waits for the services to come back then respond with the 302.

  • Have the proxy just send the info directly to the services and have the services return the 302 itself.

No one seems to know best practices here, thoughts?

A loading state for redirecting the user off the page seems weird.

If you can hit services directly, why do you have a proxy at all? And how could a proxy “send info directly”, then hand off to the services?

I guess I don’t understand the difference between 2 and 3.

Ok I guess your webserver can process the response from the service, do something, then respond to the browser with its own response - OR - it can just pass through the response to the browser? That seems like it should be however your architecture is already set up. If pass through is ok - then #3 is probably ok? Assuming I’m understanding it correctly.

In either case the browser is waiting until it gets the 302.

Yeah I don’t like #1 at all.

You can’t hit the services directly i.e. /foo hits our webserver/proxy and then an express route will proxy it to https://services/foo, but I can modify/do stuff to that route.

I originally suggested #3. Reason I bring this up is the services lead guy doesn’t like it. He doesn’t want services doing “UI logic” by sending a redirect. But every other option seems shittier. #3 is the only one doing 1 http request, others all do 2. Though technically any 302 is going to redirect to something that 200s… IDK.

#2 seems fine then - it will be the exact same from the browser’s POV.

I agree with the services guy that the service just returning a tinyurl and not worrying about stuff like 302 makes sense - if the services don’t do that in other cases.

A layer of “dumb” services that just do one simple thing is a good paradigm imo. In the future you might want to just show the tiny url as a link the user can copy. Or maybe the 302 doesn’t work for some reason and you need to do the JS redirect. In either case if you designed your service to return a 302, you’d have to make a new service or give it an alternate use case.

Lol he kind of is. I’ve been writing a script according to his exact specs that gathers kubectl data into snapshots of very large clusters over a certain time period, writes the results to a file, and uploads it to a site I built. I built it out to his exact specs and it’s nothing super fancy, literally just basic html and formatted text inside of <pre> tags because I believe it’s really bad practice to write html pages manually in a bash script so I insisted on keeping it simple.

Privately he tells me it looks great, then in our team chat he links the finished site and says it looks really ugly. Lmao. I’m as backend of an engineer as it gets. If you want a pretty website go bother one of the frontend guys.

But, he did tell me privately today that I’m becoming “quite proficient” at bash scripting so I guess I need to take that as high praise.

I’ve had worse bosses though. He doesn’t typically ride my ass and is pretty lenient, and I am sometimes a slacker, so it is working for me.

1 Like

You must have had some really shitty bosses. Man I could never work for someone who criticizes my work in front of the rest of the team, or directly insults me.

1 Like

I’m getting paid way beyond my experience level so it’s kind of just one of those things where I’ll put up with a lot making this kind of money

But yes i’ve had some brutal bosses

I know this is correct but I much prefer staying in one place until there are no more challenges or anything to learn. I could see myself being with this company for a while - from the fact I got a raise while here for only 6 months, I think they are willing to be competitive on salary if it means retaining good people.

I don’t know what will happen, but I was with my first company for nearly 15 years. I don’t quite want to do that again but 5 seems definitely possible. This company definitely took a chance on me and I feel very grateful for the opportunity. It is huge for me.

Basically as long as I’m not stagnating or miserable I prefer to stay in one place.

That’s a good site.

Lmaaooooo I just got the funniest email. There was this company I did some contract work for, but bailed on them because they were getting shady about paying me. They said they’d only pay me if they used what I wrote and then I wrote this UPS package tracker program that collected UPS info and uploaded to their DB.

Well, I never got paid and months went by and they seemed like a clown fiesta so I quit in the nicest way I could, with no fuss about paying me because it was only like $500-1000 and that’s an amount low enough I won’t go to war over.

Well I was using a UPS API key tied to my personal email for testing purposes and that key was inside of the program I submitted to them. I just got an email from UPS saying that my account is in violation of their API usage guidelines and will be disabled if it continues.

Do I tell them? The vindictive part of me is like hell nah but my professional pride is like, well, I don’t want them thinking I wrote something that doesn’t work.

It’s funny to me because they’re clearly using it, and using it in a way I specifically warned them not to because of this exact scenario.

lol no are you kidding

If prompted I’d tell them the new key is “EMYAPUOYKCUF” and when they say it doesn’t work ask them to reverse the letters

2 Likes

One of my biggest weaknesses is I am not very motivated by money. I was like welp lesson learned always get paid up front or get it in writing and chalked it up to that. There’s not really any hard feelings other than I am professionally irritated they’re using my script in a way it was not written to be used.

I just realized I could break all their shit by disabling my account.

Of course disable the API key. Also send them an email saying you know they were using it and if they want to continue using it they owe you money for past work and an up front charge to re-enable your script.

I’m not particularly motivated by money at this point either. But it’s important that people pay you what you’re worth. Because too often letting them pay you less actually makes them value you less. People are messed up.

And if you really don’t want it, donate it. Then the effort you put in isn’t about you getting more - it’s about doing good in the world.

2 Likes

C++ question

This is for some homework that nanodaughter has. It must have been something the prof said in lecture that was missed.

“Has modern C++ provided any new features to alleviate problems associated with dynamic and/or stack allocated memory?” (generally talking about arrays)

I don’t know what is considered modern, but the class requires C++ 11.

??

I think it’s pronounced “Rust”

2 Likes