Wednesday, January 31, 2018

Getting TeXShop to make acronym glossaries in LaTeX

I have no idea why this was so difficult. You need to make engine for TeXShop to create glossaries.
cd ~/Library/TeXShop/Engines
Now you need a text editor that can do ASCII files to create the engine. I called mine: make-glossaries.engine
bfname=$(dirname "$1")/"`basename "$1" .tex`"
makeindex -s "$bfname".ist -t "$bfname".alg -o "$bfname".acr "$bfname".acn
makeindex -s "$bfname".ist -t "$bfname".glg -o "$bfname".gls "$bfname".glo
Next you need to make it executable: chmod +x make-glossaries.engine
Once you restart TeXShop, you'll see "make-glossaries" in the drop down.

Monday, November 20, 2017

Getting a Nest Generation 3 to work with steam heat.

I had a difficult time getting a Nest to work my steam heating system, and google failed me, so I engineered through it. The nest says that it works with 95% of all systems out of the box, but when you have that 5%, it's rather vague. The Nest, and most other thermostats, are in the class of "power stealing thermostats", which basically means they use a RC circuit to leach a bit of power off the lines from the heater. This means that the power is acquired from two lines from the heater. At a minimum, you need two lines to turn on your heater, which are the R and the W. In my case, the Nest did not work; however, I guessed this might happen so I ordered a 120v to 24v transformer in advance.

I have a Beckett 7505B burner controller that does not have a common line. It has just two lugs, Tw and Tr, which are the R and W wire terminals. If you short these two wires together, the system will turn on. The issue was that the Nest need more power. The solution is to add a 24VAC transformer and connect them to the Rc and C lines. The "C" line is the common from the transformer, which is most likely a black line. The "Rc" line is the power from my non-existent air conditioner. In this way, the Nest is powered by Rc and C wires while the control is passed via the Rh and W1 wires. The final schematic follows and worked very well.

Monday, October 30, 2017

finding something in a text file

BSD and Linux have slightly different temperaments, and "find --type" didn't work under MacOS. I was trying to find the word "command" in all of my shell scripts to see how I tested if commands exists. I settled on grep:
grep --include=\*.sh -rl '.' -e 'command' 

Wednesday, October 11, 2017

Getting started with TypeScript under MacOS.

These are mainly notes for me, but I thought that it would be useful for someone else as well. I have a strong dislike for Javascript because the code seems to be sloppy and non-maintainable. When you come from the background of physics, the fact that you cannot do integer math will bother you. I have a new driver that I want to make portable projects between Windows/Linux/MacOS in a way that is approachable and maintainable.

I have been moving my MATLAB to Python, and for many things that are not related specific to mathematics I have had a more difficult time finding a portable language. Due to the fact that Windows support is always a challenge when you do not use it, I settled on Typescript. In the same way that Microsoft address all of my gripes about Java by making C#, Typescript solves most of my complains about Javascipt. Typescript creates Javascript, so that the code can run on the seemingly ubiquitous Javascript.

In order to use Typescript, we need a program called tsc at a minimum. A Typescript IDE would be helpful too (I used Visual Studio Code). In order to install TypeScript, I used macports, so start by installing macports.

Once you have macports, install package manager for node.js called npm:
port install npm5
Now that you have npm, you need to install the typescript support:
npm install -g typescript
Next you should test the installation of the typescript compiler, tsc
tsc --version
At this point, one can compile a program. It is a two step process where you use tsc to turn a typescript file into javascript, and then use node to execute the compiled javascript. I created a file called test.ts as in:
    class Startup {
        public static main(): number {
            console.log('Hello World');
            return 0;
You then can compile the test.ts file:
tsc test.ts
The result will be the generation of file test.js which now can be executed as
node test.js
The result is "Hello World"

Wednesday, May 31, 2017

Counting duplicates in a file.

I've been looking at lightweight hashes. In doing so, I needed a way to look for collisions. I've been using the Solaris 2.6 kernel file as a test target as it is from a 32-bit RISC processor, so it has 32-bit words. First, you convert the kernel into 32-bit words in ASCII.
xxd -c4 -g4 -p unix
I then run scripts that results in unix.hash, and from there, I need to look for collisions.
sort unix.hash | uniq -c | grep -v '^ *1 ' | sort -nr 

Tuesday, May 30, 2017

Makefile: *** missing separator. Stop.

I do not know why you still need tabs in Makefiles.
Makefile:118: *** missing separator.  Stop.
Replaced my spaces to a tab and it suddenly all works.

Sunday, May 28, 2017

Keybase looks like it will not support UTF-8 well.

When I first came across, I was excited about the premise of simple key management. I'm a crypto novice, but still, I've seen some terrible crypto implementations.

So what's the problem with keybase? Well, nothing as long as you only speak English. For some reason, it seems that keybase will not let you name devices with utf-8 characters.

I do not believe that the keybase team realized what an annoying bummer that is. I name each of my devices in the language of which I primarily use it. The analogy is that English speakers laugh when you transliterate "Dragon King" into "Long Wang". As young as keybase is as a company and application, I wish they would invest in language support on the front end. Currently, if you want to name a device in Japanese, or French/Spanish with the complete character set, you are out of luck. The proof is in the regex:

var deviceRE = regexp.MustCompile(`^[a-zA-Z0-9][ _'a-zA-Z0-9+-]*$`)
var badDeviceRE = regexp.MustCompile(`  |[ '+_-]$|['+_-][ ]?['+_-]`)