Sunday, November 28, 2021

Controller Button Layout

The Playstation controller, especially the Dual Shock controller from the PS4, is my preferred controller.  It has a typical 4 action buttons layout which uses symbols to identify each button.  

  △ 

○   □

  ×

I've developed muscle memory for I expect each button typically do which makes switching between Playstation and Nintendo games a bit of a pain since they have the confirm/decline button switched from each other.  Fortunately, each offers to let you remap the behavior for it.  While this work for system settings, each game might have a different behavior assigned to each button so I normally try to map them all into a consistent behavior.  My typical button configuration is as follows:

△ - heavy hit/special attack/switch characters

O - normal hit

X - jump/OK/confirm

▢ - cancel/decline/action

R1 - dash/evade

Controllers from Nintendo, Microsoft Xbox and Google Stadia use alphanumerical values (A, B, X, Y) for their buttons.  While XBox and Stadia have the same button names, Nintendo has a different layout which means that I never remember which is the A & B and which is the X & Y.

Stadia/Xbox:

  Y

X   B

  A

Nintendo:

  X

Y   A

  B

Monday, November 22, 2021

Cleaning and Removing Mold with Borax

 This is a reminder post for myself on the mixture solution for using Borax to clean and remove mold.

  • 1 cup of borax
  • 1 gallon of hot water
Mix the borax with the water and spray on affected area, scrub, wipe and dry area.  Do another light spray on the area and let it dry on its own.

Sunday, November 21, 2021

Thoughts on Shang-Chi and the Legend of the Ten Rings

 


Shang-Chi and the Legend of the Ten Rings got a lot of positive buzz so I watched it when it came out on Disney+.   As expected of a super hero movie in the MCU, it delivers its share of action and comedy.  It is notable that a movie centered around a hero of Asian decent with a story line that stays within an Asian sphere that it had a predominantly Asian cast.  The film aimed to respect the Chinese culture and avoided the use of outdated stereotypes.  Multiple articles have pointed out the cultural significance of this movie.

Shang-Chi will be most identifiable to Asian-Americans (or those of asian descent who grew up in western cultures) because the film is still looking at Asian culture through a Western perspective.  For example, although respectful in its view of the philosphy and people of a hidden village that is meant to represent traditional Chinese culture (even though technically the people are aliens), there are many manerisms that are clearly western (hugging as a greeting), but it is still reflective within the Asian-American experience so it's not something to criticize. 

While I enjoyed the movie for what it is, a superhero film, I also felt the movie was too rushed and wasn't able to imbue Shang-Chi with the inner qualities of a hero before the movie ended.  Instead, Shang-Chi is the superhero of the movie because he got super powers, used those powers and won a fight against the big baddie.

As a person, Shang-Chi never overcame blaming his father nor displayed the empathy and support that those around him showed him.  While angry at his father for making him train in the martial arts, the movie made it very clear that his father was not cruel and did raised him through fear as Thanos did with his own "children".  The movie also made made it clear that his father did made a concerted effort to atone for his past and that while that was recognized by Shang-Chi's mother, Shang-Chi does not attempt to consider it even though he is grown up and has had distance to reflect.  I'm not saying that the father is absolved of his wrong doings and he did fall back to his old ways, but this is a movie aboug Shang-Chi and not about his father.

Instead, Shang-Chi goes from saying how having to kill made him run away from his father to saying that he must kill his father in the same scene.  I found this lack of taking personal accountability and blaming others especially surprising as this difference is what was shown to separate  Captain America and the Patriot as shown in Falcon and the Winter Soldier.

Ultimately, this made me a little unsure about the character of Shang-Chi.  As a movie, I like the actors, the filmography, the respect it showed the Asian culture as well as the action and comedy that the MCU brings.  I do look forward to seeing more and hope that they will take more time in the next movie to develop the real "hero" aspects of Shang-Chi.

Upgrading to Fedora 35

Used Fedora DNF upgrade method to go from Fedora 34 to 35.  Didn't noticed any issues with the upgrade.   I decided to do the upgrade even though I just upgraded a couple of weeks ago to Fedora 34, but since I had some free time this week I decided to upgrade now when I have time to deal with any issues.  

Tuesday, November 2, 2021

Upgrading to Fedora 34

Although Fedora 35 just came out, I decided to first upgrade to Fedora 34 and give Fedora 35 a little bit of time to bake.  I've had good success using the regular Fedora DNF upgrade method, but this is the first time I've upgraded Fedora on my current machine because it was a new system so it only ever had Fedora 33 installed.

Didn't run into any immediate issues that I can tell.

Monday, November 1, 2021

Unable to access the internet when using PiHole?

PiHole added rate-limiting for DNS queries to a very low 1000 queries per minute and enabled it by default even when updating an existing installation.  To change the rate limit (or turn it off), edit /etc/pihole/pihole-FTL.conf and add/edit the line: 

RATE_LIMIT=0/0

The format is [# of queries]/[seconds] so to set a limit of 1000 queries per hour would be 1000/3600.

Friday, April 9, 2021

Keep Go Module Directory Clean with GOMODCACHE

Go makes downloading projects and their dependencies very easy.  In the beginning there was go get which will download the project source code and its dependencies to $GOPATH/src.  With modules, all the dependencies are downloaded to $GOPATH/pkg/mod.  The ease of downloading and the lack of management control in the go command means that is easy for the two directories to grow in size and to lose track of which project led to the download of a particular package.

I recently started to play around with the Fyne UI toolkit.  I didn't initially know what other packages it would download so I wanted to have Fyne and its dependencies in their own area.  The go command has a flag -pkgdir that is shared by the various commands.

The build flags are shared by the build, clean, get, install, list, run, and test commands:

...

-pkgdir dir

install and load all packages from dir instead of the usual locations. For example, when building with a non-standard configuration, use -pkgdir to keep generated packages in a separate location.

This didn't work as I expected because it didn't seem like it did anything at all.  Using the command

go build -pkgdir /tmp

resulted in all the downloaded package still going to $GOPATH/pkg/mod.

What did work (thanks to seankhliao) is to set the GOMODCACHE variable which sets more then the cache location but also the package location:

GOMODCACHE=/tmp go build

All the downloaded dependency packages will now be downloaded to /tmp rather then $GOPATH/pkg/mod.  

Honestly, I'm not really sure what -pkgdir is really suppose to do.  Maybe it is only for things that the build command generates?  Why does it do when using with go get?

Wednesday, April 7, 2021

Local Go module file and Go tools magic

I really value that when working with Go there are no "hidden magic" in source code.  Go source code are essentially WYSIWYG.  You don't see decorators or dependency injections that might change the behaviors after it is compiled or run that requires you to not only have to understand the language and syntax but also having to learn additional tools' behavior on the source code.  While this is true of the language it is not true of the go command for Go's module system.

I've personally found Go modules to be more confusing then the original GOPATH.  I understand that it solves some of the complaints about GOPATH and also addresses the diamond dependency problem, but it also adds complexity to the developer workflow and under-the-hood magic. Maybe that's to be expected when it is going beyond source code management and adding a whole package management layer on top, but I'd be much happier to have to deal with this added complexity and burden if the solution was complete (how about package clean up so my mod directory isn't growing non-stop?)!

Modules adds the go.mod file that tracks all a project's dependencies and their versions.  This introduces a problem when one is developing both applications and libraries since it is possible that the developer have both the released production version and in-development version of libraries locally.  To point your application at the library without constantly changing the import path in source code, the replace directive can be used, but when committing the code it is not ideal to submit the go.mod with the replace directives in it as it will likely break the build for someone else checking out the code and can expose some privacy data (the local path that might contain the user name).

Now developers have to add the replace directives locally, remove them right before submission and then put them back (without typos!).  Fortunately, in Go 1.14, the go commands (build, clean, get, install, list, run, and test) got a new flag '-modfile' which allows developer to tell it to use an alternative go.mod file.  The allows a production version of go.mod file to not have to be modified during development/debug and a local dev version of go.mod that can be excluded from getting committed (i.e. .gitignored).  

This can be done on a per-project level by adding -modfile=go.local.mod to go [build | clean | get | install | list | run | test]:

go build -modfile=go.local.mod main.go

Note that whatever the file name is, it still has to end on .mod since the tool assumes to create a local go.sum mod based on a similar name as the local mod file except with the extension renamed from .mod to .sum.

To apply the use of go.local.mod globally, update "go env":

go env -w GOFLAGS=-modfile=go.local.mod

go env -w will write the -modfile value to where Go looks for its settings:

Defaults changed using 'go env -w' are recorded in a Go environment configuration file stored in the per-user configuration directory, as reported by os.UserConfigDir.

So the flow that Jay Conrad pointed out in this bug thread would be as follows:

  1. Copy go.mod to go.local.mod. 
  2. Add go.local.mod to .gitignore.
  3. Run go env -w GOFLAGS=-modfile=go.local.mod. This tells the go command to use that file by default.
  4. Any any replace and exclude directives or other local edits.
  5. Before submitting and in CI, make sure to test without the local file: go env -u GOFLAGS or just -modfile=. 
  6. Probably also go mod tidy.

Tuesday, April 6, 2021

Listing installed packages on Fedora with DNF

To list the packages that are user installed:

dnf history userinstalled

To list all installed packages:

dnf list installed

Saturday, March 27, 2021

ASUS PN50 4300U as a portable system

I needed a computer for a remote location.  It would be used only for short periods of time a few times a year so it is not worth it to invest in a high end system, but it still needs to be powerful enough to do my work (including basic gaming for the kids).  In a more normal time, I might simply build a basic system for about $500, but the shortage of electronic components means many items are simply not available or have sky rocketed in price so that even low end systems now cost too much to build to make them worth it.

I considered getting a laptop but decided that a mini-pc fits this need better.  I am able to use it at home but can easily transport it to the remote location when needed.  My experience with the Asus PN50 has been very good so I decided to go with it again.  This time I opted for the lowest end model that uses the Ryzen 4300U with 4 cores/4 threads running at 2.7 GHz (base)/3.3.7 GHz (boost).  I went with just a single stick of 8 GB 3200MHz Crucial SODIMM and 500GB M.2 NVMe SSD.

For the monitor, I got a Lepow Z1-Gamut (2021) portable USB-C monitor.  It is easy to transport but also able to use at home.

  • $330 (PN50) 
  • $75 (storage)  
  • $46 (memory)
  • $160 (monitor)

Total cost came to $611 with no OS.  The price is reasonable given the current state of the world and portability it provides.  Note that if you don't have a keyboard or mouse, you'll need to provide one yourself.  I'm using it with a Logitech K400 Plus wireless keyboard that also has a track pad built in.  The keyboard is light and portable as well.

I had no problem setting up my previous PN50 with Windows and Linux, but did run into an issue with this particular unit when installing Windows 10.  During the installation, the lower part of the monitor was distorted.  I tried this on both the Lepow and on a existing monitor that I know worked.  The problem appeared on both.  I was still able to see the menu and install choices and the problem went away once the installer rebooted into configuration screen.  

Initially, Windows complained that it couldn't install to the drive and I worried that either the drive was bad or the memory was bad.  The ASUS BIOS doesn't normally show memory and it doesn't make it clear what drives it sees so it wasn't helpful in determining where the problem was.  I just took everything out and re-inserted everything.  This time, the installation worked.

After Windows finish installing, I couldn't access the internet through the ethernet connection to download anything and Windows itself couldn't get any updates and drives.  Ping/tracert from the command line worked but apps that tries to access the internet did not work.  I searched on Google, but none of the solution I found worked for me.

I had to use WIFI and that worked to get all the updates, drivers and patches.  Once those were all installed, using the Ethernet connection worked.  With Linux, I didn't experience this problem.

The Lepow monitor worked both through the USB-C and HDMI.  Using the USB-C, the video and power can be handled with a single cable between it and the PN50.   A problem occurred when it started to display something.  There was a whining sound coming it but it goes away if the brightness is turned up to 100% (the default setting is 30% - 50%).  Besides this issue, everything else worked as expected.

I'm not really sure why it was more troublesome installing this PN50.  Besides the CPU, the other difference with the PN50s I already own is the version of the BIOS so it is possible that the drivers on the Windows installation tool does match with this PN50 or its BIOS version.  I wish the BIOS settings were more descriptive, but fortunately everything ended up working and I didn't have to exchange any of the parts.

Boot time has been surprisingly slow from when the power button is pushed to when the Windows spinner shows up.  I can play Genshin Impact at medium graphics settings and I can run Tomb Raider at normal settings.  Although I don't think another 8 GB might help for running games on this CPU, it might help with running multiple apps in Windows so I'm thinking of getting another 8 GB to fill out the memory slot and then hopefully I'll never had to open up the case again!  Update:  I ended up getting another 8GB so it's now running 16GB of memory.

The Ryzen CPU supports up to 3200 MHz memory and that's what I got, but based on some benchmarks that others have published it doesn't seem like the 4300U benefits much from it vs 26xx MHz memory.  In this case, the 3200 was actually a few dollars cheaper then the 26xx ones so I went with 3200 anyway.