Why wordpress.com …

Those knowing my blog at heelsbroke.blogspot.com might wonder why I started publishing Linux documentation here at wordpress.com. So a few words on this subject are in order …

Looks

I’m pretty much lured by the visual impression that things have on me. Show me any well-written and helpful text on a page: If the design the text is embedded into is appalling, I hate to look at it. No matter how useful its reading might be.

This begins with pages overloaded with items, arranged so carelessly and ugly, that one cannot be sure: Are the designers simply non-pro enough to not bother whether we like their product or not, or did they simply choose the wrong job. After all a lousy web-designer could be an excellent flea circus manager any time.

Here’s a fine start of what I think is a web site with beautifully designed entrance pages, with only the needed information on it, and arranged to a nice design:
http://www.clivemenzies.co.uk/

WordPress fulfills my requirements in that regard, with dozens of different themes they offer. These themes are in most cases customizable, so to some degree users can change the appearance of them to their likings.

Additionally wordpress.com has set up a nice admin area – a.k.a. dashboard – for their users, in non-kitschy colors, and with easily browsable sub-items to edit the settings of a blog.

Functionality

I refuse to waste my time with unnecessary efforts to reach some end: If I have to dig for hours for help, on how I change things on my blog, and whether I can change them at all, then I will look for a change of the blog host. Sooner or later.

A very good start for help so far was the very entrance help page for wordpress.com: http://support.wordpress.com/.

Plus: I publish samples of code very often – which is a snap on wordpress com: They offer a style sheet tag to do that, that looks like so:

[sourcecode language="css"]
this is some <code> foo code </code>
[/sourcecode]

The important part above are lines 1 and 3: This little snippet also enables readers to easily distinguish explanations on my posts from some actual code I show them.

And yes: Sad to say on blogger.com – to get code like that running like it does here – involves a lot more effort, as it seems.

One of my favorite features on my blogs at wordpress.com is the diff you can see between different versions of the entries I wrote: I like to fine tune my posts often, and under these circumstances it’s highly important to have definite control of what was changed: I publish code, and I have to make extra sure I don’t mess it up.

And yes, wordpress.com even gives me stats for my posts – at the admin area of my blog.

Code

HTML code, as probably any code, has to be as short as possible, and as long as necessary. Keep it simple. This is important to keep debugging time at a minimum.

Besides that, non-bloated code is more elegant, and much more beautiful. For my eyes at least …

To learn HTML, a good and efficient way is to simply use the WYSIWYG editors of blog hosters. They’re available both on blogger.com and on wordpress.com: Switching from WYSIWYG to HTML editor mode shows you the tags to use for what you want.

To illustrate it, here’s an example – I want the code for these four words:

italic, bold and centered

To format the text above the blogger.com WYSIWYG editor writes this code:

<div style="text-align: center;"><span style="font-style: italic;">italic</span>, <span style="font-weight: bold;">bold</span> and centered</div>

While the code writen by the editor on wordpress.com yields this:

<p style="text-align: center;"><em>italic</em>, <strong>bold</strong> and centered</p>

I prefer the shorter one produced by the wordpress editor. Especially as both code snippets on both blogger and wordpress do nearly the same.

Costs

Well, yes – last, but certainly not least: blogging at wordpress.com is free for its users.

Now all this doesn’t mean I will close down my blog at heelsbroke.blogspot.com. It only means that I will use that blog for something else in the future. Details are not clear yet. Stay tuned, please …

Display cloning on Linux — xrandr1.2 and xorg-driver-ati

Following a few notes on the new way on Debian GNU/Linux to clone a notebook screen to an external video device. First please note there are already documents available on the background of it. Not necessarily Debian related: two links for that:

http://wiki.debian.org/XStrikeForce/HowToRandR12
http://www.thinkwiki.org/wiki/Xorg_RandR_1.2

For the latest news on the software please see the xorg-driver-ati archives on

http://lists.x.org/archives/xorg-driver-ati/

The hints here are meant for Debian Linux, and for the new ati radeon driver. The following from playing the software on an Apple PowerBook5,8. Display managing was done with KDE/KDM. Here’s xorg.conf I have installed. Please note, that these drivers are work in progress. Their behavior sometimes seems to be completely unpredictable. So the following few hints on how to use them do not necessarily take into account the intentions of the programmers of this software. That is the following procedures were found to work. No guarantees they’re right, whatsoever.

Help – if things go wrong

If you’re running into problems with the software please make sure – before changing anything like suggested below – that you have a second Linux driven computer handy to ssh into the machine with the changed radeon drivers. Make sure you can shutdown your computer safely via an ssh connection.
First a few basics on X on a friendly Apple page :

http://developer.apple.com/opensource/tools/runningx11.html

The page above might help understand the following few emergency commands:

*** 1:
If you need to run xrandr on a remote computer via ssh – for example to switch on or off its display – you need to login to this computer with the 'Y' flag, something like

ssh -Y xxx.xxx.xxx.xxx

where the xxx … part above is the IP of the remote client

*** 2:
If you now run on the remote client ‘xrandr -q’ it might yield the values for the computer where you were coming from. This indicates you won’t be able to change display settings for this remote client. So run this, on the remote machine:

echo $DISPLAY

If your shell is answering with something like

localhost:10.0

you probably will need to change that. Run

export DISPLAY=:0

Again running ‘echo $DISPLAY’ this time should give something like

:0

So, e.g. if the notebook display on the remote client was shut down accidentally, with the now changed $DISPLAY environment it should be possible to switch it on again with something like:

xrandr –output LVDS –auto

Thanks:
Brice Goglin
Xavier Bestel

Getting the software

This seems to be a definite preliminary:

  • xrandr1.2 (can be checked with a ‘xrandr -v’) and a
  • xserver-xorg-video-ati 6.7.19x and newer

xrandr1.2, e.g., comes on Debian unstable with newer x11-xserver-utils packages.

And a relatively fresh Debian from the unstable branch might be needed, too.

There’s also an option to compile the necessary ati drivers by yourself. Not quite necessarily the Debian way:

apt-get build-dep xserver-xorg-video-ati
git clone git://anongit.freedesktop.org/git/xorg/driver/xf86-video-ati
cd xf86-video-ati/
./autogen.sh
MAKEFLAGS="CC=gcc-4.3" make

You might even try to just compile what you need, with the last line above changed to something like

MAKEFLAGS="CC=gcc-4.3" make -C src {ati,radeon}_drv.la

gcc-4.3 is the compiler I would use.
After the succeeded compile, for a PowerBook5,8 it should be enough to just manually copy those resulting drivers:

  • ati_drv.so
  • radeon_drv.so

to

/usr/lib/xorg/modules/drivers

Be careful: If you are in a running X session don’t copy these new drivers with the usual 'cp': If you do you might get thrown out of your X very ugly, with the keyboard being unavailable for further use. I recommend to either log out of X completely, and then copy the mentioned drivers to

/usr/lib/xorg/modules/drivers

Even better perhaps the solution I was told, something like

cp –remove-destination <your driver> /usr/lib/xorg/modules/driver

Cloning your screen

Two scenarios for the notes following:

  • Connecting the notebook to an external VGA
  • Connecting the notebook to a TV set

Cloning the notebook screen both to VGA and TV works.

Connecting the notebook to an external TV monitor

At least with xorg packages on Debian unstable/powerpc software is getting installed, that enables screen cloning to an external PAL TV monitor, in color mode. This is accomplished here via the S-Video connector on the computer.

Please note the Debian/unstable/ppc packages being used for screen cloning to a TV set as reported here, have been fresh as of around June 10 2008.

A color video as being played here with mplayer on the laptop, seen on the telly, if the LCD is switched off:

(The girl is Kellemarie, from a video that was available via http://www.goodmagazine.com/section/Transparency/Internet_Porn – and no, it’s no porn video … :)

Cloning was done like along the line of that:

1:
xrandr –output S-video –set load_detection 1

2:
xrandr –output S-video –set tv_standard pal

3:
xrandr –addmode S-video 800×600

4:
xrandr –output S-video –off

5:
xrandr –output S-video –mode 800×600

Seems one can omit step 4.

An S-video to composite adapter was used (see http://www0.info.apple.com/images/kbase/33001/33001_23.gif for more), which was connected via an adapter to a SCART cable. The latter connected to a rather cheap 800×600 PAL color TV set. I’m no sure whether this device is really an 800×600 one. But at least it works with these values given to xrandr.

Sound for the movie was played on the notebook, due to the fact the audio out connector on the Apple PowerBook is not installed near the S-video out port on the same side of the machine, but on the opposite one. Which leaves the audio adapter cable, that is connected to the SCART cable to the TV set, too short to reach the audio out port.

Note: to get the complete LCD screen to the external screen (VGA or TV-set): I switch off my LCD:

xrandr –output LVDS –off

and after that the screen on the VGA/TV is complete. On the TV-set, that is, nearly complete: its corners are rounded, contrary to the LCD, where they’re angular.

Connecting the notebook to an external VGA

Two scenarios are being discussed here:

  • Setting the LCD screen to the largest possible common mode with the VGA
  • Setting the VGA to its largest mode

The first option implies the possibility of having both screens switched on, with the drawback of a somewhat reduced picture quality at least for the now lower moded LCD screen, where fonts now look fuzzy, and the whole screen is considerably smaller. That is, the LCD picture is looking a bit ugly now. Please have a look at the output of "xrandr -q" below for the highest possible common mode for both screens, which in that case is "1280 x 800"
These are the commands executed on the notebook:

xrandr –output LVDS –mode 1280×800
xrandr –output DVI-0 –auto

Result:

$ xrandr -q
Screen 0: minimum 320 x 200, current 1280 x 1024, maximum 2720 x 1024
LVDS connected 1280×800+0+0 (normal left inverted right x axis
y axis) 321mm x 214mm
1440×960 59.9 +
1280×800 60.0*
1280×768 60.0
1024×768 60.0
800×600 60.3
640×480 59.9
DVI-0 connected 1280×1024+0+0 (normal left inverted right x axis
y axis) 300mm x 225mm
1280×1024 60.0*
1280×960 59.9
1280×800 60.0
1280×768 60.0
1024×768 85.0 84.9 75.1 70.1 60.0
800×600 84.9 85.1 75.0 60.3
640×480 85.0 84.6 75.0 60.0 59.9
720×400 70.1
S-video connected (normal left inverted right x axis y axis)
800×600 59.9 + 60.3

Please note that the VGA is in its highest possible mode, i.e. '1280×1024', while the notebook screen is not.

If you don’t like the reduced mode on your notebook screen, simply switch it off while the VGA attached to it is on. This latter approach might also be useful if parts of the LCD display are missing on the VGA.

Please note there’s much more you might want to try with this new driver. Please ask a search engine on that, something like this, perhaps …
'man {xrandr,radeon}' might be useful, too.

Thanks:
Michel Dänzer
Brice Goglin
Xavier Bestel
Everyone out there who made this new software possible

muttprint

Muttprint is a tool to print an email message in mutt: The documentation – at least here on Debian/unstable, and as of today – in some important sections seems to be a bit useless. That’s why you’re here, right … :) … ?

For example this setting in ~/.muttrc that is recommended in
/usr/share/doc/muttprint/manual/manual-en.pdf.gz
is useless here:

# Dump all headers
macro index p "<display-toggle-weed> <print-message> <display-toggle-weed> <exit>"
macro pager p "<display-toggle-weed> <print-message> <display-toggle-weed>"

Well: wrong, I was lying: the documentation mentioned above says, just a few words later, to set

# No confirmation before printing
set print="yes"

If you have this last line in your ~/.muttrc chances are good that things go well for mutt printings … Problem with this setting: printing seems to start immediately, without confirmation, after typing 'p' in mutt. Here’s a nice workaround for that:

Simply direct the print-out to your favorite gv viewer. I use 'kghostview' for it. So the necessary setting for that would be something like this in ~/.muttprintrc:

PRINT_COMMAND="kghostview – "

Leaving away the hyphen in the line above might yield an empty page …

Please see my complete ~/.muttprintrc near the end of this post.

Note that in ~/.muttprintrc some options set to the "PRINTED_HEADERS=" line seem to get ignored in the actual print-out. Don’t ask me why, because I don’t get that …

Here’s what might be necessary for your ~/.muttrc, too :

set print_command="muttprint"
set print_split

So with the settings mentioned here, to print an email it should be enough to open it, then maybe toggling the display of headers or not by typing 'h', and then 'p' for the actual preview …

Result: Reading the available documentation for muttprint on Debian, added to the few hints from here should give you nice prints from within mutt. … :)

Following the mentioned config settings in one place. Relevant lines in ~/.muttrc:


#### muttprint:
set print_command="muttprint"
set print_split

# Dump all headers
macro index p "<display-toggle-weed> <print-message> <display-toggle-weed> <exit>"
macro pager p "<display-toggle-weed> <print-message> <display-toggle-weed>"

# No confirmation before printing
set print="yes"

And here comes ~/.muttprintrc:

# MUTTPRINT configuration file
#
# ~/.muttprintrc or /etc/Muttprintrc
# ~/.muttprintrc

#
# Here you can configure your printer
# To print in a file, use the following entry:
# PRINTER="TO_FILE:/home/berwal/test.ps"
#PRINTER="lp"

#
# Here you can set the print command
# $PRINTER is substituted by the PRINTER
# variable
#PRINT_COMMAND="lpr -P$PRINTER"
#PRINT_COMMAND="CUPS"
#PRINT_COMMAND="gv -"
PRINT_COMMAND="kghostview -"

#
# Here you can set the path to the penguin image
PENGUIN="/usr/share/ospics/Debian_color.eps"
#PENGUIN="off"

#
# Turn printing of X-Face picture on/off (on needs the packages compface
# and imagemagick)
XFACE="off"

#
# Here you can turn the duplex print on or off. (needs psutils)
# Possible values are "off" or "on"
#
# For Postscript duplex printer set it to "printer"
DUPLEX="printer"

#
# Here you can turn on or off the paper save mode
# (printing 2 pages on 1 page) - needs psutils
# Set it to 'optional' if you only want papersave mode
# if more than one page is printed.
PAPERSAVE="off"

#
# Here you can set the printing speed in seconds
# per page
SPEED="80"

#
# Choose a font:
# - Latex (EC-Fonts)
# - Latex-bright (CM-bright)
# - Times
# - Utopia
# - Palatino
# - Charter
# - Bookman
FONT="Latex"


#
# Choose a style for the first page
# - plain       no rules
# - border      rule after the headers
# - fbox        simple box around the mailheaders
# - shadowbox   shadowbox around the header
# - ovalbox     box with rounded corners around the header (thin lines)
# - Ovalbox     same as "ovalbox" but thicker lines
# - doublebox   box with double lines around the header
# - grey        grey background behind the headers
# - greybox     same as "grey" but with a additional black box
FRONTSTYLE="fbox"

#
# Should there be a rule after the header (not first page)
HEADRULE="on"

#
# Should there be a rule over the footer
FOOTRULE="on"

#
# Choose a paper format, if not specified look in /etc/papersize
# - A4
# - letter
#PAPER="A4"

#
# prints signatures, and strange: Letting it as follows keeps the sig:
REM_SIG="on"
# how does a signature look like?
SIG_REGEXP="^-- $"

#
# prints no quoting
REM_QUOTE="off"

#
# Choose of the printed headers, separation with "_"
# /Header/ : italic printing
# *Header* : bold printing
# If the header does not exist, it is not printed.
#PRINTED_HEADERS="Date_To_From_CC_Newsgroups_*Subject*"
#PRINTED_HEADERS=
PRINTED_HEADERS="Date_From_To_Cc_Subject_In-Reply-To_MIME-Version_Content-Type_Content-Transfer-Encoding_Content-Disposition_References_Resent-Message-ID_Resent-From_X-Mailing-List_X-Loop_List-Id_Precedence_Resent-Sender_Resent-Date_Status_Content-Length_Lines_Return-Path_Delivered-To_Received_Old-Return-Path_X-Original-To"

# 
# Writes error messages of LaTeX and dvips to /tmp/muttprint.log
DEBUG="1"

#
# Font size: 10pt, 11pt or 12pt
FONTSIZE="10pt"

#
# Longest line
WRAPMARGIN="90"

# margins
TOPMARGIN="19"
BOTTOMMARGIN="22"
LEFTMARGIN="20"
RIGHTMARGIN="20"

#
# Date (format of printed date)
# original, local (needs Date::Parse from libtimedate-perl)
DATE="original"

#
# Date format string (only if DATE=local)
# See strftime(3) for details
#DATE_FORMAT="%c"

# pass special options to the verbatim environment, see texdoc fancyvrvb
VERBATIMNORMAL=""
VERBATIMSIG="fontshape=it"

# how should the address be printed out?
ADDRESSFORMAT="%r <%a>,\n"

# own LaTeX code to be inserted
#
# playing with these fonts:
# 'LATEXCODE=' seems to have an impact to the mail headers
# 'LATEXCODE1=' seems being good for the mail body
# .. now the 
#
# LATEXCODE1="\renewcommand{\ttdefault}{pcr}"
#
# seems to change the body font to 'courier'
# while
#
# LATEXCODE1="\renewcommand{\ttdefault}{phv}"
#
# seems to result in 'helvetica' for the mail body ..
#
# Alternatively you can try to replace 'phv' (in the 'LATEXCODE1' line) 
# with 'ptm', 'pop', 'pag' (bigger ..), 'pgm', 'pbk' ... no guarantees
# it will work ...
# See e.g.
# /usr/share/texmf-texlive/tex/latex/sugconf/sugconf.cls
# or simply grep the 'tex' files area above 
# for 'renewcommand', if you're curious ... :)


LATEXCODE="\renewcommand{\familydefault}{\sfdefault}"
#LATEXCODE1="\renewcommand{\ttdefault}{phv}"
LATEXCODE2=""
LATEXCODE3=""
LATEXCODE4=""
LATEXCODE5=""

kmix – stopping the OSD popups

Took me some time to find how to stop the on-screen pop-up’s when changing the volume on KDE:

Finding KMilo and stopping/disabling it did the trick:
KDE Control center –> KDE Components –> Service Manager

And gtkpbbuttons OSD’s do the same as the ones from KMilo – except that the former look better … :)

Disabling Power Management for a hard disk with hdparm

Leaving the power management enabled for your hard disk might shorten its life considerably. To give you an idea about it read this entry in a thread on the topic:
http://lists.debian.org/debian-powerpc/2008/10/msg00008.html

To see whether power management is enabled for your disk, you can enter something like this:
hdparm -I /dev/hda | grep -i “power management”

On Debian Linux one might want write an entry like this to /etc/hdparm.conf, if /dev/hda is the disk you want to switch off the Power Management for:

### START excerpt /etc/hdparm.conf ###

apm = 255

/dev/hda {
}

### END excerpt /etc/hdparm.conf ###

Additionally I have this in /etc/default/hdparm:

### START excerpt /etc/default/hdparm ###

harddisks=”/dev/hda”
hdparm_opts=”-B255″

### END excerpt /etc/default/hdparm ###

A script like the one below might be necessary in /etc/power/scripts.d/, if you have pbbuttonsd running, to make sure the hdparm values are re-set after resuming the machine from some sleep mode:

/etc/power/scripts.d/hdresume:

### START /etc/power/scripts.d/hdresume ###
#!/bin/sh

# name : hdresume

# Exit silently if package is no longer installed
[ -x /etc/init.d/hdparm ] || exit 0

/etc/init.d/hdparm reload

### END /etc/power/scripts.d/hdresume ###

Link to the script from /etc/power/resume.d/:

# cd /etc/power/resume.d/
# ln -s /etc/power/scripts.d/hdresume .

Note the dot at the end of the last line …
Oh, and the laptop-mode-tools package is not installed here.

CUPS and cupsd.conf on Linux

Accessing a CUPS driven printer without password

I had to do a few print-outs with my old printer, and realized the old cupsd.conf didn’t do any more what I wanted it to do, namely running my printer on my home network, via http://127.0.0.1:631/, and without having to type in usernames and passwords there every time I wanted to change some printer settings.

After lots of googling I found a solution: I forgot where I found the template, and how much I changed it to make it work the way it should. You’ll find it below.

Please note that this configuration file is for a secure home network. That is I’m the only one using that printer. So if in doubt whether it’s a good idea or not to use this cupsd.conf – then for the sake of your network security: don’t use it.

Note the cups Debian packages installed with this file :

$ dpkg -l | grep -i cups
ii  cups                                  1.3.10-1                       Common UNIX Printing System(tm) - server
ii  cups-bsd                              1.3.10-1                       Common UNIX Printing System(tm) - BSD comman
ii  cups-client                           1.3.10-1                       Common UNIX Printing System(tm) - client pro
ii  cups-common                           1.3.10-1                       Common UNIX Printing System(tm) - common fil
ii  cups-driver-gutenprint                5.2.3-2+b1                     printer drivers for CUPS
ii  gutenprint-doc                        5.2.3-2                        users' guide for Gutenprint and CUPS
ii  libcups2                              1.3.10-1                       Common UNIX Printing System(tm) - libs
ii  libcupsimage2                         1.3.10-1                       Common UNIX Printing System(tm) - image libs

So here goes /etc/cups/cupsd.conf:

#
# "$Id: cupsd.conf.in 7199 2008-01-08 00:16:30Z mike $"
#
#   Sample configuration file for the Common UNIX Printing System (CUPS)
#   scheduler.  See "man cupsd.conf" for a complete description of this
#   file.
#

# Log general information in error_log - change "info" to "debug" for
# troubleshooting...
LogLevel debug

# Administrator user group...
#SystemGroup lpadmin


# Only listen for connections from the local machine.
Listen localhost:631
Listen /var/run/cups/cups.sock

# Show shared printers on the local network.
Browsing On
BrowseOrder allow,deny
BrowseAllow all

# Default authentication type, when authentication is required...
DefaultAuthType Basic

# Restrict access to the server...
<Location />
  Order deny,allow
</Location>

# Restrict access to the admin pages...
<Location /admin>
  Encryption Required
  Order deny,allow
</Location>

# Restrict access to configuration files...
<Location /admin/conf>
  AuthType None
#  Require user @SYSTEM
  Order deny,allow
</Location>

# Set the default printer/job policies...
<Policy default>
  # Job-related operations must be done by the owner or an administrator...
  <Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job CUPS-Move-Job>
#    Require user @OWNER @SYSTEM
    Order deny,allow
  </Limit>

  # All administration operations require an administrator to authenticate...
  <Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default>
    AuthType None
#    Require user @SYSTEM
    Order deny,allow
  </Limit>

  # All printer operations require a printer operator to authenticate...
  <Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After CUPS-Accept-Jobs CUPS-Reject-Jobs>
    AuthType None
#    Require user @SYSTEM
    Order deny,allow
  </Limit>

  # Only the owner or an administrator can cancel or authenticate a job...
  <Limit Cancel-Job CUPS-Authenticate-Job>
#    Require user @OWNER @SYSTEM
    Order deny,allow
  </Limit>

  <Limit All>
    Order deny,allow
  </Limit>
</Policy>

#
# End of "$Id: cupsd.conf.in 7199 2008-01-08 00:16:30Z mike $".
#

An important part to stop access without authentication do seem to play the ‘Require user’ instances, that are commented out above.

I wouldn’t be astonished if the code above could be written much easier, more efficient, and yes, more beautiful than here – if all we want is unrestricted access to some printer: I did not have the time so far to find that solution. Please leave a comment here if you have one.

Thanks in anticipation.