Nand2Tetris – The ALU Chip

In Chapter 2 of Nand2Tetris we build the Arithmetic Logic Unit chip. It has 2 16-bit inputs and 1 16-bit output. While providing the inputs you also specify the arithmetic operation you want to perform; . This ALU chip is designed to become the centerpiece of HACK.

In addition to ALU’s there are FPU’s (Floating Point Unit) and CPU’s (Central Processing Unit). ALU’s are used to build these more complex chips, which may contain many ALU’s.

John von Neumann proposed ALU’s in 1945 but components were large and expensive for the type of ALU we are building now.
Initially, they performed operations on single bit data. Now that we have integrated circuit (IC) transistors we are able to build ALU’s so complex they can handle operations in a single clock cycle.

Someone in my group documented errors you may come across building the ALU. Hope this helps, https://github.com/SeaRbSg/nand2tetris2017/tree/master/jwfearn/tips.

SearchKick – Remapping an Index

Recently someone updated a Rails Model ID datatype from int to uuid. This has caused issues with ElasticSearch in my local instance:

:exception:
- Searchkick::ImportError
- '{"type"=>"mapper_parsing_exception", "reason"=>"failed to parse [id]", "caused_by"=>{"type"=>"number_format_exception",
"reason"=>"For input string: \"03b42e85-1f09-402c-8f51-89d61c128ffc\""}} on item
with id ''03b42e85-1f09-402c-8f51-89d61c128ffc'''
:exception_object: '{"type"=>"mapper_parsing_exception", "reason"=>"failed to parse
[id]", "caused_by"=>{"type"=>"number_format_exception", "reason"=>"For input string:
\"03b42e85-1f09-402c-8f51-89d61c128ffc\""}} on item with id ''03b42e85-1f09-402c-8f51-89d61c128ffc'''

After some digging I around I was able to resolve this by deleting the Indexes. Rails/SearchKick rebuilt them afterwords.

You can view the available entries with a GET to elasticsearch with “*” as the path.

curl 'localhost:9200/*'

It’s easier to read if you pipe it into jq.

brew install jq
curl 'localhost:9200/*' | jq keys

From the list, identify the object that is failing, mine was organizations_development. Delete the mapping with

curl -XDELETE 'localhost:9200/organizations_development'

From there, elasticsearch will rebuild it and index your data.

Silver Bay Saved My Bacon!

This morning I was attempting to customize DoorKeeper. After an hour of prodding I wanted to wipe all my changes.

1. Git checkout .
* removes changes to known files
2. Git clean -fd
* Removes unchanged files and directories

Except that’s not what I ran. I ran clean with the flags ‘fdx’ which also removes hidden files. So I lost all my .env and config files. Sure I could spend the next hour or two hunting those down.

I though Time Machine tracked these files but I didn’t see them. Silver Bay Tech has a simple blog to follow along and have Time Machine restore these files.

Mac OS X – Restoring Hidden Files and Folders with Time Machine

Thanks Silver Bay!