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

jeff

@jeff@phpc.social

Founder & Software Architect @ Cerb 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 random
@jeff@phpc.social avatar

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

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 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

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

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

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, to php
@jeff@phpc.social avatar

I've completed "Parabolic Reflector Dish" - Day 14 - Advent of Code 2023

My GridMap2d class made this much easier. The same premise was used in at least two puzzles last year, so I had a good idea of what I needed to do going into it.

https://github.com/jstanden/advent-of-code-php/blob/main/2023/14-parabolic-dish/part2.php?ts=4

jeff, to php
@jeff@phpc.social avatar

I just completed "Point of Incidence" - Day 13 - Advent of Code 2023

I read the challenge before bed and thought about it overnight. I came up with an approach that worked in ~80ms for both parts (PHP overhead included).

I had a few ideas for Part 2, but the first trick I tried worked.

The examples on this one left several edge case landmines in the actual input.

I'm happy with how it turned out.

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

jeff, to php
@jeff@phpc.social avatar

I just completed "Pipe Maze" - Day 10 - Advent of Code 2023

Wow. Sitting on the couch with the laptop on Sunday, I was making Part 2 way harder than it needed to be.

I took a break to think about it, while generating the same pipe maze with my 11yo in Roblox instead. He modeled a straight pipe and angled pipe, and we rotated and tiled a 140x140 field of them.

That gave me an idea that massively simplified my whole approach.

https://github.com/jstanden/advent-of-code-php/blob/main/2023/10-pipe-maze/solution.php

jeff, to php
@jeff@phpc.social avatar

I just completed "Cosmic Expansion" - Day 11 - Advent of Code 2023

This was a lot quicker than Part 2 yesterday. I added a few features to my GridMap2d class and it's one of my cleanest solutions.

https://github.com/jstanden/advent-of-code-php/blob/main/2023/11-cosmic-expansion/part2.php?ts=4

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

I've completed "Mirage Maintenance" - Day 9 - Advent of Code 2023

This was a quick one.

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

jeff, to php
@jeff@phpc.social avatar

I just completed "Haunted Wasteland" - Day 8 - Advent of Code 2023

The Part 1 solution was only 2-3 lines of code after parsing the simple node/edge input.

On Part 2, I fortunately recognized the math trick from past year challenges: 2022 Day 11 (Monkey Business) & Day 17 (Rock Tower). A couple more lines of code and we get a really big answer in <20ms. Woo!

I added extended comments for the math in the code below.

https://github.com/jstanden/advent-of-code-php/blob/main/2023/08-haunted-wasteland/part2.php

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

Phew! Here's my optimal and commented solution to Part 2 of 2023 Day 5 (If You Give A Seed A Fertilizer).

It runs in <10ms in

Spoilers in the comments.

https://github.com/jstanden/advent-of-code-php/blob/main/2023/05-seeds/solution.php

jeff, to php
@jeff@phpc.social avatar

I just completed "Gear Ratios" - Day 3 - Advent of Code 2023

I wrote 2D GridMap and Vector classes during past years, since treating many challenges as a terminal Roguelike game w/ 8 cardinal directions works surprisingly well.

Subclass the 2d grid for a schematic with entities (gears, numbers), do some collision checking, and off we go.

https://github.com/jstanden/advent-of-code-php/blob/main/2023/03-gear-ratios/solution.php

jeff, to random
@jeff@phpc.social avatar

My finger joints have been protesting lately against too many years of the tiny Apple magic keyboard. Especially the half-sized arrow keys while coding.

I finally upgraded to Keychron Q3 mechanical 80% keyboard in carbon black with brown switches.

What a huge difference. The 6lb weight of this thing surprised me, but it's perfect. Tactile, essential Mac keys, full arrows, less funky 'Fn' placement.

More than I ever thought I'd spend on a keyboard, but well worth it.

https://www.keychron.com/pages/keychron-q3-customizable-mechanical-keyboard

jeff, to ChatGPT
@jeff@phpc.social avatar

Currently tinkering with a semantic question answering bot in a Cerb interaction.

This example uses LangChain + ChromaDB with a self-hosted HF sentence transformer. It updates in real-time on browser FAQ edits.

Queries fetch the most relevant entries and pass them to a ChatGPT prompt as context. An answer can blend multiple sources.

Working to get decent local text generation for privacy & compliance.

#OpenAI #ChatGPT #LangChain #HuggingFace

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

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