Don't taunt the "domain" setting

The Network preferences panel includes two little text boxes marked „Host name“ and „Domain name.“ The host name box lets you give your machine a friendly name so your box can be accessed by others on a network without them having to enter your IP address (it also gives you the opportunity to stroke your ego by entering something so clever and obscure that only you actually get it).
The domain name field, however, is NOT all fun and games. While networking will still work, name server lookups may take much longer on some machines in some network configurations. Enter a domain name only if your machine is physically attached to an actual domain (i.e. dial-up users should not enter anything here, and only some LAN users should).

 

Pe: Integrate HTML Tidy

If you use HTML Tidy to clean up your HTML, and Pe for your HTML editing needs, you can integrate the two by addinng an HTML Tidy entry to Pe’s Extensions menu, so you can call it as if it were part of the editor. To do this, you only need to create a simple two-line shell script and save it to Pe’s „Extensions“ folder.
In Pe (or another editor), type the following shell script:

tidy 

If you normally run tidy with command line options, you can put them after the program’s name (for instance, tidy -wrap 75).
Save your new script in Pe’s extension folder (by default, this is /boot/apps/Hekkelman/Extensions). Give it the name Tidy HTML. (You can name it anything you want, but due to a quirk in Pe’s programming, shell script extensions can’t start with the word „HTML“.)
To make the script appear in the Extensions menu, you must make it executable. Open a Terminal and type:

chmod a+x '/boot/apps/edit/Hekkelman/Extensions/Tidy HTML'

(you may have to tweak that path if Pe is installed in a different location).
To use the program, select everything in your document (Cmd/Alt-A) and then select „Tidy HTML“ from Pe’s extensions menu. The cleaned-up version of the document will replace your text, and any errors Pe finds will be shown to you in a separate window.
Note that any shell script or program that reads and writes to standard input and output can be added to Pe’s Extensions menu in this way.

 

SoftwareValet registration problems

Some applications seem to have difficulty being registered properly via SoftwareValet. If you find that your valid serial number is denied when you try to register, try adding a trailing space to the end of the serial number.

 

Selective volume mounting

If you use BeOS 5.01 or a version of OpenTracker released after July 2000, this tip is irrelevant — just open the Mount Settings panel (right-click on Desktop | Mount | Mount Settings) and select „Previously mounted disks.“ The old tip remains below because it still works and some people like to do things by hand.
As you know, you can use the Mount Settings panel to control whether various kinds of volumes are mounted automatically at boot time. But what if you want to get more selective than that? For example, you may have half a dozen mountable partitions on your machine (both BFS and those from other operating systems), but only want two of them mounted automatically at boot time — your boot volume and your data/MP3 volume.
To do this, tell the Mount Settings panel to mount Only the Boot Disk during boot. Then add lines like this to /boot/home/config/boot/UserBootscript:

mountvolume booboo
mountvolume esther

and so on.

 

Shuffle your startup sound

If you’d like to have a different sound played automatically every time you start your machine, you’ll want to run a brief script on startup that chooses a random sound or song from a given directory, then play it using either the built-in Sounds preferences panel or by specifying the path to your favorite audio player.
This tip assumes that your sound files are stored in /boot/home/config/sounds — edit to suit if you store them elsewhere.
Add the following to /boot/home/config/boot/UserBootscript:

N=`date +%S`
N=`expr $N + 0`
I=0
for file in /boot/home/config/sounds/*; do
	I=$[$I + 1]
done
N=$[($I * $N) / 60]
for file in /boot/home/config/sounds/* ; do
	if [ $N -eq 0 ]
		then
		rm /boot/home/config/settings/Sound
		ln -s "$file" /boot/home/config/settings/ Sound
		break
	fi
	if [ $N -ne 0 ]
		then
		N=$[$N - 1]
	fi
done

Now, copy one of your sound files to /boot/home/config/settings and rename it „Sound.“ If you want the sound to be played via the operating system’s built-in startup sound function, launch the Sounds preferences panel, select Startup in the main panel, and choose Other… from the picklist. Navigate to /boot/home/config/settings/Sound.
Alternatively, you can simply point SoundPlay, MediaPlayer, or any other audio player at your Sound link from ~/config/boot/UserBootscript. For example:

MediaPlayer /boot/home/config/settings/Sound & 

Make sure the audio format of the sounds you choose are supported by the player you use.
The idea and 99% of code for this script was taken from the tip Shuffle your background Images by Jason Scaroni.

 

HTML directory listings

If you want to create a directory listing in HTML format, paste this shell script into a text editor and save it to /boot/home/config/bin/dirlist:

echo <html><head></head><body> >
 dirindex.html
ls -1 | awk '{print "<a href="" $0 "">" $0 "</A><BR>"}'
 >> dirindex.html
echo </body></html> >> dirindex.html

Open a Terminal, cd to any directory, and run dirlist. You’ll end up with an HTML document in that directory called dirindex.html containing hyperlinks to all the files in the directory.

 

Control window look, feel, or behavior with "hey"

A few tips on this site allude to ways in which you can control the window look, feel, or behavior of your BeOS applications by sending them BMessages with hey (see for example Keep focus when switching workspaces). What’s not obvious from reading those tips is how one determines the magic numbers used in the hey commands.
The secret lies in the file /boot/develop/headers/be/interface/Window.h — a header file which contains a pile of window properties. If you look through this file, you’ll notice that it’s broken up into several sections:

window_type
window_look
window_feel

and a separate section for defining behaviors. The three sections above have numerical identifiers as standard integers, while the behaviors section has identifiers expressed in hexadecimal. Each BeOS application determines its own properties internally, but these properties can be overridden by sending appropriate message to an application or to a window.
It’s quite easy to change the type, look, or feel of any given application window. For example, say you want to change the look of an open NetPositive window to „bordered.“ In Window.h, you find a line:

 B_BORDERED_WINDOW_LOOK = 20,

So you can simply type:

hey NetPositive set Look of Window 0 to 20

And boom — that NetPositive window loses its title tab and most of its chrome. So much for look and feel.
Because window behaviors are expressed in hex, and because behaviors can be a combination of one or more properties, things get a little more complex when changing behaviors.
Specifically, the behaviour of a window is based on the value [val] passed to its SetFlags() function, and [val] can be a combination of any flags specified in Window.h. There’s also a SetFeel() function which acts on additional behaviour fields.
The usual „algorithm“ is to run:

hey ApplicationName get Flags

although in most cases you’ll have to also name a specific window of the application, like:

hey ApplicationName get Flags of Window 0

hey will return two numbers — something like:

Reply BMessage(B_REPLY):
   "result" (B_INT32_TYPE) : 16450 (0x00004042)

The first number in the result is a decimal value (16450 in this case). To change the behavior of this window, you need to add this value to the converted value you wish to change it to (behaviors are additive). Sound tricky? Bear with me. Looking again in Window.h, you see:

 B_AVOID_FRONT = 0x00000080,

so to make this window not take focus automatically when switching workspaces (as described in the Keep focus when switching workspaces tip), you would convert 0x00000080 to its equivalent decimal values (try this handy web-based converter), sum them, and set the window to the new value. You get 128+ 16450, or 16578. Now, you can simply enter:

hey NetPositive set Flags of Window 1 to 16578

and your window will add the „Avoid front“ property to its current properties (if you switch to another workspace and back, that window will refuse to be at the front when you return to the workspace).
This technique isn’t 100% foolproof (for example if you set an already set flag you might end up adding another random one, etc.) so a little caution is advised. But you won’t blow up your computer with hey, and you’ll get the original values back by simply restarting the application in question).
For more on using hey, see Chris Herborth’s Scripting chapter in the BeOS Bible, or Seth Flaxman’s hey tutorial at BeNews.

 

Recursive Tracker templates

As you probably know, newly created folders inherit their layout (screen size and position plus attribute columns, positions, and sort order) from the parent folder. But what if you want to apply a folder template to an already existing hierarchy of folders?
The following trick should do the job:

  1. Close all folders in the entire hierarchy you want to change. This is very important because the act of closing the folder writes current settings to that folder’s attributes. If you do it later rather than now, you’ll overwrite the settings you’ve just created.
  2. Open the root folder of the hierarchy you want to change and set its desired configuration using the Tracker
  3. Close the root folder
  4. Open a Terminal, cd to the root folder and type (on a single line)
    find . -type d
    -exec copyattr -n _trk/viewstate_le . {} ;
    -exec copyattr -n _trk/columns_le . {} ;
    

This will copy the Tracker attributes of the root folder to all of the other folders, which will make them look the same and share the same attribute columns and sort orders.

 

Running your own mail server

Stegemann & Stegemman’s enamel is one of two complete mail server packages available for BeOS (the other is Stalker Software’s CommuniGate Pro). Unfortunately, its documentation leaves most users scratching their heads. David Muszynski has prepared this QuickStart guide to setting up and using enamel, to get you up and running with your own BeOS mail server quickly.

enamel – A Quick Guide

The enamel package comes with seven executible binaries. Since all this guide is meant to do is offer those unfamiliar with e-mail server software a quick and easy way to send and receive e-mail on their own computer (in the mail server sense of send and receive, not in the normal sense), we will only be dealing with three of those binaries. First of all you should install everything according to the directions that come with enamel (that part is clear enough anyway).
The three apps we’ll be dealing with are MCP, pop3d, and smtpd. MCP is like the brains of the operation — it’s what all your mail transactions are routed through whether you’re sending or receiving mail. smtpd is what listens for incoming mail (and outgoing mail as well, but I’ll discuss that later) and puts it where it needs to go. Lastly, pop3d waits for someone to check their account and gives them mail that’s waiting for them. We’re now going to be editing text files to get everything configured the way you want it.
First up, MCP. Obviously the first thing to set in the MCP_settings file is the LogFile path. Easy enough — mine is set to LogFile /boot/home/logs/MCP.log. I haven’t changed any of the indexes that were set by default, and my guess is you won’t want to either right away. Next we set targets. In their simplest form they look like this:

Target david TargetPattern "david@technospider.ath.cx" 

This sets a target named david, which means that when ‚david‘ logs in via pop3, he’ll receive all mail that has been sent to his pattern david@technospider.ath.cx.
Mailing lists should be simple enough to set up with the ‚Redirect‘ statement (I say should be because I haven’t done it since I’m using the non-commercial restricted version). Anyhow, say I want to maintain a mailing list for my BUG. I’d only need to send mail to buglist@technospider.ath.cx and it will be sent to everyone on the list. Here’s how it’s done:

	Redirect cflbug ReplyTo david@technospider.ath.cx
	"John Doe <john@aol.com>"
	"Sally Struthers <sally@unicef.org>"
	"Scot Hacker <beos@birdhouse.org>"

ad infinitum (you must hit return after the last name in the list). In order for this to work you must create a target statement that corresponds to the Redirect statement:

 Target cflbug TargetPattern "buglist@technospider.ath.cx"

That’s it for MCP, and you thought it was gonna be hard. 😉
Next we’ll tackle smtpd. Nothin‘ to it — just set your LogFile path. Leave the port setting alone unless you have good reason to change it and set your MaxConnections to something reasonable. Mine’s set to ten. Done.
Lastly is pop3d. Again, really simple. Set LogFile (deja vu, huh?) to your selected path. Leave the port setting alone. Don’t go crazy with MaxConnections. And lastly define your users like this:

	User david Password ****** Target "david"
	User joann Password ****** Target "joann"

Of course, in the text file your passwords will be visible so don’t let anyone go snooping around on your computer if you don’t want anyone to find out what they are.
I’ll explain as best I can what these statements do. When someone logs into enamel’s pop3d from a remote client, enamel checks the username and password against the list you’ve defined in the pop3d_settings file, and if it find a match it sends that person all the mail that was sent to the addresses defined by MCP’s target statements.
You’ll most likely want to start MCP, smtpd, and pop3d automatically at boot time from your UserBootscript.
I have just one warning: Since everyone on the internet has an ISP, unless you run your own ISP, I would recommend that you set the smtp server settings on any mail clients you’re using to your ISP’s smtp server. Just trust me on this, it may not turn out bad for you but I wouldn’t take any chances.
I hope this has helped you out a bit. I know I downloaded, installed, and tried to configure enamel several times before it finally clicked. If anyone has suggestions, comments or questions please feel free to e-mail them to me. If you see anything in here that is wrong please let me know about it — I don’t claim to have this stuff down pat by any means.

 

cdda-fs: Mounting "enhanced" CDs

Update: BeOS 5 includes cdda-fs, and also lets you mount enhanced CDs normally, by right-clicking on the Desktop and choosing the volume name from the Mount sub-menu. The original tip, for users of older versions of BeOS, is below.


Marco Nelissen’s cdda-fs is a great utility, but the current version is unable to mount „enhanced“ CDs („enhanced“ CDs containing both audio and data) either from DriveSetup or from the Tracker. Inserting one of these CDs simply mounts the data partition. There is, however, an easy work around for mounting both partitions.

  1. Insert the cd.
  2. Fire up a Terminal.
  3. Make a directory in the root of your filesystem to mount the audio CD to, by typing mkdir /mydirectory, for example.
  4. Now type mount -t cdda /mycdrom /mydirectory, where mycdrom is the path to your CD-ROM drive (for example, /dev/disk/ide/atapi/1/slave/0/raw), and mydirectory is the path to the directory you’ve just created.

You’re golden. To automate this process, just create a little shell script that looks like this:

mkdir /mydirectory
mount -t cdda /mycdrom /mydirectory

Open up a Terminal, cd to the script’s directory, and type chmod 755 filename, where filename is the name of the script.

 
 

Kategorien

 
 
Blogroll
Resources