The best place to *find* answers to programming/development questions, imo, however it's the *worst* place to *ask* questions (if your first question/comment doesn't get any up-rating/response, then u can't ask anymore questions--ridiculously unrealistic), but again, a great reference for *finding* answers.

My Music (Nickleus)


what i configure and install immediately after a new, clean install of ubuntu

the following is for ubuntu 12.04:
(UPDATE 20130523: updated now for ubuntu 13.04)

note: the first step in each point is done by hitting the super key (windows icon). the unity search bar will pop up at the top left, then just type the text, e.g. additional drivers


* install amd video drivers (sony vaio vpcse)
additional drivers > select ati/amd proprietary fglrx graphics driver > activate

if you're configuring ubuntu 13.04, then just use the default video drivers, you don't need the proprietary ones

but if you want to find the video driver configuration it is here instead (ubuntu 13.04):
software & updates > additional drivers

* (OPTIONAL) disable tapping
mouse and touchpad > touchpad > (uncheck) enable mouse clicks with touchpad

* keyboard shortcuts
keyboard > shortcuts > Launchers >
launch web browser: ctrl+super+i
home folder: ctrl+alt+h

* terminal
Edit > Profiles > Default > Edit
scrolling >
scrollback: unlimited
scrollbar is: on the left side

* (OPTIONAL) copy over backup files from backup server/usb stick
after doing this, i move/merge the following folders into my Library folder:

my Home folder looks like this:

Library has all my favorite/important documents/files in it and looks like this:
├── art
│   ├── halloween
│   ├── interiordecorating
│   ├── Music
│   ├── Pictures
│   ├── tattoo
│   └── Videos
├── Documents
│   └── work
├── fighting
│   ├── military
│   └── weapons
├── language
├── legal
├── media
│   └── advertising
├── money
├── Nickleus
│   ├── music
│   ├── my_art
│   ├── poetry
│   └── www
├── philosophy
│   ├── atheism
│   ├── superstition
├── politics
├── science
│   ├── animals
│   ├── astronomy
│   ├── chemistry
│   ├── cryptography
│   ├── curiosity_mars
│   ├── dinosaurs
│   ├── evolution
│   ├── health
│   ├── psychology
│   └── radiation_files
└── sexuality

there are a lot more sub folders, but the list would be too long here.

* disable system sound effects
Sound > sound effects > alert volume: mute

* firefox
make firefox start with previous open tabs:
edit > preferences >  general > startup > when firefox starts: show my windows and tabs from last time

close download window after download finished:
edit > preferences >  general > downloads > check close it when all downloads are finished

setup sync (i haven't done this before so it might be a different choice next time, like Pair a Device):
edit > preferences > sync > set up firefox sync

configure searching and selecting text:
edit > preferences > advanced > general > accessibility
check always use the cursor keys to navigate within pages
check search for text when i start typing

* increase bash history size
nano -w .bashrc

change this:

to this:

update bash with the newly edited bashrc file:
source .bashrc

* configure unity launcher
appearance > behavior
auto-hide the launcher: ON
reveal location: top left corner

* turn off auto-dim
brightness and lock > brightness > uncheck dim screen to save power

* clock
click the clock in the system tray (top right) > time and date settings > clock
check weekday
check date and month
check 24-hour time
check seconds
check include week numbers

* disable ayatana (virtual) scrollbar
to get the normal scrollbars back, run this in a terminal:
gsettings set org.gnome.desktop.interface ubuntu-overlay-scrollbars false


* first, make sure your sources list is updated
sudo apt-get update

* nautilus right click "open in terminal"
sudo apt-get install nautilus-open-terminal

(note: you have to log out then log in again to get it to work)

* install geany text editor
sudo apt-get install geany

make it the default text editor:
sudo apt-get install gksu
gksudo gedit /usr/share/applications/defaults.list

search+replace to change all instances of gedit to geany, i.e.:



(thanks to the post "HowTo Change Default GNOME Text Editor or Any Other Default Program" for the tip)

why Geany? native regular expressions (regex) support

* install vlc
sudo apt-get install vlc

make it the default video player:
details > default applications > video > vlc media player
set music to vlc media player too, while you're there

* install java
jdk (i'm a developer):
sudo apt-get install openjdk-6-jdk

firefox plugin:
sudo apt-get install icedtea6-plugin

* filezilla
sudo apt-get install filezilla

if you want to import your list of sites you usually use, then the file you need to get from your old ubuntu version is:

* archive support
sudo apt-get install p7zip-rar

it will install both 7zip and a rar module

* art
sudo apt-get install inkscape gimp gimp-data-extras

* (OPTIONAL) audio editing/music production
sudo apt-get install audacity lmms ams caps cmt fil-plugins invada-studio-plugins-ladspa rev-plugins swh-plugins tap-plugins calf-plugins alsa-utils

i had no sound after my install so i had to start alsamixer in a terminal then set Auto-Mute to Disabled

then i restarted pulseaudio and i got sound back:
sudo killall pulseaudio

* (OPTIONAL) additional browsers
sudo add-apt-repository "deb stable non-free"
wget -qO - | sudo apt-key add -
sudo apt-get update
sudo apt-get install opera

once i got a weird error during "update":
W: Failed to fetch  Unable to find expected entry 'non-free/source/Sources' in Release file (Wrong sources.list entry or malformed file)
E: Some index files failed to download. They have been ignored, or old ones used instead.

to fix this i had to manually edit the sources.list file:
sudo nano -w /etc/apt/sources.list

and comment out the following line:
# deb-src stable non-free

then run a new update and install again:
sudo apt-get update
sudo apt-get install opera

UPDATE 20130523:
for ubuntu 13.04, i got the following warnings:
WARNING:softwarecenter.db.update:The file: '/usr/share/app-install/desktop/sonic-visualiser:x-sonicvisualiser-layer.desktop' could not be read correctly. The application associated with this file will not be included in the software catalog. Please consider raising a bug report for this issue with the maintainer of that application
WARNING:softwarecenter.db.update:The file: '/usr/share/app-install/desktop/workrave:workrave.desktop' could not be read correctly. The application associated with this file will not be included in the software catalog. Please consider raising a bug report for this issue with the maintainer of that application

Software catalog update was successful.
Processing triggers for hicolor-icon-theme ...
Setting up opera (12.15.1748) ...
update-alternatives: using /usr/bin/opera to provide /usr/bin/x-www-browser (x-www-browser) in auto mode

update-alternatives: using /usr/bin/opera to provide /usr/bin/gnome-www-browser (gnome-www-browser) in auto mode
Updating software catalog...this may take a moment.

Software catalog update was successful.

but opera got installed and i could run it, so it wasn't a problem.

* (OPTIONAL) fonts
i maintain a folder full of fonts i like in Downloads/nicks-fonts.
sudo cp -r ~/Downloads/nicks-fonts /usr/share/fonts/truetype/

* (OPTIONAL) torrent
become a leecher (no uploading)
transmission > edit > preferences > speed > speed limits > check upload and set value to 0

* (OPTIONAL) firefox delicious add-on

* skype
sudo add-apt-repository "deb $(lsb_release -sc) partner"
sudo apt-get update && sudo apt-get install skype

* setup network printer and scanner

* (OPTIONAL) install Download Flash and Video firefox plugin

more tips here (it's easier for me to just tag things using delicious browser plugin:


how to download cnn flash video

i found this video interview by CNN of Ballard about Romney:

to download that video you need to install this plugin in firefox (Download Flash and Video):

start playing the video in the browser then click the icon in the browser toolbar and choose the .flv video at the bottom.

ubuntu nautilus error can't delete non-empty folder

i have a folder here:

but when i try to delete it in nautilus i get an error like:
error can't delete non-empty folder / the directory is not empty

(i don't remember the exact wording)

to fix this i forced a disk check at the next reboot:
sudo touch /forcefsck
sudo reboot

after the reboot and disk check, i tried deleting this folder:

but got the same error. then i navigated all the way into this folder:

then showed hidden files (Ctrl+h)
then deleted the innermost folder and it deleted! then i stepped up to each consecutive parent folder and deleted them along the way until i got back up to:

and i was able to delete that one as well =)

quick way to add a program link to the unity launcher sidebar in ubuntu 12.04

it is totally ridiculous that it is so difficult to add an application to the unity launcher or sidebar.

solutions i found today involve editing .desktop text files or install additional software like gnome-panel, but the simplest way to do it is this:
1. start the program manually
2. go to unity's launcher sidebar
3. there will be an icon for the program you just started (it might or might not have an image file, if not, it will just look like a question mark "?")
4. right click on the icon and choose Lock to launcher


how and where to manually install eclipse in ubuntu 12.04

some people say to install optional programs in /opt
some people say to install them in /usr/local

i'll show you how to install them in /usr/local because applications there don't get overwritten by updates.

1. get eclipse, download it (e.g. Eclipse IDE for Java EE Developers, Linux 64-bit) and unpack it (nautilus > right click on file > extract here)
let's assume the unpacked folder is here:

you is your user's home directory, a.k.a. ~/

2. move eclipse to /usr/local:

sudo mv ~/Downloads/eclipse /usr/local/

3. create a simlink for the eclipse executable in the /usr/local/bin folder:
sudo ln -s /usr/local/eclipse/eclipse /usr/local/bin/eclipse

we do this so that when we enter the run dialog (Alt+F2), we can just type eclipse and hit enter, to start eclipse

you can, additionally, add a link to the unity launcher if you prefer to start it that way.


subclipse (svn) asking for username password all the time in eclipse

one of our programmers had a problem in eclipse where every time she did anything related to svn, it would ask her for her username and password, even if she chose to "remember password". it wouldn't remember the password.

to fix this i simply deleted the subversion folder in the home folder:

now open a terminal and list the remote repository, e.g.:
svn list

accept permanently

if the wrong username comes up when subversion asks you to identify yourself just hit "Enter" and you can type in the correct user name.


My minimal plugin configuration a clean install of eclipse juno

When doing a clean install of Eclipse, I need at least the following plugins:

Subclipse (SVN)

Help > Install New Software > Website:

click Add

Expand "Subclipse" and check the following "Required" plugins:
* Subclipse
* Subversion Client Adapter
* Subversion Native JavaHL Library Adapter

New > SVN > Checkout projects from SVN > Create a new repository location
(enter your project's SVN URL)

Jboss Tools JSF

Help > Eclipse Marketplace > search for "jboss jsf" > click "install" on "jboss tools (indigo)" > unselect everything, then select only "jboss tools jsf".

it will additionally install the following requirements:
* jboss tools common
* jboss tools java standard tools
* jboss tools visual page editor

then you have to enable JSF capabilities:
right click on your project > Configure > Enable JSF Capabilities
in Juno, it will open Project Facets properties. at least the following facets should be checked:
Dynamic Web Module
JavaServer Faces

on my machine there was a red X at the bottom of the window with a link to additional configuration required. click on it.

my jee application has the following configuration:
context root: myProject
content: WebContent

myProject is the name of your project

click Next

Type: User Library

click the icon at the right for Manage Libraries
click New
call it JBoss Tools JSF 1.2
click Add External Jars
to find where the JBoss Tools JSF plugin installed JSF 1.2 jars we do this in a terminal:
sudo updatedb
locate jsf-api.jar

you'll see an entry that looks like this:

so in the Add External Jars dialogue, navigate to the parent folder lib, and add both these jars:

in the dialogue Modify Faceted Project > JSF Implementation Library
check your new user library JBoss Tools JSF 1.2

uncheck Include libraries with this application (i.e. we don't want the jsf libraries to get copied to WEB-INF/lib at publish time--they're already in jboss, here: /path/to/jboss/server/default/deploy/jboss-web.deployer/jsf-libs/ )

uncheck Configure JSF servlet in deployment descriptor (we had already done it in our project, if you haven't, then leave this checked)

Note: jboss tools indigo is anticipated to work on juno

Note: i had to restart eclipse for the jsf capabilities to start working.

JRebel (optional, but very effective--fewer server restarts)

Help > Eclipse Marketplace > search for "JRebel" > install "JRebel for Eclipse"

after the install you'll be directed to the JRebel Config Center Activation page. click the Evaluate link. it will open a new browser tab/window where you can apply for a free/trial activation code. fill out the form then copy the generated key and paste it into the eclipse window where it says Paste your license code below.

Eclipse Web Developer Tools (optional, but very useful--format code with correct indentation, etc)

Help > Install New Software > Website:
The Eclipse Web Tools Platform (WTP) software repository -

Expand "Web Tools Platform (WTP) 3.4.0" and check "Eclipse Web Developer Tools"

on my machine i got the following message when installing this:
"Eclipse Web Developer Tools" is already installed, so an update will be performed instead.


eclipse subclipse svn: Couldn't perform atomic initialization

i tried committing something to svn today from eclipse and got the following error:
svn: Couldn't perform atomic initialization

the only way i could temporarily get around this was to open the project folder in a terminal and run cleanup and then update:
me@mylaptop:~/workspace/myProject $ svn cleanup
me@mylaptop:~/workspace/myProject $ svn up

it's weird, but running "up" actually committed the files i previously tried to commit inside eclipse.


java Pattern.compile regex with "greedy quantifier" "at least n but not more than m times" curley brackets {}

X{n,m} == "greedy quantifier"
X, at least n but not more than m times
full implementation of email regex validation:
practical implementation:

so here's what i came up with:
if (!Pattern.compile("[A-Za-z0-9\\._\\-]+\\@[A-Za-z0-9\\-]+(\\.[A-Za-z0-9\\-]+)*(\\.[A-Za-z]{2,})").matcher(mail).find()){
throw new ValidatorException(new FacesMessage("Invalid email."));
i ended up choosing "X, at least n but not more than m times".
here are examples of valid emails checked against my regexp above: