Welcome

This is my personal web space. Please forgive the broken articles, Markdown/Textile are not very forgiving after multiple blog software changes!

Draft

Posted on: 2021-05-04 13:21:39

While debugging, I use a local MySQL database. Sometimes, I want to inspect the contents of the DB.

Add a breakpoint, and then open up your query environment of choice:

set tx_isolation="READ-UNCOMMITTED";

Now run whatever queries you want to inspect the DB.

The tx_isolation change will only impact the current session, too.

Continue reading...

Don't put services in a Laravel Console command class constructor

Posted on: 2021-04-20 22:33:15

It will attempt to resolve the component, and that might not take place when you want it to.

You know, for instance, before your cached config gets cleared and composer dumpautoload tries to run and barfs.

Continue reading...

404 when deleting a model through Livewire

Posted on: 2021-04-06 15:35:43

LiveWire has become a new favorite thing of mine the last few weeks. It scratches the itch that I've had for a long time now: I want some flexibility in the UI to do some very simple AJAX and I want to stay in Blade templates.

Anyway, I had an interesting issue which looked like this:

  1. Open up a page with a Livewire form on it.
  2. Submit the form, causing a new model to be created.
  3. This model now has a delete button: so click on it.
  4. Livewire shows a 404.

After looking at the HTML coming through the wire, I noticed that the relations Livewire was sending, there was something not right.

Livewire sends some meta-data back to the browser related to your component. It does this, probably, so that it can just rehydrate the models on the component without the original context of the request which was originally used to generate the component.

At any rate, the model's ID that I was generating was 0. Something about the model wasn't serializing properly.

Turns out that I hadn't actually set $incrementing = false nor $primaryKey on this model. It... wasn't a standard incrementing model. It's primary key was based on another table and it was only a 0-or-1 to 1 mapping anyway.

Moral of the story: make sure you test the serializability of your models!

Continue reading...

Nerdy Movies I grew up watching

Posted on: 2021-02-06 15:49:27

I was thinking a few nights ago while listening to the Hacker's soundtrack that there were a ton of movies I watched growing while either growing up or while I was in college. Some of these I watched a lot...

Anyway, I wanted to record this here for posterity... don't want to forget them!

  1. War Games (1983) - This is the move that started it all for me. I remember watching this a lot and thinking how cool it was that the protagonist had a computer in his room. This movie has it all: suspense, nerdery, hacking skills, a little romance, and a happy ending. I did a little war-dialing when I was a kid and this movie was what I felt like I was doing. (Rather than making my mom upset because I was calling numbers I shouldn't have.)

  2. Sneakers (1992) - The original hacking movie. It has everything: social engineering, computer hacking, code-breaking... you name it! And it has Robert Redford. What's not to like? My favorite scene is the scene where he bypasses the temperature sensor by walking really slowly.

  3. The Net (1995) - Sandra Bullock was a big teenage heart-throb. Who doesn't like nerdy girls? She is an amazing thriller actress. Speed only came out the year before. This is a staple nerd-flick if there ever was one.

  4. Hackers (1995) - Ah. This is "the" movie that I can remember watching over and over. The thrill of the hack, the "sticking it to" the big guys. Having a commanding knowledge of technology in this age made one feel like a deity—and these guys made it look cool, too.

  5. Mission Impossible (1996) - Not so much a hacker movie but there was a pretty good component to it. The feels when they were on the train and their upload failed.

  6. Pirates of Silicon Vally (1999) - Noah Wyle played Steve Jobs in this made-for-TV docu-drama exploring Apple and Microsoft in the build-up to the 21st centry. I don't remember much about it, other than I watched it a bunch.

  7. Antitrust (2001) - Another thriller. This movie came out while I was in high-school. I really idolized the way this story was played out as I felt like I connected with the main character.

  8. Operation Takedown (2000) - This one was about Kevin Mitnick. We studied his case some in college and I remember watching this once or twice. No matter how careful you are it seems that your sins will always find you out.

  9. Revolution OS (2001) - A documentary about Linux. Nothing special, but I watched it over and over again in college... on my Slackware machine.

(Dis)honorable Mentions

  • Swordfish (2001) - I think I watched more clips of this than ever watching the movie, but it was pretty talked about in college. A brief search should find out why that was the case.

  • Live Free or Die Hard (2007) - Another hacker movie... with violence. Not a bad movie but I don't remember liking this one much at all.

Did you have a movie that was formative in your life?

Continue reading...

Carbon today() vs. now()

Posted on: 2021-01-13 08:43:55

Beware of Carbon::today() vs. Carbon::now(). They are not synonyms. The former is equiv. to Carbon::now()->startOfDay().

This is important, especially in test environments. If you're thinking that Carbon::today() is actually today... well I suppose it is, but in what timezone?

I had a test that was doing something calculated off of Carbon::today()->subDays(1) and that is not equal to Carbon::now()->subDays(1).

Continue reading...