레이블이 erlang인 게시물을 표시합니다. 모든 게시물 표시
레이블이 erlang인 게시물을 표시합니다. 모든 게시물 표시

2014-05-27

erlang-r17-on-osx-with-wx-and-a-working-observer

Erlang uses wxWidgets, a cross platform GUI library for it’s GUI tools. This build dependency was hard to get working pre-17, especially for 64-bit Erlang. However, 17.0 brings double rainbows and care bears for everyone that reads this HOWTO. So Enjoy!
nonode@nohost

Set correct Xcode path for compilation

As far as I know you need have Xcode install to compile Erlang from source. You can download Xcode via the Mac App Store
If you have multiple versions of Xcode installed (beta’s for example), make sure the Command Line Tools are installed and are pointing to the correct Xcode version.
Initiating an install of the Xcode Command Line Tools:
1
$ xcode-select --install
And verify that the CL-tools point to the correct Xcode install
1
$ xcode-select -s /Applications/Xcode.app/Contents/Developer

Install wxWidgets

wxWidgets is a Cross Platform GUI library that’s used by Erlang for applications like Observer.
Execute this line and get some coffee, walk the dog, take out the trash and/or play with your kids. Compilation takes a while.
1
2
3
4
5
6
$ curl -O http://optimate.dl.sourceforge.net/project/wxwindows/3.0.0/wxWidgets-3.0.0.tar.bz2
$ tar xvjf wxWidgets-3.0.0.tar.bz2
$ cd wxWidgets-3.0.0.tar.bz2
$ ./configure --with-cocoa --prefix=/usr/local
$ make && sudo make install
$ export PATH=/usr/local/bin:$PATH
Check that you got the correct wx-config
1
$ which wx-config

Install kerl

Kerl is a utility that helps you build and manage multiple instances of Erlang/OTP.
1
2
$ curl -O https://raw.github.com/spawngrid/kerl/master/kerl
$ chmod a+x kerl
Create ~/.kerlrc. I use $ vim ~/.kerlrc.
Add these lines:
1
KERL_CONFIGURE_OPTIONS="--disable-debug --without-javac --enable-shared-zlib --enable-dynamic-ssl-lib --enable-hipe --enable-smp-support --enable-threads --enable-kernel-poll --with-wx"

Build & Install Erlang with kerl

1
2
$ kerl update releases
$ kerl build 17.0 17.0
For a 32-bit Erlang prefix kerl build with CPPFLAGS:
1
$ CPPFLAGS="-arch i386" kerl build 17.0 17.0
Install:
1
$ kerl install 17.0 ~/erlang_17_0
Activate:
1
$ . ~/erlang_17_0/activate
And bliss out on your new wx-enabled Erlang:
1
$ erl -s observer start

2014-03-07

Install ODBC and MS SQL Server Client for Erlang

http://arcusfelis.github.io/blog/2012/07/02/odbc/

Install ODBC and MS SQL Server Client for Erlang

Here we are connecting to MS SQL Server 2008 on MS Windows XP from Erlang on Debian Linux.

Part 1

Install utilities (FreeTDS SQL client):
1
# apt-get freetds-bin freetds-dev
Try to connect with the tsql command from the freetds-bin package:
1
tsql -H %ip_address_or_hostname% -p %port_number% -U %username% -P %password%
or (with actual values for me):
1
2
3
4
5
$ tsql -H PI -p 1433 -U test -P test
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
1>
If you see the counter (1, 2, 3, …), most likely tsql is unable to connect to the indicated server. Check the firewall’s settings.
sqsh is an alternative for tsql (more powerful).

Part 2

Install the ODBC client driver.
1
apt-get install tdsodbc

Problems? Part 2a

tdsodbc uses unixodbc library, that conflicts with libiodbc2. libiodbc2 is a dependency for soprano, that is a dependency for the most of KDE applications.
So, you cannot use the KDE and UnixODBC in Debian (the bug from 2011 year).
This conflict can be fixed, downloading the patched versions of the packages from here:
1
2
http://packages.ubuntu.com/precise/libsoprano4
http://packages.ubuntu.com/precise/i386/soprano-daemon
If you don’t use KDE or the bug was fixed, skip this step.

Part 3

Update the config files:
/etc/odbc.ini
1
2
3
4
5
6
7
[odbc-test]
Description = test
Driver = ms-sql
Servername = odbc-test
UID = test
Database = test_db
Port = 1433
/etc/odbcinst.ini
1
2
3
4
5
6
[ms-sql]
Description = TDS connection
Driver = /usr/lib/i386-linux-gnu/odbc/libtdsodbc.so
Setup = /usr/lib/i386-linux-gnu/odbc/libtdsS.so
UsageCount = 1
FileUsage = 1
Test it:
1
2
$isql -v odbc-test test test
SQL>

Part 4

Try it from Erlang:
1
2
3
4
5
6
1> odbc:start().
ok
2> {ok, S} = odbc:connect("DSN=odbc-test;UID=test;PWD=test", []).
{ok,<0.44.0>}
3> odbc:sql_query(S, "SELECT 1").
{selected,[[]],[{1}]}
   Erlang, ODBC