Wednesday, June 19, 2019

Remmina login failed for display 0 Centos client / xrdp server on Centos 7

Hello,
When trying to connect my desktop pc (CentOS 7 ) to my new Laptop (CentOS 7) vusing Remmina, i've faced this problem :
Login successfull and then a message window saying:
sending login info to session manager, please wait
login failed for display 0

is shown.

I tried  to change xrdp.ini file by modifying some parameters such as max_sessions or bpp values but the error persists to update my remmina version or to changs session manager params .....

When i used windows mstsc i discovered that is works fine, rdesktop works fins also(but loud)  I was certain that the problem was remmina's one ...


Solution was very simple for Remmina after 2 days   😕😕😕😕😕
i've just changed
color depth combobox value in my case to 24bpp (max_bpp=32 in /etc/xrdp/xrdp.ini) 

Now it works fine and with correct desktop refresh speed





Friday, March 22, 2019

JPA : Hibernate implementation raises exception when retrieving jdbc connection

For some cases, there a need to retrieve jdbc connection to execute some database operations such as batch works; tables loading from big files or others .....

When working with enitity manager

Connection conn = em.unwrap(Session.class).connection();  

raises an exception when working with an hibernate implementation (works fine with eclipselink)
One solution is :

public Connection hibernateConnection() {
  SessionImplementor si = (SessionImplementor) entityManager.unwrap(Session.class);
  try {
   return si.getJdbcConnectionAccess().obtainConnection();
  } catch (SQLException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
   return null;
  }
  
  
 }

Friday, March 1, 2019

JBoss 7 - JSF null value input become 0

this problem occures when binding an input in jsf to a numeric attribute in the bean.
Usually when we are running the app on apache tomcat we addthis jvm paramter in the tomcat VM
-Dorg.apache.el.parser.COERCE_TO_ZERO=false

For those who are running on JBoss Server 7.x
adding a context parameter


<context-param>
    <param-name>javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL</param-name>
    <param-value>true</param-value>
</context-param> 
in standalone.xml file did not work for me.
One working solution is to create is to add a listener to your web app that adds this parameter dynamically
Here is the code

'Here i'm using WebListener annotation'

  
package com.cnss.ds.web.utils;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;


@WebListener
public class AppWebLsistener  implements ServletContextListener {
 @Override
    public void contextInitialized(ServletContextEvent event) {

        System.setProperty("org.apache.el.parser.COERCE_TO_ZERO", "false");
    }

 @Override
 public void contextDestroyed(ServletContextEvent arg0) {
  // TODO Auto-generated method stub
  
 }

}

Tuesday, January 1, 2019

graphicupload :CKEditor plugin for image upload

Default CKEditor plugins allows files upload through a complicated and non intuitive dialog box.

graphic upload is a sample plugin which allow images upload  and insertion in CKEditor
Here is some printscreens



the plugin is available at
https://github.com/wassimjied/graphicupload

Monday, October 15, 2018

Display an address on a map without google api

Two months ago i discovered that Geocoding API of google allows 1 map display per day.
Now i'm on a project that needs to display an address marker on a map, since we are in developement phase, i'm not ready to pay 200$ to enable "up to 200$' use of google api.

Here is an alternative using nominatim and openstreetmap.
Long life to opensource.

Be careful, this code supposes that there is one lon,lat forsame address, then you must mention full address to get the waiting for result.


            




The map displayed at the end of the post is printed using the script above :) where mapdiv is an html div inside your page Be careful when importing jquery (do you have another import ? if you are using cms or already integrated temlplate) If you want to display many addresses you have to iterate through xml nodes print console.log(data); just after function(data, status){ .... to see the xml document returned ... If there is no places with the entered address, same thing you can guess it by reading the xml returned. thanks for reading !