Thursday, 31 January 2008

ActiveRecord error : duplicate key violates unique constraint

I'm currently working (and still exploring) Ruby on Rails for a VoIP services management web portal project.
I frequently stumble upon some doubts about the correct RoR way of doing things - I admit, I tend to do it java style =( - but this one was really driving me crazy...
When creating a new record for a table named "groups", the ActiveRecord was hitting me with the following exception:

«ActiveRecord::StatementInvalid: RuntimeError: ERROR C23505
Mduplicate key violates unique constraint "pk_groups"»

after some "googlening", I manage to solve this. Apparently, the problem was with the expected sequence, from RoR, for that table "groups".
Since the postgresql was returning the correct next sequence number:

# select nextval('groups_group_id_seq');
nextval
---------
17
(1 row)

it was only a matter of resetting the ActiveRecord sequence (on script/console)
>> ActiveRecord::Base.connection.reset_pk_sequence!('groups')
=> "17"

Friday, 16 November 2007

IMS-Communicator and IPSec SAs

I've spent the last couple of days trying to implement the establishment of the IPSec Security Associations between the P-CSCF an the IMS-Communicator during the initial registration of the SIP UA.
The IMS-Communicator is a SIP softphone, based on the old version of the SIP-Communicator, in which I added some logic to support the IMS procedures for the UE.
Most of the work was done during my last year's academic project (in 2006) entitled "Protocols and Services in Convergent Networks", and it is used since then by people at PT-Inovação and IT, and some other folks around the globe, specially to test against the OpenIMSCore ...
But like I said in the beginning, I'm trying to support IPsec (for now only on Linux, using the ipsec-tools and setkey) so the AKAv1-MD5 authentication is finally fully implemented.
After I've done this, one of my next objectives regarding IMS-Communicator is to port all this IMS logic to the new and shinning SIP-Communicator.
Unfortunately, must probably I'll have to do it on my (little) spare time :-/



Update 1: Franz Edler manages a VM image for a kind of IMS-in-a-bottle, based on OpenIMSCore and IMS-Communicator.

Friday, 9 November 2007

linux: find string

> grep -r "string" "path"

this will list the lines where the "string" occurs in "path" (folders, files and lines inside files)

Friday, 26 October 2007

capture packets on linux

capture packets : tethereal tool

ex:
> tethereal -R tcp.port==8185 -i any -w output.cap

params:

-R «Wireshark filter string»
-i «interface anme»
-w «output file»

Friday, 31 August 2007

Creative Zen Vision:M + Last.fm

When you use Winamp to play music files hosted on your PMP (in my case, Creative Zen Vision:M), it is treated as a streaming source.
This work-around allows you to submit to your Last.fm account the tracks info received by a streaming source (like internet radio, I suppose, but didn't test it yet =)

- winamp 5.33+
- last.fm 1.1.10 (audioscrobbler.wa.1.1.10.exe)
- windows regedit:
HKEY_CURRENT_USER\Software\Audioscrobbler\Winamp Plugin
allowhttp = 1

Tuesday, 28 August 2007

saudações

Why a blog?
Well, I need something where to take notes
of those bits and bytes of knowledge that I learn every day in a way that I could easily aggregate and access them.
A blog looks to be a good idea, let me give a try :)
But why in English? I guess it could be easier in Portuguese... I'll use both :P