HNHacker News
TopNewBestAskShowJobs

slobotron

848 karma · joined November 11, 2016

submissionscomments
slobotron··on Stacked Diffs versus Pull Requests
Say two PRs get sent in by two different developers. CI builds both, passes them.

Reviewer comes and approves PR#1, it is merged into master. Depending how much CI power you have, PR#2 (and any other PR in queue) can be automatically built again on top of new master to verify it wont break anything.

You can do it lazily too and just re-check PR#2 once it gets approved by human - like other comment mentioned, CI coordinates and serializes all merges into master making sure master is always green.

slobotron··on Stacked Diffs versus Pull Requests
Hm, I thought the idea is that the only way something will land in master is if it reviews OK and CI passes all the tests on top of the current master?
slobotron··on Test && commit || revert
I do this fairly often. I find it can aid communication and recall.

Few examples:

Say we have a parser and we discover that it chokes on certain input. I'll start a new branch and first commit will be "Failing test case for XXX" to demonstrate the bug. Then I go about fixing it (or sending it off to a colleague who is better suited to do the work). Once it's fixed, it goes into PR and it gets merged into master only if CI likes it. No one is inconvenienced by the fact that that particular test fails in one of the commits...

In this case, there are couple of benefits:

1. I get to see the tests go red. Happened to me a few times where I do the test and fix in the same breath cause the fix seems simple, but then turns out the fix did nothing as the test wasn't triggering the bug. I find that I'm less likely to do a commit that says "add failing test" than I am to dive right into fixing the code prior to running the tests.

2. It's easy for anyone to go back in time to see that test indeed got red, that is to verify that provided input indeed demonstrates a bug etc. If fix and failing test case were in the same commit, then one would have to carefully checkout just some files and not others.

3. If bug is being handed off to someone, it's pretty obvious where to start if there is a single failing test when they begin looking into it.

In a similar vein, another usecase for a commit that breaks the build is as a means of communication when "architecting" new features and delegating work. We are all developers, so code sometimes comes more easily than prose, and creating a new test case that fails is more expressive and less ambiguous than paragraphs of text in the ticket.

Say we get a ticket that says "We are having problems with trolls", and we want to make it a bit harder for them to register (contrived example and silly solution). I can create a new branch, make the following commit and assign to a junior developer:

    + assert_false(
    +   UserRepository->create( email => 'blah@mailinator.com' ),
    +   'Do not allow throwaway email addresses to register'
    + );
This way, whoever gets to work on the feature has a great starting point - ticket explains the business problem, and the failing test puts them right where they need to start looking. It can be a time saver for everyone involved vs me updating the ticket and saying: "Hi DevJunior, I think the way to solve this is to hook into the registration process. The create method in UserRepository is probably the best place to implement this - it should return failure if someone tries to register with @mailinator.com"

Lastly, it's great to have a failing test to come back to when needing to leave a certain branch for a while - be it end of the day, or switching focus to more urgent matters. I find I remember quicker where I left off if test suite tells me, than if everything is green and I have to hunt what was the next thing that was needed to complete the feature... Basically, using VCS and the testsuite as a distributed TODO list :)

slobotron··on New bridge collapses into river in eastern Saskatchewan hours after opening
AvE's gonna have a field day...
slobotron··on Life in the Spanish city that banned cars
Do what downtown Vancouver, BC did - take out a travel lane and/or parking spots and create dedicated bike lane.

Sure, some businesses complain, but overall number of bikes on the road seems to have increased.

https://cyclingmagazine.ca/sections/news/opposition-to-propo...

http://dailyhive.com/vancouver/mobi-bike-share-vancouver-rid...

slobotron··on Stripe Terminal – Programmable point of sale
Yes. Years back we moved from Elavon to Stripe since 2.9% on each transaction sure beat uncertain 1.9-5% we were getting based on what card customer was using (corporate and point cards carried bigger fee).
slobotron··on Mercedes Readies First Tesla Rival in $12B Attack
Perhaps there is even an analogy with Sony delivering a lot of the sensors, and Tesla turning into a major battery supplier?
slobotron··on SGI's $250,000 Graphics Supercomputer from 1993 – Onyx RealityEngine² [video]
Always loved the IRIX Motif and 4dwm aesthetics, and was lucky to have had access to some Indigo machine in school.

Was really impressed by how responsive the file manager was wrt. the immediate appearance of icons for files created from terminal. It also kept track of which folders were open in other windows, giving them different appearance - felt like one was interacting with actual objects.

Tried numerous times to get the same feel on Linux; there used to be a project called 5dwm to recreate the Indigo Magic Desktop experience, I should check if it is still around for additional kick of nostalgia...

slobotron··on Python Fire – Generates CLIs from any Python object
Perl6 has nice builtin cli construction from method definitions and doc comments

    cat > cli.pl6

    #| Duplicates without frobnication
    multi sub MAIN( 'duplicate', Int $times, Str $text ) {
      say $text x $times;
    }
    
    #| Frobnicates up to a limit
    multi sub MAIN('frobnicate', Int :$length = 24, Bool :v(:$verbose))
    {
        say 'Verbosity ', ($verbose ?? 'on' !! 'off');
    }


    perl6 cli.pl
    Usage:
      cli.pl6 duplicate <times> <text> -- Duplicates without frobnication
      cli.pl6 [--length=<Int>] [-v|--verbose] frobnicate -- Frobnicates up to a limit


    perl6 cli.pl6 duplicate 3 blah...
    blah...blah...blah...
slobotron··on History of T (2001)
You can get dynamic scoping in perl by prefixing things with `local`.

    $ENV{BLAH} = 'hi'; 
    $Some::Package::Var = 'there';

    {
      local $ENV{BLAH} = 'hello'; 
      local $Some::Package::Var = 'world';
      

      # this call will see 'hello' and 'world'
      some_method()
    }

    # this call will see 'hi' and 'there'
    some_method()

All the caveats with playing with globals above notwithstanding, it's more useful in practice as a way to get a 'slightly different copy of an object':

    my $a = { hello => 'world', other => 'stuff'};
    
    {
      delete local $a->{other};
      print "$a->{hello} $a->{other}\n";
    }
    
    print "$a->{hello} $a->{other}\n";
this gives

    world
    world stuff
Great way for setting up log contexts etc that automatically get removed after the scope exits...
slobotron··on Runq – Runc-based runtime to run regular Docker images in KVM/Qemu
You can use Dockerfile (easy to start, large ecosystem) to build and launch a VM (presumably more secure).
slobotron··on Literate Programming: Empower Your Writing with Emacs Org-Mode
Checkout Dr Racket, I believe you can have images in the comments and even as part of code.

https://docs.racket-lang.org/quick/

slobotron··on Version Control Before Git with CVS
Our merge strategy with SourceSafe was to always do a 3 way merge (using Araxis) between:

- your latest changes

- version of the code before you made changes

- latest version of the code on the server

So yes, would have 3 full checkouts of the project locally to accomplish this. I guess it boils down to "patch" workflow, except you get to both create and apply the patch yourself. We used a real-world commit token (rubber duck IIRC) to make sure only one person was doing merges at a time...

(Tortoise)SVN was an easy sell when we discovered it.

slobotron··on The Hidden Cost of Touchscreens
Sony phones have dedicated button (hold down to enter camera app, by the time phone is out of pocket you are ready to press it again to take the photo).

On Pixel 2, double press Power button to start the camera app; then use volume buttons to take the photo. Not as ergonomic as Sony, but still works.

I'm sure other phones have something similar.

slobotron··on Supercharging the Git Commit Graph
Interesting tidbit:

> The developers making Microsoft Windows use Git

slobotron··on Teach Programming to become a better programmer
Some would argue that OOP and class hierarchies are orthogonal concepts, so any analogy with biological taxonomies is bound to leave you unenlightened for a long time.
slobotron··on New deep learning technique solves Rubik's Cube without assistance
We need AMP/PWA for PDFs!
slobotron··on I Quit My Job to Live on Donations to Zig
There is at least this comment in the docs:

> Zig is taking cues from Jai's stance on allocators, since that language is being developed by a high-performance game designer for the usecase of high-performance games."

https://github.com/ziglang/zig/wiki/Why-Zig-When-There-is-Al...

slobotron··on Cutter – A Qt and C++ GUI for Radare2 reverse engineering framework
For free CAD, checkout OnShape if you don't mind all your drawings to be public.

https://www.onshape.com/

slobotron··on A Former Tesla Staffer Became an Internet Millionaire in His Spare Time
Baby boomers were/are a large economic force due to sheer numbers and similar age related needs as they progress down the histogram. But it probably doesn't often make sense to keep arbitrary grouping of generations after them, as you suggest.
slobotron··on Stripe to donate $1M to California Yimby
Really enjoyed hearing you talk on the Knowledge Project Interview: Earning your Stripes [0].

0: http://theknowledgeproject.libsyn.com/earning-your-stripes-m...

slobotron··on How I Write SQL, Part 1: Naming Conventions (2014)
I find "[Table]ID" to be bit more readable in joins. I.e.

    SELECT * FROM table1 INNER JOIN table2 USING (table1_id);
vs

    SELECT * FROM table1 INNER JOIN table2 ON (table2.table1_id = table1.id);
slobotron··on Building a Text Editor for a Digital-First Newsroom
An excellent profiler for perl, NYTProf [0], came out of New York Times. It's still actively developed and still kicks ass - outputs easy to grok flame graphs that you can click around on to zero into any statement. More than just finding bottlenecks, I find it useful to understand workings of new codebases...

[0] https://metacpan.org/pod/Devel::NYTProf

slobotron··on Making a Statically-Linked, Single-File Web App with React and Rust
Awesome, thanks for the pointer! CPAN still has lots of tricks up its sleeve, eh :)
slobotron··on Making a Statically-Linked, Single-File Web App with React and Rust
Can of course still do this with FatPacker: https://metacpan.org/pod/App::FatPacker

But, AFAIK, only supports Pure Perl code, so one is SOL for most database drivers etc...

slobotron··on Announcing the Second Edition of “Refactoring”
Would you recommend "Software Tools in Pascal" vs the original?
slobotron··on Uber disabled Volvo SUV's safety system before fatality
Does not seem obvious to me at all. First thought I had when hearing of the accident was "how come Volvo didn't break, they advertised the tech quite a bit few years back?"
slobotron··on After over a decade of Vim, I’m hooked on Emacs
TECK (seemingly out of production) has three keys in place of spacebar by default configured as (backspace)(enter)(space)

Using thumbs to activate those works really well!

https://www.trulyergonomic.com/store/truly-ergonomic-mechani...

slobotron··on Unexpected challenges of making money on the internet
With stripe checkout, you can click "remember me".

https://stripe.com/checkout/info

slobotron··on Google Pay app for Android
If your phone has a fingerprint reader, I find that it's even easier to pull out the phone and tap, than to try and get a card out of your wallet.

Plus, feels more secure since you need to authenticate, vs anyone with your card can just tap it. (sure, usually you are not liable if you report lost credit card quickly)

What I'd really like to see next is for proper electronic receipts to be transferred to the phone, vs just the transaction total.

← PreviousPage 2 of 4Next →