miércoles, octubre 19, 2011

Gnome Shell 3: tips and tricks. Clean & fast!

(edited)
*. Auto login into Gnome 3, and set it as default window manager
1. sudo /usr/lib/lightdm/lightdm-set-defaults -s gnome-shell
*. Install classic Gnome and set it as default window manager
1. sudo apt-get install gnome-session-fallback
2. sudo /usr/lib/lightdm/lightdm-set-defaults -s gnome-classic
*. Restore the old-style scrollbars
1. sudo apt-get autoremove --purge liboverlay-scrollbar-*


0. First of all...
1. sudo apt-get install gnome-shell
2. sudo apt-get install gnome-tweak-tool
3. sudo add-apt-repository ppa:webupd8team/gnome3
4. sudo apt-get update

a. Alternative status menu:
sudo apt-get install gnome-shell-extensions-alternative-status-menu

b. Add new themes:
sudo apt-get install gnome-shell-extensions-user-theme

c. Add the workspace indicator:
sudo apt-get install gnome-shell-extensions-workspace-indicator

d. Classic Gnome menu:
sudo apt-get install gnome-shell-extensions-apps-menu

e. Removable drive menu:
sudo apt-get install gnome-shell-extensions-drive-menu

f. Enable system monitor:
sudo apt-get install gnome-shell-extensions-system-monitor

f2. Alternative (even better) system monitor:

sudo add-apt-repository ppa:webupd8team/gnome3
sudo apt-get update
sudo apt-get install gnome-shell-system-monitor
via: http://www.webupd8.org/2011/10/gnome-shell-system-monitor-extension.html

g. Places status indicator:
sudo apt-get install gnome-shell-extensions-places-menu

h. Dock extension:
sudo apt-get install gnome-shell-extensions-dock

i. Enable native window placement:
sudo apt-get install gnome-shell-extensions-native-window-placement

j. Xrandr indicator:
sudo apt-get install gnome-shell-extensions-xrandr-indicator

k. Enable "Auto Move Windows":
sudo apt-get install gnome-shell-extensions-auto-move-windows

l. Gajim extension:
sudo apt-get install gnome-shell-extensions-gajim

m. Enable "Windows Navigator":
sudo apt-get install gnome-shell-extensions-windows-navigator

Source:
http://elsoftwarelibre.wordpress.com/2011/10/11/instalar-gnome-shell-y-gnome-shell-extensions-en-ubuntu-11-10/
http://www.addictivetips.com/ubuntu-linux-tips/how-to-auto-login-to-gnome-in-ubuntu-11-10-tip/

martes, junio 14, 2011

Read a text file line by line in Java

///
/// read the file line by line
///
try {
 BufferedReader in = new BufferedReader(new FileReader(args[0]));
 String str;
 while ((str = in.readLine()) != null) {
  _log(str);
 }
 in.close();
} catch (IOException e) {
}

jueves, junio 09, 2011

Write a text file in Android using the emulator in Eclipse

///
/// check read/write permissions

boolean mExternalStorageAvailable = false;
boolean mExternalStorageWriteable = false;
String state = Environment.getExternalStorageState();

if (Environment.MEDIA_MOUNTED.equals(state)) {
// We can read and write the media
mExternalStorageAvailable = mExternalStorageWriteable = true;
Log.i(TAG,"read + write");
} else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
// We can only read the media
mExternalStorageAvailable = true;
mExternalStorageWriteable = false;
Log.i(TAG,"read");
} else {
// Something else is wrong. It may be one of many other states, but all we need
//  to know is we can neither read nor write
mExternalStorageAvailable = mExternalStorageWriteable = false;
Log.i(TAG,"nothing");
}

///
/// write text file

File testFile = new File(Environment.getExternalStorageDirectory()+"/test.txt");
try{
testFile.createNewFile();
}catch(IOException e){
Log.e("IOException", "exception in createNewFile() method");
}
//we have to bind the new file with a FileOutputStream
FileOutputStream os = null;        
try{
os = new FileOutputStream(testFile);
}catch(FileNotFoundException e){
Log.e("FileNotFoundException", "can't create FileOutputStream");
}

PrintWriter pw = new PrintWriter(os);

pw.println("test");
pw.close();

Log.i(TAG,"wrote in: " + Environment.getExternalStorageDirectory()+ "/test.txt");

viernes, mayo 27, 2011

Install subclipse (subversion) in Eclipse in a few steps

To install Subclipse (subversion) repository plugin in Eclipse, do the following:
  • 1. Open Eclipse
  • 2. Help -> Install new software...
  • 3. Click "Add.."
  • 4. Add this repository (the name does not matter; the URL does):

http://subclipse.tigris.org/update_1.6.x

  • 5. Type "subclipse" in the blank caption to search the plugin
  • 6. Select it and install it

Note that you need internet connection :)

martes, marzo 15, 2011