Ohm
the end and the beginning..
Tuesday, April 27, 2010
New Hobby Running: Summer Time
View Larger Map
I am taking up a new thing. Running! This is the route i found. 4.5km. Not too intense, neither too light. Off today, planning to take it easy in the beginning and walk a lot more than jog, will slowly build up the pace. How I wish my old cross country days had stuck with me.
Installing Oracle 10g database on Ubuntu 10.04 AMD 64
Oracle has the express edition which would have been my DB of first choice, except that there is no 64 bit version of this database. You can still install it if you are that keen with the following steps.
- Download the database 10g XE (universal) manually from http://www.oracle.com/technology/software/products/database/xe/htdocs/102xelinsoft.html
- Install using dpkg using the following command:
sudo dpkg -i --force-architecture /MY_DOWNLOAD_DIRECTORY/oracle-xe-universal_10.2.0.1-1.0_i386.debI didn't want to do the force architecture part, so I decided to do this there hard way. The problem with direct installation of 10g on ubuntu64 is that even though we have the 64 bit DB, by default Oracle doesnt support the debian architecture. I am documenting this as I am installing and hence I do not know how long this is going to be.
First things first, Oracle 10g requires your OS to be one of the following versions of linux:
redhat-3, SuSE-9, redhat-4, UnitedLinux-1.0, asianux-1 or asianux-2For this verification it checks the following file /etc/redhat-release. This file simply doesn't exist in ubuntu. So create one and put redhat-3 in it.
Also, you need to have the following installed libaio1
sudo apt-get install libaio1
Now create a user oracle using the command :
adduser oracleDownload the Oracle 10g db files and gunzip and cpio -idmv <
Give the ownership of that directory to the user oracle using the following command:
sudo chown -R oracle /opt/oracle/databasenow log into the user account of oracle from gdm and run the executable /opt/oracle/database/runInstaller
and Voilah! the installer pops up. When you get an error just click "Continue".
We have some gcc incompatibilities with the ubuntu 10.04, bleeding edge that it is. But you might be able to fix most of these issues manually using this file:
/opt/oracle/product/10.2.0/db_1/cfgtoollogs/configToolFailedCommands(I didn't do the above)
Now we need to set the paths.
Open up your /etc/profile file and add the following lines to the bottom of the file:
Now more config details:#Oracle Library Pathsexport ORACLE_BASE=/opt/oracleexport ORACLE_HOME=/opt/oracle/product/10.2.0LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/libexport LD_LIBRARY_PATH
Create the tnsnames.ora file at $ORACLE_HOME/network/admin as the following:
and the also create the listener.ora file (get a default listener.ora and edit to fill in your host specs.)ORCL=(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1512)))(CONNECT_DATA =(SERVICE_NAME = ORCL)))
Now bring up the listener using lsnctrl start
Now connect as sysdba and startup the database!
UPDATE: aargh! forgot that the kernel needs to have to have some parameters enabled as well. so i am back to force-architecture!! this does not work!!
Thursday, February 11, 2010
Saving battery on your Android
I was pretty much concerned about the battery drain on my HTC Dream/G1/Android phone, so I did some research and came up with the below. These settings should help reduce battery drain and even make your phone a bit faster.
Usually you would have been stuck, but with an open source phone, you have an answer
Researched various settings to save battery life on a linux kernel and finally compiled the below settings.
There changes are to be done to /system/bin/user.conf
This file by default is read-only to modify do the following
$ su
# mount -o remount,rw /dev/block/mtdblock3 /system
# vi /system/bin/user.conf
once you have vi you can edit the file and save it.
The changed parts are given below.
VM
laptop_mode = 5
dirty_writeback_centisecs = 1500
———-
compcache — disabled
———–
linux_swap_en = 1
——–
CPUscaling_min_freq=192000
scaling_max_freq=524000
sampling_rate=4000000
powersave_bias=100
up_threshold=25
The VM Changes
1. laptop_mode: When laptop mode is enabled, the kernel will try to be smart about when to do IO, to give the disk and the SATA links as much time as possible in a low power state. Laptop mode works by submitting all future pending disk IO (such as pending VM cache writebacks, as described in the VM writeback time tip, above) at once, when the kernel has to do an IO to the disk for any reason. By submitting future planned IO right away, when the disk is powered up anyway, the assumption is that this IO will no longer need to happen, so the disk can remain in a low power mode longer.
2. dirty_writeback_centisecs: The VM subsystem, in the Linux kernel, buffers writes to files that applications perform for a period of time. This caching allows the kernel to group consecutive writes into one big write, and to generally optimize the disk IO to be the most efficient. The kernel, by default, will start writing out data to disk after 5 seconds, so, if a power failure or kernel crash happens, at most, 5 seconds of data would be lost. Since we run on battery, we can, hopefully, set this to a longer time of 15 seconds.
3. compcache is enabled by default on this ROM of size 32MB. If you have a third partition disable this and enable that partition which would be of the file system type linux-swap by default, thereby avoiding the need to process two layers of filesystem logic of 1 from linux-swap to ext2/fat32 and then 2nd from fat32/ext2 to disk.
4. sampling_rate: this is how often you want the kernel to look at the CPU usage and to make decisions on what to do about the frequency. This is by default set to 200000, which I think is a bit too sensitive for a phone, hence I have doubled this amount to 4000000 as an experiment. Not sure till how much we can increase this, but it would be worth the test i guess. You will understand more why when we talk about up_threshold.
5. powersave_bias: set to 0, which pretty much doesnt really use this feature. in a range from 1 to 1000, if you set the powersave bias to say 100(or 10%) the cpu runs at 100-10% of the required scaled frequency and if this is enough then it is set at that. Hence as an experiment set it to 100 (or 10%).
6. up_threshold: This plays together with the sampling_rate. This is an additional check for the kernel to scale the cpu frequency if the load of the cpu goes beyond a certain percentage as specified by the up_threshold in between the sampling rates.
Hope this was helpful.
Linux Thinkpad overheating problem? Try this!
Ever since my Jaunty upgrade, my thinkpad t61 has been running extremely hot! At a point it even hit close to 100 degrees C!. This seems to a bug in the kernel mainline and hence might affect all distros.
Here is a quick fix for thinkpad users. From the kernel version 2.6.22 kernel is using thinkpad_acpi to control the fan/temperature/power. First you need to load this module with an option to modify the fan settings.
For this first run the following command:
$ sudo echo “options thinkpad_acpi fan_control=1″ >> /etc/modprobe.d/options
$ sudo rmmod thinkpad_acpi
$ sudo modprobe thinkpad_acpi
The last command loads the thinkpad_acpi module with the specified options.
The fan values can be controlled/viewed on a linux system by simply reading the file /proc/acpi/ibm/fan for e.g.
root@EntePC:~# cat /proc/acpi/ibm/fan
status: enabled
speed: 4998
level: disengaged
commands: level ( is 0-7, auto, disengaged, full-speed)
commands: enable, disable
commands: watchdog ( is 0 (off), 1-120 (seconds))
root@EntePC:~#
Please issue the following command so that we can disengage, the control of the fan and set the fan to go at full speed.
$ sudo echo level full-speed > /proc/acpi/ibm/fan
Once this command is issued, if u cat /proc/acpi/ibm/fan you will see an output as shown above. Please give it some time for this output to show the fan rotating at full speed.
This is a temporary solution and is in no way a fully acceptable long term solution. For the long term, the solution seems to lie in the updated kernel 2.6.30 version. Below you can find the steps required to do the following.
First you need the infrastructure to compile a kernel.
sudo apt-get install libc6-dev kernel-package libncurses5 libncurses5-dev
Once you have this, download the kernel source and copy the .bz2 file to /usr/src
$ cd /usr/src
$ sudo bunzip linux-2.6.30.1.tar.bz2
$ sudo tar -xf linux-2.6.30.1.tar
$ cd linux-2.6.30.1
$ sudo cp /boot/config-`uname -r` ./.config
$ sudo make menuconfig
This shows a configurable user screen. You can simply exit this screen and everything should be fine. Once this is done, simply type
$ sudo make-kpkg –initrd –append-to-version=-avallark kernel_image kernel_headers
Now wait for the whole process to complete. Make sure your fan is running at full speed at this time, cos this is a heavily CPU intensive process.
Once the whole process is done, the system automatically creates two .deb files in the parent directory at /usr/src.
$ cd /usr/src/
$ sudo dpkg -i linux-image-xxxxxxxx.deb
$ sudo dpkg -i linux-headers-xxxxxxx.deb
Replace the xxx with the actual file names from /usr/src directory.
Verify the /boot/grub/menu.lst to see if the new 2.6.30.1 linux image has been picked and reboot using this kernel and you should have your troubles resolved!
Update: Anyone who does not want to follow the above steps to sit and compile everything here are ubuntu’s kernel updates :
Follow the below steps to complete
http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.30.1/linux-image-2.6.30-02063001-generic_2.6.30-02063001_i386.deb
and
http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.30.1/linux-headers-2.6.30-02063001-generic_2.6.30-02063001_i386.deb
From Pagan to Schrödinger’s cat
Travelling through from the west to the east, and travelling through the realms of quantum physics the metaphysical, the religion, the space, the validity of time. Sure there comes a time in everyone’s lives when you sit back and question faith, sure there comes a time when you question the teachings of your teachers, the time when you are being shot down in class simply because you ask the questions that should not be, but the essential question here is “What is faith?”, “What is time?”.
Reading through, Werner Heisenberg’s “Physics and Philosophy” and Stephen Hawking’s “A Brief History of Time”. Also bought other books “Guide to make millions in poker”, “Crowdsourcing” and “The Genesis Secret”. More about the latter books some other day. Today its all about religion and science. I am not going to repeat whats in the book here, but the questions that stick to my mind are “What is time?”.
If the universe is expanding and billions of light years in radius, there surely must be a point in the universe, who are witnessing the big bang as we speak? They being so far away that if d is their distance and c is the speed of light and t is the estimated time (years for us since big bang), then there must be a point in the universe c*t light years away from us, where the light created from the big bang just reached. For this to be true, of course, the universe has to be expanding at a rate faster than the speed of light. For the universe to be expanding at a speed greater than the speed of light, there must be enough energy to propel this mass outward, thus implying the universe must be undergoing mass energy conversion of about (m/c) for every m mass propelled at the speed of light. Consuming energy at this rate, would consume m every light year and thus lead to the collapse of the m. Thus we can safely assume this is not happening. We can probably safely thus conclude, that the universe is probably expanding at a speed much lesser than the speed of light.
This conclusion is important, since this would mean, there is a time Tb which represents a time for us (earth) for us in this universe from which point, for this given universe, there would be a point in time in the past, no matter how fast we travel within the universe, that we will not be able to travel back in time. It is only within this time Tb that the universe can be essentially theoretically co-existing.
What does this mean for faith and religion? Beyond that time Tb in the past or future there is incredible uncertainty. Hasnt faith and religion always been a measure and method to mentally pacify the uncertain? Kiekagard, a devout Christian, rightly mentioned, religions have a factor of unknown and necessitated the “leap of faith” for religions to have any reasonable sense whatsoever. This phychological factor, possibly through upbringing, that has embedded within your subconcious is the basis of religion. Man’s dependence on “the supernatural” as way of consoling your own self that there is an entity that will help him out or will watch over him or will get his rewards, presents if he is “good”, pretty much like our childhood stories of santa claus or the tooth fairy. As we grow up the stories just get more and more believable (according to the level of your knowledge i.e.).
There are some stories in religion that we can directly discount right away are the story of genesis, (the creation) thats common between Islam and Christianity and Judaism (probably it was originally some folk lore among the desert dwellers). These have been proven false by Science. There are some others that are waiting proof, like Jesus respawning, a virgin (Mary) getting pregnant, prophet Mohammed curing people, Moses splitting the sea etc.
I am sure we will have scientific discoveries that will imbue faith in the real truth within our lifetime itself and I cant wait, till then what is needed by both the believers and the non-believers (or believers in science) is understanding. Understanding that the generation that has been brought up with these faiths need to know that there is a supernatural, because their sub-conscious cannot survive the challenges of this life without that mentally stabilizing factor. The younger generation that is not having to go through the etching of the dependance of the supernatural into their subconsious are actually emotionally, mentally a lot self-dependant and thus a more stronger. This could be just another stage in evolution or maybe science will verify what stories, knowledge and writings over 2000 years old (and may i add partially compiled by the men in power) to have ground. So until we know for sure, it is not like for us scientifically inclined to reject any hypothesis and thus we must be open and understanding. The believers thus must also understand that this is a natural process. Man learns and accepts what makes most sense to him logically. Giving man the ability to make this choice is what defines a free society.
Downloading from Rapidshare using WGet
When I am on windows, I use a great tool for downloading rapidshare files called the free download manager and this is something i missed in linux. So here it goes.
First you need to save your login information into rapidshare. (yes, a premium account).
#!/bin/sh
wget \
–save-cookies ~/.cookies/rapidshare \
–post-data “login=
&password= ” \ -O – \
https://ssl.rapidshare.com/cgi-bin/premiumzone.cgi \
> /dev/null
This simple script has to be run once and this will save your account cookie on your computer.
Now, we need the script to download the files using wget into a particular location. Lets assume that location is “/home/bijur/hack/dwnld/”.
#!/bin/sh cd /home/bijur/hack/dwnld/ if [ -f /home/bijur/hack/dwnld/down ] then mv down down_in_progress wget -b -nd -q -c –load-cookies ~/.cookies/rapidshare -i /home/bijur/hack/dwnld/down_in_progress echo `date` >>/tmp/down-sh-log.log echo “Ran and downloaded the following:” >>/tmp/down-sh-log.log cat /home/bijur/hack/dwnld/down_in_progress >> /tmp/down-sh-log.log echo “———————————” >>/tmp/down-sh-log.log fi
Let us save this script as .down.sh. (The . In the beginning of the file makes it a hidden file). The script checks for the existence of a text file “down” in the folder. If it finds one it will launch a wget for all the links in that file.
Third, we do not want to be launching this script every single time. So we can either have this as a nautilus script or a cron. For simplicity (and sticking to concepts already known ), lets use a cron.
On the shell launch the command “crontab -e”. This if launched for the first time will ask you to chose for your favourite editor and launch it. In the crontab file enter the following line:
*/5 * * * * /home/bijur/hack/dwnld/.down.sh
Thats it!! Now everytime you want to download a set of files. Simply create a text file in the directory “/home/bijur/hack/dwnld/” by the name “down”. Within 5 minutes, you should start seeing action!
Note: This script was developed by me about 3 years back and was posted on my blog then. Since then I have lost that blog and have posted this merely as an attempt to save this piece of code.