The Biggest Mistake Digital Marketers Ever Made: Claiming to Measure Everything

Posted by willcritchlow

Digital marketing is measurable.

It’s probably the single most common claim everyone hears about digital, and I can’t count the number of times I’ve seen conference speakers talk about it (heck, I’ve even done it myself).

I mean, look at those offline dinosaurs, the argument goes. They all know that half their spend is wasted — they just don’t know which half.

Maybe the joke’s on us digital marketers though, who garnered only 41% of global ad spend even in 2017 after years of strong growth.

read more

How to design a JS object that has private state and may be instantiated multiple times?

Just trying to wrap my head around prototype-based design

Problem: implement a data structure say priority-queue with a known API. Instantiate multiple instances of the PQ.

So I used the revealing module pattern as follows

module.exports = (function () {
// ... assume the following methods are revealed. Other private methods/fields are hidden
let priorityQueue = {
        insert,
        removeMax,
        isEmpty,
        toString
    };

    return {
        priorityQueue,
        newObj: (comparer, swapper) => {
            let instance = Object.create(priorityQueue);
            instance.array = [];
            instance.size = 0;
            instance.less = comparer;
            instance.swap = swapper;
            return instance;
        }
    }
})();

read more

React this.setState does not rerender component

I have a button which sends a post request, updates serviceStatus in this.state via this.setState method. But it does not trigger a rerender when I press the button. According to the react document, it should trigger a rerender. Code below. How do I make the component rerender?

class PowerStatus extends Component { constructor(props) { ... this.onClick = this.onClick.bind(this); } async componentDidMount() { ... } async onClick() { const url = `/api/widgets/start`; const body = { title: this.title } try { const { data } = await axios.post(url, body); this.setState(() => { return { ...this.state, serviceStatus: data.start, } }); } catch (e) { alert("Could not turn on service.") } } render() { if (this.state.initial.loaded) { const colour = this.state.serviceStatus ? "green" : "red"; return ( <Grid.Column width={3} style={{textAlign: 'center'}} onClick={this.onClick} className="img-icon" verticalAlign='middle'> <i className={`fas fa-power-off fa-5x ${colour}`}></i> </Grid.Column> ); } else { return ( <div/> ) } } }

React this.setState does not rerender component