my life

day to day

Archive for August, 2007

DJabberd + Google Talk (GTalk) HOWTO

Monday, August 27th, 2007

Since GTalk is totally complaint with Jabber, all you need to do to make your jabber server communicate with it is enable S2S in your DJabberd configuration. Also, you might need to setup a SRV record so remote jabber servers know how to communicate back to your vhost.

Add this to your djabber.conf VHost section at the top.

S2S enable

Next, add the SRV records. More information can be found by following…

http://jabberd.jabberstudio.org/2/docs/section05.html#5_7

Which means, you essentially add this (on BIND servers) to the domain configuration.

_jabber._tcp.some_domain.com. 86400 IN SRV 5 0 5269 host.some_domain.com. _xmpp-server._tcp.some_domain.com. 86400 IN SRV 5 0 5269 host.some_domain.com. _xmpp-client._tcp.some_domain.com. 86400 IN SRV 5 0 5222 host.some_domain.com.

Check that they took by running…

dig @localhost _jabber._tcp.some_domain.com any +short

Now start adding your contacts just by using the GMail email address.. e.g

add to del.icio.us    add to technorati favs   email this

PropelException: No connection params set for propel

Friday, August 17th, 2007

I upgraded to a newer version of Symfony today (v1.0.6) and had a hell of time getting the trivial task of connecting to the database working.

I was able to obtain a connection, by doing


$databaseManager 
= new sfDatabaseManager();
$databaseManager->initialize();
$con $databaseManager->getDatabase('propel');


but that’s not the ideal way, and not the way symfony gets the database handle.


$con 
Propel::getConnection('propel');
on the otherhand throws an excpetion.

Fatal error: Uncaught exception ‘PropelException’ with message ‘No connection params set for propel’

First, it was important to check that config/schema.xml is correct

<database name=”propel” defaultIdMethod=”native”>

And that config/databases.yml has a connection profile for propel

All that was good. But for some reason sfPropelAutoload was not geting loaded.

If I manually included it


include './lib/symfony-1.0.7/lib/addon/propel/sfPropelAutoload.php'It was clearly listed in the autoloader.yml


it would work, but still not desirable.

The following was in my autoloader config,

propel_addon: name: propel addon files: Propel: %SF_SYMFONY_LIB_DIR%/addon/propel/sfPropelAutoload.php

but it still wouldn’t load my sfPropelAutoload class. Adding the following made it start working…

symfony_orm: name: symfony orm classes files: Propel: %SF_SYMFONY_LIB_DIR%/addon/propel/sfPropelAutoload.php Criteria: %SF_SYMFONY_LIB_DIR%/vendor/propel/util/Criteria.php SQLException: %SF_SYMFONY_LIB_DIR%/vendor/creole/SQLException.php DatabaseMap: %SF_SYMFONY_LIB_DIR%/vendor/propel/map/DatabaseMap.php

add to del.icio.us    add to technorati favs   email this

Symfony - No package found for database “” in generated-schema.xml

Friday, August 17th, 2007

I was getting this error today on a new Symfony project. The problem was that I had defined the schema in the schema.xml file, but there was a conflicting schema.yml file that sat empty. Removing (

rm -f config/schema.yml
fixed my problems and propel-build-model + propel-build-sql succeeded.
Execution of target “sql-template” failed for the following reason: /home/eosterman/metaphr/trunk/lib/symfony-1.0.6/lib/vendor/propel-generator/build-propel.xml:187:1: No package found for database “” in generated-schema.xml. The propel.packageObjectModel property requires the package attribute to be set for each database. [phingcall] /home/eosterman/metaphr/trunk/lib/symfony-1.0.6/lib/vendor/propel-generator/build-propel.xml:187:1: No package found for database “” in generated-schema.xml. The propel.packageObjectModel property requires the package attribute to be set for each database.

add to del.icio.us    add to technorati favs   email this

Using strtotime(…) in PHP to calculate the last day of the month

Wednesday, August 15th, 2007



$unixtime 
strtotime(strftime('%Y-%m-01 - 1 second',
strtotime('next month')));

add to del.icio.us    add to technorati favs   email this

DJabberd Debian HOWTO

Saturday, August 11th, 2007

Checkout the latest SVN copy

svn co http://code.sixapart.com/svn/djabberd/ /usr/src/djabberd/

First install dependencies

apt-get install openssl libdbd-sqlite3-perl  libnet-ssleay-perl libnet-dns-perl libdigest-sha1-perl  libxml-sax-perl libxml-libxml-perl liblog-log4perl-perl subversion libdigest-hmac-perl libdanga-socket-perl libsys-syscall-perl

Now install DJabberd

cd /usr/src/djabberd/trunk/DJabberd/ perl Makefile.PL make all install

Now create the SSL certificates

mkdir /etc/djabberd cd /usr/src/djabberd/trunk/ openssl req -x509 -newkey rsa:1024 -keyout /etc/djabberd/server-key.pem -out /etc/djabberd/server-cert.pem -days 365 -nodes htdigest -c /etc/djabberd/djabberd.users djabberd [your-username-without-at-sign]

Create the server configuration file /etc/djabberd/server.conf

OldSSL  enable
# health checks from this IP (directive can be repeated) won't log and
# won't allocate a connection id
DeclareMonitor 127.0.0.1
AdminPort 5200
ClientPort 5222
ServerPort 5269
SSLCertificateFile    /etc/djabberd/server-cert.pem
SSLCertificateKeyFile /etc/djabberd/server-key.pem 

<VHost alliance.com>
  S2S enable
  RequireSSL yes
  <Plugin DJabberd::Authen::HTDigest>
    Realm djabberd
    HtDigest /etc/djabberd/djabberd.users
  </Plugin>
  <Plugin DJabberd::RosterStorage::SQLite>
    Database /etc/djabberd/djabberd.sqlite
  </Plugin>
  <Plugin DJabberd::Authen::MySQL>
    DBName               djabberd
    DBHost               127.0.0.1
    DBPort               6723
    DBUsername           dbusername
    DBPassword           dbpassword
    DBTable              user
    DBUsernameColumn     username
    DBPasswordColumn     password
    DBEncryptedPasswords 1
    DBWhere              canjabber = 1
  </Plugin> 

</VHost>

Start the server

/usr/local/bin/djabberd --conf=/etc/djabberd/server.conf --daemon

add to del.icio.us    add to technorati favs   email this

VIM Not Restoring Position

Friday, August 10th, 2007

For some reason, vim stopped recording the last position in the files I was editting. I think it is related to a recent upgrade. Regardless, adding these lines to my ~/.vimrc restored the functionality



set viminfo
='10,\\"100,:20,%,n~/.viminfo
    au BufReadPost * if line("'""
) > 0|if line("'\\""

add to del.icio.us    add to technorati favs   email this