Like in quantum error correction where the information is cleverly distributed amongst several qubits The information in this lecture is distributed amongst two different lecturers so we have Ben Krieger and Kiran Ryan Anderson and so they'll be doing a tag teaming giving one lecture after the other So I think we'll kick off with Ben here. Thank you very much. The the company also doesn't let us travel on the same plane um Well, okay, so Whenever i'm lecturing i'm reminded of like being in kindergarten And you know talking to kids who are in kindergarten no matter what you say to these people They stick the hands of the go. Why right? Why are we learning this? Uh, and the job of the education system right in the government is to beat that impulse out of the children So they never ask why they're learning so they just learn whatever it is you tell them to learn And then they regurgitate that information at the end of the semester But luckily your experience i hope in government education institutions is now complete So we can resume asking why and we can do it right at the beginning of the lecture So that you know, you'll you'll have an idea of where we're going what we're trying to achieve There's a double-edged sword right to quantum computing These devices have exponentially large hobart spaces inside of them Which makes them really powerful right? There's all kinds of stuff that you can do in that space As long as you can design some clever measurement at the end or turn your problem into a wave and apply a Fourier transform to it But also that exponentially large hobart space makes them really tough to analyze Right good luck trying even to find out what the effect of some unitary matrix is on a vector when you're dealing with Um 200 qubits or something right even with you know arbitrarily large supercomputers It's um, it's going to be really tough Um, and you know, if you can't figure out what one gate does good luck designing an algorithm Good luck understanding data structures or any of the higher level abstract Um things that we want to do to create a real branch of computer science Uh, however, not everything that you want to do with a quantum computer requires its full power Uh in error correction me and this guy, uh, we are spending our entire lives trying to figure out how to get a quantum computer to do nothing Uh, and it's very easy to describe that operation You can do with one, you know symbol Right then this thing is worth a lot of money Um Because quantum computers can't do it, you know, well, they also can't do this So, you know, you want to prepare a zero state you want to do nothing You want to maybe measure in the x basis? None of these things are are possible with fidelity one you always get some operation. That's uh, kind of close to You know the x measurement of the zero prep or the or the identity uh, and so You know given that the things that we want to describe are already trivial until we compose them into big circuits And we're going to have to add a lot of overhead Um, how do we come up with some theory of quantum mechanics that allows us to process non-trivial states like highly entangled states for example In polynomial time, right? And today we're going to go over one way to get that done Uh, and that that way, you know, people call it Goddisman knill after some of its authors People would say stabilizer operations if they know about stabilizers most of the time I would just say Pauli's and Clifford's although You know given that this is Professional rather than academic we don't settle on terminology We just sort of juggle different terms around and if anybody gets confused we leave them behind for the wolves All right, so why Pauli's and Clifford's? There are many different efficient sub theories of quantum mechanics that you could focus on Some people do tensor network states where there's a limited amount of entanglement That's very good for condensed matter where you know, things can be at weird angles in different bases But the amount of entanglement is sort of area law limited There's also fermionic linear optics or match gates If you want to get a postdoc get good at one of these, um, sub theories Uh, you can even design error correcting codes in these sub theories But why would we do it with these Pauli's and Clifford's? There's a few reasons the first is versatility a lot of the, uh Problems that you see in quantum computing, uh, like finding the ground state energy of some Hamiltonian You look up the Hamiltonian and you see it's a bunch of Pauli matrices Um, some people in fault tolerance quantum chemistry focus on a problem called cubitization Where they take some problem and turn it into a bunch of Pauli matrices All right, given that they're doing all that work, you know, maybe we can Uh, sort of live nice easy lazy lives by just focusing on Pauli matrices And of course anytime you see, uh, you know fermionic creation and annihilation operators people would say Ah, do the Jordan-Wigner transform now it's easy, right? It turns it into Pauli operators And then there's a quantum error is an error correction We'll see later in The next lecture that If you can correct Pauli errors, then you can correct a lot of stuff Uh, and Yeah, nobody believes that they're gonna get their physical error rates You know down below 10 to the minus five without some kind of protection Like even the topological cubit people are edging on error correction They're doing like everything but error correction And they I I think they think they would get down to 10 to the minus six ish But if you want to run an algorithm with billions of gates in it, right? Then you can't tolerate thousands of failures distributed somewhere in the circuit because garbage in garbage out and You know everything's going to Become a gigantic analog mess Uh, and for this reason we design codes using Pauli's and Clifford's in order to Uh, do a bunch of active error correction in firmware, basically, right? So it's a it's a layer of the quantum stack is a term which I abhor that uh goes between the hardware And it sits just on top so that when you provide to the user or to the higher level routine or virtual operations that Right Pauli operators can be used to detect Pauli errors We're going to see this in a minute and there are these Clifford things that can be used to transform Pauli's into other Pauli's And the machinery for you know moving errors onto ancillary apparatus that can detect them is already neat and tidy Um, so yeah, basically ease of use Is one of the main reasons for this And all we're going to need to notice start is a little uh undergraduate quantum mechanics or maybe first year masters A little group theory and then we can get going really okay, so um Let's do quantum mechanics In like 15 minutes uh chapter two Nielsen and twang if you're not reading nielsen and twang You're doing it nielsen and wrong All right, uh, so Oh, I should have started my lecture with a joke, right? Variational quantum eigensoulvers Okay, that was a good one. All right Ah pure beef we can Uh, we can represent quantum states using vectors This is a postulate of quantum mechanics or like an axiom which is a fancy word for something I will say without knowing how to prove Uh, and that you know looks kind of like some normalized Way too vector no big deal Uh, there are operations as well, which are usually unitary, you know inshallah um You could have for example something like so one yeah square root of three Minus the square root of three and another one you could apply such a unitary to such an operation And it only really gets complicated when you start dealing with measurements Okay, so let's deal with measurements now These are going to be operators which are observables called o that will decompose right there I think everybody's familiar like these are hermitian matrices. They have real eigenvalues. You can diagonalize them Anybody who's not you know familiar with this should like pull the parachute right now And get sucked out of the electric because you might get lost later. Although. It's okay. You're young You can sit around to be lost for an hour. It's fine, but you would decompose one of these into Uh, so real valued eigenvalue and then These projectors pi j And when you perform a measurement Here is what happens according to the postulates of quantum mechanics You would receive an outcome Lambda j Sometimes multiple lambda j's are identical and so you won't know which j corresponds to which lambda j So you can project into a subspace rather than projecting into a state But you get out these lambda j's and you get one out with probability p j equals Whatever your initial state psi was that you're doing the measurement on You know projector psi so Basically, this is this is like an inner product between Uh, a rank one projector psi and this projector here. So you can think of it as like how much of this state is in this space Basically because it defines a norm and then psi gets mapped to right under the action of this projective measurement when you Discover that it was lambda j You get pi j psi Right, which is just the projection of this state into this space divided by Square root of pj and all this term does here is normalize the state again So this is like conditional if you know if If you were assured that the measurement had occurred but not told the outcome you would get a mixture of these things And it would be a convex combination with scaleless pj. All right We are not going to use the heisenberg picture, but I have to tell you about the heisenberg picture anyway All will be revealed No worries Let's imagine like a really complicated experiment in which Some state is prepared It's then exposed to some unitary evolution And then we measure out some observable Uh, can everybody read my handwriting by the way? Even people in the back are nodding. Okay, we're good Right, so what's gonna happen? The only things that we observe are these eigenvalues that come out of the end here right these little Lambda j's and they each show up with a pj where I have to stick in the evolved state now So I'll conjugate the evolved state psi u dagger, right? Pi j u psi and then the Projection takes u of psi Right this thing maps to square root of pj and I could just rub this thing out and Stick the dagger on there and now we see what happens to the initial state. It goes to U dagger pi j u psi. Okay, so Two things could have happened It may be that Psi evolved to u of psi And then got measured or it may be that the Projectors right and therefore the The operator itself sort of evolved backwards right under this u dagger pi j u And then was measured against psi and because the outcomes of physical experiments that obey the laws of physics Don't distinguish between these two cases. They're like equivalent And so you can use Operator evolution in order to say what has happened in some physical scenario rather than having to evolve vectors We're going to see an instance of this again, although it's not quite the same as the heisenberg picture Although the paper that this comes from is called quantum computing in the heisenberg picture or something At any rate, we're going to start evolving operators in a minute Apologies to the masters in hpc program. You should all go get a masters in hpc But I need blackboard space So It's going down Hpc criminally underrated topic though So now that we've covered quantum mechanics in 15 minutes, let's do like 10 minutes of group theory This is what it's like being in quantum computing You you wake up and you come to work not knowing whether it's going to be algebraic number theory Atomic physics This stuff And you sort of take whatever the day has to offer so if If you're kind of good at a lot of different types of math apply for a job or something All right Now again, I'm not a mathematician. So I'm going to start with a punch line Group theory is a way to cheat at matrix multiplication Uh using group theory You don't have to write out all of the elements of the matrix in order to Calculate matrix products. You can just look it up in a table and often or for big enough matrices that Uh, that can mean you take polynomial time or like linear time even so like a professionals polynomial Not like into the 10 or something rather than doing exponential time Um, but a mathematician would say, you know, a group is a set endowed with an operation, etc, etc Uh, and well, okay, we have to do that now. So a group is a set endowed with an operation There are you know, there's some set g with little elements, uh g and there's an operation which will take Two elements of g And give you a third element and typically you write it with a little circle or you don't write it at all So I would say something like, you know g prime g double prime equals g Triple prime, right? It's and you can think about it like multiplication Even though for some groups it acts more like addition And the the point of group theory, right is that you're abstracting away which mathematical operation it is You're just talking about its properties Uh, right, so every group by definition has to have some identity element i such that i times g equals g times i equals g for all g in the group and you have to have an inverse g inverse such that g inverse g is g g inverse is identity Okay, uh group theory has a ton of applications. There are a lot of different groups You can do like rubik's cubes with group theory Um, you can do robot arms. You can do cryptography. You can do whatever you want, but we're going to look at a group with four-ish elements Which is just some poly matrices. Okay, so Uh, our identity is going to be this two by two identity matrix We're going to have x y and z We've already seen these matrices pop up a ton of times So the fact that we will no longer have to multiply them at the end of the lecture, right? It's going to be very advantageous anytime you see one You'll be able to start thinking about it, you know in linear time rather than trying to remember Where the minus i goes for example Don't worry that one's correct And we will see that these things form a group because they're closed ish under multiplication. So for example x y Is equal to You'll see how look at how tedious this is Right I already know the answer, but I can barely like I'm writing so much Okay, it's i z That's a bit of a problem. I would rather not have the i here But luckily you can always define the group operation that you're going to use to be multiplication where I delete the i afterwards Um, that's fully mathematically legitimate, right? It provides a map from two instances at two elements of a group to a third It's a group operation deal with it. And then Let's see we can do a whole table. I forget what these tables are called but you can make a whole table Of let me do the little circle means i'm deleting the phase. Yeah, so I could take i x y z i x y z And I get identity identity identity identity What do we get here x y z x y z? And then this thing is going to be Well z y z x So now I no longer have to multiply these matrices whenever I see them right if I've done the work once Of showing that this is closed under multiplication Then there's only a finite number of things that can it can be and I can look them all up on this table Um, which yeah, okay. I can see that you're not rolling in the aisles, you know Uh yelling hallelujah. Yeah, it's not very impressive that I I know how to get rid of two by two matrix multiplication Um, but don't worry the next page these notes go on so Uh, we will also be able to do this for tensor products of poly matrices Oh, I left the cloth over here. I don't even need it actually Let's just make another weird ugly line do tensor products Did I already say that I would make these notes available? So if you want to write things down you can but everything I'm saying is like roughly in here So writing is optional If you're just not that kind of person, okay, so a tensor product Is how you describe mathematically operations that occur in parallel And it's it's easiest to see what the properties of a tensor product are if you do it diagrammatically Right, so I'm going to use this funny symbol.  I work with Keep your hand down So a tensor b is represented by right a b So it's when I have A composite system. It's got two subsystems in it. I do the operation a to one and b to another And uh, you can see really easily one of the properties of the tensor product, which is how it composes with the series product Uh, and it's so important that I got to write it high up, but then I'm like leaving real estate Who cares? All right, so a o times b c o times d If I write this as a diagram, right, that's a b And then the next uh, have I done this the wrong way around? Whatever doesn't matter what these things are called It'll be correct in your notes Uh, so if I join these wires together We can see right just by you know sort of changing the bracketing Right, this is a o times b c o times d, but if I instead Oh, like if a if a tensor product war pants, would it wear them like this or like this, right? If I instead do this You can see that this is equal to ac times bd Where time runs in the opposite direction or whatever, uh, but it doesn't matter because the Names are consistent from here to here Uh, and this is a very valuable property because it allows us to Right anytime I I can multiply two by two poly matrices and get the answer just from table lookup I can do that here and here And if I had a longer tensor product, I could do the same thing And it would just be a linear number of steps rather than some exponentially big matrix Super convenient I'm going to go all the way over here to introduce a very tightly related property Because I'm out of board But that's also okay Most of this lecture will take the form of pro tips If you have eigenvectors And you take a tensor product, right? So it's a tensor b And then I feed that into You know the operation here then I get the product of the eigenvectors ab So anytime Oh, yeah And by the way people often write tensor products just inside the cat just a big list of symbols And that way you can do stuff like one zero zero one, right? Little compact cats That denote whole bit strings So anytime I take the tensor product of two operators, I get the scalar product of the eigenvalues Fantastic. All right, so With those pro tips out of the way, let's make our efficient sub theory of quantum mechanics. Did I define what a sub theory is? No uh let's so It's just a sub everything, right? Your theory of quantum mechanics includes a set of states a set of operations and a set of measurements So we're going to take a subset of the states a subset of the operations and a subset of the measurements And Well, okay, you could you know any old time you do that. That's a sub theory But is it efficient? Well, if you can describe all this stuff that I'm erasing right now Um using a polynomial amount of space and time then it's efficient and we will see how to do all these things you can go read About this if you want to so Let me recommend some reading over here Uh daniel goddisman's phd thesis It's from 1997, but it's still like the most up-to-date Reference on like the basic theory five oh five two Uh, yeah, and if any of you have to write a phd thesis soon, that's more or less how it's done Uh, and you can also go read errant's and goddisman before actually if you just go to daniel goddisman's website At perimeter, there's like a big list of everything that you should read instead of listening to me Uh, but I won't tell you where that is right now. You can learn later. You know focus for the time being all right, so If a pali is a matrix, how do I Uh describe a state using that matrix aren't states vectors? Sure But I'll just say that The states that we're going to use Are going to be What we call stabilized by some pali And that's to say when you multiply by a pali you get the plus one Eigen value, so it's a plus one eigen state of some pali operator And if I do this for one qubit, right then you know x Times the plus state that we saw earlier is equal to plus And you know for y there's something like Something you know plus i or i plus which is equal to you know one over root two one i Let me make sure that the dot Okay, and then z is maybe the easiest to describe because that's the zero state right one zero and Um, if I want to I can say I can also describe the minus one eigen states of these operators Which I'm going to do in a tricky way by putting the minus sign on the operator Right, so I'll say that the minus The minus state is going to be something like uh, you know one minus one Over root two And likewise I could put a minus sign here or here if I put the minus sign on the z I get the one state which when you multiply by the z you just pick up that 180 degree phase So, uh, this this works perfectly for single, uh, pali matrices. Let's do it for tensor products What we notice is if you take you know x tensor x on plus tensor plus All right, then you get plus plus no problem, but xx acting on minus minus notation is getting continually more compact Is going to be equal to minus one squared You know times minus minus which is just equal to minus minus So if I have a single pali that acts on multiple qubits, it doesn't specify a state on its own. It specifies a subspace How do I say that we should solve that problem in the notes? Um, ah first we should talk about how big this subspace is You know, if you want to keep specifying states that are in that subspace, maybe get it down to one state Um, hopefully then you got to know how big these subspaces are All right, here's where it gets a little bit tricky I'm going to denote the set of eigenvalues of an n qubit pali Lambda n for a minute Every one of these pali matrices has a plus one eigenvalue and a minus one eigenvalue Except for the identity which has two plus one eigenvalues and like minus identity which has two minus one eigenvalues But I can divide this so if I picture this as being a giant tensor product And I know that the eigenvalues are scalar products I can pop the first term off the tensor product and say that this set Is going to be equal to minus lambda uh for all lambda in lambda n minus one right the eigenvalues of the remaining pieces of the tensor product of the pali is everybody still following Yeah So I have some giant pali like x z z x i And I'm going to say the eigenvalues of this thing are going to be the eigenvalues of this thing times the eigenvalues of this thing okay uh union with lambda For every lambda, you know in lambda n minus one And if you try a bunch of examples, you will quickly become satisfied that Each one of the each one of these sets, you know for every time there's a plus one There's a minus one and vice versa And so each one of these sets is just going to be half plus ones and half minus ones Unless you do all identities or all minus identity, right? Right the all identity operator will have all plus one eigenvalues and then minus identity will have all minus one eigenvalues So each one of these operators cuts the space in half Right, so now with your little cs brains fully active filled with potato salad and caffeinated You're thinking aha i'm going to use a logarithmic number of palis Right each one cuts the space in half So in order to go from two to the n down to some constant I only need something like n of them rather than two to the n which is what the number of coefficients I would need in order to write out the ket and you would be right because You are a fictional version of yourself that lives only in my lecture notes right, and there's all right, so when Right, so this pauli acts on the state like so we say it stabilizes the state and Let me erase some more stuff Look at me checking the time like I'm not just going to go until I run out of notes Anytime you've got two operators that are both stabilizers. We'll call them s j and sk Right, and it's going to act on some psi if psi is stabilized by sk This is equal to you know s j times psi and if this you know operators also if this vector is also stabilized by s j This is equal to psi so Any state that's stabilized by these operators individually is also stabilized by the product Right, so we don't have to keep track of every possible pauli that could be stabilizing our vector Most of the time we only have to keep track of a generating set and then we can you know reproduce every element of the group a la minute whenever we need them Uh, right. I've already given the game way in the next section of the notes Stabilizers form groups and if you're a group theory head those groups are abelian which means all the elements commute Right and the reason that no anti commuting paulis are allowed Is because with this product relation if we had two paulis in here that anti commute You know if s j sk Let me you know some minus sk s j I could start taking products like s j sk s j sk Switch these two and I get minus s j squared sk squared The product of every tensor product of pauli matrices with itself is all identity. You can see on the diagonal of this table So this is equal to minus identity Which as we said does not have any plus one eigen states. So it can't stabilize anything Uh, right. So anti commuting paulis in reduces to your stabilizer space is zero dimensional go home So no anti commuting paulis allowed and if you're going to write down a generating set, they should all be independent under multiplication We will see quant America acting codes in which they are not and there are reasons why you would measure those that are redundant Right just in case there's a measurement error You might want to say oh, you know, I have multiple different ways to reconstruct my generating set so I can see whether they're all consistent But if you want to accurately describe The size of a state space by counting the number of operators Then you should make sure that each one really does divide the space in half And is not just one of these that you know doesn't divide anything in half given that s j and sk already stabilized the state in question Perfect. So that's how you describe states Uh, it takes about n squared bits of memory depending on how many bits per letter you use And let's see It's the 18th of april very useful information. It's also about 206 I think we can afford one example before we move on Actually, okay. Yeah, let me torture the students All right, so If you're really sharp, you know, then You'll already know this one, but here's the state that we've seen Already who can tell me a paulie that stabilizes this state? I will not continue until I see some hands who can tell me a Legit non-trivial paulie that stabilizes the state.  Sorry plus one squared or minus one squared right that Stabilized the state very good Do we need any more or is zed zed the only stabilizer of this state? why why Someone someone came to play today But i'm not going to put why why I'll put xx Why am I allowed to do xx instead of yy? Yeah, because when you multiply them you just generate whatever you want Uh, and you'll notice that I've ignored the i because there would be two i's that make a minus one Right, so If you flip you get one one here in zero zero here, and then the addition is commutative And that gets you back your original state All right, good people are roughly getting it fantastic. So now we're done describing the states of our efficient sub theory Let's start going from state to state with unitary operations So we will consider You acting on psi uh, we might pray that You know there will be some other stabilizer that stabilizes this state And i'm going to guess that there is and then derive that there is right, so let's say Let's guess that there's some sj prime That stabilizes u of psi That means that sj psi, you know by You know by hypothesis Is equal to u of psi However, we know psi is stabilized by something so we can stick a stabilizer in here common proof technique Uh, we can also stick an identity in here and that identity can look like u dagger u right usj u dagger Uh, u psi And then oh look This is our original state right so here is The stabilizer that stabilizes u of psi and you'll notice my dagger is in a different place than it was When I was doing the heisenberg picture because these operators are evolving forward in time So it's a heisenberg-ish picture right also Do these stabilizers commute Do they generate a group? Let's prove that they do Let's do generation first so usj u dagger times usk u dagger Everyone can already see where i'm going with this u dagger u Is eliminated and this is equal to usjsk U dagger so anytime I take the product of conjugated stabilizers That's the same as if I conjugated the product of the stabilizers Uh, so you know this is a stabilizer of the new state because The product was a stabilizer of the old state something the products of stabilizers. I still got stabilizers My new operators form a group just as my old operators did And you know because products are preserved Group commutators are preserved because those are just fancy products So it's abelian still fantastic right Um in order to do like real physics This is often enough But if you want everything to remain like efficiently computable uh a sufficient But maybe not necessary condition that I will nevertheless use today is that these operators Uh us u dagger also have to be pauli operators So I'm looking so all right We've got the group homomorphism property mathematicians. I said homomorphism You're welcome um Right So the the maps from paulies to paulies that are also unitaries. We will take this to define the cliford group There are a lot of things to say about the cliford group I think it's officially the finite automorphism group of the pauli group But nobody who works with these things every day says finite automorphism group So I often lose track of the terminology There are however three especially important clifords That you will want to know about in your life At least if you're here, I mean you don't need to tell your family over the holidays or whatever Unless they're also involved um, but Let's get in so name diagram Unitary matrix just one last time. I'm going to write out unitary matrices And then we're done with unitaries And So paulies. Oh, yeah, okay One of the things that you would need to say about clifords Is that okay Maybe maybe I shouldn't give you these notes, but I should update them first Because of this property here whenever I take the Whenever I want to calculate the effect on a product I can just calculate the effect on individual generators and then take the product afterwards That means that in order to specify a cliford fully I don't need to know all four to the n possible things that may happen if I stick some arbitrary pauli in I only need to know the effect of the cliford on a set of paulies that generate the pauli group under multiplication And that generating property gets us down from an exponential number of paulies to a linear number of generators So when I complete these tables now you will understand why they are complete, okay pauli maps So C0 is a cliford Some people put an x here. I usually put the bullseye thing Notation is not consistent and you know If you don't like it tough Unitary matrices are consistent though Right, so in the zero sector where we have the identity in the one sector we have this x to control the x operation but We quit writing these things and we begin writing these things so x tensor identity Maps to x x I tensor x goes to i tensor x z tensor identity goes to z tensor identity and z Well i z Goes to z z So this is interesting right the thing we think of classically as being uh, if this then do that Propagates information right in this basis from target up to control And this is the reason why if you surround a c0 with hadamard you get a c0 running in the opposite direction Which shows up a little more visibly in these pauli tables now speaking of hadamard hadamard is also a cliford Luckily notation for this one is fairly consistent Uh last time i'm going to write that unitary matrix fantastic and this one takes x to z and z to x And it takes y to minus y You may or may not need to use that minus sign watch yourself And then finally there's a gate which has no fixed name Uh, some people will say p you can say r Right in this in this set of notes i've called it s And it is well, okay, you can think of it as the square root of pauli z pauli z sometimes also comes with a factor of two So you always have to watch yourself You write it as an s or a p or an r write one i zero zero Is this unitary matrix and this one takes x to y and z to itself These three gates as you compose them can generate any cliford will i prove this no It would take too long But let's Let's do a pretty involved example i have 15 minutes left And we still have to do measurements i'm going to run long right now But that's okay everyone's having fun i've stayed focused i haven't goofed around so Let's prepare an entangled state x x x x i'm just going to write in a big table right these Stabilizers right z z i i i z z i and i i z z Uh, let's see. I don't want to play guess what the state is but We can so if you're trying to generate this state from a bunch of zeros Right, we can say, you know, here's what I want to do Z i i i z i i i i z Z i and i i i z right i'd like to try and find a cliford that does this Uh, there is an algorithm for doing this will I tell you what the algorithm is no I'm going to do what you're going to do when you start working with palates and clifords and just try some stuff Uh, so I know for example that there's entanglement in here that I'd like to break Right and you can tell when one of these states is entangled because it has you know weight Greater than one stabilizers that intersect each other if ever you see one of these tables that's block diagonal Like there's some stabilizers up here and some stabilizers down here But then identities in the off diagonal then you're dealing with two unentangled blocks um Maybe you can prove this to yourself We don't have a ton of time. All right, but let's take a look at what would happen If I ran a c not between cubits one and two of this state So in order to figure out what happens to xx I multiply the outputs of these two right so xx times ix is x i right so my xxx goes to xixx let me Say what's going on here c not one two Uh z z i i uh, so in order to well Let me be real fancy c not as self inverse c not times c not as the identity Which means if I read this table backwards, it's legit z z goes to i z So i z i i Nothing happens to this z Or does it now it goes to z z z i and i i z z Yes now This looks like it's entangled, but i'm allowed to multiply the stabilizers In order to generate a new generating set So i'm going to multiply this by that In order to put an identity here and now I can see that I have You know a one by one block right where I have identities in that row and that column So this cubit Is separated out right this is One state on cubits one three and four times You know the stabilizer state z right zero on cubit two We can see that this looks the same as that except on Three cubits instead of four So if I was to apply, you know a c not one three the same thing would happen I would get Another zero popping off and this would continue until I got down to one cubit where I would only have that weight one x stabilizer left So I can derive And you can run this circuit forwards for yourself That if I do this What I get out is This stabilizer state that I wanted I encourage you all to try this as an exercise In order to keep up. I mean not like right now, but you know snap a picture Take a note or whatever it is you do Uh, and that also turns out to be a pretty important state In quantum error correction that's called a cat state because it's a superposition of two macroscopically different bit strings Right so Now that we've seen a clifford circuit i'm immediately going to start using them as an abstract proof technique Because we're going from like zero to a hundred today. Oh, we started a few minutes late I get extra time no one can stop me right Let's imagine Won't you It's imagine A cloth that I can use to wipe down the board. It's just like dealing with my kitchen I have a five meter long table and the thing I need is always the other end Let's imagine that just like that last circuit, which is all the way over there We've got some abstract clifford c that we're going to use To prepare a stabilizer state And at the input we're going to put you know a bunch of weight one z stabilizers Right, these are like little zero states and we're going to prepare a big ket over here What if I was to leave out a few of these? Well, then there's a whole set of stabilizer states that we could be describing You know if we put a z in here that would be one state If we put an x in here that would be another state If we put a y in here that would be a different state So every stabilizer that we remove Doubles the size of the space that we can describe This is how we do codes Because a code you have to leave some Hilbert space in order to do computation in right It's not enough to use a single state. So We are always Leaving some cubits at the end of this abstract and coding map Right to produce logical cubits at the output Right whose operators Are like the stabilizers that would happen if I put you know a z or an x in here Right those become your logical operators And they have the same commutation relations as the Pauli's because they're unitary equivalent to the Pauli's And so they act just like Pauli operators, but on logical cubits I'm looking at the wrong set of lecture notes Fantastic So when you want to do a table or tableau a lot of people say tableau You have to I mean it's not enough If we said table it would be too like English and low class You got to have a tableau. Uh, so let's talk about one of my favorite codes We will have two stabilizers Called sx and sz z And then we'll have some logical operators X bar the bar denotes a logical operator or two And z bar two This thing is going to be x x i i i z i z x i x i and i i z z We can see that this anti commutes with that but it commutes with the other two For example, and any one of these logical x's or logical z's, you know, it has the appropriate commutation relation with its other Pauli's in the same table, right? So this code You know sits on four cubits describes two logical cubits And we can see there's like a hint of fault tolerance here In order to flip the state of one of these logical cubits It's not enough that I flip one of the bits. I have to do two Right, so two independent hopefully independent things have to go wrong in order for something to go really wrong When you're using this code and you can read all that information off of the tableau That's not always that easy, but We will make it easier in the third lecture. All right, let's let's do the last topic for this lecture measurements The hardest part of dealing with the stabilizer sub theory Luckily, we already detailed that any tensor product of pallium matrices has Plus one eigenvalues minus one eigenvalues and that's it and that means you can describe the set of projectors As One our identity plus p over two minus Identity minus p over two each one of these things is going to be like pi plus And pi minus those are the only two outcomes you can get from a measurement And when you do a measurement on a stabilizer space What happens depends on the commutation relations between the new pauli that you're measuring in and the existing stabilizers Let's do the easiest case first If the pauli is in the stabilizer group then The probability of getting plus Right is just Psi i plus p over two Psi But we just said okay, so stabilizer P is a stabilizer right so p psi equals psi identity of psi equals psi So this is just equal to one half You know psi psi plus Psi Psi Right One plus one is two so the probability of getting The plus one outcome is one And it should come as no surprise to you that when you project a stabilized state onto one of the stabilizers You just get that state back right it acts as the identity Both as a measurement and when you apply the operator Fantastic What if the pauli commutes with all of the stabilizers? But it's not itself a stabilizer right so it's one of these logical operators The joking around has has finished. We've gotten fully serious about measurement I think even in like software that I've written I would just skip measurements sometimes Uh, if I can all right, so We don't know what the probability is a priori right because p here is some new operator Psi can be some arbitrary superposition Of eigenstates of these operators. It doesn't have to be plus one or minus one with respect to any of But we can talk about the output state So we're so our output Psi is going to map to identity plus or minus p over two times psi Square root of pj sure it's normalized why not? Um s times i plus or minus p Here we get lucky s commutes with i s commutes with p and so it commutes with i plus p I can move it through here s stabilizes psi and so Psi maps to a state that is still stabilized by every s in the stabilizer right Uh, however There's a new operator in town Um, well, okay. There's almost a new operator in town If I put p here right then p Okay p times i plus p Is equal to p plus i Yeah is equal to i plus p but p times i minus p p squared is equal to the identity right, so this is p minus identity Which is equal to minus i minus p so If we get the minus one outcome p does not stabilize the state but if I was to Take this minus sign all the way back We can say minus p stabilizes that state if I had the minus one outcome So when you measure an operator that commutes with all of the stabilizers, but is not itself a stabilizer You're going to get the plus or minus one outcome And That pauli right either the plus or minus version of that pauli is going to join the stabilizer group Right, you're projecting the state space down into a state that's half the size by adding a new constraint onto the state and now The final boss of the lecture It looks like there's two pages, but there's just concluding remarks on this last page if The pauli we're measuring Anti commutes with a stabilizer Then we're going to get to see some more of these commutation relations.  It's removed from the table But let's take the product sj sk of two stabilizers that we will assume Anti commute with the measured operator and I'll drop the two root p just so you can see what's up. This guy commutes past Right, so we'll leave room for it over here This commutes past sk We flip This sign once and then we do it again sj Plus minus These stabilize the original size you get rid of them and you wind up with The you know the the fresh state identity plus or minus p acting on psi is stabilized by the product of any two stabilizers that any commute So in order to figure out the new stabilizer generators You make a list of everything that anti commutes You pick one Your choice because it's the same as multiplying the stabilizers to generate a new group You you know you you blame that stabilizer for all of the anti commutation Multiply the remaining stabilizers with it until you get you know the biggest possible set of commuting generators That set of commuting generators and the measured operator become your new stabilizer And the single you know whipping boy stabilizer leaves the the table Has to go to the kids table Now with that we can all right Do we have just enough time? I think we have just enough time to do one last Circuit simulation So we're going to put it all together and do a five qubit algorithm in just a few minutes where I mean no offense to catherine, but I think if we had tried to do A five qubit circuits in the first lecture We would not have had a good time 32 by 32 unitary matrices. We would have run out of board All right, so Let's do a circuit that kiran and I both care deeply about Muscle memory at this point. How often I write this thing down. I put a zero state in I do his measurements at the end So My initial stabilizer tableau is going to have one stabilizer and then four logical qubits So i'm going to have i i i i z x Did I leave enough space? Z edge x z. I do have enough space So here's my initial code Right, you can see this is a bad code on its own You only need to flip one thing in order to flip a logical qubit, but this is a tiny component of a fault tolerance circuit. So Other measurements will be taking care of that the c-naughts Will map any weight 1x that starts here to x tensor x Right, likewise. This x is going to map to xx. This x is going to map to xx. This one is going to map to xx And the z let's see These z's Nothing is going to happen to them because they commute past the dot. No problem The only z that gets changed by this is the initial z here, right? This z stabilizer is going to become a product of z stabilizers on these four qubits and this guy at the output So I'll put you know Maps under c-naughts too I've got the corner of the board here. So I'll leave a little awkward space z z z z z as my one stabilizer x i i i x z i i i i x z x z x z x x x Right, and that's it. Everything else is an identity Yep, these columns line up. Yeah, do they make sense? Yeah, great Now I'm going to measure that z at the end that operator Commutes with the one stabilizer that I have so it's just going to join the table as a stabilizer Uh, I'm also going to assume that I got the plus one outcome and not mess with the minus sign Because you can mess with the minus sign on your own time However, it is going to any commute with these logical operators. Oh, no, I didn't cover that case What happens if it any commutes with a logical operator? Well, you should remember is that from all the way back over here with this big cliford that I'm using to prepare states A logical operator is just sort of a stabilizer in weighting So I do the same thing, right? I've I Multiply the logical group in order to find stuff that commutes with the measurement operator Right and it sort of plays the same role as a stabilizer because it would be a stabilizer Um, if we measured it Right, so my stabilizer is going to go up to z z z z z i i i z And then my logicals i'm going to Let's see. I'm going to multiply everything by this guy, right? So this whole logical qubit is going to leave The uh the group and then I'm going to turn this into like x x i i Mm-hmm x i x i i z i i x i This group Is also generated by right, so we'll notice that there are no Logical operators affecting the fifth qubit Right, there's one stabilizer affecting it, right? I can remultiply to do this So this state is now separable And what this means is I now have right i've i've carried out Through this circuit A measurement a projective measurement of this wait for operator And i've added and removed one qubit in so doing and these are just the remaining, you know three logical qubits that Satisfy that primitive stabilizer code still distance one, right? You still have a bad time if you tried to use this in real life Because you know you only have to do one z in order to mess your qubit up All right And that is it now you know how to do Everything that we do on a daily basis Commuting palities through clifards looking at the effects of circuits Well, okay We also have to like program a lot in order to get computers to do all of this stuff for us But I mean or grad students could do it So let us know if you're interested and with that I think kiran can take it from there And introduce the kind of things we're actually interested in are there any questions You understand everything perfectly Chris clear obviously, okay, absolutely. Okay fantastic. So we'll now hear from kiran. Do you want to have a break? Okay, a lot of nodding. Okay, let's take a break for a few minutes


We'll just roll over to one o'clock, and I like to be punctual, so I think we'll get started. Welcome to Drupal DevOps on Azure websites. My name's Corey Fowler. I'm a technical evangelist from Microsoft Corporation. I came all the way from Seattle to come here today to talk. So hopefully you enjoy it. I think we're going to have a lot of interesting little piece of discussion to talk about. Before I get going, how many people have actually used Windows Azure before, or at least know what it is? Oh, brilliant. More than half the room. That's awesome. So I shouldn't have to clear through this all that much. What is Azure? Azure is a set of highly scalable data centers all around the world. We have 16 data centers worldwide spanning the US, Europe, Asia, as well as Australia today, which is really, really awesome. We have a variety of services. I just gave out a number of posters that kind of clears out what we have available to you for Windows Azure. I'm going to focus specifically on two parts today. One are Windows Azure websites, sorry, Microsoft Azure websites offering, which is a great, high density hosting platform. We'll get into that a little bit later. And I'm also going to talk a little bit about our VM platform because there's one key DevOps component that I want to show off there as well. We've had some pretty awesome momentum over the last year, bringing new features on at a rapid pace. It's been very exciting to be working in this space because it seems like every three weeks we have something new and fun to play with. So I've been keeping really busy going through and playing with the new features that have been coming out and look forward to new things that continue to come out. We have great support for a lot of open source on Azure. Not only just language support, but we actually have in the galleries for both websites and virtual machines open source CMSs. So we have Drupal in the gallery. So you get an easy click through wizard installation process. We manage a huge Hadoop service called HD Insight, which is pretty interesting because it avoids having to go and set up a high scale cluster of Hadoop yourself. You just click and spin it up and turn it off whenever you need to. Lots of different support. We just added a Redis cache provider to our platform. So you can get a full-scaled Redis server up and running to do caching of your front-end services as well as four different distributions of Linux within our virtual machine offering. And we have great support for a lot of new DevOps tools that are coming out today. So Chef, Puppet, Vagrant, Docker, just a lot of great things coming out. And we're supporting them as quickly as we can. So to clear through, what is Azure websites? Azure websites, like I said, is a high density hosting platform. What does that mean to you? Very simplistic way to start deploying things into the cloud. In fact, it's probably the fastest way to build for the cloud today. So all you need to do is go and spin up a server. It's up in a matter of seconds. You can connect your code into it using source control management. And it just goes out and deploys. You don't have to worry about maintaining PHP, the operating system packages, anything along those lines. We do all that for you as part of our platform as a service offering. And it's open and flexible for everyone. So like I said before, we support a variety of different languages. You can host all of them in a single website, which is interesting. I have a really cool demo that I do at other conferences where I actually have every single language, just a small application, and show off all the support running in a single site. But we're here to talk to DevOps today. So let's talk about Git deployment. This is an interesting way to just go in and deploy your applications out. So I'm just going to go into our portal here. We have two portals currently. This is the full featured portal, we'll call it. There's also a preview portal that I'll show you a little bit later on if we have some time. But the easiest way to get going really is just to go and hit new and custom create a website. And you can see here, all you need to do is enter a URL. So I'm just going to say drupalcon.ms. You can go and deploy that in different hosting plans, which are kind of defined by region. So I'm going to stick with the West Europe reason, because that's right here in Amsterdam. We can create a new database. We have offerings for both SQL database, which is Microsoft SQL and MySQL databases. So you can go in, set something up. For right now, I'm not going to worry about that. And I'm going to publish from source control. So I have the ability to go out and choose from a variety of different sources for this. I can use the Microsoft Virtual Studio online. I can use a local Git repository. But I think the more interesting ones are support for GitHub, Bitbucket, or just any kind of external repository, which could be either a Git repository or a Mercurial. So I'm just going to choose GitHub. And we'll go over here. That was going off to GitHub to do OAuth, but I'm already signed in, so I don't have to worry about that. And basically what it does is it pulls in a huge listing of all the repositories I have access to, which for me, as an evangelist, I have quite a few. So I'm just going to type in, oops. No, do that again. So I'm just going to type in Drupal, which I did just for the Drupal project straight from GitHub. And in order to get the right branch, I just do 7x. And what that will do is create a new site. Once the site's created, it goes off to GitHub and says, hey, I need some source from you. And adding that 7x, it will bring Drupal 7 over to Azure websites. So I already have a Drupal site set up here. So I'm just going to flip over. And basically what this has done, if you look at the deployment tab, you can see the history of the deployments coming from GitHub. And one of the interesting things about this is not only have we gone out and done deployment through GitHub, but we have the ability to trigger new functionality during the deployment process. So I can see here that they've generated a deployment script and it's running deployment commands, which in this case is really just copying a bunch of files. But we're going to talk about hooking into that in a little bit. So this is my Drupal site that I have up and running. This was just pulling straight from the repository. I did have to go in and configure it, obviously. But this means anytime I pull or I push something out to my local or to my clone of the Drupal repository, the new source code is going to come back directly into my site, which is really, really nice. So it continues deployment. Like I said before, choose your own adventure. Tons of different options for you to go and hook into Azure websites. This is how we can go in and manage our deployment process, the whole pipeline. And I'm going to just move over to that in a second. But basically we have a set of cross-platform tools, which allows you to go and interact with Azure directly from the command line. And some of the reasons you might want to go and modify this deployment script is something along the lines of other installing dependencies with potentially composer, compiling source code I have there. Just in case you might have to do some compiling of JavaScript, like coffee script libraries or TypeScript, you might minify JavaScript or expand SAS or less. But you could also do continuous integration tasks, like running your unit tests before the deployment. So if any of those tests fail, it doesn't deploy the new code base out to your site. Everything's good to go. So I've built out a deployment time dependency management thing with composer, but I just wanted to show you the command line tools that we have here. They actually took away my favorite feature recently. We used to have some amazing ASCII art at the top. So I'm kind of disappointed by that. And I think I'm going to go log in issue on GitHub later on today. But you can see here, I can just type in Azure site and I get a listing of commands that I can do for the website. So there's actually quite a few things here. I can start, stop my website. I can create new sites. I can go and add app settings, which are unique values that go into my site. So if I wanted to keep things at a site-specific level, I could add those app settings and they're exposed to me using environment variables. You can set up domains, certificates, being SSL certificates, obviously. And there's another feature called web jobs that I'll get into a little bit later. So going and using those tools, if I just type in Azure site deployment script, and I'm just going to use the help file here. Basically what this does is it generates dot deployment file and that hooks our deployment engine to say, hey, I have a custom version of this deployment that you need to run. And it also creates a script for you. So this could either be in command, sort of like Windows command line or a bash script. And you'll see here, the deployment scripts, there's a couple of different varieties just because we support a number of different languages. But you'll probably want to use the dash dash PHP and that will get PHP-specific deployment script for you. And then your output type is dash T here, which is how you can switch between batch and bash. So I've already created that and I have it up and running here on another page. So in my GitHub repository, I have this project called WAWS-composer. And basically this is the deploy CMD file that it generates for you. It just goes and sets up a whole bunch of paths and everything so you don't have to worry about it. This highlighted part I'll get to in a second. Then it basically goes off and uses website deployment. So we use this command line synchronization tool called kudosync. And basically what that does is it keeps an eye on the different files in your site. So when we do a new deployment, we don't end up crushing any user-generated data that might have been saved off to your website. So this highlighted area up here, this is the section that I added to go and download Composer. So basically what I've done is just used the curl command, go to get composer installer. It runs that, comes back, and then basically just set up the PHP script here. And then you see at the bottom, I do dependency installs. So basically just run PHP, use that environment variable for where the code's been deployed to, run Composer and then just run the install file so it goes out and gets all my vendor files for me. Extending the environment. So there's a couple of different things that you can do here. Once we have our site up and running, it's great. We have a production website, but we're talking about DevOps. That means we wanna do a lot of this continuous integration, continuous deployment kind of thing. And we just set up just get deployment in a single area. So that means, yes, I'm doing get deployment from GitHub to my production site, but say I wanna have a staging environment, something along those lines. Well, that's something that can be achievable by this feature called site slots that we have. And basically what this is, is it takes your main website and associates other web spaces to it. And these are individual web spaces. So they run in their own container. So this isn't like everything's running in the same website, but sort of separated. This is a full brand new web space for you to deploy to, but it gives you a few options. And what that is, is once you go and create that secondary site, you can then either clone the configuration from your previous site or go through the whole process of hooking up the source control management. This provides a nice staging environment where you can continuously pull stuff into, go test. And then later on, we'll show you how you can actually swap between these sites or use this new feature called testing and production to kind of move traffic around to them. The second thing that you can do is this thing's called site extensions. And site extensions are really interesting because they allow you to go and add additional functionality to Azure websites within the same context of your site. So you can use this for administering your site. Like you can see here, we have the PHP MyAdmin tool alongside here, so you can actually use that in say your staging site to look at your database connections and figure out what's going on in your data and not requiring additional tools.  You can log into your website and still be effective by using some of these tools. So what I'd like to show you now is how I've leveraged Azure websites to go and install Drush to be able to do management of my Drupal site with Drush. So we left off here before where I have my Drupal website that I set up and I have Git integration. And you can see the website up here is drupalcon-drush.azurewebsites.net. And this is the public URL. You can go and add a domain name to that to have a nice pleasing URL that kind of conforms to your company. But every site has a different sub-site. So if I was to go here and add .scm, I get into this site here. And what this is, is it's a back-end system that allows you to hook up the site extensions. It provides command line access to your website, which we can do also from the local machine. I'll show you that in a second. But it provides a great little interface for you to kind of go in and see what's happening with your website at this particular time. So what I've done is I've downloaded Drush in my site directory. And I've also downloaded Composer. And that allows me to go and do dependency management for Drush. And then once I have Drush installed, what I've done is run these two commands. And I'm using PowerShell right here. And I understand that you can't see that. But the commands are setting aliases for Drush so I can go off to my web root and use Drush instead of having to have it sitting in my WW root and have other people have access to it, which I don't want. I've moved this away, set an alias for it, and I can still go and do my commands. And then I've also set an alias for Composer just so I can use the just Composer command instead of having to do a full path or anything along those lines. So I'll just cancel out of here. I'm just gonna, I'm in my site root. So I have the ability now to just say Drush. I'm just gonna clear the cache. It's something simple to do here. And I'm just gonna clear all. And I might just have to refresh that. So I'm going to my site here. Just gonna have to rerun these two commands. There we go. And we'll say Drush, clear cache all. And it's gonna go through and clear the cache. Now you can go through and do whatever you need to do from within there. As I mentioned before, we have site extensions. So I'm working with the team to figure out what we can do to make Drush a site extension. So it's a lot easier. You can just go off and add in the Drush site extension. We'll inject it into the site for you, set up the aliases, and you'll be able to go out and use it. And you can see here that our clear cache command was successful. So I did this in the web interface. How do we go and use this from our command line? We have this other tool called Kudu exec. Kudu is the backend deployment engine that we use for Azure websites. So basically what you do is you say Kudu exec, and then you pass in that source control or site control management URL, which is what I talked about to get to the management layer that we were just looking at. Then we enter our username and password and now I actually have full command line access to my site directly from my machine. So you can see here I'm browsing through. I can go to my www.root. There's my full Drupal installation. If I go back a directory, you'll be able to see my Drush file that I had in there, the init script that I used to set the aliases and all those things. So this is a pretty interesting way to be able to leverage the command line against your website and gives you a lot of power to go and do what you need to do to get your site up and running the way you need it. Yeah, quick question. So that command line in particular is running the Windows command line, but they've aliased a lot of those commands for you. Cause I kind of venture back and forth between Linux world and Mac world and PC. So I actually use PowerShell most of the time and that's why I use the PowerShell console on the website. But yeah, a lot of the commands there are aliased for you just so if you are coming from a Mac or a Linux environment, you can use the commands that you used to. Cool. Cron jobs. So everyone's used to Drupal Cron, yes? How many people have issues with Drupal Cron? Anyone? So I think the biggest complaint that I've heard is the fact that the Cron jobs are running in the same context of your website. And that's a big issue, right? If you have a site, it's very popular. You don't want a Cron job sitting there running, taking up CPU power as you're trying to serve up traffic. So this is something that's interesting. We can actually go in, I'm just gonna explain what web jobs are. Web jobs are our answer to Cron on Windows Azure. And basically what it allows you to do is it's a simple interface. You provide us with a script file of any kind. It can be PHP, it can be JavaScript, a PowerShell, it can be Bash, anything. What we do is we run that alongside your site. Now what you're gonna say is, hey Corey, you just said, we don't want these things running alongside our site.  Well, you have the ability to continue to do that. But if you wanna separate them out, you can't, right? So we're gonna go and create a web job. Very simple thing to do. I'll just go into my site here. I already have a site set up. You'll notice it has Drupal Cron. So these sites are all kind of independent pieces. But there's nothing to say that they can't communicate to each other. So if I wanted to write crons for, say my Drupal Cron Drush site, there's nothing wrong with that. I can do that if I expose an API or something along those lines. If I need to actually interact with the site, that's perfectly fine. We do actually expose an API for this. So if you have anything going on in the back end of your site, like triggering web drops or you have web hooks or you like to pull from source control, all of our REST APIs are sitting in the back end here and it allows you to go out and do whatever you need to. So to interact with those from a different site, go into the site you wanna interact with, look at the REST API, go off to the QtWiki and they'll describe how you can actually go and interact with that. I'm just, in these two examples, I'm doing something locally on the machine, but there's nothing saying that I couldn't do otherwise. And I'm just gonna take advantage of the Monaco editor that we have sitting with inside Windows Azure websites. So once again, if you're away, you're playing around on your iPad, you need a development environment to do something quickly. Easy thing you can do, boot up this online editor and you can see here I have a little bit of a convention going on and basically these jobs are built in this convention so you can check them into source control, right? So we have an app data folder. The app data folder has a jobs folder. The jobs folder has two different types of jobs that it can run, one's continuous, one's triggered. Continuous meaning it's gonna run all the time and if it fails, we're gonna try and boot it back up for you as quickly as possible. Triggered means it can either be triggered by a schedule or triggered using the API or going to the Azure management site and clicking the run button. But what I've done here is I've created two web jobs. One's called delete logs and this is a bash script. So you can see here I'm just going through and removing the log file. So D colon home log files, PHP errors. So this is my local file system. If I wanted to go off to the other file system you can see here we have an API for files and it's actually running the API so it's the site that you wanna leverage dash API and then we have VSF which is virtual file system. So you can actually go through and ping and do a delete against that from one environment to another. And the other one is just a PHP file just to show that you can do it but I'm going off and I'm getting the environment, the region that it's actually deployed to. So this is just going off using a simple PHP script and doing something. So now I'm back in the Azure portal and both of these are triggered jobs. So I'm just gonna go here and run this report region. I can do that straight from the management portal and then I have the ability to go off to the logs here to see how well that task went and ran and hopefully I still have internet connectivity. There we go. Awesome. So it just ran 19 seconds ago so we can see what command did it run just in case you have multiple files in there. What it's gonna do is it's gonna look for run dot whatever the extension is first. From there, if there isn't a run dot it's gonna do it in alphabetical order and it's only gonna run one file at a time. So you can go in here. Here's our run details. It was successful. Here's the console output that it had and you can see here we're running in West Europe which is our local data center right here. So that was pretty easy. So I wanted to talk about virtual machines just really quickly. So Azure Virtual Machines, you can spin up from one VM to hundreds of VMs. We have tons of different images available. Both Windows and Linux machines depending on what you have a preference for. All of them are here. I'm kidding. We have tons of them. We have a lot more than this but we have four different distributions of Linux. We have a whole bunch of different Oracle virtual machine images. We have a puppet labs image so if you need a puppet agent that's all ready to go for you. And then we have a couple of Microsoft specific ones. There's also this thing called VM Depot where we have a lot of great images from Bitnami and other partners where they've gone and set up a Drupal environment for you so you can go and leverage those as well. Virtual machine extensions. This is how we take advantage of other useful tools. So basically the extensions get placed in with the virtual machine as they start up. So this is how we support things like Chef, Puppet, antivirus through semantic antivirus and Docker as well as other things like PowerShell, remote management and stuff like that. But this allows us to use Vagrant. So I'm gonna do a quick demo here on how to use Vagrant against Windows Azure. It's very quite easy. I went and ran it earlier just to make sure the machine was up and running for me. But how many people know about Vagrant? Good, a great portion of you. Shouldn't have let that slide to the bottom. There we go. So all I did here was said Vagrant up. I have to pass in dash dash provider Azure. But that says, great, let's go leverage Windows Azure to do this. So it goes through. This red line is not an error. It's just saying, hey, we don't have an existing thing so we have to go and create everything. And then it goes and creates all the deployment stuff off as you would usually see. I'm just gonna clear this out. I ran a provisioning script as well. To get this, all you need to do is say Vagrant, plug in, install Vagrant Azure. Dash Azure. So that's really awesome and ready to go. And I have one more thing here to show you is the actual Vagrant file. So Vagrant configuration. We have a dummy box that you can call whatever you want. The box really takes care of the size of the VM. So you can create a number of different boxes just to delineate the size. Then there's three main things you need for Azure. You need the management certificate. That's how we interact with the Azure API and notice that it's on behalf of you. And then your subscription ID. The image, we use the Azure command line tools. So we can say Azure account cert export. And that's how we got the management certificate. And then to get the image, you can say Azure account image list. That's gonna go out and get the huge list of VM images we have. So you can see it's actually a pretty extensive list. Just grab the full string. So the starting number to the end and then you're ready to go. Once you set that up, you can just say Vagrant SSH. And that will go off and connect to our box for us just like we're expecting Vagrant to do. And there we go, we're in our machine. So I ran a provisioning script with this. So if I say which PHP it should be able to say PHP is installed, we can see yep, it's off in that directory. So this is all set up and ready to go for our Azure PHP SDK as a development environment. So that's really great.  So just wrapping up, go off, use Vagrant plugin, install Vagrant Azure, grab the tooling and thank you very much for joining me today. I'm assuming we just switch over. Do you want to leverage that? Do you have quick questions before we move? Yeah, I'll go on and send them. Any questions? Can you actually use image or sorry, the current app gallery extension for Azure website uses MSS QL? But there's nothing to say that you couldn't go and set up MySQL, you just have to configure it properly after the fact. If you want to use virtual machines, all the Vietnamese are going to use MySQL by default, I believe. I was actually wondering like what are the problems if you don't get further than this or something. Is there anyone I can talk to? We have forms on both MSDN, which is Microsoft specific site, but we also have all the product teams looking at Stack Overflow. So if you use to take Azure websites, acu-web-sites, you can go there. There's tons of people looking at that all the time, it's all included. I also have another website, which I'll put a link up later. And before you can reach out to it directly to me on Twitter, my name is Steve. Okay, hi. My name is Tim Kreitzer. I'm going to talk to you guys a little bit about Drupal and Ruby and why we should be friends. I'm Tim. I'm from Portland, Oregon, not too far from where Corey's from in Seattle. We like to keep it weird in Portland. I work for New Relic, a monitoring company. I've run the Ruby agent development. Now, if you're wondering why New Relic sent someone who works on Ruby to DrupalCon, the reason is before coming to New Relic, I also was a manager for Drupal teams and built sites for Nike, Intel, Hitachi, mostly marketing sites, some things from small sites, couple pages to enterprise learning systems. So just a quick little bit about New Relic and what we do, application performance monitoring. You install our agent and we give you detailed statistics and analysis of what your application is doing, help you find performance problems, help you get alerted if there's outages, that sort of thing. Specifically, if you are a Drupal person, we have Drupal Instrumentation. We automatically detect if it's a Drupal site, can tell you if your new custom module that you just installed is making your site three times as slow, that sort of thing. If that's interesting to you, we're downstairs in the exhibit hall way at the end and I have a bunch of little cards that will give you a 30 day free trial instead of just 14 days, so come on by and grab one. So I wanted to give this talk because I really care passionately about developer tools and I feel like especially in the Drupal community after having been in it for about five years, it's very common for Drupal people to see every Drupal, Drupal has the solution to every problem and I wanna have more tools in the toolbox all the time. The professional athletes when they're training, they don't play their sport 12 months out of the year. They take summers, they do other things, they play golf, they have fun, they have a good time, they do other physical activities, they do cross training and I think as developers it's good for us too. Obviously we want to become more proficient at the things that we're the specialists in but we also, a wider base of knowledge is a good thing. So that's why I'm giving this talk. In Ruby, I wanna show a little bit of the fundamentals of the language just so you get an idea of what it looks like. Everything's an object in Ruby so you can ask a string to make itself into uppercase. You can run an iterator through an array and ask and get a capitalized version of all of them or you can even take a range object and convert it into an array. Every object, everything, even numbers can receive methods, strings can receive methods. Here's a quick example of a Ruby class. This is from one of my own applications, a music database, I'm including some modules. You can do inheritance in Ruby but you can't do multiple inheritance so it's much more common to use composition and include multiple modules instead of trying to do inheritance. I've got some custom things for doing database fields. So HasMany is a MongoDB adapter method that creates a relationship to another class. This is an example of Ruby domain specific languages so those are actually just methods. HasMany field and validates are all just regular methods that can be called without parentheses. And then I've also defined a bunch of custom methods myself. One of the real powers of the Ruby language is gems and you can create a gem file that looks just like this. You specify all of the gems that you want. You can say version information, maybe I want anything newer than 3.1 or anything that's in the same family as 2.2 or something like that and then it will automatically resolve and install all of your dependencies for you. If you've used Composer, NPM, they're both inspired by how bundler and gem work. So I wanted to talk a little bit also about Ruby frameworks. Obviously everyone knows Rails and you can find lots of stuff about Rails but there's a couple smaller ones that are a lot easier to learn if you wanna try just a little bit of Ruby without learning a ton of stuff at once. A lot of Ruby frameworks use Rack which is a Ruby object-based approach to building a layered web server. You put little Rack classes on top of each other and you have a full application. Anytime you have an object that can respond to a call method within a response code, headers and content, you're done, you have an application. In New Relic you can see this is an example of a Rails application and all the rack middle layers being instrumented all the way down. Another really common framework that's a really great starting point if you wanna play with Ruby is called Sinatra. It's a micro framework. All it does is just routing templates before and after filters, sessions and caching. It doesn't do database stuff. It doesn't do email processing. It's much lighter. So if you wanna just make a quick little site or a quick little application, Sinatra's really great to play with. This four lines of code is a complete and total Sinatra application. It will work just fine. You can deploy it to Heroku. You can deploy it to anywhere you would normally deploy Ruby. So if you already are using, you might already be using Ruby and not really know about it. Some of the things that Drupal people use, Compass, this is a Ruby application for front-end people to be able to do SAS. It's basically a SAS toolkit. Gives you a mixing gallery, plug-ins, Compass Clean and Compass Compile. This is really great if you have a complex SAS-based theme. It will automatically do all your preprocessing for you or you can even run Compass Watch and it will just do it for you on the fly. So if you're not using this and you are using SAS in your themes, you really should check it out. Also, Chef and Puppet are really famous applications for doing server provisioning and they're both written in Ruby as well. They're actually Ruby, the code you write for a Chef cookbook or a Puppet file are both just regular Ruby. So this is a Chef cookbook to install Nginx. Really simple Ruby. And then Corey was mentioning in his session, Vagrant as well. Vagrant is also written in Ruby. So if you wanna be able to work closely with Vagrant and edit your Vagrant file and do complicated things in it, a little bit of Ruby will help you. Specifically for Drupal, I wanna talk a little bit too. Everyone here at this conference is talking about Drupal in SOA. Services-oriented architecture doing headless Drupal, exposing Drupal data to external applications, new view layers. I am a big fan of the feeds module for Drupal for getting data in and out. It's really simple and really easy to use but there's a lot of different ways to do it and Ruby is a great partner to Drupal in this way. I wanna show you guys a little example of something that I built. This is for a athletics competition called the Wild Canyon Games. It's held in Eastern Oregon. It's a big event.  This is all the bicycles lined up for people ready to go. We wanted to do something specifically at the Wild Canyon Games for a group of about 200 executives. Each one of them was given a Nike Plus fuel band that tracked their activity and we had them train in teams in the weeks leading up to the event. And basically we wanted to do leaderboards to say which team has the most fuel points for each week, each month, individual leaderboards, that sort of thing. It would be really easy and we already had an existing Drupal 7 site at wildcannygames.org. It would not be too hard to talk to the Nike Fuel Plus API and get data and they have a pretty good published API. The documentations are pretty good but as it happens, there's already a Ruby gem that does all of the talking to Nike Plus for you. It has all of the endpoints mapped across. It knows how to do the OAuth authentication. It's really easy to use. So we set up a little architecture that looks like this. The Drupal site is at the very end Drupal PHP. And in the middle, I wrote a little Rails application using Ruby hosted at Heroku which you can do very quickly and easily to take data out of that gem and transform it, aggregate it and basically prepare it to come into Drupal. So the Nike Plus data looks like this in Ruby code. So you can see all the activity stuff that's coming back from Nike. A lot of this stuff we didn't really care about, so that was fine. I was able to go through and do summing and totaling and kind of aggregate it all together and get it into a feed that looks like this. So this is a feed that's JSON. It's ready to be imported directly into the Drupal application. We were able to set up a Drupal cron task that runs and just hits this feed every hour and grabs new things and makes Drupal nodes and then on the Drupal side, we built the leaderboard and actually displayed the data. Questions about that kind of approach? Does anybody have anything? I must have talked really fast because that was like 11 minutes. That's what I have. So hopefully if you guys have more detailed questions or wanna look at some other things we can, we have some time or if you have questions for Corey, that's okay too. That's how we do our PHP instrumentation. Yes, we also monitor ruby.net, yeah. So is the question, one of the questions that Lorna James said that we should ask all our prospective hope is does that, yeah there's a, I don't make that if you want to actually. I don't think it's on. So does Azure accept various PHP extensions? Yes, basically there's a couple of different ways that you can go and provide the extension, right? Cause we manage PHP for you. So in that case, we have a set of defaulted extensions that are enabled. Any other extension that you want to enable, you need to bin deploy.  That protects it from remote access, like remote execution and anything along those lines. And then the app settings that I talked about, there's a reserved word called PHP underscore extensions. And you make that the key of the app setting. And then if you do a comment delimited list of relative paths, so you do bin slash and then the extension name, that will go and enable them within the built-in PHP version. If you need to manage your own PHP version or would like to have full control over the PHP INI file, there's this thing that you can do, which is like bring your own runtime. And then you go and you configure the actual HTTP handler in the platform to point to a bin deployed version of PHP. Then you can just use the EXT folder of that version of PHP and the PHP INI file from that in order to enable them. I know we're also doing a lot of work on our .NET agent team around Azure and making the Azure experience to be as quickly as easy as possible. But I don't know if that's specifically for PHP. I think that's more around. I think the PHP plugin right now for New Relic is mostly for Linux. Yeah, yeah. So Azure, yeah, Azure websites runs Windows and IES. So the New Relic plugin right now, I don't think actually works within Azure websites. Probably not. Other questions? Was this interesting? I mean, was that, hopefully it was quick, I know, but it was a quick tour of some other stuff that you might not play with every day. And I hope that you'll check it out. Okay, thanks.