Here’s how to do it:
1 |
ALTER ROLE myuser IN DATABASE mydb SET search_path = myschema; |
The same syntax works for any configuration parameter, such as localization parameters.
Here’s how to do it:
1 |
ALTER ROLE myuser IN DATABASE mydb SET search_path = myschema; |
The same syntax works for any configuration parameter, such as localization parameters.
If an IPv6 address is unreachable, but you can reach the IPv4 one, you can set the preference to IPv4 for that particular address by adding a line such as this in /etc/gai.conf:
1 |
precedence ::ffff:198.145.11.105/128 100 |
That will set the preference for host 198.145.11.105 to IPv4.
See gai.conf(5) for details.
How to install the latest node.js on Ubuntu?
1 2 3 4 5 |
sudo apt-get install python-software-properties sudo add-apt-repository ppa:chris-lea/node.js sudo apt-get update sudo apt-get remove nodejs nodejs-dev npm sudo apt-get install nodejs |
Unlike IPv4, which uses DHCP for configuration, IPv6 uses the Neighbor Discovery Protocol to configure addresses and gateways. Unfortunately, originally the protocol had no means of providing addresses of DNS servers to clients, making it necessary to use DHCPv6 for that purpose. Modern Linux and Mac OS X machines are able to use the IPv6 Router Advertisement Options for DNS Configuration (RFC 6106), but to my knowledge, Windows clients are not able at the moment. Here’s how to configure a Linux router using radvd and the ISC DHCP daemon. Continue reading Linux IPv6 Router: RADVD + DHCPv6
Installing Python on Windows is a bit more laborious than on Mac or Linux, because there’s a bit of manual configuring to do. Here’s an installation checklist to go through to get it done so that you have IPython ready, and you can install packages from PyPI. These instructions are for Python 2.7. Continue reading Python 2.7 Windows Installation Checklist
I had to migrate a pretty big database cluster from one server with PostgreSQL 8.4 to a new server with 9.2 There we multiple apps using the databases, and the downtime had to be minimal. Luckily, the databases were split to multiple schemas, and there were only a few tables in a couple of schemas that were in active use at the time of the migration.
The pg_dump tool was very helpful in this operation. First, I set up ssh public key authentication between the postgres users from the source to the destination server. Then I ran the first full cluster dump to the new empty cluster. This can be done while users are actively using the source database, as long as you know which schemas, tables and sequences are in use, so that they can be copied again after shutting down applications: Continue reading PostgreSQL Database Cluster Migration Notes
In this article I will show you how to use the Sonera CStream Messaging Web Service API to send an SMS using Python, and a library called SUDS. The CStream API is two-way service for both sending and receiving messages. You obviously need to pay for the service to get access. After you have your credentials, you can start using the service.
The SUDS is a lightweight SOAP Python client for exploring and using web services. A recent version can be installed on Debian based distros with “sudo apt-get install python-suds”, or on almost anything with “pip install suds”. Continue reading Sonera CStream Messaging Web Service API with Python and SUDS
Sometimes you have an executable which does not fork to the background, but you need to control it with init scripts, so that it does indeed run in the background. Here’s a pretty generic init script for that. It allows you to configure these:
1 2 3 4 5 6 7 |
DAEMON_NAME="My Little Daemon" DAEMON_EXECUTABLE="/opt/my_daemon/my_daemon" DAEMON_OPTIONS="" DAEMON_HOMEDIR="/opt/my_daemon" DAEMON_PIDFILE="/var/run/my_daemon.pid" DAEMON_LOGFILE="/var/log/my_daemon.log" INIT_SLEEPTIME="2" |
Continue reading Init Script for Daemonizing Non-Forking Processes
HP seems to have set up a package repository for Ubuntu 12.04, which is an improvement since I last checked a few years ago. To use the repo, add the following line to /etc/apt/sources.list:
1 |
deb http://downloads.linux.hp.com/downloads/ManagementComponentPack/ubuntu precise current/non-free |
Run “sudo apt-get update”.
You can install a number of software packages from the repository:
To get a virtual serial console, you need to enable the iLO virtual serial port. I had mine set up like this:
I also enabled ssh access in the iLO web interface. This way I can ssh into the iLO and see all BIOS messages using the “vsp” command. I can even go to the BIOS setup (RBSU) by pressing “ESC-9”.
To be able to control GRUB via the virtual serial port, it has to be configured. I changed the following lines in /etc/default/grub: Continue reading HP iLO2 Virtual Serial Console on Ubuntu
I downloaded the firmware from HP site. It was named CP019022.scexe. I tried uploading it in the iLO2 web interface, but it was rejected. Next, I copied it to the server, gave it execute permissions and ran it:
1 2 3 4 |
root@host:~# ./CP019022.scexe ./CP019022.scexe: 153: ./CP019022.scexe: pushd: not found ./CP019022.scexe: 158: ./CP019022.scexe: popd: not found ./CP019022.scexe: 96: ./CP019022.scexe: ./flash_ilo2: not found |
Not working. This is a fresh installation of Ubuntu Server 12.04.2 LTS x86_64. So I had to start looking closer. The file is a bash script but the hashbang is #!/bin/sh, which puts bash into old Bourne shell mode. No pushd/popd there. Continue reading Upgrading HP Proliant iLO2 Firmware with Ubuntu Server
First, make sure you can use public key authentication or similar means to connect to ssh servers without typing in your password all the time.
Install sshfs for mounting remote filesystems over ssh, and afuse for automounting FUSE filesystems (sshfs uses fuse). Continue reading Automount Anything over SSH
In this article, I will discuss sending messages from server to web browser using RabbitMQ-Web-Stomp as the backend, and a simple JavaScript library to handle the web browser side. SockJS is used as the browser WebSockets library. This setup enables you to directly push messages in realtime from the RabbitMQ message broker to the web client. This makes it possible to deliver status updates to multiple web clients directly from the message broker. No need for special application server software in the middle.
The reverse is also possible. You can push messages from web browsers directly into the RabbitMQ routing system. This article, though, will discuss the former case, from server to client. The infrastructure required for the latter case is the same, with nothing extra needed. Continue reading Web Messaging with RabbitMQ-Web-Stomp and SockJS
To temporarily disable all triggers in a PostgreSQL session, use this:
1 |
SET session_replication_role = replica; |
That disables all triggers for the current database session only. Useful for bulk operations, but remember to be careful to keep your database consistent.
To re-enable:
1 |
SET session_replication_role = DEFAULT; |
To disable just a single trigger, use ALTER TABLE:
1 |
ALTER TABLE mytable DISABLE TRIGGER mytrigger; |
The difference to the previous method is that ALTER TABLE will globally disable the trigger, affecting all database sessions, not just the current one.
To disable all triggers for one table:
1 |
ALTER TABLE mytable DISABLE TRIGGER ALL; |
To re-enable:
1 |
ALTER TABLE mytable ENABLE TRIGGER ALL; |
Update 2015-06-16: Ubuntu 14.04 Active Directory Authentication
Authenticating Linux users against Active Directory has traditionally been hard. There’s a multitude of HOWTOs on how to do it, and every one of them seems to do it a bit differently. This is because environments and goals vary, and there are many ways to achieve a particular goal. I will add my version to the mix. This one fetches users and groups from Active Directory LDAP using a machine account added using the Samba tools, and authenticates users to the Active Directory Key Distribution Center using Kerberos. Continue reading Ubuntu 12.04 Active Directory Authentication