Le cryptage MD5 est une forme de hachage relativement ancienne mais toujours bien pratique. On peut l'utiliser pour comparer des bases d'emails avec celles d'un prestataire sans fournir les données brutes par exemple. En vue d'un partenariat, d'un échange...

Attention nous ne parlons pas ici de réelle sécurisation. Le MD5 SQL - même salé ou doublé - est sujet à caution. Il ne s'agit que de permettre la transmission de données avec une relative tranquilité quant à un usage non-souhaité de ses fichiers. Parfois le partenaire qui vous transmettra ses données cryptées vous fera également signer un engagement de non-divulgation ou de non-utilisation frauduleuse (non-disclosure). Et si c'est vous qui transmettez les données (j'avoue ne jamais le faire...), pensez-y !

Quoiqu'il en soit il est courant de demander cela à un prestataire fournisseur (l'inverse est moins acceptable). Certes PhpMyAdmin permet nativement de saisir du texte puis de l'encrypter en MD5 (Insérer/Fonction/MD5). Mais pour mettre en place un worflow ou comparer des bases en lot, il est nécessaire de maîtriser la chose en SQL.

Quelques requêtes SQL d'exemple :

Voir le cryptage MD5 d'une chaîne

SELECT MD5(Cette adresse e-mail est protégée contre les robots spammeurs. Vous devez activer le JavaScript pour la visualiser.') ;

All living databases has its duplicates. Depending on their nature or number, it may be interesting to dedupe them quickly. For this goal SQL is our friend.

Below a simple example in order to describe the main concepts of the method. Then you will be able to do this in more complex situations. Because the final formula is a bit long, we will proceed iteratively, to understand the different steps.

python picture

Maybe each morning you have to open some softwares, websites or any apps before to start working.

For me: my professional email box (Outlook), my personnal email box (Gmail), my testing email boxes (Thunderbird, Yahoo ...), Teams, the official CRM of my company, the unofficial CRM of my company, the marketing tools of my company, my Google shortcuts ... Hum, tired in the morning!

Thanks to Python and his libraries os and webbrowser, we can save time and neurons. Just add the code below in a Python script:

import os
import webbrowser
 
os.startfile("outlook")
os.startfile("thunderbird")
 
webbrowser.open('https://hg-map.fr/')
 
os.startfile(r"C:\Users\Georges\Desktop\Communications\Gmail.lnk")
os.startfile(r"C:\Users\Georges\Desktop\Communications\Microsoft Teams.lnk")
os.startfile(r"C:\Users\Georges\Desktop\Communications\Yahoo.lnk")

Clicking into will open your favourite applications. Me I prefere store my scripts in a dedicated folder, and then add shortcuts on my desktop.

Maybe you should adapt the code according your OS and your apps subtilities. Here above for example, Outlook and Thunderbird are recognized by Python, and just need to mention their system names to the os library. A website need the webbrowser library, and the Google shortcuts need the os library but from their full paths.

 

Thanks to dog.ceo and its API, you can display a random beautiful dog in a website. Just add the code below in your PHP:

<img style="width: 100%;" src="<?php
$my_json = "https://dog.ceo/api/breeds/image/random" ;
$my_content = file_get_contents($my_json);
$my_content_dec = json_decode($my_content);
$url_img = $my_content_dec->message ;
print $url_img;
?>" alt="Oh my dog!" title="Oh my dog!">

 To restrict the joke to your users (more polite), just enclose the code with this kind of PHP condition.

<?php if ($user->id != 0): ?>
   ...
<?php endif; ?>

 In Joomla a perfect spot to put it: templates/your_template/index.php, into the <div id="aside" class="span3">.

Please let me know if you find other APIs like it!

When you have to import files as text, csv, etc ... into an SQL database, non-desired line breaks (often from notes fields, text boxes,  <BR> tags, tabs, or other misinterpreted HTML ...) are very painful. It may fail your import, or be a waste of time. Exploring one's file with Notepad is sometimes necessary.

Complete 4-step correction

How to effectively manage these line breaks?

In this standard example, we want to identify and fix lines that do not start with a double quote (caused by line breaks) within a file where healthy lines start with a double quote.

Django REST API 2Here some tips about Django REST Framework (DRF) with Django 3.

Official website

Quick install

> pip install djangorestframework

Then in settings.py:

INSTALLED_APPS = [
    ...
    'rest_framework',
]

Let's go!