 I submit talks, things I'm passionate about, every now and then I'll throw a one or two talks in there about something that I kind of want to learn about. Music playing is one of my favorite bands out there. I've just started one of these Android development. So we'll talk to them and talk to them about getting an Android app built for them. Say I have my iPhone 1, and I just love to be very excuse-ed for doing something I have some fun with. So I submit this conference out in Ohio, and put a bunch of softwares of talks on there. And one of my app was Ruby and Android. Knowing that the library was out there, I used to do a couple of talks on the bottom of some things I submitted. About three weeks before the conference, I see them start playing, but just by the time the proposal for this conference comes out, as well as another one. So I send a couple of the abstracts on, and I get a pick for it here. I start playing in the library, and I absolutely can't stand it. I'll go over the wine a little bit, but the night before my talk there, I'm having a heck of a time trying to figure out how I'm gonna hold this out. I could do the, I looked back at some of the talks I'd seen, and realized they were very, very handy. And I had a lot to that, and then part of my brain kind of went, well, maybe I'll just do that. Decided not to, the night before, in a fit of desperation, I Google one more time, Ruby and Android, and found something that really just saved my day. And since sparked some real passion in me again, okay, yes, that isn't that hard to do with me, but I'm having a lot of fun with it, and do not have slides, not because I'm not a parent, but because I have literally up to the last 10 minutes been hacking on this library some more, added some more features that I wanted to finish up. So this talk is actually moving target, which is kind of fun, and I thought I'd go through it. Before I do, oh, yeah. So the reason we've done the story, the funniest part of the story was, it's like two in the morning, I've not yet found this new library, and been excited. I'm just beating my head against the table, and then comes an email from Mike Moore that says, by the way, you've been selected here to talk about JRPI Anthro. I just wanted to jump up and end up at the hotel. I mean, I was just dumb. It was quite interesting, but it's gotten much better, and really excited about it. So, yes, what do you think? Who's done the Anthroid development? Okay, not me. So, for those of you that have not done it, I want to kind of go through the metaphor, just a little bit, explain a little bit about the environment, because all of this plays into where things are, what I like to look at, and what I want you guys to keep in mind over the next six months. So, Anthroid itself, operating system for phones, and tablets written by Google, they have, it uses Java, but they wrote their own JDK, for one, because the existing one was just, like I don't think Gargantuan really describes how large this thing is nowadays. They wanted to start out a lot of it. The other thing is they wanted to deal a lot more, get a lot closer to the metal and sparks processes, and taking advantage of Unix infrastructure and architecture that's there. So, they worked with tablets called Dalvik. But, as far as your development experience goes, I find Anthroid to actually be incredibly enjoyable to program. As a device, I look at it as, I actually can't claim to have come up with a statement in front of my dad that says Ruby is already, excuse me, Anthroid is going to be the windows of the phone market. It's going to be a little less responsive, it's going to be a little uglier, it's going to be a little shitty in UX, but realistically, it's going to have a majority of the market share. And as we're looking at it, it's growing, it's getting there. And actually, what's interesting is, if we want to go with that analogy of windows, the development environment is actually incredibly enjoyable, which for those that have done windows development, wholesale, inside the entire stack, they actually make the experience quite nice and quite easy. And so, Anthroid's done very, very well about the development experience. I've spent a lot of time doing IOS development and yeah, I try to pull out a little hair I have left. So, when you get the Anthroid installed, it's pretty simple, you go down and download it, and then you have this nice synthetic light window. It goes through and shows you the available packages that you have, you go through and download them, you can get the, you can look at the Anthroid repositories themselves, it always does this, but I'm still connected. So, it goes through and finds platforms that you can go to. Anthroid is one of those places where you're developing, where you're going to have like a thousand devices to work against, so you want to get as many of these SDKs down as you can before you start deploying, and then you have this third party apps, and the only reason I wanted to show this is I find it incredibly ironic that if you look at third party add-ons, Google is actually listed. If Google's the one that developed it, I'm still trying to figure out how they were third party, but we'll see. All kinds of stuff in here, you have this new Samsung for a lot of the Zoom, tablet, libraries that are out there and so forth. So, you install your packages, you get your different SDKs that you want, whatever you're actually looking for, and there's some good samples in here. Then you work on your virtual devices. The virtual devices are just virtual machines that run. You can find packages out on the internet that give you the nice metal around. They're incredibly fast, as you can see. Do any Android development actually cause me to go get more random internet SSD? So, I see, in these places, enjoyable SSDs get a lot of patience. So, if you look at the different things you have, you have these AVs, these packages of virtual machines for the phones, basically. The thing that I still have to figure out, I'd love it if somebody could point this out to me, is how if I have a device in my hands, I can sit and make a new device, because they're pretty simple here. You have lots of properties to choose from. You have lots of targets you can do. I still have to figure out how I can get into a phone and look and see what I'm holding in my hand text-back-wise and recreate that here. You actually have to go out to Google, which is incredibly ironic, I'm holding it in my hand, but find somebody else that's got it. In most of the phones out there, somebody has done specifications for it. You can get it. So anyway, you have different ones that you can then fire up and run with. You get the emulator, this is nothing new. It has the, let's see if I can remember that. Okay, that's not bad. There it is. It has a rotation built in, so you can rotate it for yourself. You've got your on-screen keyboard here. As you can see, the highlights, at least I hope that it goes across the projector, we're gonna see if, like, if you were to click the power button or if you were to click the volume, you can, but you use your mouse as your finger. I think you get moving with it. Now, if you do any reading about Android, you're gonna notice that it is all based with Eclipse. Every single bit of documentation I've found without anything, and a lot of it's really good. There's a great book by the private side. It's all about Android, really gets you started in the scenario, but everything has Eclipse built in. Don't think you have to use it. I don't know why the authors all recommend to use it. They have some template generators and this kind of thing, but when it comes down to it, you don't need it. And Eclipse was slow in its best of days, so don't go and grab it. What you do get is this thing called ADB, the Android debug bridge. And so once you get that running simple command line help, you'll see they've done a great job of giving you command line tools to do what you need to do with your phone. So between ADB, the Android virtual simulator, and a text editor, you're out of time. And this is not trying to be fancy, trying to get in the command line. This is really, it's just as easy as getting rails installed. Everything else just works. Play around with some of the command you have here. One of the fun ones to do once you get it is, once you have one running is go up and get your shell into your phone because it is just a Unix device. You see the process is running. You can go to LS, you can see it to wherever and put your bash pro cross on to the ground. And you can see whatever it is you want to see. Play around with it. Kind of nice and fun. Not really that useful much you're getting out of there. But you'll see that it does have things talking about the servers that you can start to reboot. You can get in install and uninstall. The Java debug wire protocol is set up here and it's supported for anybody in the Java space. It's really nice visuals as to what's going on inside. And then you have the ability to, I guess the log cat, I believe, to get your log. Yeah, so you view the device log, just tail it and let it run. It's pretty nice. So that's the emulators that you need. So now Dalvik. Dalvik is the name of the virtual machine that you've run. They've written it in order to run on the phone. The lawsuit's based about all line yards. But what they've done is rewritten the JDK. Strict out a lot of it. Take advantage of a lot of the processes and the things that are going on. Makes it very, very nice. But they did rewrite it. This is something that's been around for a long time. JDK is not some part of it. They missed a couple of areas. Some areas that they don't really need that much. One of them is reflection. And that becomes very important when we start looking at Juru. So as far as development goes, you have really good, well-defined metaphors to program it. So first of all, I do not classify this part as being pretty good, but they have declarative layouts in XML. Why anybody uses XML for anything with data transport? I still have this figured out. But we'll go with it for now. So you get these XML files. They use, actually that screen is really big. So I'm gonna see if you guys are okay with the other process down just a little bit more on the screen. There we go. So you have these views that you then nest ins inside of. And every designer's nightmare in CSS, yes, you can do in Android XML. Table layouts, you have text views inside of those, all of which have items that are identified by properties on the XML. So you're not really doing anything in the XML except nesting other XML elements. Everything's one of them properties. Lots of nice sharp pointy brackets. Hurry yourself with, this is how they want you to go. All right. Now, they have what are called activities. So behind each one of these views, you have an activity. The activity is basically to put it behind it. Your controller, so to speak, right? It takes in what you want. You can handle your events in there if you want. Or you put those in separate classes. But for now, just any of the code behind the layout itself. You have this idea of services. It's any code that runs in the background. They talk about music a lot. Let's think of Pandora. You would fire up your Pandora app. You'd have your XML file for your visual display of what's going on. You'd have your activity that would show the album, go connect to the server. And then what it would do is it would spin up and create a service that then goes and starts playing the music. What this allows you to do is go out, navigate to other applications, and continue on. This is the idea, this is where the whole multitasking thing comes in. You have this idea of broadcast receivers. If you've worked with Massachusetts a lot, think of these as topics. You receive messages from the system. So you put out here and say, look, I want to get SMS messages just like you would register a topic if you're out there. It's going to notify whoever's in this list in a listener fashion and let you know. This is the way you can create apps that handle email. You can create apps that handle SMS without looking at your system or anything like that. And then the user can choose what they want to do with it. You then have content providers, which serve up your data. They are the bit of all. If you want to sort of database, SQLite, something like that, you want to sort of file, you want to grab stuff from out on over a rest service, something like that. This is where they would come in. So this is really next metaphor to glue together for an entire application. So any questions so far? We're more than in the short version. Okay. With all of these, if you go to developer.gantory.com, there's a fantastic set of documentation that walks through all of these items for you. And I really recommend that you take the chance, if you want to do some Android development, take the chance and do a Java, and do an application in Java first. Very simple, bare bones one. There are a bunch of them out there. As a language, Java is not terrible. It's not great. There's a lot of power that's missing. But the things that we usually don't like about Java are the XML, the JPE, or layers we put on top of ourselves, and whatnot. But I highly recommend going in here for two reasons. One is, again, it's not as scary as you think. Number two is, you'll get used to reading the documentation because all the documentation you'll find is going to be in Java in that form. But following along with their documentation, you really can't go wrong. So, it is running Java. It has its own JVM. So, we have JRuby, right? JRuby runs on top of the JVM. Clean implementation of Ruby. We have the free end program, anything you want from Ruby. Let me want to do it and put it out there. Well, it turns out it's not quite that easy. So, when they rewrote the JDK to Dalek, they had a bunch of issues with, they found a bunch of issues in reflection APMs. Now, traditional Java programming, traditional libraries, things like that don't take advantage of reflection a lot. It's usually looked down upon. We don't consider metaprogramming something separate. It's just kind of part of having flow to what we do. An item, a library like our language implementation on JRuby pushes Java reflection to the edge of the cliff and in the Dalek's case, it pushed it right over the cliff. So, they found a lot of things were going on. Google Summer of Code decided to thumb their nose at the Ruby community and if anybody kept track, it was really cool. The Ruby community decided to do our own. And so, we raised, anybody know how much was raised? This was $100,000. $100,000? Yes, the $100,000 was raised to do the Ruby Summer of Code where students can sign up, they have ideas for open source software and they can sponsor it with this money to go and work on this. Somebody came along and said, I want to do JRuby on Android. And one of the mentors that signed up to do this was Charlie Nutter. He thought it was a great idea because he could work on the JRuby pieces as somebody worked on the library. So, Roboto was born. So, he started working on this and it was, I believe it was the first time that in the history of Summer of Codes that there was a high school student actually who paid to do this. And he's the one that wrote Roboto. This is not why, I'm not a fan of a library by the way, it's just an interesting little fact. So, Roboto comes along and I'll let you do, I'll let you actually do the on, on the application. So, here, okay. So, one of the examples is Roboto by RB. So, what you would do is generate, use Roboto command lines to generate your file for you. It's going to give you all slew of folders. Absolutely slew of folders. You're gonna get a property spot to work with where you indicate where you're storing your SDKs. You are giving your build properties. You decide where your left package is gonna be. So, for those that aren't familiar with it in Java you have a packaging structure, usually done in your URL in reverse. So, URL, in our case edgecase.com, it's com.edgecase. You can use, and then you mimic that in folders. So, each dot in the IRD is going to be a folder in which your source is stored. And so, you come down here and there's a source that's generating. So, in Roboto's case you have this idea of assets folder where you come in and you have your scripts that you can write. Writing, writing the generate. With a couple of interesting little things. First of all, the activities that are classes. Well, actually, let's take a second, man, this. And yes, somebody I've ever been assigned a comment to about it. Here's, fully get some inquiries or using text in here. But every time I do a presentation about folder structures and things around the max you can get lost. So. All right, so, your job will look something like this. Pretty plain and simple for an activity. You're going to extend the activity. You're going to create a method on create with the same instance states. Take care of that. You always want to pass it up to super. And then, in this case, just set your content view. Nothing spectacular here. It's simply your typical kind of controller idea of taking care of what's been done before, making sure to preserve the state if there is any, and continue to ignore it. Just like any phone applications going to do applications like are on top of each other. So you really want to make sure to keep calling super and have some state popping down the chains as you go along. Very, very critical. Just make sure the flow works correctly in backbots and so forth. So this is what you would look like in Java. And then Roboto, you get your activities that would be somewhere down here. So you get these global variables for your activity. And then you do, instead of on something, you actually call handle and do what you're going to do. Here's one of the places where I was not a big fan of things, because we're, first of all, we've got global variables. I'm not a huge fan of those. It's really, really hard to get your arms around them to test because they are global. So getting out there, you can't redefine them and reset to something. But realistically, it's really hard to get your arms around it like a structure case or a test harness. So strike one in my case. Strike two was this idea of your handling things instead of calling them on. There's a metaphor that's already there. I'm not sure what the metaphor is that they're going with here, but it is growing down into their own thing. The other thing was there is a lot of, as you start exploring the API, you start playing with it, right? Start seeing, okay, does this work? Does this work? For those of you that do not have a potential surplus disorder, some of us like to take shortcuts and not read the entire set of documentation before we go off and do things. So you're trying to get different methods. Does this method exist? Does this method exist? It turns out there's a lot of instance eval calls underneath the colors of the bottle. If you're playing with a library, that is going to hang you very quickly because they're not using file line information in it. Therefore, your errors come back to just say something went wrong here, this eval block, and again, error pulling out, really difficult for me. So, now I do know people that are having a great time with this, please feel free to go ahead and try it. With that fit of frustration, went around and kept looking and ended up with, ended up settling upon something called Garrett. Garrett was a test application that Phil A. Long had written, Technomancy, for those of you that don't know, had just a play with to see what would happen with putting Mira on top of Android. Now, for those that aren't familiar, Mira is what used to be called Doobie. I'm still trying to decide if Charlie Leonard really was that naive or just that really smart. He was playing around one day with the idea of adding optional typing to Doobie. He's been working very, very hard on getting Doobie optimized and getting it much faster. It's been blowing Ruby out of the water in a lot of places, but there were still some places where it was really far above where Java could be. There's some items that the JVM as a whole does not support in method dispatch and figuring things out very quickly. So he thought, what would it look like to add optional typing in? Places where we can infer it, we can guess at it, but if we can't, you can put it in. And so we created this library called Doobie. It is now with the renamed to Mira. And Mira goes through, and he's had a couple talks where he shows the infamous Doobie matchy sequence it goes in and it comes down to a factor of like 10. It's the factor 10 slower without the typing, puts it in much faster. Really interesting how it works. Because of this optional typing, because of the way it's set up, they don't have to deal with a lot of the Java reflections there, a lot of the guessing, a lot of those things. So they came out with Mira. Always thought it was an interesting project never saw use for it until now. So it played with Garrett, excuse me, looked at Garrett in military promising. Since then, it has been extracted into a library called Pinda, P-I-M-T-A-H. Pinda is taking Mira and put it on the phone and giving it into a library. So the first one was just kind of let's play and see what happens. It works, pay that's full. Now everything was wrapped together, taken and packaged and giving you a way to create applications. And so since then, that is what I've been working on for my application, I've been working on here. So you get in these, in some cases, you can add, sorry, let's show a quick example of Mira itself in a little while. Okay, so simple class here, this is a great example. You create a hello, that's this down here, you pass it variable, which is how it is going to be a string that then is able to operate. It doesn't have to do a guesswork before it goes and fires things off. So, but again, very ruby-like in a lot of ways. So Pinda comes along and now you create applications with that. So, you generate your application and it ends up looking a lot smaller. You get your, actually the demo's hope is not come with it, that's something I've put in here. You get your source folders. Now, because it is a lot closer to Java, you have to do a lot more things like in the there, one of which is store your code according to the package structures that are there. So if you declare something in a package, you actually have to follow this folder through. Something most Java programmers forget about because our IDEs used to hide it from us. But it actually happens in the covers as well. And then things start looking very similar minus some semi-columns. But realistically, it is Ruby code and you're ready to do it. Very easy to take current examples that are out there in Java for Android and port them over very quickly. Makes it very easy. But then use Ruby to loop through things and whatnot. So at the moment, this is what we have working. Now, the other thing was with Roboto, every time you go to deploy, this thing takes anywhere from 10 minutes to three hours. It would take forever. It goes as high as the whole world. I'm completely convinced. It takes JnRuby, strips out a lot of the libraries and stuff that don't work. A lot of stuff that's not needed puts it aside, puts it back together. So a lot of things happen every time you're ready to go deploy something here. In the case of Pindup, it's a lot closer. You don't have a lot of that. It's a very, very fast deploy compared to speaking. Out to your phone. And then, see if you want it to break and it's going to go, build it and then push it out to the phone. I'm not sure if that works, but it was awesome. So it goes to the place that you go back to your phone, go and view it. Nothing special right now. Very simple application, buttons to go, bring up the next screen. I have not done anything for the next screen. So, this is working here. Now, I looked at this and thought, there's still some things I'm not a big fan of. Most of our methods are still very Java based, they're Java looking, right? And also, there just seems to be things. So, for instance, calling super with the state, make sure you always pass it up. Something you've always got to do. I don't want to get it out of my way. I don't want to look at it. I don't have to do it. So, here is what I spent the last, most of the state working on, was generating some possible methods that just did that for us shrunk it down a little bit. And I'm like, hey, it's Ruby, right? This should be pretty easy. Well, thank God Nick is here, who's given a bunch of talks on mirror because it was not easy at all. Mirror is a different language and you have to keep this in mind. The way to get this to work is actually using what are called macros. So, they don't have, you don't create these classical methods, you actually create macros that go through and actually start practicing onto the AST. They've extracted that bit of AST to do that. If anybody's worked with macros in LISC, these make a lot of sense, okay? Quoting works very similar to the way it does there. And it is then a behavior that's then watched on. So, in this case now, I don't have to implement my own action listener, like I did previously, which actually I left that for a while. So, the way to implement interfaces in JRuby and then that is to use classical method implements. So, all of this is then hidden back away when I go to the new form, right here, and whatnot. Step two is going to be, again, realizing that this is a separate language. I've been working on something called JoryViews that I'm calling JoryViews for a while because I don't like XML, because I took that one to do. Now, this is where I'm trying to go with it next. So, to get us into more of a DSL style, similar to hot cocoa, that's kind of where I was going with it, but I'm still playing and going. But I tell you, the method programming in a different language becomes very interesting. So, that's what's next. Layout's going into actual code, hopefully some validations with those, and then going into getting rid of, maybe, the manifest file and some other artifacts that I'd like to see gone, and then getting some really good example applications together. So, this is definitely still a work in progress, but it is actually being developed and working very nicely. And with that, that is all I have. So, for the resources, check out Mira.org. On GitHub, Mira, along with Penda, which is off of the Mira group. There's a Google group for it. There's also a room in FreeNode where people discuss and hang out. A lot of fun. If you want to get in and play with some things, feel free to join us. So, thank you very much, and I'll take some questions now. Yeah. So, Penda deal with, so the last time I was trying to do the Android stuff, I think it's pain with generating the R. Yes. That's stupid. I was generating the class. Penda, do that for you? Okay, yes, the question is, last time you did Android developments, the generating the R file was quite a pain, does Penda do that? Yes, Penda does do that. For those that are asking, what is R? Well, R is, where's my original? R is the way we grab resources. So, we have a resource folder in Android. You have different levels for images and things that you're looking at, and then you have a layout folder in here. But everything is still a resource. It's still an item that needs to come into your environment so you can work with. So, what they've done is this slightly interesting and slightly incredibly odd library that our class they've generated called R. Not sure where they've been quiet with the name. With public static classes and resources underneath. So, you have a class of R, you have a class for layouts, and then each of your layouts, and all it is is a tax code. It gives it an identifier for where to pick it up on your phone and where to bring it in. So, it does deal with this. This was actually, two weeks ago, this was actually an issue because it's really strange to reach in and grab through an inner class, grab an attribute off of it. And so, it was an edge case for Mira, but they did solve it, they brought it in, and so you can now do that, and reach through and grab those. But yes, it is generated, it is something you're not really supposed to touch, you're just supposed to use, so. Any other questions? Yeah? What are our looks at doing moving on to Android 4.2? So the problem with that is kind of was like, the runtime was really large. So like, for downloading that app, even if it's a small app, it would be larger than equivalent, just a great job. Right. Is that the same issue? Well, okay, so the question is, the runtimes were always really large when you were playing with any kind of Ruby, Android stuff before. Is that still an issue here? Well, yeah, it's gonna be because it's well, it's never gonna be comparable to the Java one, right? Because it's not, it's a layer on top. Whoops, sorry. So, 8k file here, stash h. Yeah, it's 228k for just a couple things. Not too bad. It's a lot lower overhead than it's gonna be for Bottle and that, because that was just our game to generate. So, there's that. I'm actually hoping not to get back to you. Yes. It becomes very obvious when you play with Mira, how much we like about Ruby is actually from the parser. That was really weird to me as I was sitting out there not listening to talks this morning, trying to get some of this meta part of your work. It's amazing how much stuff we lean on that Ruby just takes care of for us. Absolutely insane, but yeah, that's true. It's okay. I didn't see if we were... Yes. The startup time was stupid long. So, the question is, people that I have problems with experiencing in Android is the really long startup time for the emulators. They're insanely long. The only reason you didn't see it up here, I run it on an SSD, and I'm actually running those right off of it, even though it's smaller. There's no other way I can see you do this, because it's just really, it's insane. No, actually that's a good question. If you run a Roboto app the very first time you do it, the very first time you do it, there's a really long startup time, because a lot of stuff goes on. Really fascinating to kind of tailor you a lot when the mirror does not suffer from that, in that it's, and I'm looking at other applications, I can't tell a difference, I'm sure there is, but I'm slow enough to decide again. Anybody else? Okay, I'll be around, feel free to catch me. Thanks everybody.