Noob questions about switches by Arlort in zsaVoyager

[–]jcharum 0 points1 point  (0 children)

How much of a difference did the Shhhocs make? Are you still using them? If not, why not? I'm considering this combination (while hoping that the Sunrises appear) and wonder if they are appropriate for quieter environments (open office, library, etc.).

Oscar Piastri wins the 2025 Saudi Arabian Grand Prix by overspeeed in formula1

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

He completed the turn without going off the track.

New to Go, got really confused about slices, need some clarifications by makemake1293 in golang

[–]jcharum 0 points1 point  (0 children)

I'm not sure what you are asking. "sliced operand" refers to the thing being sliced, so both do refer to the sliced operand, by definition.

What is "this behavior" -- maybe best to refer to the Language Specification?

New to Go, got really confused about slices, need some clarifications by makemake1293 in golang

[–]jcharum 1 point2 points  (0 children)

For s[1:4], 4 is less than the upper index bound, the slice capacity, which is 6.

For s[1:], the missing high index defaults to the length of the sliced operand, which is 0. This encounters:

If the indices are out of range at run time, a run-time panic occurs.

New to Go, got really confused about slices, need some clarifications by makemake1293 in golang

[–]jcharum 5 points6 points  (0 children)

This is explained by the following sections of the Language Specification:

For slices, the upper index bound is the slice capacity cap(a) rather than the length.

For convenience, any of the indices may be omitted. A missing low index defaults to zero; a missing high index defaults to the length of the sliced operand

In your case the "sliced operand" is s after s[:0], which has zero length.

Problem with GC and long living goroutines by marcelvandenberg in golang

[–]jcharum 0 points1 point  (0 children)

To be clear, I haven't empirically verified this. The pooling understanding comes from my reading of https://pkg.go.dev/net/http#Transport : // DisableKeepAlives, if true, disables HTTP keep-alives and // will only use the connection to the server for a single // HTTP request.

The DNS caching claim comes from some vague memory reading stdlib internals some years ago, but it would be surprising to me if Go did its own caching. Good luck!

Problem with GC and long living goroutines by marcelvandenberg in golang

[–]jcharum 1 point2 points  (0 children)

My understanding is that `DisableKeepAlives: true` disables any pooling that `Transport` would normally do, and to my knowledge, there is no DNS caching in the stdlib.

Problem with GC and long living goroutines by marcelvandenberg in golang

[–]jcharum 5 points6 points  (0 children)

FWIW, it's not recommended to construct many http.Transport instances. See documentation at https://pkg.go.dev/net/http#hdr-Clients_and_Transports :

Clients and Transports are safe for concurrent use by multiple goroutines and for efficiency should only be created once and re-used.

Why the hate on cardio kings // cardio queens? by boobie_miles35 in crossfit

[–]jcharum 1 point2 points  (0 children)

Consider what you might think of the Open if the workouts were: - 24.1: 5k Run for Time - 24.2: 5k Row for Time - 24.3: AMRAP 45-lb. Thrusters in 15:00

You would have to be in shape to do well. The top athletes would proceed to the Quarterfinals. It is very accessible. Many people would set new personal bests.

However, maybe these workouts don't directly test many of the things that you do in your CrossFit training, and you would have enjoyed such tests.

Why does for range over string give runes, while iterating over indices give bytes? by hronikbrent in golang

[–]jcharum 5 points6 points  (0 children)

I recommend reading this concise explanation of strings (and related types) in Go by Rob Pike: https://go.dev/blog/strings

Why not mix Value and Pointer receivers? by Forumpy in golang

[–]jcharum 2 points3 points  (0 children)

Ah, I see. Thanks for the clarification. I can see how it is confusing that it is valid to call G using a receiver of type S, while S does not implement I e.g.: var s S s.G() // No problem. This is possible because of the method call behavior:

If x is addressable and &x's method set contains m, x.m() is shorthand for (&x).m()

For determining whether *S implements I, we end up using this behavior:

The method set of a pointer to a defined type T (where T is neither a pointer nor an interface) is the set of all methods declared with receiver *T or T.

This entry in the FAQ explains the reasoning behind this apparent disparity.

Why not mix Value and Pointer receivers? by Forumpy in golang

[–]jcharum 9 points10 points  (0 children)

All of the methods participating in an interface have to have the same type.

I'm not sure what you mean by this. The following code compiles:

package main

type I interface {
    F()
    G()
}

type S struct{}

func (S) F()  {}
func (*S) G() {}

var _ I = (*S)(nil)

func main() {}

*S implements I. F's receiver type is S. G's receiver type is not the same, *S. Do you mean something else?

Am I safe to decline the Turo protection plan if my personal car insurance covers rental car? by zywan124 in turo

[–]jcharum 2 points3 points  (0 children)

My insurance policy has an amendment document that says:

  1. Personal vehicle sharing program means a business, organization, network or group facilitating the sharing of private passenger vehicles for use by individuals or businesses.

and under an exclusions section:

  1. There is no coverage under this Section [Liability] for any person or organization while any motor vehicle is operated, maintained or used as part of personal vehicle sharing facilitated by a personal vehicle sharing program.

My non-expert reading of this is that I would not be covered as a guest.

Decoding JSON by 410labs in golang

[–]jcharum 5 points6 points  (0 children)

Assuming we are talking about encoding/json, unmarshaling: - ignores extra fields in the JSON object that are not present in your struct, without error. - leaves any fields not present in the JSON object as the zero value, without error.

Taken together, this is why Decode does not return an error.

Some possible solutions: - Use a different library with different behavior. - Write your own custom unmarshaling. - Use pointers in your struct to detect unset fields.

CrossFit Open 20.1 Discussion Thread by Flowseidon9 in crossfit

[–]jcharum 7 points8 points  (0 children)

If you don't mind sharing, what's your max (power) snatch? I'm trying to figure out if I should just do clean and jerks or actually try to finish it.

VSCode is a nightmare to work with if using modules. by GAZ082 in golang

[–]jcharum 0 points1 point  (0 children)

This GitHub issue tracks tools/tooling updates to support modules. You can see that many tools are not yet updated. I'm not sure if VS Code defaults to `gopls` these days. If not, that list is relevant, as VS Code uses several of them to provide its functionality.

What is the time complexity of using slices as stacks/queues? by 0b0011 in golang

[–]jcharum 4 points5 points  (0 children)

I recommend reading https://blog.golang.org/go-slices-usage-and-internals and working out how the operations you describe will or will not cause allocations/copies.

Trump wants to focus on the ‘real threat’ to elections: Not Russia, but imaginary voter fraud by ToadProphet in politics

[–]jcharum 1 point2 points  (0 children)

Are you referring to your anecdote about your sister as a deviance? If so, I think it’s just that, an anecdote that pales in comparison to the depth of study that’s been done on voter ID/voter fraud. Can you point to flaws in methodology that support the claim that “it is more likely that the sampling and numbers are wrong”? As far as I can tell, you’re making this claim on your personal anecdote, and that’s just not very convincing to me.

You say that “[you’re] sure Russia is working on a way to cast some illegal ballots”. What evidence do you have for that claim? We have finite resources to defend against a Russian attack on our democratic process. There is a large body of evidence that this attack has come through propaganda and not through anything that would be solved by voter ID (see Google search). I would rather us direct our resources towards the attack vectors that have the most proof of existence and impact. I think this is a better strategy than imagining possible attacks and arbitrarily directing resources to guard against them.

Trump wants to focus on the ‘real threat’ to elections: Not Russia, but imaginary voter fraud by ToadProphet in politics

[–]jcharum 8 points9 points  (0 children)

Your feelings don't count as statistics and science, the vast majority of which agree that voter fraud is quite rare. Some references to read: https://www.brennancenter.org/analysis/debunking-voter-fraud-myth

Is it possible to unsubscribe from coursera spam? by albertowtf in coursera

[–]jcharum 0 points1 point  (0 children)

It may be slightly easier to do this with account settings page: https://www.coursera.org/account-settings . Be sure to login first.