mercoledì 24 marzo 2021

Set date time in Centos

 Install ntp client


yum install ntpdate

modify /etc/ntp/step-tickers adding all the ntp server needed


ntpdate <ip_ntp_server>   -> ntpdate 0.it.pool.ntp.org

systemctl restart ntpdate

systemctl enable ntpdate


check time with timedatctl


change timezone:

timedatectl list-timezones
sudo timedatectl set-timezone your_time_zone


mercoledì 10 febbraio 2021

Final command to install Pyodbc on AWS EC2 AMI

sudo yum install gcc-c++

sudo yum install python3-devel

sudo yum install unixODBC-devel

sudo pip3 install pyodbc


These are the correct commands to install Pyodbc on AWS linux ami, note that is intended to install on a machine with both python2 and 3.

if you have only one version pip3 should become pip and


lunedì 16 novembre 2020

Java image rendering and Crystal report Error the definitive guide !

I've be working for a while into a Crystal report Java project.

The aim is to generate in background and email PDF files produced by Crystal report document, I built two projects on that one that generate over a http call the desired document and the second that runs every n minutes lookup the lines in a table and produce the related documents.

Everything works quite well in Eclipse but when you move in production on a linux machine there's come the rain.

The first error in the stack comes with these lines:

 javax.imageio.spi.ImageReaderSpi: Provider com.sun.media.imageioimpl.plugins.jpeg.CLibJPEGImageReaderSpi could not be instantiated
        at java.util.ServiceLoader.fail(Unknown Source)
        at java.util.ServiceLoader.access$100(Unknown Source)
        at java.util.ServiceLoader$LazyIterator.nextService(Unknown Source)
        at java.util.ServiceLoader$LazyIterator.next(Unknown Source)
        at java.util.ServiceLoader$1.next(Unknown Source)
        at javax.imageio.spi.IIORegistry.registerApplicationClasspathSpis(Unknown Source)


So i'm started struggling to find if there's a missing library or not trying to repack the jar in different ways without success.

 After a day (or more) spent and a very big headache, I scrolled down the log... saying to myself in case there's some other interesting information....  and taac here's the trick, the root cause is java.lang.IllegalArgumentException: vendorName == null!

  Caused by: java.lang.IllegalArgumentException: vendorName == null!
 
       at javax.imageio.spi.IIOServiceProvider.<init>(Unknown Source)
        at javax.imageio.spi.ImageReaderWriterSpi.<init>(Unknown Source)
        at javax.imageio.spi.ImageReaderSpi.<init>(Unknown Source)
        at com.sun.media.imageioimpl.plugins.jpeg.CLibJPEGImageReaderSpi.<init>(CLibJPEGImageReaderSpi.java:80)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at java.lang.Class.newInstance(Unknown Source)
        ... 99 more

This type of error handling is one of the thing that makes me hate java but on the other hand, i still love it, not easy language to learn but very powerfull and clean!


So, googling a bit I found some useful tips: https://stackoverflow.com/questions/7051603/jai-vendorname-null

https://thierrywasyl.wordpress.com/2009/07/24/jai-how-to-solve-vendorname-null-exception/

The solution is to add these lines in a manifest.mf file after the jar is produced, put that in the META-INF directory

Implementation-Vendor: Sun Microsystems, Inc
Implementation-Title: Java Runtime Environment
Implementation-Version: 1.6.0

 


mercoledì 29 luglio 2020

License needed for teams at today

Teams Connection error 4c7

recently I had a connection error on Teams for a user not yet migrated to 365.
user can't connect to portal.office.com nor to teams.

Root cause was that on premise the mailbox was shared since it was used both by a manager and a secretary.

when mailbox has been recovered to normal login to office immediately worked.

Desktop Teams application was still fiailing. Issue was the SSO, so modified that file :

%AppData%\Roaming\Microsoft\Teams\settings.json
"enableSso":true/false



mercoledì 1 luglio 2020

Regular expression to find digit in a string

>>> import re
>>> re.findall(r'\d+', 'hello 42 I\'m a 32 string 30')
['42', '32', '30']

If you only want numbers delimited by word boundaries (space, period, comma), you can use \b :
>>> re.findall(r'\b\d+\b', 'he33llo 42 I\'m a 32 string 30')
['42', '32', '30']
 

lunedì 22 giugno 2020

Words

The way she has it worded has me a little confused...