Friday, July 28, 2017

Homestead - recreate database after it's name being changed in Homestead.yaml

When a database name is changed in Homestead.yaml, this database is not cretead until you run this command:

homestead reload --provision

Sunday, July 23, 2017

MySQL crash recovery - ibdata1 file

It proved to me working in my case:

If you don't have backup.
I think the recommended way to recover that databases is start MySQL with innodb_force_recovery = 4 (or higher values) and dump the databases to a SQL.Then drop it and recover from backup. Instead of dropping the original database I prefer to create the new databases with another name or in another server and check the content first.
STEPS TO BE FOLLOWED
  1. In mysqld section of my.cnf add a line innodb_force_recovery = 4 and then restart MySQL server using /etc/init.d/mysql restart.
  2. Take backup.
  3. Restore it on other server and verify the contents.
Please also have a look at Forcing InnoDB Recovery.
UPDATE : For your comment how to progress on that so that it would not happen again
You should not kill MySQL it is not a good practice that may cause MySQL server to crash,whenever you make any configuration changes you should proceed as follows.
  1. Safely stop MySQL Server using /etc/init.d/mysql stop
  2. Make changes
  3. Restart MySQL Server

Saturday, July 15, 2017

MSSQL - list all foreign tables for a table

Useful command which returns a list of all referenced (foreign) tables for a MSSQL table:

EXEC sp_fkeys 'TableName'

Sunday, July 9, 2017

ReactJS - If componentWillReceiveProps is not firing, double check the syntax of mapStateToProps

In ReactJS, the first obvious reason for componentWillReceiveProps() not firing is the use of mutable data. However, if that's not the case, you should always double check the form of your mapStateToProps() function.

Here, the first example works as expected, but the second one contains a logical, but not syntax error which can be a problem to find sometimes.

EXAMPLE:

CORRECT:

var mapStateToProps=(state)=>({

    curOrder:state.orderEditorReducer.curOrder,


});



INCORRECT (not returning anything, just a function declaration):


var mapStateToProps=(state)=>function(){

  return {

    curOrder:state.orderEditorReducer.curOrder,


  }

};

Friday, July 7, 2017

[solved] - PermError SPF Permanent Error: Unknown mechanism found: -all

Super useful article about SPF records which got rejected by mail servers, although they look valid in validators ( it's all about hyphen sign, which looks similar , but it's not the same in validator and at the actual SPF record registry):

https://www.stephendonaghy.com/?p=29

PSR-1 and PSR-2 coding standards for PHP

Visual aspects of code play a significant role in raising or drowning developer's productivity. In case that there's too much clutte...