How store is injected into context and passed down from Provider

During the initial mount (ReactCompositeComponent.performInitialMount), React creates the context by merging the pre-existing context and the ChildContext, which is obtained from the component’s getChildContext method.

And in Provider.prototype.getChildContext method, the store is returned.

Define contextTypes to receive some properties of the context (otherwise all properties will be filtered out before the component receive the context)

static contextTypes = {
    store: PropTypes.object
}

Define getChildContext along with childContextTypes to pass down values through context

static childContextTypes = {
    store: PropTypes.object
}
getChildContext(){
 return {store: this.context.store};
}

type vs which in bash

In bash, type is a shell builtin command where as which is a script.

So, using type is more preferable.

Also, some history and more.

1027 /usr/local> type which
which is aliased to `alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'

1028 /usr/local> type type
type is a shell builtin

~/.bash_profile, ~/.bash_login, ~/.profile, ~/.bashrc and /etc/profile

When you log in to the system, bash will first execute the global setup file /etc/profile and then it will look for the personal setup file in the following order (will stop on the first finding)

  1. ~/.bash_profile (Derived from the Bourne Shell’s file name .profile)
  2. ~/.bash_login (Derived from the C Shell’s file name .login)
  3. ~/.profile

If all 3 files exist and need to be used, source the other files from ~/.bash_profile

~/.bashrc will be executed when you run a subshell by typing bash on the command line.

If ~/.bashrc needs to be executed when you log in to the system, source the file from ~/.bash_profile

Bash wildcards and brace expansions

Wildcards will only expand to match the names of the files in the working directory.

  • *
  • ?
  • [abc]
  • [a-z]
  • [!a-z]

So,

echo *

will list all the files in the working directory

 

But brace will expand regardless of the file existence.

echo a{b,c}d

will always echo

abd acd

When blame shows every line being changed and not committed state

00000000 (Not Committed Yet 2016-06-12 12:28:55 +0900 1) …
00000000 (Not Committed Yet 2016-06-12 12:28:55 +0900 2) …
00000000 (Not Committed Yet 2016-06-12 12:28:55 +0900 3) …
00000000 (Not Committed Yet 2016-06-12 12:28:55 +0900 4) …

This happened on Windows machine with Linux repo.

http://stackoverflow.com/questions/4638500/git-blame-showing-no-history

The problem is due to the different line breaks used in local machine and the server.

This can be solved by blaming on a file in the repo (since the file would have the same line breaks)

git blame HEAD file.txt

or using -w flag to ignore the line breaks.

git blame -w file.txt

“peer not authenticated” error during plugin fetch in Gradle build was resolved by upgrading Java to version 1.8

Summary:
“peer not authenticated” error during plugin fetch in Gradle build was resolved by upgrading Java to version 1.8

Troubleshooting Process:

Problem
[root@server01 my-project]# gradle war

FAILURE: Build failed with an exception.

* Where:
Build file ‘/root/tmp/git/my-project/build.gradle’ line: 6

* What went wrong:
Error resolving plugin [id: ‘com.moowork.node’, version: ‘0.12’]
> Could not GET ‘https://plugins.gradle.org/api/gradle/2.10/plugin/use/com.moowork.node/0.12’.
> peer not authenticated

* Try:
Run with –stacktrace option to get the stack trace. Run with –info or –debug option to get more log output.

BUILD FAILED

Total time: 7.763 secs

 

To see if the URL really is not accessible
[root@server01 tmp]# wget https://plugins.gradle.org/api/gradle/2.10/plugin/use/com.moowork.node/0.12
–2016-05-10 19:49:06– https://plugins.gradle.org/api/gradle/2.10/plugin/use/com.moowork.node/0.12
Resolving plugins.gradle.org… 104.25.172.23, 104.25.173.23, 2400:cb00:2048:1::6819:ad17, …
Connecting to plugins.gradle.org|104.25.172.23|:443… connected.
HTTP request sent, awaiting response… 200 OK
Length: unspecified [application/json]
Saving to: `0.12′

[ <=> ] 238 –.-K/s in 0s

2016-05-10 19:49:07 (25.4 MB/s) – `0.12′ saved [238]

[root@server01 tmp]# ll

-rw-r–r–. 1 root root 238 2016-05-10 19:49 0.12

 

Saw comments saying that upgrading Java7 to Java8 solved the problem from:
http://stackoverflow.com/questions/22887829/peer-not-authenticated-while-importing-gradle-project-in-eclipse

[root@server01 my-project]# java -version
java version “1.7.0_101”
OpenJDK Runtime Environment (rhel-2.6.6.1.el6_7-x86_64 u101-b00)
OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)
[root@server01 my-project]# which java
/usr/bin/java
[root@server01 my-project]# ll /usr/bin/java
lrwxrwxrwx. 1 root root 22 2016-05-02 11:15 /usr/bin/java -> /etc/alternatives/java

 

Following the instructions below,
http://tecadmin.net/install-java-8-on-centos-rhel-and-fedora/

[root@server01 my-project]# wget –no-cookies –no-check-certificate –header “Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie” “http://download.oracle.com/otn-pub/java/jdk/8u91-b14/jdk-8u91-linux-x64.tar.gz”
[root@server01 my-project]# tar xzf jdk-8u91-linux-x64.tar.gz
[root@server01 my-project]# mv jdk1.8.0_91/ /usr/lib/jvm/jdk1.8.0_91
[root@server01 my-project]# alternatives –install /usr/bin/java java /usr/lib/jvm/jdk1.8.0_91/bin/java 2
[root@server01 my-project]# alternatives –config java
———————————————–
*+ 1 /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
2 /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
3 /usr/lib/jvm/jdk1.8.0_91/bin/java

Because changing the default Java version was not desired, the path variable was modified for temporary testing purpose
[root@server01 my-project]# java -version
java version “1.7.0_101”
OpenJDK Runtime Environment (rhel-2.6.6.1.el6_7-x86_64 u101-b00)
OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)
[root@server01 my-project]# which java
/usr/bin/java
[root@server01 my-project]# export PATH=/usr/lib/jvm/jdk1.8.0_91/bin:$PATH
[root@server01 my-project]# which java
/usr/lib/jvm/jdk1.8.0_91/bin/java
[root@server01 tmp]# java -version
java version “1.8.0_91”
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)

 

And finally,
[root@server01 vc-web-advanced]# gradle war
Download https://plugins.gradle.org/m2/com/moowork/gradle/gradle-node-plugin/0.12/gradle-node-plugin-0.12.pom
Download https://plugins.gradle.org/m2/com/moowork/gradle/gradle-gulp-plugin/0.12/gradle-gulp-plugin-0.12.pom
Download https://plugins.gradle.org/m2/com/moowork/gradle/gradle-node-plugin/0.12/gradle-node-plugin-0.12.jar
Download https://plugins.gradle.org/m2/com/moowork/gradle/gradle-gulp-plugin/0.12/gradle-gulp-plugin-0.12.jar
========================= Deploy : local-biz =========================
:compileJava

:war

BUILD SUCCESSFUL