Profile

Cover photo
Bryan Mills
354 followers
AboutPostsPhotosVideos+1'sReviews

Stream

Bryan Mills

Shared publicly  - 
 
Be wary of the π propaganda - they're only telling you half the story!
2
Shawn Smout's profile photo
 
The Tau that can be enumerated is not the unending Tau.
Add a comment...

Bryan Mills

Shared publicly  - 
 
Ran across this article on API design while doing some research for a hobby-PL post.

It starts out sounding ridiculous.  Stick with it to the punchline.
What Color is Your Function? ↩ · February 01, 2015 code dart go javascript language lua. I don't know about you, but nothing gets me going in the morning quite like a good old fashioned programming language rant. It stirs the blood to see someone skewer one of those “blub” languages the ...
4
Matthew Brewer's profile photoBryan Mills's profile photoIvan Jager's profile photo
10 comments
 
Yeah, but using callbacks is also not the same thing as asynchronicity. You can have the exact same JS code above even if the functions are synchronous. (Eg, f could block until it has the result, then immediately call the callback.)

I think you assumed my example with futures implied parallelism, but it doesn't. You could use an ExecutionContext that would execute everything in the main thread, but you typically wouldn't.

My point was just that the asynchronous code was going to be uglier than h(f(x), g(x)).

That said, I think the only reason you'd want to write asynchronous code is for parallelism. Even with a single thread, you can still benefit from I/O parallelism. (Which is presumably why people are writing async code in JS.)
Add a comment...

Bryan Mills

Shared publicly  - 
 
Because there exists no method known to man, more terribly suited to expose the cosmic meaninglessness of existence than pairing the words of H.P. Lovecraft with seemingly delightful and charming...
4
1
Ryan W Sims's profile photo
Add a comment...

Bryan Mills

Shared publicly  - 
 
What I've been up to - a continuing series.

Tonight I finished ("finished") a computer keyboard project.  Built two ErgoDox kits from  (one for home and one for work), and replaced the switches in a pair of Genovation CP24 keypads to go with them.

(I want more keys readily accessible than the ErgoDox provides on its own - unlike many folks, I actually use my function keys. But the nice thing about the ErgoDox is that it's completely open-source, so the firmware is fully programmable.)

I'm still refining the key layout, but at the moment it is roughly per:
https://www.massdrop.com/ext/ergodox/?referer=GGUZDD&hash=e399e20dcd8d9a38d45f05bbd9ef5696


In a continuing experiment, I also replaced the USB controller chip in a Delcom foot pedal for modifier keys (Alt, Shift, Ctrl, and Tab) with a Teensy microcontroller.

The way the Delcom chip encodes modifiers is buggy in a way that interacts badly with the Linux keyboard driver, and it was easier to replace the chip than to either get Delcom to fix the firmware or get the Linux kernel patched to avoid Stupid Things.

In retrospect, it would have been a lot cheaper to buy the pedals and microcontroller separately and DIY from the start, but I wasn't expecting buggy firmware.

I should have known better - if there's one thing you can rely on, it's that software is broken.
2
1
Jennifer Evans's profile photoAdam Goode's profile photoAustin McDonald's profile photoBryan Mills (bcmills)'s profile photo
3 comments
 
Nice looking :).
Add a comment...

Bryan Mills

Shared publicly  - 
 
Santa's workshop has a soldering iron.

A while back, my brother-in-law saw a thing going around[1] where someone had replaced the guts of a broken NES with a Raspberry Pi running an emulator. In addition to allowing the games to be played at all, it has an HDMI output that makes it compatible with modern televisions (unlike the NES's somewhat nonstandard half-resolution composite output).

From that point, I knew what he and my sister were getting for Christmas. =)

Now, the version he saw was a nice proof of concept, but it has some hacks. It doesn't use the original connectors at all - just the power switch.  But the Pi has some lovely General Purpose Input/Output pins, the NES controller protocol is fairly well-understood, and the original power supply even runs at a convenient 5 volts.

And as it turns out, there are some People on the Internet[2] who are very serious about emulation on the Raspberry Pi and have written nice setup scripts for connecting controllers and arranging emulators.

So step one was to acquire a non-working NES on eBay. I took out the guts, but desoldered the original RF/power module in order to provide +5V for the Pi. For a brief period, I also had the RF modulator working with the Pi's composite output - Linux on channel 3! Unfortunately, I burned out the RF amp when I accidentally left the power connected during hookup. =(

Fortunately, the +5V supply still worked fine, so I bypassed the original modulator and wired the analog audio and video to the original red and yellow ports. (They don't work without some software tweaks, but we'll get to that later.)

Next step was to figure out where to place the Pi. I got some HDMI, Ethernet, and USB extensions (from Adafruit Industries), and it turns out that an XBee breakout board (from +SparkFun Electronics​) has the right spacing for the original sockets for the controllers. (Those connector sockets were a huge pain to desolder, but they make it possible to replace the front panel connectors if they wear out without re-soldering any connections.) The original expansion port is pretty narrow, so there wasn't a lot of room for so many components - I ended up shaving the rubber connectors off of the HDMI and Ethernet cables with a knife to be able to fit them closer together.

I cut out sockets for the new connectors with a Dremel and an X-Acto knife, starting with the expansion port to get used to working the material before the more cosmetically-visible HDMI port. The cuts are a bit rougher than I might prefer, but all in all I'm pretty satisfied with how they turned out.

After that, it's just a matter of wiring. I used headers soldered to a small proto-board to keep things modular for testing and rebuilding (and to provide a spot to add a resistor for the front-panel power LED). The controllers share common pins for clock and latch and each have a dedicated pin for data output. They're wired off the +3.3V rail provided by a voltage regulator built into the Pi. 

So, actually, I lied.  It's not a simple matter of wiring - the controller driver requires an updated kernel and firmware blob for the Pi, and the Raspbian OS doesn't use the same mechanism for kernel upgrades as standard Debian. Once I finally figured out that aptitude wasn't actually upgrading the kernel, things went a lot more smoothly.

There was one minor hitch remaining: only one of the controller sockets worked! After a bit of debugging, I discovered that one of the GPIO pins wasn't happy about the signal it was getting from the controller. (The controller is designed to work with a +5V source, so running it at +3.3V apparently makes it a bit noisy.) Fortunately, switching to a different pin (and tweaking the driver accordingly) made everything finally work.

It was striking to me just how much of the work was "figuring out how to fix things" rather than "actually fixing things" - lots of time tweaking resistors (before the RF burnout, at least), fighting with Raspbian's idiosyncracies, and trying to stuff a Raspberry Pi and three connectors into one little expansion port.

Anyway, it was a fun little project and I hope they enjoy the new old toy!

[1]http://imgur.com/gallery/o5vjL
[2]http://blog.petrockblock.com/
79
6
Nathan Fowler's profile photoRizky Amrullah's profile photoPaul Garrett's profile photoWes Brown's profile photo
10 comments
 
That's super cool!
Add a comment...
Have him in circles
354 people
john garry's profile photo
Eunjeong Ryu's profile photo
Ivan Jager's profile photo
Thomas Blaser's profile photo
Reggie Soriano's profile photo
John A. Tamplin's profile photo
Rachel Grove Rohrbaugh's profile photo
Kenton Varda's profile photo
Michael De Rosa's profile photo

Bryan Mills

Shared publicly  - 
 
In like a lion, out like a... polar bear?
2
Emily Mills's profile photoJoshua Evans's profile photoCaitlin Soh's profile photoMark Herber's profile photo
4 comments
 
Like a bastard, like a damned snowy bastard.
Add a comment...

Bryan Mills

Shared publicly  - 
 
A bit of C++ testing-fu.

One of my hobby programming projects (a programming-language experiment in the very early stages) is in C++11.  At my day job, I've used the googletest framework fairly widely, and it's honestly pretty good.  But I'm trying to keep my dependencies as close as possible to just the C++11 standard library, perhaps with some POSIX APIs for interactive tools.

I've also been writing a lot of Go lately - and the Go approach to testing is very bare-bones.  As I've heard Rob Pike put it: "Test code is just code."

One of the things that I've noticed in working with Go is that tests tend to fall into two categories: functional and stateful.

For functional tests, I generally want the test structure to be:
1) Generate some input.
2) Call a function with the input.
3) Compare the function's output to the expected output.
4) If the comparison fails, log the input, the name of the function, and the difference between the expected and actual output.

For stateful tests, I generally want the structure to be:
1) Do some setup.
2) Call a function.
3) Compare the state after the call to the expected state.
4) If the comparison fails, log all of the relevant setup steps, the name of the function, and the difference between the expected and actual end state.

As it turns out, it's easy to express a functional test in terms of a stateful one, but not the other way around.  "Do some setup" becomes "generate the input", and "the state after the call" becomes "the result returned by the call".

So now I have a clear API target: if I can make stateful tests reasonable, I can probably handle functional tests as well.

So what's next?  One of my major goals in writing tests is to notice and fix and awkward usage in my API.  So my test program needs to resemble a real C++ program using my API.  Test setup should be C++ statements executed in ordinary program order; conditions should be C++ booleans; the test program itself should have a main() function and ordinary scoping.

I ended up writing a minimal testing package in ~135 lines of C++ and C Preprocessor.  It's by no means perfect, but it's about as readable as a googletest test and the output is much more useful - if a test fails, I can figure out all of the relevant events without even needing to open the test file.
#include "intern.hpp" #include "testing.hpp" #include #include #include int main(int, char**) { testing::suite s; s.run("pointer_is_consistent", [](testing::logger& l) { DO(l, intern::table i); DO(l, const auto str = std::string("foo")); DO(l, ...
3
Add a comment...

Bryan Mills

Shared publicly  - 
 
“The trick to writing villains,” she said, “is that every villain is the hero of their own story.”
 
My brain is continually surprised when anti-feminists are people. Because, you know, they’re my political enemies. Clearly when people are political enemies, it means that they go around cackling a...
3 comments on original post
5
Mark Tomczak's profile photo
 
"Handsome Jack here..."
Add a comment...

Bryan Mills

Shared publicly  - 
 
I've been installing Debian on my new desktop machine today, and ran into an interesting interaction between hibernation, swap, and overcommit.

(The new machine is much higher-power than my other Linux box, so I want to have something resembling decent power-management. We'll see whether Linux is up to the task.)

At any rate: the default behavior of the Linux kernel is to overcommit arbitrarily, and with some sysctl tweaks you can get that down to "only commit memory equal to swap + a configurable fraction of RAM".

Now, the kernel won't even boot if the RAM fraction is too low - the init sequence applies sysctl.conf before it enables swap, and that means it will refuse to start all the other system-critical services that need RAM. So, in practice, you have to allow at least a little overcommit compared to your swap space. And if you try to shut down with overcommit off, the system hangs - it apparently still needs to allocate memory after it disables swap.

But the default Linux hibernation mechanisms - uswsusp and tuxonice - both reuse the swap space for hibernation!

So what happens if you try to hibernate while the system is already at peak utitlization? I don't know, but I'm guessing the OOM killer goes rampant again.


So, how can we make hibernation play nicely without overcommit?

One thought I had was to add something to the init sequence to disable overcommit at the end of boot and re-enable it again before shutdown.  Seems unpleasant, but perhaps workable.

Any other ideas?
2
Kartik Cating-Subramanian's profile photoIvan Jager's profile photoBryan Mills's profile photo
6 comments
 
+Ivan Jager
> You could probably add support for dedicated hibernate partitions. It might be easier to add a new overcommit_policy.

Yeah, in this case I'm not motivated enough to hack on the kernel myself. If my goal is "reliable software", I'm sure the Linux kernel can acquire sources of unreliability far faster than I can mitigate them.


> I do wonder what it is you're doing where performance is irrelevant but hibernate must be guaranteed to work without supervision, except in the case of hardware faults.

No, you misunderstand. My objective is (as close as possible to) a system in which everything either works or fails gracefully except in the case of hardware failure. "hibernate" is a special case of "everything".

Performance is absolutely relevant, but in the wasteland of Linux there is no obvious way to get hibernate support without swap. And I occasionally need to run Java programs; the JVM assumes that it is running with overcommit and can pre-allocate arbitrarily large amounts of memory without even intending to use it.


> Oh, have you considered ulimit/setrlimit, or do you need arbitrary code to be able to run as root with all capabilities enabled?

setrlimit doesn't have a working option to limit actual memory usage - support for RLIMIT_RSS was removed in 2.4.30. (See what I mean about not wanting to hack on the kernel myself?)

cgroups are closer to what I want, but too much configuration overhead.
Add a comment...
 
Jeb on Eve
or,
The Lost Kerbonaut

One of my Kerbonaunts in #KerbalSpaceProgram  accidentally got stranded on Eve without enough fuel to return home. After a couple decades of dedicated Kerbin R&D - and several rescue vessels - he has finally been returned to Kerbin intact with his precious payload of Eve experiments and surface samples!
2
1
Bryan Mills's profile photo

Bryan Mills

Shared publicly  - 
 
I, for one, welcome our new Skynet Marshmallow Bumper Bot overlords.
12
Daniel Jacobowitz's profile photoPaul Placeway's profile photo
2 comments
 
Well, I hope that an actual operator's permit becomes sufficiently difficult that the drooling potato-heads who are currently texting while driving, etc., are forced to buy a robotic chauffeur car instead.  Meanwhile I'll be bunkered down against this dystopian future in my garage, wrench in hand thankyouverymuch.
Add a comment...
People
Have him in circles
354 people
john garry's profile photo
Eunjeong Ryu's profile photo
Ivan Jager's profile photo
Thomas Blaser's profile photo
Reggie Soriano's profile photo
John A. Tamplin's profile photo
Rachel Grove Rohrbaugh's profile photo
Kenton Varda's profile photo
Michael De Rosa's profile photo
Work
Occupation
Software Engineer
Story
Tagline
The price of reliability is the pursuit of the utmost simplicity. — C. A. R. Hoare
Introduction
I have an eclectic and wide-ranging set of interests, including:
  • music
    • listening and playing
    • anything from experimental/microtonal to alt-country
  • philosophy
    • metaphysics
    • ethics
    • voting systems
    • macroeconomics
    • political philosophy
  • scuba diving
  • board games
  • programming language design and systems programming
    • (and the unfortunate lack of intersection of the two)
  • science
    • Sandwich Science (and general culinary experimentation in the home)
    • and science news, particularly physics and biology
Bragging rights
Jack of all trades (and master of none).
Basic Information
Gender
Male
Relationship
Married
Bryan Mills's +1's are the things they like, agree with, or want to recommend.
Tuner - gStrings
market.android.com

gStrings (www.cohortor.org/gstrings) is a chromatic tuner application measuring sound pitch and intensity.It will let you tune any musical i

Reality Foil, LLC
plus.google.com

Pittsburgh game development studio

Google Cloud Print (Beta)
www.google.com

Cloud Print (Beta). Access and share your printers online with Google Cloud Print. Google Cloud Print is built on the idea that printing can

Developer Guides and Manuals | AMD Developer Central
developer.amd.com

Title, Format, Date. New AMD Opteron(TM) 6200 Series processors "Linux Tuning Guide", PDF, 04/23/2012. BIOS and Kernel Developer G

SYZYGYS OFFICIAL WEB SITE | TOP
www.syzygys.jp

MySpace Japan. Hitomi Shimizu will have some live performances in Europe On Oct 10,14 2010 more Information at News Page >>. SIREN New

xkcd: Amazon
xkcd.com

< Prev · Random; Next >; >|. Permanent link to this comic: http://xkcd.com/1165/ Image URL (for hotlinking/embedding): http://imgs.xkcd.com/

xkcd: ISO 8601
xkcd.com

< Prev · Random; Next >; >|. Permanent link to this comic: http://xkcd.com/1179/ Image URL (for hotlinking/embedding): http://imgs.xkcd.com/

The Invention of Lying (2009)
www.imdb.com

Directed by Ricky Gervais, Matthew Robinson. With Ricky Gervais, Jennifer Garner, Jonah Hill, Louis C.K.. A comedy set in a world where no o

Dominion | Board Game | BoardGameGeek
boardgamegeek.com

In Dominion, each player starts with an identical, very small deck of cards. In the center of the table is a selection of other cards the p

Power Grid | Board Game | BoardGameGeek
boardgamegeek.com

Power Grid is the updated release of the Friedemann Friese crayon game Funkenschlag. It removes the crayon aspect from network building in t

Stardust (2007)
www.imdb.com

Directed by Matthew Vaughn. With Charlie Cox, Claire Danes, Sienna Miller, Ian McKellen. In a countryside town bordering on a magical land,

JEREMY MESSERSMITH
jeremymessersmith.com

Official Website of Jeremy Messersmith

Josh Ritter
joshritter.com

Home; News; Shows; Video; Pics; Music; Press; Store; Blog. Jul 12. Los Angeles, CA | Book Soup. 7PM – FREE – Bright's Passage reading, Q

Vibram FiveFingers : Barefoot Sports Shoes : Toe Shoes & Minimalist ...
www.vibramfivefingers.com

The human foot is comprised of numerous bones, joints, sensory receptors, tendons and ligaments. To keep feet stimulated, we recommend weari

Post-Gazette.com
hosted.ap.org

NEW DELHI (AP) -- What is a sip of clean water worth? Is there economic value in the shade of a tree? And how much would you pay for a breat

Very limited beer selection, and the "fish and chips" seemed an awful lot like frozen fish sticks. On the bright side, the service was friendly and the place was clean and well-lit.
Public - a year ago
reviewed a year ago
Public - 2 years ago
reviewed 2 years ago
Best live music club I've seen in Pittsburgh, though the food is just average. Show up early if you want a seat.
Public - 4 years ago
reviewed 4 years ago
34 reviews
Map
Map
Map
Bad sound, too crowded. Don't forget to bring earplugs. I've been to a couple concerts at Brillobox, but I'll only go if I *really* like the band because the venue is pretty bad. The music is unbearably (dangerously) loud and poorly mixed, the room is overpacked with people, and the general decor of the place makes it seem really run-down. Plus, they don't have much nearby parking -- you pretty much have to park in a residential neighborhood a few blocks away.
Public - 4 years ago
reviewed 4 years ago
Public - 4 years ago
reviewed 4 years ago
The food is good but pretty mundane, though the menu is surprisingly extensive and they have a nice variety of tasty desserts.
Public - 4 years ago
reviewed 4 years ago