Wednesday, April 10, 2019

“it’s not a superior education, but a superior peer group”

A Bloomberg opinion piece by states

These results suggest that “it’s not a superior education, but a superior peer group” that makes the difference for high-performing students, said Lisa Barrow, one of the authors of the Chicago study and a senior economist at the Federal Reserve Bank of Chicago.

which includes references to a few related studies. Worth further reading!

Saturday, March 9, 2019

Pre-defined Compiler Macros

Found this today,

that documents pre-defined compiler macros for standards, compilers, operating systems, and hardware architectures.

Go to the following page, and you will see why it is very useful!

Saturday, January 26, 2019

Laptop BIOS Reports "Fan Error"

A laptop computer of mine suddenly reports "Fan Error" during boot with a loud beep. One solution is obviously to replace the fan assembly. In this particular case, I found out that when I reapplied the thermal paste, and the "Fan Error" went away.

If you encounter this problem and happen to have some thermal paste with you, perhaps, you should try this method first. By the way, drug store-sold 91% Isopropyl Alcohol is excellent for removing old thermal paste.

Thursday, January 17, 2019

Cannot Eject USB Drive on Windows

It has frustrated me a great deal that I sometimes cannot eject USB drives on Windows. What really worked for me is the answer this superuser thread. The answer for me isn't to use the Sysinternals tools, and questionable 3rd party tools like unlocker. Rather, the answer is to use the Windows Event Viewer as pointed out by an answer in the thread. In my case, what has prevent the USB drive from being ejected is the Windows Task Manager, and I am not alone!

Tuesday, January 15, 2019

Replacing Corrupt Hard Drive for FreeNAS

An ATA hard drive can fail without being detected by the SMART system in time. At a FreeNAS 11 system I observe when this happens, the drive disappears from the zpool disk list while FreeNAS reports an alert typically like the following,

The volume MyZpool state is DEGRADED: One or more devices has been taken offline 
by the administrator. Sufficient replicas exist for the pool to continue 
functioning in a degraded state.

Since the disk drive disappears from the zpool disk list, the method to replace the disk drive in the FreeNAS guide won't work -- after you replaced the corrupted hard disk drive, if you bring the disk drive online, the disk will be "UNAVAIL"; and if you attempt to replace it via the FreeNAS's Web interface, there will be no disk for you to choose from. If you run "zpool status", you will observe a long sequence of digits instead of the partition as the following example:

$ zpool status
  pool: MyZpool
 state: DEGRADED
status: One or more devices could not be opened.  Sufficient replicas exist for
        the pool to continue functioning in a degraded state.
action: Attach the missing device and online it using 'zpool online'.


        NAME                                            STATE     READ WRITE CKSUM
        MyZpool                                         DEGRADED     0     0     0
          raidz2-0                                      DEGRADED     0     0     0
            gptid/11111111-2222-3333-4444-555555555555  ONLINE       0     0     0
            gptid/22222222-2222-3333-4444-555555555555  ONLINE       0     0     0
            99999999999999999999                        UNAVAIL      0     0     0  was /dev/ada2
            gptid/33333333-2222-3333-4444-555555555555  ONLINE       0     0     0
            gptid/44444444-2222-3333-4444-555555555555  ONLINE       0     0     0
            gptid/55555555-2222-3333-4444-555555555555  ONLINE       0     0     0

errors: No known data errors

  pool: freenas-boot
 state: ONLINE
  scan: scrub repaired 0 in 0 days 00:10:03 with 0 errors on Tue Jan 15 03:55:03 2019

        NAME        STATE     READ WRITE CKSUM
        freenas-boot  ONLINE       0     0     0
          da0p2     ONLINE       0     0     0

errors: No known data errors

The method to resolve this is via command line. Below is the steps starting from replacing the physical hard drive.

  1. Replace the physical hard drive. For this, shutdown the machine if necessary. 
  2. Partition the hard drive. Following is an example where we assume the disk is /dev/ada2.
    # create gpt called ada2
    sudo gpart create -s gpt ada2
    # create a 2G swap partition (it will be ada2p1)
    sudo gpart add -i 1 -b 128 -t freebsd-swap -s 2G ada2
    # create a second partition using the rest of the space (it will be ada2p2)
    sudo gpart add -i 2 -t freebsd-zfs ada2
    # replace disk labeled "99999999999999999999" by ada2p2. See the error message example above. 
    sudo zpool replace MyZpool 99999999999999999999 ada2p2

Once the above is completed, FreeNAS will immediately start resilvering the zpool.

Wednesday, December 12, 2018

Pushing Git Repositories to Multiple Remotes

According to this post, we configure as follows,

git remote add all URL_1
git remote set-url --add --push all URL_1
git remote set-url --add --push all URL_2
git remote set-url --add --push all URL_N

To push to the N remotes, do,

git push all

Saturday, December 8, 2018

Windows Device Guard and Credential Guard

I enabled Windows Device Guard and Credential Guard at a windows 10 host. The result was that VMWare Player/Workstation and VirtualBox ceased to work. For instance, VMWare Player complains,

VMware Payer and Device/Credential Guard are not compatible. 
VMware Player can be run after disabling Device/Credential Guard.

The error message also provided a URL to a VMWare Knowledge Base article. Following the article, the best solution is actually to use the Windows Defender Device Guard and Windows Defender Credential Guard hardware readiness tool to disable the Device and Credential Guard. The tool is distributed as a zip archive. Having extracted it, we simply issue the following command in the PowerShell session,

DG_Readiness_Tool_v3.6.ps1 -Disable -AutoReboot

You may revise the above command to match the version of the tool downloaded.