React.Component cannot use getInitialState

When React 0.13 was launched, you no longer needed to use React.createClass.

These are basically the same.

class YourComponent extends React.Component {
  constructor(props) {
    this.state = { /* initial state */ };
var YourComponent = React.createClass({
  getInitialState() {
    return { /* initial state */ };

getInitialState won’t work when you are using React.Component. Using it will show up as an error in your console:

Warning: getInitialState was defined on YourComponent, a plain JavaScript class. This is only supported for classes created using React.createClass. Did you mean to define a state property instead?

Btw, The React community is moving closer to ES6. Also it is considered as the best practice.

 Your password has expired. To log in you must change it using a client that supports expired passwords

Started GET "/" for at 2017-03-14 05:29:35 +0800

Mysql2::Error (Your password has expired. To log in you must change it using a client that supports expired passwords.):

This is an instance I encountered a few days ago. Apparently, MYSQL allows users to automatically expire passwords.

To fix the issue, log in to your MySQL console using your old password.

You will need to alter your password by using the following command:

ALTER USER `root`@`localhost` IDENTIFIED BY 'new_password', `root`@`localhost` PASSWORD EXPIRE NEVER;

Here it is in action!

$ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.10

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use database your_database
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

mysql> ALTER USER `root`@`localhost` IDENTIFIED BY 'new_password', `root`@`localhost` PASSWORD EXPIRE NEVER;
Query OK, 0 rows affected (0.00 sec)

mysql> \q

Voila! done!

 Swift: How to Join an Array of Strings into a single String

It is a common task to join an array of strings into a single string in programming. Here’s how you do it in Swift.

Swift 2

let array = ["Matthew", "John", "Paul", "Peter"]

let stringOfNames = array.joinedWithSeparator(", ")

Swift 3

let array = ["Matthew", "John", "Paul", "Peter"]

let stringOfNames = array.joined(separator: ", ")

Screen shot 2016 11 28 at 10.13.45 am

 Installing COMODO Positive SSL on your NGINX server

I just renewed my SSL certificate and have gotten a COMODO Positive SSL certificate from Here’s some instruction to setup up COMODO Positive SSL

CSR Certificate

Your CSR Certificate will contain information about you and your website. This is needed by your provider to generate your crt files

Generate your CRT

You will receive your files through email or the comodo website. Here are what you will receive

  • AddTrustExternalCARoot.crt
  • COMODORSAAddTrustCA.crt
  • COMODORSADomainValidationSecureServerCA.crt
  • your_domain_com.crt

You will need to generate your crt file via the following command

cat your_domain_com.crt COMODORSADomainValidationSecureServerCA.crt  COMODORSAAddTrustCA.crt AddTrustExternalCARoot.crt > server.crt

Add your certificate location to your server block

server {
    listen 443;

    ssl on;
    ssl_certificate /etc/nginx/ssl/your_domain_com/server.crt;
    ssl_certificate_key /etc/nginx/ssl/your_domain_com/server.key;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;



Screen shot 2016 11 15 at 7.25.15 pm