HNHacker News
TopNewBestAskShowJobs

gwking

258 karma · joined January 4, 2016

github: gwk
submissionscomments
gwking··on Show HN: A little web server in C
I am currently working on a low traffic (back office) web app for a client. It runs off of a single AWS EC2 instance (2 vcpu arm). When I looked at the hourly pricing I thought it would be $30/month, but the actual bill has been more like $4/month, I suppose due to an idling discount or perhaps some free tier credit or something else.

The web app is fronted cloudflare (free tier). On the box itself I have caddy set up as a reverse proxy with the cloudflare cert, then uvicorn serving my python asgi (starlette) app. The app uses a local SQLite db.

I’m still working out some of the operational stuff like backups and monitoring but so far I am very pleased with the setup. I’m learning a lot and for the first time I do not feel like there is some monstrous pile of complexity behind a curtain.

Setup takes some time but I have detailed notes and it gets easier every time I run through. Feel free to get in touch if you’d like to hear more details.

gwking··on After seven years of Brexit talks, Europe has emerged as the clear winner
There certainly are. I grew up in a very liberal area and have met lots of people that fit the description. Picture a guy who was raised by ex-hippies and doesn't read the news or care about politics.
gwking··on Buy hi-resolution satellite images of any place on earth
On macOS Safari, it causes the mouse to disappear when you transition from the browser window to another screen. I can't help but wonder how much money they spent creating that nuisance.
gwking··on Legal weed is wreaking havoc on return to office: ‘all of NY is wake and baking’
My guess is that they are growing pot, not just smoking it. These days you can smell the industrial marijuana warehouses from the freeway in Oakland, inside a car with the windows up.
gwking··on Why does Meta Quest – Horizon Worlds look so terible?
The emperor has no pants.
gwking··on Ask HN: How best to prepare for Python interviews starting in 3 months?
In addition to finding a cool tutorial site, I have a less exciting recommendation: spend some time reading the reference documentation. This will give him a sense of the scope of the language, the difference between core language and library features, and most of all, a bit of direction for how to help himself find answers as he progresses out of the absolute beginner phase.

The standard docs don't get recommended to beginners very often because they are not designed to be fun/motivating like learning sites, but provided that the student is intrinsically motivated, I think it can be exciting to look at all the modules and start to learn about all the things that people have built and provide for the programmer. Learning to navigate the reference material is an important skill. Some of the sections are confusing, dry, and unhelpful. Others are very worthwhile and knowing where they are is important.

Python in particular has a large standard library, much of which is quite old (good in that it is very mature, not so good in that some of it is barely relevant any more). I've been programming python for a decade and I look at the standard docs every day for something. `stdtypes.html` is kind of a big mess but at some point you have to learn most of what is in there.

If I were hiring a programmer, one of the things I would try to evaluate would be their basic research skills.

gwking··on Python stands to lose its GIL, and gain a lot of speed
I began using python during the python3.0 betas, and I watched the 2 vs 3 saga from the (unusual?) perspective of a v3 hobbyist with no back-compat requirements.

What struck me as most significant was the opportunistic breakage of things not related to the unicode transition. In the many years it took to win people over to v3, they could have marched over all the breaking changes a year at a time. Given that side-by-side installs of python3.x point versions are very functional, with or without venvs, this would have been much more palatable. Perhaps harder than it sounds though.

I attempted a couple of 2to3 translations of open source libraries over the years, with varying degrees of success. Every time I found that most of the changes were easy, but debugging the broken bits was hard due to the sheer volume of source changes. If instead I could have done conversions where there was only a single major semantic change at a time, it would be so much easier to figure out what was going wrong at any given step. Furthermore, I imagine that a single-breaking-change mentality would lead to better documentation on how to transition for each version.

For this reason, I have become rather suspicious of yearly release schedules. Swift is even more frustrating: the version changes are really just dictated by Apple's yearly PR calendar. Some big things get rushed out for WWDC before they are ready, and smaller fixes can get held back until the next year. I would much rather that the language teams just prioritize one thing at a time, release it when it is ready, and foster a community where staying up-to-date on the latest version is easy and desirable (a more complicated story for Apple than for Python I think, due to ABI, OS version, etc).

From past discussions on HN I've gathered that there is such a thing as release fatigue, where developers get irritated when libraries release breaking changes too often. Nevertheless I often wonder if languages and libraries could improve faster by making more breaking changes, one at a time, with robust side-by-side installs to facilitate testing across versions. I wish side-by-side library versions were possible in Python, just to facilitate regression testing.

Bringing this all back to the post, I sincerely hope that if Python 4 is a breaking change to the GIL, that it will be only that.

I'm curious what others think about all this. Thoughts?

gwking··on Swift Regrets
Xcode's faults preceded Swift by many years.
gwking··on Please Bring Back Our Downvotes: Society Desperately Needs It
FWIW every time I have ever flagged something on HN it’s been a fat finger mistake on mobile. Probably a drop in the bucket but worth considering that the signal is still polluted even with perfectly good faith user behavior.
gwking··on Apple's follow-up to M1 chip goes into mass production for Mac
I haev this problem! For me it's a strip about 2 inches wide, down the middle, one pixel higher than the rest of the image. I am using an LG 5k monitor, and I have been unsure if it's a problem with the monitor or the machine. I'd love to know what kind of monitor you are using; this gives me hope that it might be an apple bug that will get fixed eventually.
gwking··on Facebook is bombarding rightwing users with combat gear ads. See for yourself
Yesterday I googled "how to measure a chainsaw bar" and got targeted by a clothing company running a sale for tactical clothing, including what I can only describe as domestic terror outfits. It was striking to me to type in a single atypical search term and then be immediately cast into a completely different advertising cohort.
gwking··on Apple Silicon M1: Black Magic Fuckery
These are interesting points. I'd like to hazard a guess that the leading contributor is cache-related. Just looking at the https://en.wikipedia.org/wiki/Reference_counting suggests as much: "Not only do the operations take time, but they damage cache performance and can lead to pipeline bubbles."

I roughly understand how refcounting causes extra damage to cache coherency: anywhere that a refcount increment is required, you mutate the count on an object before you use it, and then decrement it later. Often times, those counting operations are temporally distant from the time that you access the object contents.

I do not really understand the "pipeline bubbles" part, and am curious if someone can elaborate.

Reading on in the wiki page, they talk about weak references (completely different than weak memory ordering referenced above). This reminds me that Cocoa has been making ever more liberal use of weak references over the years, and a lot of iOS code I see overuses them, particularly in blocks. I last looked at the objc implementation years ago, but it was some thread safe LLVM hash map split 8 or 16 ways to reduce lock contention. My takeaway was roughly, "wow that looks expensive". So while weak refs are supposed to be used judiciously, and might only represent 1% or less of all refs, they might each cost over 100x, and then I could imagine all of your points could be significant contributors.

In other words, weak references widen the scope of this guessing game from just "what chip changes improve refcounting" to "what chip changes improve parallelized, thread safe hash maps."

gwking··on Show HN: Etebase – An open source and end-to-end encrypted Firebase alternative
A quick bit of feedback regarding your website: I was interested in reading the front page but ended up leaving because the “perfect for...” type and delete effect was causing the remainder of the page to jump up and down by one line every few seconds. It just happens to wrap in the wrong place on my phone.
gwking··on Spy Dust (Nitrophenyl Pentadienal)
The book “Billion Dollar Spy” describes the CIA’s shredder in the Cold War era Moscow station as turning documents into powder.
gwking··on Ask HN: How to rediscover the joy of programming?
For myself the word that summarizes the best advice here so far is "introspection." A lot of people have mentioned burnout, work/play balance, languages, complexity of modern frameworks, and more. I think it's all constructive, but needs to be interpreted in a personal context.

When I was a kid programming promised to allow me to make incredible things. It was harder than it looked. I mostly abandoned it as a teenager, and then took it up again in college for the same reason. I've been doing it professionally ever since, for over 15 years.

Personally, the joy of any given task is mostly commensurate with how much effort and frustration is directed at the goal, rather than the technology that is supposed to help me get there. This is a big problem with software, because the medium is so complex, but it applies more generally. If I'm making something in the wood shop, it's one thing to be frustrated because I split the end of a board. It's much more deflating to find out that the power saw is broken.

It's partly practical: if I'm in a wood shop, I have the means to deal with a split board. I often do not have the means or the knowledge to fix the power saw. But just as importantly, it's about my own attitude. What would my 12 year old self do? My only choice was to grab the rusty hand saw, make a wobbly cut, and get on with it. Now that I'm older (I can drive and I have money) I'm more at risk of stopping everything to fix the power tools in the name of quality.

I'm currently working on contract and it has felt like an uphill battle. On reflection, I see that only a small fraction of my time is spent making the software that I was hired to build. The rest goes into fighting with the stack and the business side of the job.

The hobby project that I have on the back burner is a single page of javascript (which I am learning) with a horrendous 500 line function that draws stuff. It pays no regard to web development best practices. These are intentional constraints that limit what the output can be for the sake of my enjoyment. It's a ragged, broken mess, but it holds my interest. If I can just get it working, my friends will appreciate it! That for me is the childlike spirit.

gwking··on IBM doubles its 14nm EDRAM density, adds hundreds of megabytes of cache
I saw Alan Kay speak once, I think at lambda jam 2013. He made a comment that he’s still waiting for mainstream CPUs to allow us to fit an entire interpreter into on-core cache.
gwking··on A Note on the Use of Dictionaries (2012) [pdf]
The 'Influence' section of Scalia's wikipedia bio is interesting and relevant: https://en.wikipedia.org/wiki/Antonin_Scalia#Influence

> "Since his death in February of 2016, Scalia’s influence of course continues through his three decades of judicial opinions. But he still exerts great influence in another, less-discussed way. In 2012, he co-authored the book Reading Law: The Interpretation of Legal Texts with Bryan A. Garner. This work describes numerous “canons,” or rules regarding how to interpret legal documents ... A mere seven years since its publication, Reading Law has been cited in over 1,000 state and federal cases. Just this spring, for instance, Supreme Court justices referenced the work in 10 cases."

Note that Garner is the same co-author as for the linked PDF.

gwking··on Sundar will be the CEO of both Google and Alphabet
My understanding is that GCP lags on developer trust, specifically when it comes to support. Several years ago I was excited about GCP, but have mostly lost interest after reading various stories about account lockouts here on HN.
gwking··on Lightweight API Design in Swift
It may also have been rushed due to the ABI stability deadline. I'm speculating, but it is easy to imagine that the SwiftUI team saw the window for getting new language-level features closing.

More generally, Apple's yearly splash model seems to dictate that teams either release or wait 12 months, if waiting is even an option at all. It makes me wonder how many Apple APIs would have been revised under a more flexible release model.

gwking··on EINTR and PC Loser-Ing: The “Worse Is Better” Case Study (2011)
My guess is that Bell Labs is in New Jersey.
gwking··on The Dark Side of Dark Mode
Personally I find light-on-dark to be much easier on my eyes over the course of the day, and especially at night. With light-on-dark, I can turn the screen brightness up higher without it hurting my eyes.

Regarding the "dramatic new look" angle, what I find hilarious about this is remembering the vaporware that was MacOS Copland. My family had a Centris 610 and a MacUser magazine subscription. I was so eager to get that HiTech dark mode that I installed Kaleidoscope and Dad was Not Happy.

Apart from the nostalgia of being a kid with a computer customized to the point of dysfunction, there is a sense in which Mojave is a realization of Copland's visual ambition, offering an alternative hi tech theme that takes a step away from the original desktop and paper metaphor.

Interesting article on Kaleidoscope that I found while googling for an example screenshot: http://freshmeat.sourceforge.net/articles/learning-from-kale...

screenshot: http://pcdesktops.emuunlim.com/pictures/ss/hitech.jpg

gwking··on Yak shaving and fixing
I just happened to be reflecting on the term "yak shaving" this morning. I saw Free Solo last week, and was motivated (by the funny scene of Honnold and Caldwell in the little hotel room) to start keeping a programming journal. Writing in it this morning I realized that my efforts yesterday were a classic shave: I forked a library, started converting the tests to my own testing framework, updated a terminal coloring module that the test harness to uses, then added an interactive mode to update failing test expectations on the command line (which I've been wanting for ages), which enticed me to port some old termcap code I had to enter `cbreak` mode gracefully for one-touch `y/N` interactions (totally optional but made it feel good).

I appreciate Deestan's comment: "It's only called yak shaving when you go too deep." However I personally find the term to be more subtle than a blanket pejorative. To me, the experience is of working with a big mental stack of contexts, where I spend the day toiling on various far-removed dependencies in an effort to achieve some goal well (whatever "well" means that day). In this light, it's not that yak shaving is bad, but that there is some aspect of personal pride, and that it is hard to do without getting lost, working on things that end up not mattering, or losing momentum and motivation.

My efforts yesterday feel worthwhile. The detours I took succeeded, and yielded results that I have long desired. Other times I'm not so satisfied. Knowing when to start shaving seems to be an intuitive choice, because the payoff is too disparate and subtle to be calculated.

(There was an article on HN a while ago calling Knuth the patron saint of yak shaving, which I enjoyed, and which gave me the ideas that a) the term has something to do with pride in quality, and b) maybe it should not be used in a judgmental way. I also recall my late colleague James Golick, whom I miss dearly, using the term, with varying implications, to describe our daily work of untangling a web/mobile app that we inherited as contractors.)

gwking··on iOS 12 released
Do you use multiple iOS devices or perhaps Messages on Mac? This bug has been driving me crazy for the last year at least, and I've noticed that it happens more often when I'm using messages on the laptop and phone.
gwking··on Starting your own bank is laborious but profitable (2009)
I used to pay my very old landlord with personal checks for a chase account. At some point somebody, (I suspect the part time janitor) got my account number and tried to commit check fraud nearby. This was unsophisticated, an inkjet printer sort of attempt, but nevertheless forced me to close the account, get new numbers, and update all of my direct deposit and bill pay settings on other accounts. It cost me many hours and at least one late fee.

So the obvious feature I would like from a regular, boring checking account is one-time random numbers for everything. Every check should have a unique, completely opaque number. Every time anyone wants an account number for direct deposit, wire transfer, bill pay, or anything else, I should be able to instantly generate a new, disposable number that works until I chose to retire it.

gwking··on Lily: An interpreted language with a focus on expressiveness and type safety
The other recurring example for me was OpenGL resources like textures (this was in ObjC). Again, it turned out not to work so while once I got into more complicated examples, because of ordering issues: my GLWindow instance would get deallocated, and my refcounted GLTexture class would then get finalized after the underlying CGLContext was gone, or just not the active context. I started coming up with more elaborate schemes to deal with it but then it no longer felt elegant.

There is one other aspect of RC systems that I have come to appreciate but never seen anyone else write about: they play well with each other. It's fairly trivial to create foreign object wrappers for python and objective-c in both directions, that each call the appropriate refcount ops of the foreign system. You can then have allocated data structures referring back and forth across the language bridges and when you abandon the root, everything deallocates properly and deterministically in both runtimes. I do not have much experience with GC runtimes and their FFIs but from what I've read I suspect this might be trickier to reason about. This is an obscure point, but one that I did find interesting in terms of language interop.

gwking··on Ask HN: What is your goal in life?
Recently I've started thinking about the importance of acknowledging multiple top-level goals. At times I've tried to describe my life goals as a dependency tree of priorities, but eventually decided that framing it as such, with a single root node, does not do justice to the human experience. I want some selfish things, and also some very altruistic things, and those can coexist because I'm not a singularly focused machine. I have different moods and am influenced by the people and culture around me, and I admit that I cannot fully control my environment.

Perhaps this is too abstract an answer, but maybe it helps a bit. I'm 35, and am still working on more concrete answers. In many ways my thinking has not changed much since I was 21.

I want to do no harm to the world (or as little as possible from the environmental perspective). I want to spend my time on intellectually stimulating, meaningful work that is of real consequence to others. I want to be in love with someone, and have deep relationships with a variety of people. I want to be wealthy enough that I can live in comfort as I get older (although I feel that some level of frugality is healthy, physically and mentally). I want to enjoy the natural beauty of the world, all the more because much of it will be gravely damaged in my lifetime.

I think I have made some progress on all fronts!

gwking··on How Raganwald Lost His Crown
> At some point, a satellite the size of Mars came crashing into the earth, so hard and so fast that about a third of the earth was blasted into space. It didn’t go far–the debris formed a ring around the earth, and gravity eventually compacted it into a single satellite, our moon, but a satellite much larger than our planet’s gravity would normally be able to capture.

Something seems off about "a third": according to https://en.wikipedia.org/wiki/Moon, the Moon's radius is a bit less than a third of Earth's, but its volume is 2% and its mass is just 1%. I'm no expert, but "about a hundredth" seems more accurate.

For what it's worth, I only looked it up because I've come across this discrepancy before, so perhaps I'm missing something!

gwking··on Much ado about iOS app architecture
The divide trick is interesting; I've used it here and there over the years but never came to rely on it. Looks like the pattern became much more concise with Swift's tuple unpacking.

For what it's worth, I settled on "two uncool tricks": the venerable autoresize mask, which I have aliased to be shorter words, and extension properties for top, left, right, bottom, and center. These are just convenience accessors over a view (or layer's) frame, but there is one crucial design choice: when right or bottom mutates, it moves the origin (as opposed to resizing - this way left/right/top/bottom all have similar meaning).

Together these properties lets me write code that states intent more directly and succinctly, e.g. for a content view and a bottom bar, `bar.bottom = view.height; content.height = bar.top;`. It's still imperative code, and order matters, but it reads decently well. Conditional insertions can be just that, etc. Lastly, it helps immensely to factor out constants into named properties, e.g. `let y_margin = 4; let text_pad = 2`, especially for maintenance.

It is essentially the x-y cursor approach without a cursor - just use the relative properties of the layout built thus far to position the next item.

As for autoresize, the dumb trick worth mentioning is to initialize autoresized root views with a weird size, e.g. 99x99. Then if something is not configured right you will see the telltale square.

I have given auto layout several serious tries, most recently in 2014 or so. I tried both Interface Builder (which I deeply dislike due to nonsense XML git conflicts) and code. I found that with a few extension properties I could write auto layout code by hand effectively, but what ruined it for me was that ApKit throws layout exceptions. In general I appreciate Apple's approach to exception handling but to have my view crash before I could even see the layout was very unproductive. In contrast, when I make an autoresize mistake I can usually see what the problem is and correct it, rather than guessing at which combination of constraints caused an exception.

I would be curious to hear from folks if the auto layout situation has improved, and if there are tools that have helped with debugging (I used to rely on Reveal a lot).

gwking··on VS Code Roadmap 2018
My impression is that VSCode is partly about promoting TypeScript, and for what it's worth it has more or less worked on me. Create a "x.ts" and type some stuff; you will see error messages immediately that are roughly as good a first experience with an IDE as I've ever had. I mostly work in Python and Swift, mostly in VSCode, and I wish the support for those languages was nearly so good.

I am an intermediate JS programmer, fiddled with TypeScript a couple of years ago and was unconvinced. Since then TS has matured a lot, and I have been exposed to it in passing from looking at VSCode extensions. If I were to begin a web project today, I would give TypeScript a try. If it weren't for VSCode my thinking would probably be quite different.

As an open source project, VSCode is a significant example of TypeScript on Electron. As a self-hosted IDE I imagine that it has been a good source of feedback for the TypeScript team. I would be very interested to know how many TS issues (checker / compiler bugs, feature requests, etc) have emanated from VSCode.

gwking··on Wall Street Is Giving Up On Twitter
I went to this event two nights ago: http://www.nydailynews.com/new-york/experts-debate-solution-...

One interesting comment during the debate was that many (liberal) journalists use Twitter as a side platform on which they feel comfortable voicing more personal views. While it is an acceptable practice in their circles, conservative readers often point to those tweets as evidence of liberal bias in the industry. Regardless of the professional ethical consensus, it may be a cause of distrust, and suggests a general problem of liberal journalists preaching to the choir.

← PreviousPage 3 of 3