Replaying JavaScript errors from the userland

I came across this interesting dive into monitoring, troubleshooting, and replaying JavaScript errors from the userland – “A user encounters a JavaScript error. You’ll never guess what happens next!!“.

This is not something immediately applicable for my projects at work, but gives me a lot to think about.

rector – reconstruct legacy PHP codebase to modern standards

rector looks like an excellent tool for those days when you need to rewrite large chunks of legacy code for the modern coding standards and best practices.  Of course, there are IDEs that can help a lot with refactoring, but they are usually complex and slow.  Regular expressions have always been a poor man’s choice for replacing old code with new code.  But life can be easier and better.  rector helps you find and replace things like namespaces, class names, method names and property names; change type hints and values of parameters; replace magic methods with their real implementations, and much more.

I’m sure I’ll be trying it out Real Soon Now ™, with the upcoming release of CakePHP 3.6.

PHP-FPM tuning: Using ‘pm static’ for Max Performance

PHP-FPM tuning: Using ‘pm static’ for Max Performance” looks at different process management settings in PHP-FPM: static, dynamic, and ondemand, and the way they affect performance.  The default – ondemand – might work well for you if you have a large server with plenty of resources and not so many actual visitors.  Running on a smaller instance, or expecting high spikes of traffic might require you to look into your PHP-FPM configuration and adjust it.  The article is just what the doctor ordered.

Personally, I prefer having a dedicated instance for the web server, but that instance being as small as possible.  With that, figuring out the correct settings for static process management is easier.  It also minimizes all those nasty cases of running out of memory, swapping, and having an excessive CPU utilization.   Which is especially useful when running on Amazon AWS instances.

Linux Journal Ceases Publication

These are some sad, sad news, folks – Linux Journal is closing down:

EOF

It looks like we’re at the end, folks. If all goes according to a plan we’d rather not have, the November issue of Linux Journal was our last.

The simple fact is that we’ve run out of money, and options along with it. We never had a wealthy corporate parent or deep pockets of our own, and that made us an anomaly among publishers, from start to finish. While we got to be good at flying close to the ground for a long time, we lost what little elevation we had in November, when the scale finally tipped irrevocably to the negative.

I’ve been a subscriber of the Linux Journal for many years (just not the most recent ones), and I’ve learned a lot from it.  It’s very sad to see it go, even though it’s been years since I read it last.

Change SQL mode for MariaDB in Fedora 27

After I upgraded my laptop to Fedora 27, I started experiencing some weird issues with most of the projects I am developing locally.  Trying to save anything into the database that involves dates, started throwing the following errors:

Error: SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: '2017-11-30T13:30:48+02:00' for column 'timestamp' at row 1

A quick look around showed that Fedora 27 ships MariaDB v10.2, while the previous distribution version shipped MariaDB v10.1. Digging through the changes between the two versions didn’t help much, even though there is slight mention of the related change.

SQL_MODE has been changed; in particular, NOT NULL fields with no default will no longer fall back to a dummy value for inserts which do not specify a value for that field.

StackOverflow is much more helpful, as always.  These two threads – one and two – in particular, explained the changes and suggested the fix.  I had to either fix the projects I was working on, or modify my local configuration to use the old SQL mode.  This thread provided some more details, so the final solution was adding the following to the /etc/my.cnf and restarting the MariaDB service:

[mysqld]
sql-mode="NO_ZERO_IN_DATE,NO_ZERO_DATE"

And now we are back to normal.

The Global Airport Database

Global Airport Database – Arash Partow

The Global Airport Database is a collection of data about all (???) airports in the world, big and small.  It covers a total of 9,300 airports worldwide.

That’s pretty interesting.  For example, how many airports do you think there are in Cyprus?  Obviously, there is the Larnaca International Airport and Paphos International Airport.  Then, there is one in Nicosia, which is not functioning since the island was divided.  And there is one in Acrotiri on the British military base.  Four, right?   Well, the Global Airport Database has a total of 7 (!!!) entries for the country of Cyprus:

LCCC:N/A:N/A:NICOSIA ACC/FIC:CYPRUS:000:000:000:U:000:000:000:U:00000:0.000:0.000
LCLK:LCA:LARNACA:LARNACA:CYPRUS:034:052:030:N:033:037:029:E:00003:34.875:33.625
LCNC:N/A:N/A:NICOSIA:CYPRUS:000:000:000:U:000:000:000:U:00000:0.000:0.000
LCPH:PFO:PAPHOS INTERNATIONAL:PAPHOS:CYPRUS:034:043:004:N:032:029:008:E:00013:34.718:32.486
LCRA:AKT:AKROTIRI:AKROTIRI:CYPRUS:034:035:025:N:032:059:016:E:00024:34.590:32.988
LCRO:N/A:N/A:EPISKOPI:CYPRUS:000:000:000:U:000:000:000:U:00000:0.000:0.000
LCRR:N/A:N/A:NICOSIA:CYPRUS:000:000:000:U:000:000:000:U:00000:0.000:0.000

Larnaca and Paphos are there. The Akrotiri one is there too. Then we have 3 records for Nicosia. And one more for Episkopi. Hmm …

Fedora 27 and high DPI support

I’ve recently updated my laptop to Fedora 27 and since then I had some issues with the rendering of the desktop fonts.  At first, everything seemed too large and over-magnified.  Resetting the desktop fonts to much smaller sizes helped a bit, but there were still random issues with different applications – Google Chrome, Skype, etc.   I think these much be related to the recent improvements to high DPI support.

A few things helped me a long the way.  Here are the links, just in case I’ll need to find them in the future:

Ultimately, the things that solved my problems were the last link (installing better fonts for Fedora), and adjusting the fonts resolution from 142 dots per inch down to 96.

7 Skills Of An Effective Developer

7 Skills Of An Effective Developer” is a great article that goes over what it takes to become an effective developer.  The choice of skills is rather standard and has been covered in other articles before:

  1. Communication
  2. Empathy
  3. Planning
  4. Presentation
  5. Documentation
  6. Testing
  7. Git

but I really liked the examples that were used to illustrate them – simple, yet very realistic.

What’s the difference between JavaScript and ECMAScript?

Here’s a good explanation on what’s the difference between JavaScript and ECMAScript.  I know I’m not the only one confused.

Chicken or the egg

A confusing bit of history is that JavaScript was created in 1996. It was then submitted to Ecma International in 1997 for standardization, which resulted in ECMAScript. At the same time, because JavaScript conformed to the ECMAScript specification, JavaScript is an example of an ECMAScript implementation.

That leaves us with this fun fact: ECMAScript is based on JavaScript, and JavaScript is based on ECMAScript.

I know.

It sounds exactly like the time-travel trope of people being their own parent — a little wonky, but kind of fun to think about.