2020-05-16

customize color palette in LibreOffice


You can create a your own palette file,

  •  with .soc extension
  •  and with a content like the following:
<?xml version="1.0" encoding="UTF-8"?>
<ooo:color-table xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ooo="http://openoffice.org/2004/office">
<draw:color draw:name="panna" draw:color="#faf7d2"/>
<draw:color draw:name="mattone" draw:color="#bc5a1f"/>
<draw:color draw:name="OldLace" draw:color="#FDF5E6"/>
<draw:color draw:name="Cornsilk" draw:color="#FFF8DC"/>
</ooo:color-table>
  •  then you have to put it (also as symlink) in /libreoffice/share/palette.

You will be able to choose that palette (with the same name of the file .soc), and you will be able to use your preferred colors highlighting words in LibreWriter, for example.

2020-05-14

choose the browser to open a given link with


In Thunderbird you can use the “Open With Options” add-on, which let you choose with what browser you want open a given link in a given e-mail.

You can add new browsers as well, in a very easy way.

2020-05-13

How avoid https problems in localhost

Since a solution to force browsers toward a secured connection (with https and not http) is using an .htaccess file in the root folder, you can avoid many problems with https in localhost with this code, which you can put into the .htaccess, before the last row:

RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]{3}$

So your .htacces file should contain these rows

RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteCond %{HTTP_HOST} ^[^.]+.[^.]{3}$
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

This way you will have, with the same file, in local an http connection, and in remore an https connection.

2020-05-08

convert an InnoDB database to MyIsam

The problem of Innodb is that you can’t copy the database tables from a PC to another or from localhost to an online website, because of the file “ibdata1”, which is out of the tables folder.

So I think that the best solution, if you need to sync your database between different locations, is to convert Innodb tables into MyIsam tables, which can be copied without problems.

Unfortunately I didn’t find a way to convert a whole database with a single mysql command, but I had to convert each table, with this code:

ALTER TABLE table_name ENGINE=MyISAM.

But at the end the result was any way good.

2020-04-27

css how to expand an element to the whole web page

It could be not enough to set the height to 100%, or 100vw, you could try with
position: relative; height: auto; min-height: 100% !important;
It worked for me(cfr here)

w3c validation UTF-8 encoding error

With w3c validator you could get this error:
«Sorry, I am unable to validate this document because on line 3400 it contained one or more bytes that I cannot interpret as utf-8 (in other words, the bytes found are not valid values in the specified Character Encoding). Please check both the content of the file and the character encoding indication.» 
That could be because you have some files included in the php file checked by w3c validator, like an .inc one, not encodeed as UTF-8.
To fix this oproblem you have to encode all the components of a php file as UTF-8.

2020-04-21

search and replace in a mysql table

This is the code:

UPDATE `table_name`
SET `field_name` = replace(field_name, 'old_text', 'new_text')

2020-04-20

how to avoid #1265 error changing a value in a table structure

That is avoiding "data truncated" error. You must avoid to replace a value in use.
The right way, if a given value is already applied to some items, is
  1. to add the new value (supposed similar to the old) to the table structure
  2. search for all the items with old value
  3. replace in each item the old value with the new one
  4. delete the old value in the table structure

2020-04-13

batch change encoding to UTF-8 for several text (php) files

You can use recode
recode UTF-8 *.php -v
provided that all the files have the same encoding.
Otherwise you can try with something like
iconv -f US-ASCII -t UTF-8 *.php

a minor problem

It could be an apparent problem if there aren't non-ascii characters in a file: then these files are yet recognized, with
file -i --mime-encoding *
as us-ascii.
So you can add a non ascii character, like è:
sed -i -e "\$aè" *.php
and afterwards redo the command "recode" as above and replace some ascii expression, like agrave; with UFT-8 à character.
Eventually you will delete the "è" from the end of the files.

How to change encodig of ".srt" Subtitle File in UTF-8


To encode your SRT file in UTF-8 (for instance: "video.srt"), please follow this process:

1. Rename (F2) the "video.srt" file with your PC in "video.srt.txt".
2. Launch a text app, like Kate.
3. Click on the "File" menu then select "Save the file as...".
4. In coding option, select "UTF-8". Then save your file.
5. Rename (F2) the file "video.srt.txt" to "video.srt".
Done!

from: Zappiti Player 4K [EN]

svg editor

Inkscape is in my opinion too complicated (and Sodipodi very difficult to install, because of its dipendecies), a very interesting project is SVG-edit, at https://github.com/SVG-Edit/svgedit.
Without any installation on your PC, you can edit on-line your svg files. The resulting code is very clean, even though we have found some problem in setting colors.

permission denied

If you get rhis error message even you have all the rights, probably you are trying to run the command on a mounted partition that had the "noexec" flag on.
So change partition, .f.e. try your /home.

2020-04-11

tag object in firefox

It's probably a bug, but you couldn't manage to view an svg object tag with firefox, unless is setted as image/svg (and not a text/svg).

2020-04-09

amule: how get an "almost" high-ID

If you can't get a real high-ID with aMule you can try this trick (in an executable bash script):

#!/bin/sh

while :; do
   amule &     # run in background
   sleep 240
   killall amule
      # or   wmctrl -c aMule
   wait         # in case amule needs time to close
done
This script close aMule after 240 sec, and then restart aMule, indefinitely, so that his speed remains acceptably high.

2020-04-03

mysql wrong autoincrement number

It can happen that the ID autoincrement goes wrong; in this case my solution is very simple: I delete the ID column, and afterwards I re-create it (with the same parametres). It works.

ancient greek in LibreOffice

Some days ago I wrote this:

a simple maquillage, unfortunately

I mean ancient greek font so that you can, typing 'a' get immediatly 'α'. So far the free most interesting true type font (the only recognised by LibreOffice) is SPIonic.
You can see more details here.
With this font you can tranform the word "Nomos" in "Nomov", with few mouse clics (basically with the font menu, even though in this case you have to convert the final sigma as well).

caveat

Absolutely to avoid the "AncientGreek" extension: cumbersome, useless and very aggressive (after removing leaves you with modified shortcuts, including some basic like ctrl + z, ctrl + b and F3).Vey bad!

 a new solution

I noticed that the above solution works only within LibreOffice: if you copy a greek word in another program, you get a no-greek text (with latin encoding). That's why I call it now a maquillage.
A possible, better solution is go to a website that easyly encode your text in ancient greek, such as this.

keeping updated your custom css (in Calibre viewer or in markdown-viewer browser extension)

You can link within the css (in Calibre it is within the file "viewer-webengine.json", in markdown-viewer browser extension is the css file you yourself have chosen) your external css file, with something like
 @import url(http://localhost/path-to-your-css-file/your-css-file.css)
Provided you have a apache/php server in localhost, of course.

2020-04-01

mysql change column encoding

You can use this syntax (to change encoding a TEXT column to utf8):
ALTER TABLE name-of-the-table MODIFY name-of-the-column TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci

2020-03-23

linux. how to get images from a (short) video

You can use this code:

ffmpeg -i [nameofthevideo] -r 10 -f image2 image-%3d.jpeg

where 10 after -r is the number of images per second. So you can change it, according to your needs.

linux: keep open the terminal

you can add at the end of your command ;bash
for example:
rclone sync mega:ebooks /mnt/zippati/ebooks/ebooks/ -l -v ;bash

2020-03-02

alternative browsers

I'm very disappointed by Midori and Epiphany: too minimalist.

2020-02-28

libreoffice via snap: not a good idea

Discover let you install the latest LibreOffice release, but:
  • it is very much slower than a no-snap realease
  • no mysql-connectr available
Not a good idea!
So, I removed it: sudo snap remove libreoffice.

2020-02-20

phpmyadmin: add a table (or a view) to "favorites" (bookmarks)

In tables (or views) click on the star next to his name.

Blog Archive