Downgrade the MongoDB to older version in Ubuntu

For some reason, after upgraded the MongoDB from 3.2 to 4.2 the daemon started to complaints. I haven’t reviewed the log yet, so I need to quickly downgrade to the previous version. Here is the command I used to downgrade from version 4.2 back to 3.2:

sudo apt-get install -y --allow-downgrades mongodb-org=3.2.22 mongodb-org-server=3.2.22 mongodb-org-shell=3.2.22 mongodb-org-mongos=3.2.22 mongodb-org-tools=3.2.22

References:

Compiler vs Polyfill vs Shim

One way you can think about it is that when you compile your code, you’re transforming it. When you add a polyfill, you’re adding new functionality to the browser.

https://tylermcginnis.com/compiling-polyfills/

Shims and polyfills are libraries that retrofit newer functionality on older JavaScript engines

http://speakingjs.com/es5/ch30.html#shim_vs_polyfill

From my perspective shim and polyfill are similar, while compiler are different beast, but all of this things are having the same purpose, to solve cross-browser compatibility issues.

Compiles are focus with the language, while polyfill and shim are focus with the browser features (e.g. Screen Orientation API).

First time using Mob Programming

After several teammate come from back an annual event where Scrum practitioners gathered in Bandung. This early week my team at some company making impulsive decision to try out a new practice called Mob programming which I’ve never heard before. The only thing I could remember related to Mob is only Flash Mob which totally unrelated to Mob programming. I am not sure if we are making an impulsive decision or being enthusiastic about the new practice we have never used before.

The first day, the person who slightly familiar with the practice encourage us to use it and explain how to play the game. Everyone in the team will be in the same room, putting their focus to work on the same thing. We started by letting someone be the driver, and the rest of the team member to be the navigator.

The second day, we continued to use the Mob programming to work on the project with a tight delivery schedule.

The third day, I’ve noticed the driver getting interrupted a lot, it feels almost like when you are driving but the navigator also frequently touching the steering wheels.

What I’ve learned:

  • Using Mob programming may potentially increase the bus factor since the number of people who were familiar with the specific tools we used in the project is only 2 of 4 people
  • Enhance team collaboration

Things I noticed we could improve :

  • Whatever the editor being used during the session, make sure everyone can quickly navigate the codebase using the keyboard. Jotting down the frequently used editor keyboard shortcuts in a sticky notes might be helpful
  • Get enough sleep so that the experience during the session can be less painful
  • Before starting the session, ensure all the things that could distract the driver to be turned off (e.g. set Do Not Disturb mode in Slack)

Things I need to learn more:

  • We were briefed if the driver should not think, just code. I am still not sure about this idea. Really, the driver should not think?
  • I only grasp the idea of Mob programming at tip of the iceberg and, so I am keen to learn more about the practice

The options should be after the command

I was attempted to running a docker container with the following command but it didn’t work:

docker run --rm image-name:latest -p 80:3000

It will returns the following error:

[FATAL tini (6)] exec -p failed: No such file or directory

Why it didn’t work, it’s because I was specifying the options in the wrong order, and the correct order should be in this form:

$ docker run [OPTIONS] IMAGE[:TAG|@DIGEST] [COMMAND] [ARG...]

See https://docs.docker.com/engine/reference/run/#general-form for more details.

The following commands will work:

docker run --rm image-name:latest
docker run --rm -p 80:3000 image-name:latest

Trying Out the Convention on Wrapping the Display Name for Easy Debugging

Strive to get better at using React, I am deep diving one of React’s advanced guide: Higher-Order Components. I am curious to see how the convention of wrapping the display name for easy debugging really works.

Here is the screenshots of tree view to illustrate the differences:

without display name
with display name

Notice the element displayed in the Tree View:

without display namewith display name
<WithUser></WithUser><WithUser(App)></WithUser(App)>

More details:

My first time using Go

After following the straightforward installation guide from this page:

https://github.com/golang/go/wiki/Ubuntu

I wrote my first go program this morning. Executing the go build command will build the hello.go and produce the following binary file named with go. I was confused, why there is a new file created named with go, but after I executed the binary file I finally able to see the output in the console.

hello, world

I explored a bit the go build command and I think I can do better by naming the build output file using the -o option.

go build -o hello

So, the binary file will be named to hello instead of go. This is content inside of the binary file.

It's magic, oops, I mean machine code

It’s magic, oops, I mean machine code

Stateless function components cannot have refs

Screenshot from 2018-07-11 18-21-22

Seems to be I cannot use refs in a stateless function components. See the following gist:


import React, { Component } from "react";
class App extends Component {
constructor() {
super();
this.state = {
input1: ""
};
this.handleChange = this.handleChange.bind(this);
}
handleChange() {
this.setState({ input1: this.refs.input1.value });
}
render() {
return (
<div>
<h1>{this.state.text}</h1>
<InputWidget update={this.handleChange} />{" "}
<span>{this.state.input1}</span>
</div>
);
}
}
const InputWidget = props => (
<input ref="input" onDoubleClick={props.update} onChange={props.update} />
);
export default App;

view raw

App-1.js

hosted with ❤ by GitHub


import React, { Component } from "react";
class App extends Component {
constructor() {
super();
this.state = {
input1: "",
input2: ""
};
this.handleChange = this.handleChange.bind(this);
}
handleChange() {
this.setState({
input1: this.input1.refs.input.value,
input2: this.input2.refs.input.value
});
}
render() {
return (
<div>
<h1>{this.state.text}</h1>
<InputWidget
ref={component => (this.input1 = component)}
update={this.handleChange}
/>{" "}
<span>{this.state.input1}</span>
<InputWidget
ref={component => (this.input2 = component)}
update={this.handleChange}
/>{" "}
<span>{this.state.input2}</span>
</div>
);
}
}
class InputWidget extends Component {
render() {
return (
<input
ref="input"
onDoubleClick={this.props.update}
onChange={this.props.update}
/>
);
}
}
export default App;

view raw

App-2.js

hosted with ❤ by GitHub

The App-1.js is the file where it contains the stateless functional components with refs usage.