[-] [email protected] 2 points 1 year ago

I’ve tried something recently in a project with Dream.

Suppose you have an url like /page/param1/param2/ : you want to be able to do three things:

  1. Build this url in the application in a safe way, which mean : param1 -> param2 -> string
  2. Create a route which handle this url pattern (the compilation should fail if you don’t handle all the arguments)
  3. Ensure the handler will have the signature param1 -> param2 -> Dream.handler

Of course, some pages will have two arguments, some other three, and you have to find a way represent this in the type system.

For this, I’ve used a gadt:


type ('a, 'b) t =
  | Static : string * ('a, 'b) t -> (unit -> 'a, 'b) t
  | Int : string * ('a, 'b) t -> (int64 -> 'a, 'b) t
  | String : string * ('a, 'b) t -> (string -> 'a, 'b) t
  | End : ('a, 'a) t

The string is the parameter name in the url (id, login, …) and the gadt make the representation for this parameter in the type system. This gives me a way to declare some urls in the application:

val root : (unit -> 'a, 'a) t
(** The path to root / *)

val topic_url : (string -> 'a, 'a) t
(** The path to /:topic *)

val thread_url : (string -> int64 -> 'a, 'a) t
(** The path to /:topic/:thread *)

Then I have some some functions wihch handle this gadt:

val repr : (unit -> ('a, 'b) t) -> string
(** Represent the route associated with this path *)

val unzip : (unit -> ('a, 'b) t) -> (string -> string) -> 'a -> 'b
(** Extract the parameters from the request. 

    [unzip path extract f] will apply the function extract for all the
    arguments in the path, and gives them to f 

    The function [extract] is given in argument in order to break dependency
    circle.

    This should be something like: 

        let extract_param request name =
          Dream.param request name |> Dream.from_percent_encoded

*)
[-] [email protected] 2 points 1 year ago

C'est d'autant plus vrai en entreprise. J'ai compris ca le jour ou j'ai été présenté comme un "expert en PDF". Bah oui, l'expert est celui qui apporte une expertise (un avis quoi), ca ne veut pas dire qu'il donne de bons avis (ce qui ferait de lui un bon expert si vous avez suivi), mais juste qu'il se permet d'en donner.

[-] [email protected] 5 points 1 year ago

Alors c'est parti, digressons (le vinaigre balsamique n'est pas vraiment un vinaigre donc je suis un hors sujet)

J'ai un vinaigrier dans la cuisine et je fais propre vinaigre. En fait c'est pas compliqué, une fois que la transformation est lancée, ca continuer tout seul, ca prend juste du temps. Donc le vinaigre se fait pas l'action d'un champignon qui transforme l'alcool en acide.

Ce champignon se développe en milieu acide et continue d'acidifier son environnement, une fois que ca a commencé on est en tranquille, il n'y a pas de risque que ca tourne mal.

Bref, tous les trois mois, je retire 1/4 du contenu, et je le remplace par du vin nouveau. Et j'ai un vinaigre parfumé et gouteux, qui n'a rien a voir avec ce que l'on achète (mais ca prend du temps), on sent le goût derrière l'acidité (comme on peut sentir le goût du vin derrière l'alcool)

Je pense qu'il ne doit plus y avoir grand monde a faire ca chez soi, mais je vous assure que c'est un vrai plaisir d'avoir ca dans sa cuisine

[-] [email protected] 2 points 1 year ago

J'allais le proposer ! Les mises a jours sont fréquentes et le jeu est très riche.

Mon seul regret est la gestion de la difficultés, qui se fait en appliquant des coefficients de plus en plus penalisants. Je trouve que ca ne permet pas de réfléchir aux différentes stratégies dans chaque parties, ca donne plutôt le sentiment d'avoir "une" stratégie gagnante, qui oblige a suivre un chemin de plus en étroit quand on monte en difficulté

[-] [email protected] 7 points 1 year ago* (last edited 1 year ago)

Je ne comprend pas les axes :

  • nombre de brasserie
  • nombre de brasserie par habitants

Cela aurait fait sens si le deuxième axe indiquait le nombre d'habitants, mais là, je n'arrive pas a me représenter la diagonale du graphique

[-] [email protected] 3 points 1 year ago* (last edited 1 year ago)
  1. Passer par un vpn (et ne pas aller vers ceux qui financent les youtubeurs)
  2. Utiliser un client BitTorrent qui va n'utiliser que le vpn et s'arrêter si le vpn est coupé

Sinon [email protected] est une bonne source

[-] [email protected] 5 points 1 year ago

I've made something very close, which create a mapping following the window name (windows/xlib)

https://git.chimrod.com/smartcropad.git/about/

I've made it for circuit python, and it works with a serial connexion / JSON messages. (It could be updated with raw USB )

Not yet finished, but already used daily.

[-] [email protected] 4 points 1 year ago

Pour ceux qui suivent les flus européenns sur reddit/lemmy qu'est ce que ca donne comme réaction ?

[-] [email protected] 1 points 1 year ago

Je suis bien d'accord, disais ca dans le sens ou quel que soit le prix que l'on est prêt a mettre, ca vaudra toujours moins cher que ce qu'il nous apporte !

C'est juste inestimable un bon lit !

[-] [email protected] 10 points 1 year ago

I'm using passwordstore + self hosted git server.

Passwordstore uses gpg for the encryption layer which combine fine with ssh (used to connect to the private repo).

I'm using qtpass as gui and there is also a client for Android named password store

[-] [email protected] 1 points 1 year ago

Est-ce qu'ils vont remonter les "patchs de sécurité" en upstream ? Ca m'intéresse de voir leur code de connexion a internet !

1
submitted 1 year ago by [email protected] to c/[email protected]

Hello,

I’m building my first keyboard (a dumbpad), and I have a basic question which should be easy to solve when you know how to do it.

I’ve choosen to socket the microcontroller (in case of error, bad choice…) but I have now a question for putting the screen above: what kind of header should I use ? Is there high profile header or should I stack multiples headers ?

What would you use for this ?

[-] [email protected] 2 points 1 year ago

Same. One day I realized that emails where toi important for beeing host by an amateur me. 😉

view more: next ›

Chimrod

joined 1 year ago