Coder Social home page Coder Social logo

blog-samples's Introduction

blog-samples

Repository to hold sample codes that I use in my blog posts

blog-samples's People

Contributors

leolorenzoluis avatar tamizhvendan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

blog-samples's Issues

No .gitignore

Hi,

I think You should add .gitignore file to react-hello-world with content:
./node_modules
./src/public

Running SuaveJwtSampleApplication

Running on OSX with Mono 4.6.0.

Looking at the Mono source code, it looks like it doesn't support it there. Do you know if there's any workarounds?

<h1>IDX10632: SymmetricSecurityKey.GetKeyedHashAlgorithm( 'http://www.w3.org/2001/04/xmldsig-more#hmac-sha256' ) threw an exception. SymmetricSecurityKey: 'System.IdentityModel.Tokens.InMemorySymmetricSecurityKey' SignatureAlgorithm: 'http://www.w3.org/2001/04/xmldsig-more#hmac-sha256', check to make sure the SignatureAlgorithm is supported. Exception: 'System.NotSupportedException: Specified method is not supported. at System.IdentityModel.Tokens.InMemorySymmetricSecurityKey.GetKeyedHashAlgorithm (System.String algorithm) [0x0001c] in /private/tmp/source-mono-4.6.0/bockbuild-xamarin/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/System.IdentityModel/System.IdentityModel.Tokens/InMemorySymmetricSecurityKey.cs:128 at System.IdentityModel.Tokens.SymmetricSignatureProvider..ctor (System.IdentityModel.Tokens.SymmetricSecurityKey key, System.String algorithm) [0x0009b] in <043c3e7a937a4a2398f0429200b384e5>:0 '. </h1> <br/>System.InvalidOperationException: IDX10632: SymmetricSecurityKey.GetKeyedHashAlgorithm( 'http://www.w3.org/2001/04/xmldsig-more#hmac-sha256' ) threw an exception. SymmetricSecurityKey: 'System.IdentityModel.Tokens.InMemorySymmetricSecurityKey' SignatureAlgorithm: 'http://www.w3.org/2001/04/xmldsig-more#hmac-sha256', check to make sure the SignatureAlgorithm is supported. Exception: 'System.NotSupportedException: Specified method is not supported. at System.IdentityModel.Tokens.InMemorySymmetricSecurityKey.GetKeyedHashAlgorithm (System.String algorithm) [0x0001c] in /private/tmp/source-mono-4.6.0/bockbuild-xamarin/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/System.IdentityModel/System.IdentityModel.Tokens/InMemorySymmetricSecurityKey.cs:128 at System.IdentityModel.Tokens.SymmetricSignatureProvider..ctor (System.IdentityModel.Tokens.SymmetricSecurityKey key, System.String algorithm) [0x0009b] in<043c3e7a937a4a2398f0429200b384e5>:0 '. ---> System.NotSupportedException: Specified method is not supported. at System.IdentityModel.Tokens.InMemorySymmetricSecurityKey.GetKeyedHashAlgorithm (System.String algorithm) [0x0001c] in /private/tmp/source-mono-4.6.0/bockbuild-xamarin/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/System.IdentityModel/System.IdentityModel.Tokens/InMemorySymmetricSecurityKey.cs:128 at System.IdentityModel.Tokens.SymmetricSignatureProvider..ctor (System.IdentityModel.Tokens.SymmetricSecurityKey key, System.String algorithm) [0x0009b] in <043c3e7a937a4a2398f0429200b384e5>:0 --- End of inner exception stack trace --- at System.IdentityModel.Tokens.SymmetricSignatureProvider..ctor (System.IdentityModel.Tokens.SymmetricSecurityKey key, System.String algorithm) [0x000e3] in <043c3e7a937a4a2398f0429200b384e5>:0 at System.IdentityModel.Tokens.SignatureProviderFactory.CreateProvider (System.IdentityModel.Tokens.SecurityKey key, System.String algorithm, System.Boolean willCreateSignatures) [0x00164] in <043c3e7a937a4a2398f0429200b384e5>:0 at System.IdentityModel.Tokens.SignatureProviderFactory.CreateForSigning (System.IdentityModel.Tokens.SecurityKey key, System.String algorithm) [0x00000] in <043c3e7a937a4a2398f0429200b384e5>:0 at System.IdentityModel.Tokens.JwtSecurityTokenHandler.CreateSignature (System.String inputString, System.IdentityModel.Tokens.SecurityKey key, System.String algorithm, System.IdentityModel.Tokens.SignatureProvider signatureProvider) [0x0002b] in <043c3e7a937a4a2398f0429200b384e5>:0 at System.IdentityModel.Tokens.JwtSecurityTokenHandler.WriteToken (System.IdentityModel.Tokens.SecurityToken token) [0x00091] in <043c3e7a937a4a2398f0429200b384e5>:0 at [email protected] (System.Collections.Generic.IEnumerable1[T] _arg2) [0x00038] in /Users/leoluis/Projects/FSharpApplied/blog-samples/SuaveJwtSampleApplication/SuaveJwt/JwtToken.fs:55
at Microsoft.FSharp.Control.AsyncBuilderImpl+args@787-1[a,b].Invoke (a a) [0x00016] in
<53ed7cac904cf4daa7450383ac7ced53>:0`

New version of HttpFs affects example of the book

Good morning Tamizhvendan,

I have been following the examples of the book and thinks have changed a little bit since the edition of the book. Now, HttpFs using Hopac.dll to do its inner workings. This change impacts a little bit on how to make things work. Now there are more abstractions to consider like "Alt", "Job" and so on.

I changed a little bit your example of get request async in order to make thinks work again. In fact, it works but I'm not sure if this is the best way:

let getResponseAsync url = 
    async { 
        let req = Request.create Get (Uri url) |> Request.setHeader (UserAgent "FsharpTest")
        return job { 
                   let! response = getResponse req
                   let output = 
                       match response.statusCode with
                       | 200 -> 
                           let b = Response.readBodyAsString response |> run
                           Ok b
                       | _ -> Error response.statusCode
                   return output
               }
               |> run
    }

let asyncResponseToObservable = getResponseAsync >> Observable.ofAsync

Do you agree? Do you have a better solution?

Kind regards from Brazil.

Running the app

How do you run the app after doing this all.
I am typing npm start but it's saying missing script: start

Queston about the warbler function

I've started learning F# and Suave and I'm reading the book F# Applied.

One thing I'm struggling with is the warbler function. I know its something to do with deferring execution but I don't really understand why and when its needed.

Apparently we could also use the request function as an alternative to warbler.

Can you provide any more detail on why and when these functions are used.

SuaveJwtSampleApplication/SuaveJwt/JwtToken.fs dependency problems

Hi, thanks so much for this book, I am considering some F# in a C# project at work and the architecture examples present here have been a big help in making this assessment for our specific requirements.

I just wanted to give you a heads up that it is not possible to run the code for the Jwt sample application picking the newest versions of all the libraries that it depends on. There appears to have been some backwards incompatible changes to System.IdentityModel.Tokens.Jwt assembly that prevent it.

I found that by using open System.IdentityModel.Tokens it was not able to find the JwtSecurityToken or JwtSecurityTokenHandler classes, and if i instead used open System.IdentityModel.Tokens.Jwt it could find all the constructors but would not let me use the signingCredentials object as written.

The solution for me was to downgrade the System.IdentityModel.Tokens.Jwt nuget package to its latest 4.x release (instead of newest 5.1). I can't really glean from the MSDN pages what changed, so that is the solution I am going to stick with. I just figured I would drop a note here for anyone else attempting this section.

Thanks again for your excellent work.

Ben

PrintfFormat explanation

Great example code but thought it might be worth providing some more explanation on the use of PrintfFormat with dynamically constructing a pathScan route - this had me scratching my head for awhile - the suave music store book doesn't explain it and the msdn docs for PrintfFormat are basically empty.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.