adb-sync

To sync a PC with a smartphone (or any other android device, like an android e-reader or tablet) you can use abd, and abd-sync. This latter has the advantage that it can, unlike adb push --sync, delete files no more existing in source or create new folders.

Indeed adb push –sync can only update files and folder already existing.

a problem: the external card

You can sync not only the internal memory of your android device, but an external card as well. The problem might be find the extact name and path of your external card: so you can use adb shell, and then df and ls to see the folders our the whole device (including the external card) with its exact name, that you will be able to use afterward in adb / adb-sync.

But if you adb-sync keeping the external card into your device, because it is more convenient, you will find some problems, such as the symlinks (not considered).

So, you might try with krusader and a sync via mtp, but this is very slow.

include wordpress category (or tag) posts in a website

  • You can install wordpress in a subdirectory of your website, in localhost as well.
  • Afterward you can embed the content (or the link) of your wordpress posts in your php pages using a code like the following:
<?php 
/* the path of your wordpress subfolder with the file, required, "wp-blog-header.php" */
require("$root/wordpress/wp-blog-header.php");
//get_header(); [you can omit this row, if you want embed the wp posts in your page having already header and styles]
?>


<?php
// Get the last 200 posts of a given category: 
//in this case the 565 one (=office).
global $post;
$args = array('posts_per_page' => 200,  'category' => 565 );
$myposts = get_posts( $args );

foreach( $myposts as $post ) :	setup_postdata($post); ?>
<h2><?php the_title(); ?></h2>
<p><?php the_content(); ?></p>
// the following code is to put a link: you could choose to don't add it, or, on the contrary, to put only it
<a href="<?php the_permalink() ?>" rel="bookmark" 
title="Permanent Link to <?php the_title_attribute(); ?>">
<?php the_title(); ?></a><br />
<?php endforeach; ?>
  • if you want embed in your pages tag posts instead of category posts you can use this code

$args = array('posts_per_page' => 100, 'tag' => 'css' );

Further info here.

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.

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.

ricordi del passato (informatico)

Il mio primo PC è stato un Olivetti 086, con 20 mb di disco fisso e meno di 1 mega di ram (non ricordo più esattamente). Con windows 3.1 e una versione di MS Word che non era mica da buttar via, con il suo file normal.dot che conteneva sia i fogli di stile sia le macro.

Installare windows richiedeva una quindicina di floppy disks. Non c’erano CD, e men che meno DVD.

Fondamentali erano i files di configurazione: config.sys e autoexec.bat, caricati all’avvio. In autoexec.bat alla fine c’era il comando per far partire windows.

E la stampante? Ovviamente ad aghi: lenta e rumorosa, oltre che enorme.

Che tempi!

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.