Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Matt Thornton
    @Choc13
    I see. And is that a static member on the ServerlessHub class? Or are you using the C# implementation of that class? Or have you derived your own class in F# from the abstract C# class?
    LuisFX
    @LuisFX
    well, it's a C# assembly. I'm just importing it
    Microsoft.Azure.WebJobs.Extensions.SignalRService.ServerlessHub.Clients.All.SendAsync()
    Matt Thornton
    @Choc13
    Got ya. It looks like you’ll need to implement a concrete instance yourself, instantiate an instance of that and then access Clients from the instance.
    LuisFX
    @LuisFX
    it does look like that!!!
    Have you seen that?
    LuisFX
    @LuisFX
    this is on C# as well!!
    image.png
    Matt Thornton
    @Choc13
    Looks like you can inject an instance of the hub via parameters to an Azure function
    That article doesn’t seem to show how you setup the instance in the DI container in the Azure function though, or maybe I skimmed over it.
    LuisFX
    @LuisFX
    This helps a ton @Choc13 ! Let me read further.
    Matt Thornton
    @Choc13
    Good luck.
    I’m quite interested in what you get working here because I think im going to need something similar for the project I’m working on soon.
    LuisFX
    @LuisFX
    Oh, please don't hesitate to ask anything! We actually have gotten a lot working in terms of bindings etc. We're building a real-time telemedicine application. Here and there some hiccups, but making progress thanks to everyone in this community!!
    So anything we can answer, it would be a pleasure. Also, we're thinking on releasing all the bindings, controls, components, etc as OSS
    Matt Thornton
    @Choc13
    Sounds cool 👍
    poborin
    @poborin
    Hi, is there a way to parse YAML in fable?
    Maxime Mangel
    @MangelMaxime

    @poborin Not that I know of yet.

    But in the past, I used yaml to JavaScript object converter from npm and then used Thoth.Json to works with it.

    poborin
    @poborin
    @MangelMaxime Thanks, that shoul work. Could you recommend an npm package given you have some experience.
    Maxime Mangel
    @MangelMaxime

    @poborin

    In my use case, we are using https://www.npmjs.com/package/front-matter which use https://www.npmjs.com/package/js-yaml under the hood. So, you could try https://www.npmjs.com/package/js-yaml first.

    poborin
    @poborin
    @MangelMaxime thanks, I'll give it a try
    Antonios Kλimis
    @klimisa

    Hello, I'm trying to use Fable with the Nethereum lib. I'm getting the following error FABLE: Cannot resolve Nethereum.Web3.Web3.GetAddressFromPrivateKey. Here is a gist of the code https://gist.github.com/klimisa/054d8da05a63bc7e25e546a0a4af483f

    Apologies if that question doen't make sense, I'm a newbie.

    Maxime Mangel
    @MangelMaxime

    Hello @klimisa,
    Fable cannot compile any F# library they need to be Fable compatible.

    https://fable.io/docs/your-fable-project/author-a-fable-library.html

    When you see Cannot revolse XXX that's the error Fable output in this cases. Although, we did improve the error message, to make the error more clear, in a version of Fable so you are probably not using the latest version of it.

    Antonios Kλimis
    @klimisa
    Hey @MangelMaxime , are any resources which I can read on how to make a lib Fable compatible?
    Thanks for the quick response.
    Maxime Mangel
    @MangelMaxime
    The link I posted explain it. You need to have a .fable folder included in the NuGet pack and of course use on Fable supported API as not all APIs are supported by Fable (for exemple, you can't use System.IO, etc.)
    Antonios Kλimis
    @klimisa
    What about Newtonsoft.json?
    Maxime Mangel
    @MangelMaxime

    It is not supported you have to use.

    You need to use the native JavaScript API, or package like Fable.SimpleJson and Thoth.Json.

    Disclaimer: I am the maintainer of Thoth.Json

    Currently, Thoth.Json with it's counter part Thoth.Json.Net which allows to have the same APIs on both Fable and .NET. The .NET version currently use Newtonsoft under the hood.

    Antonios Kλimis
    @klimisa
    Thx!
    poborin
    @poborin
    hi @MangelMaxime , how would one convert Javascript Object to string in fable as I'm getting it from the js-yaml.load(...). Or, perhaps, there is an option to parse an Object in the Thoth.Json?
    Maxime Mangel
    @MangelMaxime

    Hello @poborin , there is Decode.fromValue which behave almost the same as Decode.fromString which you need to give it the "root" arguments.

    In general, you just dive it $ because you are decoding from the top level of the "JSON"/Object.

    This is actually, what Decode.fromString do under the hood: https://github.com/thoth-org/Thoth.Json/blob/7f6b448ce9ba283b606926eace136eacc148d159/src/Decode.fs#L117

    poborin
    @poborin
    Thanks @MangelMaxime it works brilliantly!
    Florian Verdonck
    @nojaf

    Hi all, if I have something like this

    [<StringEnum>]
    [<RequireQualifiedAccess>]
    type private Period =
        | Today
        | ``This week``
        | ``This month``

    How do I convert a string to my string enum?

    kerams
    @kerams
    @nojaf, possibly just box "Today" :?> Period.
    Florian Verdonck
    @nojaf
    Box didn't work but !! did, let newPeriod: Period = !!ev.Value
    kerams
    @kerams
    printfn "%A" (box "today" :?> Period = Period.Today) returns true. Casing matters here.
    Does anyone have a clue how plugins are loaded? I created one in a separate assembly with [<assembly:ScanForPlugins>], referenced the compiled binary and decorated a type with it. No matter what I do though, I'm not getting the loaded message (like Loaded Feliz.HookAttribute). The project compiles but the attribute seems to be ignored by Fable.
    Maxime Mangel
    @MangelMaxime

    Hello @kerams,

    you should add a comment on this issue fable-compiler/Fable#2489 or open a new issue to ask Alfonso to publish documentation about the plugins. If we are several people it could help ;).

    I also found one of the original PR where Alfonso introduced the plugin feature.

    fable-compiler/fable-react#207

    There is a note about using using --exclude to exclude the plugin source code and use the dll instead in development mode. It is possible that your problem is related to that.

    kaashyapan
    @kaashyapan
    How does one implement a progress bar using Elmish ? Lets say an async gets started with Cmd.OfAsync.perform .... How does the async bloc update an integer field in the model about the percentage progress ?
    Maxime Mangel
    @MangelMaxime

    @kaashyapan I think you will need to create your own cmd/subscription instead of the classic commands because you will need 3 Msg

    • The first one to update the status progress
    • The second to notify / send the result value when the action is done
    • The third one to send when there is an error

    Then it is up to you to know look into JavaScript how they handle HTTP request progress and hook it back into your subscription logic.

    Here is some pseudo code so you get the idea:

    let httpRequestWithProgress 
        (arg:'a)
        (onProgress : _ -> Msg)
        (onSuccess : _ -> _)
        (onFailure : _ -> _) =
    
        let request = setupHttpRequest arg
    
        request.on("progress", (fun res ->
            dispatch (onProgress res)
        )
    
        request.on("complete", (fun res ->
            dispatch (onSuccess res)
        )
    
        request.on("error", (fun res ->
            dispatch (onFailure res)
        )
    
        request.start()
    kaashyapan
    @kaashyapan
    @MangelMaxime Thx for your response. I did manage to implement a solution where I used some Js callbacks and hooked it to subscriptions. My question was more related to how to approach this if this is going to be done in all F# i.e inside an async CE. I suppose it be done by using some standalone observables. I havent seen such a pattern Elmish MVU + observables commonly used. Hence the question. Will try it out. Thx
    Maxime Mangel
    @MangelMaxime
    For observable support there is this library: https://github.com/dbrattli/Fable.Reaction
    If you write a clean API on top of the callback it will achieve the same goal.
    poborin
    @poborin
    Screen Shot 2021-09-18 at 11.43.17 pm.png
    Hello! I have a couple of questions about Bulma.fileInput:
    1. How would one upload a folder content using Bulma.fileInput? According to https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory it's possible, but I cannot find such a property in Bulmas prop's
    2. Is it possible to style the input button in such a way so it fits Bulma's dropdown menu in the navbar naturally? e.g. I would like to make it similar to the Save element.
    Maxime Mangel
    @MangelMaxime

    but I cannot find such a property in Bulmas prop's

    As marked on the documentation the directory feature you are looking for is not standard that's probably why it is not mapped. You can always use prop.custom("my-props", "value") to pass it.

    Is it possible to style the input button in such a way so it fits Bulma's dropdown menu in the navbar naturally? e.g. I would like to make it similar to the Save element.

    Inside the navbar you can use the field and control component as "a container for almost anything you want" Docs.

    About customizing the the File component to have a similar style as the save button, it is not available by default from Bulma: https://bulma.io/documentation/form/file/

    The reason is probably that in general the current style is what is expected from the user. But you can always write your own CSS.

    2 replies
    poborin
    @poborin
    thank @MangelMaxime .