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.

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.

MS Access is enought supported, so I would list only specific cases which took me more than 1 minute to solve.

Get the first letter from each word in upper case in a query

Get the first letter from each word in upper case and the remaining in lower case is easy with Excel (=PROPER), but with Access I searched for a long time ...

StrConv([field],3)

Get HTML from plain text in a query

Recover plain text from rich text in an Access query is easy (PlainText([field]), but the opposite is not!

Here an example to get the main HTML chars (not all!) from a field named First name:

firstname: Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace([First name],"è","è"),"ú","ú"),"í","í"),"ć","ć"),"á","á"),"é","é"),"ö","ö"),"ç","ç"),"ş","ş"),"ü","ü"),"ó","ó"),"ñ","ñ"),"ë","ë"),"æ","æ"),"à","à"),"ã","ã")

I know, I should use VBA ... Later!

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!