Xalos – Arbol de informes
para visualizar el arbol de reportes se creo el siguiente codigo:
basicLibraries.loadLibrary("Tools")
if not IsConfigured() then
ologin = loadDialog("xalos","LoginForm")
loadconf
UpdateForm
ologin.execute
else
oMenu = loadDialog("xalos","MenuForm")
oTreeCtrl = oMenu.getControl("TreeControl")
oTreeModel = oTreeCtrl.Model
oTreeModel.SelectionType = 1
'oTreeModel.RootDisplayed = false
'instantiate the MutableTreeDataModel service
oMutableTreeDataModel = createUnoService("com.sun.star.awt.tree.MutableTreeDataModel")
'MutableTreeDataModel implemets XMutableTreeDataModel
'use XMutableTreeNode::createNode(
' [in] any DisplayValue,
' [in] boolean ChildsOnDemand )
'to create the root node
'If you pass to the boolean parameter TRUE as a argument,
'the created node will be treated as a non-leaf (branch) node
'by the XTreeControl , even when it has no child nodes.
'If false, the node will be a leaf.
'The root should obviously be a non-leaf node.
oRootNode = oMutableTreeDataModel.createNode( "Informes", true )
'use XMutableTreeNode::setRoot( [in] XMutableTreeNode RootNode )
'to set this node as the root of the model
oMutableTreeDataModel.setRoot(oRootNode)
' Obtengo los reportes
if loginID > 0 and Connect() then
Dim oSql as String
Dim oRowSet as Object
Dim nRegistros
oSql = "SELECT ptrl.name, p.ad_process_id from xendra.ad_process p join xendra.ad_process_trl ptrl on p.ad_process_id = ptrl.ad_process_id "
oSql = oSql & " WHERE coalesce(jasperreport ,'empty')!='empty' AND p.ad_process_id in "
oSql = oSql & "(select ad_process_id from xendra.ad_process_access where ad_role_id in "
oSql = oSql & "(select ad_role_id from xendra.ad_user_roles where ad_user_id = " & loginID & "))"
oRowSet = createUnoService("com.sun.star.sdb.RowSet")
oRowSet.activeConnection = oConnection
oRowSet.Command = oSql
oRowSet.execute
nRegistros = oRowSet.getPropertyValue("RowCount")
if nRegistros > 0 then
While oRowSet.next()
Dim oNode
oNode = oMutableTreeDataModel.createNode( oRowSet.getString(1), false )
oNode.dataValue = oRowSet.getString(2)
'oRootNode.appendChild( oMutableTreeDataModel.createNode( oRowSet.getString(1), false ) )
oRootNode.appendChild( oNode )
Wend
end if
oRowSet.dispose
else
rem ologin.Model.fromRange.Date = CDateToIso( Date()-30 )
rem ologin.Model.toRange.Date = CDateToIso( Date() )
end if
'now create the children of the root
'Dim oChildNode1
'oChildNode1 = oMutableTreeDataModel.createNode( "Parent 1", true )
'oRootNode.appendChild(oChildNode1)
'Create this child's own children
'In two steps:
' Dim oSubChildNode
' oSubChildNode = oMutableTreeDataModel.createNode(_
' "Child 1", true )
'oChildNode1.appendChild(oSubChildNode)
''In only one:
'Go deeper in the hierarchical structure
'oSubChildNode.appendChild( _
' oMutableTreeDataModel.createNode( _
' "Grandson 1", false ) )
' oSubChildNode.appendChild( _
' oMutableTreeDataModel.createNode( _
' "Grandson 2", false ) )
'In only one:
'oChildNode1.appendChild( oMutableTreeDataModel.createNode( _
' "Child 2", true ) )
'=======================================================================
'As you see, the Data Model always creates the nodes
'(XMutableDataModel::createNode)
'and then you add it to the node you want, taking care that
'the node created and the parent node belong to the same data model
' Dim oChildNode2
' oChildNode2 = oMutableTreeDataModel.createNode( "Parent 2", true )
' oChildNode2.dataValue = "ajua"
' oRootNode.appendChild(oChildNode2)
'
' Dim oChildNode3
' oChildNode3 = oMutableTreeDataModel.createNode( "Parent 3", FALSE )
'oChildNode3.setCollapsedGraphicURL( ANY_DOC )
'oChildNode3.setExpandedGraphicURL( ANY_DOC )
'oChildNode3.setNodeGraphicURL( BASIC_BRAKE )
' oRootNode.appendChild(oChildNode3)
' Dim oChildNode4
' oChildNode4 = oMutableTreeDataModel.createNode( "Parent 4", true )
' oRootNode.appendChild(oChildNode4)
' Dim oChildNode5
' oChildNode5 = oMutableTreeDataModel.createNode( "Parent 5", true )
' oRootNode.appendChild(oChildNode5)
'
' Dim oChildNode6
' oChildNode6 = oMutableTreeDataModel.createNode( "Parent 6", FALSE )
' oRootNode.appendChild(oChildNode6)
' 'Although the API refrence states the following:
' "If you want to add child nodes to your tree on demand
' you can .[..] Make sure the parent node returns true
' for XTreeNode::hasChildsOnDemand() either by implementing
' XTreeNode yourself or, if you use the MutableTreeDataModel ,
' use XMutableTreeNode::setHasChildsOnDemand() ."
'http://api.openoffice.org/docs/common/ref/com/sun/star/awt/tree/TreeControl.html
' Dim bHasChildernOnDemand as Boolean
'in this case hasChildsOnDemand returns FALSE
'bHasChildernOnDemand = oChildNode6.hasChildsOnDemand()
' Dim aChild : aChild = oMutableTreeDataModel.createNode( "Grandson", FALSE )
'BUT the node is appended to this node that has no children on demand
' oChildNode6.appendChild(aChild)
'Should it throw an exception?
'set the data model at the TreeControlModel::DataModel property.
oTreeModel.DataModel = oMutableTreeDataModel
'oTreeCtrl.DefaultExpandedGraphicURL = FOLDER_OPEN
'oTreeCtrl.DefaultCollapsedGraphicURL = FOLDER_CLOSED
Dim oListener,oListener2
oListener = CreateUnoListener("Tree_","com.sun.star.awt.tree.XTreeExpansionListener")
'oListener2 = createUnoListener("Select_","com.sun.star.view.XSelectionChangeListener")
'Xray oListener2
oTreeCtrl.addTreeExpansionListener(oListener)
'oTreeCtrl.addSelectionChangeListener(oListener2)
'oDlg.execute()
oMenu.execute
'oTreeCtrl.removeSelectionChangeListener(oListener2)
oTreeCtrl.removeTreeExpansionListener(oListener)
'oDlg.dispose()
oMenu.dispose
'oMenu.execute
' Dim rBounds as new com.sun.star.awt.Rectangle
' Dim wd as new com.sun.star.awt.WindowDescriptor
' oColumnModel = createUnoService("com.sun.star.awt.grid.DefaultGridColumnModel")
' oColumn1 = createUnoService("com.sun.star.awt.grid.GridColumn")
' oColumn1.Title = "City"
' oColumn1.ColumnWidth = 30
' oColumn2 = createUnoService("com.sun.star.awt.grid.GridColumn")
' oColumn2.Title = "Country"
' oColumn2.ColumnWidth = 50
' oColumnModel.addColumn(oColumn1)
' oColumnModel.addColumn(oColumn2)
' oDataModel = createUnoService("com.sun.star.awt.grid.DefaultGridDataModel")
' For i = 0 To 10
' oDataModel.addRow (""&i, Array(Chr(97+i), Chr(65+i)))
' Next i
' oDialogModel = createUnoService("com.sun.star.awt.UnoControlDialogModel")
' oDialogModel.Title = "GridControl Test"
' oDialogControl = createUnoService("com.sun.star.awt.UnoControlDialog")
' oDialogControl.setModel( oDialogModel )
' oDialogControl.setPosSize( 100, 100, 300, 200, com.sun.star.awt.PosSize.POSSIZE)
' oGridModel = oDialogModel.createInstance("com.sun.star.awt.grid.UnoControlGridModel")
' oGridModel.Name = "MyGrid"
' oGridModel.GridDataModel = oDataModel
' oGridModel.ColumnModel = oColumnModel
' oGridModel.ShowColumnHeader = True
' oGridModel.ShowRowHeader = True
' oGridModel.HScroll = True
' oGridModel.VScroll = True
' oGridModel.Sizeable = True
' oGridControl = createUnoService("com.sun.star.awt.grid.UnoControlGrid")
' oGridControl.setModel(oGridModel)
' oDialogControl.addControl("MyGrid", oGridControl)
' oGridControl.setPosSize(10, 10, 280, 180, com.sun.star.awt.PosSize.POSSIZE)
' oToolkit = createUnoService("com.sun.star.awt.Toolkit")
' rBounds.X = oDialogControl.PosSize.X
' rBounds.Y = oDialogControl.PosSize.Y
' rBounds.Width = oDialogControl.PosSize.Width
' rBounds.Height = oDialogControl.PosSize.Height
'
' wd.Type = com.sun.star.awt.WindowClass.TOP
' wd.Bounds = rBounds
' With com.sun.star.awt.WindowAttribute
' wd.WindowAttributes = .BORDER + .MOVEABLE + .SIZEABLE + .CLOSEABLE
' End With
' wd.WindowServiceName = "window"
' oContWin = oToolkit.createWindow(wd)
' oFrame = createUnoService("com.sun.star.frame.Frame")
' oFrame.initialize(oContWin)
' StarDesktop.getFrames().append(oFrame)
' oFrame.Name = "TestGridFrame"
' oFrame.Title = "TestGridTitle"
' oGridControl.createPeer(oToolkit, oContWin)
' oContWin.setVisible(True)
' oListener = CreateUnoListener("XGridSelection_", "com.sun.star.awt.grid.XGridSelectionListener")
' oGridControl.addSelectionListener(oListener)
end if
Xalos – utilidades de conexion a PostgreSQL
ahora ando full exportando desde jasper, la idea es hacer un plugin que permita hacerlo de forma transparente, lidiando con java y C y los xml forms veo que la unica forma viable de hacer cosas en LibreOffice es mediante su star basic script.
a continuacion lo que desarrolle y encontre con respecto a conectarme a PostgreSQL
Dim sURL as String
Public SQLKeywords as String
Dim InfoProperties(6) as New com.sun.star.beans.PropertyValue
Public oConnection as Object
Function Connect() as Boolean
if isnull (oConnection) then
Dim driverManager As Object
driverManager = CreateUnoService("com.sun.star.sdbc.DriverManager")
'Fill the Info-Array of the DataSource with extra Values
sURL = "jdbc:postgresql://" & dbserver & ":" & dbport & "/" & dbname
InfoProperties(0).Name = "AutoIncrementCreation"
InfoProperties(0).Value = ""
InfoProperties(1).Name = "AutoRetrievingStatement"
InfoProperties(1).Value = ""
InfoProperties(2).Name = "EnableSQL92Check"
InfoProperties(2).Value = False
InfoProperties(3).Name = "IsAutoRetrievingEnabled"
InfoProperties(3).Value = False
InfoProperties(4).Name = "JavaDriverClass"
InfoProperties(4).Value = "org.postgresql.Driver"
InfoProperties(5).Name = "user"
InfoProperties(5).Value = dbuser
InfoProperties(6).Name = "password"
InfoProperties(6).Value = dbpwd
oConnection = driverManager.getConnectionWithInfo( sURL, InfoProperties() )
SQLKeywords = oConnection.getMetaData().getSQLKeywords()
else
rem oConnection.dispose
End if
Connect = true
End Function
Function getDBValueString (oSql as String) as String
Dim oRowSet as Object
Dim qcount
Connect()
oRowSet = createUnoService("com.sun.star.sdb.RowSet")
oRowSet.activeConnection = oConnection
oRowSet.Command = oSql
oRowSet.execute
qcount = oRowSet.getPropertyValue("RowCount")
if oRowSet.next() then
getDBValueString = oRowSet.getString(1)
else
getDBValueString = ""
end if
oRowSet.close
End Function
cargar finder como root para borrar cosas en PostgreSQL
sudo /System/Library/CoreServices/Finder.app/Contents/MacOS/Finder
dependencias
para tener gftp corriendo en os x requiero gtk2 atk gtk-doc gnome-doc-utils py26-libxml2 python26 db46 gdbm openssl sqlite3 tk Xft2 xrender xorg-renderproto tcl xorg-libXScrnSaver xorg-scrnsaverproto rarian getopt intltool gnome-common p5-getopt-long p5-pathtools p5-scalar-list-utils cairo libpixman jasper pango shared-mime-info tiff xorg-libXcomposite xorg-compositeproto xorg-libXfixes xorg-fixesproto xorg-libXcursor xorg-libXdamage xorg-damageproto xorg-libXi xorg-libXinerama xorg-xineramaproto xorg-libXrandr xorg-randrproto asi que gracias pero no.
LPD (Line Printer Daemon) o como acercar linux a los usuarios con Xendra
El instructor de Linux se comprometio con la empresa en dar soporte en cuanto lo necesiten, pero cuando se le llamo, dijo que esta semana era imposible y posiblemente la siguiente tambien, imaginan si esta empresa hubiera estado en produccion al 100% y tuviera un problema de configuracion de impresion en linux? que empresa aceptaria una respuesta asi?. explique al usuario como configurar, pero ellos lo veian complejo estar entrando a comandos en terminal, si bien hay CUPS, no es simple configurar impresion en red, o al menos no es intuitiva para los usuarios finales.
Asi que debido a ello integre un servidor LPD dentro de Xendra, esto es, que ahora la impresion en Xendra via red es sencilla de configurar, tan facil como lo es en Windows, esto evita dependencias de “gurus”, optimiza tiempos y es un valor diferencial interesante sobre otros sistemas. asi mismo encontre problemas en el GUI bajo Linux, por tanto Xendra 2 tambien automatiza la configuracion de un desktop para tareas dedicadas (ventas, administracion). esto reduce el ROI al no crear dependencia de un soporte caro y escaso.
Fue bueno que esta persona se botara con el cliente o no diera una alternativa al problema, pues, me permitio ver que en realidad al haber tantos escritorios bajo linux y diferentes formas de hacer las cosas, un soporte local no es la solucion real, la belleza del software libre es que existen soluciones ahi listas para ser integradas, como este servidor LPD.
asi que en Xendra 2 no tendra una configuracion engorrosa para imprimir bajo linux. una razon mas para probar la nueva version.
el proyecto integrado es http://lpdspooler.sourceforge.net/ una creacion de Chris Simoes
hornetq vs jms
cuando empece la replicacion de Xendra me encontre con que el proyecto JBoss Messaging seria descontinuado por hornetQ, al revisarlo encontre que hornetQ es superior en muchos aspectos pues deja de lado la persistencia en base de datos, y utiliza su propio journaling, en Linux utiliza una libreria asincronica enlazada al kernel, lo cual le da una gran performance, tanto asi que en el SPECjms2007 le saco la mugre a la competencia, en junio migramos Xendra 2 a Java 1.6 asi que usaremos hornetQ como el core para el manejo de replicacion asincronica via mensajeria, lo mas interesante es que ya no estas limitado al JMS spec, existen otras tecnologias mas veloces como REst y STOMP.
asi que retiraremos JBoss Messaging del JBoss 5 de Xendra y trabajaremos sobre HornetQ.
fluxbox y xendra POS
fluxbox es un manejador de ventanas, muy flexible en cuanto a sus posibilidades, ligero y perfecto para estaciones con tareas puntuales.
resulta que estuve intentando usar XFCE que es un manejador que personalmente uso cuando estoy en Linux, sin embargo en terminales de venta es una vaina, porque las personas en los puntos de ventas se ponen a jugar, y mueven muchas cosas, claro que son temas visuales, pero igual es un fastidio, asi que personalizamos conky sobre fluxbox y cairo, de esta forma el POS muestra valores de sistema criticos como uso de recursos, trafico de red y solo un acceso al Xendra, en algunos clientes estoy configurando un dock bar para que accedan a aplicaciones puntuales (OpenOffice.org)
otro tema interesante es que el consumo de recursos de ambos programas es bajisimo.
el POS ademas soporta JMS y permite por tanto asincronia con el servidor al punto que cada POS corre una base de datos y envia mensajes al servidor y viceversa, asi las ventas no se ven perjudicadas con una caida de servidor, Xendra 2 usa JBoss 5 y la ultima version de JBoss Messaging.
las base de datos son PostgreSQL, estamos trabajando en replicacion con PostgreSQL 9.0 beta ademas, pero aun no hay nada interesante que mostrar, a diferencia de otros prefiero mostrar cosas concretas que presentaciones de 20 diapositivas con datos tomados de la web.
world domination
En todo sitio encuentras gente ridicula que quiere hacerse pasar de “guru”, esta conversacion es en el canal de postgresql, un canal dedicado a base de datos, el protagonista es kW_ quien aparentemente tiene un proyecto ultra secreto.
si eres una bestia con el ingles, usa google translate.

<kW_> offtopic: does anybody know a channel where people hang around who work with microsoft compilers+linkers?
<sternocera> kW_: I work with them
<kW_> sternocera: well, do you know how you can tell the microsoft compiler|linker in which order to layout static data in the .data section of a compiled file?
<sternocera> kW_: No, and I don’t know why that matters
<kW_> sternocera: well, it matters in a specific case here… apparently the ordering is not simply the ordering on how the variable definitions for that static data appear
<sternocera> kW_: Do you mean within individual object files?
<kW_> sternocera: well, I mean in the resulting PE file (e.g. .DLL file, .EXE file …)
<sternocera> kW_: I can tell you that the initialisation order of global static data is undefined in C++, so why would the order be defined or predictable?
<kW_> sternocera: well, it is effectively a requirement which popped up from real-live testing, and it is not fun to have it, but it looks like the requirement is not going to go away
<sternocera> kW_: Are you sure it isn’t an imaginary requirement? It sounds like one.
<kW_> sternocera: no, unfortunately not, the consequences are real, I’ve measured them (unfortunately I am not allowed to be more specific)
<sternocera> kW_: You’re funny.
<kW_> sternocera: well, I wish this whole thing was not needed (because I know it is messy and compiler-specific at best), but oddly enough, it is
<sternocera> What are the nature of the consequences?
<RhodiumToad> if you’re trying to force the initialization order, then do it via appropriate methods rather than trying to hack on the physical order of data
<kW_> RhodiumToad: you mean the initialization order would possibly affect the physical order of data (it is the physical order which is needed to be influenced here, not the initialization order)
<RhodiumToad> then ignore me
<sternocera> kW_: Who knows? It probably isn’t documented anywhere, and likely varies between compiler versions. Have fun staring at a debugger looking at an ocean of hex.
<kW_> sternocera: well, this is what I currently do
Well, I can at least define islands in this ocean and look where they are positioned
<sternocera> kW_: are you aware that you sound like a crazy person?
<kW_> sternocera: well, to be honest, I do not really care about what I sound like. I’m sure however, once you would see the full picture (which I am not allowed to make public, unfortunately), you would understand the requirements.
<sternocera> kW_: sorry, I don’t believe you
<sternocera> kW_: I think it’s more likely that you don’t see the full picture.
<kW_> sternocera: no worries, I perfectly agree with you that it may sound odd (or “unbelievable”
) given not knowing the reason why this is necessary.
<RhodiumToad> if you’re not able to share details of a problem, then it’s probably not a good idea to ask for help solving it
<sternocera> kW_: I actually have the answer to your question, but unfortunately it’s a secret.
<kW_> RhodiumToad: sure… well, I’m not able to share the details of the bigger problem, and I only ask for help for the smaller one…
<sternocera> The problem you have is that you’re asking how to do an incredibly ill-advised and stupid thing, and telling us that you actually have extremely valid but top secret reasons, and that we would totally agree that what you’ve proposed is the way forward if only we were privy to those secret reasons. Ockham’s razor tells me that the simplest explanation is that you’ve decided to do this dumb thing
<sternocera> and have become emotionally attached to the idea

