miriup.de

...because open source matters

  • Increase font size
  • Default font size
  • Decrease font size
MacOSX

Starting your backup when the disk is plugged on MacOSX

E-Mail schreiben Print
There are no translations available.

Introduction

I'm using rsync to backup my data to an external USB disk. I keep forgetting to do it, so automation is what I need. This procedure doesn't just apply to rsnapshot, it should work with any backup method that can be initiated from the command line.

The basic idea

Whenever a disk is plugged, Finder will automatically mount it to /Volumes. Monitoring the /Volumes directory for changes is enough to detect the change and then we can look whether the backup volume is actually present.

Attachments:
Download this file (volume-connected.plist.txt)/tmp/volume-connected.plist[launchd configuation file]0 Kb22.09.2010 00:38
Download this file (volume-connected.txt)/tmp/volume-connected[Shell script to be executed on volume change]0 Kb22.09.2010 00:39
LAST_UPDATED2
 

postgresql for NeoOffice

E-Mail schreiben Print
There are no translations available.

Assuming you have already installed postgresql on your machine, this tutorial shows you how to hook it up to NeoOffice. For installing postgresql the author has used gentoo-prefix using the command `emerge postgresql`.

The following site has also instructions on how to install postgresql on your Mac:

http://developer.apple.com/internet/opensource/postgres.html

It also explains how to hook the JDBC driver in. Those are the steps:

  1. Download the driver from http://jdbc.postgresql.org/download.html (for my Tiger I've been using JDBC3 Postgresql Driver, Version 8.4-701)
  2. Move the downloaded driver into /Library/Java/Extensions/.
  3. Add the driver from the extensions directory to the CLASSPATH of the Java instance 
  4. Restart NeoOffice
  5. Configure the JDBC source in NeoOffice. The Datasource URL is jdbc:postgresql:$dbname (where $dbname is the name of your database). The JDBC driver class is org.postgresql.Driver
  6. Test the driver: 
  7. Test the connection: 

 

LAST_UPDATED2
 

Unknown pseudo-op

E-Mail schreiben Print
There are no translations available.

While dealing with the opensource tool using assembly for some tasks, I encountered the following error messages:

Unknown pseudo-op: .balign

Unknown pseudo-op: .hidden

Unknown pseudo-op: .type

They seem all come from the fact that my assembler is pretty old. I'm using the apple binutils. My system assembler as its version being Apple Computer, Inc. version cctools-622.9~2, GNU assembler version 1.38, my gentoo-prefix reports it's Apple Inc version cctools-698.1, GNU assembler version 1.38, so not much younger.

The GNU Assembler manual Using as comtains a list of supported assembler directives as well.

.balign 

.balign seems to allign the location counter until it is aligned. That would make loading of code more efficient. It could be done manually as well by inserting no-operation instructions so that the instruction pointer moves manually to the next aligned position.

.hidden

.hidden changes the visibility to "hidden". That works only on systems using ELF as their binary formats, so it can safely be omitted on MacOSX. On other systems it could be probably removed, when the linker can issue warnings on duplicate symbols.

.type

.type sets the type of a symbol, for example "int". ELF formats seem to support more types that COFF, but MacOSX uses dwarf-2, especially with Xcode, and I have no clue what the options are there.

 

LAST_UPDATED2
 

Xcode and header files

E-Mail schreiben Print
There are no translations available.

I had been struggling the whole week with a phenomena I could not nail down. I had an include file that was included as per preprocessor output. However not any effect from the included file could be seen, not even an #error in the first line. No missing file would be reported by the compiler. When I changed #include "file.h" to #include <file.h> it would work.

It turns out the file system locations for system header files and user header files I had configured overlapped. In Apple's GCC these can be separately specified. Apparently the cpp detected the presence of the file and didn't complain about it being missing, but when it was to put the contents of the file into the namespace it would simply not read it, if included the wrong way.

You can detect that this is happening, by looking at the preprocessor output: dig out the line which tells you how the compiler get's called. If it's a pure compilation stage, it will contain somewhere the option '-c' for compiling only. Replace it with '-E' to only do preprocessing instead and have the output written not in a '.o' file, but in a '.i' file instead. If you look into this file, you'll see all include files are now part of the file fed to the C compiler and no '#define' exist any more. However, the preprocessor still inserts comments where it got the definitions from. If you see lines like:

# 74 "/home/user/src/project/src/file1.c" 2

# 1 "/home/user/src/project/include/include1.h" 1

# 75 "/home/user/src/project/src/file1.c" 2

It means that the file include1.h was indeed included from file1.c, but didn't contain anything useful to the compiler. It just noticed line one and then skipped onto the line after the #include directive.

LAST_UPDATED2
 

Parsing and using plist files from a Mac.

E-Mail schreiben Print
There are no translations available.

Lots of stuff in a Mac is stored in property list files with the .plist extension on a Mac. Accessing them with Unix tools is possible and besides the usual C/C++/ObjC options there's a perl interface to the necessary functionality as well, as the following site suggests:

MacDevCenter.com -- Using Perl to Manage Plist Files

As these methods are accessing the underlying Cocoa mechanisms, documentation can be found on the property lists themselves here...

Property List Programming Guide for Cocoa: Introduction to Property Lists

... and on the individual methods here:

NSDictionary Class Reference

Attachments:
Download this file (plist-dump.pl.txt)plist-dump.pl[Simple perl script to dump the contents of a plist file (also binary).]0 Kb04.05.2009 13:54
LAST_UPDATED2
 


JPAGE_CURRENT_OF_TOTAL