 that wasn't the joke so how do you how do you come for the javascript bug you can solve it come on I got more of a laugh when I said I was going to tell a joke how is everyone so I'm Stephen Cooper I'm also known as developer Steve everywhere including Weibo which is blocked on this network but yeah and Weibo is Chinese Facebook for those don't know I use it occasionally it's a good platform but I am developer advocate for PayPal and Braintree in the region and I can come now and say I'm from Braintree and everyone's going to go no because it's now launched to you but we'll get to that I am of course from PayPal who are putting on the event you may have heard of it small company just starting out but yeah I'm also from Braintree which not all of you may have heard of so Braintree basically the coolest integration ever like 12 lines of code seriously I do a demo on stage in a minute 20 let you take PayPal and credit card all of my little interface like PayPal will be coming soon to the integration to Singapore because it literally only just launched like two weeks ago it's super super new here it's still a cool integration in North America we've also got partnerships with to do Bitcoin which eventually will come here I've got no doubt it will and yeah so basically gives users like totally really cool ways to pay but did you want to see demo because everyone I'm talking to is like how do you do it did you want to see live code demo I was hoping you'd say that because I prepared one here's one we prepared earlier wait let me work out I did think that I was thinking I should have done but it was last minute so I could probably it could be done so this is the Braintree sandbox I've got no transactions in here because I just cleared my account to make sure it was all nice and fresh first thing I'm gonna do after I set up my account is going to my user and grab my API keys because that's the important part API keys so I can grab the public key from here I can grab my private key as well and it'll even give me different languages but I can grab so if I need integration can go right here grab whatever you need not media but we'll get so I've got a really basic I'm gonna do is PHP and JavaScript don't hate me yeah I'm gonna record it all these codes available on my github to github.com slash developer Steve so please go get it make it better break it do with it as what what you would want to do with it yeah and I'm available for questions so if you guys have any questions after please come talk to me let me see if I can can I make that bigger no I can't so basic folder I've got here I've got the Braintree SDK PHP SDK I've got an index.html and I've got a processing file it's a really basic form it looks basically looks just like this I did regionalize it a little bit can you spot what I did Lawrence is gonna go what did you do that it says pay the button so really simple input field for an amount and the button that says pay me lot so the for the code itself really basic HTML wait let me make that bigger there we go that's better processing side I'm just gonna call it wow that's really large in here I'm just gonna call in the PHP SDK of course I set up my configuration variables that I've gotten from the sandbox and I'm gonna first thing I'm gonna do is generate a token what that looks like is I get this really really long string there it is so I'm gonna copy so I'm gonna come back to the to the form I'm going to cheat and oops I just undid my law but I'm gonna drop in the JavaScript UI so this creates a drop-in UI which we'll see in a second inside that I'm going to attach the drop-in UI to a container which is called check out and then I'm going to drop that really really long token that I just generated right in there no one copy that down take all the screenshots and then I refresh the page and there's a payment box so what that token does it basically authenticates me as that user as that merchant and basically starts encrypting right from that start that that form loads in so now I can do my payment no one copy down that credit card it has a lot of sandbox limit then I'm going to go processing take this back out and now comes the fun transaction part so I've got some basic debugging in there just so you can see it now I'm expecting two amounts to be two inputs to be posted over an amount and then a payment method nonce so the payment method nonce I get back from brain tree once I hit submit it sends all the all the details in that box over to brain tree service so no credit card is ever stored on your server or PCI and then sends it back this payment method nonce that attaches to the form in a hidden field you get all that all right so 12345 paying with credit card I hit pay me just make sure I've saved that form and fingers crossed to the demo gods yes it works so now if I go to my sandbox here I've got a dashboard I should now see transaction for 12345 that's it first time I saw like I did that I was like wait that's it but yeah that's it that's literally it that was completely last minute because just because I was talking to a bunch of you and they were like hey what's brain trees yeah so anyway that's that's how it's done and languages so we literally just launched a new version of the website tonight I don't think Lawrence is seeing this yeah it's you brand new it's just come out but yeah you can choose really cool you can choose your front-end language so you can don't have to use JavaScript you can use iOS Android you can also customize that entire form the drop-in UI you don't have to use that and all your back-end languages as well and yeah everything's document on the side I can answer questions and yeah that's it anyway now I'm gonna do the talk yeah so tonight I'm gonna talk a bit about Mongo which I should have put a slide in for but I didn't yeah so tonight I'm gonna talk about Mongo just how I've used it in the past so previous to this I'm a full stack dev I've been working and before being a developer I was a analyst so I was working with Oracle MS SQL anyone worked with the MS SQL before my sympathies just sorry the thing that bug me the most is you can never do the limit it was like well I think you can now kind of but yeah you'd have to bring back top and you know but yeah that's basically what they've been to Mongo was I was working in digital agency world which I don't know if many of you from digital agencies like sales rules the world and literally that's where Mongo has basically saved me and why the title why I've got the title tonight digital agency world is a wonderful place I liked the chaos organized pay us is to call it but I was senior developer before this at a few different agencies and sales rule the world because small agencies sales runs everything so they would always come back with these wonderful requirements of things they know making buttons different colors and redesigning the world every time I'd have to read a plan out little social media agency whereas where I first started using it we started selling Facebook apps this is back in 2011 everyone remember Facebook apps when that was a thing so we saw their first one in 2011 was like a sign-up now or something and like literally me and the front-end developers sort of threw it together in a few hours because digital agency and we use my SQL which is great did the job got off the ground and then they came back and said no no okay now we want another one for this client and then this client and this client and this client before we knew it like we had all these all these sort of things piling up the poor my skill database just could not cope so we had standard schema like we just literally put up a table had app ID equals you know auto increment column app title some basic config which was getting bigger every time we had a new version of the outcome out because oh now we need size knowing image yeah it was it was growing and then for every app there was a different set of requirements to store data so you would get at one table one at two table two which is different to table one because it means to do this stuff and then this stuff and this stuff and it just grew sales went nuts so started off with one app and before when yet we had you know 25 words or less we had signed up now to win this we had a whole plethora of apps that they were selling so we ended up with that data everywhere which at some point you kind of stop and go you know hey this isn't going to scale like we're in trouble it's gonna start sinking of course Mongo to the rescue so I started poking around in no SQL world which is awesome because literally Mongo you can throw anything you want at it like you create like a top-level branch you can start storing like huge amounts of amounts of arrays and most languages love arrays so literally you know take an array dump it straight in get data back from Facebook for the user throw it straight in Mongo you've got to be you know to keep doing API calls it's it's great of course there's normalization issues but we'll get to that Mongo server so the times that I have had to set up a server to support Mongo and I do my own sysops because I like playing in my own playgrounds and I want to use shared hosting because that's someone else's playground yeah you need a really good server to run will go like last time I set it up I got it running on a AWS medium instance but you could quite easily like scale that to large and like go really beefy you could not run another small server I've tried they are very resource hungry they will chew memory like lollies like they're literally candy they will they will literally need a really good server to run it on the upshot is dynamic collection so yeah literally you create a top-level branch your branches become the schema so in Facebook Facebook app example what I was doing was I'd have a Facebook branch just in case we decided to branch out branch out branch out and move into Twitter apps which I actually did end up doing an Instagram apps which I also ended up doing but it meant I could keep everything in its own little collection so I could have a Facebook branch I put config for the app that it was it was using in the app side and then I could do things like layout so if we had a dynamic draggable interface so user could drag a block in resize it all the variables from that the XY the all the positioning or the sizing or the app or the module configuration all stored in Mongo is amazing literally anything I threw at it Mongo could come up and keep on kicking so once a user actually interacted with one of the apps that we're building again I could store very similar top-level branch schema in a user record transactional whole other story we'll get to that I have actually got a way to do transactions you can do it but you know we'll get to it so yeah sort of in a Facebook branch app ID reference just to keep things nice and tidy and then whatever data they generated they filled in their name and address and 25 words or less or whatever the game was we could throw it in Mongo was all stored somewhat normalized but we could do some basic reporting across all the different variations and then more customized reporting as we needed to then I moved on from there and ended up working for Clemenjo which is a really sort of big agency sort of a well-known agency in agency well-planned but working for doing work with big name companies like Samsung Diageo the Diageo is like the parent brand for a whole bunch of alcohol companies bullet whiskey they do there's vodka companies there's all different drinks companies so they wanted to have some type of way to track again social media because it was it was big back in these days well that was a year ago industry moves fast but yeah they wanted to track influences in different industry types so they wanted to have users that I could track through system that I ended up developing and then find out whether they're saying positive negative things about a brand whether they were an advocate for the brand so that we could identify users that they could approach and give free experiences to or sort of help them promote the brand the company so what I started doing was watching profiling users and of course the best database to do that was Mongo I needed something dynamic I needed something I could throw transactional data into and then continually reanalyze that data knowing that I was dealing with sales that was going to come up with like every other change to the system every other week storing data at a transactional level so that I could reanalyze the data on mass and then find out different things in different ways was the biggest win so I could grab an entire user's public Facebook I could grab Twitter I could grab whatever whatever we wanted to watch and store in a similar way and then run like a sentiment API over the top so basically I could grab user level granular data transactionally per platform beta website be whatever social media process that data in different ways it could be that we're looking for particular sentiment words particular tones of sentence structure we grab that data run through various API is various various other system external systems bring back some type of scoring or some type of analytical reference and then normalize that data back to the client so we could say here's your top three you know people that we uses social media users that you should target here's what you should do for them here's top 20 maybe do a party for them like we were able to use this data all because of Mongo we have a story we're able to analyze it we were able to report on it again I kept it very simple I'm self taught with a lot of this stuff so this is just how I got it to work but obviously it different for different user cases it may be different at the end of the day I was in the seat I have to make it work it works well it was it but yeah very very similar structure so campaign brand and then I grabbed social media feeds I could have easily taken the print the brand campaign out just had a Facebook branch then dumped all that in but I could have been watching different things for different brands for different reasons and I wanted to keep it super super dynamic just because I like the challenge and Mongo can do it so I wanted to tie it back to something e-commerce because I am the advocate for paper-brain tree I thought it before but yeah transactional funny it was mentioned early so I thought Uber great example like they do a lot of data I know they do a lot of data because they have some really good servers on the brain tree side of things so Uber uses brain tree those are don't know Airbnb github they all use brain tree if it was me running setting up their database this is how I do it so use the collection I'd have in the car because they have different experiences they have helicopters now in New York they have bikes in some places like this they're gonna expand like it's inevitable keep things nice and simple have a main branch so you can build on it have a config I'm going to store the brain tree token so if I was putting with brain tree you can store the one I did earlier the example did earlier was just a basic transaction you can store credit card inside the brain tree vault for those that have used Uber first thing you do when you set your profile up capture your credit card then you set up your profile when you do that stores it in the brain tree vault you get a token back and then whenever you need to transact against the user you reference the token trigger the transaction user never has to put their credit card back in again unless it expires or they want to update it or otherwise just transact against it and then a branch for transactions so I just got in different Uber transactions added transactions added transactions added you can do transactions in arrays interacting with that and as we're saying before taking data back out it's a whole other story that gets a little bit tricky putting data in the mongo is extremely easy like getting rid of data from mongo that's a whole other thing that's kind of me but I'm open to questions and I do like memes so you can comment on what means it never showed right but yeah any any questions hopefully that was somewhat useful that was just how I've used it in the past and yeah kind of it works it worked really well I'd love to use it again it's I don't think it suits every scenario those are just the scenarios I used to do in some cases you are going to use my skill just because it makes sense like you you'll have it on the server you'll have a very light app you won't have the need for the dynamic you'll need the structure the thing I don't think mongo is still does very well and I've been using it for a while since the early days it doesn't do group by so you can't aggregate data easy I think it still struggles with that I mean you can do it map reduce it's a thing it doesn't really do it well otherwise you'd be grouped by in your code so you've been back a whole chunk of data then you sort of aggregate it and spit it out from there so you're talking about using mongo and AWS yes I've looked at those and also you originally set it up in racks space under a lamp stack previously under it was a red hat built but yeah we'll see is it under a pin to and I've run some local instances and stuff but yeah I have looked at some of the pre bake services I was cut the type of senior developer lead tech lead that liked to build my own playgrounds because I had full control over all the things but yeah of course that that means I mean waking up at 4 a.m. to fix servers and stuff that's all but yeah I have looked at some of the other those services are good providing they scale with you and the reason why I would I choose mongo for my project is I needed something that would scale quickly if needed did you never know if something's going to take off you know take right off and you gonna have millions of years of I mean that's as a developer that's kind of my ideal scenario like I build stuff for two years is but potentially to know with the whole questions fine cats with lasers oh we have work sorry what was that I like trying a whole bunch of different like I've tried other databases as well I still longer for large projects kind of make sense if you need something dynamic if you need something really structured that makes more sense as well there are configurations where there are times when you need a hybrid so if you wanted to do reporting on so the mongo data you can run a process store it on mongo transport all over to my SQL and have like a structure environment to play with it in you can do the reverse of that as well I don't think you would but you can do the reverse of that as well but yeah I mean there's always new technologies coming maybe someone will come up with like a semi structured version of mongo at some point in the future that wouldn't really make sense but they might cats with lasers right anyway that's me I'll be around I have some stickers don't read all my stickers but I have some stickers to come see me after thank you