Recently, I have started using KDE 4.3.1 after it came in Gentoo stable tree. I have been using E17 svn versions for quite some time now. I found that with E17 the cpu is relatively cooler. Of course, my benchmarking is not precise yet it shall provide you an overall view. My system is Thinkpad R60.
With KDE 4.3.1, my system starts at about 55 degree Celsius as seen above. While with E17, it starts at about 50 degree Celsius.
Interestingly, it gradually decreases to about 45 degrees while in KDE it stabilizes at the same 55 degrees.
I decided to do the usual stuff and check. So, I started music play in Amarok (yeah, I use Amarok even in E17.) and compilation. With KDE 4.3.1, temperature reached 60 degrees. While with E17, temperature was within 50 degrees.
After working on my power management, I was able to get KDE to start at about 50 degrees as shown below.
However, E17 proved better once more by starting at about 45 degrees and cooling down to even lower temperatures after that.
Here I write about various events I was involved in and ideas that inspired me. Recently, it is more of a linux blog because I have been doing a lot of work on it. However, off and on I write on various other things that my mind just can't let go easily.
Wednesday, 28 October 2009
Wednesday, 21 October 2009
Tuesday, 20 October 2009
Screen brightness
The brightness of the lcd of my Thinkpad R60 was an issue for me because I could only decrease the brightness using Fn+End; but could not increase it using Fn+Home as the Home key was defunct.
I figured may be changing some ".conf" can help me out. I checked out with people at #gentoo. Just as I expected, I just had to write appropriate integer values to
I figured may be changing some ".conf" can help me out. I checked out with people at #gentoo. Just as I expected, I just had to write appropriate integer values to
/sys/class/backlightFrom the maxbrightness file I found the max value for my system was 7. Checking the brightness file, I found the current screen brightness to be at 0. Setting it to 4 was fine with me.
Wednesday, 7 October 2009
Sed as a handy developer tool
According to EFL standards, static functions started with '_'. So, I had renamed ertf_stylesheet_add to _ertf_stylesheet_add. Going through the source looking for style string stuff, I noticed the error messages did not reflect these changes. So, I decided to do the necessary changes. I wasn't in the mood of looking for all occurrences of ertf_stylesheet_add and change them. So, I decided to try sed.
Starting with the man page and experimenting a little, I wrote the following script:
Starting with the man page and experimenting a little, I wrote the following script:
sed -e s/ertf_stylesheet_add/_ertf_stylesheet_add/ ertf_stylesheet.c
Checking the output, I saw that it worked fine and I could redirect the output to a file to have it saved. Only problem was that it changed occurrences of _ertf_stylesheet_add to __ertf_stylesheet_add, which was completely uncalled for. Digging deeper, I found that I can get rid of this by specifying addresses, i.e. restricting sed usage by specifying line numbers in my case. I wasn't satisfied with this because then I would have to go back and check the line number to ignore. So, I kept looking and finally I found my solution in regular expressions. I typed the following at command line and it worked just fine.
sed -e s/[^_]ertf_stylesheet_add/_ertf_stylesheet_add/g ertf_stylesheet.c
Also, by now I had learnt that adding the 'g' option was safe. Again I had missed on an an essential subtelity. I had forgotten this shall delete the intial double quotes of the error messages which were like:
"ertf_stylesheet_add: ..."
So, I edited my command as follows.
sed -e 's/\([^_]\)\(ertf_stylesheet_add\)/\1_ertf_stylesheet_add/g' ertf_stylesheet.c
This removed the double quotes problem. Now, as things started rolling, I wanted to do with sed. Now, in the error messages _ertf_stylesheet_add was usually followed by a colon. However, a few typos were there where there were colons instead of semicolons. So, I edited the sed line as follows.
sed -e 's/\([^_]\)\(ertf_stylesheet_add\)/\1_ertf_stylesheet_add/g' -e 's/;\(.\)/:\1/g' ertf_stylesheet.c
This did the task with the added problem of replacing
case ';':
with
case ':':
which was undesirable. Now, the problem was I was interested in a conditional replacement. So, I further edited the line as follows.
sed -e 's/\([^_]\)\(ertf_stylesheet_add\)/\1_ertf_stylesheet_add/g' -e 's/stylesheet_add;/stylesheet:/g' ertf_stylesheet.c
Here I am using two s/// expressions as this is the only way out. Checking at ##sed on freenode, I found the semantics of s/// don't allow conditional replacement. I was talking about adding this functionality to sed; but that would change sed's regxp flavour. However, this could be achieved easily using perl.
perl -pe 's/(ertf_stylesheet_add)(;?)/"$1".($2?":":"")/eg'
Well doing this task using sed took longer than it would have taken if I had done it by hand. However, since these tasks shall be common (code refactoring), I thought it shall save much time and effort in future.
Actually, the method worked so well that the "future" came in seconds and I was writing multi-line sed scripts to format error messages the whole lib folder. I quickly wrote the following lines followed by some others.
sed -e 's/\([^_]\)\(ertf_font_add\)/\1_ertf_font_add/g' -e 's/font_add;/font:/g' ertf_font.c
sed -e 's/\([^_]\)\(ertf_color_add\)/\1_ertf_color_add/g' -e 's/colortbl:/ertf_color_table:/' -e 's/color_add;/color_add:/g' ertf_color.c
sed -e 's/readloop:/ertf_document_parse:/g' ertf_document.c
Wednesday, 30 September 2009
Kernel upgrade
For some time I had been trying to upgrade the kernel on my Gentoo box from 2.6.29 to 2.6.30. I was interested in 2.6.30 kernel because of three reasons.
#1 From what I remembered from the experiements with sreadahead, this kernel was supposed to support it well. However, recently when I dug into the topic, Jeremy told me that it is very much a dead project now. I still have baselayout2 and openRC to tinker with to obtain boot speed improvements.
#2 I had a secondary LAN port installed. So, I had to configure my kernel for that. I decided that since a new kernel is available, I shall install the driver and the kernel too.
#3 This kernel supports LZMA compression. I was interested in trying it out.
I compiled the kernel fine, editted grub.conf and rebooted into my experiemental kernel. During the boot, I could clearly see that sreadahead was a dead project. It took me straight to kdm screen. However, after kdm the system froze.
My first idea was to check the command line. So, I restarted and from kdm went to command line. Invoking the following, I found that the driver for the LAN interface was fine.
lspci -k
I was clueless as to what went wrong. I thought I might need to build xorg-server, input drivers and video drivers against my new kernel. So, I ran the following command.
emerge -v xorg-server xf86-video-intel xf86-input-evdev
After that once again, I tried to get back to GUI using. However the system froze again. I thought lets get some help. Checking on #gentoo, I was suggested to try what I had done as explained above. I kept looking at IRC for four days without any solution to my problem. Then, thinking my KDE might be having issues, I tried at #gentoo-kde where Aleister suggested I might have enabled KMS and using xorg-server 1.5 at the same time. My X server log file at
/var/log/Xorg.0.log.old
was reporting fatal server error. Checking my menuconfig, I found that he was right. Disabling that option, I was able to do away with system freezes. All I lost was the two penguins that appeared during boot. The problem was xorg-server 1.5 does not support kernel mode setting (KMS).
Tuesday, 22 September 2009
Stages in software development
During development of software, debugging becomes easy when we have working code after each commit. O'Rielly's "must read" articles for programmers also recommend planning each commit well. This actually is a better way than unit testing, though is much the same in some cases. The advantage here is the developers are not only sure of the working of the newly added unit but also of its integration with the rest of the code.
To exemplify, I share the following screenshots. The screenshots are of an rtf file renderer. The folowing is the screenshot after foreground color implementation. Here the font size is rendedred double the required size. Also note the unnecesary space in between the letters 'm' and 'p' of the word "example". There are other similar cases too.
In the next commit, the font size problem is fixed, yet the problem of unnecessary space remains unsolved, though it doesn't seem to make much difference.
Then the unnecessary space problem was solved.
In the subsequent commit, double underline support was added.
The above were the screenshots of successful additions to the software. However, in between these, there must be numerous trials that reveal error in implementation. The point is while attempting to get a particular task done and properly integrated reduces debugging load.
The process described above is typical in scripting languages like Python, Lisp, etc. Following these lines in languages like C isn't difficult either. Its just one task at a time. So you build the base first - an unpolished prototype of a prototype - add features to it and improve the base to integrate better with the added features, i.e. bottom up.
Thursday, 17 September 2009
Gentoo incremental updates
Gentoo linux has been releasing weekly snapshots instead of usual long term releases. This is a nice way of providing cutting edge technology. To add to that, Gentoo does not provide updates regular way. Ebuilds are stabilized by developers and whenever we want to update our system, we have to follow the subsequent steps:
This unique updating method keeps Gentoo users at cutting edge of technology. However, there are some drawbacks. A dependency resolution problem occurs when a particular package has been stabilized; but some of its dependencies are not. In this case, portage complains that the dependencies are masked. This is what happened to me last night.
I checked out with people at #gentoo channel on IRC. The discussion could not solve the issue. I decided to postpone the update and got back to work. After about 3 hours, I synced again. The dependency problem wasn't solved. I had not installed any masked packages and PyQt wasn't also present in package.keywords. I was just hoping the incremental releases had got into a situation I described earlier as a drawback of the Gentoo update system. So, I postponed the update till morning.
Today morning, when I synced I noticed a change in PyQt ebuild. When I ran a pretended update, I got the following list of updates.
My patience finally paid off. However, it would be wrong on your part to take the impression that this is general drawback of the Gentoo release system. That is because I am using KDE 3.5.10, which does not have upstream support any more. Unless you are in such an odd situation like me, Gentoo is a nice way of getting fine-tuned cutting edge software.
P.S.: A Gentoo forums thread clarifies that this is not a singular case.
* emerge -v --syncThis updates ebuilds.
* emerge -pv --deep --newuse --update worldThis gives a list of changes that shall be made. In case, there is change of USE flags, this command will detect the packages that need to be reinstalled.
This unique updating method keeps Gentoo users at cutting edge of technology. However, there are some drawbacks. A dependency resolution problem occurs when a particular package has been stabilized; but some of its dependencies are not. In this case, portage complains that the dependencies are masked. This is what happened to me last night.
emerge -pv --deep --newuse --update world
These are the packages that would be merged, in order:
Calculating dependencies... done!
!!! All ebuilds that could satisfy ">=x11-libs/qscintilla-2.4[python]" have been masked.
!!! One of the following masked packages is required to complete your request:
- x11-libs/qscintilla-2.4 (masked by: ~x86 keyword)
For more information, see the MASKED PACKAGES section in the emerge
man page or refer to the Gentoo Handbook.
(dependency required by "dev-python/PyQt-3.18.1" [ebuild])
(dependency required by "media-sound/amarok-1.4.10_p20090130-r3" [installed])
(dependency required by "world" [argument])
I checked out with people at #gentoo channel on IRC. The discussion could not solve the issue. I decided to postpone the update and got back to work. After about 3 hours, I synced again. The dependency problem wasn't solved. I had not installed any masked packages and PyQt wasn't also present in package.keywords. I was just hoping the incremental releases had got into a situation I described earlier as a drawback of the Gentoo update system. So, I postponed the update till morning.
Today morning, when I synced I noticed a change in PyQt ebuild. When I ran a pretended update, I got the following list of updates.
emerge -pv --deep --newuse --update world
These are the packages that would be merged, in order:
Calculating dependencies... done!
[ebuild N ] app-portage/portage-utils-0.1.29 78 kB
[ebuild U ] app-shells/bash-4.0_p28 [3.2_p39] USE="net%* nls -afs -bashlogger -examples -plugins -vanilla" 6,155 kB
[ebuild U ] dev-db/sqlite-3.6.17 [3.6.16] USE="readline%* threadsafe -debug -doc -soundex -tcl" 2,912 kB
[ebuild U ] sys-devel/libtool-2.2.6a [1.5.26] USE="-test% -vanilla" 717 kB
[ebuild U ] app-emacs/emacs-common-gentoo-1.2 [1.0] USE="X -emacs22icons%" 46 kB
[ebuild NS ] app-editors/emacs-23.1 [22.3-r2] USE="X alsa gpm toolkit-scroll-bars xpm -Xaw3d -dbus -gif -gtk -gzip-el -hesiod -jpeg -kerberos -m17n-lib -motif -png -sound -source -svg -tiff -xft" 33,577 kB
[ebuild U ] virtual/emacs-23 [22] 0 kB
[ebuild U ] app-admin/eselect-python-20090824 [20090606] 5 kB
[ebuild U ] dev-python/sip-4.8.2 [4.7.9] USE="-debug -doc%" 601 kB
[ebuild U ] dev-python/setuptools-0.6-r1 [0.6_rc9] 253 kB
[ebuild U ] sys-libs/pam-1.1.0 [1.0.4] USE="cracklib nls -audit -debug% (-selinux) -test -vim-syntax" 1,564 kB
[ebuild U ] sys-auth/pambase-20090620.1-r1 [20081028] USE="cracklib sha512 -consolekit -debug -gnome-keyring -mktemp -passwdqc (-selinux) -ssh" 3 kB
[ebuild U ] sys-auth/consolekit-0.3.0-r2 [0.2.10] USE="pam -debug -doc% -policykit%" 385 kB
[ebuild U ] app-admin/sudo-1.7.2_p1 [1.7.1-r1] USE="pam -ldap -offensive (-selinux) -skey" 753 kB
[ebuild U ] dev-python/PyQt4-4.5.4-r4 [4.4.4-r5] USE="X dbus kde -assistant -debug -doc -examples -opengl -phonon -sql -svg -webkit -xmlpatterns" 6,808 kB
[ebuild U ] dev-python/PyQt-3.18.1 [3.17.6] USE="-debug -doc -examples" 801 kB
Total: 16 packages (14 upgrades, 1 new, 1 in new slot), Size of downloads: 54,653 kB
My patience finally paid off. However, it would be wrong on your part to take the impression that this is general drawback of the Gentoo release system. That is because I am using KDE 3.5.10, which does not have upstream support any more. Unless you are in such an odd situation like me, Gentoo is a nice way of getting fine-tuned cutting edge software.
P.S.: A Gentoo forums thread clarifies that this is not a singular case.
Monday, 31 August 2009
Wednesday, 12 August 2009
Rtf file size comparision
Recently, I was experimenting with rtf files. I found something really interesting. An rtf file containing 14 unformatted character created in Microsoft Word turned out to be around 30 kb in size, while an rtf file containing 54 formatted chars created in OpenOffice was only 2kb in size.
I was doubting Microsoft when I read the following line in the rtf specification v1.0:
"All styles in the document's style sheet can be included, even if not all the styles are used." However, when I actually tested them, I found their software to be producing even larger files than I expected.
I was doubting Microsoft when I read the following line in the rtf specification v1.0:
"All styles in the document's style sheet can be included, even if not all the styles are used." However, when I actually tested them, I found their software to be producing even larger files than I expected.
Subscribe to:
Posts (Atom)









