28th
JUL

Clean up the Ubuntu

Posted by admin under Linuxi:

 

Install the Debian menu to make all installed applications

Missing Icons & Fix Broken Icons

sudo apt-get update
sudo apt-get install menu menu-xdg
update-menus

 

Keeping Ubuntu clean

Install deborphan with command:
sudo apt-get install deborphan

To delete unnecessary libraries just execute:
sudo deborphan | xargs sudo apt-get -y remove --purge

To delete unnecessary data

packages use command:
sudo deborphan --guess-data | xargs sudo apt-get -y remove --purge

To see all

packages which aren’t required by any others use command
deborphan --guess-all

There is another tool to delete orphaned

packages, it’s  GtkOrpha:
sudo apt-get install gtkorphan

Once it’s installed go to System –> Administration –> Remove Orphaned

Packages, enter your password and proceed with cleaning up.

Another nice tip is to clean partial and orphaned

packages by commands:
sudo apt-get autoclean
sudo apt-get autoremove

21st
MAY

increase the screen resolutions

Posted by admin under Linuxi:


Enter in root terminal:
$ sudo dpkg-reconfigure -phigh xserver-xorg

Select your video card by scroll up or down keys on your keyboard) and then hit enter.
the next select the resolutions that you would like to be available for Ubuntu by using the arrow keys to scroll up and down, and the Space Bar to select them.

Restart X by clicking Control+Alt+Delete (backspace). to set up new resolutions.

This starts the Xorg config process.

sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf_backup
sudo dpkg-reconfigure xserver-xorg
sudo xinit — :2

Look for errors:

tail -f /var/log/Xorg.0.log

Restart all servers by bouncing XDM (or gdm or kdm):

sudo /etc/init.d/xdm start

This starts a new X server — usually on tty8 or tty9 (CTRL-ALT-F8). You can go back to the original X server by pressing CTRL-ALT-F7.

9th
OCT

Java Tips

Posted by admin under Linuxi:

Convert Map to ArrayList:
Map hashmap = new HashMap () ;
hashmap.put ( “one”,new Integer (1) ) ;
hashmap.put ( “two”,null ) ;
hashmap.put ( “three”, new String (“THREE”) ) ;

aList = new ArrayList ( hashmap.values () ) ;

System.out.println ( “The size of HashMap = “+hashmap.size () ) ;
System.out.println ( “If hashmap empty = “+hashmap.isEmpty () ) ;
System.out.println ( “The value for the \”three\” key =”+hashmap.get (“three”) ) ;
hashmap.remove ( “two” ) ;

Set set= hashmap.keySet () ;
Iterator iter = set.iterator () ;
int i=1;
while ( iter.hasNext () ) {
System.out.println ( ” “+i+” ) “+hashmap.get ( iter.next () ) ) ;
i++;
}

OR:
for (Iterator iter = hashmap.keySet().iterator(); iter.hasNext();)
{
KeyType element = (KeyType) iter.next();
ValType value = (ValType)hashmap.get(element);
}

hashmap.clear () ;

Use for-each loop through Map entry set:
Map hashmap = new HashMap () ;
for ( Map.Entry pair : hashmap )
{
System.out.println ( pair.getKey () + ” :: ” + pair.getValue () ) ;
}

Use ArrayList:
ArrayList arraylist = new ArrayList () ;

arraylist.add ( “india”,”", new String(“three”),null,”new Integer (1) ” ) ;
arraylist.add ( new Float (3.5) ) ;
arraylist.add ( 1,dummy ) ;

Add array Elements to the arraylist:
String array [] = { “foo”,”",”tow”,null,”new Integer (1) ” } ;
for ( int i=0;i < array.length;i++ )
{
arraylist.add ( i,array [i] ) ;
}

for ( int i=0;i < arraylist.size () ;i++ )
{
System.out.println ( ” “+ ( i+1 ) +” ) “+arraylist.get ( i ) ) ;
}

System.out.println ( “The size of arraylist =”+arraylist.size () ) ;
System.out.println ( “The arraylist is Empty? =”+arraylist.isEmpty () ) ;

Set the element at position one:
arraylist.set ( 1,”J2EE Programmer” ) ;

Converts arraylist to array:
Object array [] = arraylist.toArray () ;

for ( int i=0;i < array.length;i++ )
{
System.out.println ( ” “+ ( i+1 ) +” ) “+ array [ i ] ) ;
}

String value = “FOO”;
if ( “FOO”.equals(value) ) {
// do something
}

substring in Java
returnString = (xmlString.substring(xmlString.indexOf(“<ns1:queryReference>”) + 20, xmlString.indexOf(“</ns1:queryReference>”)));