OS X: Daylight Savings Time switch and launchd

The end of the Daylight Time is near, this year, the switch takes place on November 2nd, to be precise. Usually no biggie, but Europe switched back last weekend and I switched a couple of jobs from cron to launchd, as prescribed by Apple, during the year on servers located in Europe.

cron, the one available on OS X, is capable of handling the switch from daylight time to ‘normal’ without problems. Meaning jobs starting between 2 AM and 3AM won’t run twice. I always thought, that this behavior is built into launchd as well. Long story short: Three OS X Servers started the jobs twice last weekend.

Just an FYI in case you need to know.

Why the ‘Morning Banana Diet’ could actually work

The Net is bubbling with the phrase Morning Banana Diet at the moment. Some think it’s a viral hoax, some are trying really hard to make it work. Here is my take from the lab (hence the name, you know):

First things first, though. This is my take on the subject, read gut-feeling and experience. I’m not a doctor or in any other position to tell you what to do.

The Basic Idea behind the ‘Morning Banana Diet’

People on this diet are supposed to eat a banana and drink a glass of water for breakfast. That’s it? Basically, yes. It is said, that you are allowed to eat normally during the rest of the day. Your weight is supposed to go down when adhering to this routine.

Why the ‘Morning Banana Diet’ could work

Honestly, the above section sounds to good to be true, doesn’t it? IMHO, it could work. Let me tell you why. There are a couple of reasons igniting the feeling of being hungry:

  1. You haven’t eaten in a while.
  2. It is ‘time to eat.’
  3. Your blood-sugar is low.

There are more reasons, granted; let’s concentrate at the ones mentioned, though. The first one is a given, your body needs something to burn, period. The second reason is known to give you a feeling of being hungry without the real need to eat something, meaning your body could continue to exist nevertheless; it is just ‘trained’ to be hungry at certain times. Next time your getting hungry around lunch-time, try to figure out if you really need something to eat or if it’s just a habitual thing.

Reason three was my clue to why the Morning Banana Diet could actually work. If your body does not have enough sugar to burn, it tends to get nervous, and rightly so. If your body is lacking sugar, it cannot generate the energy to keep you going. The proof of the pudding 😉 , eat something with artificial sweetener, you’ll get hungry again much faster as if you’d eat something containing sugar.

If you eat a banana in the morning, your blood-sugar should be fine until at least noon; the craving for sugar during a morning-break should lessen considerably. Especially if your body gets used to the intake of sugar and vitamins contained in a banana. So the Morning Banana Diet uses reason two and fights reason three. So in theory, at least, it could work.

What’s your take on the subject?

OS X Server: Reset diradmin’s Password

The admin-password does not work with the diradmin-account? First things first:

  • Don’t panic!
  • There might be a way out of this.

What happened?

The passwords for the administrative account on OS X Server, I’m talking about the one created during installation, and the diradmin-account are the same, right? Are you sure? They probably are, if you didn’t change one of them. These two passwords are the same after the installation, because they have been synchronized during the installation. If you should change one of them later, then they won’t be synced again. Shouldn’t be a problem, though, everyone keeps records of vital data like this, most of the time.

On the other hand, if one of us sets up a machine, then said machine should get a healthy workout before deployment, to make sure the hardware is OK. This usually includes the installation and configuration of all needed hard- and software. So, in theory, the machine would be ready for deployment. But, during these tests, nobody cares about passwords; the system runs in a controlled environment and access from outside of this environment is either impossible or severely restricted. This could mean—if the Open Directory-user-accounts have been created during this phase—that nobody tried to connect to the directory-tree as diradmin after the change to the “real” administrative password. Same goes for periodic changes to the administrative password, depending on your policy.

It happened, I cannot login as diradmin any more…

Regardless how it happened, don’t do anything in a rush now; breathe. Spare yourself the trouble to try passwd diradmin as super-user, it won’t work; you need the old password to make changes. If you have access to the system, either physically or via ssh, ARD or screen-sharing, then the situation can be rectified.

If possible, make a backup of the system, seriously! Then retrace the steps in How to reset the Open Directory administrator password and you should be OK.

In a nutshell: The documents describes how to use Workgroup Manager to gather information about the password and uses mkpassdb to dump the password-database and overwrite the old password with a new one. It seems, that on 10.5 all you need to do is to use

sudo mkpassdb -dump

to get the slot-ID and

mkpassdb -setpassword [slot-ID]

executed as super-user, a.k.a. root (one way to get there is sudo su), to create a new password for diradmin.

The latter is my experience, your mileage my vary.

Disclaimer: The fact that it worked for me, does not necessarily mean it will work for you. You have to do it on your own risk, I’m not responsible if something goes wrong.

Just a Quick Reminder: ISPs, Check the RBLs!

A couple of minutes ago a friend told me, that one of his friends could not send mails via his SMTP-server. (Quick explanation: this friend of mine hosts a server on his premises and allowed a couple of his friends to use it for sending and receiving e-mail.) I checked the logs and lo and behold, the dynamic IP-address his friend was using was blocked by the RBL.

It seems, the person getting this very IP-address by the ISP before the poor soul in question used it to send spam and was blocked for doing so by the RBL. Is it that hard to check for the own address-range when getting the data-stream of an RBL (I’m 99% sure, that the ISP in question is using this very RBL to protect its own servers)? Obviously so. Hint: grep [my_ip_range] does the trick. :mrgreen:

Again, just a quick reminder. 😉

[No, I won’t name names.]

Joost’s WordPress-Bundle for TextMate gets the fun back into theme-hacking

I told you about Joost’s great WordPress-Bundle for TextMate in the post A WordPress-Bundle for TextMate and I stand by the title of this post. It really brings back the fun in hacking WordPress-themes.

I found one deprecated call (in two incarnations): listcats expands to list_cats, but the beauty in using the Bundle is, I just exchanged it to expand to wp_list_categories and I was done. I don’t have to remember which calls are deprecated, I’ll just have to make sure to check the Bundle as soon as new lists with deprecated calls show up and exchange them. The only “clear and present danger” I see in this approach is: What do i do, while not using TextMate? But that holds true for almost anything handled by a Bundle in TextMate. (I just found out, that the editor in WordPress does not close HTML-Tags when . is pressed. :mrgreen: )

Kudos to Joost for picking up the task. Thanks, really.

A WordPress-Bundle for TextMate

I just found a WordPress-Bundle for my favorite editor, TextMate. Download it from the Website of SEO-/Wordpress-wizzard extraordinaire Joost de Valk.

I’m going to test it later today.

OS X: Capturing Packets

Being kind of “Solaris-infested” at times (a.k.a. old habits die hard), I had a hard time capturing network-packets on OS X the other day. Not the capturing in itself, but remembering to use tcpdump instead of snoop. The command I was looking for was

sudo tcpdump host [ip-address]

It lists the packets as they go by, regardless if [ip-address] is the source or the destination. The use of sudo is a necessity on OS X, you’ll end up with a tcpdump: no suitable device found-message otherwise and rightly so, “normal” users have no rights to snoop tpcdump packets. :mrgreen:

OS X: The Location for “Folder Action Scripts”

Since it bit me a couple of days ago: The AppleScripts to be used as Folder Actions must be stored in ~/Library/Scripts/Folder Action Scripts or /Library/Scripts/Folder Action Scripts.

The former is the location for Scripts available to the user of the account, the latter for all users of a machine. Don’t get fooled by the fact that you are able to choose any script via the context-menu of a folder if Folder Actions are enabled.

Just in case you need to know. 😉

Logging in FrontBase, quick and dirty

This is a quick tip (and thus something I don’t have to remember as long as I have an Internet-connection and a browser at my disposal 😉 ) for all FrontBase-users out there. The following is a rundown of handy commands if you need to log activities on a database.

sudo ln -s /Users/admin/FBLogs /Library/FrontBase/LogFiles(OS X)
Creates a symbolic link to the directory FBLogs (the directory needs to be created first) named LogFiles in your FrontBase-directory. If FrontBase “sees” this directory, all logs will be created and written there instead of the standard-location in Databases. If you are using Linux or Unix, choose a convenient location on your hard-disk.

Now you’re ready to log (and roll), but you have to tell FrontBase first. Fire up sql92, connect to the database in question and use

SET WRITE SQL TRUE GLOBAL;

to convince FrontBase to start logging. To turn logging off, use

SET WRITE SQL FALSE GLOBAL;

The logfile-name is the one with “sql” added, so [name_of_your_database].fb.sql is the file the commands shown above use for logging. Said file will grow to astonishing proportions in a very short time, on a busy database, that is. If you want to use a new file while logging is active, use

SWITCH TO NEW SQL LOG;

The current file will be renamed to [name_of_your_database].fb.sql.YYYYMMDDHHMMSS and a new file named [name_of_your_database].fb.sql will be created and used (keep this in mind when using tail -f).

Again, this is supposed to be a debugging-feature, not something you enable and let run forever. Check out the documentation, there is more to logging in FrontBase; especially the explanation of the contents of your log files.

Hope this helps, if you tend (like me) to forget these commands, bookmark the post. 😉

OS X: Repairing Permissions from the Command-Line

Just a quick tip: Repairing the permissions on an OS X disk can be done from the command-line as well. The only caveat, you have to know the device of the volume. Getting the right device is easy:

diskutil list

The device-node in question is in the column titled IDENTIFIER. The device-path to use is the one with the name of the volume, e.g. if the column reads disk0s2, then the command would be:

diskutil repairPermissions /dev/disk0s2

You should see some kind of progress-bar in ASCII.

One thing to note though: Using the command does not prevent the “meditation” of the program after 20%. I’d be interested what the system is doing while it seems to mull over something when it is supposed to repair the permissions. :mrgreen: