Hello everyone. So, we continue with our discussion of the Legendre polynomials and Legendre functions. So, last time we discussed the Legendre polynomials, its completeness, its orthogonality and some of its properties such as the derivation of the Rodricks formula. Today, we shall use the Rodricks formula to prove that the Legendre polynomial of degree n has precisely n roots in the open interval minus 1 1 and these roots are distinct. Of course, it is a polynomial of degree n, it cannot possibly have more than n roots. The fact is that none of the roots are complex, all roots are real, all roots are distinct and they all lie in the interval minus 1 1. There is a considerable information on the distribution and location of roots and these roots were used by Gauss in 1814 in his quadrature formula that bears his name and it is a very famous quadrature formula called the Gaussian quadrature. It is the best possible quadrature formula and a discussion of it can be found in the book of S Chandrasekhar that you see in the slides Radiative Heat Transfer Dover Publications New York. So, let us get to the proof of this important result. So, we need to use the Rolls theorem repeatedly. What is Rolls theorem says? Of course, it is true for any smooth function or a continuously differentiable function, but for us it is going to be a polynomial. So, we have got a polynomial that vanishes at a and b and the derivative must vanish at least once in the open interval a, b. Now, supposing that the polynomial f has a double root at a and a double root at b that means that not only we have f of a is 0, f of b is 0 in addition to that we also have f prime of a is 0 and f prime of b is 0. So, now Rolls theorem applied to f of x gives us a point c in the open interval a, b such that f prime of c equal to 0. But now look at f prime of x that is also a polynomial and f prime of x vanishes at a and c and f prime of x vanishes at c and b. So, by application of Rolls theorem f double prime must vanish once at least in the open interval a, c it must vanish at least once in the open interval c, b thus we get that f double prime has two roots in the open interval a, b. Again we could take a function f which has a triple root at a and a triple root at b and we will conclude that f triple prime vanishes thrice in the interval a, b. In particular let us take f of x equal to 1 minus x squared the whole square or x squared minus 1 the whole square does not matter. Now x squared minus 1 the whole square has a double root at 1 and a double root at minus 1. So, by what we have just discussed the second derivative must vanish at two distinct points in minus 1, 1. Remember in the previous discussion when we talked about f double prime must vanish at least one in the open interval a, c and at least one in the open interval c, b which means that these two roots of f double prime are distinct they lie in disjoint open intervals. So, we have concluded that the second Legendre polynomial p 2 of x has two distinct roots in minus 1, 1 of course is a quadratic polynomial. So, it cannot possibly have more than two roots. So, p 2 x has two and exactly two roots in the open interval minus 1, 1. Now let us go further. So, now let us continue and look at what happens with the third derivative and as I explained if f has a triple root at a and a triple root at b then the argument all shows that f triple prime must have three distinct roots in the interval minus 1, 1 and Roderick's formula now tells you that the third Legendre polynomial p 3 x what is the third Legendre polynomial it is a constant multiple of third derivative of x squared minus 1 cube x squared minus 1 cube has a triple root at 1 and a triple root at minus 1. So, the third derivative must vanish exactly at three distinct roots in other words p 3 of x must have three distinct roots in the open interval minus 1, 1 and since p 3 of x is a cubic polynomial these are all the roots. Generally for n equal to 0, 1, 2, the polynomial p n x equal to 1 upon 2 to the power n n factorial nth derivative of x squared minus 1 to the power n has n distinct roots in the open interval minus 1, 1 and that completes the proof that the Legendre polynomial of degree n has exactly n distinct real roots in the interval minus 1. So, having completed this part let us go to the solutions of some more problems. So, the three term recursion formula the three term recursion formula is an extremely important formula and the presence of the three term recursion formula is significant in these orthogonal systems. You may recall when we studied the Bessel's functions in the first chapter we got a relationship x to the power n j n x prime equal to x to the power n j n minus 1 x to the power minus n j n x prime equal to minus x to the power minus n into j n plus 1 x. So, these two relations they get a three term recursion relation between j n j n plus 1 and j n minus 1. You should go back to chapter 1 and see that just as you got a three term recursion formula for the Bessel's functions you got a three term recursion formula for the Legendre polynomials. These these three term recursion formula for Legendre polynomials is going to play a very important role later. So, we want to prove this three term recursion formula. How does one prove the three term recursion formula? Let us now as a preparation for this determine the leading coefficient of these Legendre polynomials l c I have written l c in red l c of p n x is the leading coefficient of p n x. So, the leading coefficient l c of p n x is 2 n factorial upon 2 to the power n n factorial squared equation 5.13 that you see displayed. Let us prove this what is the leading coefficient l c of p n x with the definition of p n x 1 upon 2 to the power n n factorial times the nth derivative of x squared minus 1 to the power n. Now, when you expand x squared minus 1 to the power n you are going to get x to the power 2 n plus lower order terms nth derivative of that is going to be the nth derivative of x to the power 2 n plus lower order terms, but I am looking at the leading coefficient. So, I can comfortably ignore the lower order terms. So, ignoring the lower order terms we get 1 upon 2 to the power n n factorial leading coefficient of the nth derivative of x to the power 2 n. The nth derivative of x to the power 2 n is exactly 2 n into 2 n minus 1 to the n plus 1 and I multiply numerator and denominator by n factorial. So, the numerator becomes 2 n factorial the denominator becomes 2 to the power n n factorial squared and this completes this little lemma.  Recall that for any n p naught x dada p n x is a basis for the vector space of polynomials of degree at most n. This we have discussed before. So, no need to discuss it again. So, if you look at x p n x multiplied by this constant 2 n plus 1 that is a polynomial of degree n plus 1. So, this is going to be a linear combination of p naught x dada p n plus 1 x. So, this linear combination is written as a naught p naught x plus dot dot dot a n plus 1 p n plus 1 x. You can think of this as a Fourier expansion of x p n x with respect to the usual inner product l 2 and the orthonormal system p naught x dada p n x dada etcetera. Now, we have to determine the coefficients a naught a 1 a 2 etcetera. How do you determine the coefficients? Take the inner products on both sides with p j x. In other words 2 n plus 1 inner product x p n x p j x. Right hand side the only term that will survive is a j norm p j x the whole squared. We have already determined the norm p j x the whole squared and so, we have to compute the left hand side. Now, just write the integral for this x p n x inner product with p j x is an integral minus 1 to 1 x times p n x p j x d x. So, this can be conveniently written as inner product of p n x comma x p j x. Now, remember if j runs from 0 1 2 3 up to n minus 2 then what happens to x p j x it is a polynomial of degree at most n minus 1 because x p j x is a polynomial of degree exactly j plus 1 and I am saying j is less than or equal to n minus 2. So, x p j x is a polynomial of degree at most n minus 1 because x p j x is a polynomial of degree at most n minus 1 it is a linear combination of p naught x p 1 x dada p n minus 1 x. So, in particular since these things are all orthogonal to p n x x p j x will also be orthogonal to p n x if j runs from 0 up to n minus 2. Which means that the inner product that I had displayed in the last line in the previous slide that is equation 5.15 we will get a j will be 0 a j will be 0 for what values of j for these values of j some 0 1 2 up to n minus 2 which means that a naught a 1 a 2 dada a n minus 2 are all 0.  Now, we have to knock off this a n how do we knock off this a n remember p n x is an odd function if n is odd it is an even function if n is even. So, x p n x is an odd function if n is even and an even function if n is odd in other words the parity of x p n x agrees with the parity of p n minus 1 and the parity of p n plus 1, but disagrees with the parity of p n. Now remember that a function can be uniquely written as a sum of an odd function and an even function and therefore, a n must be 0.  Now, we have to put x equal to 1 when you put x equal to 1 we immediately get 2 n plus 1 equal to a n minus 1 plus a n plus 1. Remember that p k of 1 is 1 the normalization that we are talking about. So, we got an equation between a n minus 1 and a n plus 1 we need one more equation connecting a n minus 1 and a n plus 1 the way to do that would be to take the leading coefficient of both sides of this equation that you see in the very first line namely 2 n plus 1 times a leading coefficient of x p n x, but the leading coefficient of x p n x the same as a leading coefficient of p n x. The right hand side we will get a n minus 1 times a leading coefficient of p n minus 1 x plus a n plus 1 times a leading coefficient of p n plus 1 x. We already computed the leading coefficients of these Legendre polynomials explicitly you must put it in and you must get the second relationship between a n minus 1 and a n plus 1. So, now all in all they got 2 equations between a n minus 1 and a n plus 1 and that will completely determine a n minus 1 and a n plus 1 uniquely you put it in the formula and you will get the 3 term recursion formula. Now, let us go to the next item normalization constants. Now, remember that p m x and p n x in a product is 0 if m is not equal to n what happens when m is equal to n you are going to get norm p n squared. It is important to compute norm p n squared because that is a normalization constant and it will appear when you want to compute the Fourier coefficients. So, let us calculate this. Now, what you can do is you can apply Roderick's formula. Roderick's formula has a 1 upon 2 to the power n n factorial. So, to clear the denominators I get 4 to the power n n factorial squared times integral minus 1 to n p n x the whole squared dx is integral minus 1 to 1 nth derivative of x squared minus 1 to the power n multiplied by the same thing dx. We must now repeatedly integrate by parts you have to throw all the derivatives on one of the factors. All the derivatives must be removed from here and it must go to the second factor. We must perform an integration by parts n times and we already done it earlier and every time we integrate by parts there will be boundary terms and those boundary terms will drop out and the same thing is going to happen here also. When you integrate by parts the very first time you are going to become a minus sign minus 1 to 1. The derivative shifts from one of the terms to the other term you will get d n plus 1 x squared minus 1 to the power n d n minus 1 x squared minus 1 to the power n plus b 1 and b 1 is a collection of boundary terms that appear. The boundary terms will drop out. Let us examine why the boundary terms will drop out. What are the boundary terms? The boundary terms are going to be given by nth derivative of x squared minus 1 to the power n, n minus first derivatives of x squared minus 1 to the power n, x squared minus 1 to the power n has plus minus 1 has roots of multiplicity n. So, all derivatives of f up to and including order n minus 1 must vanish at plus minus 1 implying that the boundary terms b 1 must vanish. Do the integration by parts again. One more derivative will shift and we will get 4 to the power n n factorial squared integral from minus 1 to 1 p n x squared d x equal to integral minus 1 to 1 d n plus 2 x squared minus 1 to the power n times d of n minus 2 x squared minus 1 to the power n d x plus b 2 where d 2 the boundary terms again will vanish and so on. Finally, all the derivatives will shift to one of the terms n fold integration by parts integration by parts n times ultimately leads us to 4 to the power n n factorial squared integral minus 1 to 1 p n x squared d x will be minus 1 to the power n. Every time we integrate by parts you will pick up a minus sign and so all in all you have picked up n factors of minus 1 integral minus 1 to 1 d 2 n x squared minus 1 to the power n x squared minus 1 to the power n d x. Now, what are the 2 nth derivative of x squared minus 1 to the power n? It is simply 2 n factorial. So, we picked up a 2 n factorial here. So, integral minus 1 to 1 this minus 1 to the power n has been clubbed inside and written as 1 minus x squared to the power n d x and it is an even function twice the integral from 0 to 1 1 minus x squared to the power n d x. And what you do is that you put x squared equal to u you put x squared equal to u 2 x d x will be equal to d u. So, 2 d x will be d u by rho 2 u.  The beta function is staring at you and it can be written as a beta integral. I have recalled for you the definition of the beta function. We already did this when we derived the Ramanujam formula in the chapter on Fourier transform, but I had displayed it again for convenience here p is n plus 1 and the q is half. So, what is the formula? 4 to the power n n factorial squared integral minus 1 to 1 p n x the whole squared d x is 2 n factorial beta n plus 1 half. Use the beta gamma relation, what is the beta gamma relation? Gamma p gamma q equal to beta p q into gamma p plus q. That will give you 4 to the power n factorial integral minus 1 to 1 p n x the whole squared d x will be what happens is that you will get beta n plus 1 comma half will be equal to gamma n plus 1 which is n factorial into gamma half which is root pi divided by gamma n plus 3 by 2 that is what you get. And we have used the fact that gamma half is root pi. So, to simplify the expression further we use the relation gamma x plus 1 equal to x gamma x and you will get gamma n plus 3 by 2 will be equal to n plus half gamma n plus half. Gamma n plus half will be n minus half gamma n minus half so on. So, keep going and ultimately there will be another gamma half and the root pi root pi will cancel out and you will get this expression and this expression simplifies to 2 upon 2 n plus 1. So, for n equal to 0 we simply get that norm p naught squared is 2 for n equal to 1 we get that norm p 1 squared is 2 by 3 which checks out via direct calculations since p naught of x is 1 and p 1 of x equal to x. Always when you derive these things you can always double check with p naught x and p 1 x just to make sure that there are no errors in your computations. So, this calculates the norm of the Legendre polynomial the inner product of p n with itself with respect to the usual l 2 inner product. There are some more problems on the Legendre polynomials and here is a list of them. The first problem says p n prime 1 equal to 1 half n into n plus 1 this we will do in the next capsule. The second one says that p n plus 1 prime minus x p n prime equal to n plus 1 p n, third one x squared minus 1 p n prime minus n x p n plus n p n minus 1 equal to 0 p n plus 1 prime minus p n minus 1 prime equal to 2 n plus 1 p n. Now, this must be compared with the corresponding results for Bessel's function.  Now, how do you do these things? For example, take the third one for instance x squared minus 1 p n prime that is a polynomial of degree n plus 1. So, you know that it must be a linear combination of p naught p 1 p 2 that is the p n plus 1. So, you write that linear combination and you figure out what are the coefficients or better still you can club the first two together x squared minus 1 p n prime minus n x p n they are together form a polynomial of degree n plus 1 and write it as a linear combination of p naught p 1 dot dot p n plus 1 and all the coefficients except p n plus 1 will be 0 and that coefficient will be n. You can use parity arguments to simplify your life and you should use normalization constants. You can use the Roderick's formula, you can use a three term recursion formula, you got a whole lot of things for you to use. So, the next problem says use the method of series solutions to find the power series of 1 plus x to the power a where a is any real number. Find an ODE satisfied by this function we will need this later. So, that is why I am putting this exercise here. This has nothing to do with Fourier series it is something that we will need to find the generating function for the sequence of Legendre polynomials. I think it is a good place to stop this capsule.


So can you kind of walk us through what it was like living in that Wall Street world? You know, like everyone went to college looking for like, I want to be an investment banker or I want to work at a hedge fund. No one really knows what that means, right?  Honestly, it was super boring. It wasn't what everyone thinks it's going to be as a broker. It's really customer service, more than, you know, investment knowledge because you're catering to people and it's a very thankless business.


I'm here because it's a cause I really thought was important. I was invited to get involved and I thought it was a fantastic thing to do, something practical where you could help make a difference. Sleeping out like this helps raise awareness and of course the sponsorship that people so generously provide helps raise funds for some of the most needy Australians. Just when you think about the simple facts that on any night, somewhere winter, over 100,000 of our fellow Australians are homeless. Over 50,000 are sleeping out, you know, rough. This year I was sleep out. Last year you raised almost three million dollars. That's a fantastic sum and hopefully we can do better this year. A lot of people turn up at shelters and they're turned away because there's not room. So what we can do as ordinary Australians to provide support for people doing it tough has got to be a good thing.  It's going to be close to zero here tonight in Canberra. There'll be a frost in the morning. We're given three sheets of cardboard and we've got a sleeping bag to keep us warm. Imagine if you were someone who was facing this every night. Not only are you facing homelessness, not knowing where your next meal might come from, not knowing where you might sleep that night. But unlike those of us here tonight, you're not safe. While this is a really important way for us to raise awareness and to raise money, I can only start to begin what it is truly like to be homeless and anything that we can do, I can do and that all of the people involved in this project can do to help people who are homeless is a great thing. She's going to be a long note.


I'll open up my superhero shirt for this. Woo! Yes, and with good reason. So I'm going to address a few of the points made in today's talk, as well as some general questions about the book. What I find most fascinating in comic book crime is the emphasis on the retributive tease, which I think is the best analysis that I've read of how violent retribution works in the comic books, where the heroes go up to the point of absolute retribution and then stop repeatedly. The term retributive tease, I assume is your term, and having worked in the comic book industry and written about it and still being associated with many people in the industry, this is something that we would talk about without having an effective vocabulary. I think this text provides that vocabulary. And I also want to add that the analysis of the place of women in comics is important, and that this was something that even in the late 80s, early 90s, we were talking about in the comic book industry, there were repeated efforts to rectify the problem. As noted, female-centered books don't sell. If we put a naked woman on the cover, the book would sell. And so there was this conflict between what the people in charge wanted to get the books out the door and what people who were writing and creating the books wanted to do, which made some interesting aesthetic problems. One of which you've mentioned is the aesthetic problem of the continuity, which is that you can never bring the stories to a conclusion because the books are continuing. So it creates a very unusual situation where the same villain will reappear time and time again, which is, I think, what leads to the retributive tease that any final solution to the problem of the Joker or Dr. Doom eliminates part of the continuity that is essential to the comic book universe. And the creators understanding that would just have to work within this system so that they were actually constrained by the various aesthetics of the medium. And it's very similar to what you see in soap operas, where the stories unfold over very long periods of time that are related to the contracts of the actors in the series, at least in those occasionally the actors age out, whereas the conflict characters never did. I also am interested in the discussion of the virtual imagined community. And here we see policy lessons and policy questions put forward in the standard utopian mode, which is to say an institution that we understand from the real world is placed in a world with an exaggerated condition, in this case the exaggerated condition of crime and the exaggerated condition of the capacity to stop crime. And using this, we can then analyze what our social justice or our criminal justice institutions would be like if both sides had exaggerated powers. And my utopian thought class is here, so I'm hoping they'll have questions on that as well at the end. I think here, of course, of Metropolis and Gotham, both of which have utopian or dystopian elements, Metropolis being the city of tomorrow, as it's always called. And Gotham a place where crime was rampant prior to the arrival of the Batman, so terrible that Batman's parents were killed, even the wealthiest citizens in the city. And it's often the case that they mentioned how things were before the Batman arrived. I will add that I object to the claim that comics have gone uninterrogated on the question of race and sex. They were interrogated. I just don't think they were effectively altered, especially with regard to the role of women in comics, the poses, the costumes, these things problematic. However, we did see women more and more in the 90s and the 2000s entering into leading roles and stronger female characters. So I think much was rectified, though it's still a very long way to go in producing anything like equality. And part of the problem is the difficulty in getting sales on female-centered texts. Now I'll raise some general objections to the text, which I've discussed with the authors. First off, oh, can you hand me my book if you would? There's one of the things that I noted was that throughout the text, there will be lines like criminologists, Cesar Lombrosa's idea of an adivistic stigmata or marker that symbolizes the evil embodied. We see criminologist Ray Serretta finds that most criminals are portrayed as psychopathic killers. In her analysis of serial killers, Sue Epstein points out, and yet when I see a discussion of the comic books, I see in Captain America the character Sin is recruited by Norman Osborn. Or in the opening pages of Daredevil, a young Wilson Fisk and his sister witness the brutal attack on their mothers, which is to say the writers of the comic books are not credited while the criminologists are. Seems to me if someone was doing an analysis of mid-20th century literature, even covering 100 texts, in each instance in which a text was put forward, the author of that text would be mentioned. So I was concerned about that because I think it represents, and I understand that the editors of your text, actually just as the editors of comic books can create problems, the editor of your text created this problem. I can't blame the authors. But the failure to cite creators bothers me because it's part of a general cultural position that the comic books merely exist, that they don't come from the source of creative individuals. And they do, and I know these people, and they think hard about this. And I know the artists, and they all went to art school, and they can tell you the history of Western and medieval art, and they'll all tell you why Albrecht Durer is their favorite artist. And strangely, it is always Albrecht Durer. And I think it's because of the detailed drawing skills that he had. So I want more respect for the creators, which is fine. For example, we could talk about the differences between the creators. For example, Brian Michael Bendis has renowned for excellent depictions of heroes of color, and that his rehabilitation of the character Luke Cage has drawn a great deal of praise. Mark Miller has discussed the nature of criminality in his text, The Authority. Peter Millican has discussed the problems of a belief in vigilanteism and ecstatic. On the other hand, I think many of the creators follow exactly the stereotypes you talked about and don't push back. I would think of Jeff Johns, Jeff Loeb, anyone named Jeff, roughly, would be in that category. Second, I want to point out that there is a hegemony of the race, class, sexual orientation, gender analysis in the social sciences. And while those are very important categories, I think it's important to, when looking at any given cultural field, find the categories that are native to that field. So, for example, there is extensive discussion of sexuality in comic books. However, sexuality is much less thematized than many other forms of consensual human interaction. And this is partly because you can't depict it on panel. So, the discussion of sexuality overrides discussions of other forms of consensual human interaction in this text, and in, I think, work in the humanities in the last 40 years. In comic books, the more centrally thematized question of consensual human interaction is the question of friendship. We see this as central to plots like Civil War, where the heroic, where the superheroes, though friends take separate sides and constantly stop to debate each other in the middle of fights, calling upon their previous friendship. We see this in a fight of Thor versus Iron Man in Captain America versus Iron Man. Similarly, they form friendships with the villains. The Flash and the Pied Piper, for example, are going back to the 1980s. The Pied Piper, one of the very rare, openly homosexual characters in the 1980s, who then became a hero and shocks the Flash with his discussion of his sexuality, and then becomes a common part of that text, and their friendship grows.  Similarly, Spider-Man and the Human Torch, and Spider-Man's general relationship of friendship to the other heroes, where he often feels lesser than them. Another example, the analysis of race, which is, of course, centrally important to comic books. The Black Panther was envisioned in the 1960s as the epitome of the strong Black man and named for the American political movement. He was made king of the most technologically advanced nation on earth, and was a diplomat and warrior, and one interested in peacemaking, not only not the stereotype of the superhero, clearly not the stereotype of the Black man in 1964. On the other side, the ridiculous initial story of Green Lantern John Stewart has a Justice League in 1968 flabbergasted that a Black man is a superhero, even worse in the Legion of Superheroes, which occurs in the 31st century. People wrote in noting that there were no Black superheroes, and that by the 31st century, this should have happened. The writers were forced to write a story. I know the writer who wrote this, and he was very unhappy, the editors actually made me this, in which all the Black people on earth had seceded and were living on their own island nation. Just to point out, this is the 60s, so things have improved. However, and I could give many more examples, and I think the examples in the text are excellent, the central phenotypic difference analyzed and thematized in comic books is not race, however. The central phenotypic difference that is commonly thematized is one of the most central themes of comic books, but which really isn't picked up in this text is that of deformity. This is true of the Hulk, She-Hulk, Tiger, the Beast, the search for a cure for the deformities of these male heroes, and interestingly only the male heroes in these examples, occupies many issues of their respective comics and crossovers. The difficulty of deformity, its role in creating social ostracization, and the way the appearance of difference leads to judgment of differences is central to comic books, recurs but isn't dealt with so centrally in this text. So I feel like this was a thematic that was in the cultural field that was in some way masked by the methods employed by the authors. The authors do note that some of the villains have evil written on their faces, but we should note it's not only the villains who are deformed. However, when they are deformed, this often becomes central to their identity. It is not merely that they are identified as villains by this that it is written on their faces. Rather, the very fact of their deformity is psychologically, sociologically, and even criminologically thematized. For example, Dr. Doom does not become Reed Richards arch nemesis until his face is scarred. The Joker is a perfectly ordinary person until he falls into a vat of acid that dyes his skin white and turns his hair green. It is after this that he goes insane. I could go on on this point. However, I'll move to another, which is that in the first chapter, the claim is made that story arcs are as much driven by editors as by creators, if not more so. Again, I think this is diminishing the role of the creators. As a former editor and friend of current editors and creators, I would say that this is largely true in certain periods in DC comics, and they cite the blog of Valerie Doratcio, who was an editor at DC, but in Marvel much less so. In the last 10 years, the creators, Brian Michael Bendis and Mark Miller, were given over a seven-year period free reign to establish the overarching story lines in Marvel Comics. The reason for editorial intervention occurs to maintain character integrity. So, for example, you couldn't have a character crippled in one comic and not in another. It was a question of continuity across titles, and to make sure that we didn't cross lines that would prevent the comic book from being saleable to all ages. Having done that on occasion in the comics, we found that it was incredibly detrimental to sales, and the store simply wouldn't carry them. There are a few exceptions. When I was the assistant editor on the comic She-Hulk, the creator, John Byrne quit because he had a scene where she was shaving her legs, which we cut, because in another comic, it had been stated that since she became She-Hulk, she didn't shave her legs anymore. But I mean, if that's the level of intervention that they get you to quit, I'll accept that there was too much editorial intervention. But we let them do otherwise. The stories were up to the creators. They would present six and 12 month story arcs, and we merely approved them based on continuity questions. Two more points. One is that the analysis of villains, I think, to some extent fails to take into account how much of the crime is nonviolent crime in comic books. For example, there's a thematic in comic books that is glossed over is environmental crime. This is central to the Swamp Thing comics. We see this as a central issue in the authority where large swaths of the earth are being destroyed and characters in the authority use their powers to restore the earth. The character Firestorm does the same thing. The economic and white collar crime, for example, in the DC universe, Lex Luthor, Superman's arch-nemesis, is a respected businessman, and much of the evil that he does involves corporate bullying, corporate takeovers, the elimination of small businesses. When Superman started, actually, he was sort of the socialist superhero. He'd go out and fight industrialists and so on. The writers in the early books were New York, Jewish, largely Marxists who attempted to express some of this in the comic books. And we still see this in what Lex Luthor does today. In the Bendis Miller story you talked about before, Civil War, Norman Osborn, who is a respected businessman, is indeed committing crimes of violence but his much more serious crimes seem to be economic crimes and crimes that are corrupting the system, the justice system. We also see this with Dr. Doom who commits very few crimes of violence, but an intense number of political crimes as he rules a small nation. So in fact, it's not the case that these characters are faced with a wave of the sort of street crime, although that does go on. The serious crime is upper level white collar criminality. And I'll make two more notes. One is that I think there's a question about the general influence of the floppies which you raise, which is to say the books that come out on a monthly basis. Mostly what we see of the superheroes is from the movies. And it's important to note that the movies often take only tiny bits of the stories or change them. I'm gonna note in the film Kick-Ass, for example, in the movie, a young girl becomes a vigilante because the mafia is hunting her father who was a former police officer and has killed her mother. And the father decides to turn her into a vigilante.  In fact, the father is not a police officer. He was a father who lost custody, kidnapped the daughter, told her that he was a police officer, told her the mother had been killed by the mafia and did this so she wouldn't trust anyone or ask questions. And she's in fact saved from this later. In the movie, the main character, Kick-Ass, pretends that he's homosexual so that he can be near a woman he's in love with. He's a high school student. He's actually in the room with her when she's undressing and asking about clothing.  In the comic book, when she finds this out, she punches him and is angry that he looked at her naked which makes more sense to me. So I'll just note that some of this stuff gets dumbed down as it gets filtered into the mass audience. I do want to importantly note that I am very impressed with the work in this, especially on the notion of the nature of retribution and the analysis of the sex roles in comic books. And I believe that the discussion of retribution will form a foundation for much of the coming literature on comic book crime. Thank you. We'll take any questions. All right, here first. Oh, one minute. I think there's a microphone that'll go around. Once again, in relation to homosexual representation in comic books, because I haven't read your book yet, have you discussed North Star's marriage in the astonishing X-Men and also Alan Scott in Earth Two? This was, I believe, a year or two ago, a reimagining of Alan Scott, the original golden age Green Lantern as a homosexual. 2002 to 2010. So Earth Two was post-sample. So we didn't, yeah. Even since we finished our manuscript and submitted it, lots of race and sexual orientation issues came up that we talked about, but it was just too late to include. So we didn't. I feel like we may have actually jumped the gun by cutting things up at 2010, because actually the last three years, particularly on the gay superhero, there's been a lot of activity on that front. The X-Men cover about a year ago, which was a gay marriage between two X-Men. So perhaps that's moving in a direction that we didn't anticipate cutting things off at 2010, so there's definitely more work to be done. And I think if you read the text, it becomes more apparent that though the formulas are pretty discriminatory, the sort of dominant formula can be rather discriminatory, there are spaces of difference, spaces where things are experimental, and in a way not to overprivilege our current historical position, but we are at a crossroads in the last decade as to which direction this is gonna go, actually. And perhaps if we did this analysis up to 2013, we would have been more positive. I might have been on that front, actually. So you make a really good point that there's activity since then. Yes. Well, as a non-comic book reader, so speaking from total ignorance, what to mind, as you were talking, was the Stig Larsen books in Sweden. And you have this indomitable, almost superhero woman who keeps popping up again when she should be dead, right? And you have this atmosphere of not only severe sexual abuse of women, but of corruption in government. And apparently there's a Swedish genre, and there's a word for it, which of course I don't know, of generally super women heroes. She's not the only one. And I was wondering if, I mean, it's a different venue. It's not comic books. It's crime mystery. But if this trend in Sweden, in some ways resonates, or it leads you to think of differences between the societies. That's really interesting. I'm gonna have to give that one to Niki because she was actually doing some work on the movies. So the movie, Girl with the Dragon Tattoo, there was one in Sweden first, and then there was an American version. And at one point. And now there's a graphic novel. And now there's a graphic novel, so the comic books have picked it up. But at one point you were looking into, whether there was a cultural difference there that was significant. I was looking at, yeah, it's not a criminological aesthetic. So just a sort of a different take on the, not really related to this, but thanks. So I don't, I mean, I would say it's interesting because when you have characters like that, sort of revenge, that's really a revenge fantasy movie. And characters like that, and like the Brave One with Jodie Foster, those sort of like revenge fantasy movies that are so popular, but it's just the case that in this medium that the female-centric titles they just don't sustain themselves for some reason. So. And that's not necessarily true. I wouldn't think I'm not an expert on this, but it's not necessarily true. A popular crime novel so much. But it is interesting that Liz Veth, is that the name of the character? She is a lesbian or has lesbian relations. I don't know if I've heard her exact identity is maybe she's bisexual. Bisexual, thank you. And she's tough. I mean, she has some masculine qualities to the way that she will exact her revenge.  And trying to sort of live in a different frame and perhaps that's her journey, right? And it goes in various directions. I think there is a relationship, but we don't necessarily explore that here, yeah? Yeah, no. But that's something, yes, there is. I just don't know exactly what it would be other than to say that it's all a part of this sort of Western tradition of revenge and gender. Which perhaps is. I don't know how that would have played though if they did not make her bisexual though. That's what I'm saying. Because it was really her relationship with McCall. Yeah, exactly. So I still think it's falling. It's sort of pushing the envelope while maintaining a certain formula that we're used to. And I guess that's sort of how change often happens in any cultural field, right? I mean, people buy it because they're in a genre, especially with the crime novel. But then there's space for change. And so then that perhaps could change things later. And so it's that dance of what's old and what's new, maybe? Yeah, I just wonder if there's a difference with Sweden versus America because my slight experience, like four days working in Sweden with lawyers who made a big, big deal of stopping. I mean, this was one of the notorious trials in Sweden in the century. And the lawyer made a big deal of stopping, OK, I have to call my son to find out such and such. And I've never worked with an attorney in a serious case where I have to do my child care responsibilities. And there have been talk about the Swedes making this big effort. Guys are sexy when they take care of their children. So it did seem different. But that's me being one example, what I used to call philosopher's induction, one example. And I'm making generalization. So any other questions? Yeah, we've got some over here. Sorry, we're having some microphones. Awkwardness. It's working now. I think I've got it figured out. Hi, that was just really fascinating. So I'm looking forward to reading the book. I devoured comic books when I was a kid. And I haven't looked at them in years. I was madly in love with Superman until my late teens or something like that. But I was wondering if there's a, first of all, about age group. Like, who are the dominant readers today in terms of age group? And also, whether in your sort of related to that in your focus groups with adult readers, did you ask them about their political views? For example, are they pro-death penalty? Did they favor the invasion of Iraq? Do they tend to vote Republican or Democrat? Did you get any sense of correlations like that? Yeah, we did try to get some sense of that. And it's mentioned in the book. We probably have more to say than is even in the book on that score. First of all, it's mostly men. We only had, in our focus group, we did several focus groups. We only had one woman show up. And that was representative, actually. I mean, sadly, of the readership. And mostly middle-aged men. Some young people, but I would say the average age, we didn't ask age. We didn't want to make the conversation about age. It was whoever showed up and was willing to talk to us. But I would say around 35, right? I mean, in your 35 or so. I mean, these are not books for kids, obviously. And we, in our sample, we didn't mention this. We actually weeded out any best-selling childrens. Like, Simpsons has a comic. We were not looking at the all-ages comics. These are folks that live in New York City. They tend to vote Democrat, for the most part, or in this area. So our focus group is sort of New York City-based, which for comic book readers, I would imagine, I don't have raw data on this, that this is probably a higher per capita comic book readership than maybe other parts of the country. I could be wrong about that, but certainly a good place to study people reading comics. So they tend to vote Democrat. They're not necessarily for really retributive punishments like the death penalty or so on. They're probably more tough on crime. You know, sort of like, I always think of sort of the Clinton era where Clinton was incredibly tough on crime, but sort of liberal in other ways. I also think that part of the allure is this transgression of when I read these books, I get to be more of a conservative asshole than I actually am. That's, you know, this is Stacy speaking. And, you know, Mickey and I talked about this a lot. I think I'm a little bit more, I went so far at one point, I think we edited it out, that this was some sort of sleeper self or like conservative American value. Just waiting to be tapped into, you know, I got a little, you know, a little concerned about it, but I definitely think it's a more conservative medium than others as a sort of main dominant trope. And that's interesting, but certainly folks are tough on crime and are more likely to say things like, you know, this city is a shithole and we've got to clean this place. You know, these kinds of sort of disparaging comments. I would just add one other thing that what we found was interesting. We did ask those, we did specifically ask those questions, but a lot of times the conversation organically turned to those issues, because what we found is that they, when they read these books, even though it's a very solitary endeavor, right? So you go home and read or you read on the train or whatever, but it's not solitary for the, it's all about community. It's all about sharing. It's all about talking about what happened, what happened in the books. And so when they talk about these books, a lot of times they would work through what was going on in the world through those books and they would talk about the Bush administration or they would talk about the death penalty just organically as part of us asking questions about particular storylines or what did you think about our domestic violence when we talked about Hank Pym. And so a lot of it came organically from them and really got us to thinking about how these books really, the readers really sort these, work through these moral anxieties through their reading. And I just wanted to spin off on something in the sense of community, I have to tell this story. You're right, that's something that we found that we didn't know that we would find was this sense of cohesion among people who read these. And we went to one discussion group and everybody was talking about, this was before the formal event started, they were talking about the first time they had read The Sandman. And it was like, oh my first time. And I was like, and it sounded like other first times that one might talk about, but it was The Sandman. And everybody had, because that's such an iconic book, people had stories about how they came across it and how touched they were. And it was part of the sharing and it was a bonding experience for them. They take it very seriously.  And at the same time, they were fully invested in whether or not that action was just or not, whether it was criminal or not criminal, they would then turn and say, this is just a comic book, it's really not, I don't really, we don't really take this seriously, but they're very serious, they're very serious about it. So, that's true. So I actually have a question, I'm sorry to jump the line, but I wanted to see if Professor DeGivana would weigh in on this along with the authors. I wonder if you can do a bit more to unpack the relationship between print comic books, which are arguably a bit of a sub-cultural medium and the mass market films that have become so popular in the last 10 years or so. What aspects of the sub-culture appear to be sort of bleeding over or being adopted wholesale by that mass market medium and what aspects are sort of blocked, what aspects are just not making it? Yeah, that's an interesting question. I mean, if we look at the history of superhero films, what we'll find is that earlier in the 1950s, 60s and 70s, very little attention was paid to the actual form of the comic books. This continued through the 80s. When I was working at Marvel, for example, they made a Punisher movie in which they did not use the logo that he normally wore on his chest and the director said it was because he wanted to get, quote, get away from the comic books, which drew the question, well then, why did you license the comic book? Similarly, they made a Captain America film and you can see Captain America here has these vertical stripes and they changed the stripes and moved them horizontally and changed the shield and they said it was because it, you know, created a better line on this particular actor's abdomen. So there was very little interest in it. What happened was the comic books, then the creators of comic books moved into Hollywood and the Hollywood creators moved into comic books and so we saw greater cohesion and we began to get writers who had read comic books who were writing the movies. So for example, Kevin Smith was paid to write one of the Superman movies, it was never made but this was one of the first examples where a hardcore comic book fan wrote one of the films. We now see that the entire Marvel comic book, your movie line is overseen in fact by one of the comic book writers by Jeff Loeb and that there's consultation from comic book writers on this and so there's been an effort to bridge this gap on the other hand, these are still Hollywood movies and so what's left out is gonna be the complexity that you have in the continuity. So while it's one thing to adapt a story, like for example, the Skrull Invasion story in the Avengers, which you can wrap up neatly, they can't adapt the sorts of stories that comic book fans really are drawn into like the Civil War story which took years to our final crisis for example, which it just involves too much continuity. So what you get is there's a particular kind of literacy to comic book fans, you're talking about, well, they know all these characters, they know the parts, I mean, these are people who were they Russian literature scholars could cite you every instance in which Nikolai ties his shoes in war and peace. They know this stuff backwards and forwards in the manner of the obsessive literature scholar. So their level of literacy is very high and you can't ask an audience to have that level of literacy in something like a movie and as a result, I think some of the deeper thematics are left out. We're talking about the politics. There were two comic book series, weirdly enough in which superheroes murder George Bush. One is the authority, the other is black snow. I can't imagine that's, I mean, if you know these creators they tend to be fairly leftist actually. So that kind of politics is gonna be left out. The level of sophistication will be left out. But what's being drawn from it more and more is the mood of seriousness which didn't use to exist. The idea that you have to take someone seriously despite the fact that they're wearing a ridiculous outfit. And whereas in the 1950s and 60s this was all played for laughs, somehow, and I don't know how this happened, you now have a truly serious set of Batman movies. And I think the comic fans are gratified by that change. I'm not so familiar with comic books and the heroes within the comic books but as I understand, at least the popular heroes suffer some sort of injustice in their history, right? So Spider-Man loses his uncle, Batman loses his parents, Superman, whole family planet, whatnot. So I'm to understand that this kind of injustice or crime shapes them to be crime fighters. But I was wondering how many heroes are shaped by injustices that, let's say, Martin Luther King faced, like the injustice of the laws. How many superheroes face those kinds of injustices and then become fighters for justice totally? Like, you know, just changing the laws. Do we see superheroes that catch a bad guy, say, we understand this law is ridiculous but it's the law so we have to enforce it? Are there instances like that? I was thinking as we were talking of Luke Cage who was the victim of a, he was an innocently convicted person. Though he did have a small criminal past, he was convicted of something actually he didn't do and so that's part of his origin story. But it's really, comic books in general are not very critical and certainly ones that sell of the system or the laws per se. The vigilantism is often what I would call a hyperconformity to the status quo. It's this notion that the police are ineffective or corrupt or what have you but it's not revolutionary. It's not saying we shouldn't have capitalism, for example, or that we shouldn't live in cities or that we shouldn't, right? It is, there is this sort of status quo orientation. There's some exceptions. We talk about it in the book in terms of the 1970s with Green Lantern and Green Arrow taking a side trip to some, some blighted neighborhood of New York. I can't recall. Anyway, some New York neighborhood that's in bad shape in terms of economics and realizing that this was what they really should be fighting which is poverty and unemployment and all of these things. But that kind of sort of more revolutionary or leftist sort of trope doesn't do so well in the mainstream over the long haul. There are exceptions to that that are critically acclaimed but they aren't the sort of popular books. I don't know if you wanna add some more or James, do you have something? I would, I'll go ahead. I was gonna say I think the one that answers your question would be that the X-Men and all those titles are about people who are from a despised minority and that the majority of those stories tend to deal with dealing with things like laws against mutants and that. And that's why we see Magneto who's the villain is actually often a hero as well plays back and forth. So I think that's much more like the Martin Luther King story. And in general, mutation has served as a proxy for race in the comics. And this was explicit in the 1960s when they weren't able to write the sort of stories that they wanted to write about race, that they were gonna use this as their proxy throughout it. The other thing that I would add about that is that, that is true that a lot of the origin stories for the heroes have these sort of terrible backgrounds but then so do the villains. So a lot of times they'll say there'll be a story where I think it was one of the scarecrow stories but Batman was saying his background was, he suffered a lot of abuse as well. So they suffer a lot of abuse as well but the difference is that only the heroes have the will to overcome. So those types of backgrounds could lead to good or they could lead to evil. An individual offending and sort of individual punishment is very much what's on order in these books. So this is a notion of restorative justice or bringing people back into the community of repairing harm. I mean, this is just sort of not, not really on order in most of these mainstream books. So I think some of that, perhaps even if the origin is similar, I mean, I would argue that it's really a status quo orientation about punishing or coming very close to punishing individuals which means it's outside some of the framework of what you are talking about, yeah. Over here, I think this person has had a question for a while. Thank you. You just touched a bit about mutation as a proxy for a race, I was wondering if you guys could talk a little bit more about that. I feel like at the time, very similar to how Rod Serling used the Twilight Zone to talk about race and government overreach and things of that nature. So if you guys. Yeah, I mean, what was most fascinating to me is some of the ways that the Middle East was projected. So even in a JLA story as recently as about eight years ago, you had the source of apocalyptic crime coming from a, was it an alien country? It was an alien planet where everybody was a monkey. Yeah, where everybody was actually a monkey, but it looked very much like a Muslim scape with minarets and domes and stuff. So that's sort of another sort of animalization, not really mutinization, to signify the other, right? And then this goes on and this is common throughout. This is a visual medium and there's a history of sort of how that's done. And it's interesting to sort of read that in light of sort of more politically correct lenses on that. Because as you're saying, I mean, it's not just comic books who have made sort of those kinds of commingling of race or ethnicity with something other and to sort of visualize the other in that way. Did you want to add something to that? So we talk about it a lot in terms of Arab and Muslim scapes. Not as much with other types of... Why didn't I stand in for gay too? Right, I think the thing with the mutant books was a way to tell all of these sort of stories. An interesting feature, if you looked at the X-men, even as back as the mid and early 80s, the team would be largely and occasionally exclusively female characters. These characters were given very rich lives and they didn't have to play female stereotypes so much. So the writer at that time was Chris Claremont was very concerned with sexism in comics. Prior to that, when it was invented, Stanley and Jack Kirby thought that this was a way they could tell a set of stories about the civil rights struggle without alienating the readership. And they did so. I mean, there's the mutant registration laws, there's anti-mutant laws, mutants. So they really just, it was as bald as it could be without causing problems for them in selling it in the South in 1963 and so on. Nowadays, of course, you don't have to make those moves but as a result, there's a tradition in comics of using something like deformity or some visual effect to signify all sorts of difference and say, well, you know, the thing, for example, as we see the Rocky figure there, right, is always stood in as this person who phenotypically it doesn't look heroic and has to prove it over and over again. So it's something that the heroes, I mean, the writers and creators are concerned with. Having worked in the medium, I will say there was, I don't know that it's an excessively white group of creators. It reflects New York, they're New Yorkers and so in the Marvel bullpen, the majority of people working on inks and letters and stuff were Hispanic and black at that time. Of course, there were old racist white guys in the back room as well. Methodologically, whether you ever thought of using the internet so that you could get your focus groups beyond New York and have online discussions. We use it to gather focus group participants, but we used the internet a lot for monitoring, looking at participating in discussion boards, reading what people had to say. We do cite a lot about internet discussions that were going on and debates about the issues, but we didn't use it to recruit. Yeah, some of it's just my own bias of running a focus group. We wanted to get into the stores too. We really wanted to hang out with people. And you know. I think I'm personally, maybe not so much to Nikki, a little bit of a dinosaur on that and I wouldn't feel so comfortable doing social science research over the internet, but that's just me, but I mean, you're absolutely right. I mean, we had this limitation of, there was like almost no budget. We got a couple small grants, but we had really no budget for this and so we got focus groups where we got them, which was here. But you're right. That would have made it more generalizable for sure. Absolutely. Yes, Karen. So this is fascinating. I'm sorry I came late. So if you mentioned this, please forgive me. First of all, as a teacher of literature, this is fascinating and I can make so many connections, but this is something off topic, but it's been really fascinating me. I've known all, well, Professor Strobel and Professor DiGiovanni for years and I knew nothing about your interest in comic books and I'm wondering how you got to find each other. Well, we have an origin story for James as well. Can I, can I break the silence on this please? So I was at Forbidden Planet on Broadway down by Union Square and who did I see back when James was on the Senate? We were both at the cash register with our stat, it was Wednesday, which is the traditional day when the new comic books come out and we sort of looked at each other and went, uh-huh. And I said, I think I said something like, look, I'll keep the secret, you know, safe, if you'll keep the secret safe. Right. We were buying a lot of the same titles, actually. Yes, we were. Oh, how interesting. So. I don't think I hide it. I mean, I wear those to class all the time. Yeah, I clearly wasn't paying attention. I could ask old my students, I think they would know. Well, I have a t-shirt that I wear to class that's Shakespeare wearing a super, Superman cape and everything. And so when I teach Shakespeare, I take off my jacket and there is my Shakespeare Superman t-shirt. But I've always loved comic books and this is just wonderful, fascinating. Thank you. Professor Giovanni, it's amusing that you're wearing the shirt, the red ring, which is the ring for a hatred, if I'm not mistaken. Anger or rage. Okay, because the question I have kind of ties into that. Do you believe that the portrayal of evil hinders conflict resolution practices in the international arena where differing nations tend to vilify individual persons of other nations or certain subcultures, thus justifying their extremes to which they are used in war, such as like in Kosovo and so on? So is your question about the vilification of people that would then lead to hatred, that would then lead to war? Yes, because it seems that villains are portrayed as like being foreign, like being that, which we don't really relate to. So therefore we consider an opposed opposition to our identity. Yes, so we have a chapter five of the book is on villains and we do an analysis of this sort of through the criminological text of Lombrozo who you may recall from CRJ101 if you took that class, right? He was the Italian criminologist who felt that he could measure crime and he can measure it through physical characteristics of people, right? And so we used convicts. And so people with protruding foreheads, asymmetrical smiles, wrinkled skins, these were all markers of deviance, yeah. And so I think that you can follow that very, very well in comic books that the villains have these markers. And if you're an unsophisticated reader, I'm not sure people are unsophisticated necessarily, but you could sort of superficially read that people who look funny are problematic. I mean, you can do that reading. And sometimes it is explicit. So the example might be two-faced, right? No, that's all over the back. Go, go, go. Sometimes it is very explicit. You really don't, it's not, you don't have to think very hard. It's, that's the purpose of the illustration is to designate that otherness on the page. Right. And I think the X-Men is trying to sort of do something different by saying that being a mutant can be empowering, especially if you have a collective and that you can organize. But I still think that there's an inherent tension in these books because it's a visual medium, because the graphics need to be flashy to sell and because they're depicting crime and deviance, that I'm not sure there's a complete way around having some kind of visual depictions of evil. The question is whether it needs to be on the body. And I think that that can feed into all sorts of sort of notions of difference that are negative that could lead people to despise others based on superficial characteristics, but that would be a less sophisticated reading. And I'm optimistic that people, I don't know if they do, because that wasn't really our question per se, but I'm hoping that people see a little bit beyond that and see that the heroes, as Professor Giugiovani just said, that the heroes also have mutations and deformities and so on as well. And so they're not perfect people either. And so I think that helps to soften the potential for what you're talking about. I think we're gonna wind up, Professor Giugiovani had to leave because he had to teach a class. He wasn't just, you know, bailing for no good reason. But we thank you so much for coming. We're gonna stay for a few more minutes if anybody has other questions. Thank you so much.


Everybody, thanks for coming out. So without further ado, let's get talking about activity streams. The talk today is activating your site, a look in activity streams presented by us. We're gonna go over briefly what they are, how you can implement them, and why you should care about putting them on your site. So just briefly, I'm Justin Ben-Farhan. We are all work at National Geographic, which uses a lot of Django on some of our sites, and we've been doing this for a while. So again, here's the agenda. We're gonna talk about activity streams, what they are, why you should care about them on your site, some of the engineering concerns around implementing them. And then we're gonna talk through the open specification regarding activity streams, and then two solutions, one expressly in Django, and the other one as a service that can work for any website. So what are activity streams? So they're actually everywhere. So GitHub, Facebook, LinkedIn, Twitter, et cetera. You probably run into them one of these at least once today. They essentially are a way of displaying actions that people take on your site. And they also have a way that people can somehow socially link themselves to other people who are also making activities and amplify the amount that they're seeing in their stream. So why do all this stuff? What's the point to all this? And it actually turns out that it's really good in increasing engagement on your site. So even if something as simple as putting a like button on your site, we'll drive traffic immensely, because essentially people like clicking on things. We try this out on Nat Geo and just very basic, without getting any, a lot of user feedback or anything like that, people just like clicking things and say, yes, they approve this content or whatever. And also, so that's the first half of being able to publish your activities to a site. The other half is being able to consume them and see what your friends are doing. And with those two in combination, you actually set up a really powerful, positive feedback loop that will drive lots and lots of more content and engagement on your site. And that's a really great thing to do. But in terms of engineering, we get a lot of data out of it, hooray data. And with that data, we do a lot of fun stuff, including tons of analytics. You can drive recommendations like Netflix, show you related content. We have social graph apps. We can show you trending, you can drive A-B testing and tons more. But there are some engineering considerations that have to be taken into account implementing this. And Ben's gonna dive into that a bit more. Hi. So these are just some of the problems that are presented with activity streams. There are no great solutions to this. It's not a simple, clear cut answer. But it's all about weighing the benefits of each one of them. I'm gonna dive into each one of these a little bit. So the first problem is too many peppers. Essentially, there are so many implementations of activity streams out there, and that's kind of evil. We don't really get the benefit of cross-site implementation. It would be really great if I could do an activity on Facebook or somewhere else and then get that same thing at National Geographic or another site. It causes duplication of work and there's no common semantic structuring. So it's kind of hard to implement these things and come up with the terms on your own every time. We're gonna talk a little bit about the solution to that in a little bit. So the second problem that we might face is what do we actually store and what type of data structure? And in what schema? Is this gonna be a relational database, a non-relational database? What's the data structure? There's different things in terms of efficiency that could come into this. Are we doing an adjacency list, an adjacency matrix, W-linked list, something else, a key value store, just a hash. Are you gonna have more rights or reads? So if you're a social media company, you might show the news feed a lot and then you're gonna have a lot of reads. If you are a company like National Geographic, there's mostly content. I'm not gonna show you the news feed that much and I'm gonna have a lot more rights. And then do I store the activities in the same place that I store the actual stream? Where was it pre-computed or something like that? I'm gonna touch that in a little second. So another problem is centrality versus sparsity. Haters gonna hate.  So those are people who have a lot of followers or do a ton of activities. And the reverse to that, which is sparsity, forever alone, I only have one friend or I've only done one activity. And each of these things present a different problem. For instance, for the celebrity, do you start to enforce limits? At some point, that's gonna be too much to compute. Facebook, if I remember correctly, has a limit for 5,000 friends. And do you solve that with a data limit? Is that a hard limit? Or do you do some sort of UX solution where you hide the follow button at some point? And then the other way, the other problem is, what do I show a person that has one friend? What do I show a person that's only done one activity? Am I gonna show them stream with that one thing? A stream that has only that one friend's activities? Skillability, obviously an important factor here. What am I dealing with? Am I dealing with a massive amount of activities or just a few? Where do I do this computation? Am I offloading it to somewhere else? Am I doing that inside the request response cycle or doing something else with it? And how do I handle complex queries like friends of friends or follows or recommendations? And then real time versus pre-computed, when do you do your computation is an important factor. Are you pushing out in real time? If so, how do things take precedence? And are you doing some sort of half and half where you're pre-computing some stuff and then computing on the fly for other things? And what are you actually sending? Are you just calculating the ranking of things? Are you doing the entire thing, including the HTML and then just sending that off? What are you really going to compute? So I'd like to invite Justin back on and we're gonna talk a little bit about the solutions to these things and some of the implementations that we came up with. So there is a solution for some of these problems. It turns out there's an open specification called the activity stream specification that aims to solve at least the very implementations by solidifying everybody on one semantic structure and then the data and how it's stored. And so this has actually been around for a while and all of these companies here are implementing it in some fashion or another. We implement this at National Geographic and the other solutions we show you today also implement it. It supports Adam and Jason data structures out of the box and in a human friendly and machine processable way. Quick disclaimer, nobody up here is officially involved in the specification. We're just implementers who are showing our, or sharing our experience with you about this. So the spec looks a little bit like this. So there are three big entities. The actor, which is the required one, normally that's the user on your site. It's whatever's taking that particular action. The verb phrase, which is whatever actually happens like commented, post. The spec defines a whole list of officially supported verbs. But for most of the sites I've seen this implemented, they take those and then the ones that aren't there they sort of just run with and customize their own. There's an official channel to go back and propose verbs that aren't there to the draft specification, which I encourage you to do on their website. You also have an action object which is the primary object of the activity, whatever gets created essentially, whether it's a photo and an album or a comment on a blog post. And the last entity is the target is wherever that action's taking place. It could be like the album or the blog post, wherever the action is going. And then there's a little bit of meta information like what the timestamp is and a descriptive title on summary. And so this is what the JSON implementation looks like. Real quickly, a quick example. You see the actor, object and target have their own JSON object right in there. And we sort of stuck to sort of like Jason is the first class citizen of the rest of our implementations. So I'm gonna talk to you right now about Django activity streams, which is an open source project that I wrote and has been used in several different sites. So it uses the specification. It can track any object in your Django project. It runs on any supported Django database and it keeps track of everything using generic foreign keys. It also provides a way for you to render these streams onto your site using template tags or feeds. Everything's generated at request time and I leave the caching up to you. And you can read along with the source code at my GitHub repository or also read the docs. So when I'm not working at National Geographic, I'm CTO of Nalwa Studios, which is the gaming company that runs the humans versus zombies game. And APC is essentially an organized game of tag that's played at colleges, universities and other locations all over the world. And we do it with like thousands of players. We're doing hundreds and hundreds of actions a day. And we needed a way to sort of give that feedback and show people their streams. And so this is HVD source, the Django site that we set up to help moderate that game. And you can see a simple action right here is just the row. Crazy face, the actor selected the verb, the original zombie is the object and the demo games, the target. And then the timestamp is in the time since filter, all displayed right there. So behind the scenes, it uses two models to accomplish everything. The main action model has generic foreign keys named actor, target and action object that can point to any object in your Django database. It doesn't have to be a user. That also has that descriptive meta information I was talking about as well. The second model is follow. It has a foreign key to your user, whether that's Django auth user or it also supports custom user. That's up to you. And then a generic foreign key you point to any other entity that you'd like to follow. It doesn't have to be user, it could be anything else. And it maintains that relationship in the database. So generic actions are pretty simple. You just import the signal and send it along with the arguments. So crazy face is the actor first and foremost. And then all the other arguments are sent in as keyword arguments. So crazy face selected the original zombie for a target, which is demo game. Following and unfollowing is similar to Lurie. Also simple. There's just a follow and unfollow function that take a user first and then an entity second and either create or destroy that follow object. And there's also followers and following which would return a query set of users that follow that given entity or the other one as the reverse lookup and gives you a list of entities that that user is following. And of course there are streams. What good is this app if you can't show it? So it comes with a few built-in streams. User stream being the most important one that takes a user finds their followers and then gives you actions that those followers have done. That's like your main dashboard of GitHub or Facebook or Twitter. That's probably the most important one. And then there's similar other ones that are actor, target and action object that just do a similar lookup based whatever context that that given object is in and that action. So actor stream and crazy face will show me all the actions where crazy face was the actor. Model stream is another interesting one. It'll show you any and all content or any and all actions that involve particular content types. So this will show me anything that is happening with any user model. And so if I were to graph out the interesting one, the user stream query, essentially you're given the user object. It goes and finds your followers or the, sorry, the content that you follow and then it reverse looks up the actions that were involved those objects. And it can also filter it down by relationship. By default, the user stream just returns everything wherever your follower was involved in but you can customize that as well. So those only get you so far. There's also custom streams which are easily to implement. So basically this first one right here, player actions takes a game instance. It finds out the number of player IDs that are in this game and then it returns a query saying, show me all the actions where the players of this game were the actor and it does that by object ID and content type. The stream decorator gets you a little power where it will, you can just return query set arguments or keyword argument filter. You don't have to return a query set. And then the second example here is the player actions by slug. It simply does the same thing that the first one was doing, only it takes a slug instead of an instance. We're gonna get back to that guy a bit later about why that's useful. So to graph that out, it looks pretty similar to the first example. You're given a game, you find the players in that game and then you do a reverse lookup to find out where those players made the specific actions when they were the actor. So it's a little, it's pretty straightforward. It's the generic foreign keys work from the player objects to the actions and keep track of the relationship that way. So the first way to put this on your site is using template tags. And the activity stream template tag is the most helpful because that essentially takes, the first argument is the name of the stream you're interested in, like the actor stream, then any arbitrary objects you wanna pass in through that tag. This returns a stream object in context which you can iterate over and display however you want. There's a helper built in called display action, which is just an include tag that renders a specific template that you can override in your project, but you can also display as however you want on your site. It also works for custom streams.  The second sort of overall function that the templates give you is ability to create follow buttons. So this guy essentially is a link that's a toggle. If you're not following this person, it will give you a link to follow them. If you are following this person, it will give you a link to unfollow them. It's sort of like the toggle that you see on GitHub or any other social media sites. The second way to get information out of the app is through feeds. So the user feeds first and foremost. Any of these support either Adam or Jason. For the user feed, as long as you're authenticated and you go to that URL, it will return out the user feed in the machine readable format. Object feed does a lookup for specific object by content type and object ID and then returns you a stream of actions where they participated in that in any relationship. Model feed, just like I showed you just does everything based on the content type. Interestingly, you can also add custom JSON feeds like this. Like I showed you with the game slug, the second custom one before, you can actually pass URL parameters directly into your streams and render things out through a custom JSON feed that way. So in implementing this, I ran into a couple of database considerations that are important to note. So if you were to write this thing naively and write this on a template, you'd essentially get one query for getting all your actions and then as you were iterating, you would do a hit to the database for every actor, every target and every action object and this gets incredibly complex after a while. So luckily in versions of Django 1.4 newer, you have prefetch related which essentially combines those all and it just has big O of C where C is the number of content types overall. So it drastically reduces the number of database queries. It makes the queries a bit beefier and then Django gets that information back from the database and then shuffles everything together in Python to give you your final query set. So Django activity streams use this under the hood. You don't have to worry about this but you can extend it if you'd like further on. Also, since we're dealing with generic foreign keys, there are some limitations. Like the aggregation and annotation API of Django will not work for generic foreign keys that I found. So like this guy right down here that tries to find a count of actors whose health is greater than five just will not work. So this leaves, unfortunately this leaves out a lot of the interesting things like recommended content, like most popular, like a lot of the more interesting queries that you'd like to get a handle on.  So there's sort of a better way to do it and that's what we've been using at National Geographic working on the Horizon service and I'm gonna toss this back to Ben to tell you a bit more about it. Blow again. So a little bit background about the Horizon service. Like Justin said, if you're building an app which just needs an activity stream, his project is awesome for that. We have a large ecosystem. We don't really have control over the models that exist within the different sites that we have and so we needed some solution that was able to deal with this type of stuff as a service. We have a great product owner that basically told us there are three different implementations of favoriting right now. Build Me One. And so we built a service and it follows the activity stream spec or tries to. There's some limitations with some of the solutions that we chose. It does a half and half sort of real time versus pre-compute mix and what's important to know is that if you wanna use this, your models must have an API. We'll talk more about why in a minute but that is a requirement. And then there's clear separation between front end and back end modules that come together with this and this again is open source. So a little electrical circuit for you about the Horizon ecosystem. I'm gonna dive a little bit into those and we'll talk about them. But first, storage considerations. First thing we look at was what do we store this in and a graph database really is perfectly suited for these types of things. And for making interesting queries. It's optimized for large traversals. It's really good at storing the relationships and we can look at individual slices based on different things which I'll talk a little bit about in terms of the choices that we made. So Neo4j was our product that we chose to use for this, the database. We looked at others but eventually chose Neo4j. It's based on TinkerPop which is a Java framework for property graphs. Titan, which is another graph database also uses the same thing. Property graph is essentially a graph database that allows you to have properties on both nodes and edges. And underneath the hood it implements a W-linked list as its data structure for relationships and nodes are just pointers to their first relationship and that's how they traverse. In terms of complexity, indexing and search are a little bit costly because it's a double E-linked data list. It has a big O of N where N is the number of edges but and then for insert and delete it's constant speed but Neo4j actually uses Lucene on top of things so when we start talking about indexing and search it gets a much better result. But what do we actually store? So we don't want to store your entire model. We can't actually store your entire model. Our situation is one where there's multiple models. We could have a photo in one site described completely different from a photo in another site and in trying to solve that and in using the best practices for something like Neo4j, we decided on five basic properties for nodes. Those are API. If you remember I talked about you needing an API route for your models. An AID, your application ID, a type of app label model name so let's say YouTube underscore video. Created and updated timestamps and then that could be an actor, an object, a target or anything else in your graph. That's the only thing that we store. For edges it's a little bit different. Neo4j has a native type so that could be followed, favorited, liked, watched, so on and then a created and updated timestamp. We also use Redis. We use Redis for sockets, sessions, caching and then some stream data. It's really good for that type of stuff and there's not much to say except that it's an excellent database. And then back to this part, I'm gonna talk a little bit about the pre-compute cycle so we said that you have to make a choice between real-time and pre-compute. We said that we chose half and half. We use Apache Storm. I don't know if you're familiar with it. It's a really great product. It's like Hadoop but for real-time message processing. It's not a dependency but a recommendation and the way that Storm works is it has these topologies. Essentially topologies or Storm in general is a processing framework that is distributed and really good at doing these types of things for processing messages. It has topologies that describe a set of processes. Those are called bolts and you could have multiple topologies. You upload a topology by just uploading a jar file into the Storm cluster and then it runs those things. It internally can run not only Java but Python, JavaScript, C-sharp, whatever you want. And communication to it is done via message queue. We use Kafka or RabbitMQ for some certain things. Storm topologies are really good because we had a problem to solve which is one part of our company might want to have larger weights on videos and another part of our company might wanna have larger weights on articles. And in order to do that type of calculation and computation, we can create many different Storm topologies that basically define different processes to eventually get us the data that we want for each one of these streams. All of that is dumped eventually into Redis. And I think I said this but I'll say it again. This is not a dependency but a recommendation. You could do everything on the fly for the horizon ecosystem. So horizon itself is built on node and sales which is an MVC framework and I'm gonna dive a little bit into the API for it. So it supports multiple content models with the use of the simple namespacing which is the app label model name and allows access to activities from different viewpoints. You could look at things from the actor viewpoint from an object viewpoint that'll make a little bit more sense in a second. And then target and so on. Here's an example call for you. So we're at version one of the API and if you go to object, YouTube, video one and then favorited, essentially you're gonna look at every activity that is of the type favorited that has been done on YouTube video one. And we're looking at that from the direction of the object. So I'm asking what has been done to me, the object? And on the right you can see that we follow the spec and you see the little data parameter there. That's actually an after effect of Neo4j which we're working to overcome but so we try and solve follow the spec to some degree. Here's some more examples. If I did actor, auth, user one, favorited, YouTube video and then if you go to that YouTube video you'll find something funny. That would return a specific activity as described by the spec. And if you went to the object, YouTube video with that ID favorited, auth, user I would see all the activities done to an object by a specific type of user. And that's useful for accounts for instance. Thing to remember here is that direction actually matters when dealing with graph databases. So if I look at things from the point of view of an actor it's not the same as looking at it from the point of view of an object. I'm asking different questions and actually within the graph databases, sorry, within the graph database edges have direction. So if I'm asking I'm an object, what have I done?  But if I'm an actor and I'm looking at from that direction then I'll be able to get some results. Posting, really easy, API v1 activity. Basically the payload looks more or less like the data that we store. And then we do manipulations on top of that for the pre-computed stuff. And you could even do complex stuff. So we created a controller that's called proxy controller. There's also reverse proxy controller. This facilitates stuff like follow. So in this graph example you have a proxy that could be you. And let's say the proxy verb that I do is followed. And whoever I followed that could be actors or objects or whatever. What I'm gonna get back is a list of all the activities that those actors have done on objects. The return call would look pretty much the same. The return result would look pretty much the same as what I showed you earlier. So then in this case I'd have multiple actors doing the activity. So what are the problems that we run into something like this? First of all we have no control over external data. If a photo changed its title, I don't know about it. So you really need to live in an ecosystem that allows you to get that data back and to inform you of such changes. Second problem that we have is that graph databases don't really have a great ecosystem yet. So adapters are not that great. There's no real graph or, and I know because I wrote some of those adapters. And then front end versus back end computation, I heard that I missed the great talk this morning about where to do the computation. And that's a real consideration. Do you do the entire stream processing on the back end? Do you send it up to the front end to do some of the computation? And that leads me actually to the next part which is gonna be Farhan. Farhan worked on every part of this ecosystem but he's gonna talk about the front end modules and how they relate to this ecosystem. Thanks, Bob. So what are the client side modules? So you see there's the stream and snippet. That's just the names we call them and they're just standard front end technologies, HTML, JavaScript, CSS. And they allow you to communicate with the horizon service by sending actions and by consuming actions. So let's dive in. So the first thing we're gonna talk about is the snippet. It's like a like button. It's a very configurable like button. The snippet is responsible for representing a specific verb that an actor can take on a specific object. And it's also responsible for displaying some state about the activity of a specific object like counts. So here's some representations of those. And it's also an open source process. Please check it out. And this entire thing is built with just vanilla JS. So say I have a web application and say I have an awesome picture of me in LymphartBird. And I want other users to tell me, hey, if I like this, let me know if you like this picture. So on my blog or my web application, I can just add this div and the snippet would be more or less up here. And you can see the div is pretty standard. We're using standard HTML data attributes. There's an object type. And there's again the app label underscore model name, the AID, which is the application ID. So whichever application has the storing this photo. And then the object endpoint. We'll come back to that later. That's really important. And then the data verb. And as you can see, a snippet is kind of a map to an object. And the snippet and the stream have this concept of context. The snippet, since it represents an action you can take on an object, you need to ask the question, well, who's taking the action? And a lot of times it's gonna be a user. An actor of some kind. So most likely it'll be a user, but it could be really anything. And we mentioned it was highly configurable. So the data verb attribute actually maps to a template. And so you can kind of really easily customize how a verb looks differently and even the business logic that encapsulates it. And it's really easy to create your own verbs at the very bottom. Say your application needed a new verb, Pipered, whatever that means for your application. You can very easily add an attribute, make sure you have a template that's associated with it, and then you will get a custom verb. So let's look at kind of how this all works and how they kind of look like the request response cycle. So let's say I have the snippet, it has counts of eight and the user clicks the snippet. This sends a post request to the same endpoint. And this is basically the payload. Again, it's pretty, we try to be really consistent. So it's AID, API, type, app name, model name. The horizon service returns an okay. The snippet is updated with the new state. The heart is filled in and the count is all there. So I just showed you one example of one snippet on a page and it's like, hey, can there be multiple snippets on the page? Can multiple snippets be pointing the same object? Yes, they can. We kind of solve a lot of these issues because of the variety of national geographic. You know, we didn't design all the front end web pages. So we needed to have a way where these can all talk really easily to each other and communicate. So yes, one object can be represented by multiple snippets and multiple snippets can represent multiple objects on the same page and they all work fine. So that's pretty much the snippet. We're gonna talk about the stream now. So if the snippet was actions you can take, the stream is consuming. It's the news feed. It's a highly configurable news feed. It displays activities based on an actor. Unlike the snippet, which is Bill and Vanilla, this is built with just backbone. And again, it's an open-source rebuild. So let's show you what the stream looks like. Right now you're viewing the stream of Lucas Serven, who's one of the developers at National Geographic. And you can see kind of the structure of the stream. Lucas Serven, the actor, favorited the verb, the article digging Utah's dinosaurs. And on NGM is like the target in that case, on some application. He liked a lot of things on July 2nd. I'm not sure why, but I think he was in a good mood. So let's go back to the example of this make up, this is my web application. So let's say some user has favorited a photo and now the stream is showing you what they've done. And this stream is configured to show all of this particular user's activities. He favorited a photo and the most popular activity, which is Django ate some child. Let's get into the response quest cycle here because it's really, it's a bit more complicated than just posting or deleting, sending a delete request. So the module actually uses a web socket connection with the horizon service. The module, because of this we have like a bi-directional communication. So the module can ask, hey, give me all my activities or give me all the activities of people I follow. And we're gonna get back as a payload from the horizon service. Now this is where the API endpoints really come into play. Again, we don't store any, we're not storing images, we're not storing model data. We're actually just storing some API endpoint that we will call out. So the horizon service, I mean the module will call out to all these external applications that your models are on and ask for them, hey, describe this image. So it's really important now to see like why you need these API endpoints. And this is why these snippets in this module can kind of live in multiple web applications. They don't really need to know anything else. They just communicate through this mechanism. And when we get this response back, we cache all this in local storage. So you don't have to be constantly making these. And if you reload the page, the module's on, you're not gonna have to constantly make all these calls out to these external services. We cache all that locally. So this actually brings up a ton of problems and interesting considerations that we wanna stress if you wanna start using any of these softwares. One of them is that the API obviously is really chatty. The module's really chatty. You're supporting an ecosystem where there's multiple web applications. So be aware of that. You're gonna be making lots of calls out. You might be making some cores calls out. So just be aware, architecting that out. And because we're relying on all these external applications, how do you deal with failure? What do you do when the other application fails? What do you display on the stream? Do you display some cache results? These are all really important considerations to think about. I'm just gonna go over a few more. So Ben had mentioned this. This service is not really aware of changes on content. If some photo gets updated here, some video's title gets changed. How do you reflect that back to the service?  How do you change what's being displayed? How do you invalidate the cache? And a really simple example, even like sorting and kind of ranking. Let's say I wanna display the most recent popular activities on a stream and someone generates a new activity. Where does that come out? How do you immediately put that at the top? But wait, you're using an algorithm that's like, hey, I wanna only show the most popular one. So how do you kind of navigate this realm? And then again, a lot of this has to do with how do you invalidate the cache? Basically the point is there's a lot of business logic between the service and these front end modules. And so what you really need to do is determine what kind of updates, models, and things you care about so you can display them to the user. The good thing is that we've built the horizon service in a way where the back end, the service itself, and the client side modules are really configurable and so you have a lot of opportunity to kind of tweak what you need. Is this running live? Yes, it is running live. You can go check out ngmbata.com. NGM is the online version of the magazine where you can see all these issues going back to like 1888. So we encourage you to go on, become a member, and start clicking on and favoring activities. This is what the stream looks like. This isn't released yet, they're still kind of working on this, but eventually this will be displayed on the user profile page. So that's pretty much the agenda, oops. Yeah, that's pretty much the agenda. And one more thing to note that all the projects we've spoken about, all four of them, all four repos are open source. We definitely take contribution, contributes. There's a lot we need to do and we're also building out of her Django horizon app that allows Django to speak because we have so many Django applications in that jail. So that's it. And if you have any questions and I guess we'll supply the answers, but we'll try.