What will we say about Facebook React and Flux in 10 years?

I’ve been learning some React and Flux. You don’t have to develop React apps with ES6, you can still use ES5, but I think having a library that can be used (or has been over the past couple of years) with two different languages with differing syntax and quirks, and is supported via bewildering layers of complexity like transpilers and webpackers and the like, it does nothing to help developers who are just getting started.

The problem is, you start reading articles and tutorials and initially you’ve no idea that ES5 syntax is not the same as ES6, so you start inter-twining concepts from both and finding out that even copying snippets of using React apis using ES5 into ES6 classes does not work (for example). At least in the Angular world they made a clean break when introducing Angular 2 which can be developed using TypeScript and other languages. The two frameworks are obviously and deliberately different.

I don’t think this is entirely React’s fault. It’s more to do with browsers not natively supporting ES6 (yet),  and hence the need for transpilation from ES6 source to ES5 for runtime. Just to get Babel and Webpack setup and configured is a significant task. True, you can use a starter project template that’s preconfigured and ready to go, but I like to know how to do things myself so I have the understanding of what I’ve got, rather than working with a black box of magic that I have no idea how to fix if it goes wrong.

There is no denying that the JavaScript world right now is complex and diverse. It’s very complex. It’s also growing and changing quick (just look at the new module trends for JavaScript modules shared via the npm repository – it’s outgrowing every other language by far, in rate of growth and sheer numbers of modules – e.g. take a look at ModuleCounts). There’s so much going on and changing that the phrase ‘JavaScript Fatigue‘ has been coined to describe what it’s like to try and keep up (click that link or Google that for yourself – there’s over 1,000,000 hits right now, which tells you this is not an isolated feeling among just a few developers). The article ‘How it feels to learn JavaScript in 2016‘ attracted a huge amount of attention this year, and many followon discussions, but there’s no smoke without fire.

Which brings me to my question. Ten years from now will we look back and say:

  • ‘Wow, Facebook React and Flux was so ahead of it’s time. It was a remarkable approach to web development’

or will it be more like:

  • ‘Wow. Facebook React and Flux. Why on earth did we think that was a good idea?’

React ES5 to ES6: props and state

Developing with React and ES5, state on a Component is configured using the getInitialState() function:

var ButtonComponent = React.createClass({

  getInitialState : function(){
    return({
      value1: this.props.value1,
      value2: this.props.value2
    });
 },

...

});

If you’re moving from ES5 TO ES6 and creating React components using ES6 classes, if you try to follow the same approach you’ll see an error like this:

To set the initial state on an ES6 React class, you establish it in the constructor like this:

constructor(props) {
  super(props);
  this.state = {
    value1 : this.props.value1,
    value2 : this.props.value2,
  };
 }

 

RT73 wifi driver on Debian 8 completely filled my hard disk with syslog messages

Just installed Debian Hamradio Pure Blend, and I thought a 20GB partition for / would be plenty, but after a day I was getting disk full errors. So I shrunk my /home partition and extended my / partition up to 50GB. A day later it was at 100% again (I had just deleted some log file files to free up some space):

kev@kh-debian:/var/log$ df -h

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda9        58G   53G  2.5G  96% /
/dev/sda10       20G  279M   19G   2% /home

Guessing something was up, I cd’d into /var/log to see what was showing up in my log files and was surprised to see this:

kev@kh-debian:/var/log$ ls -lS

total 49743852

-rw-r----- 1 root              adm  15123453253 Dec 24 18:37 syslog
-rw-r----- 1 root              adm  13204397200 Dec 24 18:37 kern.log
-rw-r----- 1 root              adm  12416440518 Dec 24 18:37 daemon.log
-rw-r----- 1 root              adm  10053382069 Dec 24 18:37 messages
-rw-r----- 1 root              adm    139506083 Dec 23 07:04 syslog.2.gz
-rw-rw-r-- 1 root              utmp      292292 Dec 24 18:33 lastlog

Ok, ok. That’s where my disk space has gone.

Looking in syslog, I’ve got these messages repeating about 100 times a second:

Dec 24 18:55:01 kh-debian wpa_supplicant[862]: wlan0: Failed to initialize driver interface
Dec 24 18:55:01 kh-debian NetworkManager[696]: <error> [1482634501.576472] [supplicant-manager/nm-supplicant-interface.c:856] interface_add_cb(): (wlan0): error adding interface: wpa_supplicant couldn't grab this interface.
Dec 24 18:55:01 kh-debian NetworkManager[696]: <info> (wlan0): supplicant interface state: starting -> down
Dec 24 18:55:01 kh-debian kernel: [ 2026.757616] ieee80211 phy0: rt2x00lib_request_firmware: Info - Loading firmware file 'rt73.bin'
Dec 24 18:55:01 kh-debian kernel: [ 2026.757646] rt73usb 1-7:1.0: firmware: failed to load rt73.bin (-2)
Dec 24 18:55:01 kh-debian kernel: [ 2026.757652] rt73usb 1-7:1.0: Direct firmware load failed with error -2
Dec 24 18:55:01 kh-debian kernel: [ 2026.757656] rt73usb 1-7:1.0: Falling back to user helper
Dec 24 18:55:01 kh-debian wpa_supplicant[862]: Could not set interface wlan0 flags (UP): Cannot allocate memory
Dec 24 18:55:01 kh-debian wpa_supplicant[862]: nl80211: Could not set interface 'wlan0' UP

 Following the install instructions here: https://wiki.debian.org/WiFi/rt73 – and then rebooted, problem solved. Log messages gone.

Getting USB thumb drives to work with PS4’s Media Player

Quick answer: make sure the thumb drive is formatted using a Master Boot Record (MBR) partition in either FAT32 or ExFAT format. The MBR partition format is key.

If formatting a device on a Mac, the default partitioning uses a GUID Partition Map. Make sure you change this to Master Boot Record and you’ll be all set.

More discussion in these posts:

http://community.us.playstation.com/t5/Games-Services/PS4-Media-Player-Not-Reading-any-files-on-USB/td-p/45224287

Why Can’t PS4 Media Player Read My Drive? (Yes I’ve tried the Obvious Stuff)
by inPS4