Thursday, May 24, 2012

IDEA JetBrain intellij

I started using IDEA instead of eclipse ...
First impressions:
I don't like their GUI
I do like their integration with spring/tomcat/everything ...
I do like the fastness in search ...

Some tip for newbies and for ubuntu / linux user:

1) when clicking on Switch-Tab for moving between application, I don't see the IDEA icon.
Solution: http://devnet.jetbrains.net/thread/435242


intellij-launcher.png

Please remove your launcher, start IDEA from a terminal, invoke a Tools | Create Desktop Entry action, exit IDEA, and restart session. After that you'll have a correct main menu entry which displays right icon in a switcher and is pinnable to Unity launcher.






2) Good link for better navigation in IDEA:

like here:

Quick switch of the current scheme

screenshot
There is no need to dig deep into the settings dialogs hierarchy when you need to apply another Color/Code style Scheme, Keymap or even Look and Feel of the application. This can be achieved with a short series of shortcuts. Just press Ctrl + BackQuote and then the number of the scheme to change.

Tuesday, May 22, 2012

Ubuntu background color problem

Periodically, when upgrading Ubuntu, I have this background color problem, where for ex my eclipse open popup with a black color background, so I can't read the tooltip content.

I found a solution here.
In my words:

go to /usr/share/themes/Ambiance/gtk-2.0/gtkrc 
and replace #000000 by #f5f5b5

http://askubuntu.com/questions/70599/how-to-change-tooltip-background-color-in-unity


I had to edit these files:
/usr/share/themes/Ambiance/gtk-3.0/settings.ini
/usr/share/themes/Ambiance/gtk-3.0/gtk.css
/usr/share/themes/Ambiance/gtk-2.0/gtkrc
(Addition: for Ubuntu 12.04, it seems youjust have to modify the file: /usr/share/themes/Ambiance/gtk-2.0/gtkrc , replacing the tooltip backround and foreground color, with the #000000 and the #f5f5b5 color, respectively)
You require root privileges to edit the files. Use sudo gedit to edit them.
Search for tooltip in these files and you'll find the color definitions for the foreground and the background. I use #000000 as foreground and #f5f5b5 as background and now the tooltips in all applications are again readable. After changing the color values simply switch to some other theme and then back to Ambiance and the tooltip color is now fixed.


Thursday, May 17, 2012

VirtualBox VM for linux

I'm using VirtualBox for emulating linux (Centos or Ubuntu).

When creating new VM,  in order to have an external IP:

Click on VM/Settings (when the machine is off ... otherwise, the Setting option is not available)
Network and select Bridged Adapter / etho / Allow All






Then, run the on the VM
ifconfig -a 
in order to see which network card is used . For ex , here we use eth0:



eth0      Link encap:Ethernet  HWaddr 08:2e:5f:32:c6:2b
          inet addr:192.168.23.148  Bcast:192.168.23.255  Mask:255.255.252.0          inet6 addr: fe80::a2e:5fff:fe32:c62b/64 Scope:Link          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1          RX packets:1148454 errors:0 dropped:304 overruns:0 frame:0          TX packets:57473 errors:0 dropped:0 overruns:0 carrier:0          collisions:0 txqueuelen:1000          RX bytes:169648034 (169.6 MB)  TX bytes:9345047 (9.3 MB)          Interrupt:19
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0          inet6 addr: ::1/128 Scope:Host          UP LOOPBACK RUNNING  MTU:16436  Metric:1          RX packets:107277 errors:0 dropped:0 overruns:0 frame:0          TX packets:107277 errors:0 dropped:0 overruns:0 carrier:0          collisions:0 txqueuelen:0          RX bytes:70365858 (70.3 MB)  TX bytes:70365858 (70.3 MB)



Then, run the  dhcpClient in order to make the VM get a new IP address.
dhclient eth0 

In order to get this dhcpClient run after each reboot, go to the file
/etc/sysconfig/network-scripts/ifcfg-eth0

and edit it with the following:


DEVICE="eth0"
NM_CONTROLLED="no"
BOOTPROTO="dhcp"
ONBOOT="yes"




Then, ensure you don't have firewall blocking the connection to this new IP

# service iptables save
# service iptables stop
# chkconfig iptables off

In order to give the new VM a permanent hostname  :

go to file /etc/sysconfig/network
and modify the line:
HOSTNAME=your-vm-desired-name




thanks to http://servercomputing.blogspot.co.il/2011/12/change-redhat-centos-hostname.html 

Once done, I suggest to add this hostname to the /etc/hosts:

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.14.183  your-vm-desired-name


Somehow, my VM centos image didn't include some basic linux centos package.
So here they are:
  •  yum install redhat-lsb
  •  yum install openssh-clients

ReAssign MAC Address

If you decide to assign a new MAC address to your VM (if you clone it, for example), then do not forget to assign it a new external IP by doing the following:

remove content of
/etc/udev/rules.d/70-persisten-net.rules

Then , just reboot your VM machine

This file associates the network card (like eth0, eth1 etc) to the MAC address.

Wednesday, May 16, 2012

Linux tip

I have two monitors and since Ubuntu version 12.04, moving windows from one monitor to the other became 'harder' (well, it's better than before, where moving from one monitor to the other was too easy).
So, I've wrote some script for moving window or mouse cursor from one side to the other:

my script look as following:


file /home/michaelz/util/move-window-to-display.sh
#!/bin/bash
# Copied and inspired from  http://ubuntuforums.org/showthread.php?t=1414155
if [ $1 -eq 2 ]
then
    POS="1700 0"
else
    POS="0 0"
fi
/usr/bin/xdotool windowmove `/usr/bin/xdotool getwindowfocus` $POS
exit 0

I just added to add a Custom Shortcut to my keyboard ( Keyboard / Add Custom) to this script like:


for moving to the left monitor
/home/michaelz/util/move-window-to-display.sh 1 
for moving to the right  monitor (or vice-versa)
/home/michaelz/util/move-window-to-display.sh 2 


For moving my cursor:
To the left:
xdotool mousemove 0 20
To the right:
xdotool mousemove 2000 20