Saturday, 7 July 2018

WD Elements SE 4TB

The Western Digital Elements SE is a 2.5″ inch portable external hard disk, available in multiple capacities. It has the traditional "rounded" shape of WD portable external hard disks, unlike the recent models of WD My Passport disks which have transitioned to a sharp-cornered rectangular enclosure; this makes it a natural fit for the fabled WD Nomad rugged disk cases of old.
  • Dimensions: 110 × 81.5 × 21 mm for the 2TB and 4TB variants; the 1TB variant is only 12.8 mm thick.
  • Weight: about 250 g (4TB), down to about 130 g (1TB).
  • Model: WDBJRT0040BBK-WESN (4TB), or WDBJRT0020BBK-WESN (2TB), or WDBJRT0010BBK-WESN (1TB).
The 4TB WD Elements SE has physical sectors of 4 KiB, but presents to the host system logical sectors of 512 bytes; this makes it a 512e Advanced Format disk, which helps with compatibility with more simple-minded operating systems; because the disk presents 512 byte logical sectors, it must be formatted with the GPT partitioning scheme. The disk has 7,813,969,920 logical sectors, which means that its capacity is 4,000,752,599,040 bytes (3.64 TiB). Crystal Dew World's CrystalDiskInfo says that the disk spins at 5400 rpm.

C:\> fsutil fsinfo ntfsinfo A:
...
Number Sectors :                  0x00000001d1bfa7ff
Total Clusters :                  0x000000003a37f4ff
Free Clusters  :                  0x0000000027ae5d79
Total Reserved :                  0x0000000000000000
Bytes Per Sector  :               512
Bytes Per Physical Sector :       4096
...

The performances as measured CrystalDiskMark are consistent with a 5400 rpm disk with an USB 3.0 connection. Sequential read speed is about 87 MB/sec (or about 83 MiB/sec in binary units); for small random accesses the read speed drops to about 0.5 MB/sec, corresponding to a respectable 133 IOPS. (The write speed as measured by CrystalDiskMark for small random accesses is unrealistic and should not be taken into account.)

In a practical test, reading 2000 photos totalling 15 GB (13.9 GiB) took 236 seconds, coming to 63.6 MB/sec or 60.6 MiB/sec.

Thursday, 31 May 2018

Popularity of Firefox extensions

One of the many nice things about the Firefox Add-on store is that it allows browsing the add-ons in order of popularity, expressed as the number of users who, I suppose, use the add-ons.

When we look at the most popular extensions we notice that, unsurprisingly, that it looks like a power law, with a handful of extremely popular extensions and a long tail of interesting but as yet unpopular ones.

Popularity of the most popular Firefox extensions, as of May 2018.

The six most popular extensions are Adblock Plus, uBlock Origin, Video DownloadHelper, Easy Screenshot, Cisco WebEx and Ghostery:
  • Adblock Plus (12.1 million users) and uBlock Origin (4.9 million users) are worthy ad-blockers. That Adblock Plus has more than two times the number of users of uBlock Origin is a compelling testimony as to the importance of coming first. Or possibly it may be that the purely functional user interface of uBlock Origin is deterring some users.
  • Then comes Video DownloadHelper, a utility to extract, convert and save videos from web sites, including the mighty YouTube. 3.3 million users find it useful.
  • In the fourth place is Easy Screenshot, a tool to get a screenshot of the entire web page. Two and a half million users have it. Why they have it is a mystery, since the functionality to get a screenshot of the entire web page is built into Firefox.
  • Cisco WebEx sits on the fifth place, with 1.6 million users. It is highly likley that those are people who work for corporations which use Cisco WebEx for their virtual meeting needs.
  • The admirably duplicitous Ghostery is sixth, with 1.1 million users. "Ghostery blocks marketing companies from gathering website user information, but it makes money from selling page visit, blocking, and advertising statistics to corporations globally, including corporations that are actively engaged in collecting user information to target ads and other marketing messages to consumers", says Wikipedia.

Fenestral incantations

  • Microsoft Edge cannot load favicons from localhost, regardless of the server name, unless in an elevated PowerShell:
    CheckNetIsolation LoopbackExempt `
    -a -n="Microsoft.MicrosoftEdge_8wekyb3d8bbwe"
    See "Favicon not working on Edge" on Stack Overflow.
    Bruce Payette and Richard Siddaway, Windows PowerShell in Action, 3rd edition, Manning, 2017, ISBN 9781633430297.
  • How to find domain controllers:
    C> nslookup -type=srv _ldap._tcp.dc._msdcs. | find /i "svr hostname"
  • Open the Credential Manager on Windows 10:
    C> rundll32.exe keymgr.dll, KRShowKeyMgr
  • Windows and Office activation status:
    C> slmgr /dlv
    C> slmgr /xpr
    C> cd /d "C:\Program Files\Microsoft Office\Office15" & :: 16, 17, ...
    C> cscript ospp.vbs /dstatus
    C> cscript ospp.vbs /act

Tuesday, 8 May 2018

How to add new wallpapers in GNOME

As we all know, Canonical has decided to throw away its signature desktop, and to adopt GNOME. Maybe they were tired, maybe they could no longer afford to develope and maintain Unity; it doesn’t really matter why: for the current Long Term Support version of Ubuntu uses the GNOME desktop. “An easy and elegant way to use your computer, GNOME 3 is designed to put you in control and get things done”, say its developers. They really do.

Today we’ll consider a complicated task, one which is but rarely attempted by users who don’t do computers as their day job, namely adding several wallpapers, so that they appear in the Background selection list alongside those which came preinstalled. How hard could this be?

Lesser desktop environments, such as the late lamented Unity, or even the inimical Windows 10, have this complicated feature, where any picture on the hard disk can be selected and used as desktop wallpaper. But GNOME is an advanced desktop, “an easy and elegant way to use the computer”.

The official way

The official way to add a bunch of pictures to the list of wallpapers from which the user can choose is to create an XML file listing them. The name of the file doesn’t matter; but it must be placed in one of three directories:
  • /usr/share/gnome-background-properties/
  • /usr/local/share/gnome-background-properties/
  • ~/.local/share/gnome-background-properties/
The file must have the following syntax, or schema:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE wallpapers SYSTEM "gnome-wp-list.dtd">
<wallpapers>
  <wallpaper>
    <name>Human Readable Name (Never Shown by GNOME)</name>
    <filename>/full/absolute/path/to/the/picture/filename.ext</filename>
    <options>zoom</options>
    <pcolor>#000000</pcolor>
    <scolor>#000000</scolor>
    <shade_type>solid</shade_type>
  </wallpaper>
  ·
  ·
  ·
</wallpapers>

The unofficial way

For those users who feel that the official GNOME “easy and elegant way” to add some wallpapers to the default list is a bit too enterprisey, the curious and enterprising people at OMG! Ubuntu! have found an unofficial but much simpler solution:
  1. Create a directory named ~/.cache/gnome-control-center/backgrounds.
  2. Copy your wallpapers in there.
That’s it. However, this is not the official way, and stuff may happen to data stored in a subtree named .cache. Caveat utens.

Desert

For desert, here are five abstract wallpapers which anybody can use as wallpapers. Four of them are almost monochrome pixellations, and the fifth is a nice smooth gradient in Ubuntian colors; the difference between the last two pictures is simply that one is rendered at 3440×1440 and the other at 2880×1200.
 
 
 
(Pictures available on Flickr under the Creative Commons Attribution license.)

Saturday, 5 May 2018

Ubuntu 18.04: Replace snapped apps with their real selves

It all started with the System Monitor. The GNOME System Monitor is supposed to be able to show all the processes running on the system, and to show them in the form of a nice tree of parent-child relationships. But the System Monitor variant installed by default in Ubuntu 18.04 subbornly insisted on showing only my processes, and was utterly unable to show the parent-child relationships between them. It was also unable to distinguish between real filesystems and the forest of virtual filesystems mounted on any modern Linux system, which made the File Systems tab rather useless.

This was unacceptable.

A quick investigation resulted in a shocking conclusion: the preinstalled System Monitor was not a native application; it was a snap. Now I fully agree that snaps may well have their uses, although I’m not sure what those may be. But there is simply no way for System Monitor to do its job if it runs in a sandbox or a container; the hint is in the name: it’s a System Monitor.

Which made me consider than what should be done on server should also be done on workstations, and that is removing snapd. A quick dry-run test showed that removing it was allowed:
$ sudo apt-get --dry-run purge snapd
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  gnome-software-plugin-snap* snapd*
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
Taking heart from this test, I went ahead and removed snapd:
$ sudo apt-get --yes purge snapd
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  gnome-software-plugin-snap* snapd*
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
After this operation, 57.1 MB disk space will be freed.
(Reading database ... 115119 files and directories currently installed.)
Removing gnome-software-plugin-snap (3.28.1-0ubuntu4) ...
Removing snapd (2.32.5+18.04) ...
⁞
Removing snap core and revision 4486
⁞
Removing snap gnome-3-26-1604 and revision 59
⁞
Removing snap gnome-calculator and revision 154
⁞
Removing snap gnome-characters and revision 69
⁞
Removing snap gnome-logs and revision 25
⁞
Removing snap gnome-system-monitor and revision 36
⁞
Final directory cleanup
Discarding preserved snap namespaces
Removing extra snap-confine apparmor rules
Removing snapd cache
Removing snapd state
So it’s plain to see that not less than four pre-installed applications came in the form of snaps; fortunately, it was easy to get them back in the form of fully-fledged native packages:
for app in calculator characters logs system-monitor; do
  sudo apt-get --yes --no-install-recommends install gnome-$app
done
Ah, and speaking of GNOME Characters: this is a mostly useless application intended for browsing the ever entertaining emojis in the available fonts; it is definitely not the same thing as the plain old boring and very useful character map, which, for reasons known only by the GNOME steering committee and Canonical, does not come preinstalled. To get it you must install it:
sudo apt-get --yes --no-install-recommends install gucharmap

Friday, 4 May 2018

Ubuntian colors

The default wallpaper shipped with Ubuntu 18.04 can be of course copied from any Ubuntu 18.04 installation, or downloaded from the ever helpful OMG! Ubuntu! By judiciously dividing the wallpaper into squares and averaging the colors in those squares one can compute specific values for the orange and mauve favored by this version of the operating system:


          #DD4814 Ubuntian orange as used by Ubuntu.com
          #E74D0D Ubuntian orange from the default wallpaper in 18.04
          #670545 Ubuntian mauve from the default wallpaper in 18.04
          #52023C Dark Ubuntian mauve from the default wallpaper in 18.04

Sunday, 29 April 2018

Drawing for the Web

When preparing content for the web, a common task is to create various line drawings, which need to be presented as images well integrated with the page. This means, for example, that any text present in the picture needs to have a similar size with the text in the body of the page, maybe a little smaller.

A little preparation goes a long way. Let’s consider a web page which uses a font size of 16px, and accepts pictures with a maximum width of 720px. How do we prepare a drawing to be included on the page?
  • Begin by deciding on a resolution for the drawing. I prefer to use metric units, so a nice resolution is 50 pixels/cm, or 127 pixels/inch; since this makes each CSS pixel in the future bitmap exactly 0.2 mm, so that a line thickness of 0.2 mm should be one CSS pixel, 0.3 mm one CSS pixel and a half, 0.4 mm two CSS pixels and so on. How many actual device pixels this is, it cannot be known; but browsers normally render web pages at simple ratios for device pixels per CSS pixels.
  • In these conditions, 16 CSS pixels, the chosen font size, is 9.07 pt; 15px is 8.50 pt almost exactly; and 14px is close to 8 pt.
Web size Resolution Drawing size Width for 720px
16px 127 pixels/inch 9.07pt 14.4 cm
15px 127 pixels/inch 8.50pt 14.4 cm
14px 127 pixels/inch 7.94pt 14.4 cm

Then there is the problem of transparency. Some web pages are shown with plain white backgrounds, but many prefer a pale colored background, to provide for a more pleasant experience for the readers, who quite often read the page in an environment with subdued light. This means that the picture must have a transparent background, and practically imposes choosing the PNG format.

The way do it is to have a dedicated color for the  background of the picture, something which is never used in the picture except as the background, and which will become transparent. #FFFFCC is a good choice. Export the picture to a higher resolution, taking care to tell your drawing program to avoid antialiasing; if we stick with the nominal 127 pixels/inch shown in the table above, then 762 pixels/inch (6 times higher) or even 1270 (10 times higher) works. Then,
  1. Open the exported bitmap in your favorite graphics editor, and make the chosen background color transparent.
  2. Resize the bitmap to the desired dimensions.
In these modern times we live in, it makes sense to prepare several versions of the bitmap, to cater for the massively different resolutions of display devices. When possible, have at least a version intended for display at the nominal 96 pixels/inch, and one at twice the resolution.

Saturday, 28 April 2018

SanDisk Ultra Fit USB 3.1 Flash Drive

The SanDisk Ultra Fit USB 3.1 flash drive is a tiny storage device, which fits neatly into a USB port; it is available with capacities ranging from a puny 16 GB to a massive 256 GB. It measures 19.1 × 15.9 × 8.8 mm and weighs about 5 grams; at least Amazon says that is weighs 0.16 oz, and who am I to disbelieve them? Amazon sells it for some 70 USD, while in Romania Media Galaxy sells it for 400 RON, which is about 25% too much even taking VAT into account.

The device is made of two kinds of plastic, a smooth translucent material for the looping handle, and a tough and rough material, probably some sort of composite, for the part which goes into the USB port. On the top side it bears the calligraphic logo of SanDisk, nowadays a subsidiary of Western Digital. On the bottom, it bears a minute inscription stating that it was made in China, the part number, and a serial number which is different from the serial number reported to the operating system.
The diminutive yet capacious SanDisk Ultra Fit 3.1 compared with a Romanian 50 bani coin.

Formatting and usable capacity

The device comes formatted with the FAT32 file system, with 32 KiB clusters, the sole partition occupying sectors 32 to 480509951. Usable capacity is 246,021,095,424, about 246 GB or 229.1 GiB, some 26.9 GiB or 10.5% less than the advertised 256 GiB. Presumably, the missing capacity is used internally for overprovisioning in order to help the microcontroller cope with the intricate management of flash storage.

Since the FAT32 file system cannot store files greater that 4 GiB, it may be recommendable to reformat the device with the exFAT filesystem.

Performance

Running Crystal Dew World’s CrystalDiskMark to test the performance of the flash drive provides a double surprise:
  • The sequential write speed is about 17 MB/second, which is quite decent for such a small form factor device.
  • The random access write speed oscillates between 0.6 and 1.2 MB/second, which is very decent for such a small device. What this means is one can run virtual machines off the flash drive without too much pain; it is definitely good enough to run a small Linux virtual server.
Read speeds are very high; sequential read speed is over 110 MB/second, and random access read speed approaches 8 MB/second.
CrystalDiskMark results for the SanDisk Ultra Fit 3.1. Note that the results vary between the runs, notably for small I/O operations.
For a real-life test, I copied 511 high-resolution photographs, totalling 3.9 GB, to and from the drive; the results were as follows:
  • Writing 3.9 GB of data in 511 files, varying between 2.5 and 10.5 MB in size, took 6′ 7″, coming to about 10.6 MB/second.
  • Reading 3.9 GB of data in 511 files, varying between 2.5 and 10.5 MB in size, took 43″, coming to about 90.7 MB/second.
In use, the flash drive becomes hot quite quickly; this is where the small form factor doesn’t help at all. After writing some 2.5 GB, the drive’s thermal management monitor kicks in and throttles the transfer speed; for data transfers of more than a few gigabytes expect the average write speed to drop to about 8 MB/second or thereabouts.
SanDisk, SanDisk Ultra, and Western Digital are trademarks of Western Digital Corporation.

How to install Ubuntu Server 18.04 LTS 32-bit

Recent versions of the Ubuntu operating system tend to avoid admitting that a 32-bit variant of the distribution exists. Yet for many use cases the 32-bit variant is highly desirable. Don’t worry, it exists and is supported. You can get the 32-bit network-based installer in two ways:
The network-based installer works almost exactly like the ordinary text-based installed, with the following differences:
  • The computer on which the operating system is to be installed must be connected to the internet, obviously.
  • In order to install supplementary software in the installation environment, you must first download it. For example, to install parted, you must first use wget to get it from the web:
    POOL=http://archive.ubuntu.com/ubuntu/pool/main 
    wget $POOL/p/parted/parted-udeb_3.2-20_i386.udeb
The network-based installed is not limited to installing the Server edition of the operating system; you can use it to install any flavor or edition, with the advantage that the installed operating system is fully up-to-date, of course, the software packages being downloaded fresh from the repository.