Friday, December 27, 2019

Restore loading blue circle throbber in Firefox

Since Firefox 57 the loading icon has changed. Previously you’d see a blue circle spinning, now you see a dot moving horizontally. Personally, I prefer the old one.

So there’s this tip I found a while in the fantastic /r/FirefoxCSS Reddit, which restores the old throbber. Fortunately, Firefox developers kept the old animation file within the package, so we can still use them.

The following CSS must be added to “userChrome.css” file:

/* Revert tab throbber - for Nightly 57 as of 9/20/2017 */
.tab-throbber[busy]::before {
  background-image: url('chrome://global/skin/icons/loading.png') !important;
  animation: unset !important;
}
.tab-throbber[busy]:not([progress])::before {
  /* Grays the blue during "Connecting" state */
  filter: grayscale(100%);
}
@media (min-resolution: 2dppx) {
  .tab-throbber[busy]::before {
    background-image: url('chrome://global/skin/icons/loading@2x.png') !important;
  }
}

The “userChrome.css” is located in your Firefox profile folder. If it doesn’t exist, you can create it. Also, make sure it’s loading is enabled.

Thursday, October 17, 2019

Override Chrome policy in Linux

If you happen to have Google Chrome settings managed by your network administration, on Linux, the fixed settings are stored into JSON files in the folder:

/etc/opt/chrome/policies/

If you have write permissions, you can change the settings you want. You don’t even need to restart Chrome to the changes start working. This has been tested in Chrome 77.

Wednesday, October 16, 2019

Let Go website generate your documentation

When trying to figure out how go doc command works, I just found out that I don’t need to use it.

There’s an incredible feature of Go documentation website: it can generate and display the documentation of all your project, straight from GitHub – and other websites too. The generated HTML is very polished.

To use it, append your GitHub user name and repo to their URL, such as:

https://godoc.org/github.com/username/reponame

Even more interesting: all types and Go built-in types are automatically linked. And it also provides direct links to GitHub source files. On top of all that, it’s very fast. Written in Go, I suppose.

Being a C language admirer, the more I work with Go, the more I like its simplicity.

Wednesday, October 9, 2019

Using Go modules in separated local directories

Suppose I have a Go project, “foo”, which writes to the console. In this project, I have some .go files which have all the functions that actually write to the console.

Now I want to make these writing routines a separated module: “writer”, in another directory. I want two sibling directories: “foo” and “writer”. The “writer” will be used as a dependency within “foo”.

Within “writers” folder, run go mod init writer to create the go.mod file. Back in “foo”, edit its go.mod adding the new dependency:

module Foo

go 1.13.1

require (
  shoutergo v0.0.0
)

replace (
  shoutergo => ../shoutergo
)

The replace line will inform Go where to look for the module. Without it, Go will search in the internet, that’s why GitHub URLs work right away.

The version of the dependency, as far as I could find, is a Git tag, and to local modules it’s completely irrelevant, although necessary.

Now, in “foo”, we can import “writer” just like any other package:

import (
  "writer"
)

func main() {
  writer.SomeFunc()
}

As I keep learning Go and exploring the limits of the language, although I’m not entirely satisfied – lack of enums and namespaces –, I’m very pleased with its design choices with opted for simplicity. Feels like a better C.

Thursday, October 3, 2019

How Go caches downloaded packages

Here I intend to summarize how the Go package cache system works, after spending half of my afternoon running tests and figuring out this weird thing.

First off, to create a new Go project outside the awful GOPATH directory, you run:

mkdir my-project
cd my-project
go mod init my-project

This will create a go.mod file.

To add a dependency from GitHub, you run:

go get github.com/username/reponame

This will create a go.sum file, which contains the dependency tree. The package files themselves will be downloaded and buried within ~/go/pkg/mod directory, so they are effectively cached at global, machine-wide scope.

To list the packages inside my-project, run:

go list ./...

This won’t list globally downloaded, cached dependencies installed with go get.

To list the packages installed (not the cached ones) globally, run:

go list ...

Downloaded dependencies will be listed if you are in my-project folder, and if they have been downloaded already. If you run the command above from within a project directory, it will download and install any missing packages for current project, and then they will be listed.

So, if you’re outside my-project directory, there’s no way to list globally cached packages.

There’s no way to remove a globally cached package from cache individually. All you can do is delete the whole cache, with:

go clean -cache -modcache -i -r

Tuesday, October 1, 2019

CSS grid with column flow, with a nested grid

This month I was trying to layout a very complex form in two columns, and I ended up with this CSS sorcery. It’s important to notice that the number of columns and rows must be tightly controlled via their widths and heights.

Friday, September 20, 2019

The joy of Git Submodules

I’ve been using Git Subtrees for more than two years to manage the dependencies of my projects in Git. Today I found this article explaining Git Submodules, and I realized that I had it all wrong. Submodules suits my needs much better.

I finished migrating my C++ repositories which have WinLamb as a dependency. The nested “winlamb” folder effectively acts as a separated repository, without interfering with the top one. No more annoying merges with a huge hash as the commit message, when updating the library.

Monday, September 16, 2019

Rust for C++ programmers in 30 minutes

From time to time I get back to studying Rust, which looks like a good alternative to the unthinkable complexity of C++ for native programming, which even after about 20 years, still upsets me tremendously. From the perspective of a seasoned C++ programmer like me, the Rust concept of lifetimes has been particularly esoteric.

Fortunately, I found a great resource online today:

30 minutes of Introduction to Rust for C++ programmers

It’s a very concise online book with direct comparisons between C++ and Rust codes, exactly what I was after. It explains Rust basic concepts by direct comparison to C++, what greatly helps. Although you’ll need a little over 30 minutes to properly digest it, it’s well worth reading, and I consider to be the greatest introductory material so far to C++ programmers who want to dig into Rust.

Props to vnduongthanhtung, who authored the book back in 2017.

Monday, September 9, 2019

A new custom gauge for the backbowed Majesty

I’m having some trouble while setting up my new Music Man Majesty. It seems that Music Man applies some kind of pre-tension to the mahogany neck so it backbows, to counterweight the .010 strings that come stock with the guitar. Looks like a bad design decision to me, I wonder: isn’t it what the truss rod is for?

Since the guitar is hard-set to .010 gauge, my custom .008 is causing a strong backbow, with the 5th and 6th frets buzzing like crazy in all 6 strings, even with the truss rod completely loose. But I’m really enjoying the neck profile and the overall feeling of the Majesty, so I’m trying to work it out.

My current gauge is .008 .009 .011 .021 .030 .038, which I use in the Ibanez JPM and the Suhr Modern Satin without any problems. The Suhr setup is particularly perfect.

So yesterday I rescued the two heavier strings from the .009 D’Addario set I had thrown into the trash bin, and now I’m trying .008 .009 .011 .021 .032 .042 on the Majesty, with the hopes that the heavier strings from the .009 set will pull the neck forward and alleviate the backbow.

Plot twist: A couple weeks later, measuring the neck relief, I found out that the neck wasn’t backbowed, but very close to straight. The real problem was, probably, a raised 7th fret, which made the 6th fret unusable. Being an expensive instrument with stainless steel frets, I found it to be unnaceptable.

Tuesday, July 2, 2019

Goodbye Eclipse

I received my ESP Eclipse II Silver Sparkle in February 14 of this year, as part of my Les Paul craze. Today, almost 5 months later, I posted it on the mail after selling it out.

It’s a bit sad, because it was a great guitar. Way more comfortable than my previous Gibson Les Paul Studio, which I had back in 2014. The neck felt very comfortable, but it helped me understanding how I prefer flatter neck radiuses. The ESP has a 12” fretboard, which felt a world of difference from my Suhr, which is close at 14”. The ebony fretboard was very smooth, but I missed the stainless steel frets. All that not mentioning the incredible looks of this guitar, shiny all around – one of the main reasons that made me buy it.

This ESP had an EMG 81 in the bridge, and an EMG 85 in the neck. I swapped them, and the guitar sounded much more balanced. The cleans were beautiful, but somewhat overcompressed, it was hard to tweak a proper clean tone for rhythm parts.

This ESP had the D string slot very low, the open D was buzzing. I played my sole gig with this guitar having the nut like that, improvising paper shims inside the nut slots. I replaced this nut with a new bone nut soon after.

In the sole gig I played with it, in March 23, it felt very heavy on my shoulder. Also, it made me do a lot of mistakes, probably because of the different position the Les Paul shape puts you in, and the rounder fretboard radius. Since then, I played no other gig. And I realized I’m not playing it anymore. Saddened, I decided to sell it. And it was gone today. And I must say, despite everything, I miss it.

Now, I hope my Les Paul craze go away.

Thursday, June 27, 2019

Personal key YouTube page links

Once logged in, these links will take you to key YouTube pages:

/comment_history Comments you wrote.
/my_liked_videos Videos you liked.
/my_videos Videos you uploaded.
/subscribers People who subscribed to your channel.
/subscription_manager Manage the channels you have subscribed to.
/view_all_playlists Playlists you created.

Sunday, June 16, 2019

The weight of my guitars

It finally happened.

After an awful amount of time wondering, I finally managed to temporarily steal a precision weighing scale from my girlfriend’s kitchen, and finally find out how much my guitars weigh. Here are the results of my current guitars, updated:

Year Model Weight (kg) Weight (lbs oz) Weight (lbs)
2012 ESP Eclipse II silver sparkle 3.75 kg 8 lbs 4 oz 8.25 lbs
1996 Ibanez UV7BK 3.63 kg 8 lbs 8 lbs
1997 Ibanez JPM P2 3.52 kg 7 lbs 12 oz 7.75 lbs
2014 Music Man JP6 silver sparkle 3.45 kg 7 lbs 10 oz 7.6 lbs
2016 Music Man Majesty arctic dream 2.95 kg 6 lbs 8 oz 6.5 lbs
2013 Suhr Modern Satin natural 2.77 kg 6 lbs 2 oz 6.11 lbs

I actually tought the JPM was lighter, and the Eclipse was heavier. The Modern Satin is, indeed, a very lightweight guitar.

The JP6 silver sparkle was said on Reverb to weigh 7 lbs 14 oz, or 3.57 kg, which was actually wrong.

Monday, May 27, 2019

Clean tones of ESP Eclipse II with EMGs

In another chapter of my Les Paul craze, hoping for something more comfortable than my previous Gibson Les Paul Studio, which I had back in 2014, I bought an amazing-looking ESP Eclipse II, in silver sparkle finish. Realy eye-catching. A Japanese one, not the LTD crap.

I’m very pleased with the EMG pickups. Originally this guitar probably had a Seymour Duncan JB/59 set, and they were replaced by EMG 81 (bridge) and 85 (neck). However, I noticed the 85 is higher output and also it has a lot more bass, so I swapped both pickups. This EMG system is great: once you have the circuit installed, the pickups can be changed quickly by detaching the cables. Now, with the 85 at the bridge and the 81 at the neck, the guitar sounds very balanced.

As for the comfort, it’s not bad as my old Gibson, but definitely it’s not a comfortable guitar. The neck made me realize how much I like finished necks, and the ebony fretboard is sweet. Other than that, I played only one gig with it, and it felt very awkward on my shoulder. I guess I’m a superstrat player, definitely.

Friday, May 17, 2019

Tornado of Souls solo

About one year ago I recorded the solo from “Tornado of Souls”, by Marty Friedman, from the classic Megadeth album “Rust in Peace”, from 1990. I’ve seen many people saying that it’s the hardest Megadeth solo, so I decided to incorporate it into my band’s set list, by replacing the “Hotel California” solo, after noticing some theming similarities. The result is pretty great. Unfortunately, in my band gigs, I hardly find someone who can appreciate the effort I put in learning it.

Anyway, this is the take I recorded about one year ago, using my Suhr Modern Satin, which I’m rather disliking the thin tone these days.

Friday, February 8, 2019

Chrome 72 annoying F6 key behavior

On all browsers, since immemorial times, I’ve been using the F6 key to go to the URL bar and select the whole URL. My current browser is Google Chrome, which in its version 72 changed the behavior of this F6 key, which now puts the focus on the tabs or somewhere else. You have to hit the F6 key twice in order to focus the URL bar.

And I’m not the only one who noticed this:

Fortunately, there’s a bug to the issue:

I wonder who in the hell decides changes like this. I’m seriously pissed about this change, and already considering go to Firefox, which I already use at work. I really hope they revert this stupid nonsensical change. Stop fixing what isn’t broken.

Follow up: I just installed Chrome 74.0.3729.108, and the F6 key is working properly again. Such a relief.

Thursday, February 7, 2019

A very simple, raw Win32 WinLamb program

Months ago I noticed that WinLamb was missing a simple, introductory example. I never really had time to write and publish one. Until today.

Click lines is a very simple program, inspired by Charles Petzold, which draws lines upon mouse clicks. Just this. It’s intended to be a very simple showcase of WinLamb, showing how to create raw windows, raw custom controls, and handling messages. I usually use dialog boxes on my real-world programs, but for this one I really kept it bare-bones, with no dialogs.

I hope it can be useful to anyone interested in WinLamb.

Thursday, January 24, 2019

Git commit with specific date

Very interesting Git option I just found: --date. When making a commit, you can specify the date manually. However, if you make a new commit with a past date, it will still be shown as the last commit, even with a date prior to the previous commit.

A new commit at January 1, 2019, 12:00, specifying timezone UTC-2:

git commit -m "Comment" --date="2019-01-01T12:00:00-02:00"

Changing the date of the last commit, using UTC+0 as timezone. Will be prompted to write the comment:

git commit --amend --date="2019-01-01T12:00:00Z"

This goes hand-in-hand with this current date trick.

Friday, January 11, 2019

Node.js script to kill a JBoss instance

I’ve been dealing with consecutive JBoss restarts lately at work, and I needed a quick way to kill a running JBoss server instance. First I wrote a PHP script, but then I translated it to JavaScript, so it could run upon Node.js, which I’m using a lot lately.

I’m using it a lot.

Tuesday, January 8, 2019

Reading a file line by line in JavaScript and Node.js

While writing a small Node.js utility in JavaScript, I needed to read a text file from disk, line by line, into a string array. I wrote a small utility function to this task, which is async, returning a Promise.

Usage is pretty straightforward:

const readLines = require('./readLines');

async function foo() {
  const lines = await readLines('myFile.txt');
  console.log(lines.length);
}