the old-fashioned but like the old old-fashioned use maple syrup and you just want to do a quarter ounce now We're gonna add bitters to this one two three town branch bourbon two and a quarter ounces So let's add some ice stir it for 10 seconds rub the rim of the glass and just gently place it right on top of the ice Perfection we are going to be making a Negroni So let's start off with our sweet for move and we're gonna do one ounce One ounce of Campari do one and a quarter ounce Just a little extra if you don't have a big ice rock you could just fill up your glass with ice and we need to stir it for 10 seconds And ideally you want to lay that right on side of the glass Perfect nicely balanced


Let's focus on not what we can't do to help them. Let's focus on what we can do to help them Approaching an owner for example, it's like when you approach that owner You know you're just trying so hard to set that appointment and to get that listing You know that owner is turned off. You're not going to get that listing You know you're not because they're they're dead set on trying to sell it on their own or whatever at that time And you keep pressing them, but you're not listening to them You're not listening. He's telling you that he's not going to do this right now You know and so let's focus on not what we can't do to help them Let's focus on what we can do to help them, right? So okay cool Well, what do you if you're good there? Let me try to help you sell it on your own And where are you moving to? Let me try to help you buy your next house, right? And so it's the same thing with mortgage Brokers to real estate agents, you know if they tell you that They have a mortgage broker listen to them You know and then and then move and then move to move to something that you can help them with You know what I mean


QuickBooks Desktop 2023 Barter Sale Transaction Let's do it! Within 2-its, QuickBooks Desktop 2023 Support Accounting Instruction by clicking the link below, giving you a free month membership to all of the content on our website broken out by category, further broken out by course, each course then organized in a logical, reasonable fashion making it much more easy to find what you need than can be done on a YouTube page We also include added resources such as Excel practice problems, PDF files and more like QuickBooks backup files when applicable So once again, click the link below for a free month membership to our website and all the content on it Here we are in QuickBooks Desktop Sample, Raw Castle construction going through the setup process We do every time, maximizing the home page, going to the view drop down and getting that open windows list open making a bit more room over here for the open stuff in the open window Reports drop down, we're going to go to the company and financial, open up that P&L profit and loss income statement Tab 010123124, January to December that is We're going to customize that report so I can go to the fonts and numbers and change the font size on up to 12, okay? Yes, okay, and then go to the reports one more time Going down to the company and financial, down to the balance sheet standard this time with the changing of the range or the just date, 123124, customizing it, fonts and numbers, change the font, 12, okay? Yes, please, okay, that's what we do every time going back to the home page In prior presentations, we've been focusing in on the customer cycle which could be called the sale cycle, the revenue cycle the accounts receivable cycle and prior sections we've been looking at the vendor cycle which could be called the expenses cycle or accounts payable cycle Now note that at the end of each of these cycles, we expect something to be happening typically to the checking account On the customer cycle, we expect at the end of the process that there's going to be a deposit into the checking account for goods and services we provided to a customer At the end of the vendor cycle, we typically expect there's going to be a decrease to the checking account for goods and services that have been provided to us by the vendor But what if we have a situation where there's a barter or a trading type of situation how can we enter that into our system? The easiest way to do that would be to say, well, can I use the same system, the same process but then have the end result, the checking account be kind of like a clearing account which will be canceling each other out In other words, the vendor is giving us goods and services for example and we are giving back goods and services, let's say, of an equivalent value That would mean that if you put cash in the middle of that transaction then we would be paying the vendor, let's say 100 bucks for goods and services they give to us and they would just then be paying us, let's say 100 bucks for the goods and services that we provided them which would of course net out in the checking account So clearly you can just remove the transaction from the checking account and just provide each other goods and services in practice but in the system you're still going to have to record the transactions So you could basically imagine that at the end of the day, if we go to the balance sheet there's going to be a deposit to the checking account at the end of the day there's going to be a decrease to the checking account the two will net out even if they don't actually clear the bank, right? That's one way that we could do it but we don't really want to do it that way because then we're using the checking account as a clearing account and as you can see the checking account already has too much activity going on not at one date but 010124 it already has too much going on and because it's kind of like the lifeblood of the company there's the most different kinds of transactions the most variety of types of transactions in it so we don't also want to be using it as a clearing account for things that aren't going to clear the bank that'll make it difficult for us to reconcile to the bank the easiest thing to do when there's a barter transaction is to say well let's just create another account which is going to be a cash type of account because I would like to have it up here to be able to interact with our forms in the same way as other cash accounts but we're only going to use it for clearing accounts for like bartering transactions so to do that let's first go back on over to our homepage and let's go into our chart of accounts we could do that by going here and we'll talk more about the chart of accounts later but I usually go to the lists up top and then go to the chart of accounts this way and I'm going to add another account that's going to be in the type of a bank account we'll talk more about bank account types and future presentations up top and I'm just going to call it something like a barter type of clearing account or something like that you're going to add the account by going to the account down below and say I want a new account for Favore and it's going to be a bank account type because I have to have it interacting with my forms in a similar fashion as a bank account otherwise I would put it as like an other current asset or something and I'm going to call it a barter clearing account so it's a clearing account for bartering so we don't need anything else I don't need a description, I don't need a routing number we're not going to connect it to the bank feeds or anything like that so I'm just going to say okay save it and close it so I'm not going to set up any bank feeds I'm going to close that out and you've got the bartering account up top I probably should have put a number on it since they have the account numbers turned on here but I'm not going to mess with that at this point in time I'm going to go back to the homepage now now if we think about a bartering transaction we provide goods and services to someone else they provide goods and services of an equivalent amount to us those two things could happen at the same point in time or it could be that we provide the goods and services first for example possibly first creating the invoice and then they have the goods and services later or they give us the goods and services first in which case we would enter the bill first and then we provide the services that they're requesting in return and then we can create basically an invoice at a future point in time even if the two things happen at the same point in time obviously we're going to have to enter one side of the transaction first and then the other side also note that I'm going to do this with the full accrual process you might be able to enter it a little bit faster depending on the circumstances but I'm going to enter a full accrual process starting with the invoice to receive payment and the deposit on the sale side and then the enter the bill and the pay bills on the payable side because that will cover the largest amount of scenarios that could take place so let's enter the invoice first I'm going to go into the invoice so I'm just going to make up an invoice and I'm just going to call it, let's just call it barter a new customer, barter customer just to add a new customer and then we're going to say quick add just to add it quickly and we're not going to need a class I'm going to keep the template I'm going to say this happened in 2025 because currently the sample file is in 2024 so that I can see at least the income statement in and of itself in 2025 which might make it easier to see what's going on here with this one transaction, 011525 let's say and then that will keep that and okay and then I'm going to set up a new item here so I'm going to set up a new item to drive this I'm going to set up an item we'll talk more about items later I'm going to keep it simple with a service item instead of an inventory item at this point in time and we're not going to be dealing with the sales tax I'm going to call it just item 01 let's say and obviously you could use any item remember the items represent what you're selling so the goods and services that you're selling I'm just going to create a new item so that we can keep it distinct and then I'm going to say the rate let's say the rate is going to be I'm going to say $5,000 here I'm going to say it's not going to be taxable so let's say no tax so no sales tax in other words and then the account I'm going to say let's make a new account just to make it easy to see it and it's going to be an income type of account because this is the invoice side of things I'm just going to call it barter income hopefully I'm spelling barter correctly alright so I'm going to say save it and close it and then okay so that looks good so now we've got the item that we're going to be recording and we've made it nice and easy on the invoice so all that's going to happen is there's going to be an increase then to the accounts receivable for the customer of the barter customer account in the sub ledger and the other side is going to go to the sales account we're not dealing with sales tax and we don't have any inventory that we have to deal with so that is great so I can say save and close let's say save and close let's see what happens to the accounts go into the balance sheet I'm going to change the date to 25 now so let's say 01525 and so there we have that in accounts receivable double-click in the accounts receivable we see there's our barter there's the 5000 there we can track it by customer as well by going to the reports up top we can go down to the customers and receivables and take a look at the customer balance detail and if we go back down to the barter barter there it is there's the invoice right there you can also find it in the customer center if you went to customers customer center first tab barter and we can see it there but the dates are in fiscal year 2024 so let's say all there it is there okay so let's close this back out for now let's close this back out for now and then we can then go back to the home page and the other side of the transaction would be a bill so let's enter that so then on the other side we're saying that the vendor is giving us something so I'm going to enter that on the other side which would be a bill so I'm going to enter the bill which is going to increase the accounts payable we're going to say this is going to be what's let's call it the same name I call it barter barter vendor barter vendor barter vendor okay let's keep that I'm going to say tab quick setup on that one quick setup on and I'm going to have this happen on 01 let's say same date 1525 I believe it was and so there it is now on the expense side of things it would be whatever they gave to us right so if we exchange it for services whatever the service was we would put on the expense side of things here the other thing that they might provide us they might give us supplies something like that where we can put into supplies they might give us the like an asset that we're trading for in which case it was property plants and equipment we would put it into the property plant and equipment down here the other thing that might happen is what if they were to give you something for personal use so you gave them something of a business use and they gave you something for your own personal use well in that case it's not a business thing that you're getting here you don't have to put that into a draws account like an equity type of account and it would be basically a draws type of account but we'll put it into like supplies let's say supplies we don't have a supplies account I'll just call it supplies I'll just make a supplies account we'll just make it up here supplies did I spell supplies right it's going to be an expense account supplies it needs two s's any case we're going to say save it so there we have it what's this going to do an accounts payable account because it's a bill increase in accounts payable the other side is going to go to the supplies let's check that out well let's make an amount it's going to be for the same amount of the five thousand here and we might put in the memo it would be a good thing to put like it's a barter transaction or something like that to help us out in the memo so I'm going to say save that and close it and let's check out what happens with it so then if I go back to the balance sheet we can then say in the accounts payable side of things now right here we're going to double click on it and there is our bill that it will also be tracked by vendor so I can close that back out and see that by going to my reports drop down vendor payable and go to the AP aging or let's say the vendor balance detail report let's say and so we said this was barter vendor there it is right there closing that back out you can also find it by going to the vendor center which gives you vendor tab the barter vendor right there if I look at all date ranges want to see all of them so there is that so closing that back out so now we can kind of finish this transaction off so if I go back to the home page we enter the bill so now it's in accounts payable and it's in the accounts receivable so if we've exchanged the goods and services we're just going to go through the rest of the process until the customer side gets the deposit going to the checking account normally but no it's going to go instead to the clearing account and then the bill will go what it would be to the checking account normally but no we are instead going to be putting it into the clearing account the clearing account then netting out so the next step on the invoice would typically say receive payment so the receive payment I'm going to put it into un-deposited funds which is the normal kind of process I'm going to say the received from the barter transaction just note before I do that that you could track this and then say okay if I go into my customer center and I go into my customer for barters I could say okay there's my barter and I can track it just like anything else and say I can call this person up hey barter customer you need to pay us not in cash but you need to pay us the equivalent of goods and services that you promised to pay us right we could track it in a similar way even though we're expecting at the end of the day not to get goods and services but to get some others not to get cash but to get goods and services so you can also open up the invoice you'll recall and you could say that I'm going to say okay I received payment for this particular invoice and so okay and then we're backed off so there's the barter received payment that we have there's the number we're going to be putting it into undeposited funds and you could say that it's something other so I added barter here so barter and so I'm just going to say okay as the type it doesn't really matter even if you pick like cash because this is more of a more informational type of thing than anything else but in any case we'll keep that what's this going to do decrease the accounts receivable the other side's going to go into undeposited funds note that if you have this drop down you could put it directly into the barter account if you want and skip the next step but I'm just going to go through the full process here so we're going to save this one okay so that one has been saved I'm going to close this out now and say okay what happened with that with that if we go to the balance sheet we know that it's going to be going out of accounts payable so if I look at the I'm sorry it's going out of the accounts receivable so we should have a payment when did I record that repeat see payment I think I recorded it in a prior period let's go back to the customer center that payment is happening in December let's double click on that I'm going to change the date to 01 15 25 and save it so now let's check it out so if I close this back out and so there's the payment so it goes back down and we could of course track that in our in our second report customers and receivables and we can look at the customer balance detail and we can see the barter customer has now been cleared back out but the other side is in the clearing account which is an undeposited funds at this point in time there's the 5000 I want to take it out of undeposited funds and put it into then not the checking account but the barter account which is going to then clear out with the transaction from the other side so I'm going to go back to the home page to do that you can see I have the little red thing here so I'm going to click on it and we just want the 5000 that I'm going to make the deposit on okay I'm going to deposit it this time in the correct date 01 15 25 and then it's going to come out of undeposited funds into the checking account so we'll save it and close it just like any other normal transaction except hold on I went to the wrong with it didn't I let's go into the checking account double click on the deposit and the thing that we want to change is it's not going into the checking account I want to put it into the bartering account so I'm going to change the account that's why we kind of set it up as a cash account so it can still interact in a similar way as the other cash accounts but it's going to be a clearing account okay now let's save it and close it and now if I close this back out it went into bartering account up top so that's a clearing account so we'd expect to go back down once the second half of this barter transaction has been made notice again you could say well why don't you just keep it on the checking account and you could have the checking account go up and down it would result in you in the same spot as before the transaction happened you could do that but you don't typically want to because you don't want to muddy up your checking account and you're also going to have to reconcile the checking account to the bank statement so if you have transactions that are going in and out of it even though they clear out fine it'll cause a problem with the reconciliation process potentially so we're going to go back to the homepage and do the other side so if we entered the bill and now we're going to say we're going to pay the bill so let's go to pay bill side of things and we're just going to be picking up that 5,000 up top so we're going to 5,000 now notice you could say well what if they only gave us half of the transaction and so on so we could say well what if they what if what if we only provided half of it for example then we could still you know put the 2,5 here and then there would still be an outstanding balance and we would have to provide the difference right so you could track that kind of similar kind of thing with the accounts receivable and the accounts payable in a barter transaction so let's just pretend that was the case let's put this here as of 1525 and once again we don't want it coming out of the checking account we want it going to the bartering account so did you know you can select I'm not going to choose the default and we're going to say select bills and pay we're not going to print the check number so I'll say check number down here select bill I'm not going to put a check number okay closing it back out so now if we go to the balance sheet we can see the accounts payable should have going down on the liability side so accounts payable we have a decrease of the 2005 if I go to my vendor center customer vendor center with the barter customer where's my barter customer so we still have an outstanding balance because we only paid off the 2,5 closing that back out and we can see then up top the barter account is now at the clearing account 2005 because I haven't paid the second component of it and I'll just do the next half of it so just to note that you can still kind of track the receivables and payables using using the system even though you don't expect to get cash at the end of the day let's finish it out and let's pay the rest of it pay the bill we're going to say the barter transaction we're going to we're going to pay the second 2005 as of let's say this is going to be 11525 it's going to be a sign the check later changing the checking account to the barter and account that's the key it's not going to be changing the default pay selected bills no check number and I'm going to say okay and then let's go back to the balance sheet so now we can see the barter account has now been removed because it basically went up and down one way to see that I like to look at the trial balance you could change the settings so you could see a balance that is at zero but let's take a look at the trial balance because it does that automatically and I'll start looking at the trial balance more in the future course or future presentations it's down here in accounting and taxes trial balance and let's go from 010125 to 123125 and so there's the clearing account with a zero balance in it if I double click on it then of course you could see it went up and it went back down again that's what it means to be a clearing account it's being used so that it will clear out periodically not just in terms of a temporary account which you might hear from accounting terminology like the income statement accounts clear out at the end of the period but it's going to clear out periodically with a particular use typically you might say well I could have just done that same thing in the checking account but look at all the activity going on in the checking account 010124 you don't want to have you don't want to muddy up the activity in the checking account and you don't want to mess up the reconciliation process that is then the point of the other account being used and then of course if I go back to the balance sheet and we look at the accounts payable let's do it this way vendors vendor center just to round things out the barter vendor balance is back down to zero so that's how you can enter the barter transaction you could possibly not go through the full accrual process you know and do it more in a cash based method but just remember that at the end of the day you can imagine a barter transaction as though you implemented the cash into the barter transaction right you could say well what if I actually pay you the five thousand dollars and you pay me the five thousand dollars and then it'll go properly through our checking accounts you could do that but then you could just say well why am I going to do that I'm just going to eliminate the five thousand dollar exchange between each other and just call it a barter with the bookkeeping side of things we still kind of treat it as though it's a cash transaction that's the easiest way to do it and so therefore you want to set up a cash account so that the end result of these two ends of the transactions because you're still buying goods and services and you're still selling goods and services right so at the end of the transaction they'll net each other out in not the cash account or not your checking account but another cash type of account is the easiest way to think about that kind of transaction


So, in this and the next lecture, we will be looking at examples, which require us to carry out first law analysis of systems. We will do examples involving both ideal gases and two phase mixtures of water as well as R134A. So, let us start with a few examples involving ideal gases. The first example actually involves liquid and the solid. So, we have 2 kg of ice in a container. So, the container initially, so let us say we have a container like this. So, this initially contains liquid water at 20 degree Celsius and we have certain amount of ice which is 2 kilogram. So, 2 kilogram of ice at 0 degree Celsius is dropped into this container of liquid water and then we also add 3500 kilo joules of heat to the container. So, assuming that there is constant pressure and there is no loss of heat to the surroundings, we are asked to determine the final temperature and mass of water vapor formed, if any. We do not know whether any of the water is converted to vapor or not, but if it is then we are asked to calculate the amount of water vapor formed. So, for us the system in this case is relatively easy to identify. We take the ice and the liquid water in the container to be the system. So, when the ice is dropped into the water, it will melt and perhaps all of the both of them would evaporate together, but this system will contain the same amount of mass. So, we take that to be our system and we apply first law, but what we would do is since we do not know how much of the water if any is going to evaporate, let us calculate the amount of heat that is required to take this system to a final temperature of 100 degree Celsius. We are assuming that in everything is at atmospheric pressure. So, we require the I mean we calculate the amount of heat required to take the system to 100 degree Celsius and if the supply heat exceeds this, then we know that some of the water is going to evaporate. We can calculate the amount of water that evaporates after that. It is a very logical way of approaching the problem and there are other shorter ways perhaps, but this is a very logical way of approaching this problem. So, let us do it that way. So, we apply first law delta E equal to Q minus W. In this case for the system under consideration, there are no kinetic energy changes. There is no, there are no potential energy changes. Only the internal energy change is present. So, we write delta E equal to delta U equal to Q minus W. Now, none of the system boundaries deform during this process, which means displacement work is 0 and no other form of work interaction is also there. We do not have electrical work or steering work or any spring work anything like that. So, we take W to be equal to 0. So, which means that the internal energy change in internal energy of the system is equal to the heat that is supplied and the system itself is comprised of ice and liquid water. So, delta U ice plus delta U liquid is equal to Q. So, if you focus on the ice, then the ice at 0 degree Celsius melts to form water at 0 degree Celsius and it is then heated to 100 degree Celsius. So, the change in internal energy for this process comes out to be the latent heat that is required to take the ice from ice at 0 degree Celsius to water at 0 degree Celsius and then the amount of heat that has to be supplied to take it to a final temperature of 100 degree Celsius. Now, for the liquid water it is initially at 20 degree Celsius. So, the change in internal energy for the liquid water would be m liquid times a specific heat capacity of the liquid times a change in temperature which is 100 minus 20. So, the sum of these two would be the amount of heat that is required to take the system to a final temperature of 100 degree Celsius. So, if you substitute the numbers we get this to be 3188 kilojoules. So, we need to supply this much heat to take the ice at 0 degree Celsius and the water at 20 degree Celsius combined to 100 degree Celsius. The heat actually added is 3500 kilojoules so that is more than this. So, we know that some of the water will definitely evaporate. What we do next is as I said there are shorter methods for doing this but let us just look at the logic behind doing you know logic behind solving this problem. So, if all of the water evaporates then the amount of heat required for that is given by m ice plus m liquid times L prime where L prime is the latent heat of evaporation and if you substitute the number that comes out to be 15820. So, which means that this is not sufficient to evaporate all of the water. So, the amount of water that will that will evaporate can be calculated by taking 312 which is the excess heat divided by the latent heat. So, that comes out to be 0.1381 kilogram. So, the analysis proceeds in almost all examples along the same lines you identify the system and then you go through the analysis by applying first law in a consistent manner and then you go through the analysis that is most important identification of the system applying first law to the system and then proceeding. But there will be increasing degree of complexity as we go through the examples this is a very very simple example. Let us go to the next example. Here we have a frictionless piston cylinder mechanism. So, this initially contains air and the air in the cylinder is compressed from 100 kilopascal to a final pressure of 800 kilopascal and the process is given as PV raise to n equal to constant where n is equal to 1.27. Such a process is usually called a polytropic process with n being called the polytropic or index exponent. We are asked to evaluate the work done and the heat interaction. So, the assembly is not insulated it is only frictionless which means there is going to be some heat interaction between the cylinder and the surroundings. So, it is quite clear that we take the air in the cylinder as our system. So, here we are looking at polytropic processes for different indices on a PV diagram this is for ideal gas. So, it is very important to keep that in mind. Notice that n equal to 0 represents an isobaric process where P is constant and n tending to infinity represents an isochoric process for which the volume remains constant. All other processes fall in between n equal to 1 is an isothermal process. So, this is isobaric and this is isochoric and n equal to gamma for an ideal gas as we will see later is an isentropic process where entropy remains constant. n equal to 1 is isothermal where temperature remains constant all the other processes lie in between. So, if your initial state is 1 then states on the second quadrant are obtained by compression processes and states on the fourth quadrant are obtained as a result of or at the end of expansion processes. So, we take the air as a system and the work interaction remember we have only displacement work in this case that is integral of PDV. So, integral 1 to 2 PDV we substitute the process equation we know how P is related to V that is explicitly given in this example. So, we can get this to be equal to this and since we assume air to be an ideal gas we can take PV equal to MRT. So, we finally end up with an expression that looks like this. For air we take the molecular weight to be 28.8 and gamma to be 7 5th. So, we can calculate the specific gas constant or particular gas constant as the universal gas constant divided by the molecular weight and CV is nothing but r over gamma minus 1 from Meijer's relationship we derived this earlier. So, we will be making use of these two. Now, PV raise to n equal to constant may also be rewritten as P raise to 1 minus n over n times T equal to constant once we use the equation of state. So, we can apply this to the initial and final state and get the final temperature to be 467 Kelvin. So, once I know the final temperature I can actually substitute these values into the expression for displacement work and get it to be equal to minus 357.11 which means that since air is compressed the negative sign is consistent with the fact that work is being done on the system to increase the pressure. Now, we apply first law to this system. So, delta E equal to Q minus W. In this case also there is no change in potential energy of the system and there is no change in the kinetic energy of the system. There is no work except displacement work. So, we can write delta E equal to delta U equal to Q minus W which may then be rewritten like this. So, delta U is as we said before MCV times T2 minus T1 and if you substitute the values Q comes out to be minus 116.06. The negative sign indicates that heat is lost by the system to the surroundings as the air is compressed. Now, at this point students at least quite a few students have a question which is that since CV is specific heat at constant volume should it not be applied only to constant volume processes how are we justified in using CV for this process. One must keep in mind that when we wrote the expression for total energy you may recall that we derived the first law for a cyclic process and then we identified E as a property and you may recall that we wrote E is equal to U plus PE plus KE. We know that KE is a property, P is a property, E is a property. So, U is also a property of the system which means that U depends only on the initial and the final state and not on the process by which we arrive at that state. And you may also recall that we further wrote the specific internal energy U to be equal to 5 halves or T depending based on the degrees of freedom that a diatomic gas had correct. So, we wrote it to be 5 halves or T notice that T is a property. So, which means that U is also a property and it depends only on the initial and final state from this we identified. So, we wrote this as CV times T and we equated CV to be 5 halves or for this case per unit mass. So, this is independent of the process. So, the fact that delta U equal to M times CV times delta T is independent of the process and CV is equal to 5 halves or again it does not depend on the process. It is called specific heat at constant volume because as we wrote earlier if we go back a little bit as we wrote earlier as we wrote earlier CV is equal to partial U partial T and remember we said U is a function of T comma specific volume it has to be a function of two properties because we are dealing with the simple compressible substance. So, CV when we take the partial derivative it is understood that V is a constant here because we are taking partial derivative with respect to T V is a constant which is why it is called specific heat at constant volume. But it does not mean that it is dependent on the process the constant at constant volume refers to the fact that we have to take a partial derivative because this is a function of two variables. So, that completes this example let us move on to the next example. So, here we have an insulated vessel like this notice that the insulation is indicated here through this hatching. We have an insulated vessel and side A is initially evacuated we have a stirrer in compartment B and there is also membrane which will rupture if the pressure exceeds 1 megapascal in compartment B. So, we have a certain amount of air in compartment B. So, work is transferred externally through the shaft to the stirrer and the stirrer is turned until the membrane ruptures. So, once the membrane ruptures the air fills the entire vessel we are asked to calculate the final temperature or temperature in B when the membrane ruptures work done by the stirrer and the final temperature and pressure once equilibrium is attained remember this is evacuated initially which means that this this will be an there will be an unresisted expansion when the membrane ruptures. So, that is a non-equilibrium process what we are asked to calculate is a final equilibrium temperature and pressure. So, we take the entire vessel to be our system as shown here and as we discussed earlier. So, let us proceed with the example. So, the initial temperature may be evaluated in B may be evaluated by using equation of state in this manner to get the initial temperature to be 303 Kelvin. Now, the membrane ruptures when the pressure in compartment B is 1 MPa. So, the temperature of the air in compartment B when the membrane ruptures may also be calculated quite easily using the equation of state. So, once it reaches 433 Kelvin the membrane ruptures. So, this process is labeled 1 2. So, starting with the initial state until the time when the membrane incident when the membrane ruptures is we identify that as process 1 2. So, we can apply first law. So, we write delta E equal to delta U because there is no change in PE or there is no change in KE. There is no heat interaction because the vessel is insulated and W 1 2 consists only of sterile work. There is no displacement work, displacement work is 0 because there is no deformation of the system boundary. We have identified the system to be to contain the entire vessel. So, there is no deformation of system boundary. So, delta U is for the system is simply M times Cv times T2 minus T1 for the air in compartment B. So, we may evaluate this as minus 187.64 which means work done by the sterile is 187.64 kilojoules. So, let us say that the final equilibrium state is numbered 3 and we apply first law for process 2 3. Again delta E is equal to delta U is equal to Q minus W. Q is 0 because vessel is insulated. In this case for 2 3 W displacement is already 0 because there is no deformation of the system boundary. The sterile is also stopped once the membrane ruptures that is given in the problem statement. So, there is no work interaction for process 2 3 which means that the temperature remains constant. So, the final temperature may be obtained as 433 Kelvin. And knowing the final temperature and the final volume remember the air now occupies the entire vessel we can calculate the final pressure to be 333.33 kilo Pascal. The next example is somewhat involved straight forward, but quite involved in terms of work that we do. So, we have 2 cylinders here of different cross sectional areas. The bottom cylinder as indicated here is completely insulated both the piston and the cylinder are insulated. Now, heat is supplied to the air. So, it this contains air this also contains air. So, heat is supplied to the air in compartment A or cylinder A and the piston moves slowly down by distance of 2 meters. We are asked to calculate a bunch of quantities here as you can see areas are given total distance is given mass of the piston piston assembly is also given. So, let us proceed with the analysis. So, first quantity which is asked is mass of air in cylinder A. So, we can calculate it using ideal gas equation of state all the values are known. So, that comes out to be 0.2 kilograms. Now, at any instant during the process of force balance on the piston looks like this. So, this is the differential pressure. So, if you look at this. So, the weight of the piston acts in the downward direction. The pressure at A acts in the downward direction, but the atmospheric pressure on the lower face of this piston acts in the upward direction. So, the net force in the downward direction is P here minus P atmosphere times the cross sectional area. Now, the pressure of the air in cylinder B acts in the upward direction atmospheric pressure acts in the downward direction on this piston. So, the net force is P B minus P atmosphere times area in the upward direction. So, the force balance may be written like this. And if you rearrange this, then and use the known values take all the known quantities to the right hand side, we can get the pressure in compartment B to be initial pressure in compartment B to be 325.45 kilo Pascal. So, once I know the pressure, I can I am given the initial temperature also. So, I can use the equation of state to evaluate the mass of air in the in cylinder B as 0.15 kilogram. Now, work interaction for atmosphere basically is P atmosphere times delta V for the atmosphere, because atmospheric pressure remains constant. Now, delta V for the atmosphere has to be calculated carefully because this piston assembly moves down by 2 meters. That means, the volume occupied by atmosphere decreases on this side and it increases on this side. So, delta V on the A side actually is negative delta V on the B side is positive for the atmosphere. So, we calculate. So, delta V on the A side is minus 2 times A cross-sectional area on that side, because the piston moves down by 2 meters and delta V on the B side same height times the cross-sectional area with the positive sign. So, the work interaction for the atmosphere comes out to be minus 786 joules, which means work is done on the atmosphere. Now, the piston work comes out to be positive based on the elevation change because the piston moves down. So, which means that there is a reduction in potential energy of the piston, which means the piston is doing work on these aerotics or whatever it is interacting with. So, that is plus 200 joules. Now, if I consider the air in B as my system at any instant, I can apply first law to the air here and write like this for a differential change. Here we are using the differential form of the first law because we are applying it at an instant. De equal to du no change in ke or pe equal to delta q minus delta w, delta q is 0 because B is insulated as we already mentioned and the only form of work is displacement work. So, minus P dv. Now, if I substitute for du, I can write it as mcv dt and this may be written as in terms of specific volume as minus m times P times dv. Rearrange and integrate. We finally, get this equation which describes the process undergone by the air in cylinder B, which is simply nothing but T times specific volume V raised to the power gamma minus 1 is equal to a constant. So, this is the equation that describes the adiabatic fully resisted process. Remember the air, the cylinder and the piston are insulated on the B side. So, and the process takes place slowly. So, the process undergone by air in the B side is an adiabatic fully resisted process, which is described by this. So, I can calculate the final pressure in B using this equation. The final volume is V initial volume minus 2 times the cross sectional area. So, we get the final pressure in B to be 442.84 kilo Pascal. Final temperature in B may also be evaluated using equation of state as 327 Kelvin. We know the final volume. We know the final pressure. We can easily calculate the temperature. Now, if I apply first law to the air in the cylinder B, remember previously we applied first law to the air in cylinder B at an instant. So, we use the differential form of the law. Now, we are applying first law to the air in cylinder B for the entire process. So, we write delta E equal to delta U equal to Q minus W. And so, the displacement work for the air in B comes out to be minus 2923 joules. Clearly work is being done on the air in cylinder B and the magnitude is 2923 joules. Now, I know the final pressure. We have already calculated the final pressure in cylinder B. So, using our force balance equation, I can now evaluate the final pressure in cylinder A. In the beginning, we use the force balance equation to calculate the initial pressure in B. Now, we are using the final pressure in B to calculate the final pressure in cylinder A and that comes out to be 258.7 kilopascal less than the pressure in cylinder B. The final volume of air in cylinder A is higher by 2 times the cross sectional area because the piston assembly moves down by 2 meters. So, that may be evaluated quite easily. And using the equation of state, we may evaluate the final temperature of air in cylinder A to be 458 Kelvin. Now, if we apply first law to the air in cylinder A, we get delta E equal to delta U equal to Q minus W. Q is not 0 here because we are supplying heat to the air in cylinder A. So, we can rewrite this expression as delta U A plus W A. Notice that the work interaction for the air in cylinder A plus work interaction for air in cylinder B plus W piston plus W atmosphere is equal to 0. So, if I take the air, then the work done for the system plus work done for surroundings is 0. For the air in cylinder A, surroundings it is interacting with consists of air in cylinder B, piston plus atmosphere. So, the sum of all this is equal to 0. So, I can replace W A with a negative of W B plus W piston plus W atmosphere. Substitute the values, we get heat supplied to be at 26.315 kilojoules. The problem is involved, but conceptually not very difficult to follow. You need to do this systematically, identify the system, apply the first law, use the equation of state and then proceed based on the information that is given in the problem.


My name is Rocky Mesa. I'm Gavin Wohl. And we're here to talk to you about FormBuilder, or hey, look what you can do with Wiggy and the tree model. We work at FusionBox. FusionBox is a Django web development agency in Denver. At FusionBox, one of our open source projects is Wiggy. Wiggy is a content editor that we made in response to some of the problems that our clients had, that we've been seeing with our clients. It's a drag-and-drop editor for tree structures. So a problem that we've encountered frequently is a client is asking us for the ability to dynamically create a form on their website without any programming. So they want to specify what fields they want, they want to specify validation for those fields, and they want to control what happens when the form submits. So we've actually built a bunch of these form builders for clients before, and every time we do it, we would run into some problems. So if you wanted to have different models for different types of fields, it doesn't work really well with just what Django gives you. If you want to have an input and a drop-down, those have different fields, but you have to put all the data in one model, and then it's kind of gross ordering. You can do that with something like the inlines and Django Admin Sortable, but it limits you to just having one model. And then on top of that, for example, one time we had a client that had a field that referenced an image, and they needed the image to be inside of the form so that they could refer to that image. So it's kind of hard to have non-form content inside your form when you can only deal with one model. And on top of that, when you're done, when you've made it, you can't really package it up and put it on PyPI because it's not extensible. If anybody wants to add a field type, they have to edit your original field model. But that was before Wiggy. Wiggy's data model is a heterogeneous tree. What that means is it's a tree where the nodes can be different types. That's implemented as a tree-beard tree of nodes, each with a generic foreign key to their content. In addition to the data model, Wiggy also provides the UI for manipulating that tree. We built a drag-and-drop editor to edit the tree data. So how does Wiggy help with this? Let's look back. Here's the reasons why it was kind of hard, and a good form builder would overcome these, ordering forms, mixing different types of fields, having non-form content, and being sensible. So if we look at ordering forms, Django TreeBeard gives us this, and Wiggy gives us an editor for it. So it's already done, we don't have to think about it. The generic foreign key allows us to reference any type of content, so we're now able to use a different model for each of our fields. Interespressing non-form content? Just like Gavin said, we can use any model, so we can add images and videos and Google Maps, and we just do it. Since the generic foreign key is able to reference any model, sometimes you want to limit that. So Wiggy provides a compatibility system that allows you to specify which tree relationships are possible. So if you want to add a new field type, you can write a model and then specify that it goes in a form, and now Wiggy is able to add that field to a form. So we went ahead and built a form builder with Wiggy, and you can see it right there. You've got different types of form fields, like choice field, form input, file upload, and you can just drag them and drop them. Interespressed non-form content. It's got a form wrapper widget, and that form wrapper widget has got a cool method called get form, which returns a Django form class. So you don't have... Everybody's familiar with Django form classes. You can just use that, but the user built that form instead of a programmer. And here's what it looks like on the front end. So the user has complete control over this form. Thanks, guys. We're out at... We've got a booth over there, and we've got these links. They should look at wiggy.g. There's a demo, and it's on GitHub. It's open source. It's on PyPI. Thanks, guys. Come talk to us if you have any questions. At DjangoCon US last year, I launched the B-Ware project. B-Ware is an umbrella project. I've been running in what I laugh and refer to as my spare time, in which I'm hoping to collect a bunch of useful graphical development tools for testing, coverage, debugging, the sort of things that we do in a day-to-day life as Python developers. The cornerstone of B-Ware at the moment is Cricut, a graphical tool for running your test suites, including Django test suites, and enable you to navigate the whole testing process. But since last year, I've been a little bit quiet. Well, what happened? I'm still passionate about graphical tools and having good tools for development, to support development, but I've hit a few road bumps. Most notably, I was using TKinter to develop these tools, and TKinter doesn't have a web widget or, you know, a web view widget, which is kind of a big thing to be missing in 2014. So I started looking around at my options. There are lots of options out there, but none of them really work out of the box really well with Python. QT works nicely, but it's huge, and the Python libraries have this really weird limbo-state licensing problem. WX Windows is really annoying to install. GTK's support for OSX is RunX Windows. Kivi does cross-platform, but it uses themes, and I really hate themes. So this was very rapidly becoming a yak for me. I've got things that I want to do, but I need a widget toolkit that meets my requirements. So about the start of this year, I started shaving that yak, and about a month ago, I publicly announced Toga. Toga is a cross-platform, 100% system-native, Python-native widget toolkit that's installable using PIP install Toga. What does all that mean? Well, it's cross-platform. I've got it running on OSX, I've got it running on Linux, on Ubuntu, and I've got some preliminary support for Windows as well. It's 100% system-native. It doesn't use a theme to pretend it's rendering system-native widgets. It uses system-native APIs to render system-native widgets. So a button on OSX is an NS button. It looks like, behaves like, acts like an actual NS button. On Ubuntu, it's a GTK.button. These are accessed either using the native Python APIs that exist or a C-type binding to the system binaries. But because the system binaries are always there, you don't have to compile anything to get them. It's also Python-native. Python-first and Python-native. And Python-native. Because I'm developing it in and for Python, it means the APIs feel Python-native. So you can do things like, have context managers. And, for example, if you've got a long-running action that is stimulated in response to a button press, most widget toolkits coming from a C heritage will tell you to spawn a thread or create a callable that's then put into a timer method that you inject into an event loop. In Toga, you just yield. Python gives us the ability to yield and a long-running event handler can yield back to the main event loop. There's no timers or callback threads required. It's a pure Python app, so there's no binaries to ship with it, nothing to compile, no compiler required, with one small caveat on Ubuntu and virtual environments. The installation process is pip install Toga and off you run. So how mature is it? Well, it's only had six months of spare-time development, but here is a simple Fahrenheit to Celsius calculator running under OSX. And here is the same user interface, running on the same code, running under Ubuntu. I've done the most work on OSX, so the widget support there is at the point where I can mock up the full cricket user interface using Toga. And the original source of MyAC, here's a really dumb web browser written in 35 lines of code. It's got a little bit of documentation. This example is part of that documentation. There's obviously a lot more to go, and there's a basic tutorial. Oh, and one more thing, writing a new GUI toolkit is all fine and dandy, but it really is a bit pointless if it doesn't support all the hot platforms that everyone is using today, and that includes mobile platforms. So I ported it. Here is the same Fahrenheit to Celsius calculator running off exactly the same source code, running natively on iOS. To be completely clear, I'm using iOS widgets on an iPhone from Python Source, using exactly the same Python Source that the desktop application used. Unfortunately, it doesn't work on Android yet, but I am working on it. I'd love to talk to anyone with Python on Android experience about what might be possible. There's also a template project out there if you happen to want to develop a Python app and not use Toga or use some other project out there. So if you want details or anything else about Toga, go see pyb.org. I'm going to fund some further development on this with the intention of turning it into something you can actually use for serious professional enterprise development. If you or your company think you might be interested in helping to fund that development, paying for commercial support maybe, or otherwise getting involved, please get in touch. Thanks very much. The unenviable position of following Russell. Very charismatic. So my name is Dan Watson. I'm going to be talking about a little library I wrote for interfacing with PGCrypto. PGCrypto is a Postgres extension that basically lets you encrypt data inside your database using AES or Blowfish ciphers. So why would you want to do this? I mean, the most common reason is you have some sensitive information that you want to encrypt in your database but still want to be able to search on in your ORM in Django. I also have a couple functions that might be useful if you need to deal with ASCII Armor, which is a OpenPGP message format that we're dealing with block ciphers. The Lola VoIPI, which is basically a collection of Python functions for dealing with PGCrypto, you can see if you're using PGCrypto the SQL, you just encrypt data using a key file or a key string and a cipher, and that's what you get back and basically doing the same thing in Python using PyCrypto and a couple utility functions in my library, you basically get the same data back. So you could also do the same thing with ASCII Armor, which is basically a fancy name for, again, OpenPGP message format. You can take that same encrypted data and call Armor on it and you get back this text string where you can actually store basically the binary data in a text field instead of a byte A or whatever you want to store it in. So using the PGCrypto.Armor function, it's basically the same, same message back. I guess the real meat of this is doing it in Django. You might have a Django model for an employee, say you want to store a social security number, salary, date hired, and you don't want these things to be human readable and you don't want to say transmit your key over the network when calling into Postgres. So here's an example model with some example data and you can see when you get back the model instance and try to access an encrypted field, it's decrypted kind of transparently. With Django 1.7, the Custom Lookups are awesome. If you haven't played with them, I highly recommend it. You can now query encrypted fields in the database as you would normal fields without having to pull them into Python first. So you can filter on social security number or you can do date hired less than and salary is greater than and you get back query sets. And you can see the SQL for that actually looks like all the decryption and conversion to ASCII Armor is done on the database side, so you don't need to do Python processing for it. That's pretty much all I have. If you're interested in talking about it, find me later. Here's a couple links for padding information, OpenPGP and PGCrypto. Thanks. So here we have some model in this case in NSF which is for the whole U.S. and how as for some other foundations on for the state of some model, like the state of Oregon and the state of some model in Brazil in the southeast part of the country. So here we have it's good, but it's okay. Here we have the second result of search for scholarships the user is searching for Alzheimer's disease and it has done more than 200 results of scholarships and research grants and on the left we have the facet and in the facet we have the multi-level, so each bold one is a category and inside of each one there is a for instance in that case a few thousand knowledge and we have four items of astronomical science and so on and each of these have one hierarchy so in for instance we can have on the left the health science and inside of the health science we have collective health then it's pretty medicine nursing and so on but in Portuguese everything is translated actually we have in Portuguese and everything is translated into English and we have the same hierarchy and this is the same idea the user can select many of them, many of the facets at the same time which is a problem and what I'm going to show you guys is the main changes we can do to your haste implementation in order to accomplish this kind of thing so for multi-level facets you can choose each one you want on all of them you can get a free flight showing you guys and implemented but for multi-level first we have like a facet A which is at the top of the category and inside of that we have a B, C and B and for that we have a map my search app and the search index is .py which is the common file for haste and we are doing the main one is the area which is the multi-level field and in the schema xml we have over declaration we are using the type of the standard map which is like for folder hierarchy usually in the sort of implementation they explain this like this but we are using in a different context so which is not a problem we are using that slash in the prepare area to make the hierarchy and we have all the the area search for query for filtering the user what he has selected for mode select we are using the DAG EX for exclusion in solar they have also in their documentation probably they don't have this in haste because these only work for solar and not for the other ones that the haste works with and for that we use the EX DAG for the clarity facet and when you are going to narrow it down you use the DAG the TAG with the same name in this case UIS and then narrow it down in this case I have cut voltage the search with area search exact B or area search exact B and then you get as it counts show exactly like the last part of the slide when you get the seven results also the other counts for the other areas in that facet and on the plane wall you do all these but using a surface in each view determine which one is Portuguese and which one is English and for that it's good because it's only English Portuguese but if you are from a UIS also feel like that it's good to be a mess so if you have a bad idea just come to me and talk more about it I'm Smith I work at Tivix small Django consulting company based out of San Francisco Jeff gave a really good talk I think on Tuesday on Ansible so I just wanted to build on that finding and best practices that I've been using so some background what's the need you know as a consulting company we get projects and we want to get up and running very fast as fast as possible anyway you know the project goes into production after months of development while the staging environments out of sync while someone knows which packages to install etc etc so that would be nice to not panic and then you know sometimes you have a code branch you just want to set up an entirely separate environment where you can run a branch with your code base and show it to the CEO or the client or whoever you know it is and I know if Roku supports it really well but you know if you're an AWS or Linux or Rackspace it's somewhat of a pain so while Ansible we really like the philosophy behind it it's agent-less so if you like fabric you'll definitely or you might like it batteries included you know tons of modules so you don't have to scholar or get help to find the right module you need or may need etc so they have a certain list of options you can write your own obviously lots of releases 7000 followers on github you know that's my unscientific way of finding out what's good or not chef has 3000 by comparison the company behind Ansible is raised $6 million so that you know it's only going to get better and better over time technically speaking why would you want to use it configuration management you know what packages my server needs things like those orchestration and deployment you could potentially just ignore orchestration and deployment just use it for configuration management along with fabric and I'll show you examples the core concepts there are lots of them so I'm just going to skip over in a nutshell the 3-1 3 are playbook, play and tasks at a very low level a task is the sort of granular thing that you see in yellow this is off from their video so some gotchas and best practices you know where do I put my Ansible code so we've gone with you know the directory structure on the left which you see you know high level there's a very good file author's license Ansible client in Django project name singular client or frontend code Django's your Django project and then there's Ansible directory underneath Ansible you'll see you know there's dev and staging and production those are basically the inventory files the big directory note there is the roles and that's the key you don't want one giant Ansible file you want to basically follow this kind of structure and have things in roles what's inside roles so yeah so that's the directory structure the middle one is basically the roles so Django, Python, USB, virtual and these are very composable roles so you could swap out USB for ginucon not a problem so just get the ginucon role you can swap out nginx or apache swap it out, virtual envir is its own role anything under Django will basically be very Django specific anything under virtual envir will be virtual envir specific if you're using flash you can ignore the Django role et cetera et cetera so you can basically build these roles and within these roles as you can see on the right under the USB role there are handlers, tasks, templates and wires I can't cover all of them but the main one is tasks the templates are basically very interesting there's the uisgi.ini template instead of having different templates in your code base for staging production et cetera you can have one template it's a ginger template as you can see and then use variables so what are some of the best practices user modules they have lots of modules I've mentioned some of them here pip and Django managed being the two ones what are the alternatives you could use the shell and command module and then go a while but then you'll end up doing basically all of these things so you might as well leverage the modules that they have they're pretty flexible here's the Django managed modules for example you can specify the app path, the virtual env the command and also the settings you want to use and as you can see I'm using variables here so there's almost nothing here that's specific to dev staging production or any other environment use variables there are group variables, there are environment variables there are lots of variables it'll save you a lot of time so if you're actually changing your code or anything all you have to do is add another file or two and then you're good to go so as you can see I've defined where my virtual env is it might be different from dev versus production so you can accommodate for that use templates don't have multiple files for your uvizgi or your apache or nginx settings, etc use templates and these are ginger templates and they get compiled and put in certain places in runtime, use facts this is a great ansible it's basically when it connects to a server it gathers facts so for example in your nginx settings you don't want to hard core the number of processes or listeners, it's just based on the server so if you're upgrading your server these will automatically change you can still leverage fabric so for example we want to have a fab bootstrap command where we bootstrap our local development system so you could still use fabric but underneath it's calling that big ansible command which you never want to call by hand the same thing you can deploy by fabric but it's hidden in your fabric file you still continue staying fab staging launch and it will launch through fabric launch through production this github repository there is really nice some other articles, there's analysis by Lyft why they're developed with stout stack sadly and that is the end and that's where the presentation is thank you very much I'm going to tell you about this thing called Hendrix it's a framework for deploying Django apps that was developed by these people right here at this company called realio.com where it is currently being used in production I'm here because they hired me to implement some asynchronous stuff and celery and when I got to work that guy Justin over there basically threw himself in front of me and was like don't do celery try this instead and I was like are you crazy so I did and now I'm converted and I think everybody should know about this thing so Hendrix it's basically Django plus twisted that's the idea with the name or so I've been told what is it it is essentially it goes in the pipeline where you normally use unicorn or you whiskey however you say that and it is a twisted wrapper for that process using green or whatever it is that you whiskey does it uses twisted to handle that whole thread pool et cetera if you don't know what twisted is from their web page it is an event driven networking engine written in python and it's really amazing the more I learn about it the more impressed I am so easier Django development and deployment with benefits why is it easier with little things like when you're running the dev server you don't have to do that if debug then serve my statics from here Hendrix has a nice little way of doing that you also don't need sim links for your admin anymore it just works now which is kind of nice and another bonus is that you get you can just make a self sign certificate and run SSL right there in the Django dev server very handy sometimes in production because twisted has its own thread management you don't need to do your like unicorn how many workers confile stuff like that so we have a little up start config that you can just it's actually made for ansible so it has like the template brackets and you just use it in ansible pops it in the right place and you can just do a typo right here it should be I think it's Hendrix start I don't remember it's basically an Ubuntu service thing there should be a pseudo in there too so but the good stuff is really what twisted brings to the table by running a Django app in Twisted at Django I've seen a lot of people with a lot of different ways for dealing with some of these problems that Hendrix really kind of has for me solved web sockets deferred threads that normally stuff that you don't want to run in the request cycle you can just defer it do it over here don't have to use celery all the time asynchronous IO for doing well let me just go through some examples web sockets real time communication you can do chat clients our chat servers you can do I did some games like it's super fun you can write to your e-mail and then you can go to the page and click on the Brem right there in socket call and you don't have to run note which is kind of nice sometimes here's a little example of doing a deferred thread like this is a pattern I see constantly where you want to send an email the right way to do that is usually to have celery do it so that the user doesn't have to wait for it but now you can just in a separate thread, go back to the user instantly. Yeah, so I still have an installed celery at Relio, strangely. This use case is where you have like, you have to go hit some API, it takes a second or two. You can basically set them all up instantly and then you're back to doing something else. It's a little callbacky, but it's something that you have to get used to once in a while. And the basic functionality, which is serving your web app, it's a little bit scary doing something totally that nobody else seems to be doing, but so far, so good. And one of the reasons that we wanted to show everyone is hopefully someone will find some problem with it before the wrong time for finding problems with things. In the future, it's still in development. We're kind of trying to solidify some conventions, get some tests going, prove that it really is a viable way to do things, because it really does seem too good to be true, and some little details are still being refined. We'll have the read me tidied up by end of day today, I promise, and oh good, I'm almost done. Pip install Hendrix, and that's it. Thank you. So I'm also from Tivix, and at Tivix, we've had a number of projects over the past year and a half where we've been using Django and AngularJS together to come up with single page apps. And so I wanted to take a few minutes to just sort of share some of our insights and what our experience was in putting that all together. So just wanted to say thanks to Nina for her talks on Django REST framework and AngularJS earlier this week, and we'll move on. If you wanna follow along, it's public slides, you can go and visit them now. So AngularJS and Django work really, really well together, really like it, but you really also need to keep their roles well defined and separated. We had started with a sort of mixed configuration where we had Django templates and pages actually driving the AngularJS implementation, and that was kind of messy and difficult to really organize and have working productively. We then progressed to a website where it primarily just consumed JSONP content from a TastyPy API, and that was better, but as I'm sure you're all well aware, JSONP has some rather significant limitations, so step in the right direction. But what we ultimately settled on was actually using Django REST framework to provide all the content and interactions between the website and Django.  So yeah, going forward, we're only using Django REST framework and AngularJS in that configuration. They are completely separate. We just have the calls back and forth. We do not have Django defining any templates up front. The single page app is just a collection of HTML files and assets that have been optimized. So how did we get there? We've been treating AngularJS as a platform, so think of it as like you're developing an iOS app. You don't go into developing an iOS app by saying, now how am I going to have Django generate my views and controllers and all of that? Think of them being completely separate. As a result, you need to utilize separate tools from Django and Python. So for us, we've been using Grunt quite extensively as well as Yeoman. Furthermore, if you're going to be building an API for mobile apps or for your website, just do that all upfront when you're going to put together your single page app. Don't put it off. Don't put off aspects of it. Make sure your API is all fleshed out. You've got validation and everything can be done from there. You'll really reap the benefits later when you do go to mobile and it's all ready to go. So this is a quick diagram of our stack that we utilize to develop and deploy Django REST framework. We use Nginx in combination with AngularJS, Yeoman, Bower. That all goes towards the end result, which is this nice and tidy set of assets. So during development, what we'll do is we'll use Yeoman to actually scaffold out the project. This is nice as a good way to avoid StrangularJS, which is to let Yeoman make opinions about how this should work upfront. Defer to its directory structure, utilize the Grunt job that it has set up, and just once again avoid mixing Django and AngularJS. Just keep them separate. We moved on to using GruntServe to actually manage them in parallel, and that got messy because we had cores, and we also had to write code that accommodated that. That wasn't great. So we're just serving it as static content on the same domain, and that works nicely. There are some caveats, but not a big deal. Deployment, once again, don't use Django to deploy it. Use Grunt and Gulp to actually build and deploy the assets and utilize those tools as much as possible to crunch it down. So if you want to check out some code we've written, we're at github.com slash tivix. We've written Django rest-off, which integrates the authentication tools with Django in a restful interface, as well as an AngularJS module that interfaces with all that nicely. So once again, there's the URL for the slides, and thank you for a great conference.  To my way of thinking, it sucks primarily because it still thinks of itself as an Apache plug-in rather than a Python library. This is evidenced most clearly by the configure method of the lazy settings object. So what is the unsettings project? It's an effort to change project-wide settings from a globally incorporated single entity, Django.com.settings, to a set of individually injected objects configurable with a diverse and flexible variety of patterns. Here's a quick example. This is how you send mail with Django, right? An exceedingly simple task that Django happens to handle beautifully. Here's the documented approach. Import send mail and call it with its common sense dependencies injected. Of course, when we try to do that, we get an error because we haven't supplied the back end as a card to the function. Now in Python, this is called type error, or maybe in some cases attribute error. But in this other language called Django, it's improperly configured. This already betrays the underlying thinking on the matter because Django doesn't and can't know whether I've actually configured an email back end. It only knows whether I've supplied it to the function.  So I do. You can see here that I also specify a file path to avoid getting another improperly configured. This isn't documented, but it actually works in the sense that allows me to instantiate and obtain the back end object. However, even with a properly instantiated back end object, watch what happens. This is the end of the road. I can't tell send mail about default char set, and since I haven't run settings that configure, my logic is essentially being rejected at this point. I can go no further. Now I don't know about you, but I run into this problem constantly. It's especially burdensome for a project like Hendrix, which Jayman just talked about, because the Hendrix tries to import Django and feed it to its own APIs, which is a perfectly reasonable thing for a Python library to do. Now it might be an apt metaphor to think of on settings as the third and final phase of Django's puberty. Prior to magic removal, Django was a child. Starting at about 1.4, it experienced a sort of adolescence, and now it's truly coming of age, right? The first step is the custom off that user model that shows that Django cares about its people. Then migration shows that Django cares about its people's right to change our mind. On settings shows that the Django tribe does not treat its project as an Apache plug-in, but as a feature rich Python subculture. So what's the current state of on settings? In addition to myself, the project has two other active contributors, both of whom are very talented and thoughtful Pythonistas, Skyler DuVeen of WNYC and James Farrington at Slashroot. We've developed a decorator called Uses Settings. When applied to a function that uses the setting singleton, it allows injection of that setting as a quirk instead. Simple. Now how many of you have written parts of Django's internal APIs that use the setting singleton? A small number of us, right? Those of you that aren't raising your hands will experience no change of behavior whatsoever from the implementation of our decorator. Now for those of us that are raising our hands, the Uses Settings decorator is actually a relief of many of the pains of maintaining and testing APIs that require settings. Together we crafted a pull request of 78 commits that indicate our vision for the implementation of this decorator. Of these, we think eight are ready for review today. If these eight are merged, you'll be able to call, send mail, just as I tried to do, without raising an error. Now, the reasons that I think that this is really important is, of course it removes burdensome import logic, allowing you to send mail. Great. But it's also a signal to the Python community that says we are you. We're a Python library. We're a Python project and we appreciate the norms of the larger Python tribe. More importantly than that, it's a signal to new Django contributors that says your work belongs here and it won't be locked away behind our configuration drama. There's a lot of Python developers with incredible logic to contribute to our project. And if they know that contributing it to our project means that anytime they wanna use it, they have to negotiate with the setting Singleton, they might be less inclined to. And there's plenty of other projects where their logic can go.  I was on Alayna's Django news podcast about at PyCon. Give that a listen and you can learn more obviously that I can tell you in five minutes. Look at our poll requests to see what you think. Work on on settings at the sprints. I'll probably be working on it at least a little, although I'll probably also work on Hendrix. Think of Django as a community and a movement, not just a product. And see if that starts to subtly change your view on the matter. And lobby your core team. Not that long ago, this was what felt to me an awfully controversial idea but I'm now slowly hearing members of the core team, I think, tell me that they're coming around on it and starting to see that this is a viable way forward. I'm really hopeful that it is and I do intend to keep working on it. Numbers, the first and second phases of Django's puberty as I call it are some of the finest work by Russell Keith McGee and Andrew Godwin that I've seen in the open source movement. I'm Justin Holmes. My email address is justinatjustinhomes.com. My GitHub is github.com slash jmiles. This presentation was made with a little thing called Wheelman, which is a coffee script library for creating presentation through, persuasion through the scroll wheel for you to check that out as well. Thank you very much. So form factor. Form factor is a mobile data collection platform. What actually is that? It's a Django powered platform for easy collection and submission of data from any device. So think of a field worker who needs to, on their daily tasks, they have to submit a form. They go from house to house. Form factor would allow them to do that from any device which we'll get to. So how's it built? You build a form with Django. You define what your form is and then using a Rust framework through a set of APIs. Different forms are made available on any different platform and these are the keyword. They're being native forms. So simply define a form on your server with Django and then expose that and you'll have, using our iOS, Android and future JavaScript library, you'll see a native form render. So what was the challenge and why did we do this? Why not just simply create an HTML form and then simply render it in a web view on iOS and Android and the reason for that is we wanted that kind of native field. The real problem is these people need to submit data, right? So it needs to be as seamless as possible. It can't be kind of a janky experience which we've experienced on HTML5 and using phone gap and whatnot. So these are all native forms and we didn't want to reinvent the wheel. We're constantly building forms and as you guys know, building forms are hard. You have to have custom validation for each field and it takes a lot of time. So we wanted something out of the box that you could simply just define, build it once on the back end and then all the different clients listening will seamlessly update. This is a bit of the modeling. So as we were building this, we thought why call it forms? Because we wanted forms to refer to some other piece of data we have. So we thought a bit more generic and why not call it entity? A form is just a representation of that entity. So I'll get to a demo in the end but an entity is something you actually define. It's a thing, right? And then there's different entity attribute fields and these each are different types. So your text field, select field, related and your actual data is an instance. So these instances related to entities and then instance field will generic farm key to a entity attribute. So that was kind of a form factor platform I just discussed but a lot of the core of what we used to build it will be open sourcing and that will be Django app with that allows you to create new entities and then REST framework APIs allow you to create and edit these instances of these entities and then iOS and Android code base that are hooked up with these with API so you can simply just plug it in and start using it and then as you can see we have kind of a internal debate going on what we're gonna use for the JavaScript framework. And what you guys can use to use a simple contact form, right? If you had an Android application, iOS application, you could simply just pull in our libraries and pip install this form factor library and you're pretty much good to go. So it's really that simple. You could build your own form factor or whatever else you want. So quick demo of it. Though this is me actually defining an entity right here. So let's give person a first name and all your validation you can actually define right here and the mobile Apple dynamically picked that up. So now the entity ID is 27. So this is the simulator running.  Simply submit it. No alert but it's there and you can change orders and it will pick it up in that as well. That's great.  I need Jacob Birch. Okay. The Lawrence Journal World Offices in Lawrence, Kansas which is really, really close to the middle of the country and really close to the middle of nowhere. Simon Wilson, Adrian Holivardi and Jacob Kaplan Moss started what became Django. And actually exactly almost nine years ago, a little over nine years ago, Adrian actually made the work they had been doing for the Journal World open source, thereby sort of giving the birth to Django. To celebrate this event, we who are in Lawrence, Kansas are going to be throwing a birthday party. What that entails, we don't know and that's up to you, everyone in the room and everyone in social media who can sign up right now on DjangoBirchday.com. Let us know if you're interested in visiting Lawrence, see a little bit of history and having some fun. If we get a small amount of people, we'll have a little party, we've got a lot of people but they're a bigger party and probably have some talks along with it. So there's the information. You can talk to Frank, you can talk to me, you can talk to Jeff, you can talk to Flavio, all of us are here if you have any ideas for it and we hope to see you in Lawrence in about a year. That's it. Teamux and Teamacil. Teamux is, this is just a tool talk. Teamux is a terminal multiplexer. How many people have used Teamux? Wow, I don't even need to be up here. Well, for the other half. If you have, for those who haven't, if you've used GNU Screen, it's kind of similar to that. And then I'll explain Teamacil after I show Teamux. So, wow, it's so small. So, this is just my eye term. In Teamux, it just allows me to create windows and panes. You can't actually even see the power shelf at the bottom but you can have lots of different windows and each window can have panes. So, I can separate the screen into two panes. I can separate it into three panes, et cetera. And I can also do this on the, I can use it like you use new screen to connect to servers and your session, your SSH session on the server is maintained. So, for example, I can connect to, this is actually one of our production servers. And as soon as I, as soon as I SSH into it, whatever server I had or whatever session I had running before is still there. So, I can go and I can look at whatever I was looking at earlier and kind of, oh yeah, that's what I was working on. That's where the problem was, right? And I use, I just use eye term tabs, as you can see at the top, to kind of have, I use that for separate sessions only, only when I'm connected to separate servers and everything else can exist in Teamux. And then, Teamacil allows you to just kind of save Teamux configuration. So, if I wanna work on a particular project, I just say Teamacil and say I wanna work on my UREC project.  And you can just specify commands that get run in each pane. So, you know, get status, get branches, so I can remember what branches there were, a listing of the directory, et cetera. You can, you can specify whatever you want to run. And if I, let's see, since I can't, oh, so over on the left here is just what the, what a Teamacil configuration file looks like. It's just YAML. And so you, the important part is really the, so root is kind of the root directory, so it'll change directory into that directory in every pane. And then, you just have a list of panes. Oh, you can give it a layout, so if you have a complicated layout, for example, I bought a $300 4K TV that I've been using as a monitor. And it's really crappy in every way, except for the fact that it has 4,000 pixels. And so on that one, I have like this six or eight pane layout. And you just kind of, you can just put that in here and it's beautiful. But as you can see, it's just really simple. I just tell it what commands to run in each pane and it just does it. Thank you. Alrighty, so Carson Bates is a responsive image handler. And we built it at PBS Kits. So around January, we released a new version of our homepage. Pretty fancy, lots of pictures and everything. And it's responsive, so that's good. When you change the viewport, it takes pixel density and everything into consideration and readjusts the layout.  So when you say it's responsive, you gotta take some of this other stuff into consideration. Pretty overwhelming stuff. So in the beginning, we were like, all right, we can use some of these solutions. But the first three, at least, you still have to stamp out those different sizes yourself. The front end piece of it, the JavaScript, and in the case of the picture element, the browser can take care of building the request. So it asks for the right size image. But you still have to make them.  It is, so we built Bates, which is the backend in Django, that does a lot of that automatically. So the other two solutions are actually pretty good. Adaptive Images, it's built in PHP, and it uses a thin layer front end that sets cookie hints, so that the served image will be the right size for whatever user agent detection the cookie supplies. And resource it is also very good, I suppose, and then we used it. I think you have to pay for it. It's a platform as a service that suffers as a service. So here are some of the guiding philosophies for when we built our thing. We wanted to keep the markup as semantic as possible, and we want to not really break anything that you might have on your page, like jQuery and other frameworks and whatnot. And we wanted to be pretty agnostic about what you might want to use as a backend. So if you don't like Django, don't use it, use your own thing, that's cool. Just use the piece of JavaScript to make the request, or vice versa, if you want to write your own front end to do your user agent detection and whatnot, build those rules yourself, use the Django backend as your image breaker, cool. There's the GitHub project, you can check it out. I will lunge and give you a chance to copy it down. All right, so here's the Django backend, you just pip install baits, and here's the admin. There's a couple of things you need to configure. Like obviously you'd have to tell it where to fetch your images from. So there's the notion of origin, and then your image sizes. So that's just a width, a quality, so you can compress it if you want to. And there's a name, short name. So on the front end, the way you would use this is you would include JSONJS, and in your markup, your image tags, instead of setting your source attribute, you're gonna set something called data Carson source, and that URL is built from a combination of the namespace, which is the origin that you just set in the Django admin, and the other thing you just set, which is the, sorry, and the other part of this is the image path. So in other words, in your origin is where you specify the domain, in this case for PBS Kids, it's a kind of delivery network. But after that, what's the path that comes after? That's this part. So the other attribute Carson size is the image profile that you define in the admin. So, you know, script tag can include Carson, and there's a method called init in the Carson object. Right now it's in the pbs.kids namespace, but we're probably gonna factor that out. You just initialize it whenever you want to. In this case, it's on document ready, but whenever. Other, some other features that are in here, there are two built-in sizes, so that mezzanine is the source size, and none is just, I don't want to serve this image at all, because I wanna save bandwidth. Rules, so sometimes it's useful to determine the size of your image in data Carson size dynamically at runtime. So you can do that with a callback, it's just the function that you can supply to do that maybe based on some user agent detection or capability detection. Event hooks are nice, so when image is low, you wanna control how it's presented to the user, so maybe it's kind of faded in and whatnot. Carson done is the same thing before all of the images, so maybe you want them all to fade in at the same time when they're done loading. The trade-off is now you've gotten rid of browser prefetch, that optimization in your browser, where inspects source attributes and gets the images beforehand. We don't have that anymore, unfortunately. Run that better documentation, we're working on it. There's a get-up pages. Picture support, I'm out of time. Picture support and ad hoc sizes. Can't take it for questions, thank you. So tomorrow we have the sprints and people are generally advised not to run before they can walk, which is a shame when other people are sprinting and you want sprint too. So don't worry about what people say because like other people, you're probably full of good ideas and have solutions to problems and want to collaborate and contribute to what we're doing and we want you to. But too often people lack technical expertise or they lack the collaboration expertise or they simply lack the confidence to become involved. And these are barriers preventing participation. People want to commit, but they're not sure how. So the workshop that I'll be running tomorrow on the first day of the sprints, it will run all day, will cover the four key tools that you need to get started and the process itself. And generally I find that even people who are doing this for the very first time and they don't even need to be Python users will normally leave the workshop at the end of the day with a commit in Django's code base. Might be a very small one, but it will be something, you've got a very good chance of something getting in. I'll be there to help you. The other sprinters will be there to help you. Our colleagues in the Django project will also be online helping you. So if you've ever wondered what these sprints were about or you've wanted to commit to Django or another Python project, come along to this. We'll work at the speed of the slowest person which is usually myself. It's not rocket science because rockets are useless in this kind of endeavor. And it'll be fun and you don't need to worry about being the slowest person in the room or anything like that, just come along and have fun. If it's too slow for you, then you can just ignore it and I won't be in the least bit offended if you drop in or out. And you might be able to help people who are going a little bit more slowly than you. So it's all online anyway. You don't have to come to the sprints to do it. There's a tutorial there. There's a repository for it that you can help improve. You can come and find me on IRC or in real life. Drop me a line. Don't be afraid to commit. Thank you. I still have... I had two minutes left. So I'm going to use the rest of my allocation. Now forgive me if you've seen this before. I know some of you have, but I had one original idea in July, in May 2013. I'm still waiting for another one. I'm going to milk this one for all that it's worth because we have to work with what we can get. So, relationships. There are 7 billion other people in this world. Are you sure that you have chosen the right one for yourself? Because right now, there's probably someone out there with whom you would have been happier than the imperfect person you are having an imperfect relationship with right now. What's worse is that your chances of discovering the perfect person are almost nil. Simple arithmetic means that almost any choice you'll make is the wrong one. And also that you will fail in any attempt to make a better choice. So stop worrying about making the right choice. Instead, commit to what you have already chosen and develop it into the best possible relationship for you. And the same goes for your relationship with the software that you work with. Because there are 7 billion web frameworks and languages and platforms to choose from. And anyone that you choose will probably be imperfect and the wrong one. So stop trying to make the right choice and instead commit to the project you have already chosen. And help turn it into the best possible one for you. Thank you. Okay.