Sunday, April 27, 2014

Make Colorful Folder Icon in Nautilus

Folder Color is a Nautilus extension that allows you to easily change the folder icon color to some predefined colors such as blue, pink, black, yellow, violet, orange, green, grey or red. With a small tweak, the extension also works with Nemo file manager.



Saturday, April 26, 2014

Install and Configure Apache Tomcat in Netbeans Ubuntu

  • If Tomcat is not installed yet, install it first
sudo apt-get install tomcat7
  •  And then configure like this
cd /usr/share/tomcat7
sudo mkdir common
cd common
sudo ln -s ../lib lib
cd ..
sudo mkdir conf
cd conf
sudo ln -s /etc/tomcat7/server.xml server.xml
sudo chmod o+rx /usr/share/tomcat7/conf
  • Open service tab on upper left beside project tab
  • Right click servers, add server
  • Choose Apache Tomcat
  • Browse server location in /usr/share/tomcat7
  • Enter username and password you want, for example I add "admin" for the username and password
  • Open terminal and execute
sudo nano /etc/tomcat7/tomcat-users.xml
  •  Add this on the top of </tomcat-users> 
<role rolename="admin-gui"/>
<user username="admin" password="admin" roles="admin-gui"/>
  • Press Ctrl + O and the enter
  • Type this in terminal 
sudo service tomcat7 restart
  •  Access your apache tomcat from browser in http://localhost:8080 
  • The root web directory located in /usr/share/tomcat7-root/default_root

Install Adobe Reader Ubuntu

  • Get installer here
  • Open the deb with gdebi or software center or dpkg

Friday, April 25, 2014

Source For Adding File System into Linux

10 Super Powerful Linux Commands

We always say that the most powerful Linux tools are its Command lines. This is because you can do about everything right from your command line. You can easily explain your computer exactly what you require and it comes back to you with appropriate results. Infact there are some commands that make this tool even more powerful! Here we bring to you a list of 10 such commands that work like energy drinks for you Linux machines!

Thursday, April 24, 2014

Solving "perl: warning: Setting locale failed" in Ubuntu

It is happen because locale setting needs to be reconfigured. To do that, just type this in terminal
sudo dpkg-reconfigure locales
If it doesn't successfull, try to set locale first
sudo locale-gen en_US en_US.UTF-8
and then type dpkg again.

source

Sunday, April 20, 2014

Install Squid Proxy Ubuntu Server

  • Install Squid
sudo apt-get install squid
  • Set squid to run after startup
update-rc.d squid3 defaults
  • Open squid configuration file
sudo nano /etc/squid/squid.config
  • Add this to the first line of squid.conf to use ipv4 only
dns_v4_first on
  • Press Ctrl+w to search "http_access deny all"
  • clear "#"
  • Search "acl localnet" with Ctrl+w
  • add line "acl localnet src your-ip-public"
  • Press Ctrl+w to search "http_access allow"
  • add line "http_access allow localnet"
  • Press Ctrl+o and then press enter to save edited file
  • restart squid service
sudo service squid3 restart
NB:
  • You can change localnet to whatever you want
  • To change proxy port, search "http_port 3128" and change 3128 with port you want
Source

Friday, April 11, 2014

How Priority Queue in Java is Working

Source Code

  1. import java.util.*;  
  2. class PQ{  
  3.     static class PQsort implements Comparator<Integer>{   // inverse sort  
  4.         public int compare(Integer one, Integer two){  
  5.             return two - one;           // unboxing  
  6.         }  
  7.     }  
  8.     public static void main(String[] args){  
  9.         int[] ia = {1,5,3,7,6,9,8};         // unordered data  
  10.         PriorityQueue<Integer> pq1 =   
  11.             new PriorityQueue<Integer>();     // use natural order  
  12.           
  13.         for (int x : ia)                // load queue  
  14.             pq1.offer(x);  
  15.               
  16.         for (int x : ia)                // review queue  
  17.             System.out.print(pq1.poll() + " ");  
  18.         System.out.println("");  
  19.               
  20.         PQsort pqs = new PQsort();          // get a Comparator  
  21.         PriorityQueue<Integer> pq2 =   
  22.             new PriorityQueue<Integer>(10,pqs);   // use Comparator  
  23.               
  24.         for (int x : ia)                // load queue  
  25.             pq2.offer(x);  
  26.           
  27.           
  28.         for (int x : ia)                // review queue  
  29.             System.out.print(pq2.poll() + " ");  
  30.           
  31.         System.out.println(" ");  
  32.     }  

Saturday, April 5, 2014

Backup and Restore Database MySQL

For backup all databases
  mysqldump -u username -ppassword --all-databases > /tmp/alldatabases.sql
For backup spesific database
 mysqldump -u username -ppassword --databases databasename > /tmp/filename.sql
For restore
mysql -u username -ppassword databasename < /tmp/filename.sql

Friday, April 4, 2014

Instaling Kubuntu Desktop without KDE Application

Just type this in terminal
sudo apt-get install --no-install-recommends kubuntu-desktop

Setting Proxy for apt-get in Ubuntu

  1. Open terminal
  2. Type this
    sudo nano /etc/apt/apt.conf
  3. Add this line if there in no authentication in your proxy
    Acquire::http::proxy "http://proxyserver:port/";
  4. Add this if there is authentication in your proxy
    Acquire::http::proxy "http://username:password@proxyserver:port/";
  5. Press Ctrl+x and then press y