Sunday, 31 March 2019

KVM is required to run this AVD. /dev/kvm/ device:permission denied. Grant current user access to /dvm/kvm

When I updated my Android Studio to 3.2.2 and when tried to run emulator got the problem -


After searching on internet, I found the successful solution here .

Solution is to need to install qemu-kvm. To do this run command type -

sudo apt-get install qemu-kvm

After successful installation of qemu-kvm, check the ownership of /dev/kvm, to check this, type-

ls -al /dev/kvm 

After this command you can see that kvm is under root ownership.

Now type following command to check the which user is under kvm group -

grep kvm /etc/group

This command will give output like -

kvm:x:127:

So, there is nothing after second colon (:), there should be a username after second colon.

So, to add user (your system username) to kvm group, type

sudo adduser <your_system_user> kvm

This command will add you (your system user) to the kvm group.
Once again run the command -

grep kvm /etc/group

Output may be like -

kvm:x:127:your_system_username

Now all done. Re-login/restart  is required to apply the effects.

See all steps screen shot bellow -





Saturday, 30 March 2019

Execute any command/script at system startup in Ubuntu 18.04 (LTS)

Today, after installing Ubuntu 18.04 after a long use of lower version of Ubuntu, I got there is no rc.local file in etc directory. Actually this file is used to start any script at system startup.

So, what to do if it is not available in Ubuntu 18.04?

Just create a file by typing any of given command -

sudo nano /etc/rc.local

or

sudo gedit /etc/rc.local

or

sudo cat /etc/rc.local


and paste the following text in this file -


#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

exit 0



After saving this, make it executable by command -

chmod +x /etc/rc.local


Now you can paste your scripting script in this file.

Sunday, 24 March 2019

Notice: Undefined variable: var in F\wamp\www\project\filename.php in PHP/WAMP

I got the following problem when I was migrating from WAMP server 2 to WAMP Server 3 version in my project.



Code I was written that -

<?php $var=$_GET['ll']; ?> //getting value from another page in a variable

<?php echo $var; ?> //Printing the value on page

This code segment has problem, when my project was developed in WAMP Server 2

I just replace this code segment in WAMP server 3 to resolve this issue.


<?php 
if(isset($_GET['ll'])){
    $var = $_GET['ll'];
}
?>


<?php 
if(isset($var)){ 
    echo $var;
}
?>


Friday, 22 March 2019

How to recover data/databases/tables from mysql in WAMP server.

Suppose you are running WAMP server on your local system and due to bad luck your WAMP server got corrupted or unable to start. You must have created some databases and tables in your MYSQL, then you would be unable to access these data. So, now here question arises that, any how we can get this data/databases/tables and recover our databases and tables.

Answer is "yes".

There might be several ways to recover data, but what I applied was very simple and hassle free. Let see, how I recovered my data.

I have applied this method on WAMP Server 3.1.7 on 64 bit Windows Server 2016.

Copy your old WAMP server data of location your_root_wampserver_folder\bin\mysql\mysql5.7.24\data ( in my case it was D:\wamp64\bin\mysql\mysql5.7.24\data ). Copy either data folder or data of data folder for recovery to any location.

Note:- You can see your all databases name as folder in data folder, you have been previously created.

Now back up your new installed WAMP server MYSQL data folder (location your_root_wampserver_folder\bin\mysql\mysql5.7.24\data) data to any safe location.

 After backing up after data folder of your new system, copy the old data folder to new data folder.

Important :- Both WAMP versions should be same.

Thursday, 21 March 2019

Allow access of WAMP server from another system (Forbidden : You don't have permission to access / on this server.)

When we install WAMP server on new system, if it is installed successfully, it works fine on system, but when we try to access it from another system we got error like-



Let see how it can be resolved ?

For WAMP server > 3

Click on WAMP icon in the tray of icons situated in right hand side of task bar. Then click on Apache -------> httpd-vhosts.conf



httpd-vhosts.conf file will be opened with following text -

# Virtual Hosts
#
<VirtualHost *:80>
  ServerName localhost
  ServerAlias localhost
  DocumentRoot "${INSTALL_DIR}/www"
  <Directory "${INSTALL_DIR}/www/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require local
  </Directory>
</VirtualHost>

Change Requie local line to Require all granted

Now httpd-vhosts.conf will look like -

# Virtual Hosts
#
<VirtualHost *:80>
  ServerName localhost
  ServerAlias localhost
  DocumentRoot "${INSTALL_DIR}/www"
  <Directory "${INSTALL_DIR}/www/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
   Require all granted
  </Directory>
</VirtualHost>

Then save the file and restart the server.

You should also check the colour of WAMP server icon in tray, it should be green.

For WAMP server < 3


If you have installed WAMP server version less than 3, the you have to change in httpd.conf file and search offlineonline tag in the file and replace it from

#   onlineoffline tag - don't remove
    Order Deny, Allow
    Deny from all

to


#   onlineoffline tag - don't remove
    Order Allow,Deny
    Allow from all

and save the file then restart the server.

Another way to resolve it to check that server is offline or online.

Click on WAMP icon in tray and the click on Put Online (See the WAMP icon in Offline Mode and Online mode, there is a change in icon)





Change image source dynamically on hyperlink

 Changing image source dynamically using JQuery. Here in this example I have created there hyperlink and stored all images in the same folde...