Changing default root ditectory in Apache Web Server and avoiding 403 permission denied error
Most of the web servers are powered by Apache. When you are doing development in your machine you may wish to change the default root directory of you Apache web server.
When you install Apache, by default root directory will be most likely /var/www. But you might want to change this location to a secondary partition on your hard disk. Say a localtion /
Follow the steps given here:
- Locate your httpd.conf, open it in write mode.
- Find line with text something like this
- Change it to
- Similarly locate for
- Comment everything else inside these 2 lines.
Only thing you need is this line:
Require all granted
Now start the apache server and try to load index.html which is located in your web root(it can be any .html file) by typing this in your browser
If you get an error saying “You do not have the permission to access this folder”, it may be caused by this.
Users’ home directories are assigned 700 (drwx———) permissions by default. Therefore, the web server, which is running under “http”, is unable to access your home directory. Change your home folder’s permissions to allow access to the web server (755 maybe).
Placing text over an image - Android UI
If you are trying to align some text over an image and finding it difficult with
RelativeLayout and any other ways, just do this. Use a
You can change the location of text over image by just changing
android:gravity attribute of the
The below code which I found in stackoverflow.com places some text over center of an image.
PS: This only works inside
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/relativelayout" android:layout_width="match_parent" android:layout_height="
match_parent” > <ImageView android:id=”@+id/imageView” android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/imageSouce" /> <TextView android:id=”@+id/imageViewText” android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft=”@+id/myImageView” android:layout_alignTop=”@+id/myImageView” android:layout_alignRight=”@+id/myImageView” android:layout_alignBottom=”@+id/myImageView” android:layout_margin="1dp" android:gravity="center" android:text="Hello" android:textColor="#000000" /> </RelativeLayout>
Backup and restore your unrooted android device using ADB
If you want to backup your android device to a PC, but do not want to root it, here is a simple solution for that.
"No need to have super user privilege to carry out backup and restore operation "
First attach your device to computer. Select MTP as transfer protocol.
Enable USB debugging on your device by going to Settings -> Developer options.
You need to have Android SDK installed in your director, so that you can use adb to backup all your data to your computer had disk.
Open Terminal in your computer and run
$ adb backup -all -apk -shared <backup-file-name>.ab
Your device will ask you to enter a password, please do it.
This will backup all your phone data, including app data and data stored in SD card into a file called <backup-file-name>.ab
You can run adb from anywhere if directory where it is located is added to path variables. Otherwise you have to navigate into that directory and run adb from there.
Similarly, to restore the backup data to your device, follow the following steps.
Attach your device to computer and run $ adb devices from computer terminal to check whether device is online or not.
If all goes well, move to directory where <backup-file-name>.ab is located and run
$ adb restore <backup-file-name>.ab
If you want to backup your device to cloud, you can use an app called Helium which is developed by ClockworkMod developers.
Watch this TV ad. One of the coolest ever !