Yet Another Blog

April 22, 2015

Keyboard bug in Intellij under Ubuntu

Filed under: computer, Java, linux — Tags: , , , , , , — guilleml @ 3:09 pm

If you’re using intellij under Ubuntu you probably noticed the keyboard stops working sometimes just in the IDE.
This is very anoying and there is an open issue: https://youtrack.jetbrains.com/issue/IDEA-78860
If you want to enable again the keyboard execute this command on any terminal:

ibus-daemon -rd

This seems to work in versions 14.04 and 14.10.

Source: http://askubuntu.com/questions/501907/keyboard-locks-in-intellij-idea-on-ubuntu-14-04

February 17, 2015

Setting environment variables in OpenShift

Filed under: computer, Java, linux, Software — Tags: , , , , — guilleml @ 12:51 pm

If you need to set some environment variables in your GEAR you can use an action hook.
The pre-start action hook will serve you well but if you need to restore those variables after a gear restart, pre-start action hook won’t work.
Post-restart action hook, on the other hand, will execute its actions but I haven’t managed to get the environment variables working. After its execution all environment variables that should have a value were empty.

What I did was to modify pre-start action hook to create environment variables as files under $HOME/.env/user_vars

# Actual script
export OPENSHIFT_POSTGRESQL_DB_HOST="xxx.xxx.xxx.xxx"
export OPENSHIFT_POSTGRESQL_DB_PORT="***"
export OPENSHIFT_POSTGRESQL_DB_NAME="***"
export OPENSHIFT_POSTGRESQL_DB_USERNAME="***""

# Added script for post restart variables
echo "xxx.xxx.xxx.xxx" > OPENSHIFT_POSTGRESQL_DB_HOST
echo "***" > OPENSHIFT_POSTGRESQL_DB_PORT
echo "***" > OPENSHIFT_POSTGRESQL_DB_USERNAME
echo "***" > OPENSHIFT_POSTGRESQL_DB_PASSWORD

After this, if you execute gear restart, the environment variables will exist and will be accesible from your application.

April 27, 2011

nVidia PowerMizer on Linux

Filed under: computer, linux, Software — Tags: , , , , , , — guilleml @ 11:20 pm

Nvidia settings panel has a tab called powermizer where you can set a power policy. It will change Graphics Clock, Memory Clock and Processor Clock depending on the system graphics load.

First get what modes do your card and driver support:

nvidia-settings -q GPUPerfModes -t

perf=0, nvclock=50, memclock=135, processorclock=101 ; perf=1, nvclock=405, memclock=324, processorclock=810 ; perf=2, nvclock=405,
memclock=1800, processorclock=810 ; perf=3, nvclock=715, memclock=1800, processorclock=1430

I have 4 levels, 0, 1, 2 and 3. 0 is the one I want to set as it sets the clocks to the lower frequency.

If you want to set it to a powersave mode with no scaling you can do it by editing /etc/X11/xorg.conf like this:

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
Option  "Coolbits" "1"
 Option  "RegistryDwords" "PowerMizerEnable=0x1; PerfLevelSrc=0x2222; PowerMizerLevel=0x3; PowerMizerDefault=0x3; PowerMizerDefaultAC=0x3"
EndSection
 
"PowerMizerEnable=0x1;

enables PowerMizer feature (0×0 would disable it instead). This entry may not be needed since in recent driver versions PowerMizer is enabled by default.

PerfLevelSrc=0x2222;

sets the governor approach. 0×2222 means fixed frequencies for both battery and AC mode.

PowerMizerLevel=0x3;

sets the current mode. 0×3 is the lowest, least power intensive mode.

PowerMizerDefault=0x3;

sets the default level on battery. 0×3 is the lowest, least power intensive mode.

PowerMizerDefaultAC=0x3"

sets the default level while with an AC plug. 0×3 is the lowest, least power intensive mode.

Sources: http://linux.aldeby.org/nvidia-powermizer-powersaving.html

http://tutanhamon.com.ua/technovodstvo/NVIDIA-UNIX-driver/

October 21, 2009

Broadcom-wl in archlinux 2.6.31

Filed under: computer, linux — Tags: , , , , — guilleml @ 6:51 pm

After upgrading to 2.6.31 my wifi stopped working so I googled a little, I found a few usefull links:

http://aur.archlinux.org/packages.php?ID=19514

http://bbs.archlinux.org/viewtopic.php?id=82613

http://wiki.archlinux.org/index.php/Broadcom_BCM4312

Basically what I did was to execute “makepkg” again in the broadcom-wl package and reinstall it. Then I executed:

#mkinitcpio -p kernel26

Also make sure your rc.conf is rigth, you have to add !b43 and !ssb to your MODULES section.

MODULES=(acpi-cpufreq cpufreq_ondemand lib80211_crypt_wep lib80211_crypt_ccmp lib80211_crypt_tkip wl !ssb !b43 fuse)

Reboot your computer and check that your wifi card is working:

#iwconfig

eth0      IEEE 802.11  Nickname:””
Access Point: Not-Associated
Link Quality:5  Signal level:206  Noise level:165
Rx invalid nwid:0  invalid crypt:0  invalid misc:0

Then you can use wicd or networkManager to connect to your network.

February 8, 2009

Setting up Hibernate with MySQL under GNU/Linux

Filed under: linux, Software — guilleml @ 1:01 am

We’ll need to have installed mysql packages, of course, as long as the java libraries for hibernate, mysql jdbc connector or any other things needed for the project as struts, spring…maybe an IDE as Eclipse or Netbeans.

Query browser may be useful to check database updates, modify tables o whatever you could need, anyway, what I wish to comment is the hibernate.cfg.xml file:

<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE hibernate-configuration PUBLIC “-//Hibernate/Hibernate Configuration DTD 3.0//EN” “http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd”&gt;
<hibernate-configuration>
<session-factory>
<property name=”hibernate.dialect”>org.hibernate.dialect.MySQLDialect</property>
<property name=”hibernate.connection.driver_class”>com.mysql.jdbc.Driver</property>
<property name=”hibernate.connection.url”>jdbc:mysql://localhost:3306/empresas</property>
<property name=”hibernate.connection.username”>root</property>
<property name=”hibernate.connection.password”>toor</property>
<mapping resource=”hibernate.hbm.xml”/>
</session-factory>
</hibernate-configuration>

Take a look I’m using JDBC driver for MySQL, you should change the hibernate.connection.url with your own following the same format, let’s sayour database’s name is “enterprises”, then your connection url will be jdbc:mysql://localhost:3306/enterprises

netbeans - hibernate

The classes and tables mapping will be in hibernate.hbm.xml with its own format, for example:

<class dynamic-insert=”false” dynamic-update=”false” mutable=”true” name=”com.myapp.struts.Empresa” table=”empresahib” optimistic-lock=”version” polymorphism=”implicit” select-before-update=”false”>
<id name=”id” column=”id” type=”long”>
<generator class=”increment”/>
</id>
<property name=”nif” type=”java.lang.String”/>
<property name=”fecha” type=”java.sql.Date”/>
<property name=”rep_legal” type=”java.lang.String”/>
<property name=”denomsocial” type=”java.lang.String”/>
<property name=”telefono” type=”java.lang.String”/>
<property name=”email” type=”java.lang.String”/>
</class>

October 8, 2008

Dell Inspiron 1525 hotkeys in KDE 4.1.1 Debian

Filed under: computer, linux, Software — Tags: , , , , , , , , , — guilleml @ 7:57 am

In Kubuntu 8.04 my laptop multimedia keys worked fine but in KDE 4.1.1 under Debian they didn’t, I couldn’t assign them to actions in system preferences.

To solve it I’ve used xbindkeys, it works pretty nice and now I can control the volume with the volume keys. To do so, type:

#aptitude install xbindkeys xbindkeys-config

Now you can use xbindkeys-config to configure using a graphical interface or you can configure in ~/.xbindkeysrc.

To configure volume keys under kde 4.1.1 you will need to assign some actions to each key in order to increase, decrease or mute the volume, I’ve used qdbus and kmix to do that, for example, if you want to  mute the audio:

$qdbus org.kde.kmix /Mixer0 org.kde.KMix.toggleMute Master:0

So you need to assign that to the mute key. To increase the volume:

$qdbus org.kde.kmix /Mixer0 org.kde.KMix.increaseVolume Master:0

And to decrease the volume:

$qdbus org.kde.kmix /Mixer0 org.kde.KMix.decreaseVolume Master:0

So the xbindkeysrc file will be:

#Mute
“qdbus org.kde.kmix /Mixer0 org.kde.KMix.toggleMute Master:0”
m:0x0 + c:160
NoSymbol

#SubirVol
“qdbus org.kde.kmix /Mixer0 org.kde.KMix.increaseVolume Master:0”
m:0x0 + c:176
NoSymbol

#BajarVol
“qdbus org.kde.kmix /Mixer0 org.kde.KMix.decreaseVolume Master:0”
m:0x0 + c:174
NoSymbol

After that you want to run xbindkeys daemon every time you login with your user, so add it to ~/.xinitrc, ~/.kde4/Autostart or any way you know to do so.

September 19, 2008

PHC-Control in Debian Lenny

Filed under: computer, linux, Software — Tags: , , , , , , — guilleml @ 5:42 pm

To build your own module for undervolting your CPU you’ll need some files:

linux-phc-0.3.1 from https://sourceforge.net/projects/linux-phc/

linux-source and headers from aptitude:

aptitude install build-essential linux-source-2.6.26 linux-headers-2.6.24-1-amd64

Go to /usr/src and untar the linux source:

tar xvfj linux-source-2.6.26.tar.bz2

Apply the patch and build the module:

cd linux-source-2.6.26

cp /boot/config-2.6.26-1-amd64 .config

cp /usr/src/linux-headers-2.6.26-1-amd64/Module.symvers /usr/src/linux-source-2.6.26

patch -p1 < linux-phc-0.3.1-kernel-vanilla-2.6.26rc8.patch

make oldconfig

make prepare

make scripts

make M=./arch/x86/kernel/cpu/cpufreq

mv /usr/src/linux-source-2.6.26/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.ko /usr/src/linux-source-2.6.26/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.ko_old

mv /lib/modules/2.6.26-1-amd64/kernel/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.ko \
/lib/modules/2.6.26-1-amd64/kernel/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.ko_old

cp /usr/src/linux-source-2.6.26/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.ko /lib/modules/2.6.26-1-amd64/kernel/arch/x86/kernel/cpu/cpufreq/

And that’s all

Edit: Thanks to Andrew for the correction, there was an error I made writing the commands to the blog.

September 9, 2008

Increase battery life in your linux laptop

Filed under: computer, hacks, linux, Software — Tags: , , , , , , , , , — guilleml @ 7:10 pm

Recently I’ve bought a laptop, Dell Inspiron 1525 with a T5750@2Ghz and a 9 cell battery.

I installed KDE4, plasma, desktop effects…it’s cool, really cool,  but then I discovered powertop, a tool that is able to recommend some settings to make  your CPU to awake less times every second. The tools shows yo a list of the tasks that are awaking the CPU so you can try to get a more power-efficent system.

It recomends you some actions to take, you just accept or not them, as set the SATA bus in low-power mode, USB autosuspend, set ondemand cpu freq governor, delay writing to the hard disc, etc…

I noted KDE4 is cool but not when you’re using the battery so I installed fluxbox and XFCE, both are nice, XFCE seems to wake up less the CPU, then I started to look for scripts and patchs to waste less energy.

So here are the tuning I’ve done to my laptop:

From http://ubuntuforums.org/showthread.php?t=847773

#!/bin/bash

# Go fast on AC power.  Similar to default Ubuntu settings
if on_ac_power; then
# Set the drive to mostly stay awake
hdparm -B254 -M 254 /dev/sda

# Remount ext3 filesystems so the journal commit only happens every 60
# seconds.  By default this is 5 but, I prefer to reduce the disk
# activity a bit.
mount -o remount,commit=60 /
mount -o remount,commit=60 /media/sda3

# Turn off the laptop mode disk optimization
echo 0 > /proc/sys/vm/laptop_mode

# Manually set the wifi driver to no power savings.
#echo 6 > /sys/bus/pci/drivers/iwl????/0000\:??\:00.0/power_level

# Set kernel dirty page value back to default
echo 10 > /proc/sys/vm/dirty_ratio
echo 5 > /proc/sys/vm/dirty_background_ratio

# Only wakeup every 60 seconds to see if we need to write dirty pages
# By default this is every 5 seconds but, I prefer 60 to reduce disk
# activity.
echo 6000 > /proc/sys/vm/dirty_writeback_centisecs

# Turn off sound card power savings
echo 0 > /sys/module/snd_hda_intel/parameters/power_save

# Set the SATA to max performance
echo max_performance > /sys/class/scsi_host/host2/link_power_management_policy
echo max_performance > /sys/class/scsi_host/host3/link_power_management_policy
echo max_performance > /sys/class/scsi_host/host4/link_power_management_policy

# Make sure ondemand governor is set
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

# Enable the webcam driver
#  modprobe uvcvideo

else # Save power

# Set the disks to aggressively save power and use the lowest acoustic
# level.  Note: Currently Firefox is very poorly behaved and some
# might find these settings too aggressive.  If so, change “-S 4” to
# something larger like -S 24 (two minutes).
hdparm -B180  /dev/sda

#set the LCD bright to 60%

echo 60 > /proc/acpi/video/VID/LCD/brightness

# Change the ext3 commit times to 10 minutes.  This reduces disk
# activity
mount -o remount,commit=600 /

# Set laptop disk write mode
echo 5 > /proc/sys/vm/laptop_mode

# Manually set the iwl3945 driver to power savings.
#echo 5 > /sys/bus/pci/drivers/iwl????/0000\:??\:00.0/power_level

# Reduce disk activity by waiting up to 10 minutes before doing writes
echo 90 > /proc/sys/vm/dirty_ratio
echo 1 > /proc/sys/vm/dirty_background_ratio
echo 60000 > /proc/sys/vm/dirty_writeback_centisecs

# Set sound card power savings
echo 10 > /sys/module/snd_hda_intel/parameters/power_save

# Set SATA to minimum power
echo min_power > /sys/class/scsi_host/host0/link_power_management_policy
echo min_power > /sys/class/scsi_host/host1/link_power_management_policy
echo min_power > /sys/class/scsi_host/host2/link_power_management_policy
echo min_power > /sys/class/scsi_host/host3/link_power_management_policy
echo min_power > /sys/class/scsi_host/host4/link_power_management_policy

# Make sure ondemand governor is set
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

# Remove the webcam driver
modprobe -r uvcvideo
modprobe -r sbp2
modprobe -r ieee1394
modprobe -r uvcvideo
modprobe -r videodev
modprobe -r v4l1_compat
modprobe -r compat_ioctl32
modprobe -r v4l2_common
fi

The script is commented, I only changed a few things from the original, it works fine, some drivers are able to set the hardware in low-power mode but it seems they don’t do by default, GNU/Linux seems to have to polish laptop distributions.

Powertop shows you the watts you’re currently using when the laptop is not connected to the AC, so I played with phc to undervolt the CPU, now I’m able to use less power for the CPU, this doesn’t decrease the performance.

You can use this tutorial http://ubuntuforums.org/showthread.php?t=786402 to get a kernel able to undervolt the cpu, you just have to replace a module.

My original settings are:

43 35 27 19

Now they are:

24 1 1 1

Powertop shows the laptop uses less energy now and the cpu is colder at high load.

June 25, 2008

OpenSuse 11.0 KDE 4.1 beta2

Filed under: computer, linux, Software — Tags: , , , , , — guilleml @ 9:37 am

Kde 4.1 beta has been released and there are packages available for OpenSuse 11.0, I’ve installed them and they work pretty good, I can’t tell much differences but flash plugin works on konqueror!

The desktop seems quite stable and fast.

You can get it from http://en.opensuse.org/KDE/KDE4

Or just click here and OpenSuse will do everything for you.

The changelog shows some interesting features I haven’t tested yet, but I will.

June 20, 2008

Updating OpenSuse 11.0 to KDE 4.1

Filed under: computer, linux, Software — Tags: , , , — guilleml @ 5:53 pm

I read on this blog KDE 4.1 was more stable than KDE 4.0.4, the version by default in OpenSuse 11.0, I updated the mirrors to try it.

http://download.opensuse.org/repositories/KDE:/KDE4:/UNSTABLE:/Desktop/openSUSE_11.0/
http://download.opensuse.org/repositories/KDE:/KDE4:/UNSTABLE:/Extra-Apps/openSUSE_11.0/
http://download.opensuse.org/repositories/KDE:/KDE4:/UNSTABLE:/Community/openSUSE_11.0/

Just add them using yast2, software repositories.

After updating I restarted the xorg server and the KDE running, there wasn’t much visual difference, just some little details not very “beautiful” but not much problem. I have to say that this update solved the problem I had with kopete I wrote about in my last post, notifications are working fine now.

  • The menu for adding a new msn account in kopete was chaotic, by resizing the window the objects were shown fine, KDE 4.1 mixes languages, I suppose it’ll be solved in the final release.

Free Image Hosting at www.ImageShack.us

  • Kget doesn’t download anything, neither in 4.0.4 nor in 4.1.

Free Image Hosting at www.ImageShack.us

  • Taskbar icons have a gray border they didn’t have under 4.0.4, I don’t know how to remove it.

Free Image Hosting at www.ImageShack.us

  • Alt+Tab combination sometimes doesn’t work for changing active window, neither under 4.0.4.
  • The p4-clockmod kernel module doesn’t load at boot so I can’t change my CPU frequency if I don’t load it.
  • I haven’t disabled the pc speaker yet.
  • Konqueror4 stills doesn’t load flash objects, I haven’t found information about how to solve it, at least firefox loads them perfectly.
  • I updated Firefox 3b5 to version 3 adding the Mozilla repositories, Firefox is a little faster for it.

One thing I’ve noted is that OpenSuse 11.0 seems faster than Kubuntu/Ubuntu, on Kubuntu I can hear the hard disk everytime I run an application, now the application loads perfectly and fast without accessing so much, that was one thing I noticed when I tried *buntu, in Debian, Gentoo, Archlinux…the disk access was much like OpenSuse’s, maybe it’s for the disk scheduler, I haven’t investigated it. Oh! I discovered that you can change the kernel I/O scheduler in yast2, by default it selects cfq.

Older Posts »

Create a free website or blog at WordPress.com.