Showing posts with label OSX. Show all posts
Showing posts with label OSX. Show all posts

26 Jun 2010

Unix like window management under MacOSX

Keep Afloat adds sticky windows, always on top and transparency on OSX.

9 May 2010

ERROR: language "plpgsql" does not exist

A freshly installed PostgreSQL 8.3 on OSX (Snow Leopard) via MacPorts would not accept the plpgsql language, this can be fixed easily:

-- Create a function handler:
CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler AS '$libdir/plpgsql' LANGUAGE C;

-- Create the language 'plpgsql'
CREATE TRUSTED LANGUAGE plpgsql
HANDLER "plpgsql_call_handler";

-- and I don't know if is a good thing to :
GRANT USAGE ON LANGUAGE plpgsql TO public;

Start/Stop/Restart PostgreSQL 8.3

Installed PostgreSQL 8.3 with MacPorts (Snow Leopard). This script wirl make it easy to start/stop/reload your local PostgreSQL server:

#!/bin/bash

echo "You need sudo rights to perform this action ..."

plist="/Library/LaunchDaemons/org.macports.postgresql83-server.plist"
launchctl=$(which launchctl) # if needed, set this to an absolute path

if [[ -z "$1" ]]; then
echo "Usage $(basename $0) start|stop|reload"
exit 1
fi

mode="load"

if [[ "$1" == "start" ]]; then mode="load";
elif [[ "$1" == "stop" ]]; then mode="unload";
elif [[ "$1" == "reload" ]]; then mode="reload";
else
echo "Unknown mode '$1'";
exit 2;
fi

if [[ "$mode" == "reload" ]]; then
exit $(sudo $launchctl unload -w "$plist" && \
sudo $launchctl load -w "$plist")
fi

sudo $launchctl "$mode" -w "$plist"

PostgreSQL 8.3 on OSX with MacPorts

Installing PostgreSQL on OSX Snow Leopard is pretty sinple, just install MacPorts and the issue the command:

$ sudo port install postgresql83 +universal


Start the server with:
$ sudo launchctl load -w /Library/LaunchDaemons/org.macports.postgresql83-server.plist


Stop the Server with:
sudo launchctl unload -w /Library/LaunchDaemons/org.macports.postgresql83-server.plist

Use PgAdmin III for getting started and administering your databases.

24 Apr 2010

postgresql 8 with macports (snow leopard)

Installing postgresql 8.3 on OSX Snow Leopard with MacsPorts (PgAdmin III binary for OSX).

Install

$ sudo port install \
postgresql83 \
postgresql83-server +universal

create first database

$ sudo mkdir -p /opt/local/var/db/postgresql83/defaultdb
$ sudo chown postgres:postgres /opt/local/var/db/postgresql83/defaultdb
$ sudo su postgres
sh-3.2$ cd /opt/local/lib/postgresql83/
sh-3.2$ ./bin/initdb -D /opt/local/var/db/postgresql83/defaultdb

Output
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locales
COLLATE: C
CTYPE: UTF-8
MESSAGES: C
MONETARY: C
NUMERIC: C
TIME: C
The default database encoding has accordingly been set to UTF8.
initdb: could not find suitable text search configuration for locale UTF-8
The default text search configuration will be set to "simple".

fixing permissions on existing directory /opt/local/var/db/postgresql83/defaultdb ... ok
creating subdirectories ... ok
selecting default max_connections ... 20
selecting default shared_buffers/max_fsm_pages ... 1600kB/20000
creating configuration files ... ok
creating template1 database in /opt/local/var/db/postgresql83/defaultdb/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the -A option the
next time you run initdb.

Success. You can now start the database server using:

./bin/postgres -D /opt/local/var/db/postgresql83/defaultdb
or
./bin/pg_ctl -D /opt/local/var/db/postgresql83/defaultdb -l logfile start


Restart the service

(in case it is already running)
$ sudo launchctl unload -w /Library/LaunchDaemons/org.macs.postgresql83-server.plist
$ sudo launchctl load -w /Library/LaunchDaemons/org.macs.postgresql83-server.plist

3 Aug 2009

Mac OSX

I got this Mac Mini brought in today for testing a new screen capturing solution we might implement.

It turned out to be a very nice experience. I knew these macs are shiny but they seem to be pretty useful too! After some poking around I found out there is an X Server available, an ssh client was there too. So I could instantly launch some remote X apps.

It turned out, that these macs ship by default with Python (2.3.something) and there is a nice IDE called Xcode which is offered by Apple for free of charge.

Furthermore, what got me excited, was the fact that there are many command line tools and a bash (by default). It is possible to read out information about the system's hardware and configuration via «system_profiler» which seems similar to «wmic» on Win32 and «/proc» on linux.

My next laptop will be a mac book!