How to Freeze the Page in Chrome

As a QA engineer, there are often times when I’ll be working with dynamic elements on a page that disappear on mouse out. This can be extremely tedious to try to inspect these transient elements, and the only solution is to freeze the page. This can be done as follows:

Open Chrome javascript console
Go to “sources”
On the right side, click the little “pause” icon, or press F8 to pause script execution.

Pressing F8 with the sources tab open was what worked best for me. Then you can switch to the Elements tab, click the magnifying glass icon, and inspect away.

Useful Amazon Echo Features

I purchased an Amazon Echo recently and am writing this post to catalog useful features I’ve discovered with it.

  1. Use it as a Bluetooth speaker.

Say “Alexa, pair bluetooth device” to put the Echo in pairing mode. On your device, find the Echo and pair with it. Play music, profit.

2. Set the volume.

The volume can be set to values between 1 and 10.

Simply say, “Alexa, volume <volume>” to change the volume.

3. Play the radio.

“Alexa, play <radio station>”

4. Flip a coin

“Alexa, flip a coin”

Reification vs. Erasure in Java Collections

This is another concept I came across in Joshua Bloch’s “Effective Java.” According to Wikipedia,  “Reification is the process by which an abstract idea about a computer program is turned into an explicit data model or other object created in a programming language.”

A reified collection in Java is one that enforces its element types at runtime. A collection that is implemented using erasure enforces its types at compile time (and “erase” their element type information at runtime).

This is especially apparent when it comes to arrays and lists. Arrays are reified, while lists that use generics use erasure.

For example, this won’t compile, because generics enforce their type at compile time (erasure):


This will compile, but will fail at runtime, because arrays are reified.

 

Jetta vs. Rock Pile

(spoiler alert: the rock pile won)

My friends and I backpacked the Waucoma Lakes Loop on Saturday and Sunday. It’s in the Hatfield Wilderness, and PCT trail #2000 runs tangent to one of the trails we hiked.

The route we took would’ve been about 12 miles, but we made it much longer by…uh…getting really lost.

11425107_1025819994095981_4506426398335327030_n

11392842_1025820057429308_595110519570104678_n

Ultimately, we ended up at a backpacker’s camp by Wahtum Lake, and enjoyed a beautiful, quiet, clear night. My friend Mike shot this photo from the edge of the lake.

11416286_10152920157183994_8828767641765481704_o

The next morning, we hiked around the lake…

11391492_1025819950762652_2621861946466626893_n

…and then headed back to the trailhead where we had started.

The forest service roads on the way to that trailhead had been really rough, so we had some reservations about traversing them again.

But, alas, we had no choice but to go back the way we came.

At one point, we took a wrong turn. As we backtracked, we noticed a piece of someone’s car in the road. We stopped to move it, and then realized it was a piece of OUR car.

IMG_3269

 

That was when we noticed the oil leaking from under the front of the car.

We tried to ignore this as we continued on…to the rock pile. Like, literally, the road is just a really long pile of rocks at this section, and you have to just sit and listen as they tear up the undercarriage of your car.

We were JUST celebrating our return to the pavement when the oil light came on and the car started screeching at us. When we got out, we were greeted with a pool of oil and an awful smell.

FullSizeRender

 

We had just enough cell service to call for help. My girlfriend had roadside assistance insurance, and they sent a tow truck. Unfortunately, we were told that the truck would only hold two, and there were four of us.

So my friend Ed and I hitchhiked back with someone who turned out to be kind of a crazy driver. As we veered around narrow curves with steep dropoffs and no guardrails at high speeds, I wondered if we’d have been better off just walking the 9 miles back into town. The driver seemed to notice our tension, and slowed down a little. We arrived safely at the auto shop, and the tow truck soon arrived.

Upon closer inspection, we saw the huge puncture in the oil reservoir:

11401455_1025820097429304_1632885693003600750_n

 

(Fortunately, it doesn’t look like there was any damage to the engine itself)

The owner of the shop was kind enough to give us a ride to Double Mountain brewery, where we waited for our ride back to Portland.

Lesson learned: clearance is your friend on forest service roads. We were told that if we hadn’t made it to the pavement, the company wouldn’t have been able to tow it. In which case, we’d have had to leave it overnight. Which would’ve been okay except for the fact that abandoned cars tend to be popular targets for shooters in the area. So we got very lucky.

All in all, we’re grateful we made it back to the pavement, grateful to have had so many kind strangers who helped us out, and grateful that we got to enjoy that backpacking trip. If you’re thinking of going yourself, I’d start at the Wahtum lake trailhead instead. The roads are much better there, and you could hike to Rainy Lake or use it as a base camp to explore the PCT.

 

 

 

 

Generic method for filtering lists with Google Guava

The following is a generic method for filtering lists with the Google Guava library that uses Predicates.


 

String Hashing with Google Guava


Reference: http://dev.knacht.net/blog/2014/07/13/calculate-hash-values-using-google-guava-library/

How to persistently set environment variables on OSX 10.10

In OSX Yosemite, for security reasons, Apple disabled the ability to set environment variables from the /etc/launchd.conf file. But never fear, you can still set them with a LaunchAgent.

1. Create a plist file.

2. In that file, place the environment variable you want to set in this format:

Where “FOO” is the variable to set and “bar” is the value to set it to.

3. Activate the plist file, either by restarting or by executing


Reference: Setting environment variables via launchd.conf no longer works in OS X Yosemite? – Stack Overflow

Hiking, Photography, and Software Engineering.