Friday, July 12, 2013

Eclipse + P4 plugin hangs on start

If Eclipse with installed Perforce (P4) plugin hangs on start trying to load a workspace and in WORKSPACE/.metadata/.log you see something like this repeating again and again:
============
!ENTRY com.perforce.team.core 4 0 2013-07-12 17:17:31.375
!MESSAGE Perforce password (P4PASSWD) invalid or unset.
============

This simple action may help - just remove if exists ".p4tickets".
On Linux:
rm ~/.p4tickets

On Windows:
del C:\Documents and Settings\<username>\p4tickets.txt

Solution was found here: http://osdir.com/ml/version-control.perforce/2005-12/msg00125.html

Tuesday, July 3, 2012

Open "*.docx" files as MS Word files by MS IE 8.0


Users of Microsoft Internet Explorer may face this weird issue - try to download or open any "*.docx" or "*.xmlx" file from any site in Internet and you'll see it opens as zip archive!
Well, and this is because MS employees involved in different projects have no idea about other projects within MS MS IE has this nice feature "Open files based on CONTENT, not FILE EXTENSION".  So just guess where to disable this USEFUL feature and you're good to go.

If you're not that smart (as I am for example) you may read through this step-by-step guidance:

If using IE8, you need to disable Opening files based on content rather than extension. Instructions -
1. In the upper-right corner of IE8, click on Tools to open the drop down menu;
2. At the bottom of the Tools menu, click Internet Options;
3. In the Internet Options dialog box, select the Security tab;
4. On the Security tab, select the Internet zone, then click the Custom Level button;
5. Scroll about 2/3 down the list to the option “Open file based on content, not file extension” and change the setting to Disable;
6. Click OK;
7. Repeat steps 4-6 for the Local Intranet zone and Trusted Sites zone;
8. Click OK;
9. Close all instances of IE8;
10. Reopen IE8 and it should now recognize Office 2007 and 2010 file extensions when saving email attachments.

The most funny part is any other browser on Earth opens files in question in proper application (MS Word or Libre/OpenOffice Writer) by default.

This issue has been known for years now and still MS ignores it. Well, it's their decision.

Friday, June 8, 2012

mount sshfs with access for all users

sudo sshfs user@host:/path mount_path -o allow_other

Add user in "vboxsf" group to access VirtualBox shared folder in Ubuntu guest

On Debian (Ubuntu and a like):
sudo adduser <username> vboxsf

On RedHat (CentOS):

sudo usermod -a -G vboxsf <username>

Monday, January 16, 2012

Slow boot of Ubuntu into Unity 3D with proprietary nVidia drivers


I have Ubuntu Oneiric Oncelot 11.10 with proprietary nVidia (nvidia-current: 290.10-0ubuntu1~oneiric~xup1) drivers.

And there're 2 things I'm tired of:

  1. Slow boot. Mostly a black screen after nVidia drivers are already loaded.
    It turned out it lasts more then a minute (73 seconds for example, compared to booting into Unity 2D - 38 seconds).
  2. Slow wake-up from suspend. Don't have precise numbers but Unity 2D wakes just immediately while Unity 3D shows me a black screen more then a minute.

So I decided to try "bootchart".
Installed it with: sudo apt-get install bootchart
And booted into:
Unity 3D - got 1:12.98 min


Unity 2D - got 0:38.66 min



Then looked if some processes related to nVidia differ in both boot logs.
And indeed I found out that "nvidia-settings" process was mentioned proc_ps.log in such proportion:
- 66 times for Unity 3D and
- 21 times for Unity 2D.

That lead me to conclusion that disabling "nvidia-settings" may improve boot performance.
So I did "sudo chmod a-x /usr/bin/nvidia-settings" and the next boot in Unity 3D took the same 37 seconds (0:37.76) as with Unity 2D.

For sure it is not the solution, but at least a direction to look.

Moreover this unfortunately has nothing to do with wake-up delay, so keep looking into it.

Anyway, hope this helps.

P.S. Make sure you know what are you doing while dealing with system files.

Fix FlexNET License Server Manager

For some reason in FlexNET tools version 11.4 license server manager application stopped working. Actually it won't start at all:
=========
 ./lmgrd 
bash: ./lmgrd: No such file or directory
=========

the most probable reason for such sort of problem is unavailability of some dependence (i.e. shared library).

So let's look at dependencies:
=========
$ ldd lmgrd 

linux-gate.so.1 =>  (0xb784b000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb781a000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb77f0000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb77d1000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb7655000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb7650000)
/lib/ld-lsb.so.3 => /lib/ld-linux.so.2 (0xb784c000)
=========

The first suspect is definitely (for me at least it was so) "linux-gate.so.1"
=========
This virtual library provides the necessary logic to allow user programs to access system functions through the fastest means available on the particular processor, either interrupt, or with most newer processors, fast system call.
=========

Others look pretty solid except the last one:  /lib/ld-lsb.so.3
=========
$ file /lib/ld-lsb.so.3
/lib/ld-lsb.so.3: ERROR: cannot open `/lib/ld-lsb.so.3' (No such file or directory)
=========

For some reason in some modern Linux distributions this symlink is not set by default and one needs to fix it whether manually or simply installing "LSB core" (Linux Standard Base core support package)  package.
In RedHat:
=========
yum install redhat-lsb.i686
=========


or for Debian/Ubuntu
=========
apt-get install lsb-core package
=========

Now it resolves correctly:
=========
$ file /lib/ld-lsb.so.3
/lib/ld-lsb.so.3: symbolic link to `ld-linux.so.2'
=========

And as a consequence lmmgr starts and acts properly now!

Friday, December 16, 2011

Windows 7 states not genuine Win7 boot after moving partition


For some reasons after playing with disk partitions Windows 7 thinks System partition label was changed (for example from C: to V:).
As a consequence Windows now thinks that your installation is not licensed... 


And here's a very simple solution that saved my day.
Found here: http://social.technet.microsoft.com/Forums/en/w7itproinstall/thread/48c99917-9ee3-4fe5-9ea8-2ac44b365e93

  1. Hit control-shift-esc to get the task manager and ran regedit
  2. Navigated to HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices, backed up and removed the data inside
  3. Reboot

 upon reboot, the system will checked the key again and validate the license.

Monday, December 12, 2011

LCD bring-up tips

During Embedded Linux Conference Europe 2011 I attended one very interesting presentation regarding new LCD bring-up procedures.


Among other nice things we were presented with extremely useful utility that may save a bunch of time while guessing what is wrong with this brand new LCD.
And this is fb-test utility.


Feel free to check it out from here http://www.elinux.org/images/0/09/Fb-test.c and then simply build it with your cross-toolchain of choise.
Then on target run it.


More on this you may find here http://www.elinux.org/Board_Bringup_Utilities

These are slides from ELCE http://elinux.org/images/d/d5/Elce-2011-anders.pdf

Video of this presentation (39 minutes)
FullHD (242M): http://free-electrons.com/pub/video/2011/elce/elce-2011-anders-board-bringup-lcd-display.webm

450x800 (98M): http://free-electrons.com/pub/video/2011/elce/elce-2011-anders-board-bringup-lcd-display-450p.webm

Add trusted certificates from Firefox to Citrix ICA client in Ubuntu

For some connections Citrix ICA client may display message saying:
You have hot chosen to trust "XXX server", the issuer of the server's security certificate.

Basically if you have Mozilla Firefox installed on your PC you may easily use its certificates for Citrix client as well.

Do do it just copy them over to ICA Client certificate folder:
sudo cp /usr/share/ca-certificates/mozilla/* /opt/Citrix/ICAClient/keystore/cacerts

Friday, November 11, 2011

Enable menu icons in Ubuntu 11.10 Oneiric Ocelot

Back in the day menu icons were essential part of system interface, then it was possible to enable/disable those icons in Ubuntu-tweak etc.
With 11.10 release we are in position when only dconf-tools tool may help us.
So first of all we need to install dconf-tools (it is not installed by default).

sudo apt-get install dconf-tools

And then open dconf-editor (start typing "dconf" in Unity dash)
In dconf editor go to org->gnome->desktop->interface and enable menus-have-icons.


Wednesday, November 9, 2011

Enable ifplugd with DHCP

To get ifplugd properly working with network interface that should obtain its configuration from DHCP server one basically needs to properly modify /etc/network/interfaces file:

# Configure Loop
auto lo
iface lo inet loopback

iface eth0 inet dhcp

Note, there's no "auto eth0"  line, so eth0 will be managed by ifplugd

Syntax highlighter in blogger

Just to save my setup of "Syntax highlighter"

Here are pretty good instructions of how-to integrate "Syntax highlighter" in blogger http://www.shirmanov.com/2010/09/adding-syntaxhighlighter-30-to-blogger.html

And below are my settings.
They differ in

  1. "Eclipse" theme instead of "Midnight"
  2. Added 3 new brushes I'm interested in: "Plain", "Diff" and "Bash"

Note, as it is said here http://alexgorbatchev.com/SyntaxHighlighter/manual/installation.html
in case of "<pre /> method" Major issue with this method is that all right angle brackets must be HTML escaped, eg all < must be replaced with &lt; This will ensure correct rendering.

<!-- First we add CSS styles -->
<link href='http://alexgorbatchev.com/pub/sh/current/styles/shCore.css' rel='stylesheet' type='text/css'/> 
<link href='http://alexgorbatchev.com/pub/sh/current/styles/shCoreDefault.css' rel='stylesheet' type='text/css'/> 
<link href='http://alexgorbatchev.com/pub/sh/current/styles/shThemeEclipse.css' rel='stylesheet' type='text/css'/> 
 
<!-- Second we add JS scripts -->
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js' type='text/javascript'></script> 
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shAutoloader.js' type='text/javascript'></script> 
 
<!-- Then we add Brushes -->
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPlain.js' type='text/javascript'></script> 
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushDiff.js' type='text/javascript'></script> 
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushBash.js' type='text/javascript'></script> 
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js' type='text/javascript'></script> 
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js' type='text/javascript'></script> 
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCSharp.js' type='text/javascript'></script> 
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js' type='text/javascript'></script> 
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushSql.js' type='text/javascript'></script> 
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCss.js' type='text/javascript'></script> 
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCpp.js' type='text/javascript'></script> 
 
<!-- At last we call SyntaxHighlighter -->
<script language='javascript' type='text/javascript'> 
    SyntaxHighlighter.config.bloggerMode = true;
    SyntaxHighlighter.all();
</script>

Mount jffs2 image in your development system

Devices with embedded linux quite often have root file-system stored in flash-memory. And quite often it is whether jffs2 or yaffs2. For partitions of small size (say < 100-200 Mb) one may easily use jffs2, while for larger partitions it is recommended to use yaffs2 because of its better scalability (smaller RAM requirements and better performance).
Another big advantage of jffs2 over yaffs2 is its native support in mainline linux kernel. For sure yaffs2 patch could be easily applied to your kernel tree it is always very nice to have a feature in mainline.

So basically you prepare proper file-system image and put it on MTD-device of your embedded board.
And sometimes you need to get some data from prepared file-system image or even modify it on your host development machine.

I found a nice bash script on Maemo Wiki http://wiki.maemo.org/Modifying_the_root_image#Shell_script_to_mount.2Funmount_JFFS2_using_block_device_emulating_MTD
But since I have kernel of version 3.0 on my machine I decided to remove parts for 2.4 kernel (corresponding branches were used for 3.0 kernel as well because of improper tests that were not written for 3.0 obviously). And also I added automatic pick-up of an empty loop device.
So here's a very helpful script for mounting jffs2 image:

#!/bin/sh
JFFSIMG=$1 # jffs image
LOOP=$(losetup --find) # loop device
MP="/media/jffs2" # mount point
MTDBLOCK="/tmp/mtdblock0" # MTD device file
BLKMTD="block2mtd"
UMNT=""
 
echo "$0" | grep unmount_ >/dev/null 2>&1
[ $? -eq 0 ] && UMNT=1
if [ $# -gt 1 -a x"$2"x = x"unmount"x ]; then
  UMNT=1
fi
  
if [ x"${UMNT}"x = x""x ]; then
  if [ ! -b ${MTDBLOCK} ] ; then
    mknod ${MTDBLOCK} b 31 0 || exit 1
  fi
  lsmod | grep loop >/dev/null 2>&1
  if [ $? -ne 0 ]; then
    modprobe loop
    [ $? -ne 0 ] && echo "loopback loading failed" && exit 1
    sleep 1
  fi
  losetup ${LOOP} ${JFFSIMG} || exit 1
  sleep 1
  modprobe mtdblock
  modprobe ${BLKMTD} || exit 1
  echo "${LOOP}" > /sys/module/block2mtd/parameters/block2mtd
  sleep 1
  modprobe jffs2
  [ ! -d ${MP} ] && mkdir -p ${MP}
  mount -t jffs2 ${MTDBLOCK} ${MP} || exit 1
else
  umount ${MP}
  if [ $? -ne 0 ]; then
    echo "Cannot unmount JFFS2 at $MP" && exit 1
  fi
  modprobe -r jffs2
  modprobe -r ${BLKMTD}
  modprobe -r mtdblock
  sleep 1
  losetup -d ${LOOP}
fi

Wednesday, November 2, 2011

Transform one multi-channel sound card into 2 virtual stereo ones

I love music!
I may say that the only period of time I don't listen to music is when I'm asleep.
And essentially while sitting at my desktop at work I cannot escape temptation to tune to Last.fm.

Another thing to mention is I cannot wear headphones for too long. Even my Sennheiser HD-555 which are "open-desing" ones and extremely comfortable. So I prefer to enjoy some sort of loudspeakers. And I do have them.

But sometimes I have to talk with colleagues through Skype. And well... it's not so nice to bother colleague/s sitting right next to me (in the same room) with these conversations... at the same time they're OK with my music.

So basically I needed to split audio output of Skype and all other applications.
The first idea was to get an extra PC (some old one from garbage) and use as a remote player. It's possible to install there MPD or some other stuff that has an ability to be controlled remotely through local network for example.

But it was not so elegant and basically I didn't manage to find "extra PC".

At this point I though what if I try to play with PulseAudio setting which is default audio server in Ubuntu for years now.

And so I did.

This wiki article covers everything I needed: https://wiki.archlinux.org/index.php/PulseAudio#Splitting_front.2Frear

Below is an extract from it.

Splitting front/rear

You may want connect speakers to front analog output and headphones to rear output. It would be usefull to split front/rear to separate sinks. Add to default.pa:
load-module module-remap-sink sink_name=speakers remix=no master=alsa_output.pci-0000_05_00.0.analog-surround-40 channels=2 master_channel_map=front-left,front-right channel_map=front-left,front-right

load-module module-remap-sink sink_name=headphones remix=no master=alsa_output.pci-0000_05_00.0.analog-surround-40 channels=2 master_channel_map=rear-left,rear-right   channel_map=front-left,front-right
(replace alsa_output.pci-0000_05_00.0.analog-surround-40 to your sound card name that you got from 'pacmd list-sinks')
After that you can switch player between speakers and headphones.

To restart PulseAudio execute: pulseaudio -k

This will kill PulseAudio server and then it will be restarted automatically with new settings applied.

The only thing that surprised me then - I couldn't find a way or tool to select desired virtual output for particular application.

And it turned out this tool is "PulseAudio Volume Control" (pavucontrol).

Here's a screenshot:

Unfortunately pavucontrol isn't installed by default in Ubuntu 11.10 so one needs to install it:
sudo apt-get install pavucontrol

Another issue is that application which uses direct access to ALSA won't appear in pavucontrol and so it's impossible to control which output they use.

But this is also could be solved quite simple:
In order for ALSA to use PulseAudio it needs a special /etc/asound.conf (system wide settings) (recommended) or ~/.asoundrc (settings on a per user basis):
File: /etc/asound.conf
pcm.pulse {
    type pulse
}
ctl.pulse {
    type pulse
}
pcm.!default {
    type pulse
}
ctl.!default {
    type pulse
}
If you omit the last two groups, Pulseaudio will not be used by default. You will then need to change the ALSA device to "pulse" in the applications that you use to make it work.
That's it. I finally got what I was looking for and it cost me an hour to google and experiment a bit.

Tuesday, October 18, 2011

Enable access to domain SMB shares from Nautilus (gvfd) in Ubuntu 11.10 Oneiric Ocelot

While running Ubuntu 10.10 on my main desktop I was able to access SMB shares within our Windows domain easily with no setup tweaks.

Recently I tried just released Ubuntu 11.10 and got stuck in situation when Nautilus asked me for credentials upon attempt to open "smb://share/folder", I entered my user name, domain name and password, but immediately on pressing "OK" button I got right the same window to enter password.

Next step I tried was "smbclient" run in terminal.

 $ smbclient -k //sp-filer/public  
 kerberos_get_default_realm_from_ccache: failed to get default principal  
 session setup failed: NT_STATUS_MORE_PROCESSING_REQUIRED  
 did you forget to run kinit?  


 $ smbclient //sp-filer/public  
 Enter abrodkin's password:  
 session setup failed: NT_STATUS_MORE_PROCESSING_REQUIRED  
 did you forget to run kinit?  


 $ kinit  
 The program 'kinit' can be found in the following packages:  
  * krb5-user  
  * heimdal-clients  
 Try: sudo apt-get install <selected package>  


So I installed "krb5-user" package which in turn has "krb5-config" as a dependency.
During "krb5-config" setup I entered our domain server address into prompt.


 $ kinit  
 Password for user@DOMAIN.SERVER.COM:  


And right after this I got both smbclient and Nautilus working like a charm.

Note: It's important to use ALL CAPITALS in domain realm name!

Saturday, October 8, 2011

Download entire albums from Picasa with GoogleCL

With GoogleCL it's simple as 1-2-3:
$ google picasa get "Album name" local_path

But with my album naming scheme this didn't work at first.
I name my albums like this: "2011.10.10 (Short description)"

And while GoogleCL relies on regular expressions parenthesis within an album name caused problems (album wasn't retrieved from Picasa).

But then I discovered that it's possible to disable regexp usage in GoogleCL configuration.
http://code.google.com/p/googlecl/wiki/ConfigurationOptions

In "~/.config/googlecl/config" set "regexp=False" in "[General]" section.

Tuesday, September 20, 2011

Fix "make xconfig" in buildroot-2011.08

Buildroot-2011.08 could use both Qt3 and Qt4 for configuration menu representation depending on Qt version installed on host system.

But if there're both of them (for example Linux kernel prior 2.6.38 uses Qt3 and Qt4 I use for application development) you'll get weird error on attempt to execute graphical configuration utility of buildroot in question:

 $ make xconfig  
 mkdir -p /home/_private/Downloads/buildroot-2011.08/output/build/buildroot-config/lxdialog  
 make CC="/usr/bin/gcc" HOSTCC="/usr/bin/gcc" obj=/home/_private/Downloads/buildroot-2011.08/output/build/buildroot-config -C package/config -f Makefile.br qconf  
 make[1]: Entering directory `/home/_private/Downloads/buildroot-2011.08/package/config'  
 /usr/bin/gcc -DCURSES_LOC="<ncurses.h>" -DLOCALE -I/home/_private/Downloads/buildroot-2011.08/output/build/buildroot-config -DQT_SHARED -DQT3_SUPPORT -I/usr/include/qt4 -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/Qt3Support -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtSql  -D LKC_DIRECT_LINK -c qconf.cc -o /home/_private/Downloads/buildroot-2011.08/output/build/buildroot-config/qconf.o  
 In file included from qconf.cc:48:  
 /home/_private/Downloads/buildroot-2011.08/output/build/buildroot-config/qconf.moc:13: fatal error: private/qucomextra_p.h: No such file or directory  
 compilation terminated.  
 make[1]: *** [/home/_private/Downloads/buildroot-2011.08/output/build/buildroot-config/qconf.o] Error 1  
 make[1]: Leaving directory `/home/_private/Downloads/buildroot-2011.08/package/config'  
 make: *** [/home/_private/Downloads/buildroot-2011.08/output/build/buildroot-config/qconf] Error 2  

To fix this issue in Ubuntu you only need to set "moc" alternative to "moc-qt4", so /usr/bin/moc will point to "moc" from Qt4 instead of the one from Qt3 (which is set by default):

 sudo update-alternatives --config moc  
 There are 2 choices for the alternative moc (providing /usr/bin/moc).  
   
  Selection  Path       Priority  Status  
 ------------------------------------------------------------  
 * 0      /usr/bin/moc-qt3  45    auto mode  
  1      /usr/bin/moc-qt3  45    manual mode  
  2      /usr/bin/moc-qt4  40    manual mode  
   
 Press enter to keep the current choice[*], or type selection number: 2  


Sunday, September 18, 2011

Fix black tooltip background in Eclipse

To solve black tooltip background in Eclipse in modern Ubuntu linux distributions ("Ambiance" theme):
Simply reset "System default" option and set preferred color of "Source hoover background" in "Preferences"->"C/C++"->"Editor"->"Appearance color options":

And here we go: