@jeff@phpc.social
@jeff@phpc.social avatar

jeff

@jeff@phpc.social

Founder & Software Architect @ Cerb.ai for 22 years, building web-based coding tools for enterprise communication and workflow automation. 100% source-available & customer-funded.

I've been obsessed with coding since the dial-up BBS days of the early 1990s. My daily stack is PHP/MySQL/AWS/Docker, with increasingly more Python for devops/ML.

Learning piano and German.

#php #mysql #aws #docker #infosec #machinelearning #nlp #investing #compilers #bootstrapping #german #music #piano

This profile is from a federated server and may be incomplete. Browse more on the original instance.

jeff, to php
@jeff@phpc.social avatar

I'm surprised more projects aren't having this MySQL scaling issue in .

MYSQLI_OPT_CONNECT_TIMEOUT only affects the TCP init, not the time to first byte.

MYSQLI_OPT_READ_TIMEOUT is then also needed to time out quickly if a socket connects but sends no data in a reasonable time (DoS otherwise).

However, that also aborts queries that run longer than the limit (reports, schema upgrades).

You have to set the timeouts before a connection and can't use @@session.

https://bugs.php.net/bug.php?id=76703

jeff,
@jeff@phpc.social avatar

@ramsey Sure, that's possible. I'll check if PDO avoids the issue, but a glance at the docs seems like ATTR_TIMEOUT doesn't make a connection / read distinction for MySQL either.

The bug report proposes a reasonable change of including the max-time-to-first-byte in the connection timeout so connect/read are properly decoupled. RDS has had this issue a few times (probably load balancer related).

Cerb is likely older than PDO, so that's not an easy change. I'd break more than I fix. 😅

jeff, to python
@jeff@phpc.social avatar
jeff,
@jeff@phpc.social avatar
thomas, to php
@thomas@phpc.social avatar

devs on Macs: If you use something other than homebrew to manage mulitple php versions, what is it?

jeff,
@jeff@phpc.social avatar

@thomas I use Docker Compose to mix PHP and MySQL versions during dev.

The local code directory is a mount in the containers so I can edit easily w/ PhpStorm.

I commit the Dockerfile + docker-compose.yml so anyone can spin up a copy and just point their browser at it.

The containers for deployment wrap the committed code from GitHub.

https://github.com/cerb/cerb-release/tree/v10.4/install/docker

jeff, to php
@jeff@phpc.social avatar

I've completed "Never Tell Me The Odds" - Day 24 - Advent of Code 2023

I'd already finished this one with Python+Z3, but that felt like cheating. I had some free time today to understand the math and do a pure PHP solution for Part 2.

https://github.com/jstanden/advent-of-code-php/blob/main/2023/24-hailstones/solution.php?ts=4

jeff, to random
@jeff@phpc.social avatar

I just completed all 25 days of Advent of Code 2023! https://adventofcode.com/

jeff,
@jeff@phpc.social avatar

@dave Thanks, Dave! 😀 Yeah, the last week can become a slog w/ ramped up complexity and less time during holidays.

I used PHP again, since it's a good excuse to get experience w/ newer features (>8.2) that are currently above my project minimum versions.

I've also been able to add a few of the nicer solutions to my library. e.g. Graph traversal + combinations.

I did use Python+Z3 for a final one, and Graphviz for another; but I'm revisiting those after reviewing smarter solutions. 🤓

jeff, to php
@jeff@phpc.social avatar

I've completed "A Long Walk" - Day 23 - Advent of Code 2023

I'm still catching up after the Christmas break.

I lost a bit of time trying to optimize this one more than I really needed to.

https://github.com/jstanden/advent-of-code-php/blob/main/2023/23-long-walk/solution.php?ts=4

jeff, to php
@jeff@phpc.social avatar

I've completed "Sand Slabs" - Day 22 - Advent of Code 2023

This was a fun 3d problem. I had a decent approach for both parts right off the bat, but a silly bug only solved the example and not my input.

Part 2 was easy with the same approach but not very efficient.

https://github.com/jstanden/advent-of-code-php/blob/main/2023/22-sand-slabs/solution.php?ts=4

jeff, to Roblox
@jeff@phpc.social avatar

We didn't have many puzzles this year that felt suitable for rendering. Finally, on Day 22 (Sand Slabs) we have a 3D construct.

Here's my "Jenga tower" input data rendered in before processing.

A 3D rendering of a tower of bricks for the Advent of Code 2023 Day 22 (Sand Slabs) puzzle. The sandy bricks are a mix of vertical and adjacent beams that are precariously stacked toward the sky.

jeff, to php
@jeff@phpc.social avatar

I just completed "Step Counter" - Day 21 - Advent of Code 2023

Catching up. Part 1 was straightforward. I took my first hint of AoC 2023 for Part 2 after a few hours spent dicing up the infinite grid.

https://github.com/jstanden/advent-of-code-php/blob/main/2023/21-step-counter/solution.php?ts=4

chrisbiscardi, to rust
@chrisbiscardi@hachyderm.io avatar

A visualization of falling blocks made from the input data and parsers used in day 22 and /

physics came from bevy_xpbd

cubes falling

jeff,
@jeff@phpc.social avatar

@chrisbiscardi That's a beautiful interactive visualization! Nice work. 👍

velkuns, to php French
@velkuns@phpc.social avatar

I've completed Part One of "Pulse Propagation" - Day 20 - Advent of Code 2023 https://adventofcode.com/2023/day/20

done with

Code here: https://github.com/velkuns/adventofcode-2023/blob/main/src/Day/PuzzleDay20.php
+
Some objects for clean code: https://github.com/velkuns/adventofcode-2023/tree/main/src/Day20

Part 1 was easy with clear logic in mind, no bug.
Part 2 ... still running (it tooks ~ 55s for 1million times), so I don't know when it will finish, but probably in long time 😅
Maybe the response tomorrow morning 😄
But it was fun to code !

jeff,
@jeff@phpc.social avatar

@velkuns For my inputs, brute forcing would take about 416 years at that press rate. 😅

This was the first puzzle this year where I felt like I needed full OOP to make sense of it.

jeff,
@jeff@phpc.social avatar

@velkuns hah! Yeah I break the PSR-1 code conventions during AoC.

I keep everything non-reusable in a single file per puzzle.

The library is a PSR-4 autoloader.

jeff, to php
@jeff@phpc.social avatar

I just completed "Pulse Propagation" - Day 20 - Advent of Code 2023

My code is a little longer than usual since OOP + inheritance made the network and module logic much easier to follow.

Spoilers in comments.

https://github.com/jstanden/advent-of-code-php/blob/main/2023/20-pulse-propagation/solution.php?ts=4

beausimensen, to random
@beausimensen@phpc.social avatar

I feel a need for an app that is sorta like a bookmark app but maybe a bit more structured? I'm not sure exactly what that even means.

After losing an article I know I read recently, it's become more clear I need help organizing my browsing history and solid resources when I find them.

What are other people using for bookmarking and organizing links to resources these days?

jeff,
@jeff@phpc.social avatar

@beausimensen I still use and enjoy Instapaper, but I'm tempted about 3x a day to build my own.

jeff, to php
@jeff@phpc.social avatar

I just completed "Aplenty" - Day 19 - Advent of Code 2023

Part 1 was basically what I do at work every day w/ cascading workflow rules and automation.

I had a good idea of what to do on Part 2 from the start, so it was a lot more enjoyable. I got the runtime for both parts down to ~3ms.

https://github.com/jstanden/advent-of-code-php/blob/main/2023/19-aplenty/solution.php?ts=4

velkuns, to php French
@velkuns@phpc.social avatar

I've completed Part One of "Aplenty" - Day 19 - Advent of Code 2023 https://adventofcode.com/2023/day/19

Done in

Code: https://github.com/velkuns/adventofcode-2023/blob/main/src/Day/PuzzleDay19.php

Just only the part 1 today. I don't really like this kind of part 2 with optimised range calculation, so just skip it and have some rest for remaining time :D

jeff,
@jeff@phpc.social avatar

@velkuns Part 2's ranges were less tedious than the ones in Day 5 (Seeds).

But yeah, nothing wrong with prioritizing rest. 😀

It gave me an excuse to add some Range helpers that I had meant to do after Day 5.

steve, to random
@steve@social.dinn.ca avatar

I've been going back to 2022 and trying to catch up on the Advent of Code problems that frustrated me to no end. Finished several of them, but that damn one with the robots...

I got past part 1 by the skin of my teeth, but I can't spare the years it would take to let my algorithm tackle part 2.

jeff,
@jeff@phpc.social avatar

@gregtitus @steve Also if you track the current best state, you can abort any candidate state early that couldn't beat the record if it was left to play all of its turns.

Given that it takes a certain number of turns to produce bots, you can extrapolate the best case scenario from any turn, whether it's possible or not.

Also shift the state ahead to the next time you can actually build something and don't iterate the waiting rounds.

jeff, (edited ) to php
@jeff@phpc.social avatar

I've completed "Lavaduct Lagoon" - Day 18 - Advent of Code 2023

I spent a few hours tinkering with an approach on this one, but it was fun. I managed to get the PHP runtime for both parts under 20ms.

One of my shortest solutions once I added some AoC library functions.

https://github.com/jstanden/advent-of-code-php/blob/main/2023/18-lavaduct-lagoon/solution.php?ts=4

jeff, to random
@jeff@phpc.social avatar

I've completed "Clumsy Crucible" - Day 17 - Advent of Code 2023

I'm catching up after the weekend. I went for readability over speed on this one.

https://github.com/jstanden/advent-of-code-php/blob/main/2023/17-clumsy-crucible/solution.php?ts=4

jeff, to php
@jeff@phpc.social avatar

I've completed "The Floor Will Be Lava" - Day 16 - Advent of Code 2023

GridMap2d and Entity2d continue to come in handy.

This one had a big edge case that wasn't immediately obvious from the instructions.

https://github.com/jstanden/advent-of-code-php/blob/main/2023/16-floor-lava/solution.php?ts=2

jeff, (edited ) to php
@jeff@phpc.social avatar

I just completed "Lens Library" - Day 15 - Advent of Code 2023

This was really close to three one-liners. A nice break from the past few days.

This one really benefitted from being an array-based language w/ ordered hash tables by default.

I used array_keys(filter) to treat keys as associative and indexed at the same time.

https://github.com/jstanden/advent-of-code-php/blob/main/2023/15-lens-library/solution.php?ts=4

jeff,
@jeff@phpc.social avatar

@velkuns hah! Yeah, the instructions were rather confusing today for what ended up being one of the easier challenges. 😁

  • All
  • Subscribed
  • Moderated
  • Favorites
  • anitta
  • mdbf
  • Youngstown
  • InstantRegret
  • ethstaker
  • slotface
  • PowerRangers
  • Durango
  • vwfavf
  • kavyap
  • tsrsr
  • ngwrru68w68
  • DreamBathrooms
  • everett
  • Leos
  • magazineikmin
  • rosin
  • tacticalgear
  • thenastyranch
  • osvaldo12
  • GTA5RPClips
  • khanakhh
  • cisconetworking
  • modclub
  • cubers
  • tester
  • normalnudes
  • provamag3
  • All magazines