Sunday, September 3, 2017

Visual aspects of code play a significant role in raising or drowning developer's productivity. In case that there's too much clutter, no clear patterns and no lots of randomness in style, code reading can be difficult, and even stressful. This is why developers are constructing ways of dealing with the code complexity. They hope it can make everyday programming life easier. And I'd say they have the point. It really is important to have a clean, flowing, easy to read code.

One good example of such a coding standard is PSR-1, and it's extension PSR-2. Some of the rules of these standards are:

Saturday, August 12, 2017

If your app was written for older versions of MySQL and is not compatible with strict SQL mode in MySQL 5.7, you can disable strict SQL mode. For example, apps such as WHMCS 6 and Craft 2 do not support strict SQL mode.

If you're using WHMCS 7, see our article on customizing MySQL for WHMCS 7.
To disable strict SQL mode, SSH in to your server as root and create this file:

/etc/mysql/conf.d/disable_strict_mode.cnf
Open the file and enter these two lines:

Friday, August 4, 2017

If you are using npm inside of a Homestead box which is being hosted in Windows, and you see a "Exit status 1" error , or EIO error thrown by npm scripts, make sure that you have downloaded the npm packages inside of Homestead box, and not in Windows.

Apparently, there could be some differences in encoding / character set which can result in npm errors inside of Homestead box.

So, inside your Homestead box, remove the node_modules file and re-run npm install. Now you should be able to run npm scripts normally.

Sunday, July 23, 2017

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

In mysqld section of my.cnf add a line innodb_force_recovery = 4 and then restart MySQL server using /etc/init.d/mysql restart.

Sunday, July 9, 2017

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.

Friday, July 7, 2017

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):

Friday, June 30, 2017

You are trying to run npm install on an existing git repository, but your npm install stops somewhere at fetchMetadata and throws an error code 128, which doesn't tell you much.

First of all, there are multiple possible causes for error code 128, most of them have something to do with permissions, so make sure you have access permissions and you're using proper ssh key(if any).

However, if that doesn't solve the problem, you might try this:
Try to split the package.json file's dependency list into N subgroups and run npm install on those chunks.

This way, it will download some packages every time, and it won't download them anymore when you run npm install for the next chunk.

I'm not sure what's root cause of this bug, but it seems to be a potential bug in npm v.5.0.0+. This needs some more research, but for the moment, I hope that the trick of splitting the npm install load will do the trick for you!

This was tested with node v8.0.0.0 and v8.1.3 with npm v5.0.0 and v5.1.3.
OS: Ubuntu 16.04
(nvm was used as the node manager, and the package.json contained both free and private git repos hosted at bitbucket and github).

UPDATE:
Possible reason for this error is the too high number of connections npm is trying to open. For some internet routers / connections, it might simply be too much. Currently, there's no official ability to limit max connections from npm, even there were some discussions on this in past. Lets hope this will be added into the newer versions.

Also, npm's error log is very bad at reporting the root cause of this error. In most cases, it simply says error code 128. However, every once in a while, it will print out something like Connection refused, or cannot connect to remote repository - host unknown, or something.

This error has a tendency to show up at large repos , filled with lots of git+ssh entries.

This issue might be somewhat related to this problem too:
https://github.com/npm/npm/issues/7862