Category: technology

  • Fix – ERROR 2006 (HY000) while importing database in MySQL

    While importing big database in MySQL, you might get the error as shown below:

    ERROR 2006 (HY000) at line 3387 in file: 'path_to_the_db_dump.sql': MySQL server has gone away

    Step 1:

    Open a terminal and find a config file for MySQL by command locate my.cnf.

    You will get the list of files. Open your responsible file.

    If you don’t know the responsible file then open all the files ;). There is no harm to add our solution in all the related config file.

    Step 2:

    Add following line to my.cnf file.

    max_allowed_packet=64M

    Restart your MySQL using below command.

    sudo service mysql restart 
    OR
    brew services restart mysql

    That’s it!!!!

  • go to particular commit in git

    Safe way to do this by creating a new branch with a particular commit hash.

    Here is an example:

    git checkout -b new_branch 6e559cb( replace with your hash )

    That’s it!!!

  • Apply svn patch and then undo the same patch via command line

    Apply svn patch

    patch -p0 -i path_of_patch_file.patch
    
    Example: patch -p0 -i /Users/blah/Downloads/7526.2.patch

     

    Undo svn patch

    svn patch --reverse-diff path_of_patch_file.patch
    
    Example: svn patch --reverse-diff /Users/blah/Downloads/7526.2.patch
  • Fix Node Sass does not yet support your current environment on macOS

    Video for who doesn’t like to read ;). And if you like the video then subscribe my channel and share this with others who has the same issue.

    Recently I came across this below error when I tried to run npm start command on my Mac.

    Error: Node Sass does not yet support your current environment: OS X 64-bit with Unsupported runtime (79)
    For more information on which environments are supported please see:
    https://github.com/sass/node-sass/releases/tag/v4.12.0

    So you can fix this with 2 steps only.

    1. Open your package.json file and in “devDependencies” section, change “gulp-sass” version to “^3.0.1” and save the file.

     

     

     

     

     

     

     

    2. Run npm install

    After doing this, your issue should be fixed. Now you can run npm start

    And it’s done!!!!

    Ref: https://github.com/jakearchibald/wittr/issues/20#issuecomment-342740559

  • Change URL without reloading page using Javascript

    Change URL without reloading page using Javascript

    This will be possible if your browser supports HTML5. You can do that by below small code.

    var title = 'Your Title',
        url   = 'https://yoursite.url';
    if (typeof (history.pushState) != "undefined") {
        var obj = { Title: title, Url: url };
        history.pushState(obj, obj.Title, obj.Url);
    }

    You can remove a title from the object ( `obj` ) if you don’t want to change the page title. In that case, the second parameter in pushstate function will be blank. like below:

    history.pushState(obj, '', obj.Url);

    That’s it