26/04/2014

[Linux] Replace Unity with another desktop environment

If you too feel like Unity is a nightmare and would like to switch to another desktop environment, but do not fancy to reinstall everything from scratch, know that it's indeed possible to switch between multiple installed ones at login time, although it's not recommended to have more than one installed.

This example will show how to convert Ubuntu(Unity) in XUbuntu(Xfce), but can be adapted to any desktop environment you like (simply install the desired environment instead of xubuntu-desktop).

First, install XUbuntu desktop:

sudo apt-get install xubuntu-desktop

Now if you log out, before you log in, you'll be able to select which desktop environment you want to log in to by clicking on the Ubuntu logo and selecting another session (ie: XUbuntu Session).

If you wish to remove the old environment to clean things up a little, run:

sudo apt-get remove activity-log-manager-common compiz compiz* gnome-applet* gnome-bluetooth gnome-control-center gnome-desktop* gnome-pane* gnome-power-manager gnome-screensaver gnome-screenshot gnome-sessio* gnome-shell-common gnome-termina* gnome-user* hud libzeitgeist* nautilus overlay-scrollba* python-zeitgeist unity unity* zeitgeist zeitgeist*

Afterwards, you may also want to run:

sudo apt-get autoremove

and if you have installed deborphan:

sudo orphaner --purge

[Linux] Xfce change show desktop keyboard shortcut

Trivially, this setting can be found under System Settings->Window Manager->Keyboard shortcuts, then just double click on a shortcut to input the new one. The default value is CTRL+ALT+D.

However, it may happen that the shortcut associated with the "Minimize all open windows and show desktop" behaviour does not work after logging out of the session or restarting the PC.

It is possible to fix this issue by manually editing the configuration in .config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml

Look for the line containing show_desktop_key as value and alter it suiting your needs. For example, to set the shortcut as Super+D, use:



Note that the "show desktop" behaviour differs from the standard in Xfce. Usually, after minimizing everything then opening a new window and minimizing everything again, you'd see the desktop. In Xfce instead, the minimization is treated as a toggle so the second time you minimize everything, you're actually bringing all the previously minimized windows back up.

You can verify this by adding the "show desktop" button to the panel, then toggling the shortcut and seeing that the button is depicted as pressed and stays that way until you toggle the shortcut again.

[XUbuntu] Disable guest session

To disable the guest session in XUbuntu, simply run:

sudo sh -c 'printf "[SeatDefaults]\nallow-guest=false\n" >/usr/share/lightdm/lightdm.conf.d/50-no-guest.conf'

this was tested under release 14.04 LTS.

To enable it again, either delete that file or remove the allow-guest=false line from it.

You may have to log out and log in again to see the changes applied.

[Linux] Xfce set Chrome as default browser

So, you installed Google Chrome (not Chromium) on your machine and set it as default browser from its menu but even if it's the only installed browser, you see Xfce not using it as the default one:

exo-open --launch WebBrowser

asks you to specify the default browser instead of launching it, and if you set it, Chrome complains he's not the default every time you open it.

You may work around the issue by changing the preferred application for the browser:

gksu xfce4-settings-manager

and setting the default browser as:

/usr/bin/google-chrome "%s"

then ignoring Chrome's complaint.


[Linux] Xfce not showing all apps in the menu

When using Xfce as your desktop environment, you may notice that some installed applications are not listed in the main menu while other desktop environments indeed show them.

What happens is, if one of the application categories is Settings, then it won't show up under the main menu and will be listed under the Settings Manager application, accessible from the main menu. After opening it, you'll see those unlisted applications available.

After editing the application categories by altering its .desktop file, you'll see it listed under the main menu as well.

[Linux] Add/remove PPA repositories

You can easily add and remove PPA repositories to your software sources with the apt-add-repository command. Use:

sudo apt-add-repository ppa:USER/REPOSITORY

to add and:

sudo apt-add-repository -r ppa:USER/REPOSITORY

to ONLY remove (same as --remove) it. Alternatively, if you installed ppa-purge, you can use it to remove the repository AND (if possible) revert to the official packages:

sudo ppa-purge ppa:USER/REPOSITORY

[Linux] Install VMWare Player

After downloading VMWare Player for Linux, you may feel a bit stuck on how to install it. Luckily, it's as easy as:

gksudo bash PATH_TO_DOWNLOAD_LOCATION/VMware-Player-VERSION.bundle

If you do not have gksu, install it:

sudo apt-get install gksu

19/04/2014

[Oracle] Get user's tablespace quota

To check the current quota status for user's tablespaces, run this query on DBA_TS_QUOTAS:

SELECT tablespace_name, username, ROUND(bytes/1024/1024) MB, ROUND(max_bytes/1024/1024) MAX_MB 
FROM dba_ts_quotas;

remembering that you will need the grants to access it

[TIBCO ActiveSpaces] Implement shared_all persistence

TIBCO ActiveSpaces supports persistence to a DB of your choice when spaces are configured in shared_all persistence mode.

By implementing the Persister interface in Java, C or .NET, you are able to create a persistence client that connects to your DB and joins the metaspace, receives callbacks on AS events and handles persistence to and from the DB.

You can download a code sample in Java (DISCLAIMER: NOT PRODUCTION READY, just a sample!) showing you how to create the persistence client to an Oracle DB.

[Oracle] Get DB tables size in MB

To have an idea of how much space your Oracle DB tables occupy, you may run this query on ALL_TABLES:

SELECT owner, table_name, num_rows, ROUND((num_rows*avg_row_len)/(1024*1024)) MB 
FROM all_tables;

Remember that it is accurate only if you gathered statistics before:

DBMS_STATS.GATHER_SCHEMA_STATS('your_schema_name');

Usually you could have the grants to query it but a more precise query, would be to query DBA_SEGMENTS, which would require you to have additional grants:

SELECT segment_name, segment_type, ROUND(bytes/1024/1024) MB
FROM dba_segments
WHERE segment_type='TABLE'
AND segment_name='your_table_name';

and will include also the data currently in the bin. If you want to ignore it, query DBA_EXTENTS instead


05/04/2014

[CentOS] Install Oracle XE

Unlike on Windows, installing Oracle XE on CentOS requires some more steps after the actual RPM installation.

After you download the zip file, extract it and install the RPM, browse to the Disk1 directory under the folder where you extracted everything into.

Now run as root

/etc/init.d/oracle-xe configure

to configure and start the database.

The installation process creates a /u01 folder, inside it, under app/oracle/product/VERSION_NUMBER/xe/bin you'll find the oracle_env.sh script which sets some environment variables used by Oracle for you.

To have it permanently set those variables for your user, add this line to your .bash_profile (found under your user home):

. /u01/app/oracle/product/VERSION_NUMBER/xe/bin/oracle_env.sh

After this, you should be able to run SQLPlus (you may have to log out and log in again or just open a new terminal window).

[Linux] Purge unwanted locales on RPM installation

When installing RPM packages on Linux, you'll also install a lot of unneeded locales - there are only so many languages you can speak.

To avoid installing all locales every time, you can specify the ones you're interested in inside the /etc/rpm/macros.lang file (example for English UK and Italian):

%_install_langs   en:it:en_GB:en-GB:it_IT:it-IT

this will apply only to newly installed RPMs.

[CentOS] Browse folders in same window

CentOS comes out of the box with the uber-annoying setting to open each folder in a new window; this makes the screen really messy very fast as you browse the filesystem.

To have it always use the same window when opening new folders, just alter this setting:

Edit->Preferences->Behavior->Always open in browser windows

Then log out and log in again