martedì 30 aprile 2024

Fail Fast

Learn/React Faster

Do it Better

martedì 10 gennaio 2023

Linux permission with WINSCP

 I find frustrating the way linux manage permissions and how to grant a folder permissions to upload file with winscp.


Now the best way I find to do that is:

1. create a group for a project folder and add users to it (this is not mandatory but a good way to work)

$ groupadd <group>

$ usermod -a -G <user> <group>

2. assign permission to folder to grant upload to ftp/winscp:

$ chmod o+rwx -R workfolder/  #This assign "others" rights to rwx, could be harmful in case of web application, be carefull!

$ chmod g+rwx -R workfolder/ #grant write to group

 

venerdì 26 agosto 2022

New goal

 I know is just a small step but to me looks like a goal.

First container running and working.



venerdì 19 agosto 2022

Grep Recursive

 Command to recursively search into file with grep:

grep --include="*.prop*" -nRHI "<text>" * > filename.txt


martedì 15 marzo 2022

Change ngnix area pwd

How to change a password for user on a secured area proxied by ngnix:

sudo htpasswd /etc/nginx/.htpasswd

giovedì 8 luglio 2021

Pensione

 Nell'azienda dove lavor ci sono diverse persone in Pensione che lavorano ancora come consulenti.

La cosa non sarebbe grave se non si lamentassero per ogni cosa e se non pretendessero dall'azienda gli stessi servizi di quando erano dipendenti.


Gli abbiamo proposto di fare cambio: lui al lavoro e noi a casa con la sua pensione ma stranamente dicono no, è meglio la pensione...... Ma allora vai a casa lascia il posto a qualcuno !


mercoledì 7 aprile 2021

EC2 Enable awslogsd

 list enabled service :

systemctl list-unit-files


enable awslogsd:

sudo systemctl enable awslogsd

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...

mercoledì 10 giugno 2020

mercoledì 27 maggio 2020

Creating a java app to render crystal report I encountered this excecption

 com.sun.media.imageioimpl.plugins.jpeg.CLibJPEGImageReaderSpi
 could not be instantiated

The problem is caused by vendorName == null exception

To resolve the issue edit the manifest file produced by eclipse and add these lines: 
Manifest-Version: 1.0
Class-Path: .
Main-Class: com.pacorini.crystal.Starter
Implementation-Vendor: Sun Microsystems, Inc
Implementation-Title: Java Runtime Environment
Implementation-Version: 1.8.0.191

martedì 5 maggio 2020

Come attivare git su un progetto eclipse esistente Git/Code commit

Non so chi ha scritto il codice dell'integrazione tra Eclipse e Git ma secondo me ha dimenticato di aggiungere qualche feature indispensabile.

Sarà capitato anche a voi di scrivere un progetto e poi decidere di salvarlo su git o quantomeno di gestire il versioning.
Fino a qui sembra semplice ma quando si attiva la sicronizzazione git vuole per forza creare un repository in una directory diversa da quella del progetto dove poi trasferisce il vostro codice.
E questa è una dei motivi per cui continuo a preferire SVN rispetto a Git. SVN sembra però essere un po' morto a differenza di Git.
Nel mio team pertanto abbiamo deciso di utilizzare un repository comune online (non github) sul quale scaricare il nostro codice.

Il punto è che ho un sacco di codice che vorrei caricare senza dover stravolgere i miei workspace.

Dopo svariati tentativi non sono riuscito a trovare una funzione in eclipse che mi permetta di collegare un progetto esistene a un repository remoto.
Mi ha salvato una serie di comandi da shell:
1. entrare nella folder del progetto che si desidera sincronizzare
2. abilitare la cartella a git con: git init
3. aggiungere il contenuto con: git add .
4. aggiungere un commento: git commit -m "Initial commit"
5. eseguire il commit del progetto con: git push -all

A questo punto aprire eclipse (se è aperto chiudere e riaprire il progetto) e sarà sincronizzato con il vostro code repository !!


Se qualcuno avesse le istruzioni visuali si senta libero di aggiungerle nei commenti. Se vi è stato utile lasciate un commento!

sabato 30 novembre 2019

La mia ricetta dei tortellini



Carne bovina polpa di vitello 70 gr
Lonza di maiale 70 g
Prosciutto crudo Parma 80 g
Mortadella di Bologna 80 g
Parmigiano Reggiano DOP da grattugiare 150 g
Burro 20 g
Uova grande 1
Noce moscata da grattugiare q.b.
Sale fino q.b.
Pepe nero q.b.

venerdì 8 novembre 2019

Linux: avoid strange characters in dialog

Add this to user:
export NCURSES_NO_UTF8_ACS=1

mercoledì 25 settembre 2019

Linux execute at boot

The common mistake running a script @reboot using crontab is that the script is execute immediately after system is up so network service is not started yet.

a workaround is:
#execute call home at boot
@reboot         root    sleep 120; /devcomm/startup.sh > /devcomm/logs/cronlog 2>&1'








the script itself:

#!/bin/bash
#startup application
cd /devcomm
/usr/bin/python3 call1.py
/usr/bin/python3 call2.py