HNHacker News
TopNewBestAskShowJobs

zanecodes

461 karma · joined September 27, 2016

submissionscomments
zanecodes··on Linux and Powershell
You can shorten any argument name in PowerShell, so long as it can be disambiguated:

    PS C:\> ls -di # same as Get-ChildItem -Directory; -d would pass the -Depth parameter instead
    

        Directory: C:\


    Mode                LastWriteTime         Length Name
    ----                -------------         ------ ----
    d-----       2020-07-24     18:09                PerfLogs
    d-r---       2020-12-14     22:45                Program Files
    d-r---       2020-12-24     22:57                Program Files (x86)
    d-----       2020-07-23     11:29                temp
    d-r---       2020-07-24     14:19                Users
    d-----       2021-01-15     21:33                Windows
zanecodes··on Statecharts: A Visual Formalism for Complex Systems (1987) [pdf]
I would call the former an implicit state machine, while the latter is an explicit state machine.
zanecodes··on Anu: A sound, distributed version control systema
Git actually does not work with deltas; each commit contains the hash of a tree object [0], which contains the hashes of the files within it [1]. This tree is effectively a snapshot, since it contains every file hash in the working directory at a certain point in time. Since Git uses the file hash instead of just the file path, it doesn't have to download the files whose hashes haven't changed since the last commit, which is what makes it behave somewhat as if it is operating on a delta.

[0] https://git-scm.com/book/en/v2/Git-Internals-Git-Objects#_gi... [1] https://git-scm.com/book/en/v2/Git-Internals-Git-Objects#_tr...

zanecodes··on Throwable Robot Car Always Lands on Four Wheels
Not to mention that the design constraints of a reaction wheel and a drive wheel are almost polar opposites: a reaction wheel needs to have the largest possible moment of inertia, to maximize the change in angular momentum for a given mass and torque; meanwhile, a drive wheel should have the smallest possible moment of inertia, to maximize the change in angular speed for a given mass and torque, particularly since you typically want to minimize unsprung mass (in fairness, the demoed robot didn't have any suspension to worry about).
zanecodes··on Guard Clauses, a Better Way to Do Conditionals
In Haskell (I know, I know) I would probably write something like this, if I were porting the example one-to-one:

  getInsuranceAmount status = case
      [hasInsurance,  isTotaled,  isDented,   isBigDent   ] <*> [status] of
      [False,         _,          _,          _           ] ->        1
      [True,          True,       _,          _           ] ->    10000
      [True,          False,      False,      _           ] ->        0
      [True,          False,      True,       True        ] ->      270
      [True,          False,      True,       False       ] ->      160
Personally, I'm not a fan of the early return pattern, since it forces me to read the entire function top to bottom (and possibly simulate a state machine in my head) to understand under what circumstances it returns each possible value, and I'm far too lazy for that. In contrast, my example makes it very straightforward to see what set of conditions leads to which value, and vice versa.

Tangentially, this probably wouldn't be a very idiomatic piece of code to write in Haskell, since some of the conditions are likely to be mutually exclusive (what does it mean when isDented is False but isBigDent is True?) My instinct would be to model the status as a sum type, and then to pattern match on its inhabitants instead of writing helpers for 'hasInsurance,' 'isTotaled,' etc, but someone with proper professional Haskell experience might have an even slicker way to think of it.

zanecodes··on The world split into 7 equal areas of population
On Windows 10, you can go to the Settings app > Ease of Access > Color & high contrast and choose color filters for deuteranopia, protanopia, tritanopia, grayscale, inverted, and grayscale inverted.
zanecodes··on Fidget Spinners: Why Being Interesting Can Do More for You Than Being Useful
At the risk of sounding like a fiddly-toy-elitist, I have to say that I prefer practice butterfly knives. There's a wide variety of tricks to learn and it takes some hand-eye coordination. Of course, they're also louder, and tend to freak people out until I point out that it's not sharp (and probably a while afterwards too).
zanecodes··on A critique of trends in tech
But they don't toss things out of windows, they toss Windows out of things
zanecodes··on Terms and Conditions, the Graphic Novel
I completely agree. Wouldn't it be nice if code did what we meant instead of what we said too though?

Not everything can be solved with code, but it's fun to think about, and leads down some interesting paths, even if they're ultimately impossible or impractical.

What if we could encode ambiguity? Legal code could have some wiggle room. Of course, you'd want to be able to do things like ask 'Is X legal under Y circumstances' and receive an answer, and at that point you effectively have human-equivalent artificial intelligence.

zanecodes··on Terms and Conditions, the Graphic Novel
Of course, my idea is wildly simplistic and naïve. But wouldn't it be nice?

I suppose in a sense, using court cases to set precedent is like implementing a regression test: "We found a bug in this law, next time you hit this edge case, treat it like this."

zanecodes··on Terms and Conditions, the Graphic Novel
In my ideal fantasy world, we wouldn't have terms of service; instead, we would be given a structured 'legal code' file, which encodes the terms and conditions as unambiguously as possible.

I could add my personal preferences to my local licenseconfig; for instance, I want to own everything created using software on my machine, and I don't want companies to be able to sell my data, regardless of whether it is anonymized.

Now when I install software, my license daemon alerts me if that software's legal code might conflict with my preferences, and gives me the option of clarifying my configuration, making an exception, or cancelling the installation.

zanecodes··on The New System76 Galago Pro Is a Potential Macbook Killer
I own a 2015 Razer Blade 14 and am overall fairly happy with it, just be aware that it is a gaming machine first and foremost, and as such has very mediocre (~5 hour web browsing) battery life. This is compounded by the notoriously bad power management on most Linux distros, and there are some minor driver support issues (mostly due to the NVidia 970M). I ran Manjaro on mine for a few months before going back to Windows 10 after Windows Subsystem for Linux came out, mostly for gaming reasons.
zanecodes··on Is Semantic Versioning an Anti-Pattern?
> you have absolutely no idea what secret sauce is necessary to get a working application again

That's what .lock files are for.

zanecodes··on Want to Build a Side Business? Just Buy Great Domain Name
I made https://istodaywednesday.com for the express purpose of a joke, and I have no regrets.
zanecodes··on FAA: Reboot 787 power once in a while
>A permanent software fix is anticipated in the second quarter of 2017

Who wants to bet that the permanent fix will be 'automatically reboot the computers if the plane has been powered on for more than a week and stationary on the ground for more than N minutes'

zanecodes··on What Pro Computing Could Be
https://superuser.com/questions/973009/conclusively-stop-wak...

I can confirm that this works on Windows 10 Home edition.

zanecodes··on Show HN: How bloated is your favorite app?
Install rate is referring to the percentage of users who install the app at all, versus those who choose not to because the app is too big.
← PreviousPage 5 of 5