HNHacker News
TopNewBestAskShowJobs

shangxiao

694 karma · joined June 17, 2013

submissionscomments
shangxiao··on Why Kakoune – The quest for a better code editor (2016)
You don't have to use VimScript, you can write your Vim plugins in Python if you wish.
shangxiao··on WW2 Bomb Explodes in England
I was also surprised the first time I heard you can safely burn explosives: I was reading some comments on the Vietnam war from veterans talking about how they used to heat their meals by burning pieces of C4.
shangxiao··on My building has replaced our keys with an app
> It is funny people can't envision things breaking...

This is what enraged me about the Therac-25 design which ended up killing people. There's a whole report to read on the design, failure and follow up but to paraphrase the designers eliminated the physical locking mechanism and had this attitude that "oh it's electronic so it won't wear out and fail".

shangxiao··on CSS checkbox examples
Incidentally most of them _are_ focusable by the keyboard but just aren't tabbable.

I'm using a Chrome plugin Vimium - one of the shortcuts 'f' (documented as opening links) actually highlights all focusable elements. Using this feature shows most of the checkboxes are interactive.

Edit: I guess the reason for me pointing this out is hopefully there's an easy way to make these more accessible for keyboard users.

shangxiao··on Best Practices – Why I Hate Them
"Good practice" is also common in English. When folks use the term "Best Practice" I often ask them whether they in fact mean the former.
shangxiao··on Free resources to promote your next startup
Couldn't be further from the truth, see my reply.
shangxiao··on Free resources to promote your next startup
Typer looks neat. I don't think it was well-established when I started on this, there were quite a few offerings but the only one I managed to find was python-fire. It didn't quite do what my team wanted and there were a few behaviours that we didn't quite like so we decided to make this.

Having said that bargeparse was meant to rely solely on stdlib as the environment we were operating in was tightly controlled and any 3rd party packages had to go through a lengthy review process to be whitelisted.

Additionally, since our team (and others in our organisation) were mostly using argparse, the goal was to provide a way to declaratively interact with it using existing features in the language itself.

shangxiao··on Free resources to promote your next startup
I don't have a startup but I did make a useful little Python library while at my previous job to help ease the pain with using argparse to make CLIs.

It's called bargeparse [1]. The idea is to define an entry point function and use its signature as a means to declare the CLI arguments & options. I was surprised at how well Python's syntax for function arguments works for this... especially the use of pos-only & keyword-only arguments to force a particular style.

[1] https://github.com/shangxiao/bargeparse

shangxiao··on WaterBear – A free library of documentaries and shorts
Mainstream news outlets have been caught doing this. Australian ABC News (government funded) deceptively edited a Navy ceremony that showed the Governor-General & Navy Chief ogling over young women twerking [1]

[1] https://www.theguardian.com/media/2021/apr/15/australian-nav...

shangxiao··on Migrating Large Heroku Postgres Instances to AWS Aurora Without Downtime
Nice!

Slight nitpick: Django should automatically create the Hstore extension for you [1] during migrate whenever you use a HStoreField

[1] https://github.com/django/django/blob/f5e07601b233a50e6bcca4...

Edit: I might've been mistaken here in thinking the above migration operation was automatically applied as the docs seem to suggest you need to add it yourself [2] but at least it's as easy as adding an operation ;)

[2] https://docs.djangoproject.com/en/3.1/ref/contrib/postgres/f...

shangxiao··on Guido van Rossum joins Microsoft
I'm quietly hoping they'll ask him to work on a typescript-style of project that adds static typing as a layer on top of Python :)
shangxiao··on macOS Big Sur
"Professional use" just means to use in your profession, not that they are claiming to be an IT expert.
shangxiao··on Serverless: slower and more expensive
I feel like we're just transferring the labour from ops to dev though. Where I work we still haven't got as good a development workflow with lambdas as we did with our monolith (Django).
shangxiao··on Microsoft acquires Citus Data (YC S11)
What about future Microsoft? :)
shangxiao··on The State of JavaScript 2018
yeah nah…
shangxiao··on Big List of Naughty Strings
I'm curious to know what it is about each of the strings that makes it naughty. A comment next to each one describing what it's supposed to be testing would be great.
shangxiao··on Eerie Skyglow Called 'Steve' Isn't an Aurora, Is 'Completely Unknown' to Science
Yes, that's correct. At 300km, Steve would be situated within the thermosphere [1]

> The highly diluted gas in this layer can reach 2,500 °C (4,530 °F) during the day. Even though the temperature is so high, one would not feel warm in the thermosphere, because it is so near vacuum that there is not enough contact with the few atoms of gas to transfer much heat.

[1] https://en.wikipedia.org/wiki/Thermosphere

Edit: typo

shangxiao··on How not to structure database-backed web apps: performance bugs in the wild
ORMs are good for 90% of your use cases, the rest I'm happy to use SQL for.

I could attempt to deconstruct the ORM problem, but Martin Fowler had a nice article [1] on replying to "ORM hate" a few years back which is worth the read for folks that question the usefulness of ORMs (and I believe questioning things is a healthy thing to do!)

[1] https://martinfowler.com/bliki/OrmHate.html

shangxiao··on An Italian Song That Sounds Like English But Is Nonsense
She actually had another crack at it where it looked as though she studied the lyrics harder as she does quite a good job

[1] https://www.youtube.com/watch?v=uEbV5M59Xc8

shangxiao··on Surviving 75 hours alone in the ocean
Nobody is downvoting to win a petty fight. It just looks like you haven't understood the thread of the conversation and are trying to argue about something when there is no argument.

I wouldn't take it personally.

shangxiao··on It’s About Time for Time Series Databases
This is a bit easier to grok: http://www.timescale.com/how-it-works

(if you're new to this like me)

shangxiao··on Google Memory Loss
According to Merriam-Webster [1] "rackless" is a variant of "reckless".

[1] https://www.merriam-webster.com/dictionary/rackless

shangxiao··on Is Your English Accent British or American?
I was rated as 71% US ;) I wonder if the various accents of Australia rate differently or whether I'm influenced too much by foreign media.
shangxiao··on YouTube Drops Online Star Logan Paul from Premium Advertising
Philip DeFranco has analysed this well and covered this in several videos, the latest being [1]. I agree with his analysis that the problem here is YT itself, not the content creators. I personally believe this latest development makes Logan Paul somewhat of a scapegoat, especially since his video apology [2] was one of the most sincere public apologies I've seen.

[1] https://www.youtube.com/watch?v=C-ePy-2WLfY

[2] https://www.youtube.com/watch?v=QwZT7T-TXT0

shangxiao··on We Can’t Trust Facebook to Regulate Itself
I find this to be a legitimate question. At least in my country all news outlets have a political bias one way or another, including those run by the government itself.

Is there something about NY times (I don't read it) that warrants a downvote on OP's comment?

shangxiao··on Going beyond the idiomatic Python
I was thinking exactly this as I was going through those examples.
shangxiao··on Against an Increasingly User-Hostile Web
I love the fact that IRC is still alive and kicking. The #django channel on freenode is still pretty active as opposed other communities that flock to slack or gitter.
shangxiao··on Seven habits of effective text editing (2000)
siisussjsk might've been referring to doing a quick check to see if vim supports mouse as an interface… which it does.
shangxiao··on Seven habits of effective text editing (2000)
Perhaps you should add an [edit] to your original post seeing as it's nabbed top spot and spawning several threads about lack of cursor support?
shangxiao··on Nuclear deterrence is limited by geography
Space deployments are banned by the Outer Space Treaty [1]. Slide 3 mentions Fractional Orbital Bombardment System (FOBS) which was not banned by the Outer Space Treaty but subsequently by SALT II. Interestingly enough the US never ratified SALT II [2].

[1] https://en.wikipedia.org/wiki/Outer_Space_Treaty

[2] https://en.wikipedia.org/wiki/Fractional_Orbital_Bombardment...

Page 1 of 9Next →