Archive for the 'SQL' Category

aolserver4-nsmysql

Nice! Finally got AOL Server’s nsmysql driver working with a lot of help from Dossy. (THANKS!)

This was the trick:

make NO_ROPT=1 NEED_ZLIB=1 NO_LDOVERRIDE=1

As well as having libmysqlclient14 and libmysqlclient14-dev. I’m running Lenny, so I had to grab those from Sarge. Thankfully they installed without a problem.

I haven’t actually tried it yet, but I wanted to post the solution before I got distracted with other things. How do I know its working? The logs:


[14/Jul/2008:12:56:46][4967.3083085488][-main-] Notice: modload: loading '/usr/lib/aolserver4/bin/nsmysql.so'
[14/Jul/2008:12:56:46][4967.3083085488][-main-] Notice: Ns_MySQL_DriverInit(mysql):  Loaded Panoptic MySQL Driver v0.6, built on Jul 14 2008 at 12:56:36.

So the fact that aolserver4-nsmysql is included in lenny, but libnsmysql14 is not, is a problem. I haven’t heard back from Riccardo yet, so I’ll hold off on contact him again until I do.

UPDATE: I’ve successfully queried a MySQL database and returned values to a TCL script, and output to a web page. It works. :-)

SQL Relay + Python

I’m installing sqlrelay-python on lenny to try it out with a new python powered framework I’m building.

sudo apt-get install python-sqlrelay
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  librudiments0.31 libsqlrelay-0.39 sqlrelay
Suggested packages:
  librudiments-doc sqlrelay-doc sqlrelay-config-gtk sqlrelay-connection-daemon sqlrelay-api
The following NEW packages will be installed:
  librudiments0.31 libsqlrelay-0.39 python-sqlrelay sqlrelay
0 upgraded, 4 newly installed, 0 to remove and 208 not upgraded.
Need to get 590kB of archives.
After this operation, 1761kB of additional disk space will be used.
Do you want to continue [Y/n]?
Get:1 http://ftp.us.debian.org testing/main librudiments0.31 0.31-2 [177kB]
Get:2 http://ftp.us.debian.org testing/main libsqlrelay-0.39 1:0.39.4-4 [185kB]
Get:3 http://ftp.us.debian.org testing/main sqlrelay 1:0.39.4-4 [158kB]
Get:4 http://ftp.us.debian.org testing/main python-sqlrelay 1:0.39.4-4 [69.4kB]
Fetched 590kB in 0s (639kB/s)
Selecting previously deselected package librudiments0.31.
(Reading database ... 41856 files and directories currently installed.)
Unpacking librudiments0.31 (from .../librudiments0.31_0.31-2_i386.deb) ...
Selecting previously deselected package libsqlrelay-0.39.
Unpacking libsqlrelay-0.39 (from .../libsqlrelay-0.39_1%3a0.39.4-4_i386.deb) ...
Selecting previously deselected package sqlrelay.
Unpacking sqlrelay (from .../sqlrelay_1%3a0.39.4-4_i386.deb) ...
Selecting previously deselected package python-sqlrelay.
Unpacking python-sqlrelay (from .../python-sqlrelay_1%3a0.39.4-4_i386.deb) ...
Setting up librudiments0.31 (0.31-2) ...
Setting up libsqlrelay-0.39 (1:0.39.4-4) ...
Setting up sqlrelay (1:0.39.4-4) ...
Adding sqlrelay group
Adding group `sqlrelay' (GID 109) ...
Done.
sqlrelay:x:109:
Adding sqlrelay user
Warning: The home dir /var/cache/sqlrelay you specified already exists.
Adding system user `sqlrelay' (UID 109) ...
Adding new user `sqlrelay' (UID 109) with group `sqlrelay' ...
The home directory `/var/cache/sqlrelay' already exists.  Not copying from `/etc/skel'.
adduser: Warning: The home directory `/var/cache/sqlrelay' does not belong to the user you are currently creating.
sqlrelay:x:109:109:SQLRelay administrator,,,:/var/cache/sqlrelay:/bin/bash
/etc/sqlrelay/instances empty.
Please read /usr/share/doc/sqlrelay/README.Debian.
Setting up python-sqlrelay (1:0.39.4-4) ...
apt-get install sqlrelay-mysql

Indeed, to start sqlrelay, you do have to edit /etc/sqlrelay/instances.

Language Battles




Every once in a while, someone’s PHP bashing gets the best of me, and I review some other languages: python, ruby, ocaml, perl, and c mostly. I’ve dabbled a bit with most except ocaml, and I don’t really have a preference. I started using PHP based upon a suggestion from a friend of mine many years ago, and just kept going because it was the path of least resistance.

Amongst the interpreted languages, I’ve tried out python, perl, and ruby all with reasonable success, and so I’m pretty much planning to continuing to use them all as the situation dictates. Its probably a good idea to be flexible like that.

So how am I feeling about situation dictation?

Python

I’m feeling that python is good when you want to hunker down and build a big sophisticated program which can do everything on its own pretty well. The pluses - wsgi, cross platform, awesome community. The downsides (for me), the barrier to entry is still a little high. Its definitely more of a real programming language than perl or php, which can be scripted and run without too much specificity. I’m still at the plowing ahead stage of programming, not so much as the plan-before-build stage. For me, its a lot about convenience. I really like how python can run as a daemon and keep accounting of things - like with fail2ban. That’s the kicker for me, if I were to create a monitoring system which needed to keep track of changing dynamics, I’d use python.

Perl

I like perl. Its a lot like php in the its easy to get going. Its readily available, has an awesome community, and has tons of libraries out there. However, like python, it lives just outside the web world for me, back in the command line, shell world. Now that I’m using mod_fcgid instead of mod_php, that is less true, but I still have a bit of a tough time using either python and perl with apache.

What’s impressed me so much about perl is the work that brad fitzpatrick has done with it - like memcached and djabberd, as well as the spamassassin project. The mod_perl community is also really impressive. There are some pretty amazing mod_perl modules out there, and I’m impressed with how well they work with Apache.

I guess if I were to create a network socket server or an apache module prototype, I’d use perl.

Ruby

Of perl, python, and ruby, I’m least familiar with ruby. I’ve used it on the command line and it seems to have some cool stuff and a good community, so I’m sure I’ll be using more of it. Ruby appears to have a lot of web use cases, but I’ve missed the boat in that regard. Mongrels and ruby on rails is foreign to me, but I’m definitely interested. The RoR stuff and MVC reminds me of Java, which doesn’t thrill me. I’d rather write in C, and only concern myself with running the code on free operating systems like FreeBSD and GNU/Linux.

PHP

So what about PHP? Well as I’ve said before, I don’t really write much in PHP. I maintain Nexista, but most of the applications which run on it are written in XML, XSLT, and SQL, leveraging the libxml2 and libxslt libraries which have PHP bindings.

Inasmuch, I’ve thought a lot about rewriting Nexista as an optimized Apache application server, and I might just do that someday. I’ve started on a python port, but haven’t made it too far. It might be possible to get parts of it working on Apache using existing modules like mod_sqil and mod_xslt, and then fill in the gaps with customized c-based modules, or maybe ever mod_perl modules.

Rails versus Symfony

Looks to me like Ruby on Rails is pretty much the same as Symfony, and without worrying about which came first, I have to wonder what makes the MVC system so great.

Personally, I prefer using standards (namely SQL and XML) instead of programming language syntaxes - true, it does make things a little sticky from time to time, but it frees up logic into reusable templates, but also makes it really easy to specialize.

That isn’t to say that the people who created Ruby on Rails and Symfony didn’t do a great job, I really like what they’ve done with tutorials and generally spreading the word about application frameworks.

I guess my gripes have to do with that this can encourage poor database modeling, because its so easy to connect a web interface with a database, and bridge in some code while your at it.