2011-11-14

Solaris 11 default route

Q: How to add a default gateway on a Solaris 11 system?

A:
      route -p add default 192.168.1.1



Explanation: If you happened to be a Solaris administrator since version 2.3, like me, you were used to create a file
 
      /etc/defaultrouter 

But not any more! The "route -p" certainly is a good thing, I'll remember that.

2011-11-08

flatten a gnu tar archive

Problem:

I have a tar file with a deep directory hierarchy but only some files in it. I want to extract the files into my current directory and not care for subdirectories. Filenames do not conflict. The gnu tar option --remove-components does not handle this well.

Solution:

Fortunately, there is a very general gnu tar option --transform:
    tar --extract --transform='s/.*\///' --show-transformed-names --file=foo.tar
This deletes pathname up to the first slash character, resulting in the desired effect.

Example:

$ mkdir -p a/b/c/d/e/f/g/h/i
$ echo "hi there" >  a/b/c/d/e/f/g/h/i/foobar
$ tar cvf foo.tar a
a/
a/b/
a/b/c/
a/b/c/d/
a/b/c/d/e/
a/b/c/d/e/f/
a/b/c/d/e/f/g/
a/b/c/d/e/f/g/h/
a/b/c/d/e/f/g/h/i/
a/b/c/d/e/f/g/h/i/foobar
$ tar --extract --transform='s/.*\///' --show-transformed-names --verbose --file=foo.tar
a
b
c
d
e
f
g
h
i
foobar
$ cat foobar
hi there 

2011-03-03

Repairing Windows XP

Repairing Windows XP (e.g. because disk was moved into new box).
  • first make sure the administrator account has a password
  • download the latest service pack and current patches to disk, e.g. with the help of a Linux live system
  • make a backup copy of %SYSTEM32%\WPA.DBL and WPA.BAK
  • boot from Windows CD, preferrably a recent one
  • you may have to enter the administrator password
  • select install (not "R" for repair console)
  • select repair ("R")
  • if installation of some files fails with a bogus error message, skip
  • if you can not boot any more, try to boot safe mode
  • install service pack and pachtes (may replace files that you skipped before)
  • restore WPA ("Windows Product Activation") files
  • check activation state: oobe/msoobe /a
bingo

PEAR installation on Windows

Unbelievable but true, there is no native PEAR for Windows.



PEAR is a vastly successful standard library collection for the even more successful PHP server side web programming language. Almost every website nowadays uses a PEAR module or two. Entire web frameworks use PEAR and and its distribution/installation system.

That is was written on Unix by Unix nerds and is used on Unix webserver hosts should not make it unfriendly to Windows users. But it does.

Unbelievable but true, there is no PEAR.msi to be downloaded anywhere from the web. For the simple reason that no one has cared to wrap it. I am writing this in March 2011. It feels like stone age.

Get me right. I am not a Windoze luser computer newbie. And I do all my work (paid and unpaid) on Linux and other Unixes. Nevertheless, I think this disrespect of the PEAR community for the other worlds out there is nothing less than atrocious.