Ted Piotrowski

Code to live. Live to spend time outdoors.

Page 8


Move over Macbook Air

fg (1).png

Image from asus.com

I bought an ASUS Chromebook Flip recently and it’s been a treat. The 4GB model sells for $279, but you can always find an “opened box” model on Amazon Warehouse deals for around $220. I guess some people are not thrilled with the Chromebook (browserallthethings) approach and send them back barely used. Their loss, your gain.

I’ve been looking at tablets for sometime, but could not find the winning tablet/keyboard combo. The desire is to be able to read articles/docs + watch movies comfortably, but be able to shoot off a lengthy email and write some code as well. The Chromebook Flip has a 360 degree hinge allowing it to act as a tablet and a traditional laptop as well. Win. It’s also light (less than a kg) and super thin (1.5cm).

The Flip is one of the few Chromebooks that runs on ARM making it very power efficient. No more sprints for the charger because battery...

Continue reading →


First 3D printing project

3D printing is the process of creating models by stacking layers of thermoplastic on top of each other. It’s similar to icing a cake. There are some rules to follow. Each additional vertical layer can only overhang the previous layer at a 45 degree angle. This means you can 3D print a capital letter Y because the branches go up at a gradual 45 degree angle. A capital letter T would collapse, however, because the crossbar is an abrupt 90 degree angle.

It’s good to start learning 3D printing by trying to recreate an existing part. I used a part from a broken pair of headphones. The part is responsible for holding the headphone headband together. I chose this part because it has a simple geometric design and because I had the broken part available for measurement.

Printed replacement along with broken piece

You create your 3D model in a free program called SketchUp. I learned the necessary SketchUp skills in a one hour class at...

Continue reading →


How laundry dries

One thing that bothered me while living in Australia was drying laundry. Many rental properties do not contain a clothes dryer and people tend to avoid using dryers when they are available. I like dry laundry. Even on intensely sunny days in Australia, drying clothes on a line never seemed to eliminate all the moisture content. People claim sun dried laundry has a fresh smell. To me, it smelled like faint dampness.

I recently took a stab at quantifying the effect. The experiment consisted of hanging wet laundry outside and measuring its weight over time. As a shirt dries it loses water content and its weight decreases. Here is the data:

Time elapsed Merino shirt Cotton shirt 0 minutes 220g 280g 15 minutes 185g 251g 30 minutes 156g 220g 45 minutes 145g 193g 60 minutes 141g 172g 75 minutes 141g 167g 90 minutes 140g 164g 105 minutes 141g 165g After dryer 130g 1 ...

Continue reading →


NSA puzzle

My dad recently presented me with a puzzle. The puzzle consists of nine square tiles. Each tile edge has the top or bottom half of an Air Force, Army, Marines, or Navy emblem. The challenge is to arrange the tiles in a 3x3 grid where all emblems between touching tiles align correctly.

unsolved.jpg

Number of possibilities

To create a 3x3 grid, we start by choosing a tile for the upper-left hand corner. We have 9 tiles to choose from. Each one of those tiles can also be rotated in one of 4 ways (0, 90, 180 and 270 degrees). Therefore we have 9 * 4 = 36 options for the first tile. Next we choose the upper-middle tile. With the upper-left tile selected, we only have 8 tiles to choose from. Once again, this tile can be rotated one of 4 ways. Therefore we have 8 * 4 = 32 options for the second tile. Proceeding like this we have 7 * 4 = 28 options for the upper-right tile, 6 * 4 = 24 options for the...

Continue reading →


Unit tests are for developers. Integration tests are for users.

I was recently tasked with teaching a fellow developer about unit testing. Tim had no testing experience prior to joining the company. Tim had learned to write Webdriver tests over the past year, but now wanted to learn about unit testing.

The first point I covered is that unit testing is good for combinatorial tests. If you want to test a lot of different inputs, you’ll likely want to do it by writing unit tests because they are fast.

The second point I made is that the easiest methods to test are methods that map inputs directory to outputs. Sum(a, b) is a good example. The sum method’s return value is always dependent on its arguments, a and b.

Next I created an example where a module called out to another module in one of its methods. I showed how to mock the external module and proceeded to test that given an input the module under test called out to the mocked module.

Tim did...

Continue reading →