Les expressions régulières (regex) sur Notepad++ sont très pratiques pour standardiser un fichier de données avant import par exemple, récupérer des données, corriger des chaînes particulières, avec des conditions, etc...

Ici quelques astuces propres à mon usage personnel.

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!

Exemple d'interface cartographiqueFabrik est une (excellente) extension gratuite et open-source disponible sur Joomla, et permettant de construire des applications de bases de données. Un article présentant globalement le CCK Fabrik est déjà disponible sur ce site.

L'article ci-dessous est plus détaillé, et regroupe une série de pratiques courantes ou avancées, mais peu documentées en français. L'article reprend aussi des fonctionnalités PHP classiques mais ici adaptées à l'API Joomla.

Bien sûr cette page n'a rien d'exhaustif, et ne pourrait exister sans le forum Fabrik. Merci encore à toute l'équipe Fabrik et au projet Joomla. Et non, je ne travaille pas pour eux.