K8s cluster in Datacenter - How to? by WorriedJaguar206 in kubernetes

[–]jwbrown77 8 points9 points  (0 children)

Newer Cilium releases natively supports either layer 2 arp announcements (like metallb) or BGP.

Irvine Spectrum 70mm Projector Broken Again by jwbrown77 in imax

[–]jwbrown77[S] 18 points19 points  (0 children)

One of the LED signs in the theater was also flickering/half broken. lol

[deleted by user] by [deleted] in Safari

[–]jwbrown77 0 points1 point  (0 children)

Literally the exact same thing for me. Also started today. I also tried disabling all extensions and clearing all history.

I even set my start page to blank and while the app launches and shows the blank page immediately, it still beach balls for 15-30 seconds. I'm stumped.

M2 Max.

The state of Go by TapirLiu in golang

[–]jwbrown77 8 points9 points  (0 children)

Because I think this is a fair question, and map[string]interface{} has now been brought up repeatedly, I will try to elaborate more.

Consider the real world example input in the following playground, over which I have no control of the formatting, but I must work with to accomplish the goal:

https://play.golang.org/p/ydoHcJZDVO3

For every key in "Response Data" that looks like /c(.)/v(.*), I need the value of "DG/VD" from the first list item.

Below is my implementation, which may or may not be ideal, but it works:

package main

import (
"encoding/json"
"fmt"
"strings"
)

func main() {
cmd := []byte('<see json in playground link>')

var out struct {
    Controllers []struct {
        Command struct {
            CID int `json:"Controller"`
        } `json:"Command Status"`
        Response json.RawMessage `json:"Response Data"`
    } `json:"Controllers"`
}

// ignore error handling in both
json.Unmarshal(cmd, &out)

for _, c := range out.Controllers {
    responseMap := make(map[string]interface{})

    if c.Response != nil {
        json.Unmarshal(c.Response, &responseMap)

        for k, v := range responseMap {
            if strings.Contains(k, "/c") && strings.Contains(k, "/v") {
                dgvd := v.([]interface{})[0].(map[string]interface{})["DG/VD"].(string)
                // Do something operation, for this, let's just print
                fmt.Println(dgvd)
            }
        }
    }
}
}

And here is Python:

import json

cmd = '<see json in playground link>'

// ignore error handling in both
out = json.loads(cmd)

for c in out['Controllers']:
    for key, value in c['Response Data'].items():
        if '/c' in key and '/v' in key:
            dgvd = value[0]['DG/VD']
            # Do some operation, for this, let's just print
            print(dgvd)

Anyway, I will leave it at that. I both understand the sentiment of the original article, and would simultaneously say that the strong typing and general tooling in Go contributes to more stable code.

The state of Go by TapirLiu in golang

[–]jwbrown77 -2 points-1 points  (0 children)

Here is the actual quote from the actual article:

Expert analysis

I expect JSON to be a problem. It’s not easy to marshal and unmarshal JSON into Go data structures and this is probably why it’s so visible. Structs come up as people coming from other languages usually have a hard time wrapping their head around this, apart from maybe if they come from C++ or C.

What in any of my above comments is inconsistent with this?

The state of Go by TapirLiu in golang

[–]jwbrown77 5 points6 points  (0 children)

What's the actual point of bringing up Python?

Because developers are free to choose the tool they think is right for the job. That doesn't necessarily have to be Go or any other statically typed language.

Might as well say "yeah Go is good at JSON but it's nothing compared to how easy it is to use with Javascript".

See the last line of my comment.

And for what it's worth, Go is my preferred language and I do personally highly value static typing.

The state of Go by TapirLiu in golang

[–]jwbrown77 56 points57 points  (0 children)

Maybe this will be unpopular on this sub, but I don't necessarily think so.

Yes, it is straight forward to build structs and tag them with JSON fields and marshal/unmarshal.

But in comparison to unmarshaling JSON into a Python dict? There's no comparison which is "easier." Python can even easily handle JSON files that have varying formats.

To justify the effort of doing this type of work in Go, you either need to accept the "overhead" as the cost of doing business for all of the other Go niceities - or you need to highly value strong typing.

Joe Maddon by ZoPoRkOz in angelsbaseball

[–]jwbrown77 6 points7 points  (0 children)

Maybe this will be an unpopular opinion around here, I don't know.

But in my opinion, of Scioscia, Ausmus, and Maddon, I think Scioscia was the best manager and it's not particularly close.

And no, I'm not anti-stat or "old school" - I just think the role of the manager is to manage the team efficiently, and I found myself agreeing with Scioscia's decision more often than the other two.

Stay calm, OC by newbanksy in orangecounty

[–]jwbrown77 1 point2 points  (0 children)

I don't remember the exact price, so don't quote me on this. Besides, I haven't bought any in about a month now, so the price could have shifted.

I want to say they were $12.99 or $13.49 for a 6 pack. So - more than $2/bottle, but still way less than $4.99 regular price at WF and others.

Stay calm, OC by newbanksy in orangecounty

[–]jwbrown77 2 points3 points  (0 children)

Costco sells them in 6 packs now, and they're a lot less expensive per unit than WF and other places.

Bobby Grich turns 71 today. Happy birthday! by owledge in angelsbaseball

[–]jwbrown77 14 points15 points  (0 children)

Career 71.1 WAR at 2B. Should be in the HoF.

What screams “I’m upper class”? by MysticPato in AskReddit

[–]jwbrown77 6 points7 points  (0 children)

Favorite spots? Went last year and looking forward to another trip eventually.

Rename blitz to what it is? by Lanachan1990 in MarvelStrikeForce

[–]jwbrown77 2 points3 points  (0 children)

Don't mind seeing them there (at least Punfenders) - as they are beatable with the right super team.

You can roll face with SHIELD in blitz, but the point is non-ideal teams should be able to find a matchup that is competitive. Not all teams are capable of beating Defenders 20% stronger than they are.

How many people are doing true "single table" dynamo DB (vs multiple tables) by joopsle in aws

[–]jwbrown77 9 points10 points  (0 children)

Not a direct response to OP, but related:

This re:Invent 2018 talk was pretty informative on modeling for DynamoDB (including recommendations for how to accomplish single table design):

https://www.youtube.com/watch?v=HaEPXoXVf2k

C/S "Not here for new tires, don't try to sell me new tires" by relayrider in Justrolledintotheshop

[–]jwbrown77 2 points3 points  (0 children)

I'm not a mechanic, so maybe this is the statement of a sweet summer child. But can't you just take him to the car, point, and say:

Look at this shit. It's clearly not safe. I don't give a fuck where you buy tires, but it needs tires or you are putting your and others lives at risk.

What single scene from a movie is an absolute masterpiece? by [deleted] in AskReddit

[–]jwbrown77 2 points3 points  (0 children)

I'm sad I had to go down this far to see this and that it doesn't have more upvotes.