 The following is a Coderland presentation about our newest attraction the Compile Driver Hello, this is Doug Tedwoldt for Coderland and we are thrilled to have with us our good friend Don Schenck Don wrote the cool parts of the Compile Driver sample that we published recently Don's part was the react-based front-end that makes the demo scenario much easier to use as you know if you've gone through the Compile Driver and if you haven't what are you waiting on If you've been through the Compile Driver the heart of the code Does image manipulation via JSON with Don's code? You can see those results instantly on the screen fabulous piece of work check it out if you haven't seen it So Don welcome. How's it going? Good. Thank you. It's good to be here. Everything is going fantastic The app is done. The app is done and shipped. So I'm thumbs up Yes, yes life is good until the next project starts. So there we go Well, tell us a little bit about how you worked with the camera because that was one of the things going into this That I thought might be a big hassle somehow getting access to the webcam From a web app. Was that a big hassle? Well, it it wasn't a big hassle, but there were some interesting things So I you know like anybody else I used my web search kung fu and found a library for react and that was you know That was simple enough It was a little bit challenging to figure out exactly what some of the settings were but like any developer You just start hacking away and play and see what happens, right? But what I found interesting was that? running things Became a problem because you can't use the camera over an unsecured connection In other words, you have to use TLS if you just run it straight HEP The camera doesn't work and you cannot on like in Chrome you cannot unblock it like it blocks it You just don't have a choice It doesn't even come up and ask you and you go to settings. It's like no you can't do this So you have to use TLS HTTPS to allow the camera To be unblocked which I understand I mean it kind of makes sense that people aren't eavesdropping on you I guess reassuring. Yeah, but you know how it is your developer you get all the stuff and it's gonna work And then you find out now I have to install a certificate on a server So now you're going down these rabbit holes like any other develop project, but in the end I found a library that uses the HTML 5 Canvas which allows you to use a camera and I found a really good Base 64 encoding library to send the files back and forth. So I was often running There you go. Cool. Yeah base 64 was one thing I thought from a Java perspective the the image manipulation code is a spring boot app and Didn't really know what I was in for in terms of JSON mangling and work with base 64 Base 64 is baked into Java to my delight. I had not worked with those libraries before And there's a cool library called Jackson that works with JSON. So it automatically Serializes deserializes as JSON made made my life easy other things as you know did not make our lives easy as as Projects will Tell us a little bit and you know your opinions be as as diplomatic or not as as you care to be Your opinions of k-native versus open-wisk, which I know you've used open-wisk quite a bit What what are your thoughts on k-native as sort of an emerging thing? that Seems to have a lot of momentum behind it. Yeah So there's two answers or two parts to it. So first of all as a front-end developer I don't care because I'm not dealing with it. I mean that's that's that answer but having dealt with I mean put up with you dealing with it It k-native got to be frustrated. So Comparing the two and I want to go much too much into it because I actually wrote a blog post That addresses this but open-wisk had all the plumbing if you will for for restful interface Like build into you don't have to code anything to handle HTTP Request it's built into open with open-wisk and creating a function is like you write a file and you run a command and you have a function k-native is Has what k-native has done is made microservices into functions because they scale to zero Right, and then has other I mean has eventing serving and building and you know it works better for like monitoring and Istio is built into it. So there are benefit. We k-native is gonna win. I just I think There was some frustration dealing with it. It's not as slick. I don't think from strictly a developer First Lance at it But I guess like anything else once you get used to it. It's fine from my standpoint as a front-end developer It was just a URI so right, right, right, but we did Yeah, it got to be a challenge It was fun Yeah, I'll just share this for our millions of viewers doing tuning in that the issue with k-native is That to send requests to it. You have to use the host header and An X HR such as would be emitted by Don's react application can't modify the host header So nothing would work Ultimately, I hacked together a little proxy to get around that Your code calls my code. I fixed the header and off we go but that was That that that was a weekend. I just assumed forget Yeah, well if anybody comes up with a solution that works we accept pull request that would be slick if somebody went Oh, you know what it is and you know, it's gonna be it's gonna be oh, there's this one little thing Right semi-cooling and a plus sign over here will fix it or something like of course I Will be thrilled to get that PR and I will merge it instantly that will be a fine thing I will be happy to delete my proxy repo from GitHub destroy it forever if that happens Yeah, so one of the things you do another way you could get around it is instead of my code calling the back end is The camera would write a file and then the back end could be watching the directory to pick up the file The there are some benefits to that one of which is once you write the file you have it in Perpetuity or until you delete it whereas ours you you you we're not as soon as I get them based image We're we're Overlaying it so there's no record of the first one to speak We're stateless Yeah, basically. Yeah. Yeah, that's a good way. That's when we look at although in real life You'd still have to write it somewhere But the point is right that is another option was to you know to write it to a file and I have worked on systems Where that's what we did So like every other decision in IT it depends and your mileage may vary and you know Yeah, because what one of the things we did to keep it simple was we did not use Knative eventing Right, which is something, you know, we've talked about this before that We could have done Have Knative eventing set up to watch You know an s3 bucket or something so that you know if your code writes a file and event kicks off and Yeah, so we kept it simple and only used two weekends of trying to get Knative to work rather than using eventing and spending an hour We were really smart though In retrospect it was a real genius effort Yes Here is yeah What developer hasn't gone through that and hindsight is always 2020 and so we did it folks. So maybe you could like not do it or Do as we do no But it was a good project to get into it so to speak it works well it works well Yeah, you know, you know, especially if you're you're running your stuff, you know, it doesn't really matter if you go You don't have to go through Knative to use this code with the react front end use the webcam take a picture click a button and And there you know what I didn't do I just real just not realized it I didn't even try just on a mobile device. I'm gonna See what happens I guess by the time you are watching this I will have done that but Go try a little device to do it happens It'll be a follow-up follow-up podcast later or something. It'll probably be a PR to a pull request to make it So I did use a I think I use bootstrap Anyway, we'll see what happens. Yeah, I did not try it on anything but my laptop. I couldn't tell you All right, and anything else you'd like to say about the code of me it was a real pleasure working with you It wasn't always pleasure, but it was a lot of fun getting this Getting this thing knocked out with you No, other than just keep in mind everyone that the the underlying languages the Java the node and all that you can You can do what you want. So you can write the back end and net you could do the front end an angular That's what's really cool about working with k-native and just containers in general is that you have us Freedom for example before this interview. I was running cobalt in a container just because you can Yeah, well, that's gonna be a small blog post just to prove a point but can you cobalt in a container? Yes, sir It's there. It's coming Next project, I'll probably give it to you in cobalt. Okay, looking forward to that. Yeah Gonna go update my resume in LinkedIn profile now Downstate it would be the better words than updated All right, well done it was great working with you I hope we do many coderland related things in the future that this has been a lot of fun and I think people will get a tremendous amount of Benefit out of your examples there. It really made the project much better. Thanks for the warning There you go. All right. Well, thank you brother. I appreciate the time. Thank you. See you. All right. Bye. Bye