Linux, Ubuntu unmet dependencies problem (32-bit - 64-bit)


Hi,

Recently I have come across tricky issue related to the intalling 32bit version of flash debugger on 64 bit version Ubuntu. Following the previous post related to it:
Flash Player debugger for Linux x64 (How To)

Everything went well up to installation of nspluginwrapper.

     sudo apt-get install nspluginwrapper

End up with the following error:
"""
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 package1 : Depends: package2 (>= 1.8) but 1.7.5-1ubuntu1 is to be installed
E: Broken packages

"""


Before going further, you can try following commands:
sudo apt-get clean;
sudo apt-get autoclean
sudo apt-get -f install
sudo dpkg --configure -a
sudo apt-get -f install
sudo apt-get -u dist-upgrade
sudo apt-get -o Debug::pkgProblemResolver=yes dist-upgrade


If no luck with the above please continue reading below...

First step to resolve is to try compile and build sources manually.
1. download nspluginwrapper
2. ./configure

Result: more errors with missing dependencies.

After few hours of investigation here are the workarounds:
Step 1: Try to install unmet deps automatically
1. sudo apt-get install auto-apt
2. sudo auto-apt update
3. sudo auto-apt updatedb && sudo auto-apt update-local
4. sudo auto-apt run ./configure

Possible errors: some dependencies still cannot be found

Step 2: Try find missing deps manually end install it.
Possible errors: you found it but it cannot be installed because of
impossible situation with unmet dependencies ;)


Step 3: Install ia32-libs
sudo apt-get install ia32-libs
Possible errors: still impossible situation :D

Step 4: Do some hacking:
1. sudo touch /etc/apt/preferences
2. sudo gedit /etc/apt/preferences:
Package: *      
Pin: release a=precise*
Pin-Priority: 2012

3. sudo apt-get dist-upgrade
5. sudo apt-get install ia32-libs


Possible errors: missing multiarch or anything

Step 5: Enable multiarch and try again:
1. echo foreign-architecture i386 | sudo tee /etc/dpkg/dpkg.cfg.d/multiarch
2. sudo apt-get install ia32-libs
// finally OK!
3. sudo apt-get check
4. sudo rm /etc/apt/preferences // can now delete it


Problem was almost fixed for me:
sudo auto-apt run ./configure
Went further but still some unmets and I gave up,

BUT after all above have tried below again:
sudo apt-get install nspluginwrapper

SUCCESS!

I guess above workarounds can be used to install ANY 32 bit package on 64 bit version of Ubuntu or other Linux OS.

Hope that helps.
Cheers!

Eclipse IDE and IntelliJ IDEA shortcuts and tips

Useful and best practice IDE settings include:
  • show line numbers
  • show whitespace characters
  • line delimiter type UNIX
  • encoding UTF8
  • using spaces instead of TABS
  • limit startup plugins / extensions

Eclipse startup and performance settings
1. eclipse.ini - specify custom java location:
-vm
/home/mnoor/jdk1.6.0_45/bin

2. eclipse.ini - performance tweaks:
-XX:MaxPermSize=512m
-Xms128m
-Xmx1024m

IntelliJ startup and performance settings
1. idea.vmoptions - memory settings:

-Xms128m
-Xmx512m
-XX:MaxPermSize=250m
-XX:ReservedCodeCacheSize=64m

2. idea.sh - additional VM args, JAVA location, etc.


Some Common and useful shortcuts:
1. Open class/type:IntelliJ - CTRL+N
Eclipse - CTRL+SHIFT+T

2. Open resource / any file:
IntelliJ - CTRL+SHIFT+N
Eclipse - CTRL+SHIFT+R

3. See documentation:
IntelliJ - CTRL+Q
Eclipse - F2

4. See declaration:
IntelliJ - ALT+Q
Eclipse - F2

5. Navigate to declaration:
IntelliJ - CTRL+B
Eclipse - F3

6. Find usages / references:
IntelliJ - ALT+F7
Eclipse - SHIFT+CTRL+G

7. Refactor / rename:
IntelliJ - SHIFT+F6
Eclipse - SHIFT+ALT+R

8. Implement abstract methods from abstract base class or interface.
IntelliJ - CTRL+I
Eclipse - CTRL+1 -> add unimplemented methods

9. Code completion:
IntelliJ - CTRL+SHIFT+SPACE
Eclipse - CTRL+SPACE

10. Search in files
IntelliJ - CTRL+SHIFT+F
Eclipse - CTRL+H

11. Back to previously edited place:
IntelliJ - CTRL+SHIFT+BACKSPACE
Eclipse - ALT+LEFT, ALT+RIGHT

12. Comments
IntelliJ - CTRL+/, CTRL+SHIFT+/
Eclipse - CTRL+SHIFT+C

13. Navigate to the implementation
IntelliJ - CTRL+ALT+B
Eclipse - CTRL+T

That's it, cheers!


Linux: setting environment variable, e.g. JAVA_HOME

In many situation you need to have some variable set on the system in order to use some applications.
The common are vars like JAVA_HOME or MAVEN_HOME pointing to the corresponding directories.

The main thing you will need to do is to set it as bellow. Additionally you can add it to the current PATH (or rather add its executables) and export updated PATH:

# java home directoy
JAVA_HOME=/path/to/java/home/dir
# additional adding bin executables to the current path
PATH=$PATH:$JAVA_HOME/bin
# exporting the updated path var
export PATH

Now depeding on where will you put above content config will be slightly different:
Option 1. Setting environment vars for user only - this will be set only for the currently logged in user:
gedit ~/.bashrc

Option 2. Setting globally for all logged in users
sudo gedit /etc/bash.bashrc

Option 3. Global at system level regardless if user is logged in or not. This one is probably the best way.
sudo gedit /etc/environment


So I were using Option 1 way until I've come into error running application from the desktop that requires JAVA. If you run it from console it can see the JAVA_HOME, however if run from desktop it does not see it.

Going with the Option 3 and setting variable globally solved that problem!

Cheers!

HTML auto redirect website to a different URL

There are several ways of achieving above...

One of it is using just HTML and editing <HEAD> block in the main index.html (or index.htm) file:

Scenario:
  1. You have website on the server, e.g. www.mywebsite.com
  2. You want to redirect it to any other url location either remote or local to your server website, e.g.
www.mywebesite/folder/page2.html

Try putting the following inside <HEAD> of you index.html file:
<meta http-equiv="refresh" content="0;URL=www.mywebesite/folder/page2.html" />

where value zero (0) means the time before the redirection will take process - in that case immediately.

This is it, cheers!

Dual monitors configuration for Linux

Having problems with setting up multiple screens?

Recently I have come into issue with setting second monitor connected to the laptop.
If standard nVidia setting are not available for some reasons you can use XRandR tool.

The basic use of the command is following:

For HDMI connected device on the left of your screen:

xrandr --output HDMI1 --auto --left-of LVDS1


For VGA output:

xrandr --output VGA1 --auto --left-of LVDS1


You can also provide parameter to set up the resolution of the device, for example:

xrandr --output HDMI1 --mode 1600x1050 --left-of LVDS1


Cheers!

Ubuntu missing window title bars and footers

Hi,

Few times I have noticed after log in to the Ubuntu or XUbuntu system there are no title bars and footers on application windows.

One of the reason can be that xfwm window manager has crashed. You can try restoring it by running the following command:

xfwm4 --display=:0.0 --replace

This did the trick for me.

If it doesn't help try to investigate by view logs of xsession errors available in home directory file .xsession-errors

less ~/.xsession-errors


Hope that helps!

Debug mode timeout and disconnects.

Hi there,

This will be very quick post about tweaking debugging problems in cases of:
  • timeout
  • disconnection
If you debug from you environment standalone desktop application you can just set it in the options of debug configurations. Look for the timeout settings.

If you debug web application running in web browser there is something else you can set to improve it.
For example in Firefox there is special settings site that allows you to configure advanced properties:
  1. In Firefox browser URL field type in: about:config
  2. You should get a warning about risk of changing advanced settings so please continue at your own risk.
  3. Then there are plenty of properties to choose from but we are interesting in increasing timeouts related stuff. You can update following keys:
  • devtools.debugger.remote-timeout
  • dom.ipc.plugins.timeoutSecs
  • dom.ipc.plugins.timeout.secs
  • dom.ipc.plugins.processLaunchTimeoutSecs
  • dom.ipc.plugins.parentTimeoutSecs
  • dom.min_background_timeout_value
  • dom.min_timeout_value

Note for some properties value comes in seconds for others in milliseconds. You will need to experiment a bit with it. Usually setting timeout to -1 means unlimited.


Cheers!