Pages

Saturday, October 16, 2021

Reminder : undo git add command


Just to remember a simple command...

Add a file in order to be managed by GIT : 

git add filename

If you want to undo the git add command  :

git reset file

Friday, October 15, 2021

apt-get install php7.3-curl failed

 

I had a problem when installing the php7.3-curl dependency :

The package dependies was not satisfied :
 php7.3-curl : Depend: libcurl3 (>= 7.44.0) but not installable

In fact, the problem occurs because I forgot to change stretch to buster in my configuration :

 vi /etc/apt/sources.list.d/php7.3.list
deb https://packages.sury.org/php/ buster main


Then I restarted :

apt-get remove --auto-remove php7.3-curl
apt-get purge --auto-remove php7.3-curl
apt-get install php7.3-curl

Sunday, October 10, 2021

Reminder : install Docker

This a reminder to install Docker (20.10.8) on Debian 11 (Bullseye).


Get the key


 curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Add Docker in source list


echo \

  "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \

  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Install Docker


apt-get update
apt-get install docker-ce docker-ce-cli containerd.io


Final steps

It's better to add a Docker user :

useradd -m -s /bin/bash -G docker oscardocker
su - oscardocker

Test

You can execute the following command  : docker-compose up


Docker version 20.10.8, build 3967b7d


Saturday, October 2, 2021

Talend : call a JSON API with parameters

 


In my job, I need to call a JSON API every month.To achieve that, I made Talend jobs.

The first Talend job initializes parameters in context and launches a second jobs in charge of calling the API with theses parameters.


Load parameters


The first thing we need to do is to collect parameters for our JSON request. In order to use them, we stored these parameters into variables.This section will explain how we do.

Load parameters in context by using a tMap









First, we defined a variable with a key (TOKEN) and a value (row2.rnsr) by using a TMap component (MAPPING_PARAM1):




Then, the Talend  tContextLoad component (LOAD_CTX_PARAM1) will load this variable in context.


Load parameters in context by reading a file

An other useful way is to read a parameter file. I used this way to store a temporal authentication TOKEN :



In this job, we created a csv file; TOKEN.csv; that contains this line : TOKEN;123Then, we rode this variable with a tFileInputDelimited. Here is the component properties :

To finish, we made a link between  tFileInputDelimited (READ_TOKEN_FILE) and tContextLoad (LOAD_CTX) in order to load the variable in context.


Execute JSON CALL

We created a second job in order to call our JSON API (CO02_EXTRACT).

Note : 

  • In the job parameters don't forget to select "Transmit all context".
  • We used a tFlowToIterate because we have a list of parameters.





Here is the job responsible of the execution of the JSON call (CO02_EXTRACT) :
 

We checked theTOKEN_VALUE component in a tJAVA component (CHECK_CONTEXT_VALUE) :

String contextValue = context.TOKEN_VALUE;

context.synchronizeContext();

if (contextValue.equals("")){

System.out.println("ERROR : TOKEN doesn't exist anymore.See  TOKEN.csv");

System.exit(1);

}

Then we load all context values with a tContextDump (CTX_DUMP). 

The last step is to call the url. I used a tFileInputJSON component with URL and context parameters :



Version : Talend Open Studio Version: 7.3.1

Débutez en crypto-monnaie de manière ludique avec les projets "Move to earn"

Les projets "Move to earn" sont des projets très en vogue en ce moment dans le monde de la crypto-monnaie. Le principe est simple ...