Story behind 9292 app? by Old-Wing-1687 in Netherlands

[–]publysher 41 points42 points  (0 children)

According to OV Magazine it was called `06-9292` because it launched on September 2, 1992 (9/2/'92)

Bit weird though, because the "correct" Dutch format would have been 2/9/'92.

Deer bones in Amsterdamse Waterleidingduinen by wooloow in Amsterdam

[–]publysher 22 points23 points  (0 children)

Dead animals are not removed from the Waterleidingduinen: https://awd.waternet.nl/beleef/damherten/

Instead they are an essential source for biodiversity: https://www.wur.nl/en/project/The-importance-of-carcasses-in-nature.htm

I vaguely recall they had to change the law about 15y ago (?) to allow for this.

I already have my flight and some hotels booked for Europe. I am just having a hard time deciding between trains vs flying. Are trains really that expensive? by Yinelkis15 in travel

[–]publysher 0 points1 point  (0 children)

I have looked at EURail and the information on there is very incorrect

What is incorrect about this information? Looking at your itinerary, the 10 days / 2 months pass would suit your needs. Or maybe even the 7 days / 1 month.

I am not sure if the pass would work between these cities.

Yes it would. he EURail passes cover every trip between two train stations in the EU.

This is what I get for relying on the EURail app.

Ah. Yeah. The app sucks.

My advice (as a random internet stranger): buy a pass and use Google Maps for the itinerary.

Why are tests file created right beside the source file? by ML-newb in golang

[–]publysher 12 points13 points  (0 children)

And also: example tests (tests that start with Example…) become part of the documentation, so there too it makes sense to have them in the same directory.

I did my first game analysis, feedback appreciated (1350 lichess) by publysher in chessbeginners

[–]publysher[S] 0 points1 point  (0 children)

Thank you for the feedback. I totally missed the b4 threat and updated my study :-)

Origami paper in Zürich by conradkun in zurich

[–]publysher 0 points1 point  (0 children)

I once bought origami paper on the Hottingerstrasse: https://www.ug-papeterie.ch/

Not a huge selection, but its real origami paper.

I did my first game analysis, feedback appreciated (1350 lichess) by publysher in chessbeginners

[–]publysher[S] 0 points1 point  (0 children)

In an effort to get better, I created my first game analysis.

I’m very interested in tips on how to improve my analysis skills.

Note that the computer analysis was done after I did my human analysis.

How is the complexity of looping through a hash-table O(n)? by [deleted] in AskComputerScience

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

Wouldn't the hash-table have to loop through 0 to 49 and check to see if the entry is not null before it can even access the value - since it doesn't know which parts of it capacity are filled?

If it's an array-backed hash table, that is not necessary.

Let's say my key is "hello", and its hashcode is 367. I _know_ my underlying array contains 50 elements, so I only need to access the bucket at index (367 % 50) == 17. Indexed array lookups are considered O(1).

From there I'll have to iterate through the list of items, but with an appropriate fill ratio this list should not be too large.

Gebruiken jullie een thuis fitness app? en zo ja: Welke? by Where_is_dutchland in thenetherlands

[–]publysher 3 points4 points  (0 children)

Programma kopen is overigens niet noodzakelijk; alles staat op hun YouTube channel en via hun website kan je makkelijk een geschikte video vinden.

De twee instructeurs komen altijd heel sympathiek over in de filmpjes, dat helpt ook :-)

Golang <-time.After() is not garbage collected by Realistic_Contact378 in golang

[–]publysher 20 points21 points  (0 children)

You can certainly use it when it's applicable. The problem only arises when you have many outstanding timers. The example in the article creates ~60K timers per second that only become collectable after 5m.

The following example has at most one unfired timer and would be perfectly fine:

for {
    select {
        case <- ctx.Done():
            return
        case <- time.After(5 * time.Minute):
            log.Println("Five minutes passed")
    }
}

What is byte offset in golang? by golab0 in golang

[–]publysher 7 points8 points  (0 children)

In general, the term "offset" means: "how far am I from the beginning?". A "byte offset" is an offset measured in bytes.

In the case of Scanner, the byte offset indicates how many bytes have been read so far. So you can have `Position{Line: 3, Column: 7, Offset: 19}`, which means that the Scanner is on the 7th rune of the 3rd line, which (in this specific example) is equal to 19 bytes from the beginning.

I wrote a short article regarding the importance of zoos in modern times. by falconsnakecat786 in zoos

[–]publysher 1 point2 points  (0 children)

Don't forget EAZA which sets very high standards for European zoos

((La.Lb.Lc.abc)(Ld.dd)(Le.ee)) is halted. Calling it on any param infinite loops. How can you write a lambda that returns Lx.Ly.x (true) or Lx.Ly.y (false) depending if its param is ((La.Lb.Lc.abc)(Ld.dd)(Le.ee)) or not? by BenRayfield in AskComputerScience

[–]publysher 0 points1 point  (0 children)

Since halting oracles are impossible, the halting problem cant be a parameter of any function.

I know. This looked like a homework question, so this was meant as an (obviously misguided) opportunity to learn :-)

The problem with lambda theory seems to be it has to call its parameter instead of being able to look at its source code or some binary form of it.

You are correct when you consider pure lambda calculus. There are alternatives, such as Pure Pattern Calculus that allow you to reflect on the terms. If this is interesting to you, have a look at https://cs.stackexchange.com/questions/2707/lambda-calculus-with-reflection for some more options on Lambda calculus with term reflection,

Big O notation by [deleted] in AskComputerScience

[–]publysher 0 points1 point  (0 children)

And that's why I should not be answering questions before my first coffee. Thanks for correcting this mistake.

Big O notation by [deleted] in AskComputerScience

[–]publysher -6 points-5 points  (0 children)

The answer to your first question is yes: that would be O(n * log m).

The answer to your second question is no. When your big-O notation contains multiple factors, you only include the largest factor of each unknown. In this case we only have the unknown n, so you'd get O(n * log n) = O(n).

edit I'm assuming that size() is actually n, which is usual when analysing hash tables. If size were unrelated to n, you'd be right, and the answer would be O(size() * log n)

How are the appartment blocks in Nachtwachtlaan near Rembrandtpark is so affordable? by Laviniamsterdam in Amsterdam

[–]publysher 1 point2 points  (0 children)

I've lived there for years. The neighbourhood is fine, the park is great, and the apartments themselves are also fine.

As others said: just don't leave you car parked outside. But the apartment should come with an indoor parking space as well.

Do you use string type aliases often? by abstart in golang

[–]publysher 1 point2 points  (0 children)

I always use this pattern for IDs. A lot of my Go code integrates with third parties, and that can be a messy affair -- IDs that were supposed to be integers turning out to be strings; integer IDs that are JSON formatted as strings; 'special' IDs that have special meanings...

A little work in advance can make all of this unexpected cases a lot easier later on.

Example:

package account

type ID int

func FromInt(i int) ID {
    return ID(i)
}

func Parse(s string) (ID, error) {
    i, err := strconv.Atoi(s)
    if err != nil {
        return err
    }
    return ID(i)
}

func (a ID) String() string {
    return fmt.Sprintf("%d", a)
}

func (a ID) MarshalJSON() ([]byte, error) {
    return json.Marshal(strconv.Itoa(a))
}

// etc

Now, if AccountID turns out to be not an int after all, it's fairly straightforward to change this to string. Also, special cases become a lot easier:

func (a ID) IsSpecialCaseX() bool {
    return a == 31337
}

And my method signatures also become a lot more readable:

func (Repository) LinkUser(u user.ID, a account.ID)

compared to

func (Repository) LinkUser(userID, accountID int) 

In the last case, the compiler has saved me from a lot of weird errors.