Star Wars: The Mandalorian

Trailer for The Mandalorian, a Star Wars live-action series, due November 12 on Disney+:

After the stories of Jango and Boba Fett, another warrior emerges in the Star Wars universe. “The Mandalorian” is set after the fall of the Empire and before the emergence of the First Order. We follow the travails of a lone gunfighter in the outer reaches of the galaxy far from the authority of the New Republic.

How To Organize Team Building Retreats

UX studio, a Budapest based 30-person design company on how they plan their team retreats, how they keep the balance between fun activities and serious work during those retreats, etc:

Every six months, our whole UX company travels to a remote location in Hungary’s countryside for two days to have fun and decide together about our big goals.

These team building retreats play an important part in UX studio’s culture. We have been doing them for five years now, and we love them dearly. So, after ten of them, I’m sharing my learnings and giving tips to those of you just starting out with the corporate retreat concept.

How To Organize Team Building Retreats →

Learn about security by hacking a fake bank using a real hacking method

Cool interactive site showing your how to perform a Server Side Request Forgery hack, based on a true incident:

The following interactive tutorial is a reconstruction of Capital One’s data breach incident that exposed the records of almost 106 million customers.

Paige Thompson is accused of breaking into a Capital One server and gaining access to 140,000 Social Security numbers, 1 million Canadian Social Insurance numbers and 80,000 bank account numbers.

To all developers: As always, beware when processing user input …

Contra – Interactive Application Security Training →

(via Jesse)

Time to First Byte: What It Is and Why It Matters

Harry Roberts has done an extensive write-up on Time To First Byte (TTFB), an often overlooked metric when it comes to measuring the performance of websites.

While a good TTFB doesn’t necessarily mean you will have a fast website, a bad TTFB almost certainly guarantees a slow one.

To see what happens during your TTFB, you can leverage the Server Timing API.

Time to First Byte: What It Is and Why It Matters →

Connect to Remote MySQL Server with SSL Certificates from PHP: Fixing the error "Terminated due to signal: ABORT TRAP (6)"


Photo by Clem Onojeghuo on Unsplash

To connect to a MySQL Server that requires SSL from PHP with PDO, you can use this piece of code:

try {
	$db = new PDO('mysql:host=DB_HOST;dbname=DB_NAME', $user, $pass, [
		PDO::MYSQL_ATTR_SSL_KEY => 'path/to/client_private_key',
		PDO::MYSQL_ATTR_SSL_CERT => 'path/to/client_cert',
		PDO::MYSQL_ATTR_SSL_CA => 'path/to/server_ca_cert',
	]);
} catch (PDOException $e) {
	print "Error!: " . $e->getMessage() . "<br/>";
	die();
}

To my surprise I was greeted with an abort signal (not an Exception!) when running this piece of code when trying to connect to a MySQL 5.7 Server on Google Cloud SQL:

Terminated due to signal: ABORT TRAP (6)

Thinking it was a problem with the used certificates I turned to the mysql binary to verify their contents:

$ mysql \
	--ssl-cert='path/to/client_cert' \
	--ssl-key='path/to/client_private_key' \
	--ssl-ca='path/to/server_ca_cert' \
	--host=DB_HOST \
	--user=DB_USERNAME \
	--password

And guess what: that command, of course, worked just fine … but what is the problem then? Is it Google Cloud SQL? Is it PHP acting up?

At the root of the problem is the fact that I’m connecting to the host using an IPv4 address and that the Common Name in the certificate – which one needs to choose manually when generating an SSL Certificate for a Cloud SQL instance – does not match (ref).

To work around this issue you have two options:

  1. (recommended) Connect to your Cloud SQL instance using the Cloud SQL proxy
  2. (not recommended, but needed when solution 1 is not an option) Disable the verification of the server SSL certificate

For the first solution follow Google’s instructions on the Cloud SQL Proxy.

For the second solution, set the PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT option to false:

try {
	$db = new PDO('mysql:host=DB_HOST;dbname=DB_NAME', $user, $pass, [
		PDO::MYSQL_ATTR_SSL_KEY => 'path/to/client_private_key',
		PDO::MYSQL_ATTR_SSL_CERT => 'path/to/client_cert',
		PDO::MYSQL_ATTR_SSL_CA => 'path/to/server_ca_cert',
		PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => false,
	]);
} catch (PDOException $e) {
	print "Error!: " . $e->getMessage() . "<br/>";
	die();
}

💁‍♂️ Do note that in this case your connection is encrypted, but you’re not validation the server SSL certificate, and therefore cannot be guaranteed that you’re connecting to the correct server …

With all these set, your PHP code should be able to connect to the MySQL instance without being terminated prematurely …

Did this help you out? Like what you see?
Consider donating.

I don’t run ads on my blog nor do I do this for profit. A donation however would always put a smile on my face though. Thanks!

☕️ Buy me a Coffee ($3)

The ingredients of a classic house track

Another great video in the Vox Earworm series, a must see for any (house) music lover. Perfect fit to watch right after their previous “The Disco Invention that Changed Pop Music” video.

On June 12, 1979, thousands of disco records were destroyed at Chicago’s “Disco Demolition Night”. Within one year, Chicago DJs and producers had reinvented the genre, and house music rose from the ashes of disco.

5 Tips to Help You Avoid React Hooks Pitfalls

Kent C. Dodds:

As hot as it is, React Hooks require a bit of a change in the way you think about React Component Lifecycles, State, and Side Effects and it can be easy to fall into problematic scenarios if you’re not thinking about React Hooks properly. So let’s look a bit at what pitfalls you could come across and how you can change your thinking so you avoid them.

Glad to see one of the tips is to no longer think in lifecycles, but in effects. Also, must say I hadn’t really checked out the ESLint React Hooks Plugin yet 😬.

5 Tips to Help You Avoid React Hooks Pitfalls →

React DevTools 4.0

Version 4 of the React DevTools have been released, with a lot of improvements.

At a high level, this new version should offer significant performance gains and an improved navigation experience. It also offers full support for React Hooks, including inspecting nested objects.

The release notes hold a detailed list of changes, with example gifs. Furthermore there’s an interactive React DevTools tutorial showing you a few of the basics.

ℹ️ If you’re interested in some more behind the scenes, be sure to follow @brian_d_vaughn on Twitter. He’s been working on it the past few months.

React DevTools 4.0.0 supports react-dom 15.x and up, and react-native 0.62 and up.

React DevTools 4.0.0 Changelog →
Interactive React DevTools Tutorial →
React DevTools extension for Google Chrome →
React DevTools extension for Mozilla Firefox →

Inside NASA’s facility where they keep the Moon Rocks

In honour of the upcoming 50th anniversary of the first lunar landing – which launched on July 16th, 1969 – Destin from SmarterEveryDay went to the NASA facility where they keep about 70% of the Moon Rocks that were ever collected (Apollo Missions 11, 12, 14, 15, 16, and 17). The video offers us a truly amazing inside view on how the rocks are stored, manipulated, documented, etc.

Extra kudos to his guide Andrea Mosie, who speaks in such a passionate, open, and honest way about it all. It must be a joy and privilege to work with her.

💩 Did you know: In order to take all those rocks back, the astronauts left a lot of their stuff on the moon … including wastebags filled with their own poop.

In the end of the video Dustin refers to It’s Okay To Be Smart‘s video on The Genesis Rock, which is also worth your time:

The Wikipedia article on Moon Rocks is also worth a read 🙂

🚀 If you really want to go back in time you can – just like with the Apollo 17 Mission before – relive the entire Apollo 11 Mission in real-time. Included real-time elements are:

  • All mission control film footage
  • All TV transmissions and onboard film footage
  • 2,000 photographs
  • 11,000 hours of Mission Control audio
  • 240 hours of space-to-ground audio
  • All onboard recorder audio

And to say some people still think this was all a scam 😅

Apollo 11 in real-time →