Item number SCP-294 Object Class Euclid Special Containment Procedures There are no standard special containment procedures on file for Item SCP-294. However, only personnel of Security Clearance Level 2 or higher are allowed to interact with it. See Document SCP-294-A SCP-294 is currently being stored in the second floor personnel break room, and is monitored by two guards of Security Clearance Level 3 at all times. Description Item SCP-294 appears to be a standard coffee vending machine, the only noticeable difference being an entry touchpad with buttons corresponding to an English QWERTY keyboard. Upon depositing $0.50 US currency into the coin slot, the user is prompted to enter the name of any liquid using the touchpad. Upon doing so, a standard 12-ounce paper-drinking cup is placed, and the liquid indicated it's poured. 97 initial test runs were performed, including requests for water, coffee, beer, and soda. Non-consumable liquids such as sulfuric acid, wiper fluid, and motor oil, as well as substances that do not usually exist in liquid state, such as nitrogen, iron, and glass, and each one returned to success. Test runs with solid materials such as diamond have failed, however, as it appears that SCP-294 can only deliver substances that can exist in liquid state. It is of note that after approximately 50 uses, the machine would not respond to further requests. After a period of approximately 90 minutes, the machine seemed to have restocked itself. It is also interesting to note that many caustic liquids that would have eaten through a normal paper cup seem to have no effect on the cup's dispense by the machine. Testing is ongoing. As suggested, SCP-294 would move to the second floor personnel break room as a money-saving venture. Regarding Incident 294-01, guards were stationed at the item, and a security clearance became necessary to interact with it. Document SCP-294-A, regarding Incident 294-01 On August 21, 2005, Agent Joseph ████ attempted to use Item SCP-294 to obtain coffee during his allotted break time at 9.30 am. After request of Agent ████ to see what it would do on ████, requested a cup of joe from the item. Moments after confirming the selection, Agent Joseph ████ began to sweat profusely and complained of dizziness before collapsing. After moving the unconscious agent to the infirmary, the medical team recovered the contents of the cup dispensed by Item SCP-294, a combination of blood, tissue, and other bodily fluids. Testing revealed the DNA sequence of the biological matter dispensed by SCP-294 matched out of Agent ████. Agent ████ made a complete recovery after four weeks of rest and intravenous hydration. X-rays and CAT scans showed no further signs of injury and was released. Both ages were reprimanded. Additional security measures for SCP-294 have been recommended. Addendum SCP-294-F After reviewing documentation on SCP-294 ████ suggested testing SCP-294's ability to retrieve specific liquids from a distance. Addendum SCP-294-H With the overseeing of O5 ████, a cup of SCP-075 secretion was used as input. The product was proven to be the requested liquid, and the cup was able to successfully contain the material. However, the report for incident 075-07 was acknowledged two hours after the test. See Addendum SCP-075-M. A containment procedure breach had occurred exactly the same time this test was taking place, waking SCP-075 to its active stage. It was able to secrete an amount of basic solution equal to the capacity of a coffee cup before emergency containment procedure was applied and it was rendered passive. The liquid was not found in the post-incident investigation. Addendum SCP-294-I Researcher punched in requests for a cup of gold. The machine dispensed a cup of molten gold. Researcher requested similar pressure materials with the same result. Addendum SCP-294-J Researcher punched in, from a safe range, requests for a cup of anti-water. The machine hung briefly, then displayed out of range on entry pad. It is theorized that SCP-294 is a limited range of collection and cannot reach in the alternate universes or dimensions. Addendum SCP-294-K Researcher punched in, requests for diamond. SCP-294 briefly hummed, then displayed out of range on entry pad. SCP-294 gives this result for all solid substances. As diamond is a solid crystal and form of carbon, it appears the machine will not dispense liquid carbon, as this does not result in a diamond. When cup of carbon was subsequently punched in, the machine dispensed a cup of liquid carbon. SCP-294 was immune to the damaging effects of the dispensed liquid. Addendum SCP-294-M Testing for range of SCP-294's capacity for retrieval has been initiated. A unique compound has been formulated, composed of undisclosed ratios of ████████ brand bleach, ████████ brand cola, met-Rx powder, and garam masala. The fluid was created and placed in a sealed container 25 meters away from SCP-294. When requested, the fluid was dispensed, an equal amount of the mixture was no longer present in its original container. Addendum SCP-294-0-01 Researcher ████████ under observation of level 4 personnel keyed in a request of the best drink I've ever had. SCP-294 dispensed a fluid similar in appearance to cola. The researcher identified it as a mixed drink he recalls having at a bar during his bachelor party, and was convinced it was the best drink. To not know what ingredients were in the drink besides rum and cola, further tests are scheduled to ascertain how SCP-294 gathered information. Addendum SCP-294-0-01A Under the same conditions, Agent ████████ the best drink I've ever had. SCP-294 delivered a dark fluid, topped with white foam, which would later identify to be in a lager. The cup was printed with a colored picture of 5 men and 2 women drinking beer on the beach. Was one of them. In his briefing, Agent ██████ confirmed that his favorite drink ever was a Vienna lager he consumes at the beach with his friends. It has now been confirmed that SCP-294 has the ability to directly gather information for someone's mind in order to comply with the given conditions. Addendum SCP-294-0-01 Subject keyed, the perfect drink. The machine dispensed a cup containing an odorless lavender liquid. After drinking the liquid, subject appeared to go into shock. Subject later committed suicide, leaving a note which read, quote, I'm sorry, but at this point everything's just one big letdown, unquote. Having such a drink again is highly discouraged. None of the components of the drink have yet been identified. Addendum SCP-294-0-01 Subject keyed in, quote, Something Cassie will like, unquote. The device was heard to hum for about 3 seconds, before dispensing an empty cup. Printed on the side of the cup was an image of a traditional soda fountain glass, filled with something brown and topped with whipped cream. Upon introduction to SCP-085, it was identified by her as a chocolate banana milkshake and judged delicious. Addendum SCP-294-W Researcher keyed in, request, quote, A cup of music, unquote. SCP-294 produced a clear sparkling fluid that tasted vaguely alcoholic. Following ingestion, subject reported feeling and not hearing a continuous rhythm and demonstrated the ability to move and even dance with a certain fluidity that he had not previously shown. Testing on other abstract concepts is continuing. Addendum SCP-294-AB During a mass security breach, Agent ██████ requested, quote, A cup of pertinent medical knowledge, unquote, while taking shelter inside the second floor break room. Of the four agents in the room, Agent ██████ was the only one who was not injured. SCP-294 poured a cup of clear green liquid. Following the ingestion of this substance, Agent ██████ began mending the other agent's wounds in a manner consistent with Foundation medical training. Agent ██████ no longer has the medical training that the liquid provided and other attempts to recreate the effect have failed. The agent has speculated that this event was an emergency measure taken by the object to ensure self-preservation. Addendum SCP-294-AC Dr. ██████ requested, quote, My Life Story, unquote, from SCP-294. SCP-294 made humming noises and shook violently for approximately three minutes before providing a highly viscous opaque black liquid. Upon consumption, Dr. ████████ reported that he remembered everything that had ever happened to him. Following his test, Dr. ████████ entered his office and returned 48 hours later with a 538-page autobiography. Addendum SCP-294-AD Researcher produced requests consisting solely of the phrase, quote, Surprise Me, unquote. The vice produced an opaque cup containing normal water, later determined to have been heated to approximately 200 degrees Celsius. Upon receiving vibration from transport, the contents of the cup turned into steam, violently spraying boiling water in a 2-meter radius. Addendum SCP-294-AF Researcher produced requests for, quote, Blood of Christ, unquote. SCP-294 vibrated and produced a message hick-assed in him colleague Sanguidus Mayi, and produced a paper-drinking cup containing approximately 0.12 liters of red grape wine. Addendum SCP-294-AG Researcher produced requests for, Cup of Smolodon Blood Cup of Passenger Pigeon Blood and Cup of Thomas Jefferson's Blood and received three out-of-range errors. Addendum SCP-294-AH A D-class personnel with IQ of 99 and low-curiosity scores was given written instructions about what to request. The D-class personnel produced a request for Blood of Kenneth Lupus and received a cup of liquid subsequently identified as wolf blood. The D-class personnel next produced a request for Saliva Equisperus Cabalus and received a cup of liquid subsequently identified as horse saliva. The D-class personnel next produced a request for Urine of Bascalarco Cenarius and received a cup of liquid subsequently identified as koala urine. The D-class personnel next produced a request for Cerebral Spinal Bluid of Fobrovis Patersoni and received a cup of liquid currently undergoing analysis. It is to be noted that Fobrovis Patersoni went extinct during the late Miocene epic approximately 8 million years ago. Addendum SCP-294-AI Dr. King produced a request for a cup of room-temperature superconductor and received a cup of apple juice with seeds floating in it. Addendum SCP-294-AJ Dr. Menchu produced a request for a cup of D-151839's leukemia and received a cup of blood. The fluid was microscopically examined and found to contain leukaemic blast cells which were a genetic match to D-151839. A second request for a cup of D-151839's leukemia resulted in an out-of-range error. D-151839 was subsequently found to be free of leukemia, however, within 15 days the leukemia had recurred. Other SCP-294 experiments are currently awaiting approval.


So Amaro here from Portugal, he works for Akia and he is also the chairman of the Portuguese user group and he is going to talk to us about multi-region failover scenarios in the cloud and he will explain to us how the cloud can be made a safe place. So we are here to see how we can turn the cloud in a safe place. How many of you have already servers in the cloud? Please raise your hands. Wow. Okay, so this session is for you, definitely. You are in the right place. I'll go here. So my name is Ricardo Amaro. I'm from Portugal and I'm a cloud systems engineer. I work for Akia in the operations team. What we do is that we provision servers, we manage these servers, we arrange solutions for performance and we deal with bare-bone critical issues. So if everything is failing, the last resort is ops. So that's what we do. Everything in the cloud. The agenda for today is why the cloud? We're going to talk about the cloud hosting, see the AWS Amazon regions, see how to make a failover, compare the solution between DNS failover and CDN failover. We're going to see file replication. We are going to configure file replication, also database replication. And I will show you a complete setup out, well, that you can do actually for yourself. This will be a basic demo. And this demo will be like a multi-region shot recipe that you will be using two cloud servers on US, two cloud servers on EU. I hope you understand US, United States, European Union, okay, so you're ready on this subject. We will use Ubuntu Linux for this. We will use the Glaster Unison solution. We will install the Lampstack and Drupal and Tangsten for MySQL replication. So why the cloud? I'm sure a lot of you have your own reasons, but since this is a Drupal con, I'm sure also that the major issue is to solve the scalability of Drupal. And like 3 says here, this was written like in 2008 when it started Acquia. And one of the mission criticals of Acquia is to make Drupal the most known and used content management system. We actually don't develop sites on Drupal. We just host them. So we work with a lot of partners. So in a cloud infrastructure, or a moving infrastructure, which one of these do you think Drupal will be for, let's say, a media site, a newspaper site? Which one? It will be only a cloud infrastructure fixed or like a moving infrastructure that you will have the site living and always changing and evolving. Probably that's why you choose Drupal to construct your site. But while it's moving ahead, you must have the notion that a spike can ruin the day and probably a bad setup of your cloud servers can ruin the whole month. Imagine a media site, a newspaper, that will lose visitors' income during one month because of a bad setup, a company that didn't do a good hosting, et cetera. So why taking chances? We have really to take care about our cloud solutions. We know it's cheap to put in the cloud, but we have to make it safe. So the cloud offers us a series of services. The first services that it offers us, and it's the one that we're talking here about, it's the infrastructure as a services. Of course you have the platform as a service or the software as a service. There are other companies, they do dedicated Drupal hosting with software as a service. We also have like Drupal Gardens is software as a service. About the cloud regions, I'm sure you all know this. There are several data centers around the world and the ones that we are focusing today are the ones in US and EU. We of course now, Acrea is starting here on Asia Pacific and we'll start soon using Sao Paulo. So from small to big. What we have in terms of Drupal on Acrea is an offer that starts with one server. Who knows, who has used already this product? It's DevCloud. Yeah, OK. So DevCloud is just one server, no failover. If the machine goes down, we have to put it up again. So we have to reboot or relaunch the instance, it's how it is. But it's because it's a development, it's DevCloud, it's for developers. Because if we're talking about scalability and we're talking about insurance that the site will always respond, we have to start to use the managed cloud. And in the managed cloud, the simplest setup is this one. Where you have two balancers on the front, then you have two webs, and then you have two file systems with database replicating to each other. So you can see if one balancer fails, it will switch to the other. If one web fails, it will switch to the other. And the same for the FSDB, the file system database. And the theme of today is this one, is when you have two different regions, and this is very difficult to set up. Because normally you have to deal with some issues regarding the passing of the data between regions and the asynchronous nature of this. So if a server is not responding, now it could respond later. Cloud providers, for us, we are using now Amazon EC2. But we could be using a lot of them. So you have a source here. These slides, by the way, they will be available later. You can check here a very good comparison sheet, where you have prices and features of the several providers. But there are other providers on the cloud. And these are the dedicated cloud hosting. One of them is Apia. And what we do now has these numbers. So this is only on managed cloud, not on dev cloud. Dev cloud is increasingly going up and going down in terms of people that are using and then switch to managed cloud when they really want to put the site up and running. So we have above 600 customers, a total of 2,300 servers. That's basically managed by me on the GMT of Europe, because, well, we're a small operations team. But since we have everything automatized, it's fairly good. 7.7 billion requests per month, 1.4 billion page use per month, and about 133 terabytes of information delivered. And these are basically the major clients that we have. It's large media, global political, and large news. This, of course, the responsibility of this infrastructure is divided between us and Amazon. So this is basically the diagram of all this infrastructure. We have Apia cloud, then the application, of course, is Drupal. Then we have the LAMP stack, Amazon EC2, which has the virtual structure, network, physical media, and physical security. That's their responsibility. And so we have the security, availability, and compliance in all this diagram. Another company that now spawned lately was Pantheon. They are very promising. They raised a lot of money now on financing from the Foundry Group, and, well, we hope really they have success. It's good for Drupal. We have also Omega 8. They use Eager or Iajir. Some of you will say one thing or the other. Doesn't matter, but it's this who knows Eager from here. OK. It's a very good hosting platform. So you can follow the discussion here. Cloud outages. It's been a hard journey because a very large number of companies don't have a disaster recovery plan. We have, but still, on 21st of April, 2001, it was a major crash in AWS and, of course, Rackspace. Sorry? Yeah, I'm going to just refer that. So this was really a way that Rackspace took some ground from AWS. Then in December 2011, a lot of people don't know this, but Amazon just told us, well, we have a lot of servers. They are on degraded hardware. They are going to be shut down. You have to relaunch everything. So we were relaunching machines like two weeks or something. And like you said, in June 2012, we had a massive, massive outage damaging hundreds of data volumes and instances. And this was in US Virginia, that the center, because, well, they tell it was a storm. You probably have heard about this case. So you have to plan for failure. That's what we are talking about today. And we give our customers a production scenario and a staging scenario. The production scenario is this one. What we do here is to have a CDN. We advise customers to have a CDN on front. Why is that? Because it's easier to fail off. Then the CDN is connecting to those balancers that you saw in the first diagram. And these balancers, depends on what's active now, they are connected to a series of webs. Depends on the client. We have a client that has 24 webs. That's massive. And we have clients that have two webs. And also the webs can have different sizes, memory, CPU, well, like when you spawn an instance on AWS. And on these webs, it's Drupal. Drupal is there in the file system as a doc root. And it's being shared by these machines over Gluster. And then it's r-synced with a constant process to the other region. So we're talking about here, you can make a line here and divide and see, for instance, no, this is really EU. And this is the US. On this part, you have a lot of servers. They are just standing by, just waiting. Can be on the end? Yeah, unless it's a small question. Yeah, wait for it, wait for it. Yeah, I will talk about that. So what we have here, it's basically a process running at this moment for some clients. And it's called the multi-region setup. MySQL, it's being replicated with Tungsten. And we also see how that is used. The staging scenario, there was a request from this special client, he asked us, instead of having machines on the same region, if they could test machines, of course, in a smaller quantity, but to have the development and the staging between two regions. This was the smallest setup that we could get to. I think that's clear enough. So the failover. How to do the failover? The failover between regions can be done by two ways, at least, and the preferable way is this one. It's called the CDN switch. And since we give the customer two balancers, one in region A, the second in region B, we give the customer an IP. And we tell them, if it fails on region A, just switch the CDN IP where it's requesting, where it's making all the requests to the other IP. And this has been working quite fine. The other would be to have no CDN and low TTL on a DNS that's connected to an IP directly. But in that case, you would have to wait that DNS cache expires. So it's kind of problematic. I would not advise that. So what? Everything is freaking? Yeah, yeah, it's true. Or a C name problem, actually, on AWS. So this is like a hint for you. Always use elastic IPs. They assure that when the machines restart, you will have always the same DNS name internally or externally. And the IP, it's the same. It's the same inside, which is different from the outside IP, but both are the same. Replication software. I'm sure that most of you that you know Gluster file system, I'm going to install it here in a video so you can see for the ones that don't know it yet. But please use the last version. Yeah, that is laughing because that's the reason we use our sync, of course. But still, I would advise make always an asynchronous replication between regions. So to configure Gluster, it's pretty easy. They went from version one to two. And now in version three, it's really lame to copy. It's like only this commands to configure Gluster. And on the end, of course, you have to put on the AFS tab amount for your Linux server. So let's see the video. We have our servers, they are running on European Union. And we were given this DNS name to which we are going to connect in order to create Gluster on them. So the first thing to do is to go inside of these machines. The EU machines, they are more also for the second one. I don't know why. We are doing here the third and the fourth server in our multi-region cluster. OK, so you're good. And we can now start to create our bricks. In this case, we are going to create two directories where Gluster will keep its files. It's not ever, ever write or read directly from them. But it will be the place where Gluster keeps it. Now we are going to install Gluster itself. So it's simple, apt-get install command. And this one, and this one. Notice I created another directory that was GFS, MNT GFS. And that directory is where we are going to actually mount the Gluster network file system. OK, we're all set. So now what we are going to do, Gluster is running, what we are going to do is to probe from one server to the other server. So this server will probe the fourth server. As for that, we are going to use the TNS name. OK, worked. And this server here will probe the server three. That's done. OK. So and of course, we can check the status. It's connected. Great. What we are going to do next is to create the actual volume that will use these two bricks. And for that, we will use the command volume create. And in this case, volume one. And we will say that it's a replica of two bricks. And we will say that the first brick is on this DNS name. And the second brick is on this DNS name. So it's great. OK, we created the volume. It seems OK. And we can just get the volume information of it. Volume info. It's running fine. And we can start now the volume. OK, it started. So the next step will be actually to mount this volume on our mounting point. And for that, we will use a file that was automatic generated by Gluster itself and also with the options of the network file system. Good. So if we write sudo mount, we can see that it's mounted. Then we can check. Actually, if it is there, great. And we can touch a file inside just to check. OK? Good. Of course, we can alias the file that's there. You can actually, if you want, you can see that the file is also on your brick. But you should not go and touch it. And now we go for this server here, where we are going to do exactly the same mount. And we are going to see whatever is inside of the mount. Yeah, our file is there. So it means that our Gluster is connected. I can put this command here either on RC local or on FS tab, so when the server starts, you will have the Gluster mounted already. OK. I hope you all understood this demo. I made this video because normally we have Wi-Fi problems in Drupal Coins. And I don't want to make the same mistake I've been seeing. So in terms of Gluster, you have to know that on EBS volumes, that's what instance use on AWS, they have not so good performance. So the best thing to do is always to go around it and create some tweaking on EBS volumes. So always choose the instance that will have 1 gigabyte connection. And since you have 20 megabyte per second for IEO, you should probably make eight devices together as a write zero or a stripe. So you could use the velocity multiplied by 8. Oops. OK. In the previous drawing, you saw our sync replication. I think to have a replication that's still a synchronous and it's not constant because you have the server trying to probe the other server constantly. And this takes a lot of CPU from the machine itself. I think to have replication both sides, it's the best way to do it. This could be discussable. Of course, other people can come here in the end. Let's discuss. I think it's always good to have other ideas. But if we set up a cron with Unison that's replicated both sides, I think it's a good solution. You could have another other solutions and I'm willing to hear them. So I had this video. How to set up now? Good. Now that we have already our machines configured with cluster, next thing we'll do, the next step, will be to install the LAMP stack and also use Unison to replicate Drupal across the whole four servers using multi-region setup. We'll start to go to the file system and to create here a series of directories that will keep our configuration files. Next, we will link these directories to the dedicated to the system files there on ATC and on VAR. Next thing to do will be to install our LAMP server also here in, sorry, also here on this server. We have to do this. So the next thing we'll install the LAMP server on this, the third server, which will request for a password and we will let it install. And we will install the LAMP server on the fourth password. It's installing. So while it's doing that, we can go here and switch to the web directory where we have a web files for Apache and just get the latest version of Drupal. So we can enter it a little bit slow. One of the things that I saw in this testing is that the EU machines are really, really slower. Great. We have the Drupal 7 entered, so we will move this directory to a directory called Drupal itself and we will change the user of this series of web files to the user of Apache. Good. This one already finished. Let's see if GIDI, PHP GIDI is already installed. OK. It's doing that. And the next thing to do is to actually create the site where we'll have a Drupal site. And for that, we will use here the sites available directory. And I have here a neat command, one minute command, that will transform the default site into a Drupal site. So we will enable this Drupal site and we will disable the default Apache site that comes with Apache. We'll restart here. Good. And we will restart here. The last thing I want to check is if we have our Simlinks. Correct. This is important because you will have the same configurations on both servers, actually on the four servers at the same time. And this is correct. Just change on one. Great. Replicate the Drupal. So we should be all set. At least regarding the file. So what we can do now is since we have the DNS of this server, we can just put the DNS here and see if the site appears. It does. Great. So let's see if the other server also responds to the same thing. Perfect. It's installed. So the next thing to do will be to use Unison to replicate these files across the regions to the other servers. So let's clean this up here. Just change to GFS. OK. And we will have to create special keys with SSH to connect to several servers. So the first thing to do will be to install Unison on all of these servers. That's another reason to use Unison for our Simlinks. It's a question of security. Because in this case, either you would have to configure a firewall to only accept connections on that last report, or you use a command like Unison via SSH. So on this server, it's the third server that I'm working in. I will just go to the keys directory and I'll generate ID, MR, multi-region key. It's done.  Also here, this key is good. So you can see that here you already have the keys because they are replicating. So I'm just going to grab here the pub. Going to put this key. I'm going to put this key. Good. We should go here to the third server now and just connect to the other server. How will we do this? I have here a command. It's Unison. And then you pass some arguments for SSH. And then you tell that the server and the directory that you want to be replicated, it's that one. And also the local directory to be replicated, it's that one. So you go now and pass this series of commands and the magic starts. OK, it's now copying all of the things, multi-region. And it's copying both sides. This is the big difference between Unison and Common R-Sync. So if you go now to the US, we will go to this server. We just go to the GFS and we'll see that everything is now replicated here to the other region. And since this one, the second server is also being connected. These both are connected with Gluster. You have the same files. So at this moment, we have the full sync configured for a multi-region replication. The only thing that we are missing is that we have to put this command into a cron job. Contra E. And yeah, whatever can be that one. And we just say, OK, five minutes, we will replicate, use this command to replicate. And we can put this into a lock. Good. So we just now save this file. And we will be sure that in five minutes, this server will replicate to the other server continuously. At the moment, we have already. Sorry. So this was the installation of the LAN and the Unison with Drupal. And now we go to the tungsten replicator, which will be much, much faster because I cut some parts of the same. As you notice, these commands are actually normal commands that you should know from other stuff. So this you can build for yourself. There is no proprietary stuff around this. So tungsten is a tool that serves to replicate MySQL in a secure way because it uses SSH also. So you can use it, actually, since you already have the keys on all the servers. Now you can install tungsten on all the servers. And you can check if the servers are all online, just with one command. And you can just have an overview about the status of all databases in all servers. This is a very important thing. Most of the people don't know this. We submitted a patch on Drupal 7.12, which is there is a failure on the MySQL replication if the SQL mode is not defined. So what we do now, this is kind of an internal secret, but it's not really a secret. What we do now is use this SQL mode on settings.php so that MySQL does know it's only this SQL mode. You should use this. And it will not break. Yeah, it is. Good point. Our replication of the files done and working. The next thing to do will be to create the database replication with tungsten. Tungsten has a series of difficulties where replication breaks on Drupal 7. But in Acquia, we managed to create here a little trick, which is to create an SQL mode on settings.php. And this will keep the replication stable within tungsten. So we save this file. This will be our settings.php file. And we will use this file in our Drupal site. Tungsten is not easy to install. But I have already prepared a series of commands. They will install our four master slaves. And for that, I have here a series of variables that I will use with the DNS names. I will put these variables on the several servers. And since we have already installed the master slave servers on these servers, we will now install for every server in our cluster, we will install the slave service. So the first one, second one, third one. So what it is doing now is actually to enable the slave service on these servers. OK. So the servers is now installed on each of the four machines. And you can see that tungsten is online. So what we will do now is to watch our service here and here and install our database. So we'll get here to our Drupal installation. And we will install a minimal Drupal 7. OK, so our installation. OK. OK, so I'm very sorry the videos were at late night. So I was some kind of tired. So the thing with tungsten is really that you should have that thing of the replication fixed. And we should have a consideration. I will give you these slides. It's not really important that you have all the performance tips from AWS. But it's really important that you see our running site now. So our installation is done. Our site is running on two regions now. And it's based on a cluster of cluster with tungsten and unison. And the machine should be replicating to each other. Let's see the site. Here is the site. And let's check for the replication. So for that, I prepared here some tabs. You have server 1, server 2, server 3, and server 4. They are now clean. It's based on the actual installation. And we can create some content to it. And let's check after this the other server. So let's create the content type first. Let's say it's page and page. Save. Let's create content. Let's add some tests, page, test summary, and test body. Let's save this one. And with this, we should already have our home page modified. Let's check the home page. So the test page appears on the home page. Now let's check the second server. See, the test page has already replicated to the second server. So if we put anything into the database, it will be replicated. Also the files, they will be replicated to the other servers. So this ends our installation. And thank you. So one thing with this do-it-yourself scenario. As you've seen, it takes a lot of time. It takes a lot of patience. It takes a lot of effort. And basically, it's trapped. So OK, now I can unveil. I was trying to do all of that stuff like late hours after my work with Acre. And finally, I found out, yeah, if someday I will advise someone to do that, I will say, yeah, just try to do a smart choice, choose hosting with Acre. If not, if your business is actually to host, then probably this presentation will be very interesting for you. In any way, I think it's very important to choose AGI in the cloud. Don't use just one server. Please take care of your customers, because this will have reflections on Drupal, well, the way that people see Drupal. So any questions that you have? I see there was, like, you had some questions? Yeah, OK. No, the DNS fell over in, you're talking about the balancers that we use on Acre, right? Yeah, like in the fact that they are automated. Yeah, they are automatic. Like in the same second that the machine starts to fail, it will fail over to the other machine. So it's, yeah, yeah. Yeah, we put a lot of construction in terms of our infrastructure, which is called the fields environment. It's a very technical and inside thing. But that basically automatizes everything that we have in Acre. It's a fields way. We use puppets. We use Ruby. We use a lot of bash scripts, a lot of PHP inside of Drupal. We have checks that go using Drush to see if the mic, sorry. So my question is? Yeah, hundreds of gigabytes. That's what we do, actually. What is your really, it's about the size of the files, the amount of files? The amount and the size at the same time. Yeah, it works. If you do it, like in our infrastructure, there should be no problem. The only problem is, as he stated, is the cluster that we use now. It's going to be a brave enough. And the new version of Gluster has no problems dealing with more files. And you have, of course, the problem of AWS. EDS volumes, they are slow. I assure you they are really slow. In this case, I only saw this after. But the volumes were very slow while installing. And this was because these two machines that I was using were in Ireland. I don't know. But maybe the neighborhood is awful. Like, slow. It's just a generative contact. Yeah. Yeah, the only thing that you have to really take care of there is that you don't have the files on the same directory. Just that. Yeah. So you will not. Yeah. You should not have any problem with that. At least what we've seen. But please don't put the files on the same directory. That will give problems for sure. Yeah, that's good. Yeah. That's good practice on Drupal. Yeah. Yeah, we can stay later a little bit talking about this. It would be nice to have other. This is like an unexplored ground, like. It's very hard. OK, guys. Thank you. I have here three t-shirts. I will make just two questions. Maybe you heard what is the name of the product that we have that has just one server on the cloud? Hey, raise your arms. OK. Take your shirt. So what is? Maybe you were paying attention. How many servers do we have on Managed Cloud at the moment? Raise your arm. Great. Yeah, but it was first. OK, and since you have the other question, I'll give this to you. Thank you. OK, guys. Thank you. I appreciate you being here. It was really, it's a difficult demo. I hope you understand. But let's continue to talk about this. Yeah, yeah, the presentation. Even the video. Yeah.


All right, so my name is Pratik and I run supportb.com. Avinash is also around here if you want to check out what we do. And before this, I used to run a service called Musubu, which I still sort of run. And a couple of other things like Hacker Street, I kind of host it. And so anyway, today we'll talk about Backbone.js. And I think, oh really? Wow. So today I will talk about Backbone.js. Also, so I think the talk is not exactly about Backbone.js, but it's about actually, you know, kind of learning to love JavaScript. And so most of us look at JavaScript as this language which we just sort of pick up on the way, you know. How many of you guys are familiar with Douglas Crockford, the good parts, right? So if you attend his talks, that's what he says, right? We just pick up JavaScript and we never really learned it. So it's about actually learning to see, like, that you can build, like, really cool applications in JavaScript. You can structure your code and you can give it as much love as you give, you know, Python or Ruby or PHP. So let's get started. And, I mean, typically most people just, like, love jQuery and stick with jQuery, right? And I also really love jQuery. And I have done a prototype app before, prototype JS. And so coming from that background, I really love jQuery. But still, I think jQuery is, like, good for simple stuff.  You want to change a little DOM or something like that. But if you want to build a full-page app, right, you know, it's not really that good. So it's good for a simple website. But if you want to build a single-page application, it's not so great. And what do I mean by a single-page web app? Just to be on the same page. You know, something like Gmail or the mobile me or the new Twitter. If you've seen the new Twitter web interface, that's a single-page app, right? There's no page refreshers.  So that's what you're talking about here. And so Jeremy is the guy who created Backbone. And so as he says, unless you're a really fastidious coder, some sort of library to help structure large-scale JavaScript applications is important. It's far too easy to degenerate into nested files of jQuery callbacks, all tied to the concrete DOM. And so I think this is the biggest problem if you're using jQuery to build big applications. You'll be writing so much event, you know, so many callbacks, so many events, and, you know, they'll all be tied to your DOM. If you change a class name, it will all just sort of break down. And so that's where I think something like Backbone comes in. There are a lot of other alternatives like Sproutcore, which there's a talk on. But I'll not really be comparing any of this. We'll just dive into Backbone and keep it short so you can ask questions. So just a few properties of complex web, you know, single-page apps, which makes it necessary that we have a framework, right? One is all of the logic, client logic is typically on the client side. So how many of you guys have used, you've all used Gmail and like Pivotal Tracker. They have almost all of their, you know, a big chunk of their logic on the client side. And then, you know, they just keep it in sync with the server. And so they have all of their logic in JavaScript. They have, they have a lot of updates to the UI when the data changes. So, you know, every time a new mail comes in, the listings change, the counters are changing. If a new reply comes in, it says you have a new reply. So the whole bunch of stuff is happening on the screen at any time. And typically the templating is happening on the client side. So if you've done a little bit of Ajax, I mean, how many of you've done it in Rails, for instance Ruby on Rails, right? Or so what you do is you make a call and, you know, you send free rendered HTML back and you just insert it in the right div and it just gets rendered there. Typically in a single page app, you don't do that. You send the data back and then you do templating on the client side. So there was a talk in the morning on Mustache. So something like that. You keep your templating here because it just keeps it all clean. And yeah, lessed it on the wire, exactly. And so to not go crazy building it, because it's pretty easy to go crazy building it, you need like an MVC-like pattern to keep the code clean. You need a templating language like Hamel or ERB or Mustache or Handlebars to render view elements. You need a really good way to manage events and callbacks.  People don't care whether it's a single page app or not. If they press back, it should go back to the previous state. And that's a big deal. And you need easy testing. I mean, I'm assuming everybody here test drives their code, right? It's 2011. Test drive your code. So fortunately there's help. There's backbone.js. It's just 4KB packed in GZEPT. The only dependency is underscore.js. How many of you have played with underscore in the past? Okay.  And it makes it really easy. So it's like the missing link in JavaScript. And you need jQuery or Zepto to do Ajax or to do DOM manipulation. And so this is one great thing about backbone that it's giving you all this stuff to structure your code. But you can still use jQuery to do your DOM manipulation. You can use all of your familiar jQuery plugins for rendering or for doing table sorting. So you don't have to, versus if you go to Sprout code where you have to use everything that's provided by the framework.  And that's a very good, very well annotated source code. And that tool is also written by this guy. So it's very easy to, it's just 700 lines of code, 750 lines of code. So you can pretty much go through the entire source code and there's no magic happening there. So what does it give us? It gives us MVC, which is Model Views and Collections. It's not Model Views and Controllers. It's Model Views and Collections. So we'll look at, we'll just go through a little bit of code to build something like this. So this is something like gmails. In our case this is like ticket listing. So, you know, you have a, so that, so this is on a whole ticket listing element. Then it has individual ticket rows or emails. I mean, if you prefer that. So basically what we'll be building is like rendering using, using backcode, building something with render this. And then when you click on it, it opens up a particular email. So we'll see how to do this using backcode. If you want to do this using jQuery, I don't know. I can't remember how to do this using jQuery. So anyway, leave that. So you can build models, model, data is represented as model. So if you have an email, the email object as such which has that, you know, subject and the content, that's a model. So data is represented as models. Models can be, you can create models, validate them, destroy them and possess them on the server. So, you know, you can fetch a model, you can make some changes to it, and then when you save it, it makes a call to the server and saves it back. So it, it, it maps really well to, you know, your server's restful paradigm. And the great thing about models is that if you change an attribute, let's say if you change a subject, so you can bind to a change event. And then in the right place in the UI, you can say, oh, every time this model subject changes, change the subject here. So, so this way you don't have to manually keep track of things. You just keep binding to events. So you, so there are a lot of events and for every attribute is an event, model as a whole, there's a change event. So there are a lot of events that backbone gives you that you can bind to. And that's the right way of doing things in backbone. So this is how you make, so I'm assuming everybody's familiar with this namespacing in JavaScript, right?  So you just don't make like global or like you make like, just as we support the namespace, dot model, dot ticket summary. So you extend from a backbone model and you can do your unit code here and that's pretty much it. So every time you get a JSON object back, backbone will take that and, you know, all the attributes that will, all the fees it will take and create attributes automatically. So all of that work is done for you. You don't have to worry about all that. So, so this is like the ticket summary model which will be used to render that row. And, and then we have collections. So collections are basically a collection of models. So you have one model and then you have n models. So you, so you have a ticket summary model and then you can have a ticket summary collection which has a lot of models. And so collections again have their own event. So every time you add a model to a collection, it has an add event. Every time you remove it, you have a remove event. So let's say, you know, a ticket is deleted. So you can bind to the remove event and take it out of your DOM. So, you know, the recurring theme in backbone is like to use events for everything. To not like stores, you know, pointers to rows or pointers to the views, but to use events and like keep things that way. Because the great thing about that is you don't have to worry about who else is using that event. So, you know, three or four views could be getting updated based on the change to a particular attribute, but you don't have to worry about it. You just write self-contained code. Yeah? Yeah. Yeah. No, so actually you'll see, which obviously what happens is, I mean, so we'll just wait. We'll come to it. It's not as simple as that, but we'll come back to it. So, so if collections, collection of models, triggers events. And so what you can do is you can, how many of you are familiar with the restful paradigm, right? Where you have like slash tickets and then you have slash tickets, slash ID. So, you can give your collection a URL saying slash tickets and it fetches a bunch of tickets and then it understands that this is a collection of these models. So, it will initialize individual models for you. At the same time, it will keep calling those add callbacks. So, you can do something about it. So, you can fetch from a collection and then you're saving, if let's say an individual model back, it will derive its own URL from the collection. So, it knows collection is slash tickets. So, my ID must be slash ticket slash ID. So, it all maps really cleanly with, you know, restful sort of URL structure. And really well, I'll show that actually. So, and one other thing is that you can define a comparator in your collection. So, what happens, every time you add a new model, it will invoke that comparator and insert it in the right order. So, you can be sure that your, if you worry about order of models, you can be sure that it stays in that particular order. So, they have this one neat thing. And so, this is how collections look like. This is a ticket this connection. It's a connection of the model that we just defined. We get some new model. This is the URL you should fetch from. So, this is a neat ticket. This can be used for passing, like, if you send your JSON with a top level namespace thing, you know, you can decide if you want. So, you can use something like this for that. And again, this has an initialized. So, you can do some stuff here, whatever you want to do. So, you can, I don't know what you might want to do here. Yeah, so, I'll show that actually. So, let's come back, let's come to the views.  Here, actually, views are more like controllers. Views are the ones responsible for initializing things and hooking them up to each other. So, views are actually like pretty intelligent in backbone. So, they are more like Rails controllers and they are responsible for instantiating collections, binding events, doing the fetches, as you asked, all of that stuff. So, if you see this view is pretty complicated. So, what you do is initialize the view. Now, see, what we wanted to do is see, this is like a typical UL-LI thing, right? View, have a talk. So, you can just say this, this ticket lists view, the entire view is a UL. So, if you initialize it with a div, sorry, with a tag UL. So, you say it's a UL and then here you initialize the collection. So, you say, okay, let's start taking lists, this is collection. Now, buying knowledge, if you are in the stock, the first stock of objects, this basically makes you every time add or add on the stock, the list is already bound to this object here. So, this is an understood thing, you don't have to, don't worry too much about it right now. The interesting thing is you can say that on the ticket list, add, you can find add-on and on a refreshment, find add-on. So, what, when you fetch from the server a collection of tickets, the refresh event is going to be called, which will basically, which will call add-on of these. And when you see add-on of what it does, it passes that particular model and initiates another view. So, those will be the actual rows. So, this is the big view, this is the one which contains all of these and then each of them will be individually initialized over here. So, every time this is done, it will initialize a view, take this and append with that dot. And now what interesting thing over here is, you see, we are not worrying about the actual class name or the actual ID of the thing. So, when you do add-on of this dot tl, we have already the selected already spoke to this ul tag. So, everything is happening inside that ul now. So, you don't have to worry about where it is placed in the page, what is its ID, it doesn't really matter anymore. So, this way you can just worry about the particular component you are working on and you don't have to worry about the page as a whole. So, right away all your worries like drop by like a factor of 10 or something. So, you initialize a ticket summary view, pass it a model and then once you are done with that, you basically start appending it. And as we'll see in this one. So, ticket summary, I think that is not here. So, this will have a copy of that. So, this will be the allies. So, this will be the each individual allies which will be created and appended to the ul. And so, again the same kind of thing what you do over here is actually, so one thing that you can use is you can pass it events. So, you can say on click do this. And again as you see you are not particularly, you are not really thinking in terms of the DOM. I know you are just saying this view as a whole has this click event and on click event open ticket. And on open ticket what you do is we change the href. You know we change the location and that should somehow get handled.  You are never worrying about app as a whole or the page as a whole. You are decoupling from the DOM and even when you are like conventionally when you know you would like render ul and then you would run a for loop and then li. You are not doing that anymore. So, the benefit of that is let's say now you have a new ticket. You add it to the collection. Immediately the ad will be fired which will file the ad one, which will insert it into the DOM. So, like you know it just stays like really clean. Can you take it later? This finishes flow. It was very hard for it to stay in your head for too long. So, one thing which we are doing over here is in the render here we are actually calling a template and you are passing it on. So, this is like client side template that I was talking about. So, if you see and you should not have that because your html can change but this structure as such is going to stay the same. So, for that you use client side yeah. So, it just defined in handlebars. So, we use a templating language for handlebars which is a super set of moustache. So, this is your template. So, here it is here because the code went out of the scene. So, what you can do here is like a very logical system. If you can't do too much logic you can't earn loops here. Like you can do simple text. So, this is like a text. If it's 100 and bold it, if it's not 100 and bold the subject. This is a helpers. You can define and you can define some helpers. You can say from the requester object extract a name or email. So, if you want to do anything complicated you define helpers. But overall your template stays very very simple. So, what it is how you do is it would just pass it a right object a ticket object with a top level an empty gate. And it will render this. This will come back and be rendered as a ticket row. Yeah, it's your just personal preference. I mean. So, this has you know you can go one level up in the namespace in JSON and so you can do a bunch of fancy things with handlebars. So, it just makes it a lot easier. So, yeah this is the URL thing which you know we were talking about. So, collections have a URL. The models derive the URL from the collection or you can define individually if you want. And they map really well. So, create maps to post slash read get update export delete is delete. So, it maps like really well with the restful thing. And finally, backbone gives you some. You have to write a logic for that. So, you have to write some custom logic for that. And so, actually I can kind of tell you in this. So, finally you have the router. I mean, this is the one which makes sure that you are responding to particular URL. So, like in the ticket summary we saw when we click it just changes the URL. But then what happens? So, the router is one which makes that magic happen. So, when the URLs change, this is the one which catches the URL and calls the right functionality. So, they are used for setting up routes the great thing is you can add routes during runtime. So, you know as and this So, you may not immediately see the benefit of that but it's like really useful if you have I don't know if you start building a real app and so you can add routes during runtime. And so, this is how it looks like. So, what is this? Right when my app is served if it's like let's say the app is app.com, right? app.com where there's nothing after that that's the dashboard route. So, the app you are able to match this now. The dashboard route in our case what we're going to do is it would create that ticket list view, that big listing, a new instance of that. And it will actually update it. So, this is how you update it to a particular page of that now until now you don't actually care about where it's not even in the page actually as such. So, this is where you update it to the DOM and show it. And when you match ID, you know something like this or hash ID, then you match the open ticket now and how do you do that? So, automatically, all that, if you say it's not good, does it automatically follow that route or not? I'll just show that actually. So, this is where the sort of magic happens. So, that's why it's very easy to support you know people can copy a URL and send and it's not dependent on the state at all because the right URL will be matched and then you can say this is a default URL. So, match this one or whatever you want. So, it's very easy to prevel because of back button now also like have people be able to copy and recreate a state of that in a new browser. And- What does it mean to go on long route? This is the entry point. Yeah, so that is the entry point. Yes. So, yeah, so what you do is, you basically, you just say, you initialize that and then you say you start the history. And this is where you can copy to push state but you'll have to change the URL to slash. But if push state is not supported back button will change them back to hash. Or if people- So, what if they say a slash or a hash or nothing? No, so if you want estimate it should be slash actually. Don't want to use a hash for this. But back button will change it if it's not supported. Why not just ask us who the, I don't have, we don't have a slash and this back button will take care of it. Yeah, that's true, I don't know. And one thing is back button is itself like a moving time. So they do keep changing stuff. So, you know, for all that may change. And so you basically to run your app, you initialize a new router instead. Yeah. Yeah. And what if I happen to, so if you said that the history state is preserved, does that mean that on the server I have to want to access that anything? Yeah, yeah, yeah, yeah. So you have to, it's not so much true for the hash URL because the hash URLs are ultimately loading the same page. But if it's a slash URL, yeah, your server should understand that you have to configure a server like that. Yeah. So it needs a server-side support. And so we initialize a router instance since that is the default one. It matches the dashboard route which creates a new instance of ticket list view which creates a ticket list collection and fetches it. The fetch calls refresh. The refresh is already bound. So the refresh handler renders ticket summary for each of the tickets fetched and starts appending them through the DOM. So basically this is the process. Now once it is rendered, each of these tickets summary as we saw at our on-click handler. So you click on it. It changes the URL to hash ticket ID which matches the second route that we have defined. Which is responsible for instantiating an individual ticket view. We did not see the code for that but you can write the code for that. So basically the paradigm is you initialize your app, match the default route or something and then after that, at least that's the way I do it. I just keep changing URLs and keep matching those URLs to some handlers. So you can always on-click just change the page but that way you will not get the benefits of the back button or browser history or anything. So you should avoid that. But if you opt into HTML5, then it can be slashed too. No, this was, I did that, I mean, but you can define slash actually. No, but, no, no, HTML5, it won't reload. It's a push state. So it won't, it will just, so that's like if you have seen that Github's code browser, right? It's actually, the URL is seen but the page doesn't reload. So you can go and check it out. When you click browse your repositories there, the URLs will keep changing but the page won't be reloading. So, so one thing is that so far we have looked at models as things which are bound, which have something on the server. So if you have a ticket model, you'll have a ticket API but backbone models are not just for API, you know, for API back models. So what, like in our application, what we have done is, I can, so, so this is something like how our app looks like. And so what you've done is actually even these things are rendered using code. So you can define a JSON that says give me a my ticket screen which renders these screens and renders these buttons. So in a way, that's also data, that's some data, right? But there is no corresponding API in the backend. But you can, the great thing that happens is what you can do is you can use your views and you can use a collection and say, oh, every time a new screen is added, insert an element over here and find these events. So this is where your time without income helps. So you can say, okay, this is where you are for this. So you should use this code organization even for other things in your application, not just for things that you're fetching from the server. So, let's see, what do you want to do and fix, like in something that's lost in this case? Yeah. So the way we have done it is, let's see if the code is here. Yeah, so if you can see what we do, as I said, everything in ours is triggered by rows. So what we need to do is, we change the URL to slash, slash, slash, query. And then we handle this around in the open source system. And so that's why we can add validation to it. So we use this slash, slash, query, and page, column, page. And you open the same source, you see? But in the handle, you pass a page parameter. So when you are making an API call, you pass that page there. So, as I said, we just handle everything using URLs actually. But how will the collection change there? No, so you, the collection will define a new, you will instantiate a new screen, a new view. And then you will replace your current view with that view. What we do is we keep a stack of views. So when you press the back button, the older one is just like popped out and made the current one. So yeah, so these are some of the patterns that you can use. So what we have is, we have something called, so, so what, so we just say, okay, current view, set this particular view as a current view. So then that case set and set, et cetera, current view, and for all the older views, we will hide it and also for something like, you are not a current view. So then you can either recycle them and remove them from your account, or you can reduce the polling frequency or do whatever you want. So we have to sort of tell us this framework for ourselves. So, ultimately you would have to do something like this if you are writing a very complicated app. And so, Backbone has a module called Backbone Sync. You can overwrite it to, so people have written local history thing, adapters, and so you can do all of that. So just wanted to test, touch one testing. So we, we at least like, so this is like really, really, really complicated code.   Because whether it's polling every five second or not or whether it's removing or not, you will just go crazy manually testing. So you should write test-reven code. So we use Jasmine for it, which is a very popular choice right now. And so we can write something like this. So, so we can say, okay, create a new ticket summary. Now, expect the top level element to have a ticket, have a new request here. Or if you click it, so you know, this is a view.vl.click, you should expect the windows location to change. So you can write, you know, your Jasmine code like this, and it makes it a lot more manageable. And you don't want to make network calls. So you can use Synon, there's something called Synon.js for mocking and stubbing. So you can do something like this. You can say, okay, create, give me a fake server. At this one, it should be in this fact. So it has a create and do list and I do fetch. It will actually give me this thing back. So you don't really top your backend. And so it keeps the test very fast and very manageable. And you can use test unit or whatever, but I mean, if you're familiar with RSpec, Jasmine has a very behavior-driven development sort of flavor to it. So you know, expectations and, you know, nice error messages and all of that stuff. And yep, so this is what we do. And if you find all this exciting, you should come and work for us. So we work on cutting it stuff. Like we said, we give you a MacBook Pro, we have Xboxes, you'll be programmer number three. So we're not just number two, I'm number one. We're number three. We are already sort of public beta. Another thing is if you're a company, you should definitely check us out for your customer support. We have a couple of customers including some really big ones which unfortunately we cannot disclose until we have officially signed them up. And yep, so, so much for that. And yep, questions. I think we, okay. You mentioned Jasmine. Right. So how do you automate this? What do you have to do with this? No, so Jasmine gives you a command line rate task which you can put as a part of your continuous integration build or something. And that's what it does probably. So I've just run Firefox in the virtual frame buffer. In the radius, phantom. Phantom, yeah. Yeah, we want to, but yeah, so that's the thing, right? You know, when you are two people, you can only do so much. So, but yeah, phantom is, I think, definitely an emerging choice. It's a headless browser, so. This is Jasmine. Where's the gate? There is something of Jasmine headless. Oh really? Something very simple. But anyway, we run our Cucumber specs and so in our continuous integration, we run our spec Cucumber which needs a Firefox thing. You can probably do phantom, but it is proven to work on Firefox, so we just, and then we do Jasmine. So we have just, so we just, in the virtual frame buffer, you can run our Firefox. So it will invoke it in memory and it will just keep, you can connect to it using VNC if you want and debug. Yeah, it's pretty straightforward. So yeah, that's actually a pretty cool question to ask. So what do we have done? We have written a pretty fancy thing on top of it. So, what do we have done and we have? So actually, so we have written a little wrap up. So what it does is, because there's only like a deep and sink route. So what it does is, like every time now you initialize a model, it will actually, it's like an identity map thing. So you know, it will actually take, if already a model exists with that ID, it will take that object, but it will sort of re-initialize it with new attributes that you pass or if you do a fetch, it will fetch. So what happens is, even if you have, so like there's a ticket summary with a ticket item for a particular ticket, then there's a full ticket view.  But if you initialize different models, which is the backbone's default behavior, then if you change something here, it won't be reflected there unless you do the next refresh. But if you do something like that, it's basically all bound to the same object. And so you change one attribute here and if you're bound to the call, everything changes for, or everything bound to that object. So is there a lot of talking on the model? No, so when you do the same, it will be preserved there. And you have to express it? Yeah, you have to express it. And it's always difficult. Yeah, it's a crud app. So I'll try it. So one thing, when you're kind of doing something like back one or single page app is that you have fully functioning API right when you know you have a version one of the product. Yeah, in our case, the admin side of things we still do using Rails, Rails views, but everything else is just, yeah, it's a JSON API. This would be like, it's equal to the plate, right? Yeah, yeah. Though we recommend using Postgres. Yeah, so this is the thing which we have written. So it's like a little cache store which keeps a copy of each layer, reference to each layer, models, and then when you are creating a new model, it basically checks if it already exists and all that. So it works pretty well. You also use, it's like, the app can actually run through the cache. No, not yet, not yet. I mean, we can do all of that. It's already pretty snappy actually. Unfortunately, there's no internet, so it's not fetching the right font. But if you see the URLs change and the back button is like pretty snappy, you know, you can go to a new listing and this is coming locally, so it's kind of slow. That's a good question. I don't know.  So as of now, I don't really care about it. Maybe when we go like really mainstream and you know, we have to optimize. So, yeah, first time now.  After that, it's only JSON transferred. So after that, every time you do... Oh, really? Okay, I don't know. So here, anyway, it's a development, so everything is not concatenated, but you can concatenate and send. And then after that, it's just, you know, XHR requests. Right now, it's all server. But as I said, you can override that Backbone sync module and so every time you do save, you can save a local copy and then save. So it's pretty easy to override all of that stuff. No, actually, we want to open-source this app because if you think about it, it's like the de facto reference for our own API. So, I mean, I actually wrote a blog post about it. So my philosophy is that the core of your product is actually the API and, you know, all the user experience. And if you want people to adopt your API and if you put this code out, it's actually like a very good rep because it always stays in sync. So people can just look at it and see how the API functions. So there's actually no reason to try to protect it. The underscore comes with a templating language. Oh, no, no, no. That's what I said. So you can use your regular jQuery plugins for all of that. There is no, so this dollar is a jQuery dollar. So you can do whatever you want. So when you say dollar of certain element, it gives you a jQuery, whatever, the DOM object or something like that. And you can do whatever you want with it. So you can use any plugin. Yeah, you can use, handlebars is just our choice.  And one thing which we use is we use something called jammit, at least for Ruby projects, it's like really, so that will compile your templates and make it available in a global namespace. And so it makes it very easy to use. But yeah, you are free to use any templating language you want. Yeah, so a spine came out after backbone. So some of the things which are missing in, which spine did better than backbone were like this identity map, but we had already written our own. So I think give both a good shot and see which one works for you. No, we have a poll right now. We want to, I mean, if you were in the last talk, I don't know, so we want to do more like a push assisted polling thing, which is like, because polling, so push works really well when everybody is tied to one channel. So if you are on a ticket and you want to update that, it works well. But if it's here, there are a lot of combinations depending on who's logged in, which company, which view they are on. So what you wanna do is we wanna broadcast an event saying, okay, in your company, tickets have been updated. So then you can initiate a poll. So maybe we'll do that later. You can use it if you want. I mean, I think you just have to make sure that the dollar, but why would you wanna use prototype? Yeah, yeah, yeah, yeah, yeah, yeah, yeah, yeah, yeah, yeah. Sorry, you can use it if you want. We use Capybara, yeah. Capybara, so you can integrate Serenity with this Capybara, then you can translate your, because you are basically running which app, so you need Serenity testing right now. Yeah, yeah, yeah, yeah. You can use it if you are, like, you can have this here, sir, or not, sir, right? You cannot run that, like. No, you can, that's what I was saying. So you can, there's something called XVFB, X Virtual Frame Buffer, which is like having a display, but in memory. So your browser will launch in memory and if you want, you can even connect to it using BNC. So, I mean, it's like having a real browser, so you don't have to do any changes.  Are there tools, there's a transaction, there's something like that? Now there are some gems. If you use awesome Ruby, then you have gems for all of them. Yeah, yeah, yeah, yeah, yeah, yeah, it does. You can opt into HTML5, push it. This is older browsers. No, older browsers, it will fall back to the hash thing. Yeah, older browsers, you'll fall back to the hash thing. Yep, thanks, any other question? I'm, anyway, hanging out here. So if you guys want to chat, okay, thank you.


Hello and welcome to this session in which we will discuss serious EE savings bond, which are type of original issue discount bond. Before we do so, we have to understand an IRS doctrine called the constructive receipt doctrine. What is the constructive receipt doctrine? Well, it's an IRS principle to determine when income should be taxed. So from the IRS perspective, when should they tax you? Well, here's what the IRS looks at. If they believe you have access to the money, if the money is credited to your account, if the money is available to you, then you did receive it. If you did receive it, you have access to it. If you have access to it, you should pay your taxes. So under this doctrine, doctrine in individual or business is considered to have received income even if they don't physically receive it. So let's assume the money was credited to your account. You did not receive it, but it's available to you. It is your money. Therefore, you need to pay taxes. So the purpose of this doctrine is to ensure that taxpayers cannot avoid paying taxes by deferring or delaying its receipt. Because one tax strategy is to delay paying taxes because of the time value of money. The more you can delay it, the better off you are. So if income is available to an individual or a business, they are considered to have constructively received it. And it must be reported as taxable income in the appropriate tax year regardless whether they actually did receive it or not. So for example, let's assume you received a check in the mail on December 31st. You did not pick it up until January 15th. You went on vacation. Well, guess what? You did receive it. You had access to it December 31st, but you just chose not to get it. Well, you have it. It's income to you for that year. Before we proceed any further, I have a public announcement about my company, farhatlectures.com. Farhat Accounting Lectures is a supplemental educational tool that's going to help you with your CPA exam preparation, as well as your accounting courses. My CPA material is aligned with your CPA review course such as Becker, Roger, Wiley, Gleam, Miles. My accounting courses are aligned with your accounting courses, broken down by chapter and topics. My resources consist of lectures, multiple choice questions, true, false questions, as well as exercises. Go ahead, start your free trial today. Now let's talk about original issue discount bond. Why is that important? Well, because what is a discount?  So for example, lenders, what they do, they often offer loans with maturity payment, exceeding the original amount, resulting in this is what we call original issue discount.  They would say, yes, here's what we're going to do. You want to borrow $100,000, that's going to be the face value of the loan. We're going to issue a loan, okay, for $80,000. So right now we'll give you cash, we'll give you cash of $80,000, but you will pay us, you'll have to pay us back $100,000. So this is called a discount loan. It means you're getting $80,000 today, you'll pay them $100,000 later. Now, regardless of the taxpayer accounting method, original issue discount must be reported as it accrues, and interest earned is computed using the effective interest rate method. Now you may not pay this face value until three years later. Well, you'll get $80,000 now, you will pay it, or let's assume, let's assume the opposite. Let's assume you went to the bank and you deposited $80,000, and you're going to get $100,000 later, three years from now. Well, guess what? Your total return is $20,000. You're not going to get it until three years later. Regardless, each year, year one, year two, year three, what you have to do is you have income that you have to report. In total, you're going to get $20,000. Let's take a look at an example. Let's assume on January 1st, X1, John a taxpayer using cash basis lends $907,030 to a financial institution to a bank by purchasing a CD. The certificate is priced to yield 5% as the effective interest rate. Simply put, John's going to earn 5% every year for two years, 24 months. The interest is computed annually. No interest payments are made until maturity when John collects a million dollars. John walks into the bank today, lends the bank $907,030. Two years later, John can walk into the bank and get a million dollars, but that's again two years later. This deal yields to John. John will earn 5%. Here's what's going to happen. As of year one, John will do what? This money will grow at 1.05, which is the original amount plus 5%. If we take 907,030 times 5%, John earned the first year $45,351.50. This money was added to the original amount. This is what I did. By the end of the year, John will have $952,381. Now, this number is in the bank account of John, but John cannot take this money until the end of the year. Guess what? This $45,000 is taxable. This is a form of original issue discount. John gave 907,030, purchased a CD and will not get their return until two years later, but the IRS says, well, they credited the money to your account. You have to pay taxes. Well, I didn't get the money. Well, yeah, that's the deal. Now, this money will stay in the account for year two and will earn this money, will stay in the account and will earn another 5%. When they earn another 5%, which is the original amount plus 5%, John will withdraw a million dollars. So in year two, if we take 952,381.5 times 0.05, John earned in year two $47,620 rounding, or 619.50, 619.50. So this is how much John earned in year two. Well, this amount is taxable too. So notice, now in year two, which is good, John should have the ability to pay because John received their money. That's fine in year two, but in year one, John did not see this money, cannot touch it. They can, but they'll get a penalty if they do, but they're gonna have to pay taxes on it. So this is what we mean by the money is taxable as it accrues, regardless whether you are a cash basis or not. Now, good news for serious E and serious EE bonds, which are type of bonds. Well, serious E are gone, but we have to talk about them real quick. Serious E and serious EE are types of savings bond issued by the US Department of Treasury to help fund the government and allow individual to save money. So rather than giving your money to the bank, to the financial institution, you can buy those original issued discount bond from the government. Now bear in mind, serious E were issued from 1941 to 1980, and they have 30 year maturity. Those are gone because they're gone 30 years after 1980, they no longer exist. Serious EE on the other hand were introduced in 1980 and are still being issued today. They follow the same concept. They earn a fixed rate of interest up to 30 years and can be redeemed after one year if you choose. Now, how does it work?  And today they pay for the bond like $500 or whatever amount they pay. And this bond will have a face value of $1,000, but that's you have to wait 18 years or something like that. So you'll get the bond today. It shows you have a bond for $1,000, but you have to wait 18 years to get the $1,000. They only paid $500. So every year, this bond will accrue interest until it reaches $1,000 after a year later. Now you can have any number, you can have $50,000 to $100,000, so on and so forth. Now, although these bond issued at discount, they do not follow the rules for the original issue discount. Remember, the original issue discount, like the John CD, John will have to pay interest every year. Here, income is usually postponed until the redemption or maturity. What does that mean? It means although you're earning interest every year on this bond, you're not receiving, you don't have to pay the taxes. And this aspect of US savings bond make them attractive as they offer income deferral benefit, not found in corporate bond or CDs like financial institution or banks. So this is why people will buy them. They would say, okay, I like to defer paying taxes. I'm earning the interest and I don't have to pay taxes until that bond mature. This is kind of a good news, bad news type of situation. Why? As we mentioned, the deferral feature, it's an advantageous. If the investors don't have enough money, they have insufficient fund to pay the taxes as the income accrues. So that's good. So as the income accrued, I don't have money to pay the taxes. That's good. So the the tax is being deferred. That's the good news. Now, at the same time, the federal may work against the investor. How? Here's what could happen, especially if the tax rate at the time of the redemption is higher when the income accrue, or if the bunch of the bond into one tax here moves the investor into a higher tax bracket. Let me explain this. So remember your rich aunt or uncle or your grandpa or your grandma gave you this bond, and they gave you the bond at 500,000. Let's make it 50,000. And after 18 years, you're going to get 100,000. Now your tax bracket between now and 18 years from now, because you're not making money, you're still young, maybe you are in the, I don't know, let's just make this up. 12% tax bracket. As interest is earned, you are in the 12% tax bracket. The government says you don't have to pay taxes now, you can pay the taxes later. They say, great, I'm deferring the taxes. But here's what's going to happen. Here comes your 18th year and you're making a lot of money, and now your tax bracket is 28%. So what happened is, now you have to pay 28% on these earnings, because while you defer them, you should pay them when the, your tax bracket is lower, or what could happen to this additional 50,000 of income from 50 to 50,000 kicked you in higher tax bracket, took you from 28% to 37%. I'm just making up those bracket. So this could be advantageous. So to avoid this possibility, here's what you can do. A cash taxpayer can choose to include the interest from these bonds and your annual income as they accrue. So what you will do, you would say, I am not going to wait until it matures to pay my taxes. I'm going to pay my taxes every year as they accrue. Two reasons.  That's one. Two, my tax rate is lower now than later where I'm going to have to be making, I'm going to be making more money. I don't have to, but you should be making more money as you grow older. So this option is particularly useful for kids, for children. Why? Because most of their income is wiped out by their standard deduction. Also, remember, as you get older, you make more money. As you get, as you make more money, you are in a higher tax bracket. As you are in a higher tax bracket, you have to pay more taxes. So it's advantageous to do what? Don't wait, although they're giving you this option. But again, this is part of tax planning. As I mentioned, this is part of tax planning. Let's take a look at an example. John purchased $1,000 face value series EE savings bond for 500 on January 2 of the present year. By December 31, by the end of the year, the redemption value is $519.60. What can John do? John can say, you know what? I'm going to ignore this additional $19.60 or John say, I'm going to pay taxes on this. It's John's option. Well, if John defers this, it's part of the deferral strategy. What John's saying, maybe John don't have the money now. Don't want to pay taxes on this money. Or John says, maybe in the future, I have a lower tax bracket, I will wait until I cash it down the road. Or John could say, you know what? I'm going to pay it now. My tax rate is lower. And I have the money now, maybe down the road. I don't have the money. And my tax rate is higher. So when the bond is mature, John would receive a form 1099, telling them how much interest to include in their income. If John chose to report the income as it occurs, let's assume after when they get the 1099, they're going to say, you earned $500 in interest. And you have to pay the taxes. If John was paying the interest of that $500 over a period of the bond, they'll have to keep your record, say, no, I don't owe $500, I owe, I still have to pay taxes only on $20. Now, IRS rules for serious EE bonds. If the taxpayer choose to report the bond yearly, this election applies to all owned bonds and securities acquired afterwards. So if you choose to do that, you have to keep in mind, you have to pay the interest on all these investments, any investments you have that's similar to that. Okay. Changing the reporting method, then you have to talk to the IRS, just know the rules. What should you do now? Go to far hat lectures and look at additional resources, lectures, multiple choice through false additional notes. That's going to help you understand serious EE and serious EE savings bond. Really, it's serious EE savings bond. You have to understand how original issue discount work. And what's important in this original issue discount is the doctrine of constructive receipt. Good luck, guys.


Hi and how are you all today? My name is Priyanka and let us discuss this question. It says the circumference of the base of a cylindrical vessel is 132 cm and its height is 25 cm. How many litres of water can it hold? So here we need to find how many litres of water it can hold. That means we need to find the volume of this cylindrical vessel, isn't it? So before proceeding on with the solution we should be well versed with the volume with the formula that is volume of a cylinder that is equal to pi r square h where r is equal to the radius of the cylindrical base and h is the height of the cylinder. Right, so this becomes the key idea of our question further. Now according to this question there is a cylindrical vessel whose circumference of the base is given to us. Also we are given the height of this cylinder as 25 cm. Right, first of all with the help of this circumference we will be finding the radius of this cylinder and substituting the radius and the height in the formula that we know we can find out how much water it can hold. Here we are given the circumference of the base 132 cm. Now with the help of our previous knowledge we can write that the circumference formula is equal to 2 pi r remember that means 2 pi r is equal to 132 cm that implies r is equal to 132 the whole divided by 2 into the value of pi is known to us as 22 by 7 so 7 will go in the numerator that implies the value of r is let us simplify it further 21 cm that is 3 into 7 so we know the value of r we know the value of h which is given to us as 25 cm let us find out the volume of the cylinder the cylindrical vessel so that is equal to pi r square h that is 22 by 7 multiplied by r square that means 2 times 21 will get multiplied multiplied by h that is 25 so we have on simplifying the value or the volume of the cylinder as this is equal to 34650 cm cube now we need to convert centimeter cube into litre because in the question we need to find out how many liters of water of water can it hold so we need to convert it into litre using this relation so that means converting centimeter cube into liters we just need to divide 34650 by 1000 and it will get converted into liters so the answer is 34.65 liters of water the cylindrical vessel can hold right so this is the required answer hope you understood the whole concept well just remember the formulas and have a good day


Hi and welcome to our session. Let us discuss the following question. The question says surface area of spherical bubble is increasing at a rate of 2 cm square per second. Find the rate at which volume of the bubble is increasing at the instant when its radius is 6 cm. Now begin with the solution. Let radius of the bubble be r cm. The surface area of the bubble let us denoted by s is equal to 4 pi r square as the bubble is spherical in shape. Now s equals to 4 pi r square implies ds by dt is equal to 8 pi r into dr by dt. We are given that surface area of the spherical bubble is increasing at the rate of 2 cm square per second. That means ds by dt is equal to 2 cm square per second. And thus ds by dt equals to 8 pi r into dr by dt becomes 2 equals to 8 pi r into dr by dt. dr by dt is equal to 1 by 4 pi r. Let's name this equation as equation number 1. We have to find the rate at which the volume of the bubble is increasing at the instant when its radius is 6 cm. Now volume of the bubble that is denoted by v is equal to 4 by 3 pi r cube. Now v equals to 4 by 3 pi r cube implies dv by dt is equal to 4 by 3 into 3 pi r square into dr by dt. Now this is equal to 4 pi r square into dr by dt. Let's name this equation as equation number 2. From 1 to dv by dt equals to 4 pi r square into 1 by 4 pi r and this is equal to r. We have to find the rate at which the volume of the bubble is increasing at the instant when its radius is 6 cm. So that means we have to find dv by dt when radius is 6 cm. Now dv by dt r equals to 6 cm is equal to 6 cm cube per second. The required answer is 20 m cube per second. This completes the session. Bye and take care.