How to Delete the Login Credentials of an Active Network Session

A list of active network sessions is generated by entering the command “net use” in the windows cmd console.

C:\Users\id>net use
New connections will not be remembered.
Status Local Remote            Network
OK           \\192.168.1.3\foo Windows Network
The command completed successfully.

A connection can be deleted using the same command but specifying the details of the connection and adding the delete flag.

C:\Users\id>net use \\192.168.1.3\foo /delete
\\192.168.1.3\foo was deleted successfully.

GCOV: How to Run from The Latest Sources

If you want to work with the latest gcovr files without installing them then try the following sequence of commands under linux which clones the latest repo before modifying the python path and then running gcovr against the coverage files.

$ git clone git@github.com:gcovr/gcovr.git
$ export PYTHONPATH=$PYTHONPATH:<path to gcovr repo>
$ python -m gcovr -r <path to files> --html --html-details <file to create>.html

Emacs: How to Format an XML file

Using emacs in conjunction with libxml2 it is possible to quickly format an xml file into a more readable format. For the purposes of this example we will take the following xml file and reformat it. NB libxml2 must be installed on your machine

<?xml version="1.0"?>
<Tests xmlns="http://www.qedevelopment.co.uk">
  <Test Id="0001" Type="foo">
    <Name>Foo test</Name>
    <Input>1</Input>
    <Output>One</Output>
  </Test>
  <Test Id="0002" Type="garp"><Name>Garp test</Name><Input>abc</Input><Output>def</Output></Test>
</Tests>

Enter the following command into emacs. Where C-x h represents the pressing of the <ctrl> key and the ‘x’ key at the same time followed by the ‘h’ key in order to select all the text in the buffer. M-| represents the pressing of the <esc> key followed by the ‘|’ key (not the simultaneous pressing of the two keys). The RET represents the return key, and don’t forget the ‘-‘ between it and the format.

C-x h C-u M-| xmllint --format - RET

You contents of the buffer should now have been reformatted as show below.

<?xml version="1.0"?>
<Tests xmlns="http://www.qedevelopment.co.uk">
  <Test Id="0001" Type="foo">
    <Name>Foo test</Name>
    <Input>1</Input>
    <Output>One</Output>
  </Test>
  <Test Id="0002" Type="garp">
    <Name>Garp test</Name>
    <Input>abc</Input>
    <Output>def</Output>
  </Test>
</Tests>

How To: Connecting Valgrind to GDB

Debugging memory issues can be made much easier if you use Valgrind with gdb. To do this you need to ensure that the Valgrind gdbserver is enabled. You do this when Valgrind is started with the command below

$ valgrind --tool=memcheck --vgdb=yes --vgdb-error=0 <prog>

where <prog> is the path to the program you want to test e.g. ./test

You then need to open another terminal window and start gdb

$ gdb <prog>

You now need to tell gdb that you want to work with the remote target

(gdb) target remote | vgdb

You can now continue, and wait for gdb to break when Valgrind determines that there is a problem.

(gdb) c

Minidlna: How to Auto Start

To setup the auto starting of minidlna on a linux machine running systemd create a file /etc/systemd/system/minidlna.service and enter the following:

[Unit]
Description=minidlna server
After=network.target

[Service]
Type=simple
ExecStart=/usr/local/sbin/minidlnad \
  -R -S -f /home/pi/.minidlna/minidlna.conf

[Install]
WantedBy=multi-user.target

You should now be able to start minidlna running with the following command:

$ systemctl start minidlna

In order to set the system up to auto start minidlna when powering up enter the following command

$ systemctl enable minidlna

MCCI USB Exerciser: How to Fix Ubuntu Warnings

If you are getting the following warning messages when running the MCCI USB exerciser then you can try the following:

./mcci2101: error while loading shared libraries: libusb-1.0.so.0: cannot open shared object file: No such file or directory

sudo apt-get install libusb-1.0-0:i386

./mcci2101: error while loading shared libraries: libudev.so.0: cannot open shared object file: No such file or directory

pushd /lib/i386-linux-gnu/
sudo ln -sf libudev.so.1 libudev.so.0
popd

Yocto: How to remove getty@tty1.service

Tty services are enabled in the later parts of the yocto build as a result of sources compiled earlier in the build process. As part of the compilation of these files a text file

presets/90-systemd.preset b/presets/90-systemd.preset

is analysed. If the line

enable getty@.service

is found then tty1 will be enabled at a later date when an appropariate symlink is added to the folder getty.target.wants. If the ‘enable’ is replaced with ‘disable’ in the file then no symlink will be added. One solution is therefore to create a suitable systemd_%.bbappend to patch the above line.

Kodi: How to Modify a Cached Actors Thumbnail

If an actors thumbnail has already been cached Kodi can be a bit reluctant to update the image. If all else fails you can try replacing the cached image directly with the new image, but take care, this is a low level mod.

Actor thumbnails are stored in the user directory .kodi/userdata/Thumbnails using a hashing system. You can determine the hashed value of the image by looking in the Textures database stored in the directory .kodi/userdata/Database.

I’ve used DB Browser for SQLite to look into the databases on my windows machine.

Image of the Kodi textures database file
Contents of the Kodi Textures13.db file

If you look in the textures table you should be able to relate your video’s/actor’s url to the hash of the stored thumbnail. The image above shows that the file 2002-02-03 S01E01-thumb.jpg is cached as the file a5605273.jpg. Replacing the a5605273.jpg file with the new image should lead to the new image being displayed. Don’t forget to update the source image though. At some point you will no doubt clean and reload the full database at which point the source file will be loaded.