radu's blog

Laptop Mode is a setting that allows you to extend the battery life of your laptop. It does this by changing how the kernel distributes disk I/O over time. Linux normally does disk I/O in small amounts, nicely spread out over time. But this way, the hard drive never gets a chance to spin down, wasting valuable power. Laptop mode helps by making disk write activity "bursty", so that only reads of uncached data result in a disk spinup.

To enable Laptop Mode in Ubuntu you'll have to install the package laptop-mode-tools:

sudo apt-get install laptop-mode-tools

It has pretty good default settinga, but you can change them by editing the file /etc/laptop-mode/laptop-mode.conf:

sudo vim /etc/laptop-mode/laptop-mode.conf

For some strange reason the vertical scrolling is not working by default on Ubuntu 10.04. The solution to this problem is quite simple, but not so obvious.

To enable vertical scrolling for Sony Vaio F11 on Ubuntu 10.04 you will have to run the following command:

echo "options psmouse proto=imps" >> /etc/modprobe.d/psmouse.conf

The above command will set the protocol used for communication with the touchpad.

After upgrading to Ubuntu 10.04 Lucid Lynx some things started to work out of the box, but the sound and the microphone weren't between them.

Fixing the sound is easy, just install the alsa backport module:

sudo apt-get install linux-backports-modules-alsa

Fixing the microphone is a little bit more complicated. My solution is to patch the alsa-driver which comes with the backports package.

First you'll have to install the packages needed for compiling and then get the sources for the backports package:

sudo apt-get build-dep --no-install-recommends linux-image-$(uname -r)
apt-get source linux-backports-modules-alsa-$(uname -r)

Now download the patch file and apply it to the sources:

cd linux-backports-modules-2.6.32-2.6.32/updates/alsa-driver/
wget http://kenjiru.ro/files/enable-internal-microphone.patch
patch -p1 < enable-internal-microphone.patch

If everything goes fine, you can start compiling the sources. The following line will make sure only the driver for your card will be compiled:

./configure --with-cards=hda-intel --enable-dynamic-minors --with-moddir=extra
make

We don't need all the modules, only the one we patched:

sudo mkdir /lib/modules/`uname -r`/extra
sudo cp ./pci/hda/snd-hda-codec-realtek.ko /lib/modules/`uname -r`/extra/

Next you'll have to tell depmod to use the new module instead of the old one:

echo "override snd-hda-codec-realtek * extra" | sudo tee -a /etc/depmod.d/ubuntu.conf > /dev/null
sudo depmod -a

That's it! You'll have to restart to load the new module. You can verify the new module is used by issuing the following command:

$ modinfo snd-hda-codec-realtek
filename:       /lib/modules/2.6.32-22-generic/extra/snd-hda-codec-realtek.ko
description:    Realtek HD-audio codec
license:        GPL
alias:          snd-hda-codec-id:10ec*
srcversion:     4513A8ACA8A682A191E5AE5
depends:        snd-hda-codec,snd
vermagic:       2.6.32-22-generic SMP mod_unload modversions

The filename field should point to the new module.

Installing Oracle UCM 10gR3 on Windows is very similar to the Linux installation. Basically you'll have to go through the same steps:

  • Install and configure the Oracle XE Database
  • Install Oracle UCM
  • Install and configure the Apache Webserver

Install and configure the Oracle XE Database

Simply install the Oracle XE 10g Database, nothing special here.

After installing the database, you'll have to create a new tablespace for UCM. Connect to the database as SYSDBA using SQL*Plus and run the following commands:

CREATE TEMPORARY tablespace idc_temp
  tempfile 'c:\oraclexe\oradata\XE\idc_temp.dbf'
  size 200M reuse autoextend ON next 5120k maxsize unlimited;

CREATE tablespace idc_sys
  datafile 'c:\oraclexe\oradata\XE\idc_sys.dbf'
  size 200M reuse autoextend ON next 5120k maxsize unlimited;

CREATE user idc
  IDENTIFIED BY idc
  TEMPORARY tablespace idc_temp
  DEFAULT tablespace idc_sys
  quota unlimited ON idc_sys;

GRANT connect, resource TO idc;

Install Oracle UCM

Download the required file from the Oracle website and unzip it in your home directory. Now go to the following directory:

UCM -> ContentServer -> win32

And run the setup script:

setup.bat

The Oracle Content Server setup script will walk you through several steps. Most of them should be left as default, but some should have different values:

Oracle User: idc
Oracle Password: idc
Oracle Instance Name: XE
Attempt to create database tables: yes

Install and configure the Apache Webserver

The final step is to configure the Apache Webserver.

After installing the webserver, edit the file

LoadModule IdcApacheAuth "C:/stellent/shared/os/win32/lib/IdcApache22Auth.dll"
IdcUserDB idc "C:/stellent/data/users/userdb.txt"

Alias /idc "C:/stellent/weblayout"
<Location /idc>
        Order allow,deny
        Allow from all
        DirectoryIndex portal.htm
        IdcSecurity idc
</Location>

And that's all!

Sometimes you might want to parse a .hda file in a custom Java application, outside of the Oracle UCM.

Here is a sample code:

/*
 * Main.java
 */

package hdatest;

import intradoc.data.DataBinder;
import intradoc.data.DataSerializeUtils;
import intradoc.resource.ResourceUtils;
import intradoc.serialize.DataBinderSerializer;

public class Main {

        public static void main(String[] args) {
                DataBinder dataBinder = null;
                String dir = "/usr/lib/oracle/ucm/data/profiles/document/";
                String file = "dprules.hda";
               
                DataSerializeUtils.setDataSerialize(new DataBinderSerializer());
               
                try {
                        dataBinder = ResourceUtils.readDataBinderHeader(dir, file);
                } catch (Exception e) {
                        e.printStackTrace();
                        return;
                }
               
                String str = dataBinder.getLocal("blDateFormat");
                System.out.println("blDateFormat: " + str);
        }
}

To compile the above source code you'll have to include the file /shared/classes/server.zip in your classpath:

javac -classpath /usr/lib/oracle/ucm/shared/classes/server.zip hdatest/Main.java

The important bit here is the initialization of the serializer. Without it you will get an ugly exception like this one:

intradoc.common.ServiceException: !csResourceUtilsFileIOError!csResourceUtilsFileReadError,dprules.hda
        at intradoc.resource.ResourceUtils.serializeDataBinderWithEncoding(ResourceUtils.java:251)
        at intradoc.resource.ResourceUtils.serializeDataBinderEx(ResourceUtils.java:86)
        at intradoc.resource.ResourceUtils.readDataBinderHeader(ResourceUtils.java:283)
        at hdareadtest.Main.main(Main.java:18)
Caused by: java.lang.NullPointerException
        at intradoc.data.DataSerializeUtils.detectEncoding(DataSerializeUtils.java:157)
        at intradoc.resource.ResourceUtils.serializeDataBinderWithEncoding(ResourceUtils.java:224)
        ... 3 more

User login

Who's online

There are currently 0 users and 0 guests online.