vendredi 21 août 2026

Problème de zoom dans inkscape v 1.4.3 MacosX

Pour Inkscape 1.4.3 sous macOS, lorsque les SVG s'ouvrent à un zoom minuscule, la solution qui a fonctionné est  dans les Préférences Interfaces > Fenêtres « Taille de la fenêtre par défaut : Grande » (et non « Maximisé »), puis dans Divers, cocher « Zoomer quand la fenêtre est redimensionnée ».

vendredi 9 janvier 2026

Generate tex file from docx

Install Inkscape 

https://inkscape.org/

and then in .zshrc, add

export PATH="/Applications/Inkscape.app/Contents/MacOS/:$PATH"

Test if Inkscape can be launched from terminal:

Inkscape -V

Now, after installing pandoc https://pandoc.org/installing.html, you can convert a docx file into tex:

pandoc -s Final.docx -o Final.tex --extract-media=

It will create a media folder with the figures.

Pandoc does not automatically preserve mixed page orientations (landscape/portrait sections) from DOCX to LaTeX, as it lacks direct support for DOCX section properties.

Edit the generated .tex file manually: Add \usepackage{pdflscape} to the preamble, then wrap landscape sections with \begin{landscape}...\end{landscape} around tables or content matching the original DOCX. For global landscape, use \documentclass[landscape]{article}.

The complex tables are not well handed by pandoc. You can generate tables separately:

https://www.tablesgenerator.com/

To test your tex file, you can convert them into pdf using pdflatex installed with mactex:

http://www.tug.org/mactex/

pdflatex --shell-escape Final.tex

vendredi 26 septembre 2025

Reindex or rebuild spotlight in MacOSX Tahoe

Test if spotlight is enabled:

√ ~ % mdutil -sa
/:
Indexing enabled. 
/System/Volumes/Data:
Indexing enabled. 
/System/Volumes/Preboot:
Indexing enabled. 

If it is disabled rather than enabled, the first solution is to try to enable it:

1- In the Terminal, type and run the command: sudo -i.
2- Enter your administrator password and press Return.
3- Continue to run the commands mdutil -Ea and mdutil -ai off.
4- Enter the command mdutil -ai on and press Return, and you will see a message saying that indexing is enabled.

Second solution if the first one does not work:

sudo mdutil -ai off
sudo pkill -f mds
sudo pkill -f mdworker
sudo rm -rf /System/Volumes/Data/.Spotlight-V100
sudo rm -rf /.Spotlight-V100

Restart the Mac - This step is crucial
After reboot, enter in terminal :
sudo mdutil -ai on
Force a complete reindexation :
sudo mdutil -E /
sudo mdutil -E /System/Volumes/Data

Test if it works :
mdfind "kMDItemContentType == 'com.apple.application-bundle'" | head -5

Indexing takes a few hours to finish completely, but you’ll see the apps and recent files right away.

Based on 

https://www.reddit.com/r/MacOSBeta/comments/1mob0co/solved_macos_tahoe_public_beta_1_spotlight/?tl=fr

mercredi 24 juillet 2024

python3.11 still required when python3.12 is installed

 If you try to use pip while you have up-to-date python version 3.12 installed, you will get this error:

zsh: /opt/homebrew/bin/pip: bad interpreter: /opt/homebrew/opt/python@3.11/bin/python3.11: no such file or directory

If you are using pip3, it works.

The only solution until now is to install python 3.11. But it is pity to downgrad python:

% brew install python@3.11

I don't know what to do...

lundi 15 juillet 2024

tess software

 To install tessm on a Ubuntu x86 from http://membres-timc.imag.fr/Olivier.Francois/tess.html

# Install ChartDir
cd /usr/local
wget https://www.advsofteng.net/chartdir_cpp_linux_64.tar.gz
tar xzf chartdir_cpp_linux_64.tar.gz
rm chartdir_cpp_linux_64.tar.gz

Verify that GSL is installed using
gsl-config --libs
It will return
-L/usr/lib/x86_64-linux-gnu -lgsl -lgslcblas -lm

Install tessm:
cd $HOME
wget http://membres-timc.imag.fr/Olivier.Francois/tessm-2.3.1.tar.gz
tar xzf tessm-2.3.1.tar.gz 
cd tessm-2.3.1/
./configure CPPFLAGS="-I/usr/local/include -I/usr/local/ChartDirector/include" LDFLAGS="-L/usr/local/lib -L/usr/local/ChartDirector/lib"
Edit Voronoi.cpp and PlotUtilities.cpp:
Replace all
([\( ])Transparent
with 
\1Chart::Transparent
And 
([\( ])LineColor
with 
\1Chart::LineColor

make

Add in .profile
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/ChartDirector/lib
alias tessm=$HOME/tessm-2.3.1/tessm

logout and login and enter
tessm

###########################
cd $HOME
wget http://membres-timc.imag.fr/Olivier.Francois/tessmAdmBYM-2.3.1.tar.gz
tar xzf tessmAdmBYM-2.3.1.tar.gz
rm tessmAdmBYM-2.3.1.tar.gz
cd tessmAdmBYM-2.3.1/
./configure CPPFLAGS="-I/usr/local/include -I/usr/local/ChartDirector/include" LDFLAGS="-L/usr/local/lib -L/usr/local/ChartDirector/lib"

Edit Voronoi.cpp and PlotUtilities.cpp:
Replace all
([\( ])Transparent
with 
\1Chart::Transparent
And 
([\( ])LineColor
with 
\1Chart::LineColor

In vi:

:%s/ Transparent/ Chart::Transparent/g
:%s/(Transparent/(Chart::Transparent/g
:%s/ LineColor/ Chart:: LineColor/g
:%s/(LineColor/(Chart:: LineColor/g

make

Add in .profile
alias tessm=$HOME/tessm-2.3.1/tessm
alias tessmAdmBYM=$HOME/tessmAdmBYM-2.3.1/tessmAdmBYM

logout and login and enter
tessmAdmBYM

###########################
cd $HOME
wget http://membres-timc.imag.fr/Olivier.Francois/tessmAdmCAR-2.3.1.tar.gz
tar xzf tessmAdmCAR-2.3.1.tar.gz
rm tessmAdmCAR-2.3.1.tar.gz
cd tessmAdmCAR-2.3.1/

./configure CPPFLAGS="-I/usr/local/include -I/usr/local/ChartDirector/include" LDFLAGS="-L/usr/local/lib -L/usr/local/ChartDirector/lib"

Edit Voronoi.cpp and PlotUtilities.cpp:
Replace all
([\( ])Transparent
with 
\1Chart::Transparent
And 
([\( ])LineColor
with 
\1Chart::LineColor

make

Add in the .profile
alias tessmAdmCAR=$HOME/tessmAdmCAR-2.3.1/tessmAdmCAR

logout and login and enter
tessmAdmCAR

vendredi 12 juillet 2024

Patron de votes au premier et second tour de l'élection présidentielle sur un bureau de vote à Chaville en 2022

 Dans la publication 

Girondot, M. Nouvelle méthodologie d’analyse bayésienne du report des voix et de l’abstention lors du deuxième tour des élections. Comptes Rendus Mathématique 2023, 361, 243-256, doi:10.5802/crmath.401.

je note:

"Le plus gros problème concerne la capacité à limiter la possibilité pour le modèle à trop bien expliquer les données en affectant sur les abstentions des premiers et seconds tours, des votes à l’autre tour. En effet, dans les cas où le nombre d’abstentions est important, la meilleure solution numérique consiste à postuler que les abstentionnistes du premier tour ne sont pas les mêmes que ceux du deuxième. Bien que valide d’un point de vue numérique, cette solution n’est pas satisfaisante car une forte proportion des abstentionnistes du premier tour seront aussi des abstentionnistes au second tour. Il est aisé d’évaluer cette proportion en comparant les signatures sur les listes d’émargement dans les bureaux de votes au premier et second tour. On peut alors dénombrer les électeurs inscrits aux deux tours et ayant voté à l’un ou à l’autre des tours. Cette valeur peut alors être utilisée pour contraindre le modèle qui fournira des estimations plus plausibles du comportement de vote des électeurs comme nous l’avons vu précédemment. Si cette valeur ne peut pas être obtenue (voir la partie discussion en ce qui concerne la possibilité légale d’obtenir l’accès aux registres d’émargement), on est obligé de choisir une gamme de valeurs, par exemple 85 %, 89 %, 90 %, 91 % et 95 %, correspondant à la probabilité qu’un électeur n’ayant pas voté au premier tour n’ait pas voté non plus au second."

J'ai pu établir cette proportion dans un cas particulier, l'élection présidentielle en France en 2022 à Chaville, bureau 2.

Il y avait 1008 électeurs inscrits.

Premier tour: 

N1=840 votants et A1=168 abstentions (16% d'abstention)

Il est important de noter que ici ce sont tous les votants incluant les blancs et les nuls contrairement à ce qui est montré ici: https://www.ville-chaville.fr/fileadmin/documents/1.Actualites_et_Evenements/Actualites/Citoyennete_Solidarite/Election_presidentielle_2022/Election_presidentielle_Chaville_2022_premier_tour_synthese.pdf

Second tour:

N2=792 votants et A2=216 abstentions (21% d'abstention)

Sur la base de la liste d'émargements:

Le nombre d'électeurs ayant voté au premier tour et pas au second est de N10 = 88.

Le nombre d'électeurs ayant voté au second tour et pas au premier est de N02 = 40.

On appelle N12 le nombre d'électeurs ayant voté aux deux tours, N10 ceux ayant voté seulement au premier, N02 ceux ayant voté seulement au second et N00 ceux s'étant abstenus aux deux tours, on a les relations suivantes (en gras, les valeurs connues):

N1 = N12 + N10

A1 = N00 + N02

N2 = N12 + N02

A2 = N00 + N10

N1 + A1 = N2 + A2 = 1008

On a donc :

N12 = N1 - N10 =  840 - 88 = 752

N12 = N2 - N02 =  792 - 40 = 752

et

A2 = N00 + N10

d'où N00 = A2 - N10 = 216 - 88 = 128

A1 = N00 + N02

d'où N00 = A1 - N02 = 168 - 40 = 128

Avec ça on peut calculer toutes les probabilités qu'on veut et notamment pour "le pourcentage d’électeurs n’ayant pas voté au second tour qui n’avaient pas voté au premier tour non plus." dont on a besoin soit:

N00 / (N00 + N10) = N00 / A1 = 128 / (128 + 88) = 0,59

Donc 59% des électeurs qui n'ont pas voté au premier tour n'ont pas voté non plus au second tour. Finalement, parmi les abstentionnistes il n'y a que 13% qui n'ont pas voté ni au premier ni au second donc des "vrais" abstentionnistes.


vendredi 12 avril 2024

Stop auto-upgrade in Ubuntu

 The simplest way to do this would be to disable every auto-upgrade. Here's how you can do it on Ubuntu 18.04 and 20.04:

  1. Open Terminal (if this is an Ubuntu Server installation, just SSH into the thing)
  2. Edit Apt's 20auto-upgrades file to disable everything:
sudo vi /etc/apt/apt.conf.d/20auto-upgrades
  1. Ensure everything is set to 0. If done correctly, you'll have a file that looks like this:
APT::Periodic::Update-Package-Lists "0";
APT::Periodic::Download-Upgradeable-Packages "0";
APT::Periodic::AutocleanInterval "0";
APT::Periodic::Unattended-Upgrade "0";

mardi 5 mars 2024

Poppler-qt5

I don't know in which case I should use this information

_________

poppler-qt5 is keg-only, which means it was not symlinked into /opt/homebrew,

because it conflicts with poppler.


If you need to have poppler-qt5 first in your PATH, run:

  echo 'export PATH="/opt/homebrew/opt/poppler-qt5/bin:$PATH"' >> ~/.zshrc


For compilers to find poppler-qt5 you may need to set:

  export LDFLAGS="-L/opt/homebrew/opt/poppler-qt5/lib"

  export CPPFLAGS="-I/opt/homebrew/opt/poppler-qt5/include"


For pkg-config to find poppler-qt5 you may need to set:

  export PKG_CONFIG_PATH="/opt/homebrew/opt/poppler-qt5/lib/pkgconfig"

  export PKG_CONFIG_PATH="/opt/homebrew/opt/poppler-qt5/share/pkgconfig"


mercredi 28 février 2024

Mapping keyboard in Ubuntu

mgirond@emys:/etc$ localectl list-keymaps
Failed to read list of keymaps: No such file or directory
mgirond@emys:/etc$ localectl
   System Locale: LANG=fr_FR.UTF-8
       VC Keymap: n/a
      X11 Layout: us
       X11 Model: pc105
wget https://mirrors.edge.kernel.org/pub/linux/utils/kbd/kbd-2.6.4.tar.gz -O /tmp/kbd-2.6.4.tar.gz
cd /tmp/ && tar xzf kbd-2.6.4.tar.gz
sudo mkdir /usr/share/keymaps/
sudo cp -Rp /tmp/kbd-2.6.4/data/keymaps/* /usr/share/keymaps/
localectl list-keymaps | grep -i fr
localectl set-keymap mac-fr-legacy
mgirond@emys:/tmp$ localectl status
   System Locale: LANG=fr_FR.UTF-8
       VC Keymap: mac-fr-legacy
      X11 Layout: us
       X11 Model: pc105

Other solution: List of available keyboard is
cat /usr/share/X11/xkb/rules/base.lst

cd /etc/default/
sudo nano keyboard
and change 
XKBLAYOUT="us"
to (or something else !)

XKBLAYOUT="fr"

Note that the mapping is not perfect with Mac keyboard; you can use option + ascii number to get the missing characters


To take into account the change
setupcon -k


mardi 20 février 2024

Force running update in Ubuntu in noninteractive mode

 Or do 

sudo dpkg-reconfigure debconf --frontend=noninteractive

or

export DEBIAN_FRONTEND=noninteractive

or 

sudo DEBIAN_FRONTEND=noninteractive apt-get -y -q update

-y, --yes, --assume-yes

Automatic yes to prompts. Assume "yes" as answer to all prompts and run non-interactively. If an undesirable situation, such as changing a held package or removing an essential package, occurs then apt-get will abort.

-q, --quiet

Quiet. Produces output suitable for logging, omitting progress indicators.

Another solution

sudo vi /etc/needrestart/needrestart.conf

And change #$nrconf{restart} = 'i';

to 

$nrconf{restart} = 'a';


mercredi 21 juin 2023

Bad permission in sudoers files prevents to connect or use sudo

# If you have this message:

sudo: /etc/sudoers.d/rules is world writable

# connect in root 

su

# Then do

chmod 0755 /etc/sudoers.d/rules


To create a root password, do:

sudo passwd root

jeudi 1 juin 2023

Do not show a volume in finder (MacOSX)

 From https://www.idownloadblog.com/2016/12/02/how-to-hide-mounted-volumes-from-desktop-finder/


1) Ensure the volume that you want to hide is mounted and visible in the Finder, desktop, or Disk Utility.

2) Make a note of the chosen name of your volume, for example, Time Machine or Storage.

3) Launch Terminal and type the following command, replacing “Drive Name” with the name of your own volume, which you noted earlier (keep the quote marks):

sudo SetFile -a V /Volumes/"Drive Name"

4) Enter your password when prompted.

Note: Install command line developer tools if you’re prompted to do that.

5) In terminal: killall Finder

To revert :

sudo SetFile -a v /Volumes/"Drive Name"
killall Finder

lundi 3 avril 2023

Search a text within the file content in Unix and R

 In UNIX:

grep -rnw '.' -e 'texttosearch'

To search within the current directory '.' or 'path" to search in the path.
The options
-r means "recursive"
-e is the pattern to search for
-n Each output line is preceded by its relative line number in the file, starting at line 1.
-w The expression is searched for as a word (as if surrounded by ‘[[:<:]]’ and ‘[[:>:]]

Do not hesitate to do a man grep to see the dozens of options!


In R, a equivalent using "brut force" (without recursive option) is found in the package HelpersMG (https://CRAN.R-project.org/package=HelpersMG) :
inside(
  text = stop("A text to be searched for is necessary"),
  path = ".",
  pattern = "*\\.R$",
  showallfilenames = FALSE,
  ...,
  fixed = TRUE,
  ignore.case = FALSE
)

dimanche 26 mars 2023

Indistinguishable Objects to Distinguishable Boxes

# Indistinguishable Objects to Distinguishable Boxes

# The number of different ways to distribute Nballs indistinguishable balls into

# Nboxes distinguishable boxes is C(Nboxes+Nboxes-1,Nboxes-1).

# For example, 5 balls into 3 boxes can be done in these C(7,2) = 21 ways:


# Number of balls

Nballs <- 10

# Number of boxes

Nboxes <- 3


# The number of different ways to distribute n indistinguishable balls into

# k distinguishable boxes is C(n+k-1,k-1).

# nb<-choose(N+nbjour-1,nbjour-1)=dim(tb)[1]

# divers<-matrix(rep(0, nbjour*nb), ncol=nbjour)


# generate all possible positions of the boundaries

xx <- combn(Nballs+Nboxes-1, Nboxes-1)

# compute the number of balls in each box

a <- cbind(0, diag(Nboxes)) - cbind(diag(Nboxes), 0)

tb <- t(a %*% rbind(0, xx, Nballs+Nboxes) - 1)



mercredi 22 mars 2023

Install spymicmac on Ubuntu 22.04 with Anaconda3 installed

 Software micmac can be found here:

https://spymicmac.readthedocs.io/en/v0.1.1/setup.html

When installation was tried using the setup from this page, an error was throwing in relation with qt5. It seems that there was a mistake with Anaconda qt5 installation.

The solution has been to find the directory of installation of qt5 using:

locate /qt5/plugins/

In our case, it was:

/usr/lib/x86_64-linux-gnu/qt5/plugins

Then, rather than doing:

cmake .. -DWITH_QT5=1 -DWERROR=0 -DWITH_CCACHE=OFF

as indicated in the spymicmac documentation, use:

cmake .. -DWITH_QT5=1 -DWERROR=0 -DWITH_CCACHE=OFF -DCMAKE_PREFIX_PATH=/usr/lib/x86_64-linux-gnu/qt5/plugins



samedi 1 octobre 2022

Uninstall iSCSI Initiator X

 The method to uninstall iSCSI Initiator X in the web site of the editor is wrong:

https://www.kernsafe.com/help.aspx?product=iSCSI%20Initiator%20X&topic=macos-iscsi-initiator-uninstallation

use rather:

sudo rm -rf /Library/KernSafe

sudo rm -rf /Library/KernSafe-iSCSI-Initiator-X-3.20

sudo rm -rf /Applications/"iSCSI Initiator X.app"

sudo rm -rf /Library/LaunchDaemons/com.kernsafe.initiator.x.plist

And restart


jeudi 1 septembre 2022

prevent apt to stop updates in Ubuntu 22.04

 In Ubuntu 22.04, the needrestart command, which is part of the apt-get upgrade process in Ubuntu, by default this is set to "interactive" mode which causes the interruption of scripts.

To change this behavior, we can edit the /etc/needrestart/needrestart.conf file, changing the line:

#$nrconf{restart} = 'i';

to

$nrconf{restart} = 'a'; (if we want to restart the services automatically) or $nrconf{restart} = 'l'; to simply list the services that need restart.

Another trick:

To disable "Pending kernel upgrade" via command line:

sudo vim /etc/needrestart/needrestart.conf

then uncomment this line

#$nrconf{kernelhints} = -1;

jeudi 18 août 2022

sudo reports an error

 Check that your hostname is well declared in /etc/hosts:

mgirond@pepa:~$ hostname

xxxx

mgirond@pepa:~$ cat /etc/hosts

127.0.0.1 localhost

127.0.0.1 xxxx


# The following lines are desirable for IPv6 capable hosts

::1 ip6-localhost ip6-loopback

fe00::0 ip6-localnet

ff00::0 ip6-mcastprefix

ff02::1 ip6-allnodes

ff02::2 ip6-allrouters

ff02::3 ip6-allhosts

vendredi 29 juillet 2022