Saturday, November 9, 2013

Linux - Make pen drive as RAM

 Linux - Use a USB drive as RAM

Actually I am going to clear it first that it does not increase your RAM memory, the process is used for improved performance by cpu using increased swap space but it works same as increased RAM.

It increases your swap space of the system according to size of your pen drive. Suppose you have given 2GB swap space in your system and now you use 8GB pen drive for increased swap space, it shows total swap space around 10 GB.

Follow the process to increase performance of your system.

First make sure that your pendrive is empty and there is no necessary data in it otherwise it will be lost.
Find the device name of your pendrive using command

fdisk -l
In my case, it is /dev/sdb1
 
Now unmount the pendrive using

sudo umount /dev/sdb1
Create swap partition using

sudo mkswap /dev/sdb1
Make it enabled using
sudo swapon -p 32767 /dev/sdb1
32767 is the priority,  The maximum priority can be 32767 and the lowest 0.

To see if swap space is increased or not, Run following command
cat /proc/swaps

If you need to take the pendrive out, do the safety removal process using

sudo swapoff /dev/sdb1
Now you can remove your pendrive but it will not be detected, you need to format it in fat32 or NTFS (in any familiar partitions)
Now pen drive will not be detected, format it again in fat32 using

mkdosfs -F32 -v -n "" /dev/sdb1/span>

Now pendrive will be detected again.

Note :
Swapping is necessary for two important reasons. 

First, when the system requires more memory than is physically available, the kernel swaps out less used pages and gives memory to the current application (process) that needs the memory immediately. 

Second, a significant number of the pages used by an application during its startup phase may only be used for initialization and then never used again. The system can swap out those pages and free the memory for other applications or even for the disk cache. 

Tuesday, October 8, 2013

Netbeans - Choose Project Please Wait Error

Netbeans does not load php projects.
Netbeans - ' Scanning Projects ' Process Hangs




If you are not able to add projects in Netbeans. Whenever you want to add, it sticks on 'choose project' status.

Nebeans requires Java (jdk) to start and use. The problem is because you have installed openjdk , If you install oracle java, you will not face this problem.

Click here to see how to install Oracle Java or if you are using Ubuntu, click here.
Now open Netbeans.

But

If you are facing problem to install Oracle Java or the process is very Lengthy, this post is for you.

Follow these steps and you will get rid off this Netbeans issue.

If you have installed openjdk-6 or openjdk-7, just leave it, do not remove it.

Download complete package of netbeans with oracle java from here
If you are using 32 bit system, download the file Linux x86 or if you have 64 bit system, download the file Linux x64

Now you have to execute this file, 
Run following command to execute this file :
# sh /path/of/downloaded/sh-file.sh
Complete the wizard.

Note :
If above command gives you permission denied error, it means your downloaded sh file is not executable, make it executable using
chmod a+x /path/of/downloaded/sh-file.sh
When Netbeans will be installed, Open Available Plugin tab and Install php plugins from it.

Now you are ready to use Netbeans for PHP projects without getting "choose project please wait" error.

Saturday, September 28, 2013

Fatal error: session_start(): Failed to initialize storage module: files (path: ) in /usr/share/phpmyadmin/libraries/session.inc.php on line 81

 Fatal error: session_start(): Failed to initialize storage module: files (path: ) in /usr/share/phpmyadmin/libraries/session.inc.php on line 81

Solution : 1
Add the parameter in the file php.ini
session.save_path = "/tmp"
Restart apache.

Solution : 2
If you are using Debian or Ubuntu and you have tried solution : 1 and  it still shows above error, remove following lines from /etc/phpmyadmin/apache.conf
<IfModule mod_php5.c>
AddType application/x-httpd-php .php
php_flag magic_quotes_gpc Off
php_flag track_vars On
php_flag register_globals Off
php_admin_flag allow_url_fopen Off
php_value include_path .
php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/
</IfModule>

Now restart apache2 & mysql and try again.