Blog

Fluxbox startup techniques and transparent Eterm on desktop

15.08.2005 at 17:27

Today i am writing about my favorite window manager fluxbox. I personally like to have some information about the system displayed on the desktop, therefore i am using torsmo. However torsmo doesn't really work well together with root-tail and so i began to search for another way to easily display some information from a script or file on the screen.

After a while i came up with a transparent Eterm on the desktop. So here is my ~/.fluxbox/fluxbox-startup

#!/bin/bash
#
# we don't have to execute fluxbox
# because it is already running,
# this scirpt will be called from
# ~/.fluxbox/apps
#
fbsetbg ~/.fluxbox/wallpaper
torsmo &
# add a transparent eterm to the desktop
~/.fluxbox/startup/eterm-syslogd &

~/.fluxbox/startup/eterm-syslogd

#!/bin/bash

#
# eterm startup script for use on a desktop.
#

Eterm \
    --trans true \
    --background-color white \
    --foreground-color black \
    --pointer-color white \
    --no-cursor \
    --scrollbar false \
    --xterm-select \
    --buttonbar false \
    --font -artwiz-snap.de-normal-r-normal--10-100-75-75-p-90-iso8859-1 \
    --borderless true \
    --geometry 110x10+10+620 \
    --no-input \
    --name etermondesktop \
    --exec sudo tail -f /var/log/messages

fluxbox-startup is called via ~/.fluxbox/apps as shown below

[startup] { ~/.fluxbox/fluxbox-startup }
[app] (etermondesktop)
  [Sticky]      {yes}
  [Layer]       {12}
  [Hidden]      {yes}
[end]

This has the advantage that the file is only called when fluxbox starts up other WMs don't care about it and fluxbox style files can still use rootCommand: (for example to set a wallpaper) which wouldn't be possible if rootCommand was set in ~/.fluxbox/init.

The next few lines set specific settings for our app called etermondesktop. Because Sticky is set our Eterm will be displayed on every workspace, Hidden prevents it from being visible in the toolbar and Layer places it below all other windows.

By passing the --name etermondesktop option to Eterm our settings will apply to it.

» read more » comments

PEAR:DB Database Abstraction Layer

11.08.2005 at 09:31

Nowadays web applications need to be flexible and so it is wise to use a database abstraction layer, so it will be easy to exchange the underlaying DBMS. There are quite a few projects out there who provide this functionality, PEAR:DB PEAR:MDB and AdoDB are probably the most popular ones.

While developing this page i took a closer look at PEAR:DB mostly because it is a part of PEAR and therefore available on most system by default. Furthermore it's API is straight forward and the documentation is usable. Additionally i can recommend reading the excellent Quick Start Guide to Pear DB.

Since PEAR:DB aims to support multiple DBMS they need to make some compromises, for example not all DBMS support something like mysql_insert_id() therefore such a feature has to be emulated. In case of PEAR:DB this is done with sequences.

Of course you could do an ugly hack like this:

mysql_insert_id($DB->connection);

However this is DBMS-specific code and the hole point about using a DB abstraction layer is to avoid this kind of thing, furthermore you will screw up if the connection property will once be private.

So you see, it's always up to you whether the code is really DB independent or not.

Enjoy.

» read more » comments

Booting Windows from a non-first disk with GRUB

09.08.2005 at 21:16

As you probably know Windows can only be installed on the first harddisk, but furthermore it can only boot from there. I strugled over this recently while configuring GRUB, i was actually quite sure that my config file was correct (remember grubs naming convention which starts with zero so hd(0,0) refers to the first partition on the first disk) but Windows just didn't boot.

And so i googled for a possible reason and found this faq entry. My machine has /dev/hdc for reserved for linux while /dev/hdd belongs to a Windows 2003 Server so my entry in /boot/grub/menu.lst now looks like this:

title Windows 2003 Server
   map (hd0)(hd1)
   map (hd1)(hd0)
   rootnoverify(hd1,0)
   chainloader +1
   makeactive

Since grub doesn't count dvd and cdrom drives, in my system hd0 points to /dev/hdc and therefore hd1,0 refers to /dev/hdd1.

Shuting down / rebooting the system with a grub menu entry

I personally find it quite useful to have an entry to shutdown or reboot the PC available in the grub menu because from time to time it happens that i just want to eject a cdrom without actually starting the operating system so these comes in handy.

title shutdown
halt

title reboot
reboot

» read more » comments

Vim commands for the daily life

05.08.2005 at 12:42

My favorite editor is vim but until recently i didn't really use its great features (well even yet i may only use about 5% of its capabilities). So i decided to read a bit through the documentation and there is lot of interesting stuff, and so i am going to write a short summary about the commands which i use in daily life (not the cryptic ones which were designed to attract perl programmers ;)) However this is not ment as an introduction for newbies or a documentation type :help or checkout vimtutor for these things. Ok here it goes:

args 			# show opened files
args file3 fil4		# set new ones

next	next!	wnext	# go to the next/previous file
prev	prev!	wprev	# in the list depending on what you
			# want to do with your changes.

split [filename]	# split window horizontally / 
vsplit [filename]	# vertically

CTRL + W W		# switch between the windows
CTRL + W [UP/DOWN-KEY]

CTRL + W _		# maximize current window
:qall			# close all windows
:only			# close all windows expect the current one

"{a-z}y			# yank a line into a register
"{a-z}p			# past the content from a register

:mark {a-z}		# set a mark store it in a register
:m{a-z}

:'{a-z}			# jump to a given mark

q{a-z}			# record some commands and store 
			# them in a register type q to stop 
@{a-z}			# recording and @{a-z} to play

Oh and here is an excellent VIM Reference Card for those of you who like to further investigate in this topic.

» read more » comments

APT keeps packages back

04.08.2005 at 20:05

Ever wondered why apt keeps some packages back when doing an apt-get update && apt-get upgrade?

apt-get upgrade
Reading package lists... Done
Building dependency tree... Done
The following packages have been kept back:
  cpp gcc libcurl3 ssh tasksel x-window-system-core xbase-clients xlibmesa-gl
  xutils
0 upgraded, 0 newly installed, 0 to remove and 9 not upgraded.

The message actually means that there is a new package version available but for some reason it can not be installed. Maybe the package has broken or new dependencies. If you want further information about a specific packages this can be done by setting a special options like shown below.

apt-get -s -o Debug::pkgProblemResolver=yes install xutils > /dev/null
Starting
Starting 2
Package xutils has broken dep on xbase-clients
  Considering xbase-clients 4 as a solution to xutils 10013
  Added xbase-clients to the remove list
  Fixing xutils via remove of xbase-clients
Package x-window-system-core has broken dep on xbase-clients
  Considering xbase-clients 4 as a solution to x-window-system-core 0
  Re-Instated libglu1-xorg
  Re-Instated libdmx1
  Re-Instated libxkbfile1
  Re-Instated libxkbui1
  Re-Instated libxss1
  Re-Instated libxxf86dga1
  Re-Instated libxxf86misc1
  Re-Instated libxxf86vm1
  Re-Instated xbase-clients
  Re-Instated x-window-system-core
Package xlibmesa-glu has broken dep on libglu1
  Considering libglu1-xorg 0 as a solution to xlibmesa-glu 15
  Added libglu1-xorg to the remove list
  Considering libglu1-mesa 0 as a solution to xlibmesa-glu 15
  Fixing xlibmesa-glu via keep of libglu1-xorg
Package x-window-system-core has broken dep on libglu1-xorg
  Considering libglu1-xorg 0 as a solution to x-window-system-core 0
  Holding Back x-window-system-core rather than change libglu1-xorg
Done

So you can see the problem, usually an apt-get install [packagename] should solve it. However if you have numerous packages which have been kept back you may want to do an apt-get dist-upgrade. For further information check out the APT-Howto.

» read more » comments

<< 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 >>