Personal tools

May 17, 2010

collective.amberjack 1.0 released

This is the first plone 4 compliant release

we have a support team!

Starting from 1.0 release, RedTurtle decided to support the project providing a 4 person team.

Activities won't be no more based on a voluntary participation and in the spare time. They are going to be supported and scheduled in a more stable way.

It doesn't mean that collective.amberjack is going to be company branded - quite the contrary - it means that we have a stable team that is going to enhance and mantain the tool.

Except me, the team contains: Mirco Angelini, Federica D'Elia, Luca Fabbri e Andrew Mleczko. During the last Ferrara' sprint, we were glad to have Jacopo Deyla's contribution and the Giacomo Spettoli's return (former contributor) both of them from Regione Emilia Romagna.

You are even more then welcome to participate in the development, in supporting the initiative or just in using and testing the tool. Your contribution will be more useful since, from now, there will be someone that will take care of it.

WHAT'S NEW? 

This 1.0 release supports Plone 4:

  • the 12 tours has been completely revised
  • the TinyMCE support has been added
  • we have a battle plan

WHAT NEXT?

I talked about a roadmap. It assumes that during next Sorrento sprint we'll complete the tasks that will refactore the code and improved 1.1 release.

In the meanwhile we're going to schedule a set of steps that move collective.amberjack in a more solid, usable and mostly, extensible tool.

We are also confident to introduce Windmill as the TTW tool for creating tutorials. Andrea Benetti from University of Ferrara is starting to extend it. Then we'll integrate it into a collective.amberjack.windmill package.

how could you get involved inTO the project?

If you are interested in contribution, the places where we meet are these:

  • launchpad, for the project management (blueprints, bugs, etc.)
  • coactivate, extremely useful for documentation through its wiki and for the mailing lists
  • the code is obviously release on collective.

Otherwise, if you just want to use the system, pypi is your friend:

rilasciato collective.amberjack 1.0

Questa è la prima versione per Plone 4

abbiamo un team di supporto!

Dalla 1.0x RedTurtle ha deciso di supportare il progetto. 

Le attività non saranno più semplicemente volontaristiche e nel tempo libero, ma schedulate nel tempo, supportate e seguite in modo professionale.

Questo non significa che collective.amberjack sta diventando un progetto aziendale, ma semplicemente che avremo un team che ne porterà avanti lo sviluppo.

Il team, oltre a me, è composto da Mirco Angelini, Federica D'Elia, Andrew Mleczko e Luca Fabbri. All'ultimo sprint a Ferrara abbiamo avuto il supporto di Jacopo Deyla e il ritorno di Giacomo Spettoli (tra i primi contributori) entrambi della Regione Emilia Romagna.

Ora, sei ancora di più il benvenuto se vorrai partecipare allo sviluppo, supportare l'iniziativa o semplicemente utilizzare il sistema. Il tuo contributo sarà ancora più utile ora che qualcuno lo porterà avanti sistematicamente.

what's new? 

Questa prima release 1.0x supporta completamente Plone 4:

  • i 12 tour sono stati completamente rivisti
  • è stato introdotto il supporto per TinyMCE
  • abbiamo un piano di battaglia

what next?

Dicevo di un piano di battaglia. Il piano prevede che al prossimo sprint a Sorrento si concludano le operazioni che ci porteranno ad una versione 1.1 rifattorizzate e ulteriormente migliorata. 

Nel frattempo predisporremo una serie di step che ci porteranno ad avere un sistema più solido, usabile e soprattutto estensibile.

Contiamo di introdurre Windmill come tool di creazione di tour via web. I primi tentativi sono molto promettenti. Andrea Benetti sta portando avanti la parte di studio che verrà integrata successivamente in collective.amberjack.

Dove puoi seguire il progetto?

Se sei interessato a partecipare, i posti dove ci incontriamo sono questi:

  • launchpad, per la gestione del progetto (blueprint, bug, ecc.)
  • coactivate, ci è utile per documentare il tutto attraverso il suo wiki e per gestire la mailing list
  • il codice è tutto rilasciato su collective.

Se, viceversa, vuoi utilizzare il sistema, pypi è il tuo amico:

May 13, 2010

managing replicas on database using Lotusscript

Filed Under:

How to manage database replication options using Lotusscript also if user doesn't have manager access

Customer request was: 

Disable replication on the database if user never replicate it in the last week

User only has author rights in ACL database (which is a replica of a management deployed on n users laptops) 
How to get it programmatically even if the user has no rights manager? 

If you try to access the object NotesReplication and try to do something like that:

Dim session As New NotesSession
Dim db As NotesDatabase
Dim rep As NotesReplication
Set db = session.CurrentDatabase
Set rep = db.ReplicationInfo
If rep.Disabled Then
  rep.Disabled = False
End If
Call rep.Save()

You get the following error: 

"Error supplied to access product object method" 

The key is to use the Notes API, in particular NSFDbReplicaInfo 

API in this case exploit user credentials of id who wrote the Lotusscript code, so you should sign the agent with the ID of the administrator or with a user who has manager rights to the database 

We must define the following class in the "Declaration" agent 

Dim rc As Integer 

Type DBREPLICAINFO 
ID AS TIMED 
flags As Integer 
CutoffInterval As Integer 
As cutoff TimeDate 
End Type 

Declare Function Lib W32_NSFDbOpen "nnotes.dll" Alias "NSFDbOpen" (ByVal dbname As String, hdb As Long) As Integer 
Declare Function Lib W32_NSFDbClose "nnotes.dll" Alias "NSFDbClose" (ByVal hdb As Long) As Integer 
Declare Function Lib W32_NSFDbReplicaInfoGet "nnotes.dll" Alias "NSFDbReplicaInfoGet" (ByVal HDB As Long As retReplicationInfo DBREPLICAINFO) As Integer 
Declare Function Lib W32_NSFDbReplicaInfoSet "nnotes.dll" Alias "NSFDbReplicaInfoSet" (ByVal HDB As Long As retReplicationInfo DBREPLICAINFO) As Integer 
Declare Function Lib W32_OSLockObject "nnotes.dll" Alias "OSLockObject" (ByVal handle) As Long 
Declare Sub OSUnlockObject Lib "NNOTES.DLL" Alias "OSUnlockObject" (ByVal handle) 
Declare Sub W32_OSMemFree Lib "NNOTES.DLL" Alias "OSMemFree" (ByVal handle) 


Class NotesReplicationSettings 

Private hdb As Long 
As private retReplicationInfo DBREPLICAINFO 
Private prvdb As NotesDatabase 
Private flgDBExist As Integer 

Sub Delete 
If hdb <> 0 Then Call W32_NSFDbClose (hdb) 
End Sub 

Sub New (inpNotesDatabase As NotesDatabase) 

As String Dim sDatabase 
As New NotesSession Dim uaesession 
Dim rc As Integer 

Me.flgDBExist = False 

'Get a valid NotesDatabase to the specified database 
If inpNotesDatabase Is Nothing Then 
Error 14104, "NotesUserActivity: Object Database is invalid" 
Exit Sub 
End If 

September prvdb = New NotesDatabase (inpNotesDatabase.Server, inpNotesDatabase.FilePath) 

If (prvdb.Server = "") Or (uaesession.IsOnServer) Then 
sdatabase = prvdb.filepath 
Else 
sdatabase prvdb.server = + "!" + Prvdb.filepath 
End If 

'Open the target database 
rc = W32_NSFDbOpen (sDatabase, Me.hDb) 
If rc <> 0 Then 
Me.flgDBExist = False 
End If 

'Set the Replication Information 
rc = W32_NSFDbReplicaInfoGet (Me.hDb, Me.retReplicationInfo) 
If rc <> 0 Then 
Me.flgDBExist = False 
End If 
Me.flgDBExist = True 
End Sub 

DBExist As Integer Public Function 
DBExist = Me.flgDBExist 
End Function 

Public Function Parent As NotesDatabase 
Set Parent = prvdb 
End Function 

Public Function SetDisableReplica (sFlag As Integer) As Integer 

As Long Dim puActivity 

If Not Then Me.flgDBExist 
Error 14104, "Notes DB not opened" 
SetDisableReplica = False 
Exit Function 
End If 

Me.retReplicationInfo.flags = (Me.retReplicationInfo.flags Or & H4) 

rc = W32_NSFDbReplicaInfoSet (Me.hDb, Me.retReplicationInfo) 
If rc <> 0 Then 
Me.flgDBExist = False 
End If 

End Function 
End Class

get an instance in initialize agent method as follows (db is target database to manage):

Dim nrs As New NotesReplicationSettings (db)  

and disable (or enable depending on the parameter that is passed, 1 or 0) replication: 

nrs.SetDisableReplica (1)  

or  

nrs.SetDisableReplica (0)  

And that's all

May 10, 2010

Unchained melody

Filed Under:

Collection concatenation can be done in many ways. A fairly underused way is to use the builtin chain method

Let's suppose you have to concatenate several collections objects, e.g.:

>>> a=range(3)
>>> b=set('ale')
>>> c=(a,b)

One easy way to do that is to create an empty list and use the extend method

>>> cat=[]
>>> cat.extend(a)
>>> cat.extend(b)
>>> cat.extend(c)
>>> cat
[0, 1, 2, 'a', 'e', 'l', [0, 1, 2], set(['a', 'e', 'l'])]

But another elegant way do achieve the same result is to use the chain function from itertools

>>> from itertools import chain
>>> chain(a,b,c)

>>> cat=list(chain(a,b,c))
>>> cat
[0, 1, 2, 'a', 'e', 'l', [0, 1, 2], set(['a', 'e', 'l'])]

This is especially useful when you have big amount of data because the result of the chain function is an iterator

How to make your team mates think you are someway useful

Filed Under:

Disclaimer: vi integralist should skip this post :)

During a technical meeting here in RedTurtle, me and my colleagues were exposing fancy stuffs about software development and I was amazed that the attention of my team mates was triggered by me using a self made Pydev template to insert the encoding on top of Python files.

So here, I am reporting this to the whole planet, hoping someone else will appreciate this simple time saving tip :)

Adding a new template in Pydev is really easy, just go to Window -> Preferences... A configuration window should appear (see image below).

Screenshot
 of Pydev 
configuration window

Navigate the tree panel on the left: Pydev -> Editor -> Templates and add click on the New button.

Another window will appear, where you can insert a name for your template (in my case utf8), a description (Insert encoding in the file) and the text to be inserted when this template is used (# -*- coding: utf-8 -*-).

With this template configured, insert che utf-8 encoding in to a file is just as easy as typing ut[CTRL]+[SPACE].

 

Document Actions