We have a glassfish instance for development purposes in which monitoring was activated on all modules. This caused it to start very slow. We couldn’t access the admin console either because the startup process was failing or taking too long. So, changing the configuration from the admin console wasn’t an option neither from the command line (CLI) with the asadmin command -because it needs the server to be up and running first-

So, you have to disable monitoring from the configuration file prior to attempting to start the server. The file is {jboss-home}/glassfish/domains/domain1/config/domain.xml

look for the lines

<monitoring-service>
        <module-monitoring-levels connector-connection-pool="HIGH" jdbc-connection-pool="HIGH" ejb-container="HIGH" thread-pool="HIGH" jpa="HIGH"></module-monitoring-levels>
</monitoring-service>

and change it to

<monitoring-service>
        <module-monitoring-levels connector-connection-pool="OFF" jdbc-connection-pool="OFF" ejb-container="OFF" thread-pool="OFF" jpa="OFF"></module-monitoring-levels>
</monitoring-service>

or remove them altogether like so

<monitoring-service>
        <module-monitoring-levels></module-monitoring-levels>
</monitoring-service>

then start the server

asadmin start-domain –verbose

sources:
https://stackoverflow.com/questions/13747147/glassfish-3-1-2-monitoring-ejb-container-bean-methods
https://stackoverflow.com/questions/32118705/start-glassfish-domain-without-enabling-or-starting-deployed-applications
https://www.c2b2.co.uk/middleware-blog/glassfish-4-performance-tuning-monitoring-and-troubleshooting.php

runlevel3

What to do when there’s no space left on device (boot partition)

First identify your current kernel with

uname -r

then list all other kernel images you have installed (except your current)

dpkg -l linux-{image,headers}-“[0-9]*” | awk ‘/^ii/{ print $2}’ | grep -v -e uname -r | cut -f1,2 -d"-" | grep -e ‘[0-9]’

you can try to remove them with the following command

dpkg -l linux-{image,headers}-“[0-9]*” | awk ‘/^ii/{ print $2}’ | grep -v -e uname -r | cut -f1,2 -d"-" | grep -e ‘[0-9]’ | xargs sudo apt-get -y purge

if that doesn’t work, you could try to remove them manually.

Identify kernel images you may remove with

sudo dpkg –list ‘linux-image*’|awk ‘{ if ($1==”ii”) print $2}’|grep -v uname -r

remove the files with using the older versions and, perhaps, leaving out the last 2 versions for having an option in case you need to boot with a previous kernel

rm -rf /boot/-4.4.0-{47,51,53,57}

fix missing dependencies with

sudo apt-get -f install

and finally clean up with

sudo apt-get autoremove

fuentes:
https://askubuntu.com/questions/89710/how-do-i-free-up-more-space-in-boot
https://askubuntu.com/questions/345588/what-is-the-safest-way-to-clean-up-boot-partition

Supongamos que tienes un reporte en el que quieres ocultar un listado de una consulta de acuerdo al valor de un parámetro.

Podríamos ocultarlo fácilmente mediante la opción de visibilidad ‘Properties | Visibility | Hide element’ y utilizar una expresión como la siguiente

params[‘ocultarDetalles’].value === true

Screenshot from 2017-06-23 15-02-13

pero la consulta se ejecutaría de cualquier manera, lo que ocasionaría tiempo y procesamiento innecesario.

Para que no se ejecuté la consulta, es necesario remover el elemento que queremos ocultar en el método ‘beforeFactory’ del reporte. Para ello, primero necesitamos especificar el nombre al elemento que queremos ocultar, yo utilicé un grid el cual contiene la tabla de la consulta y lo nombré grdDetalles.
Screenshot from 2017-06-23 15-28-46

Luego selecciona la pestaña ‘Script’ y en la ventana ‘Outline’ selecciona el reporte. Asegurate seleccionar el evento ‘beforeFactory’ y agrega el siguiente script

if (params['ocultarDetalles'].value === true) {
    reportContext.getDesignHandle().findElement("grdDetalles").drop();
}

Screenshot from 2017-06-23 15-01-23

con esto se evita que se realice innecesariamente la consulta.

fuentes:
http://developer.actuate.com/community/forum/index.php?/topic/34143-does-birt-still-execute-a-query-if-an-element-is-hidden/

While I was working with a lot of reports, it made sense to use a standard file name for all the files. This was an afterthought, so it required me to rename the files. I was hoping Ubuntu Nautilus had this option, but for my current version -16.04- it doesn’t. That feature is expected to land in 17.04. in the meantime you can install nautilus-renamer which offers the same feature.

Just download the .deb package from the nautilus-renamer launchpad page and install it with

sudo dpkg -i nautilus-renamer_4.0-quantal_all.deb
sudo apt install -f
killall nautilus

It des not work if parent folders contain spaces in their name and it does not support unicode characters. I guess the nautilus version for 17.04 should work with these.

Then, just open a nautilus window and select a bunch of files, right click and select ‘rename…’ or just press F2.

done!

sources:
http://www.omgubuntu.co.uk/2016/06/nautilus-batch-rename-feature-coming-gnome-3-22
https://launchpad.net/nautilus-renamer
http://www.omgubuntu.co.uk/2016/08/quick-look-new-features-nautilus-3-22
https://launchpad.net/~gnome3-team/+archive/ubuntu/gnome3

We have a bunch of tables per office, each on its own schema in an Oracle Database.

For simplicity, we have created views on this tables and synonyms to access this views from one single schema. Hibernate supports mapping entities to synonyms, so there’s nothing more we need to do on our entities. But we still want to be able to add and modify underlying data.

To achieve this we had to create views and triggers like so

SET DEFINE OFF;
CREATE OR REPLACE FORCE VIEW CENTRAL.VPARTES
(
   SID_PARTE,
   ...
)
AS
   SELECT 'OF001' SID_OFICINA,
          T.SID_PARTE,
          ...
     FROM OFICINA001.TPARTES T
    WHERE 1 = 1 AND T.NESTATUS IN (1, 2)
   UNION ALL
   SELECT 'OF002' SID_OFICINA,
          T.SID_PARTE,
          ...
     FROM OFICINA002.TPARTES T
    WHERE 1 = 1 AND T.NESTATUS IN (1, 2);


CREATE OR REPLACE TRIGGER CENTRAL.TG_VPARTES_UPD
INSTEAD OF UPDATE
ON CENTRAL.VPARTES
FOR EACH ROW
BEGIN
IF :OLD.SID_OFICINA = 'OF001' THEN
UPDATE OFICINA001.TPARTES
SET    
       SESTATUS       = :NEW.SESTATUS,
       ...
WHERE  1 = 1
AND SID_PARTE        = :NEW.SID_PARTE ;
ELSIF :OLD.SID_OFICINA = 'OF002' THEN 
UPDATE OFICINA002.TPARTES
SET    
       SESTATUS       = :NEW.SESTATUS,
       ...
WHERE  1 = 1
AND SID_PARTE        = :NEW.SID_PARTE ;
END IF;
END;
/

for the INSERT it would be kind of the same.

If you happen to use JHipster, to allow the usage of synonyms while passing the liquibase validation we need to add a hibernate property on our corresponding application-{profile}.yml or disable liquibase altogether.

spring:
    profiles:
        include: no-liquibase
...
    jpa:
        database-platform: org.hibernate.dialect.Oracle12cDialect
        database: ORACLE
        show-sql: false
        properties:
            ...
            hibernate.synonyms: true

sources:
http://stackoverflow.com/questions/6531729/updatable-view-oracle
http://stackoverflow.com/questions/8817253/jpa-entiy-on-synonym-instead-of-table

JHipster is a great tool to start and develop applications, it follows best practices and includes best of breed frameworks and tools.

But, at first it could be too complex to understand. One of the tough things to grasp is liquibase. For us, we had been used to design and build the tables first and then our entities. With jhipster it takes only one step, create your entities and liquibase will take care of the rest. I totally understand why it’s included (they recommend best practices remember), changes to the database are part of any system and as such they should be included as part of the application -and version control, of course-.

To ease the adoption of this tool, we disabled liquibase on production by adding just this lines to the application-prod.yml file

spring:
    profiles:
        include: no-liquibase
...

sources:
http://stackoverflow.com/questions/34559042/disable-liquibase-temporarily-in-jhipster-2-26

To integrate a REST web service with SmartGWT DataSource you have client side data integration mechanisms.

I’ve used this to connect an existing REST web service with SmartGWT controls.

Nevertheless, we have a REST web service wich receives a Path Parameter to update an entity.

    @PUT
    @Path("/proveedores/{id}")
    public Response updateProveedor(@PathParam("id")String id, String request){
        Response response = null;
        try{
            SCRequest<Proveedor> scRequest = Jackson.mapper().readValue(request, new TypeReference<SCRequest<Proveedor>>() {
            });
            Proveedor proveedor = Proveedor.guardar(scRequest.getData());
            response = Response.ok(Jackson.mapper().writeValueAsString(new SCResponse(0, proveedor))).build();
        } catch (Exception e){
            String error = "Ocurrio un problema al actualizar el registro del proveedor";
            log.error(error, e);
            response = Response.serverError().entity(error).build();
        }
        return response;
    }

we need to configure the URL of the RestDataSource dynamically like so in the transformRequest method

public class ProveedoresRestDataSource extends RestDataSource {
    private static final Logger log = Logger.getLogger("ProveedoresRestDataSource");

    public static final ProveedoresRestDataSource INSTANCE = new ProveedoresRestDataSource();
    public static final String API_REST_WEB_GWT_COMPRAS_CATALOGOS_PROVEEDORES = "api/rest/web-gwt-compras/catalogos/proveedores";

    public ProveedoresRestDataSource() {
        setDataURL(API_REST_WEB_GWT_COMPRAS_CATALOGOS_PROVEEDORES);
        setDataFormat(DSDataFormat.JSON);

        OperationBinding create = new OperationBinding(DSOperationType.ADD, API_REST_WEB_GWT_COMPRAS_CATALOGOS_PROVEEDORES);
        create.setDataProtocol(DSProtocol.POSTMESSAGE);
        OperationBinding retrieve = new OperationBinding(DSOperationType.FETCH, API_REST_WEB_GWT_COMPRAS_CATALOGOS_PROVEEDORES);
        OperationBinding update = new OperationBinding(DSOperationType.UPDATE, API_REST_WEB_GWT_COMPRAS_CATALOGOS_PROVEEDORES);
        update.setDataProtocol(DSProtocol.POSTMESSAGE);
        DSRequest updateProperties = new DSRequest();
        updateProperties.setHttpMethod("PUT");
        update.setRequestProperties(updateProperties);
        setOperationBindings(create, retrieve, update);

        DataSourceField fldId = new DataSourceTextField("id");
        fldId.setPrimaryKey(true);
...
        setFields(fldId, ...);
    }

    @Override
    protected Object transformRequest(DSRequest dsRequest) {
        if(DSOperationType.UPDATE.equals(dsRequest.getOperationType())){
            String id = JSOHelper.getAttribute(dsRequest.getData(), "id");
            dsRequest.setActionURL(API_REST_WEB_GWT_COMPRAS_CATALOGOS_PROVEEDORES + "/" + id);
        }
        return super.transformRequest(dsRequest);
    }
}

sources:
http://helpdesk.objects.com.au/java/how-do-i-generate-dynamic-urls-with-smartgwt-and-restdatasource
http://www.smartclient.com/smartgwt/javadoc/