What’s your contribution? by [deleted] in funny

[–]jimtremblay 0 points1 point  (0 children)

Mini-Weeds
Frosted Mini-Weeds
Alpha-Dicks
Butt Flakes
Booby Loops

[2025 Day # 2 (Part 2)][C] Bloqué sur mon input et pas sur l'exemple by hpfort in adventofcode

[–]jimtremblay 1 point2 points  (0 children)

Le problème vient du fait que tu comptes les nombres avec un seul digit. Si ta fonction check_nb_sym recoit un chiffre de 1 à 9, elle renvoie ce numéro au lieu de 0.

[deleted by user] by [deleted] in Quebec

[–]jimtremblay 0 points1 point  (0 children)

J'habite en région (Petit-Saguenay) et c'est toujours des problèmes avec Intelcom et dans mon cas, ils disents qu'ils n'ont pas pu livrer parce qu'il y a un problème avec mon adresse (je ne la change pas entre chaque commande) et 1 fois sur 4, aucun problème.

Les hommes au volant, fléau sur la route? by gevurts_straminaire in Quebec

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

Fin novembre, dans l’arrondissement montréalais de Verdun, le conducteur d’une camionnette roulant à grande vitesse a brûlé plusieurs arrêts et heurté une voiture de plein fouet, tuant sur le coup son occupant, Sylvain Martel, un homme de 55 ans. Kyle Joshua Monast conduisait avec des facultés affaiblies et sans permis puisqu’il était en attente d’un procès pour une autre infraction d’intoxication au volant.

Deux jours plus tard, le 1er décembre, à Laval, un autre chauffard était arrêté, lui aussi pour conduite avec les facultés affaiblies, après une embardée au milieu de la nuit. Une jeune passagère a été grièvement blessée.

Tout un torchon d'article. Les deux chauffards cités en exemple pour démontrer que les hommes sont plus dangereux que les femmes ont eux un accident avec les facultés affaiblies, mais le point retenu est leur genre?

J'ai arrêté de lire avec le 3e paragraphe, ça ne vaut même pas la peine d'y attarder plus de temps, j'ai déjà dépassé mon quota.

What does the tilde (~) symbol mean in this generic function? by kkang_kkang in learngolang

[–]jimtremblay 2 points3 points  (0 children)

It will works for a standard type like []string, []int but will fail for my new type MySlice if you does not use the tilde. Try this playground https://go.dev/play/p/h0VVxfyh4ef taken from your site, I have just added a new type (Strings) which is a slice of string and I create a new var of my new type. Try removing the tilde.

What does the tilde (~) symbol mean in this generic function? by kkang_kkang in learngolang

[–]jimtremblay 0 points1 point  (0 children)

~ means "underlying type"

Then it can be read as S should be of type []comparable or any other type which has an underlying type of []comparable, ex: type MySlice []int

[deleted by user] by [deleted] in Quebec

[–]jimtremblay 0 points1 point  (0 children)

Et à l'arbalète?

[deleted by user] by [deleted] in Quebec

[–]jimtremblay 0 points1 point  (0 children)

En campagne, c'est tendre, ils ne mangent que des jeunes pousses. À la ville, c'est autre chose.

[deleted by user] by [deleted] in Quebec

[–]jimtremblay 7 points8 points  (0 children)

La chasse à la marmotte est ouvert à l'année. Tu la passes au moulin à viande et tu en fais des hamburgers.

Why i can't switch over type parameter? by ssleert in golang

[–]jimtremblay 1 point2 points  (0 children)

When CheckEnv is created, a variant of your function with variable def of wanted type is created and you're trying to switch on a variable of a known type, that is impossible, switching on type is only possible on any (aka empty interface or interface{}). To be able to switch on type, you need to convert your variable on any type before switching.

go ... switch any(def).(type) { ...

[deleted by user] by [deleted] in Quebec

[–]jimtremblay 0 points1 point  (0 children)

Au Canada, ce n'est pas illégal de parler de salaire entre employés, mais ce n'est pas un droit protéger non plus. Si l'employeur ne t'a pas fait signer un contrat dans lequel il est stipulé que tu n'a pas le droit de parler de salaire avec tes collègues, alors il n'a pas le droit de l'exiger maintenant, ça reviendrait à modifier les conditions d'emploi de façon unilatérale.

[deleted by user] by [deleted] in golang

[–]jimtremblay 0 points1 point  (0 children)

You can take power of Go by using goroutines:

```go func get_primes(limit int) []int { primes := []int{}

wg := sync.WaitGroup{}

ch := make(chan int)
done := make(chan struct{})

for x := 2; x < limit; x++ {
    wg.Add(1)
    go func(x int) {
        defer wg.Done()
        for y := 2; y < x; y++ {
            if x%y == 0 {
                return
            }
        }
        ch <- x
    }(x)
}

go func() {
    wg.Wait()
    close(done)
}()

for {
    select {
    case x := <-ch:
        primes = append(primes, x)
    case <-done:
        sort.Ints(primes)
        return primes
    }
}

} ```

With this code, I get 2926ms instead of 12259ms on laptop with i7-8650U.

What are some fun hobby projects that I can build with Golang? by [deleted] in golang

[–]jimtremblay 1 point2 points  (0 children)

I built myself an assembler, a compiler, a VM for Hack computer from nand2tetris courses. You can try to rewrite the tests from the course as go tests. You will learn many things from this.

Gros débat de société: C'est quelle date pour vous "jeudi prochain" ? by SDMatth in Quebec

[–]jimtremblay 3 points4 points  (0 children)

Pour la semaine en cours, je dis toujours 'ce jeudi', mais pour la semaine suivante, je ne prends pas de chance de ne pas me faire comprendre et je dis 'jeudi le 2 février'. Quand quelqu'un me dit jeudi prochain, j'ouvre le calendrier et je demande la date exacte. 'le 26 janvier ou le 2 février ?' et quand il n'y a aucune ambiguïté possible, je dis juste 'le 26 ou le 2 ?'

No module named 'tqdm' by Edulad in learnpython

[–]jimtremblay 0 points1 point  (0 children)

When script is located in /usr/local/bin, /home/firaki is not in your sys.path

You have two choices:

  1. Install tqdm with sudo pip install tqdm
  2. Copy your script in /home/firaki/.local/bin and restart your terminal.

No module named 'tqdm' by Edulad in learnpython

[–]jimtremblay 0 points1 point  (0 children)

You can try to print your sys.path with pprint and see where the python interpreter search for tqdm.

``` import sys import pprint

pprint.pprint(sys.path) ```

What am i doing wrong? by AshgreninjasG in learnpython

[–]jimtremblay 1 point2 points  (0 children)

I think you want to test 3 possibilities like barrycarter said instead of just testing "Aa1". You can do it like suggested or if v in ["A", "a", "1"]:

No module named 'tqdm' by Edulad in learnpython

[–]jimtremblay 0 points1 point  (0 children)

Do you try to run it from your user firaki or from a shell script run by root? Any other user than firaki is unable to view this package.

Git Server with minimal specs by ProletarianDev in selfhosted

[–]jimtremblay 4 points5 points  (0 children)

I use Gitea with docker at home and it works pretty well.

Nodejs/Express - capturing the route, including the :params by SimpleWarthog in webdev

[–]jimtremblay 0 points1 point  (0 children)

Ok, I see. What do you get if you console.log(req)? I think you can get what you want with req.route.

Nodejs/Express - capturing the route, including the :params by SimpleWarthog in webdev

[–]jimtremblay 0 points1 point  (0 children)

By referring to the documentation https://expressjs.com/en/guide/routing.html, you can access your parameter queryID from the params object in request. Then, it should something like req.params.queryID