bkpmind Just some notes

2Apr/120

Script to solve KDE problem with multiple monitors

I'm using KDE 12.1 with KDE 4.7.2 and I was getting problem with KDE losing the multiple monitors configuration after boot. Every time I turn on my laptop, with a external monitor connected with VGA cable, I had to configure it manunaly.

A workaround proposed by Swerdna user from openSUSE forum was create a script to execute after KDE login to configure both monitors. So, hands on! :)

I've created a script called dual-monitor.sh:

#!/bin/sh

MY_MONITORS="`xrandr -q | grep VGA`"

if [ -n "$MY_MONITORS" ]; then
        xrandr --output LVDS1 --auto --pos 0x0 --output VGA1 --auto --right-of LVDS1
fi

Swerdna suggested me to use xrandr command to configure my monitors.
First I do a check if I'm with my external LCD connected before to configure the monitors.

After that, I put KDE to execute this script through AutoStart.

29Nov/110

error while loading shared libraries: libgmp.so.3

Scenario: openSUSE 12.1 and Bluespec 2011.06.D

When I was trying to run Bluespec compiler I was getting this library error:
/opt/Bluespec-2011.06.D/lib/bin/linux64/bsc: error while loading shared libraries: libgmp.so.3: cannot open shared object file: No such file or directory

I've tried a lot, but I couldn't find the package that provides libgmp.so.3. If you know, please leave a comment below.

So, let's use the dirty way to get things done:

$ sudo ln -s /usr/lib64/libgmp.so.10.0.2 /usr/lib64/libgmp.so.3

11Nov/110

How to crop a SVG image and export to EPS with Inkscape

First part is crop some region of a SVG image using Inkscape software.
You need select the Square at left toolbox and draw over the image, selecting the area that you want to be visible.
After you need to select all with CTRL+A and go to menu Object and select Clip -> Set.
And finally go to menu File and select Document Properties -> Resize page to content -> Resize page to drawing or selection.
Your crop is done!

Second part is save SVG image to EPS format to be easy use in Latex document.
Go to menu File, select Save as... and choose EPS format.
That's it... now the image is ready to be used in Latex document.

1Oct/110

Using hdparm to solve noises from hard drive

That's old but can be useful for somebody.
When I installed last version of openSUSE (11.4) I started listen to strangers noises from my hard drive. It was like my hard drive got turned off several times per minute.

The solution I've found was use hdparm tool to configure the hard drive Power Management. I've set that way:

hdparm -B 254 /dev/sda

To make this permanent, I've put this command in /etc/rc.d/boot.local

Footnote 1: This never happen before with this laptop, even with other distros. I hope this doesn't happen in the next release.

Footnote 2: The following script help me to understand what was going on with my hard drive:

#!/bin/bash
lastval=0
while :
do
        newval=`smartctl -A /dev/sda | awk '$2=="Load_Cycle_Count" {print $10}'`
        if [[ $newval != $lastval ]]
        then
                date
                echo $newval
        fi
        lastval=$newval
        sleep 120
done
17Sep/110

vmware and the “several modules must be compiled…”

Sometimes vmware needs to compile some modules showing you a message "Before you can run vmware several modules must be compiled and loaded into the running kernel". This could happen just after you have installed it or after a kernel upgrade.

So, vmware try to build these modules automatically, but sometimes it can't.
(Of course, life isn't easy)

To solve this problem, I found the below script that must be executed by root user.

#!/bin/bash
cd
cp -prn /usr/lib/vmware/modules/source /usr/lib/vmware/modules/source-backup
mkdir fixed
cd fixed
find /usr/lib/vmware/modules/source -name "*.tar" -exec tar xf '{}' \;

## add missing header on kernels
sed -i '/#include "compat_wait.h"/a\#include "compat_sched.h"' vmnet-only/vnetUserListener.c
sed -i '/#include "compat_page.h"/a\#include "compat_sched.h"' vmci-only/include/pgtbl.h
## comment out an invalid definition
sed -i 's|\(extern void poll_initwait(compat_poll_wqueues \*);\)|//\1|' *-only/include/compat_wait.h

tar cf vmblock.tar vmblock-only
tar cf vmci.tar vmci-only
tar cf vmmon.tar vmmon-only
tar cf vmnet.tar vmnet-only
tar cf vmppuser.tar vmppuser-only
tar cf vsock.tar vsock-only

cp -p *.tar /usr/lib/vmware/modules/source

cd /lib/modules/`uname -r`/build/include/linux
ln -s ../generated/autoconf.h
ln -s ../generated/utsrelease.h
cd

vmware-modconfig --console --install-all

# clean up
cd
rm -rf fixed
cd /lib/modules/`uname -r`/build/include/linux
rm autoconf.h utsrelease.h
cd /usr/lib/vmware/modules/
rm -rf source-backup
cd

This was successfully executed in openSUSE 11.4 and the script's author was the malcolmlewis user from forums.opensuse.org. Thanks Malcolm!

Tagged as: , No Comments
9Sep/110

Installing tint2 on openSUSE

I'm using GNOME 3 on openSUSE 11.4 and everything is (almost) fine. But something that I missed was the taskbar, but no more, thanks to tint2.

tint2 "is a simple panel/taskbar unintrusive and light (memory / cpu / aestetic)".

Unfortunately tint2 isn't available through Yast, so we have to do this in a hard mode (not so hard).

Grab the source code from http://code.google.com/p/tint2/, unpack and enter into its directory. Open the INSTALL file and you'll see that is very simple to build tint2. You just need to create a directory and execute cmake, make and make install commands.

At the end, you'll want it to execute automatically. The easiest way is through gnome-session-properties tool. Add a new entry there and do logout/login.

And you also get, completly free, tint2conf used to manage your panel themes.

4Mar/111

Installing devices in Quartus 10

Again, Quartus and Linux: the eternal fighting.

Today's episode: where the hell are my devices? Why I'm getting "No devices installed" ?

Ok, so you have installed Quartus and, in your first project, you realize that don't have any device available. It's possible install only devices you realy need using quartus_sh script.

All devices has .qda extensions and are available inside "devices/subscription" directory, created during installation.

./quartus_sh --qinstall -qda /(directory_to_devices)/cyclone.qda
./quartus_sh --qinstall -qda /(directory_to_devices)/cycloneii.qda
./quartus_sh --qinstall -qda /(directory_to_devices)/(your_device_here).qda

Detail: sometimes you could get some error, but just repeat the command that should works.

Tagged as: , 1 Comment
12Jan/111

Error during SystemC compilation

I'm using Linux Mint 10 / Ubuntu 10.10 and I was getting an error during SystemC compilation. The error was:

make[3]: Entering directory `/home/sergio/a/systemc-2.2.0/src/sysc/utils'
g++ -I. -I. -I. -I../../../src    -Wall -DSC_INCLUDE_FX -O3 -c -o sc_utils_ids.o `test -f 'sc_utils_ids.cpp' || echo './'`sc_utils_ids.cpp
sc_utils_ids.cpp: In function ‘int sc_core::initialize()’:
sc_utils_ids.cpp:110: error: ‘getenv’ is not a member of ‘std’
sc_utils_ids.cpp:111: error: ‘strcmp’ was not declared in this scope
sc_utils_ids.cpp: At global scope:
sc_utils_ids.cpp:119: warning: ‘sc_core::forty_two’ defined but not used
make[3]: *** [sc_utils_ids.o] Error 1
make[3]: Leaving directory `/home/sergio/a/systemc-2.2.0/src/sysc/utils'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/sergio/a/systemc-2.2.0/src/sysc'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/sergio/a/systemc-2.2.0/src'
make: *** [all-recursive] Error 1

I found a solution at Fedora Forum (thanks to YamlaJ user).
Edit systemc-2.2.0/src/sysc/utils/sc_utils_ids.cpp file adding these two includes:

#include "string.h"
#include "cstdlib"

Now you can proceed with make ; make install and test with:

cd examples/sysc/rsa
make check
11Jan/110

Bluespec Syntax Highlighting for Vim

Here goes a little tip for those who like to use Vim editor to program in Bluespec but gets bored with all your code in gray lines.

Just copy the directory structure inside of $BLUESPEC_HOME/util/vim/ to your home .vim directory (~/.vim) to get syntax highlighting working for bsv files.

mkdir ~/.vim   # Only if you don't have vim directory yet.
cd $BLUESPEC_HOME/util/vim/
cp -r * ~/.vim

Now you don't need to load Bluespec Workstation just to get some color in Vim editor ;)

11Jan/110

Just an example in how to use gnuplot

Just an example in how to use gnuplot

gnuplot> set yrange [50:70]
gnuplot> plot "./out.txt" using 2:4 title 'Signal 1' with lines, \
> "./out.txt" using 2:5 title 'Signal 2' with lines
gnuplot> set yrange [58:62]
gnuplot> replot
Tagged as: No Comments