Programming or How to Exit Vi Without Rebooting

another fkn major cloudflare outage…….

my consulting projects are causing me to write more python than I normally otherwise would lately and I fucking hate duck typing and this overly prettified language. it’s fucking official. it’s a me problem, I know, but some stuff is so fucking difficult for my C/linux/shell/static typing brain to wrap itself around.

like, say in C, you are trying to reference some field in a struct. you may do something like:

(pseudocode)
if (struct_) { // do something }

if struct is a null pointer, you skip over this, because otherwise crappy things happen in most languages. this makes sense to me.

well, consider this python:

body = {}
if body:
  print(“python is cool”)
print(“python is idiotic”)

this doesnt enter the if clause! wtf! To my C brain, this is a fully instantiated object reference that is definitely not null, it’s just empty. If I wanted to check if it was empty, I’d fucking do that! but no, python galaxy brains decide this is more “readable.” to me it really isn’t, and I’m struggling mightily with this kind of thing everywhere. To get the desired effect, the line is instead “if body is not None” which, I guess is more readable? goofy as shit.

Yeah, what you’re describing is the concept of an object being “falsy” that mostly doesn’t exist in C. I struggled with this a little too when first using languages like Python or JS (which works similarly) but in general I think it’s good, one you get past the hurdle that a reference can be both non-null and false. The melding of the “null” and “empty” states are, I think, somewhat useful shorthand for determining whether an object is, like, interesting or more specifically holds data; oftentimes, I think specifically wanting to know if an object is non-null but maybe empty is actually kind of an edge case, so it make sense that the language makes the common case (“does this have data?”) more accessible/succinct than the less common case (“does this exist?”).

2 Likes

Yea I just have to remember that if len() == 0 it will be falsy I guess. lol me, I shouldn’t be struggling so much with this, but then I realized Ive mostly worked with statically typed languages like C/C++/Java that dont really do this type of thing as often.

My friend asked me “well why are you comfortable in bash and that doesnt have static types” well yea, but almost everything in bash is a string, and if you need data manipulation, you’re probably not doing it in bash.

14 years until the 2038 problem, I just realized. I better have retired by then.

1 Like

Anyone using Playwright and Python for scraping? Trying to figure out how to attach to a remote debug session and then convert to running headless. May not be possible. Need to convert to an active Chrome session to take advantage of stored auth tokens so I don’t have to do any auth in the code. The rest is just trying to automate some tests we run on our portal.

lol this will make anyone here feel like a rockstar at their job

image

*rainbow text*
You will not be able to get this code again

How does that get into production? Did they start the company hiring 'C’s?

I mean it’s a huge amount of words to say idiot company exposed an endpoint that returned the entire User table.

this can’t be that big of a deal because literally nobody uses spoutible

1 Like

I’m about to upgrade (currently have the last-gen intel macbook pro), I’m thinking that I might actually go full-time ipad, has anyone else done this? The main hesitations in the past have been 1) docker (this really doesn’t concern me because running docker on mac has always been a bit of a hack anyway and I never really need access to docker in a situation where I wouldn’t also have access to infinite EC2 instances) and 2) using external display/keyboard/trackpad at home. With the new USB-C ipads this seems to be less of an issue? Keyboard and trackpad are solved (I use a wired USB mechanical keyboard and bluetooth touchpad), so the only issue really is the external display. How is the experience using ipad with a big 4k monitor?

FWIW my dad has completely moved from laptop to ipad, he has a 10th gen ipad with the “magic keyboard folio” and I have to say I was pretty impressed with the experience, it was way better than I expected and I would guess it’s even better with the ipad pro + magic keyboard (may go by the apple store and try it out today)

worth noting that the motivator moving me towards the ipad would be portability (I used to log 150k+ miles/year traveling, last year was more like 75k but I think it’s trending up again this year)

I suppose it all depends on what you need to on the device vs what you’re doing on a remote machine. I’ve seen a couple of good terminal emulators so that might not be a problem. Don’t know about docker, but I’d be surprised if it was as good as a Mac because the oses are so different. That much traveling you should get a Vision Pro demo while you’re at the Apple Store. If you can live on an iPad it should all run on the vision, eventually. At the moment you can’t mirror an iPad, only computers.

the terminal definitely isn’t an issue, I’ve used a couple of emulators that are fine (the real issue with these is mostly if you try to use the on-screen keyboard).

there’s currently no way that I know of to use docker directly on ipad (seems Apple is really determined to prevent anything vm-like on iOS) but that’s not really a blocker for me.

also 0% chance I’m getting a vision pro

1 Like

what really doesn’t make sense is why an iphone 15 costs more than an ipad pro

I’m not sure they’ve rationalized their prices across products as well as they have within products, but shouldn’t the new iPhone have a better chip and better screen?

iPad Pro has the same chip and screen as MacBook pros

1 Like

1 Like

I don’t think I’ve ever seen a “stop using your computer immediately” advisory before

this is insanely bad, luckily this was spotted while it was still extremely bleeding edge, I would guess the number of people who have this deployed in production is single digits, the attack itself seems to be a really long con (someone slipped a backdoor into an open source component, he’s been contributing to this project for 2+ years).

3 Likes