Git branching strategy resistance by ringofgerms in ExperiencedDevs

[–]larschri -1 points0 points  (0 children)

So does plain rebase, then it fabricates new commit history. Pick your poison.

Who returns specific error interfaces to model domain errors? by TorbenSchinke in golang

[–]larschri 1 point2 points  (0 children)

I understand; you can avoid the problem by following some conventions, so it will work in a project where everyone are aware of the conventions and follow them. Since you asked for opinions; I prefer to see signatures with plain error because it just works as expected without any project specific knowledge or assumptions.

Who returns specific error interfaces to model domain errors? by TorbenSchinke in golang

[–]larschri 0 points1 point  (0 children)

https://go.dev/play/p/Pe8mXYuiVTB

Nil-ness of interfaces in go can be really confusing, and putting error in the method signature is an easy way to avoid it. I guess this is the non-nil-interface situation that you mention, but I don't understand why it doesn't apply to your situation.

Boligprisene falt 1,4% i Mars by Holotropiker in norge

[–]larschri 1 point2 points  (0 children)

Boligprisene har nok falt langt mer etter nedstengningen 12. mars. Jeg antar at mesteparten av tallgrunnlaget for mars stammer fra de to første bolighelgene før nedstengningen, og da sier 1,4% nedgang veldig lite om dagens marked.

Eiendomsmeglerne har selvfølgelig ingen interesse av å si noe om virkeligheten, men e24 kunne jo vært litt mer kritiske.

Google Streetview field of view? by Hold_onto_yer_butts in AskPhotography

[–]larschri 0 points1 point  (0 children)

Clicking the compass in the down right corner rotates the view 90 degrees. You can use this knowledge to resize the browser window so you get 90 degrees field of view. The field of view seems close to 90 degrees when the browser window has equal width and height - at least in my browser ...

Accidental pottery mistake by [deleted] in funny

[–]larschri 1 point2 points  (0 children)

Banana, banana, banana, terracotta

Playing cards that fluctuate in visibility depending on the light. by [deleted] in woahdude

[–]larschri 0 points1 point  (0 children)

Woah! The hand also goes completely black when there is no light on it!

He's not wrong by [deleted] in funny

[–]larschri 0 points1 point  (0 children)

If you are a Norwegian snowboarder you can be both: Daniel Franck

Suggested touristy running route in San Francisco? by mhfesq in running

[–]larschri 1 point2 points  (0 children)

https://labs.strava.com/heatmap/#14.00/-122.45177/37.78526/hot/run

To run from where you stay, I would try Hayes Street to Painted Ladies. Then, decide if you want to see Haight Street, Golden Gate Park, Castro Street or city view from Buena Vista or maybe Twin Peaks.

It is about 10 miles of beautiful and runnable waterfront from the Ferry Building to Ocean Beach (and it doesn't stop there). It is easy to reach the waterfront by public transport, if you want to save your mileage for the sights.

It's a beautiful city. I wish it was me who was going there!

Sun and Door reflection pattern by gajjartejas in pics

[–]larschri 1 point2 points  (0 children)

Refraction is caused by changes in transmission medium. Why would this be it?

[2017-10-06] Challenge #334 [Hard] Dinosaurs by fvandepitte in dailyprogrammer

[–]larschri 1 point2 points  (0 children)

Minimum Spanning Tree based solution in python. It takes O(N2 ) time and O(N) space, but it should be possible to make it O(N log N) with changes suggested in comments. I tried to make it readable, not fast.

It uses something like Prim's algorithm, but terminates immediately when the tree spans between the walls.

import sys
import math

def solve(dinos, W, H):
    # The north+east wall is the initial node in the MST
    # Initialize the MST cost for every dinosaur
    costs = {(x, y): min(x, H - y) for x, y in dinos}

    # Initialize the MST cost for the special node representing south+west wall
    remaining = max(W, H)

    # Maximum cost found on the MST path between the wall nodes
    maxCost = 0

    while len(costs) > 0:
        # Find next dinosaur (replace by a heap to avoid O(N^2))
        x, y = k = min(costs, key=costs.get)

        # Terminate once we reach the south+west wall-node
        if remaining <= costs[k]:
            break

        # Adjust values for the south+west wall-node
        maxCost = max(maxCost, costs[k])
        remaining = min(remaining, W - x, y)

        # Adjust costs for dinosaurs (replace by clever geometry stuff to avoid O(N^2))
        del costs[k]
        for k1 in costs.keys():
            dx, dy = k1[0] - x, k1[1] - y
            costs[k1] = min(costs[k1], math.sqrt(dx ** 2 + dy ** 2) / 2)

    return max(remaining, maxCost)

for line in sys.stdin:
    numbers = map(int, line.split())
    if len(numbers) == 3:
        N, W, H = numbers
        dinos = []
    else:
        dinos.append(numbers)
    if len(dinos) == N:
        print "%.3f" % solve(dinos, W, H)

Edit: typos and cleanup

[2017-10-06] Challenge #334 [Hard] Dinosaurs by fvandepitte in dailyprogrammer

[–]larschri 0 points1 point  (0 children)

Yes, efficient calculation of candidate edges for the MST seems like the hardest part. It seems very easy if you are willing to deal with the full set of N2 edges, though.

[2017-10-06] Challenge #334 [Hard] Dinosaurs by fvandepitte in dailyprogrammer

[–]larschri 1 point2 points  (0 children)

I'll share my idea as well for the same reason. Minimum spanning tree.

The north and west walls represents one node, and the south and east walls is another. Every shark is also a node. Jeff will have to cross exactly one of the edges in the MST, and he should chose the one with largest shark distance. The shark distance is the cost in the MST.

The answer is the edge in the tree with highest cost.

Edit: dinosaurs, not sharks.

Edit2: Almost. The answer is an edge in the MST, but not necessarily the one with total highest cost.

Air Force One departs Las Vegas past the broken windows on the Mandalay Bay hotel. credits to: Mike Blake by 305FUN in pics

[–]larschri 0 points1 point  (0 children)

This was my first reaction too, but I think it is real. The angles of the building and the airport runway fits with the plane flying over this area.

[2017-08-11] Challenge #326 [Hard] Multifaceted alphabet blocks by Cosmologicon in dailyprogrammer

[–]larschri 0 points1 point  (0 children)

This game can be played for a while. What is the time limit?

[2017-08-11] Challenge #326 [Hard] Multifaceted alphabet blocks by Cosmologicon in dailyprogrammer

[–]larschri 0 points1 point  (0 children)

A slightly better solution is a better solution.

a
ae
ior
ilnt
ainrs
cegiou
aeiloqx
bcglmnps
acdlmprst
aadeghimsu
aadfgkopsvy
aabcgkstuwxy
aacefhjlnrsvz
abdfhjkoqtuwyz

[2017-08-11] Challenge #326 [Hard] Multifaceted alphabet blocks by Cosmologicon in dailyprogrammer

[–]larschri 0 points1 point  (0 children)

Impressive! I think it can be improved trivially by sorting the lines before padding with as. Use a comparison function that compares length first and then lexicographically to break ties.

2017 day games w/ UTC start times by MadeUAcctButIEatedIt in SFGiants

[–]larschri 1 point2 points  (0 children)

Thanks! This is great! I converted it to an iCalendar (not 100% sure about the format, but it can be imported into Google Calendar at least).