2015-12-28

HOWTO: preventing aptitude from breaking the APT package setup

Initial conditions:
  • usually, you use apt-get (from the apt package) for Debian package maintenance (installing, removing, upgrading etc.);
  • sometimes you launch aptitude (aptitude package) to do some work;
  • after doing some work with apt-get, you notice that aptitude hasn't caught up with the current package state (i. e., it wants to install / remove some package(s) just from the start).
Solution: hide (or delete) the outdated package states file from aptitude (note: it'll overwrite an old backup, "/var/lib/aptitude/pkgstates.old", if present):
$ cd /var/lib/aptitude
# mv pkgstates pkgstates.old
P. S. This should also work for Debian derivatives (e. g. Ubuntu).

2015-12-04

Hardware accident: Chinese LED lantern turned into a firework

Device brand / model: Yajia YJ-6812
Description: a Chinese lantern with 32 LEDs (quite bright really; 2 levels of brightness); rechargeable (no information on battery currently); without any external power adapters (plugged directly into AC socket by a simple 2-wire cable). Bought on a local Ukrainian (Vinnytsia city) market. The design somewhat reminds of a kind of grater.

2015-11-30

Software: MediaInfo

Currently, MediaInfo is probably the best free & open-source utility for extracting technical info (metadata) from multimedia files (most frequently, containers with audio and video streams).
It's quite portable (runs on various Linux distributions, MS Windows, Apple Mac OS X, FreeBSD etc.; released regularly in source and compiled binary forms) and comes with CLI and GUI interfaces.

External links:

2015-10-31

HOWTO: force filesystem check on reboot in MS Windows (NT family)

These tricks may be well-known, but still handy for busy volumes (e. g., the system one):
  1. Open a command prompt (cmd) with administrator privileges (either via "Start → Run..." menu, "<WinKey> + <R>" hotkey, or other methods you like).
  2. Two options.
    1. Marking volume "dirty":
      > fsutil dirty set C:
      Volume - C: is now marked dirty
      
    2. A milder option, just scheduling the volume to be checked on startup:
      > chkntfs /C C:
      
      
  3. Reboot safely.
  4. Watch the CHKDSK operation progress...
  5. DONE!
    (You can check the CHKDSK logs later in the "Event Viewer" (eventvwr.msc or simply eventvwr for short)).
References:
---
Last updated: 2016-05-20

Hints: D-Link ADSL router: time to change the power adapter

Sample device: D-Link DSL-2640* (quite old combined ADSL modem / Ethernet switch / Wi-Fi router); should probably work for some other Linux-based routers with Broadcom chips.

Some trouble signs include: red power lights, not booting into the normal working mode (or booting into the recovery one) after power-on; slowing down of the operation, decrease of the performance & significant packet dropping rate; unexpected restarts etc.

Reliable internal software (firmware) symptoms — specific log strings get triggered, e. g.:
  • accessed via the web-based interface:
    System Log
    Date/TimeFacilitySeverityMessage
    ....
    Jan 1 00:01:23userwarn
    kernel: - Power glitch detected. Duration: 5 us
  • and via Telnet / SSH:
    ...
    > sh
    ...
    # dmesg
    ...
     - Power glitch detected. Duration: 6 us
    ...
    
    • Note: reportedly, some users also observe another diagnostic log message:
       - Power failure detected. ADSL Link down.
What to do:
  1. check the power cabling (and fix it, if needed);
  2. check the electrolytic capacitors:
    1. inside the power adapter,
    2. and in the router itself,
    3. and replace (resolder) the blown-up ones with new ones (paying attention to the nominal values, indeed);
  3. buy a new power adapter, if needed.
Safety notes:
  • BEWARE of electric shock.
  • Disconnect the AC power before opening the cases.
  • Some technical experience needed.
---
Last updated: 2015-11-30

2015-09-30

HOWTO: get rid of packed B-frames in AVI (MPEG-4 Visual) video with FFmpeg

You've probably seen some AVI (Audio Video Interleave) files with MPEG-4 video (more specifically, MPEG-4 Visual / ASP, usually encoded by DivX or Xvid codecs) inside; they are often used for DVD-rips. Such AVI video files often contain "packed B-frames", which is not an optimal frame storage way, but just a workaround for the VfW (Video for Windows) framework shortcomings (i. e., bugs).
To ensure you have a "bad-style" MPEG-4 AVI file, you can check it with a media analyzer utility like MediaInfo (in this case, it'll show you something like "Muxing mode : Packed bitstream").
Fortunately, that wrong thing is easy to "unpack" with an up-to date version of FFmpeg (v2.7+):
$ ffmpeg -i in_bad.avi -codec copy -bsf:v mpeg4_unpack_bframes out_good.avi
The conversion is lossless (neither video nor audio quality is harmed; the file should remain compatible with the hardware players... or even become more compatible), but often can even reduce the resulting AVI container size.

BTW, after "bitstream unpacking", the MPEG-4 video stream becomes standards-compliant, so you can put it directly into the popular MP4 container without transcoding (but it requires the audio stream to be MP4-compatible too, e. g. MP3 is OK);
e. g., here are 2.5 3 remuxing examples using the same FFmpeg:
$ ffmpeg -i in10_good.avi -codec copy out10_good.mp4
$ ffmpeg -i in20_bad.avi -codec copy -bsf:v mpeg4_unpack_bframes out20_better.mp4
$ ffmpeg -i in20_bad.avi -codec copy -bsf:v mpeg4_unpack_bframes -movflags faststart out25_best.mp4

You can download the source code and binary builds of the current FFmpeg (for MS Windows, Apple Mac OS X and Linux) freely from the official site.
Usually, you will find a compatible version in the repositories of your favorite Linux distribution;
however, in Debian, it's available only starting from the release 9 "Stretch" (and fortunately, it's currently in the backports for 8 "Jessie" too; and for use in Ubuntu, you need release 15.10 "Wily Werewolf", at least):
# sudo apt-get install ffmpeg

References:
  1. FFmpeg
    1. FFmpeg Bitstream Filters Documentation
    2. Download FFmpeg
    3. FFmpeg Changelog
    4. #2913 (Bitstream filter to fix "invalid and inefficient vfw-avi packed B frames") – FFmpeg
  2. MediaInfo
  3. Debian Package Tracker - ffmpeg
  4. ffmpeg package : Ubuntu
  5. Wikipedia
    1. Ripping
    2. MPEG-4 Part 2
    3. DivX
    4. Xvid
    5. Audio Video Interleave
    6. Video for Windows
    7. Video compression picture types
    8. Inter frame
---
Last updated: 2017-12-28

2015-08-31

Tips: where to find the photos in your Google account

You can try to find your photos in different "departments" of your Google account:

And don't forget about the trash folder(s):

---
Last updated: 2018-03-01

2015-08-01

Overview: barcode reading software in Linux

Tested in Debian Jessie:
# apt-get install dmtx-utils zbar-tools

2015-07-31

Tip: where to get the periodic table of the chemical elements

My favorite official source to download printable copies of the periodic table of the chemical elements (also known in the post-USSR countries as the Mendeleev's table) is IUPAC (the International Union of Pure and Applied Chemistry):
(Currently, the table on the IUPAC site dates back to 2016-11-28).
---
Last updated: 2017-02-11

HOWTO: the poor man's random number generator

Spoiler: the described binary random number generator (RNG) usually doesn't consume any electricity, but still definitely needs a minimal investment :-)

2015-06-30

HOWTO: find out the PDF.js version built into Mozilla Firefox

To find out the version and build number of PDF.js (built into your installed version of Mozilla Firefox), you should visit a specific URL (if it doesn't work, just try to copy-and-paste it):
and look patiently at the beginning of that page.

E. g., for Mozilla Firefox 38.0.5 we can get the following:
...

PDFJS.version = '1.0.1149';
PDFJS.build = 'bc7a110';

...
(To view more of its internals, just visit resource://pdf.js/. Note: if you browse through that, the address will expand to a specific path pointing to some file inside some library-archive of Firefox, e. g., jar:file:///path/to/firefox/dir/omni.ja!/chrome/pdfjs/content/build/pdf.js).

Links:

2015-04-25

The 3rd Edition of The Art of Electronics is finally out!

The 3rd Edition (2015; the previous ones were of 1989 and 1980 respectively) of The Art of Electronics masterpiece (by Paul Horowitz and Winfield Hill) has been finally released by the Cambridge University Press!
And this great book looks impressive at least: consisting of more than 1000 pages, weighing more than 2 kg (handle with care!) and costing more than 100 USD (at the start of the sales; beware of counterfeit versions though!).

Links:
  1. The Art of Electronics on Wikipedia
  2. The official Art of Electronics website
    1. Errata | The Art of Electronics 3rd Edition
  3. The Art of Electronics (3rd Edition) on Amazon.com
---
Last updated: 2019-04-24

2015-03-30

HOWTO: get a highest-resolution version of an image on Last.fm

Sometimes you can find an interesting picture on Last.fm, but don't have an obvious option to zoom in. Fortunately, sometimes you can view it in a better quality too (it depends on the originally uploaded image resolution):
  1. First of all, copy the URL of a necessary image; you should get something like this:
    http://userserve-ak.last.fm/serve/64s/35346791/RJ+Test+Artist+1+knifefighttypepadcom.jpg
  2. Then you'll need to modify the URL a little; just replace the entire substring consisting of alphanumeric characters between the two slashes after the "serve" word and before the image number with a single underscore:
    http://userserve-ak.last.fm/serve/_/35346791/RJ+Test+Artist+1+knifefighttypepadcom.jpg
  3. Just paste the modified image URL into your browser's address bar and enjoy the (big) picture!

2015-02-28

Audio file tag editors

Here are some of my favourite audio file (music etc.) tagging / tag editing applications.
  1. Free, open-source, multi-platform (Linux, Mac OS X, MS Windows etc.)
  2. Free, closed-source, Win32 only.