August 16, 2016
Haskell & Stubbornness
A persistent theme for the entirety of my adult life as a programmer has been attempting to learn the Haskell programming language. Everything about the language appeals to me, from strong static typing to lambdas (my first exposure to them) to its purity. Despite these repeated attempts over the last ten years, I have been unsuccessful in becoming a proficient Haskell programmer.
So what’s kept me from Haskell enlightenment?
Stubbornness, pure stubbornness. Or at least so I’m convinced.
See, the Haskell community is rich and plentiful with very smart people. Additionally, Haskell has incorporated some ideas from mathematics. These mathematical ideas introduced words like Monad and Monoid into the vocabulary of the community. While the constructs in Haskell share the same name as their namesakes in mathematics, they are not identical.
So we have a community of very smart individuals and a set of semi-obscure mathematics concepts which mostly describe concepts in Haskell. Now, when they write books, guides, or tutorials about Haskell, they use this expanded vocabulary that is outside most programmers’ experience.
Back to me, this is a story about me. I’m stubborn. Haskell presented a unique challenge for me. It came with a vocabulary that I felt was elitist. For a long time, I counted myself in the camp of folks that jokingly told other programmers that Haskell requires a PhD in math as a prerequisite to learning it. I read all of the books (LYAH, RWH, you name it) but still, it just never stuck. The concepts were beautiful, but the details felt heavy handed with obscure math concepts.
Well the stubbornness runs both ways - because I’ve never gotten the hang of Haskell, I’ve yet to give up on learning it. My latest attempt was initiated by a new Haskell book called Haskell Programming from First Principles. Typically, I’d have ignored the book but the story of one of the authors caught my eye. She is not a professional programmer by trade and was taught (from first principles) by her co-author.
The story of the author reminded me of my stubbornness and so here we are. I’m reading this new book, learning Haskell in a new way, and hoping this time it sticks.
May 7, 2016
Stupid Git Tricks: 1 of N
To the surprise of some developers outside of Microsoft, my team uses Git for the vast majority of our code (10,000+ lines of code). Since we work on Windows, Git is built by using a bastardized subset of Cygwin to provide some of the POSIX facilities it requires. This generally works but there is some cruft and ugliness that occasionally rears its ugly head.
Recently, I performed a clean install of Windows 10 on my work laptop. Shortly thereafter, I started encountering a puzzling issue with Git when I was working from home. Any time I’d ask Git to do an operation that required hitting the wire or talking with the origin, it would inexplicably hang. Eventually, it would crash and spew some error that was largely meaningless.
After googling for a couple of hours, I found issue 493 on GitHub for the git-for-windows project. Apparently Git is poorly behaved with whatever changes occurred in the users/groups APIs when the machine is unable to resolve the domain controller. To mitigate this issue, a workaround was identified where you would install Cygwin and copy its settings for POSIX groups and passwd, working around Git trying to resolve the domain controller.
Assuming that your Cygwin installation was
C:\cygwin\ and that your Git for Windows installation is at
- Install Cygwin
- From a Cygwin Bash prompt, type in the following:
getent passwd $(id -u) > /etc/passwd
getent group $(id -G) > /etc/group
Now, if you’re off of your office network, you should be able to push/pull without issue.
Some Side Notes
- I’m on a domain joined laptop.
- I’m using Git Credential Manager to seemlessly pass my credentials to Visual Studio Team Services (formerly VSO)
April 10, 2016
Adventures in Gigabit Internet
In my never ending pursuit of novelty, I recently acquired gigabit internet. I discovered back in November of 2015 that CenturyLink would begin offering gigabit internet in my Seattle neighborhood and that it was competitively priced with service about 1/5th as fast from Comcast. I thought it over for a bit and ultimately decided that I must have this new and shiny thing so that I may lord it over family and friends.
Brief side story: I often hear people complain about Comcast and how the service is always going down or the internet connection is slow or how customer service is poor. Ignoring the data caps which are a valid complaint, those individuals that have only had Comcast in Washington don’t know what bad Comcast service is. I lived in Texas and Florida, having had Comcast in both places and there were times I wasn’t sure the internet was going to work for days at a time, not just hours. In the time I had Comcast in Seattle, I only had one issue and it affected the entire West Coast.
Back to our regularly scheduled programming… so I signed up for CenturyLink Gigabit in November with an estimated installation date of about a month later in December. Apparently they were unable to roll out fiber fast enough and were working 18 hour days just to get people hooked up.
The December installation date rolls around and I noticed that at some point, someone had strung fiber to the house (probably the day before). The technician comes out, explains what he’ll need to do, asks if I have any questions and begins his work. The installation was smooth, taking about two hours, and requiring the technician to drill a single hole through my exterior wall to run the fiber into the house. I was pleased that he drilled the hole at a downward angle from inside to outside the house and filled the hole with silicone caulking after running the fiber to maintain the moisture barrier.
The technician finishes up, sets up the modem/router combo, and confirms I have connection with his tool. I begin playing with the connection while he’s cleaning up and notice that the modem/router seems to only be able to max out at around 600 Mbps versus the gigabit (1000 Mbps) speed I signed up for. Now 600 Mbps is nothing to sniff at but it’s not 1000 Mbps. I bring it up with the technician and he notes that it can take a couple days for the connection to get setup correctly on the CenturyLink side — I don’t really buy this explanation but I let it go at that. There’s likely nothing he can do any way as I have my own suspicions as to what’s going on.
Remember when buying a new processor was the easiest way to speed up your computer? That ended around the Pentium II time frame based on my recollection. How about when the easiest way to speed up your computer was to buy more RAM? That lasted till around 2010 or so when consumer grade SSD’s became widely available at reasonable prices. So from 2010 onward, the easiest way to improve your computer’s performance was to install an SSD as the primary operating system drive. Well we’ve hit a new benchmark — gigabit internet is fast enough that the vast majority of SOHO (Small Office/Home Office) networking gear is no longer sufficient. Now we don’t buy new computers to speed up our experience, we need to buy new networking gear.
So I head to the always trustworthy Internets and begin searching for information about what router to get for CenturyLink Gigabit. I turn up two or three useful articles…
- Bypassing needless CenturyLink Wireless Router on Gigabit Fiber
- A bit internet upgrade: A real-world review of the new 1 Gigabit internet from CenturyLink
- I have CenturyLink’s 1gb fiber to the home and it’s glorious!
One of the articles (2) notes needing a new router while another simply wants a new router (1). The last article (3) seems to be able to get the elusive gigabit speeds with the default router from CenturyLink but it’s definitely a different model than the router I was given. Side note: you’ll notice that when those articles show their SpeedTest results, they show something like 930–940 Mbps and that’s actually the
theoretical realistic limit for fully capable hardware. To get actual gigabit you’d need to spend an order of magnitude more for 10 Gbps hardware.
So those articles are fun and good but what router do I buy? I don’t just want a gigabit router because that just means the local network traffic moves at gigabit. I need a router with a good WAN → LAN speed. After some digging online, I found SmallNetBuilder and discovered the Ubiquiti EdgeRouter Lite-3. It looked to be highly configurable and supported a key feature that is needed if you want to cut out the CenturyLink branded router — VLAN tagging. For whatever reason, the VLAN used by the ONT (Optical Network Terminator) is tagged 201 and so you can’t just use any old router to talk to the ONT.
Further searching on the internet and I found that the multiple individuals have had success getting the EdgeRouter Lite setup with CenturyLink so I went ahead and bought it. This particular router is complex to setup — or at least more complex than any I’d tried to setup in the past despite having used DD-WRT with some fairly complex settings. With a little searching though, I was able to adapt a config used by a forum user to get my EdgeRouter Lite setup correctly.
For your convenience: a scrubbed version of my config.boot for the EdgeRouter Lite.
This config will setup:
- eth1 as WAN
- eth0 as LAN (192.168.1.1/24)
- PPPoE connection (look for @qwest.net)
- WAN → LAN bridging
- VLAN tagging for VLAN 201
- OpenDNS as the DNS nameservers
- the correct MTU of 1492 to communicate with the CenturyLink backend
- enable DHCP server
- firewall rules to drop all incoming requests
This should be a basic setup. I haven’t spent any time trying to look into opening up firewall ports so that’s decidedly outside my expertise. It was a wonder I got the above features working and stable.
The only addition to this setup is my Apple AirPort Extreme (802.11/ac) in wireless bridge mode to serve WiFi to the house. With that setup, my MacBook Air will get around 240 Mbps and my 3rd gen ThinkPad X1 Carbon will get closer to 300 Mbps.
TL;DR: Well I can get the 930 Mbps speed I was supposed to with the Ubiquiti EdgeRouter Lite-3 if I plug in a gigabit interface directly to eth0. Keep in mind that you’re only going to see that speed if you have no real networking between the router and you — so eth0 wired directly to computer. That said, for $100 it’s one of the best routers I’ve ever owned and it’s been extremely stable with no speed drops or rebooting of the router. It just chugs along.
January 24, 2015
My wife and I have recently begun the home-buying process. After looking at our finances last fall, I realized that if we were to liquidate some of our investments, we could have a downpayment for a house. With this in mind, I began lining up the assorted “ducks” needed in buying a house, namely:
- determining a price range
- determining a down payment for that price range
- looking at our mortgage options
Around the turn of the new year, we finally got a chance to go to meet with a representative from our credit union and talk over the basics. While I was familiar with some of the info, my wife had little knowledge of the process (and to be honest, I wanted confirmation of my own knowledge).
Prior to all of this, I had occasionally perused Redfin and Zillow. After a while, I determined I actually preferred Redfin and thus began keeping active searches just so I could get an idea of what I liked in a house and what I didn’t. After we had met with the credit union, as aforementioned, I started spending more time looking at details and scrutinizing photos provided on Redfin. It was this closer scrutiny that raised to my attention a detail I hadn’t previously noticed, Redfin realtor ratings mean nothing.
What do I mean by that? Why would I say that? People love reading feedback about individuals in service industries and how they treat their customers. Of course the ratings matter. No no, you misunderstand me. The reviews mean something, the ratings mean nothing.
The Redfin Realtor Search site is the way I looked up ratings for Redfin Realtors in our area. Go ahead, take a look at the ratings for realtors. At least in my area, Seattle, there’s not a single realtor they list that doesn’t have a 4.5 out of 5 stars or better rating. That leads me to the corollary to my previous statement: When everyone is a 4.5/5, no one is a 4.5/5.
This is the same concept as participation ribbons and “honorable mention.” If your scale isn’t actually differentiated, then the scale doesn’t matter. It’s the reason your college courses were curved. It’s okay that the highest grade was a C+ and you got an F, the professor is going to curve the grade so that the person with the C+ gets an A+ and now you’ve got yourself a C. The professor wasn’t interested in the absolute value of grades people got, he knows that shit is hard. Maybe he feels he didn’t cover a topic well enough and now because everyone bombed the midterm, he’ll correct it by curving the course. Curves have an interesting side effect in which they encourage the class as a whole to gravitate toward a small range of grades. If some asshole gets an A before the curve, everyone else is hosed. That’s a story for a different time, and now I’ve gotten sidetracked.
So if every realtor is rated 4.5, how do you differentiate? Well you meet with realtors until you find one that clicks. The homebuying process is incredibly nerve-racking for your first time or at least it is for Caroline and I. You want a realtor that can keep you grounded (within your price range, how much maintenance to take on) and keep you calm. You can’t discern this from rating nor can you discern it from a review. That brings me to my next point: The written reviews matter as they’re a way to narrow down what you’re looking for.
If you’re a high energy person, you probably like being around high energy people. If you’re prone to being a little neurotic, you probably should have some people that are level-headed in your life. Same goes for a realtor. While the reviews written about a realtor help you filter, you won’t be able to really discern how good of a fit you are with them until you meet them and spend some time chatting.
A good example is our experience in interviewing realtors. We talked with two realtors, whom shall remain anonymous. Both were great and lovely individuals. They both had qualities we loved. I’m a detail oriented guy, security engineer and all. I like people that I feel are on top of their shit. They got it together, they know what’s happening. My wife likes to make an emotional connection with the people around her. She wants to feel involved and connected, and wants them to feel involved and connected. The first of the two realtors (let’s call her Realtor A) we met, is very detail oriented. She is a clear Type A personality, very results oriented but very friendly too. The second realtor we met was less of a Type A personality, but she clicked really well with my wife and I on a personal level. She seemed to have a calming effect that worked well with my wife’s anxiety and yet she didn’t seem inattentive to the details, which calmed my own anxiety.
So if the ratings don’t matter, why does Redfin post them? My presumption is that, similar to having a merit scholarship in college, Redfin-affiliated realtors must keep a certain quality of review feedback as well as throughput on home sales & purchases. It is likely that in order to meet the 4.5+ rating in the first place, you’ll likely already be a 4.5+ realtor straight out. That is to say, those realtors which can sustain such a rating and sale/purchase numbers is holistically a 4.5/5 realtor. They’re just that good.
So what do you propose Zac? Now, I cannot 100% say that Redfin only displays 4.5+ realtors, but if that’s really all they display and/or affiliate with, there’s no need to show the rating. Absolutely keep the reviews. By displaying the ratings, they create false market where consumers believe that these ratings matter except that they don’t. If a consumer trusts Redfin and even consider Redfin’s affiliated realtors, they’re already bought in. I remain unconvinced that the ratings actually influence user decisions in going with a Redfin realtor. That said, it’d be interesting to see Redfin use A/B testing for a period to see if there’s a meaningful drop in users requesting Redfin realtor services.
All in all, the point is simply this: When everyone’s a 4.5/5, no one’s a 4.5/5.
January 19, 2015
In the beginning, there was Zac. He discovered Linux and ran fifty thousand different distributions, never being satisfied. When one distribution fixed an issue, thirty new issues were created. Subsystems bickered, sound servers wept, and bus systems rended their clothing.
This went on for years and finally Zac gave up. He threw in the towel and bought a Macbook. He basked in the mostly-Unix environment provided by OS X. He occasionally tried to take Linux back but it was always a disappointment. One of the more recent forays into nix, he ventured into the BSD realm. Using FreeBSD from versions 7 to 9, he found a mostly harmonious environment. There were forays into other BSDs but these were but fleeting dalliances. Then the FreeBSD gods thought fit to introduce hellacious regressions/complications around version 9. Thus ended Zac’s adventures in nix yet again for several years.
Enter OpenBSD in 2015, stage left.
It seems every year, we hear that 20XX is the year of the Linux desktop. Inevitably, every Linux pundit from Brasil to Mongolia will extol the virtues of switching to Linux. Now don’t get me wrong, Linux does great things but it’s never worked out of the box well enough as a desktop. There’s always something to tinker with, some driver to compile, some knob to fiddle with.
I installed OpenBSD 5.6 on my old Thinkpad x201 and much to my surprise, it just worked. Better than installing Windows out of the box on this particular machine in fact. WiFi required a firmware update, but that was as simple as running
fw_update. I configured a few settings with the help of the very thorough OpenBSD documentation and it’s pretty much been cake.
Maybe 2015 is the year of the OpenBSD desktop rather than the Linux desktop.
USB Key Setup
I won’t cover how to burn an ISO to a CD. That territory has been tread since before I started using *nix. In fact, I’m not even going to cover USB key creation with OpenBSD install media. OpenBSD does a better job at that in section 4.3.4 of the FAQ.
I’ve taken to storing the various tweaks to config files in OpenBSD in my https://github.com/zacbrown/configs/tree/master/openbsd. There’s three main groups in the ‘openbsd’ folder of configs, spread below. Folders are in italics and bold.
fw_update - this is required to update the WiFi drivers. My chipset is the iwl-1000. YMMV.
- etc - everything in this directory can be copied directly into /etc/.
- xorg.conf - a little chunk of Xorg config to setup the TrackPoint
- rc.conf.local - the basic settings I use in mine, including specificying that apmd should dynamically scale the CPU, which daemons to launch, what flags to pass to PF, etc.
- BSDNow.tv has a good coverage of some of the things you’d put in rc.conf.local.
- login.conf - Settings for how much heap processes can take before the OS forcibly kills them.
The aforementioned settings are pretty key to a good experience with OpenBSD as a desktop. The
xorg.conf file is necessary for the TrackPoint middle-click button to work for scrolling. While
rc.conf.local changes aren’t required, many of the options I’ve specified in there are good suggestions for laptop configuration. The
login.conf file changes are necessary since web browsers are terrible hogs.
I don’t actually have any “elaborate tweaking” that had to be done. One open issue is getting the hardware volume buttons to control the hardware mixer rather than routing the commands through X to the application with focus.
- etc - everything in this directory can be copied directly into /etc/.
- apm - this folder contains scripts that will be run for various apmd events (suspend, standby, hibernate, shutdown)
- In my case, the
suspend script is used to cause the Xsession to lock. See .xinitrc below for what happens.
- pf.conf - firewall settings, block all inbound. Might need to allow ssh at some point.
- bin - some basic helper scripts
- wireless & wireless.cfg - wireless is a perl script that nicely connects to preconfigured wireless networks specified in wireless.cfg. You can find the original author of the script here.
- powersaver-mode - uses
sysctl to change hw.cpuspeed to lowest setting (0) to reduce CPU usage
- performance-mode - uses
sysctl to change hw.cpuspeed to highest setting (100) to maximize CPU usage
- .xinitrc - This file is read before X11 is started. Notable entries in it are the launching of
xidle which is used by the aforementioned apm scripts to trigger the Xsession to lock on suspend.
- .kshrc - This file is loaded for each new
ksh instance. Just some basic defined variables used in the terminal.
- .profile - This file is loaded for each new logon session. In order to get it to reload fully, you need to logout and back in.
The configurations above are the extra tweaks I’d have made in some form in Windows had I just installed that. Power management configurations, settings to lock the machine on suspend, firewall settings, and wireless connection settings. None of these are earth-shattering settings to get some fundamental piece working.
Now at the beginning, I made it sound like it was all completely working when I installed. That may appear misleading considering all the files I describe above but they’re largely customizations as opposed to required steps. The basic tweaks section are the only real requirements.
As far as observations go, the ThinkPad x201 gets great battery life. It’s about the same as running Windows 7 and definitely better than any Linux distribution I’ve tried to run on it. WiFi is also better in OpenBSD than it was on Linux. Signal reception is more consistent whereas it seemed to fluctuate a considerable amount on Linux.
All in all, this is a pleasant surprise and I’ll be running OpenBSD on this laptop for the foreseeable future.
July 24, 2013
Glorious Nippon (Japan)
I’ve begun the long and arduous (but enjoyable) task of planning the honeymoon that Caroline and I will be taking. I’ve vacillated between several locations for the honeymoon. Much of it was concern over cost, time, and comfort traveling. Japan was the first real contender and after much thought it remained our best option. Other frontrunners included Turkey which has recently lost its shit and Montreal which takes just as long to get to as Japan from Seattle because there are no direct flights.
We’ll be traveling during the latter half of October of this year so as to enjoy the fall chill rather than the humid summers that most of the Land of the Rising Sun suffers under. Most people consulted that are “in the know” regarding Japan say to visit either in October (fall colors) or in April (cherry blossoms). Additionally, the fall means fewer tourists so we can be all the more obvious as the crude Gaijin that we are.
“Dreamliner”, our tube of pain
Our flying tube of pain of choice shall be a Boeing 787 “Dreamliner” now that the FAA and Japan’s transportation agency have cleared the 787 for flight again. Boeing has redesigned the batteries which so inconveniently caught fire in the original designs. I figure six or seven months of the plane being in flight will demonstrate whether or not they’ve fixed the problem sufficiently. The plane’s unique design is supposed to:
- lower cabin pressure
- better humidity so that passengers are not “dried out”
- other stuff I can’t remember because effort
The fine purveyor of flying tube of pain services is All Nippon Airways (ANA) which consistently ranks as one of the best airlines. In fact, if you look at the top rated airlines, all but one of the 5/5 star airlines are Asian. I’ve wanted to fly on ANA for a long time now and went through great pains to be sure that we did not get put on a code-share United flight to Tokyo.
Once we arrive in Tokyo, we’ll be staying on the edge of the lovely bustling insanity that is Shinjuku Ward (think burrough if it were NYC). I spent a bit of time looking at the possibility of staying in hostels but the price savings to be had there are better if you’re a guy traveling alone. Girls staying in hostels complicates things as most of the time bathrooms are shared. While I like to think ourselves adventurous and open-minded, I don’t think either of us want Caroline to share a co-ed bathroom with mostly male strangers. Since shared bathrooms are out, this means looking for hostels that have private suites/rooms which ultimately end up being $10 cheaper than an actual hotel with 75% more hassle (hassle comes from things like curfews and lack of quiet). Since we’re not necessarily looking for travel companions (the main benefit of staying in a hostel), we don’t gain much for the trouble of trying to stay at one comfortably.
What we’ll do in Tokyo, who knows? You can spend a month there and barely scratch the surface. We’ll do some touristy things, wander through the madness of the city, try to eat at Jiro’s restaurant, and perhaps hit the fish market. Fortunately, I’ve got a nice big guide book to point us in the right direction as well as the internet to suggest destinations.
After four glorious days in Tokyo, we’ll pack up, hop on a Shinkansen (bullet train for you uncultured swine), and head to Osaka. Osaka is the other major business center in Japan with a couple of notable surrounding cities:
- Kyoto - the former capital of Japan and home to roughly one brazillion temples
- Kobe - a luxury town with nice restaurants and delicious cow meat
Similar to Tokyo, we’ve got no specific plans. We’re simply going to get a little lost and see what we find. The word on the street is that the food in Osaka is unique in several ways and we do love to eat so we’ll probably just stuff ourselves with delicious and roll around in a swollen rice coma state.
The aforementioned plans only cover roughly 7-8 days of the 15 we’ll be in Glorious Nippon. We’ll need to find some other things to do to flesh out the rest of the trip. I’m almost certain Onsen (Japanese hot springs) will play a part as well as a visit to Hakone, a resort town outside of Tokyo near Mt. Fuji. Perhaps we’ll also squeeze in a trip to Kanazawa where there’s a rather large garden to stare at.