(Re)Learning Elixir

I’m writing a small app in Elixir and Phoenix to better organize data from the Texas Parks and Wildlife Draw Hunt system. In theory, this will allow me to build a calendar view to see when hunts are in a more systemic manner as well as track hunts that I’ve applied for along with the results.

Some day, I’m sure that I’ll work on a personal app that doesn’t involve HTML scraping but this isn’t the day. I could have probably just built a small UI to input data manually and been done in about the same amount of time but I’m learning a ton about the Enum module in Elixir along with the API of Floki. So it’s mostly a win-win though slow going.

Today’s lessons revolved around two main blocks: how to pass a module’s function to functions in the Enum module that require it and the behavior of Mix tasks as it relates to the entire application. Writing these down here in hopes of better remembering them in the future.

For the Enum and module functions, I knew this from a video course I took by Pragmatic Programmers. You have to append your module function with the ampersand sign to make it work along with passing along the arity of the function you are calling as seen below in the 3rd line. If you try to pass it as just the function name, you’ll get a complaint from the compiler that the function doesn’t exist.

 def scrape() do
    hunts = get_hunts("ADE")
    Enum.each(hunts, &parse_baglimit/1)

The second issue was the behavior of Mix as it relates to the entire application. I’m writing a custom Mix task to scrape the hunt data and what was working perfectly well in my iex console failed miserably in Mix. That’s because Mix does not load the entire application in the same way that iex will. So dependencies (in this case the hackney dependency of HTTPoison) will not be loaded. Adding a line to ensure the App is loaded makes this work as in line 2 below.

  def run(_) do


Stackoverflow and mix

Stackoverflow and function passing

DIY Printer Table

Last week, Wobbles and the wife headed for Arkansas and a week away from work. Left to my own devices and a printer that had been sitting on the floor for about 6 months, I found this post that had some basic pictures to build a simple three shelf printer table. It didn’t have any plans or materials list so I basically came up with some plans to create my own. The materials list below resulted in a 3 foot high table that was 22 X 20 inches and sufficient to hold a decent sized Brother printer

1×10 whitewood board, 6 feet long 2
1×3 whitewood board, 6 feet long3
Quart of Polyshield stain and poly1
1 5/8ths Black swivel casters, 2 pack2
# 8 3/4inch self driving screws24
wood conditioner1
Package of #000 steel wool1
Cheap Foam sponge brushes from paint section4
1 1/4 by 1/8 inch angle iron, 36 inches long4

To reproduce this, you’d also need a Kreg jig system. I have the set which contains a starter set of screws along with the system for creating pocket holes. I picked whitewood because it was the cheapest decent wood that Lowes had. Other options were pine and oak but given that this was my first real project where I didn’t have any solid plans to go on, I didn’t want to have to throw away a bunch of oak that I screwed up.

To start, I cut the 1x10s into six 22 inch sections. These make up the 3 shelves by drilling pocket holes, gluing and then screwing them together. I then cut the 1x3s into the sections for the sides. This resulted in six 20 inch sections for the sides. and three 22 inch sections for the backs. I then drilled pocket holes in the bottom of the shelves to connect both the two 1x10s and the sides. In retrospect, I think I think I’d use a finish nailer on the sides instead of the pocket screws because it was difficult to keep pocket screws from poking out the sides. FYI, that table came from Sams and is a real winner. It holds up to 1000 lbs, is super light, comes with two clamps and allows me to not mess with setting up sawhorses.

Once the shelves were constructed, I used a random orbital sander on the wood, first with a 100 grit and then a 150 grit to get them pretty smooth. Once the shelves were sanded and wiped down, I started staining. This was my first ever stain job. I had the reasonably good sense to start with the bottom of the bottom shelf. Painting stain onto unconditioned wood with a paint brush is a terrible idea. It looked like a murder scene. After a little research, I learned that when the stain instructions tell you to condition raw wood, you should listen. I also learned that stain should be applied with sponges and/or rags.

Back at Home Depot (no home improvement project I’ve ever done was the results of a single trip), I picked up wood conditioner, some rags and some cheap $1 foam brushes. Conditioning the shelves made a big difference as did wiping on the stain. It’s much easier to get a decent look this way and avoid stain brush strokes in the wood.

Stained shelf
Improving my technique

I left the stain to dry for 24 hours. In the mean time, I used unibit drill bits to put screw holes in the angle iron. I put them flush with the top and bottom and then marked the middle of each piece of angle iron and put holes about 3/4s of an inch on either side.

Wear your eye protection when dealing with metal!

Once the stain was dry, I took the #000 steel wool and hand sanded all three shelves. Stain doesn’t naturally go on smooth and because of the grain of the wood, actually seems to make the surface somewhat rough again after initial sanding. The steel wool really gives it a nice finish and brings out some of the gleam in the grain. Wear a mask for this as the steel wool gives off a really fine dust mixed with stain.

Once that’s done, it was just a matter of assembly using the self driving screws (though I put in small pilot holes) and putting on the wheels. The main struggle here was just having things level and doing it by myself. Clamps make everything easier. Do the top and bottom shelf first and then the middle one is a lot easier if you are by yourself. You can see the pocket holes in the picture below. A craftsman would have filled those with wood putty and sanded them over. I on the other hand just wanted to build something and knew they’d never get seen by anyone on the bottom of each shelf.

Overall, this took about 48 hours, much of which was learning how to stain along with the stain drying process. It cost about $120 all told not including tools. Angle iron makes shelving pretty easy to work with. The main issue here I think is that because the sides are 1×3, I could only use 3/4 inch screws which limits the structural ability to hold a lot of weight. I’m only using it for a printer plus decorative items on the top shelf so think it will be find over time. If it starts to sag, I’ll get to build another one.