responsive (css) menu

I have successfully used for several years a pure css menu, without javascript. But the problem now is that it is not enough reponsible with mobile devices. I mean that the maximum that can it be asked is to show (correctly) the main entries (disabling the drop-down from them).

I tried the new release of that css menu : but the main problem of this new, and responsive release (with some aiax script, though) it that by clicking on the hamburger icon all menu levels are shown. And If you have more than 50 entries it is a too long list.

To get a drop-down pure css reponsive menu, because of the limits of our current browsers, it is necessary use input and label tags (in a terrible: non-sematic way). This is the way of this attempt: no bad (no js, only css and that trick), but very hard to import in a previous menu.

Another attempt was following an example of collapsible responsive menu w3cschools: a code very simple and lovable, so to say, but here too: very difficult import in a previous, complex, menu.

a non-destructive way to modify a multi-boot

You can try gdisk: a very simple, easy, fast and safe, command-line tool.

With gdisk you can make several actions, such as:

  • convert a MBR disk to a GPT one (with the command gdsk and then the disk you want modify , i.g. /dev/sda, and the doing the command “w”, that is “write”)
  • re-order your partition table (with the command “s”, that is “sort”), if in your disk there is some “desorder”, i.g. if /dev/sdb8 is before /dev/sdb6.

connecting android to samba in Linux

You must add in smb.conf (in /etc/samba), at [global] section and at “allow hosts = row, the android device IP, otherwise you won’t be able to connect it to PC samba network.

Then you can use several android apps, like X-plore (G-Play, commercial, but good) or Material File Manager (F-Droid, open source, quite spartan, but fast and reliable), to set the samba connection with your PC and view the files shared on your PC.

Provided, obviously, that PC and android device are both connected at the same local network.

php show a content in a given period of the year

You can use a very simple php code, f.e. for Christmas and Happy New Year greetings:

<?php 
$dataattuale = date('m-d');
$inizioauguri = date('m-d', strtotime("11/13"));
$finauguri = date('m-d', strtotime("01/10"));  
if (($dataattuale >= $inizioauguri) && ($finauguri <= $finauguri))
{include "$root/natalizio.php";} 
?>

The above code show the content of natalizio.php (in root folder) from November 13th to January 10th.

open-source cookie-bar solution

I found this very interesting and simple script: cookie-bar, customizable very easily here.

Unfortunately I didn’t manage to save and use that (free) javascript in local. No jquey, no css, a very short code.

The only thing you have to do is personalize the code within you have what you want hide if your visitor refuse your cookies.

The code should be something like the following:

<?php
 if ((isset($_COOKIE['cookiebar'])))
    {
    echo " [whatever you want";
    }
 else
    {
    echo "<div class=\"what-you-want\">to see this content accept our cookie policy.</div>";
    }
?>

radial gradient in new KDE

The new KDE Plasma releases require a slight change in your svg files, if you have a radiant gradient (no problems instead with the linear ones).

You have to specify the radialGradient cx, cy and r, like in the following example:

<?xml version="1.0" standalone="no"?>
<svg viewBox="0 0 22 22" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  <defs>
    <radialGradient id="gradient" cx="0.50" cy="0.50" r="0.45">
      <stop offset="0%" stop-color="#fbfbf0"></stop>
      <stop offset="80%" stop-color="#bc5a1f"></stop>
    </radialGradient>
  </defs>
  <g>
    <path fill="url(#gradient)" d="M11 .008l3.4 6.888L22 8l-5.5 5.361 1.298 7.57L11 17.357l-6.798 3.574 1.298-7.57L0 8l7.6-1.104z" />
  </g>
</svg>

Because a svg with this other following code won’t work (will be invisible)

<?xml version="1.0" standalone="no"?>
<svg viewBox="0 0 22 22" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  <defs>
    <radialGradient id="gradient">
      <stop offset="0%" stop-color="#fbfbf0"></stop>
      <stop offset="80%" stop-color="#bc5a1f"></stop>
    </radialGradient>
  </defs>
  <g>
    <path fill="url(#gradient)" d="M11 .008l3.4 6.888L22 8l-5.5 5.361 1.298 7.57L11 17.357l-6.798 3.574 1.298-7.57L0 8l7.6-1.104z" />
  </g>
</svg>

update remote wordpress from localhost

Migrate DB is a good tool, even in its free version. You can follow these steps:

  • create a database in remote and import there the local wordpress database, changing some data with Migrate DB (tipically you have to convert the local server path https://localhost/your-local-path/wordpress to //your-remote-path/wordpress, and the local absolute path (such as /mnt/your-PC-path/wordpress) to the remote absolute path (such as https://your-remote-path/wordpress);
  • upload the local wordpress folder to your remote website, via FTP;
  • change in the uploaded folder the wp-config.php file, according to the db user, db name and db server of the remote wordpres database;
  • go to the remote wordpress, login (user and password are identical to the your local wordpress ones), and go to Migrate DB -> settings, and there -> generate/reset API key, copy the 32 char key and paste it in the local Migrate DB push box.
  • So your connection should work, syncing the remote database with the local one.

VLC and chapters

VLC is a good player, but it can happen that if you create only one mkv chapter, it doesn’t recognize it (unlike other player such as, in Linux, SMPlayer).

To fix this you have to add at least two chapters,

link from outside to a part of a file

pdf

It is possible to link a page of a pdf, with the following syntax:

file:///your-path-here/your-pdf-filename-here.pdf#pag=[the-page-number]

or, if the file is within your localhost folder

http://localhost/your-path-here/your-pdf-filename-here.pdf#pag=[the-page-number]

epub

It is possible to link to a given location of an epub file, i.g. with calibre viewer, with a code like the following

file:///your-path-here/your-epub-filename.epub?open_at=epubcfi(/10/2/4/2/132/18/1:65)

You can get the string after open_at (in the above case: epubcfi(/10/2/4/2/132/18/1:65) in the calibre viewer, this way:

  • right click
  • -> go to
  • -> location
  • -> current location (above in the window) : copy