Blog

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

Displaying recursive datastructures with Smarty

03.08.2005 at 20:20

For those of you who don't know what smarty is, it is a PHP Templating-Engine whose main idea is to separate programm logic from presentation.

I would suggest reading the excellent documentation for a brief overview.

A quite common task in web development is to display recursive data structures such as tree menus etc. However this can be a bit tricky for someone new to smarty. There is currently no built in mechanism for doing so, but with the possibility to include subfiles it can be done. Here is how it works.

menu.tpl

{* other html stuff *}
<h2>Linklist by category</h2>
      {include file="menu-recursive.tpl" menu=$menu depth=1}
</div>
{* other html stuff *}

menu-recursive.tpl

{foreach name=entry item=entry from=$menu.entries}
    {if $smarty.foreach.entry.first}
        <ul>
    {/if}         
    <li>{$entry}</a></li>
    {if $smarty.foreach.entry.last}
        {if $menu.sub}
            {include file="menu-recursive.tpl" menu=$menu.sub depth=$depth+1}
        {/if}
        </ul>
    {/if}
{foreachelse}
    <p>This category contains currently no entries.</p>
{/foreach}

PHP-file with the datastructure.

$demo = array(
    'entries' => array('demo 1','demo 2'),
    'sub' => array(
        'entries' => array('demo 1.1','demo 2.1'),
        'sub' => array(
            'entries' => array('demo 1.1.1','demo 2.1.1')
        )
    )
);

$smarty->assign('menu',$demo);
$smarty->display('menu.tpl');

You should get a list looking similar to the one below.

However if a designer is able to understand this stuff is a completly different story...

read more comments

Fluxbox key bindings after switchover to Xorg

02.08.2005 at 21:14

I finally had some time to switch my desktop box over to Xorg. However after the successful upgrade i noticed that my fluxbox key bindings were no longer working. After a while i found out that the ugly Windows-Key, which i am using as a modifier , did no longer work as expected. xmodmap confirmed that:

xmodmap:  up to 2 keys per modifier, (keycodes in parentheses):

shift       Shift_L (0x32),  Shift_R (0x3e)
lock        Caps_Lock (0x42)
control     Control_L (0x25),  Control_R (0x6d)
mod1        Alt_L (0x40)
mod2        Num_Lock (0x4d)
mod3        Mode_switch (0x71)
mod4      
mod5        Scroll_Lock (0x4e)

So first of all i had to look up the keycode of the windows key. This can be done with xev:

KeyRelease event, serial 25, synthetic NO, window 0x1200001,
    root 0x4b, subw 0x1200002, time 3292297, (45,38), root:(108,116),
    state 0x0, keycode 115 (keysym 0x0, NoSymbol), same_screen YES,
    XLookupString gives 0 bytes:  ""

Now that we know the keycode we can define our modifier:

xmodmap -e 'keycode 115 = Super_L'
xmodmap -e 'add Mod4 = Super_L'

Now xmodmap should print something like this

xmodmap:  up to 2 keys per modifier, (keycodes in parentheses):

shift       Shift_L (0x32),  Shift_R (0x3e)
lock        Caps_Lock (0x42)
control     Control_L (0x25),  Control_R (0x6d)
mod1        Alt_L (0x40)
mod2        Num_Lock (0x4d)
mod3        Mode_switch (0x71)
mod4        Super_L (0x73)
mod5        Scroll_Lock (0x4e)

And the modifiers should once again work properly. You can add the two xmodmap commands to your ~/.xsession file, this will adjust the settings on every start of the xserver.

cat >> ~/.xsession << "EOF"
xmodmap -e 'keycode 115 = Super_L'
xmodmap -e 'add Mod4 = Super_L'
EOF

read more comments

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