среда, 25 апреля 2012 г.

How to connect to postgreSQL database through the network

How to connect to postgreSQL database through the network (linux - debian system)

First you have start the postgreSQL server....

# /etc/init.d/postgresql start

step:1 Allow remote access to postgresql database....


First you open the file called /etc/postgresql/pg_hba.conf.

# vim /etc/postgresql/8.1/main/pg_hba.conf

Now append the following line.

host all all ip_address net_mask auth_method


"ip_address" means your ip. "net_mask" means net mask. "auth_method" means authentication method. There are few authentication methods. such as "password, trust, md5" like that...

eg:
host all all 192.168.0.2 255.255.255.0 trust

When we add auth_method as 'trust', think as trust user. If we add as 'md5', have to issue password while connect to this machine.

more details on postgresql doc

then save and close

step:2 Allow TCP/IP communication

open the file called /etc/postgresql/8.1/main/postgresql.conf. (8.1 means version. It may be vary)

Uncomment "listen_addresses" option.

It's default value is "localhost" and change to '*'.


Finally restart the postgresql database server..

# /etc/init.d/postgresql restart

step:3 Try to connect from remote machine


# psql -h 192.168.0.21 -U postgres d- test

-h means host
-U means user name
-d means database name

enjoy...........

From http://chamathg.blogspot.com/2007/08/how-to-connect-to-postgresql-database.html

пятница, 30 марта 2012 г.

Иногда возникает необходимость работать с несколькими серверами используя ssh.
Некоторые неудобства доставляет то, что часто надо подключаться и вводить пароль.
Можно воспользоваться методом аутентификации, основанном на паре ключей.

Для этого достаточно сгенерировать личный ключ на локальном компьютере:
localuser@local-machine:~$ ssh-keygen -t rsa
Команда создаст (если её еще нет) директорию .ssh в домашнем каталоге и запишет в неё файл id_rsa.pub с ключом.


Далее необходимо зайти на сервер и создать в папке ~/.ssh файл authorized_keys.

Затем поместить в этот файл строку из файла id_rsa.pub, который вы сгенерировали на локальной машине.

Добавлять в файл authorized_keys можно сколько угодно таких записей.

В итоге мы получаем доступ к удаленной системе без ввода пароля.

вторник, 10 января 2012 г.

export HGENCODING=UTF-8

Чтобы PyCharm не тупил с кодировкой меркуриала: echo export HGENCODING=UTF-8 >> .profile

пятница, 23 сентября 2011 г.

Разворачиваем Django на Windows 7.

Устанавливаем:
python 2.7 из exe
easy_install для python 2.7 из exe
PostgreSQL (Перед установкой смотрим чтобы в системе не было пользователя postgres)
pip для python из сырцов
psycopg2 (ищем exeшник)
PIL (ищем exeшник)
virtualenv через pip
Django

tortoisesvn

eclipse
py-dev
subclipse

пятница, 24 июня 2011 г.

Python 2.5.6 and zmq 2.1.7

setup.py configure --zmq=/opt/local/
setup.py build_ext --inplace
setup.py install

вторник, 17 мая 2011 г.

Смена дефолтного текстого редактора

cd ~
touch .profile
/opt/local/bin/mcedit .profile -> export EDITOR=/opt/local/bin/mcedit

вторник, 17 августа 2010 г.

Скриншоты

⌘+Shift+3 (Скриншот всего экрана сохраняется на рабочий стол)
⌘+Shift+Ctrl+3 (Скриншот экрана сохраняется в буфер обмена)
⌘+Shift+4 (Выделенная часть экрана сохраняется на рабочий стол)
⌘+Shift+Ctrl+4 (Копирование выделенного фрагмента в буфер обмена)

Смена фотрмата скриншотов

defaults write com.apple.screencapture type JPG
killall SystemUIServer

пятница, 12 марта 2010 г.

Install lxml-2.2.6 on OSX 10.3 (Python 2.6.3) in $HOME

libxml2-2.7.6

./configure --prefix=$HOME --with-python=$HOME/Python-2.6.4
make
make install

libxslt-1.1.26:

./configure --prefix=$HOME --with-python=$HOME/Python-2.6.4 --with-libxml-prefix=$HOME
make
make install
cd $HOME/Python-2.6.4/lib/python2.6/site-packages/
ln -s $HOME/lib/python2.6/site-packages/* .


lxml-2.2.6

../python setup.py build_ext --with-xslt-config=$HOME/OpenERP/bin/xslt-config --with-xml2-config=$HOME/OpenERP/bin/xml2-config -I $HOME/OpenERP/include/libxml2

пятница, 18 декабря 2009 г.

Install OpenLDAP in MacOS 10.5.3

LDFLAGS=-L/usr/local/BerkeleyDB.4.7/lib CPPFLAGS=-I/usr/local/BerkeleyDB.4.7/include ./configure
make depend
make install

воскресенье, 1 ноября 2009 г.

Установка Postgresql-8.3 в ubuntu

sudo apt-get install postgresql-8.3
sudo apt-get install postgresql-server-dev-8.3
sudo apt-get install pgadmin3
sudo -u postgres psql postgres
\password postgres

четверг, 15 октября 2009 г.

Google поиск по умолчанию в firefox

1. about:config
2. keyword.url
3. http://www.google.com/search?btnG=Google+Search&q=

среда, 22 июля 2009 г.

PostgreSQL

Если вдруг не хочет запускаться:

rm /Library/PostgreSQL/8.3/data/postmaster.pid

четверг, 9 июля 2009 г.

ZSH

ZSH, о да! это тема!
Терминал >>> настройка >>> загрузка >>> Открытие Shell >>> с командой : /bin/zsh

четверг, 2 июля 2009 г.

Установа OpenLDAP в Mac OS X

1. Скачиваем релиз дистрибутива openldap
2. Скачиваем дистрибутив Berkeley DB.4.7
3. Разваричиваем архив Berkeley
4. Переходим в него
5. Собираем и устанавливаем
cd build_unix
../dist/configure
make
sudo make install
6. После установки собираем openldap
env LIBS="-Lresolv" CPPFLAGS="-I/usr/local/BerkeleyDB.4.7/include" \
LDFLAGS="-L/usr/local/BerkeleyDB.4.7/lib" ./configure
7. Запускаем make depend
8. Запускаем make
9. И самое интересное make install
10. Запускаем в тестовом режиме: sudo /usr/local/libexec/slapd -t

Sony NW-S203F в Mac OS X

Наконец то удалось подружить мой плеер с маком. Сдружил их программой JSymphonic, качать здесь http://sourceforge.net/projects/symphonic/files/

вторник, 30 июня 2009 г.

Установка песочницы Python-2.5.4. и Zope с помощью zopeproject

Установка песочницы Python-2.5.4. и Zope с помощью zopeproject
1. Скачиваем дистрибутив Python с оф сайта python.org
2. Создаем папку проектов в домашнем каталоге, к примеру Zope
3. Разварачиваем архив с Python в корень домашнего каталога tar -xf Python-2.5.4.tgz
4. cd ~/Python-2.5.4
5. ../configure --prefix=/User/Nelter/Zope/Python-2.5.4
6. make && make install
7. В корне домашнего каталога создаем директорию .buildout и файл в ней default.cfg с содержимым:

[buildout]
newest = false
eggs-directory = /Users/Nelter/Zope/egg
find-links = http://download.zope.org/ppix

8. Скачиваем с сайта pypi.python.org setuptools-0.6c9.tar.gz и разварачиваем его в каталог ~/Zope
9. Создаем симулинк python: ln -s Python-2.5.4/bin/python2.5
10. Устанавливаем setuptools: cd setuptools-0.6c9 && ../python2.5 setup.py install
11. Создаем симулинк на easy_install: cd ../ && ln -s Python-2.4.5/bin/easy_install
12. Устанавливаем zopeproject: ./easy_install zopeproject
13. Создаем симулинк на zopeproject: cd ../ && ln -s Python-2.4.5/bin/zopeproject
14. Создаем инстанцию Zope: ./zopeproject HelloWord
15. Запускаем сервер Zope в debug режиме:

cd HelloWord/bin
./helloword-ctl fg