off-line comparation of two documents

You can use LibreOFfice (OpenOffice), following these steps (see here):

«In order to compare documents you need to have the original document and the one that is edited. To compare them:

  1. Open the edited document that you want to compare with the original document.
  2. Select Edit > Compare Document.
  3. An open document dialog appears»

tables and small screens

Tables, mainly if with more than two columns, are badly rendered on small screens (smartphones, tablets and the like). Indeed, not only they are unreadable, but they mess up the whole page, making it unreadable on small screens.

Therefore the best would be avoid as possible tables used as layout or even concept map.

The only tables you should use are for data (as from a database). In these cases you can use this helpful css code:

 <style type="text/css">
 table {
  border: 1px solid #ccc;
  border-collapse: collapse;
  margin: 0;
  padding: 0;
  width: 100%;
  table-layout: fixed;

 table caption {
  font-size: 1.5em;
  margin: .5em 0 .75em;

 table tr {
  background-color: #f8f8f8;
  border: 1px solid #ddd;
  padding: .35em;

 table th,
 table td {
  padding: .625em;
  text-align: center;

 table th {
  font-size: .85em;
  letter-spacing: .1em;
  text-transform: uppercase;

 @media screen and (max-width: 600px) {
  table {
    border: 0;

  table caption {
    font-size: 1.3em;
  table thead {
    border: none;
    clip: rect(0 0 0 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
  table tr {
    border-bottom: 3px solid #ddd;
    display: block;
    margin-bottom: .625em;
  table td {
    border-bottom: 1px solid #ddd;
    display: block;
    font-size: .8em;
    text-align: right;
  table td::before {
    * aria-label has no advantage, it won't be read inside a table
    content: attr(aria-label);
    content: attr(data-label);
    float: left;
    font-weight: bold;
    text-transform: uppercase;
  table td:last-child {
    border-bottom: 0;


In this way you can get you data perfectly readable on small screen., as you can see in this example.

How to set the css :.after size

It may happen that an image you chose for a css after content is too big. Therefore you need to resize it.

The following code doesn’t work:

yourelement::after {
  content: url(image.jpg);
  width: 10px;

You should use this, instead

    background-image: url(image);
    background-size: 10px 20px;
    display: inline-block;
    width: 10px; 
    height: 20px;

How to switch a php variable according to the server address

I managed to switch my websites links (containing a php variable: $root) according to the server address. If they are in localhost the variable begins with: http://localhost , if they are on remote the variable is the remote address.

The php code is quite simple:

if ($_SERVER['SERVER_NAME'] == "localhost")
{$root_yourwebsiteA = "http://localhost/your path/yourwebsiteA/";
 $root_yourwebsiteB = "http://localhost/your path/yourwebsiteB/";
 $root_yourwebsiteC = "http://localhost/your path/yourwebsiteC/";
{$root_yourwebsiteA = "http://remote path/yourwebsiteA/";
 $root_yourwebsiteB = "http://remote path/yourwebsiteB/";
 $root_yourwebsiteC = "http://remote path/yourwebsiteC/";

how to pass a php variable to javascript

You can use a code like the following:

  $name= "Hello World";
<script type="text/javascript"> 
  var x = "<?php echo "$name"?>";      

and then insert this code in a php page: but not with a js extension, but with some like inc

embed a div from another page

The way with less code is a jquery script. Like the following:

<p id="new"></p>

$( "#new" ).load( "/your-path/your-file.php #your-div" );

The only security limit is that you cannot use an absolute path, beginning with https:// .

But you can use a php variable to set your javascript value so that it may be available from any folder (sub-folder) of your website. See here how to pass a php variable to javascript.

mysql add some string to several rows

If a column has several rows, i.g.:

'red, yellow'  
'yellow, green'

And you want to add a new string (‘blue’) to every row, so that the result be:

'red, blue'  
'red, yellow, blue'  
'green, blue'  
'yellow, green, blue'

you can use this code

UPDATE my_table 
SET mycolumn = CONCAT('same new string ',mycolumn); 

But the above code works only for rows with some content, not for the empty (NULL) ones. Therefore you can complete your task with the following:

UPDATE my_table 
SET mycolumn = 'same new string' 
WHERE mycolumn IS NULL; 

mysql/php output in utf8

To avoid output problems in non-latin characters you should add this line in a msyqli query (i.e. after $db = mysqli_connect($db_host, $db_user, $db_password, $db_name);):

mysqli_set_charset($db, 'utf8');

import an external table to a mysql table

  • You can use a graphical interface to prepare the rows to insert in mysql table: be careful that a) the number of columns be matching with the mysql table rows number and b) the order of columns be the same.
  • Save your date as csv: in this way you will be able to make further modifications to your data: i.g. you could add new ,NULL,columns (because in librecalc if a column is empty at the end of a file that column is not added).
  • Be very careful with comma (,) within the columns, if you import the table in mysql with comma as column separator. You should avoid commas within a column, if you use commas as separator.
  • In phpmyadmin import your csv file as a new table. As and of line you can set \n if yout line ends with something like “NULL”. Otherwise, if you rows ends with “NULL”, you will get an undesired column at the end of teh impoorted table.
  • Don’t worry if the columns type doesn’t match with the destination mysql table: this is negligible.
  • In sql do this command:

INTO your_destination_table
FROM the_new_data_table-from-csv;

  • Using insert IGNORE you can avoid to delete the ID beginning column, if it is simply an autoincrement one.
  • Your new rows should have been added to your destination table: done!

Thunderbird chrome not working

If even after adding chrome folder thuderbird doesn’t use your cutomized css, you should try with:

Settings/Options > Advanced > General > Config Editor

toolkit.legacyUserProfileCustomizations.stylesheets > true