Posted on Leave a comment

How to Change Bootstrap Carousel Slide Speed

The speed cannot be controlled by the API. Though you can modify CSS that is in charge of that. find in the bootstrap.css file:

.carousel-inner > .item {
    position: relative;
    display: none;
    -webkit-transition: 0.6s ease-in-out left;
    -moz-transition: 0.6s ease-in-out left;
    -o-transition: 0.6s ease-in-out left;
    transition: 0.6s ease-in-out left;
}

and change 0.6s to the time you want. You also might want to edit time in the function call below:

.emulateTransitionEnd(2000)

at bootstrap.js in function Carousel.prototype.slide. That synchronize transition and prevent slide to disapear before transition ends.

Source: http://stackoverflow.com/questions/17332431/how-can-i-control-the-speed-that-bootstrap-carousel-slides-in-items/17332516#17332516

Posted on Leave a comment

How to lock screen orientation to portrait or landscape?

This article will show you how to lock screen orientation to one direction.
Environment Details:
– Phonegap Build – cli-5.2.0
– Device: iPhone S5 9.3.2

For locking orientation to portrait add following code into your config.xml:

<gap:config-file platform="ios" parent="UISupportedInterfaceOrientations" overwrite="true">
    <array>
        <string>UIInterfaceOrientationPortraitOmg</string>
    </array>
</gap:config-file>

For Landscape:

<gap:config-file platform="ios" parent="UISupportedInterfaceOrientations" overwrite="true">
   <array>
       <string>UIInterfaceOrientationLandscapeLeft</string>
       <string>UIInterfaceOrientationLandscapeRight</string>
   </array>
</gap:config-file>

Source: https://github.com/phonegap/build/issues/263

Posted on Leave a comment

SSH: How to stop a script running in the background?

  1. Open/Login SSH into the server
  2. Type in ps x
  3. See the list of processes currently on your server
  4. Get the PID(process id) from that list and type kill xxxxx
  5. That should do it.

Source: StackOverflow
Tested on Linux / CentOS 6.7 x 64

Posted on Leave a comment

PHP: How to run / execute a script in the background forever through SSH ?

You can execute a php script in the background forever by using SSH through PHP but for that you have to make sure first that SSH2 extension is available.

PHP DOCS: http://www.php.net/manual/en/function.ssh2-exec.php

$connection = ssh2_connect('shell.example.com', 22);
ssh2_auth_password($connection, 'username', 'password');

/* if you want to execute script from a different directory then use commands in same line separated 
   by ';', that is required in php.
   In below second command '&' will do the magic to run command forever.
*/ 
$stream = ssh2_exec($connection, 'cd httpdocs/subdir/dir; /path/to/php server.php &'); 
$stream = ssh2_exec($connection, 'ps aux | grep server.php'); 

// printing ssh output on screen
stream_set_blocking($stream, true);
$stream_out = ssh2_fetch_stream($stream, SSH2_STREAM_STDIO);
echo stream_get_contents($stream_out); 
// closing ssh connection
$stream = ssh2_exec($connection, 'exit'); 
unset($connection);

If you want to do same thing through SSH Terminal (PuTTY) then follow this tutorial:
SSH: how to run a PHP script in background forever in Linux (CentOS) ?

Posted on Leave a comment

SSH: how to run a PHP script in background forever in Linux (CentOS) ?

If you want to run a PHP script in the background forever through SSH then follow these steps:

If you are using a SSH terminal (PuTTY) then directly run following command:

// Notice '&'; that operator will help to run this script forever.
php server.php &

// make sure that you are in the root directory of server.php

ssh outpout

Now your script is running in background and will keep running indefinitely even after closing terminal.

To check if your script is running or not You can run following command:

ps aux | grep server.php

Screenshot_1

If you want to do same thing through PHP instead of terminal then follow this tutorial:
PHP: How to run / execute a script in the background forever through SSH ?

Posted on Leave a comment

CentOS: how to execute a php file with different php version than the php version of OS

To execute a php file with different php version than the version installed on the main php of your Server follow this:

You should know that where is that php version located so that you can add the path.

In my case I want to use PHP 7 that is installed in the plesk hosting panel folder so I’ll run following command:

 /opt/plesk/php/7.0/bin/php server.php

In above code server.php is the file which we want to execute. Just enter above command in the ssh terminal and it will execute successfully.

If your php is located in some other location then get that path and run in the same manner as I did above.

Testing Environment:

OS: CentOS 6.7 x 64

Posted on Leave a comment

How to install Plesk on Linux CentOS?

Download the autoinstaller from our website:

wget http://autoinstall.plesk.com/plesk-installer

Add execute permissions to the autoinstaller:

chmod +x plesk-installer

Launch the autoinstaller:

./plesk-installer

If upgrading Plesk from a lower version:
Command line:

/usr/local/psa/admin/sbin/autoinstaller --all-versions

GUI (Graphical user interface):

/usr/local/psa/admin/sbin/autoinstaller --all-versions --web-interface

For more information, please refer to Plesk Installation guide.

Tested on CentOS 6.7 x64

Source: https://kb.plesk.com/en/119521

Posted on Leave a comment

How to install Node.js on Linux CentOS from the EPEL Repository?

An alternative installation method uses the EPEL (Extra Packages for Enterprise Linux) repository that is available for CentOS and related distributions.

To gain access to the EPEL repo, you must modify the repo-list of your installation. Fortunately, we can reconfigure access to this repository by installing a package available in our current repos called epel-release.

sudo yum install epel-release
Now that you have access to the EPEL repository, you can install Node.js using your regular yum commands:

sudo yum install nodejs
Once again, you can check that the installation was successful by asking Node to return its version number:

node –version
v0.10.30

Tested on CentOS 6.7 x64

Source: DigitalOcean

Posted on Leave a comment

How to download full source of old commit in BitBucket?

It’s very easy to download complete source of your project from an old commit by just following these steps:

  1. Click on Commits from the dashboard of your project in BitBucket.
  2. Get the commit id of the commit you want to access e.g. 341583f
  3. Open https://bitbucket.org/USERNAME/PROJECT_NAME/get/COMMIT_ID.zipFrom above url replace USERNAME , PROJECT_NAME and COMMIT_ID with your own username, project name and commit id relatively. This will give you older version of your project up to that commit.

It’s very useful to access older version of your project. I just found this solution so I shared it. I hope it would help someone.