Páginas

Monday, February 18, 2019

Free Software for Web Analytics

This is a personal note. I've been looking for a Google Analytics replacement. These are alternatives to Google Analytics I came across today:

  • Nothing. Yes, nothing. Simply do not track anything, that may be the best way to go as it respects visitors' privacy.
  • AWStats: ugly for modern standards. Based on log files. I recall experimenting with this several years ago. It may be a fine solution to avoid adding JavaScript snippets to a site.
  • JavaScript-based and self-hosted:
    • Matomo (previously called Piwik): seems to be the best of its kind. Well maintained, full of features. Big focus on its commercial offering of hosted service. Matomo on GitHub.
    • Open Web Analytics (OWA): looks less fancy. Seems to be more community oriented, no business around. Open Web Analytics on GitHub.
    • Fathom: maybe the newest kid in the neighborhood. Built with Go and Preact (a smaller React-compatible JS library, first time I hear of it). Fathom on GitHub.
Other pieces of software might be worth a look. No software also deserves a lot of consideration.

See a list of web analytics software on Wikipedia for more.

Thursday, January 24, 2019

Installing Flutter and Android Studio on Fedora 29

Since neither Flutter nor Android Studio come as regular packaged applications, I am installing them under ~/opt/android. Android Studio installs the Android SDK at ~/Android/Sdk, and creates projects at ~/AndroidStudioProjects.

Download Flutter and Android Studio.

$ mkdir -p ~/opt/android

Android Studio installation

$ unzip ~/Downloads/android-studio-ide-182.5199772-linux.zip 'android-studio/*' -d ~/opt/android
$ cd ~/opt/android/android-studio/bin/
$ ./studio.sh

Follow the wizard accepting defaults.

Tools > Create Command-line Launcher, at ~/bin/studio.
Tools > Create Desktop Entry

I did not install the libraries that are said to be required (zlib.i686 ncurses-libs.i686 bzip2-libs.i686). So far they did not seem to be missed.

Set up the Android emulator. I added two virtual devices, both are Pixel 2 with API 28, Android 9.0 with Google Play. One is x86 and the other is x86_64. Not clear which one will give better performance.

Flutter installation

$ tar -C ~/opt/android -xf ~/Downloads/flutter_linux_v1.0.0-stable.tar.xz flutter
$ ln -s ~/opt/android/flutter/bin/flutter ~/bin/
$ flutter doctor
$ sudo dnf install libstdc++.i686

I am a bit puzzled and hesitant to accept licenses that flutter doctor --android-licenses says need to be accepted.

4 of 5 SDK package licenses not accepted

They are:
  • 1/4: License android-googletv-license
  • 2/4: License android-sdk-preview-license
  • 3/4: License google-gdk-license
  • 4/4: License mips-android-sysimage-license
I guess I'll need to surrender :-(

Now on Android Studio, install the Dart and Flutter plugins.


Let the Android hacking begin!

Wednesday, January 23, 2019

Lenovo X1 Carbon 6th Gen - personal notes

Personal notes configuring my Lenovo X1 Carbon 6th Generation laptop.
The computer was bought in July 2018, and at the time there were unfortunate power management issues on Linux, as described in the Arch Wiki.

This post is based on simple notes I took while setting things up.

BIOS configuration changes


  • Disable WoL and UEFI network stack
  • Disable Wake by Thunderbolt 3
  • Disable Card Reader and Fingerprint Reader
  • Disable Computrace module activation
  • Enable Intel TXT security feature
  • Disable AMT (ctrl-P)

Install Fedora 28

Tune GRUB2 timeout for faster boots: edit /etc/default/grub, TIMEOUT=1

Power management

Trying to counter the suspend issue that caused the battery to drain very quick, IIRC in about one or two hours, with the laptop warm when the lid was closed., I went on to install some tools:

dnf install powertop
dnf install tlp tlp-rdw

https://linrunner.de/en/tlp/docs/tlp-linux-advanced-power-management.html#fedora

sudo dnf install akmod-tp_smapi akmod-acpi_call
sudo dnf install smartmontools

sudo vi /etc/defaults/tlp RESTORE_DEVICE_STATE_ON_STARTUP=1

I believe these are not necessary with newer kernels and newer BIOS firmware (currently on 1.34).

Other configuration

Configure name, and background and lock screen

$ hostnamectl --static set-hostname crater.local

Install RPM Fusion repos
Install Dropbox

To get the Dropbox icon on the top bar, install (K)StatusNotifierItem/AppIndicator Support

After about 6 months of usage

The few notes in this post baked for a long time. Now, about 6 months since I unboxed the laptop here's what happened:

  • I have used the laptop very lightly while travelling
  • Was very frustrated for not being able to suspend
  • Suspend issue was fixed by BIOS 1.30, got the upgrade through Gnome Software Center and LVFS
  • There was a growing discontent with Thunderbolt 3, it seemed that enabling it caused boot times and wake from sleep extremely slow, taking 30+ seconds in both cases
  • I have upgraded to Fedora 29
  • At around 20:48 UTC on Jan 6, 2019 the laptop produced its last log line and would not boot anymore
  • On the following day, Monday, I contacted the Lenovo support to claim my warranty, and started a lengthy process until I got my machine back from their repair center on Jan 22
  • They had to replace the motherboard, dead. The note said "reset problem"
  • I upgraded the BIOS on the new motherboard (was 1.27) to 1.34 and the Intel ME firmware (was 11.8.50.3425) to 11.8.55.3510
  • Fine tuned BIOS settings, and thus far have not observed the slow boot/wake up like in the faulty motherboard:
    • Disable Wake On LAN
    • Disable UEFI Networks Stacks
    • Power > Sleep State = Linux
    • Thunderbolt BIOS Assist Mode = Disabled (not changed from factory, until I determine if enabling is really needed with the current firmware/kernel combination)
    • Disable Wake by Thunderbolt
    • Disable Intel AMT by pressing ctrl-p when the Lenovo logo shows up, then set a MEBx password and disable AMT management features (I so much wish Intel ME and all other features were not there in the first place...)
    • Enable Virtualization features
    • Disable ports: Ethernet LAN, Wireless WAN, Memory Card Slot, Fingerprint Reader
    • Disable Computrace
    • Keep Secure Boot disabled
    • Disable Intel SGX
    • Boot only using UEFI, disable CSM

I hope the system will survive more usage.

Friday, July 20, 2018

How Complex Systems Fail

Highlights from How Complex Systems Fail:


  • Title) How Failure is Attributed to Proximate Cause
  • 1) It is the presence of these hazards that drives the creation of defenses against hazard that characterize these systems
  • 2) multiple layers of defense
  • 3) Catastrophe requires multiple failures
  • 4) Eradication of all latent failures is limited primarily by economic cost but also because it is difficult before the fact to see how such failures might contribute to an accident
  • 5) complex systems run as broken systems
  • 5) The system continues to function because it contains so many redundancies and because people can make it function, despite the presence of many flaws
  • 6) It is impossible to eliminate the potential for such catastrophic failure
  • 7) Post-accident attribution accident to a ‘root cause’ is fundamentally wrong
  • 7) There are multiple contributors to accidents
  • 7) social, cultural need to blame specific, localized forces or events for outcomes
  • 8) Knowledge of the outcome makes it seem that events leading to the outcome should have appeared more salient to practitioners at the time than was actually the case
  • 8)  It seems that practitioners “should have known”
  • 9) dual roles
  • 9) Outsiders rarely acknowledge the duality of this role
  • 11) After an accident, practitioner actions may be regarded as ‘errors’ or ‘violations’
  • 11) biased by hindsight and ignore the other driving forces, especially production pressure
  • 13) Human expertise in complex systems is constantly changing
  • 13) need to replace experts who leave
  • 14) Change introduces new forms of failure
  • 14) overt: open and observable
  • 14) use of new technology
  • 14) decrease the number of low consequence but high frequency failures
  • 14) create opportunities for new, low frequency but high consequence failures
  • 14) Not uncommonly, these new, rare catastrophes have even greater impact than those eliminated by the new technology
  • 14) hard to see the contribution of technology to the failure
  • What to do? Freeze a system from all and any change?
  • 15) post-accident remedies usually increase the coupling and complexity
  • 16) Safety is a characteristic of systems and not of their components
  • 18) Failure free operations require experience with failure
  • "Game day" and failure injection



Learning vi: mental notes

Though I use vi here and there for several years now, there's always some new trick to learn.
Lately I've had on my desk the book Learning the vi editor by Linda Lamb, published by O'Reilly.

Here I list, in no particular order, some notes as a way to reinforce what I've learned from the book. The focus is on things that called my attention, were new to me and/or that were not internalized yet in my day-to-day usage.


vi versus/and ex

ZZ = save and exit = :wq (ex command)
:e! = reload from disk
~ = toggle case
xp = transpose two characters

0 = go to beginning of line (same as ^)
W = move to the beginning of the next word, ignoring punctuation
B = move to the beginning of the previous word, ignoring punctuation
e = move to the end of the next word
E = move to the end of the next word, ignoring punctuation

. = repeat last command
Y = yy
P = put text before cursor
D = d$
C = c$
X = delete character before cursor
cc = change line = ddO = 0D
"3p = put contents of buffer number 3 (not the last buffer)
U = undo all edits on a single line
A = append at the end of the line
I = insert at the beginning of the line
s = c+space = xi = substitute character
S = cc = substitute line

50i* = insert 50 times *

ea = append to the end of a word
J = join consecutive lines