2019-10-26
whatsapp web e social: a capo senza inviare
se premete enter vi parte il messaggio. Per andare a capo continuando a scrivere un messaggio: shift+enter
2019-10-25
convert an ics file (exported from web calendar) as textual diary
- sudo apt install python3-pip
- pip3 install ics
- create the bash executable file, like this
se avete google
#!/bin/bashwget -O diario.ics https://calendar.google.com/calendar/ical/[remote path]/basic.ics
python3 convert-ics.py > /home/[local path]/local-file.md
se avete nextcloud
wget -O diario.ics https://ecloud.global/remote.php/dav/calendars/[vostra user(ad esempio la mail]/personal/?export --user=[il vostro user, come prima]--password=[la vostra password]
See also here.2019-10-24
embed database data in odt file
the problem
In odt it is possible to insert some database data as fields in a odt file, but when you change data in phpmyadmin I get1) a correct update in the data source view above the text,
2) not in the odt file (body: where are the fields): the fields texts remain unchanged, even after doing the command "update fields" (both from menu and from keyboard: F9, or shift+ctrl+F9).
a solution
A workaround is to use insert - section to insert a part of a php file via localhost.- you will see in your odt file the content of the (section=div, of the) php file, as in the picture following:
- insert -> section -> link -> file name "http://localhost/[path]/[filename].php" -> section (the "id" name you have chosen in php file, i.g. inserting a <div id="biblio">[php/mysql code]</div> the section name will "biblio")
- activate a php/mysql server in local
- and possibly have some knowledge of html/php source code.
Labels:
database,
embed database,
fields,
LibreWriter,
odt
avidemux too slow
It's better use (one of) the following codecs for encoding
Cfr.here.
- x264
- libavcodec MPEG-1/MPEG-2
- libavcodec MPEG-4
- Xvid
Cfr.here.
share (embedding) text between odt documents (librewriter)
Impossible use cross-reference or dde-link for more than a paragraph.
So the only way (to share more than a paragraph) are sections:
It is not necessary a master document.
So the only way (to share more than a paragraph) are sections:
- define the area you want share in the file A as a bookmark;
- in the file B insert -> section -> as link - choose the file and the bookmark
- the text boormarked in A will be visible in B
It is not necessary a master document.
Labels:
bookmark,
cross reference,
LibreWriter,
section,
sections,
share text
2019-10-13
problems with "locale"
In case of problems with locale (i.g. autokey not starting, or a file with non-latin characters not opening) you can try these commands
- export LC_ALL="en_US.UTF-8"
- export LC_CTYPE="en_US.UTF-8
- sudo dpkg-reconfigure locales
Labels:
autokey,
gtk,
locale,
non-latin,
regional settings
2019-10-12
calculate age from year of birth
There are two ways:
You can also use php code, as in the following way
(inspired from this page (https://stackoverflow.com/questions/3776682/php-calculate-age), and _slighty modified_:
$dob ="$row[anno_nascita]";
$age = date_diff(date_create($dob), date_create('now'))->y;
echo "age: $age years
";
select *,year(CURDATE())-year(anno_nascita) age from studenti__classi;
2. save the result as view
3. and so you will have, in the view, the age (of your students, i.g.) that can work in LibreBase (to connect with that view).
via php
## 2. in phpYou can also use php code, as in the following way
(inspired from this page (https://stackoverflow.com/questions/3776682/php-calculate-age), and _slighty modified_:
$dob ="$row[anno_nascita]";
$age = date_diff(date_create($dob), date_create('now'))->y;
echo "age: $age years
";
via mysql in phpmyadmin
1.do this sql query:select *,year(CURDATE())-year(anno_nascita) age from studenti__classi;
2. save the result as view
3. and so you will have, in the view, the age (of your students, i.g.) that can work in LibreBase (to connect with that view).
2019-10-10
insert a text as field from an odt to another odt
0. Avoid to copy more than one paragraph: in that case the whole original file will be insert in the destination file.
1. copy an area in original file
2, paste special in destination file (as DDE link)
1. copy an area in original file
2, paste special in destination file (as DDE link)
2019-10-08
convert big (text) pdf files to word
This website has converted a big (5mb) text pdf file to word in a very good way.
2019-10-04
symlinks on fat32 devices
You can use posixovl:
done!
- install posixovl (i.g. via synaptic);
- rename /sbin/mount-posixovl -> mount-posixovl.orig;
- create a new mount-posixovl in sbin:
#!/bin/bash
# wrapper for mount.posixovl to conform with common mount syntax
# with this wrapper posixovl can be used in fstab
# location of the original mount.posixovl
origposixovl="/sbin/mount.posixovl.orig"
# gather inputs
while [ $# -gt 0 ]; do
if [[ "$1" == -* ]]; then
# var is an input switch
# we can only use the -o or -F switches
if [[ "$1" == *F* ]]; then
optsF="-F"
else
optsF=""
fi
if [[ "$1" == *o* ]]; then
shift
optsfuse="-- -o $1"
else
optsfuse=""
fi
shift
else
# var is a main argument
sourcedir="$1"
shift
if [[ "$1" != -* ]]; then
targetdir="$1"
shift
else
targetdir="$sourcedir"
fi
fi
done
# verify inputs
if [ "$sourcedir" == "" ]; then
echo "no source specified"
exit 1
fi
if [ "$targetdir" == "" ]; then
echo "no target specified"
exit 1
fi
# build mount.posixovl command
"$origposixovl" $optsF -S "$sourcedir" "$targetdir" $optsfuse
- add to /etc/fstab something like this (depending on the name of your device):
LABEL=Basic\0402 /media/duns/basic2 vfat user,rw,noauto,uid=1000,gid=1000,iocharset=iso8859-1,shortname=mixed,showexec,utf8 1 2
/media/duns/basic2 /mnt/e-reader posixovl noauto 0 0
- create a script, like this:
#!/bin/bash
wmctrl -c mount.posixovl.orig
mount /media/duns/basic2
mount.posixovl -F /media/duns/basic2 /mnt/e-reader
krusader --left /mnt/e-reader/ebooks --right /mnt/zippati/eBooks
done!
2019-10-02
customize grub in KDE Neon
0) Avoid Grub customizer: absolutely useless.
1) You can modify /etc/default/grub uncommenting GRUB_THEME="/boot/grub/themes/breeze/theme.txt"
2) Then you can modify /boot/grub/themes/breeze/theme.txt: for example you can
for example "sudo grub-mkfont --output=/boot/grub/fonts/DejaVuSans-10.pf2 --size=10 /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf"
c) per installare nell'mbr
sudo grub-install /dev/sda
1) You can modify /etc/default/grub uncommenting GRUB_THEME="/boot/grub/themes/breeze/theme.txt"
2) Then you can modify /boot/grub/themes/breeze/theme.txt: for example you can
- add a background: adding, in # General settings, a line such as "desktop-image: "your-image-in-the-same-folder.png" (obviously you have to put, as root, that image into the folder);
- reducing the height for menu items, in "+ boot_menu": "item_height = 15" (not: 33)
fine tuning
a) you can change the screen resolution (in /etc/default/grub);- give this command "xrandr" in order to know the supported resolutions
- then uncomment/modify GRUB_GFXMODE="your desired resolution"
for example "sudo grub-mkfont --output=/boot/grub/fonts/DejaVuSans-10.pf2 --size=10 /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf"
c) per installare nell'mbr
sudo grub-install /dev/sda
thermal monitor plasmoid not working
As explained here, if you have a bug in the thermal monitor plasmoid, to fix it you can change main.qml in .local/share/plasma/plasmoids as following (updated 22 feb 2020, adding ": []" after "property var systemmonitorAvailableSources"):
/*
* Copyright 2015 Martin Kotelnik
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
import QtQuick 2.2
import QtQuick.Layouts 1.1
import QtGraphicalEffects 1.0
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import "../code/model-utils.js" as ModelUtils
import "../code/config-utils.js" as ConfigUtils
Item {
id: main
anchors.fill: parent
property bool vertical: (plasmoid.formFactor == PlasmaCore.Types.Vertical)
property bool planar: (plasmoid.formFactor == PlasmaCore.Types.Planar)
property bool initialized: false
// configuration
property int temperatureUnit: plasmoid.configuration.temperatureUnit
property string configuredResources: plasmoid.configuration.resources
property int baseWarningTemperature: plasmoid.configuration.warningTemperature
property int baseMeltdownTemperature: plasmoid.configuration.meltdownTemperature
property int updateInterval: 1000 * plasmoid.configuration.updateInterval
property int itemMargin: 5
property double itemWidth: 0
property double itemHeight: 0
property color warningColor: Qt.tint(theme.textColor, '#60FF0000')
property var textFontFamily: theme.defaultFont.family
Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation
property double aliasFontSize: itemHeight * plasmoid.configuration.aliasFontSize * 0.01
property double temperatureFontSize: itemHeight * plasmoid.configuration.temperatureFontSize * 0.01
property double iconFontSize: itemHeight * plasmoid.configuration.iconFontSize * 0.01
property double temperatureRightMargin: itemHeight * plasmoid.configuration.temperatureRightMargin * 0.01
property double iconBottomMargin: itemHeight * plasmoid.configuration.iconBottomMargin * 0.01
property bool enableLabelDropShadow: plasmoid.configuration.enableLabelDropShadow
property var systemmonitorAvailableSources : []
property var systemmonitorSourcesToAdd
property int numberOfParts: temperatureModel.count
property double parentWidth: parent !== null ? parent.width : 0
property double parentHeight: parent !== null ? parent.height : 0
property double widgetWidth: 0
property double widgetHeight: 0
Layout.preferredWidth: widgetWidth
Layout.preferredHeight: widgetHeight
property bool debugLogging: false
function dbgprint(msg) {
if (!debugLogging) {
return
}
print('[thermalMonitor] ' + msg)
}
onParentWidthChanged: setWidgetSize()
onParentHeightChanged: setWidgetSize()
onNumberOfPartsChanged: setWidgetSize()
function setWidgetSize() {
if (!parentHeight) {
return
}
var orientationVertical = false
if (planar) {
var contentItemWidth = parentHeight
var contentWidth = numberOfParts * contentItemWidth + (numberOfParts-1) * itemMargin
var restrictToWidth = contentWidth / parentWidth > 1
itemWidth = restrictToWidth ? (parentWidth + itemMargin) / numberOfParts - itemMargin : contentItemWidth
} else if (vertical) {
orientationVertical = true
itemWidth = parentWidth
} else {
itemWidth = parentHeight
}
itemHeight = itemWidth
widgetWidth = orientationVertical ? itemWidth : numberOfParts * itemWidth + (numberOfParts-1) * itemMargin
widgetHeight = orientationVertical ? numberOfParts * itemHeight + (numberOfParts-1) * itemMargin : itemHeight
}
FontLoader {
source: '../fonts/fontawesome-webfont-4.3.0.ttf'
}
Image {
id: noResourceIcon;
anchors.centerIn: parent
visible: temperatureModel.count === 0
height: itemHeight
width: height
source: '../images/thermal-monitor.svg'
}
ListView {
id: listView
anchors.centerIn: parent
width: widgetWidth
height: widgetHeight
orientation: !planar && vertical ? ListView.Vertical : ListView.Horizontal
spacing: itemMargin
model: temperatureModel
delegate: TemperatureItem {}
}
/*
*
* One object has these properties: temperature, alias and other
*
*/
ListModel {
id: temperatureModel
}
Component.onCompleted: {
plasmoid.setAction('reloadSources', i18n('Reload Temperature Sources'), 'system-reboot');
reloadAllSources()
setWidgetSize()
}
onBaseWarningTemperatureChanged: {
tryReloadSources()
}
onBaseMeltdownTemperatureChanged: {
tryReloadSources()
}
onConfiguredResourcesChanged: {
dbgprint('configured resources changed')
tryReloadSources()
}
function tryReloadSources() {
if (!initialized) {
dbgprint('applet not initialized -> no reloading sources')
return
}
reloadAllSources()
}
function getSystemmonitorAvailableSources() {
if (!systemmonitorAvailableSources) {
systemmonitorAvailableSources = systemmonitorDS.sources
}
return systemmonitorAvailableSources
}
function action_reloadSources() {
reloadAllSources()
}
function reloadAllSources() {
dbgprint('reloading all sources...')
var resources = ConfigUtils.getResourcesObjectArray()
temperatureModel.clear()
if (!systemmonitorSourcesToAdd) {
systemmonitorSourcesToAdd = []
}
if (systemmonitorDS.connectedSources === undefined) {
systemmonitorDS.connectedSources = []
}
if (udisksDS.connectedSources === undefined) {
udisksDS.connectedSources = []
}
if (nvidiaDS.connectedSources === undefined) {
nvidiaDS.connectedSources = []
}
if (atiDS.connectedSources === undefined) {
atiDS.connectedSources = []
}
systemmonitorSourcesToAdd.length = 0
systemmonitorDS.connectedSources.length = 0
udisksDS.connectedSources.length = 0
udisksDS.cmdSourceBySourceName = {}
nvidiaDS.connectedSources.length = 0
atiDS.connectedSources.length = 0
ModelUtils.initModels(resources, temperatureModel)
for (var i = 0; i < temperatureModel.count; i++) {
var tempObj = temperatureModel.get(i)
var source = tempObj.sourceName
if (source === 'group-of-sources') {
dbgprint('adding group: ' + tempObj.alias)
for (var childSource in tempObj.childSourceObjects) {
dbgprint('adding source (for group): ' + childSource)
addSourceToDs(childSource)
}
} else {
addSourceToDs(source)
}
}
ModelUtils.rebuildModelIndexByKey(temperatureModel)
initialized = true
dbgprint('reloadAllSources() DONE')
}
function addSourceToDs(source) {
if (source.indexOf('udisks/') === 0) {
var diskLabel = source.substring('udisks/'.length)
var cmdSource = ModelUtils.getUdisksTemperatureCmd(diskLabel)
udisksDS.cmdSourceBySourceName[cmdSource] = source
dbgprint('adding source to udisksDS: ' + cmdSource)
addToSourcesOfDatasource(udisksDS, cmdSource)
} else if (source.indexOf('nvidia-') === 0 && nvidiaDS.connectedSources.length === 0) {
dbgprint('adding source to nvidiaDS')
addToSourcesOfDatasource(nvidiaDS, nvidiaDS.nvidiaSource)
} else if (source.indexOf('aticonfig') === 0 && atiDS.connectedSources.length === 0) {
dbgprint('adding source to atiDS')
addToSourcesOfDatasource(atiDS, atiDS.atiSource)
} else {
dbgprint('adding source to systemmonitorDS: ' + source)
if (getSystemmonitorAvailableSources().indexOf(source) > -1) {
dbgprint('adding to connected')
addToSourcesOfDatasource(systemmonitorDS, source)
} else {
dbgprint('adding to sta')
systemmonitorSourcesToAdd.push(source)
}
}
}
function addToSourcesOfDatasource(datasource, sourceName) {
if (datasource.connectedSources.indexOf(sourceName) > -1) {
// already added
dbgprint('source already added: ' + sourceName)
return
}
datasource.connectedSources.push(sourceName)
}
PlasmaCore.DataSource {
id: systemmonitorDS
engine: 'systemmonitor'
property string lmSensorsStart: 'lmsensors/'
property string acpiStart: 'acpi/Thermal_Zone/'
onSourceAdded: {
if (source.indexOf(lmSensorsStart) === 0 || source.indexOf(acpiStart) === 0) {
systemmonitorAvailableSources.push(source)
var staIndex = systemmonitorSourcesToAdd.indexOf(source)
if (staIndex > -1) {
addToSourcesOfDatasource(systemmonitorDS, source)
systemmonitorSourcesToAdd.splice(staIndex, 1)
}
}
}
onNewData: {
var temperature = 0
if (data.value === undefined) {
dbgprint('data for source ' + sourceName + ' not yet available')
} else {
temperature = parseFloat(data.value)
}
ModelUtils.updateTemperatureModel(temperatureModel, sourceName, temperature)
}
interval: updateInterval
}
PlasmaCore.DataSource {
id: udisksDS
engine: 'executable'
property var cmdSourceBySourceName
onNewData: {
dbgprint('udisks new data - valid: ' + valid + ', stdout: ' + data.stdout)
var temperature = 0
if (data['exit code'] > 0) {
dbgprint('new data error: ' + data.stderr)
} else {
temperature = ModelUtils.getCelsiaFromUdisksStdout(data.stdout)
}
ModelUtils.updateTemperatureModel(temperatureModel, cmdSourceBySourceName[sourceName], temperature)
}
interval: updateInterval
}
PlasmaCore.DataSource {
id: nvidiaDS
engine: 'executable'
property string nvidiaSource: 'nvidia-smi --query-gpu=temperature.gpu --format=csv,noheader'
onNewData: {
var temperature = 0
if (data['exit code'] > 0) {
dbgprint('new data error: ' + data.stderr)
} else {
temperature = parseFloat(data.stdout)
}
ModelUtils.updateTemperatureModel(temperatureModel, 'nvidia-smi', temperature)
}
interval: updateInterval
}
PlasmaCore.DataSource {
id: atiDS
engine: 'executable'
property string atiSource: 'aticonfig --od-gettemperature | tail -1 | cut -c 43-44'
onNewData: {
var temperature = 0
if (data['exit code'] > 0) {
dbgprint('new data error: ' + data.stderr)
} else {
temperature = parseFloat(data.stdout)
}
ModelUtils.updateTemperatureModel(temperatureModel, 'aticonfig', temperature)
}
interval: updateInterval
}
Timer {
interval: updateInterval
repeat: true
running: true
onTriggered: {
ModelUtils.computeVirtuals(temperatureModel)
}
}
}
2019-10-01
Subscribe to:
Posts (Atom)
Blog Archive
-
▼
2019
(56)
-
▼
October
(15)
- whatsapp web e social: a capo senza inviare
- convert an ics file (exported from web calendar) a...
- embed database data in odt file
- avidemux too slow
- share (embedding) text between odt documents (libr...
- avoid b/w photos in librebase
- problems with "locale"
- calculate age from year of birth
- insert a text as field from an odt to another odt
- convert big (text) pdf files to word
- symlinks on fat32 devices
- view djvu files with okular
- customize grub in KDE Neon
- thermal monitor plasmoid not working
- gdrive su dolphin
-
▼
October
(15)