text:
<ymp_presentation>
	<ymp_slice>
		<ymp_param_istitle>true</ymp_param_istitle>
		<ymp_title>Equilibrium Calculations: Intermediate values of K</ymp_title>

		<ymp_idx>0</ymp_idx>
		<ymp_xAbsolute>25</ymp_xAbsolute>
		<ymp_yAbsolute>0</ymp_yAbsolute>
		<ymp_xOffset>0</ymp_xOffset>
		<ymp_yOffset>0</ymp_yOffset>
		<ymp_tc>00:00</ymp_tc>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>1</ymp_idx>
		<ymp_xAbsolute>80.45</ymp_xAbsolute>
		<ymp_yAbsolute>118.3</ymp_yAbsolute>
		<ymp_xOffset>489.4</ymp_xOffset>
		<ymp_yOffset>47.3</ymp_yOffset>
		<ymp_tc>00:01</ymp_tc>
		<ymp_txt>In this library entry, we consider a specific case of the following general situation: We mix together some chemical solutions, such that we know the identities and initial concentrations of the chemical species in solution. We also know what reaction is taking place and the equilibrium constant K for that reaction. Our goal is then to determine the concentrations of the chemical species in the solution after a long enough time that the concentrations reach steady state. </ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>2</ymp_idx>
		<ymp_xAbsolute>221.85</ymp_xAbsolute>
		<ymp_yAbsolute>155.85</ymp_yAbsolute>
		<ymp_xOffset>274.8</ymp_xOffset>
		<ymp_yOffset>40.6</ymp_yOffset>
		<ymp_tc>00:03</ymp_tc>
		<ymp_txt>See [insert link to future library item] for a qualitative discussion of reversible reactions and chemical equilibrium. That module shows that a system reaches equilibrium when the reaction quotient, Q, becomes equal to the equilibrium constant K. In this module, we discuss how to use the fact that Q=K at equilibrium to predict equilibrium concentrations.</ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>3</ymp_idx>
		<ymp_xAbsolute>79.85</ymp_xAbsolute>
		<ymp_yAbsolute>220.45</ymp_yAbsolute>
		<ymp_xOffset>463.4</ymp_xOffset>
		<ymp_yOffset>75.2</ymp_yOffset>
		<ymp_tc>00:05</ymp_tc>
		<ymp_txt>The example we'll consider is a solution that has these concentrations and undergoes the given reaction, for which the equilibrium constant is 19. </ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>4</ymp_idx>
		<ymp_xAbsolute>77</ymp_xAbsolute>
		<ymp_yAbsolute>310.3</ymp_yAbsolute>
		<ymp_xOffset>370.9</ymp_xOffset>
		<ymp_yOffset>38.1</ymp_yOffset>
		<ymp_tc>00:07</ymp_tc>
		<ymp_txt>The reaction is reversible, meaning both the forward and reverse reaction occur simultaneously. At equilibrium, the rates of the forward and reverse reaction become equal such that the concentrations of the chemical species reach a steady state. This steady state is reached when Q = K, where Q for this reaction is as shown here.</ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>5</ymp_idx>
		<ymp_xAbsolute>74.55</ymp_xAbsolute>
		<ymp_yAbsolute>367.1</ymp_yAbsolute>
		<ymp_xOffset>430.1</ymp_xOffset>
		<ymp_yOffset>107.2</ymp_yOffset>
		<ymp_tc>00:09</ymp_tc>
		<ymp_txt>We'll begin by shifting the reaction by various amounts. Our initial concentrations correspond to Q=0.055. This is considerably smaller than the equilibrium constant, K=19. The reaction will therefore shift towards product to increase Q towards 19. </ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>6</ymp_idx>
		<ymp_xAbsolute>183.05</ymp_xAbsolute>
		<ymp_yAbsolute>443.15</ymp_yAbsolute>
		<ymp_xOffset>308.1</ymp_xOffset>
		<ymp_yOffset>39.5</ymp_yOffset>
		<ymp_tc>00:11</ymp_tc>
		<ymp_txt>The change in concentrations must obey the stoichiometry of the reaction. The changes shown here obey the stoichiometry and lead to Q=1.0. Although Q has increased, it is still less than K=19.</ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>7</ymp_idx>
		<ymp_xAbsolute>68.35</ymp_xAbsolute>
		<ymp_yAbsolute>490.8</ymp_yAbsolute>
		<ymp_xOffset>421.7</ymp_xOffset>
		<ymp_yOffset>77.2</ymp_yOffset>
		<ymp_tc>00:13</ymp_tc>
		<ymp_txt>In this trial, we've increased the shift by an additional 40%, leading to a Q of 33. Q is now greater than K=19, so we have shifted the reaction too far towards product. </ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>8</ymp_idx>
		<ymp_xAbsolute>498.3</ymp_xAbsolute>
		<ymp_yAbsolute>399.35</ymp_yAbsolute>
		<ymp_xOffset>114.8</ymp_xOffset>
		<ymp_yOffset>164.8</ymp_yOffset>
		<ymp_tc>00:15</ymp_tc>
		<ymp_txt>The reaction will shift from the initial position towards product until Q=K, which will lie between the two trial changes listed here.</ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>9</ymp_idx>
		<ymp_xAbsolute>66.45</ymp_xAbsolute>
		<ymp_yAbsolute>582.8</ymp_yAbsolute>
		<ymp_xOffset>508.1</ymp_xOffset>
		<ymp_yOffset>15.2</ymp_yOffset>
		<ymp_tc>00:17</ymp_tc>
		<ymp_txt>To determine the precise change in concentrations needed for Q to equal K, it is convenient to introduce a variable x that describes the change. </ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>10</ymp_idx>
		<ymp_xAbsolute>84.05</ymp_xAbsolute>
		<ymp_yAbsolute>610.8</ymp_yAbsolute>
		<ymp_xOffset>281.2</ymp_xOffset>
		<ymp_yOffset>77.2</ymp_yOffset>
		<ymp_tc>00:19</ymp_tc>

		<ymp_txt>A single variable, x, suffices because the changes must obey the stoichiometry of the reaction. The change in reactants and products must have opposite sign. (A shift in the forward direction will decrease the reactant concentrations and increase the product concentrations. Similarly, a shift in the reverse direction increases the reactant concentrations and decreases the product concentrations.) Since our initial Q is less than K, it is convenient to put a negative sign in front of the variable x for the reactants. Multiplying the variable x by the stoichiometric coefficients of the reaction ensures the changes obey the stoichiometry. In this case, the (-2x) for L ensures that the change in [L] is twice that in [Fe+³] and [FeL2+³]. </ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>11</ymp_idx>
		<ymp_xAbsolute>193.05</ymp_xAbsolute>
		<ymp_yAbsolute>632.25</ymp_yAbsolute>
		<ymp_xOffset>321.8</ymp_xOffset>
		<ymp_yOffset>53.9</ymp_yOffset>
		<ymp_tc>00:21</ymp_tc>
		<ymp_txt>The resulting concentrations are obtained by subtracting the change from the initial concentrations. These concentrations can then be inserted into the definition of the reaction quotient for this reaction. </ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>12</ymp_idx>
		<ymp_xAbsolute>423.3</ymp_xAbsolute>
		<ymp_yAbsolute>635.4</ymp_yAbsolute>
		<ymp_xOffset>123.2</ymp_xOffset>
		<ymp_yOffset>83.2</ymp_yOffset>
		<ymp_tc>00:23</ymp_tc>
		<ymp_txt>We now have an expression for Q that is a function of a single variable x. Our above two trial changes correspond to x=1.0 and x=1.4. Although we could continue to make guesses at x until we find a value at which Q=K, it is more efficient to solve Q=K for x algebraically. </ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>13</ymp_idx>
		<ymp_xAbsolute>55.9</ymp_xAbsolute>
		<ymp_yAbsolute>753.3</ymp_yAbsolute>
		<ymp_xOffset>252.4</ymp_xOffset>
		<ymp_yOffset>67.1</ymp_yOffset>
		<ymp_tc>00:25</ymp_tc>
		<ymp_txt>Our goal is to find the value of x for which Q=K, since this will give us the change in concentrations needed to reach the equilibrium steady state. </ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>14</ymp_idx>
		<ymp_xAbsolute>85.3</ymp_xAbsolute>
		<ymp_yAbsolute>816.65</ymp_yAbsolute>
		<ymp_xOffset>209.5</ymp_xOffset>
		<ymp_yOffset>112.1</ymp_yOffset>
		<ymp_tc>00:27</ymp_tc>
		<ymp_txt>We begin by expanding the denominator. </ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>15</ymp_idx>
		<ymp_xAbsolute>89.9</ymp_xAbsolute>
		<ymp_yAbsolute>900.2</ymp_yAbsolute>
		<ymp_xOffset>253.7</ymp_xOffset>
		<ymp_yOffset>91.9</ymp_yOffset>
		<ymp_tc>00:29</ymp_tc>
		<ymp_txt>We then cross multiply and combine terms to get a cubic polynomial equation. </ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>16</ymp_idx>
		<ymp_xAbsolute>140.65</ymp_xAbsolute>
		<ymp_yAbsolute>987.1</ymp_yAbsolute>
		<ymp_xOffset>289.4</ymp_xOffset>
		<ymp_yOffset>50.8</ymp_yOffset>
		<ymp_tc>00:31</ymp_tc>
		<ymp_txt>A cubic polynomial has three roots, meaning there are three values for x that will cause this cubic polynomial to be zero. You can obtain these using a modern calculator. (Please see the manual for your calculator.) Or by using the following website: http://www.1728.com/cubic.htm  The results are shown here.</ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>17</ymp_idx>
		<ymp_xAbsolute>450.95</ymp_xAbsolute>
		<ymp_yAbsolute>968</ymp_yAbsolute>
		<ymp_xOffset>73.5</ymp_xOffset>
		<ymp_yOffset>72.3</ymp_yOffset>
		<ymp_tc>00:33</ymp_tc>
		<ymp_txt>All chemical systems we will consider have a single unique equilibrium state. We will therefore always find only one root that gives reasonable results, i.e. that leads to all concentrations having positive values.</ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>18</ymp_idx>
		<ymp_xAbsolute>55.55</ymp_xAbsolute>
		<ymp_yAbsolute>1064.5</ymp_yAbsolute>
		<ymp_xOffset>443.1</ymp_xOffset>
		<ymp_yOffset>139.3</ymp_yOffset>
		<ymp_tc>00:35</ymp_tc>
		<ymp_txt>We'll try each of the roots in turn. For the first root, we can get the changes in concentrations, and the resulting concentrations, by putting x= 3.987 into our table. This root leads to [L] being negative. Although these values for concentrations obey the Q=K equilibrium conditions, we can reject this solution since it leads to a negative concentration.</ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>19</ymp_idx>
		<ymp_xAbsolute>80.5</ymp_xAbsolute>
		<ymp_yAbsolute>1224.8</ymp_yAbsolute>
		<ymp_xOffset>424.8</ymp_xOffset>
		<ymp_yOffset>109.5</ymp_yOffset>
		<ymp_tc>00:37</ymp_tc>
		<ymp_txt>The second root also leads to a negative [L], and so can be rejected. Although these concentrations obey the Q=K equilibrium condition, we can reject this solution since it leads to a negative concentration.</ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>20</ymp_idx>
		<ymp_xAbsolute>77.5</ymp_xAbsolute>
		<ymp_yAbsolute>1345.5</ymp_yAbsolute>
		<ymp_xOffset>396.2</ymp_xOffset>
		<ymp_yOffset>79.7</ymp_yOffset>
		<ymp_tc>00:39</ymp_tc>
		<ymp_txt>The third root leads to positive concentrations for all chemical species and so corresponds to a valid solution. In the table, we have replaced the "result" label with "equilibrium", since these concentrations correspond to equilibrium concentrations. </ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>21</ymp_idx>
		<ymp_xAbsolute>58.3</ymp_xAbsolute>
		<ymp_yAbsolute>1371.8</ymp_yAbsolute>
		<ymp_xOffset>78.0</ymp_xOffset>
		<ymp_yOffset>56.0</ymp_yOffset>
		<ymp_tc>00:41</ymp_tc>
		<ymp_txt>Tables of this type are often called ICE tables due to the Initial, Change, Equilibrium notation. </ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>22</ymp_idx>
		<ymp_xAbsolute>73.8</ymp_xAbsolute>
		<ymp_yAbsolute>1514.5</ymp_yAbsolute>
		<ymp_xOffset>539.0</ymp_xOffset>
		<ymp_yOffset>41.5</ymp_yOffset>
		<ymp_tc>00:43</ymp_tc>
		<ymp_txt>Although all three roots lead to concentrations for which Q=K, only x=1.370 leads to positive concentrations. So we now know that the equilibrium concentrations are those corresponding to this value of x, which are listed here.</ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>23</ymp_idx>
		<ymp_xAbsolute>128.4</ymp_xAbsolute>
		<ymp_yAbsolute>1574.65</ymp_yAbsolute>
		<ymp_xOffset>401.4</ymp_xOffset>
		<ymp_yOffset>40.5</ymp_yOffset>
		<ymp_tc>00:45</ymp_tc>
		<ymp_txt>Since we've done a lot of algebra above, it is a good idea to check our answer. A useful check is to confirm that our equilibrium concentrations obey Q=K. Our concentrations pass this test. If they did not, we could go back and check our algebra to find where we went wrong. [Joe is it possible to embed concept tests in the movie?  If so we'll place one here.. if it would be easier to have 2 movies with a concept test in between that would work as well... Concept test; what if the signs in the above table were changed to (+x, +2x, -x)?]</ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>24</ymp_idx>
		<ymp_xAbsolute>55.6</ymp_xAbsolute>
		<ymp_yAbsolute>1646</ymp_yAbsolute>
		<ymp_xOffset>506.3</ymp_xOffset>
		<ymp_yOffset>33.5</ymp_yOffset>
		<ymp_tc>00:47</ymp_tc>
		<ymp_txt>In the above example, the algebra became quite complex. Part of this complexity was due to the initial position of the reaction. We will now show a strategy that can often be used to simplify the algebra. The strategy is to shift the reaction to a different initial position. </ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>25</ymp_idx>
		<ymp_xAbsolute>65.85</ymp_xAbsolute>
		<ymp_yAbsolute>1699.2</ymp_yAbsolute>
		<ymp_xOffset>517.1</ymp_xOffset>
		<ymp_yOffset>40.7</ymp_yOffset>
		<ymp_tc>00:49</ymp_tc>
		<ymp_txt>For this system, a convenient initial position is obtained by pushing the reaction all the way to completion. (We'll see later why this choice is convenient.)   We'll use the notation Q=infinity to denote this position, since Q becomes infinite when one of the reactant concentrations goes to zero.  </ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>26</ymp_idx>
		<ymp_xAbsolute>92.6</ymp_xAbsolute>
		<ymp_yAbsolute>1752.55</ymp_yAbsolute>
		<ymp_xOffset>339.1</ymp_xOffset>
		<ymp_yOffset>85.8</ymp_yOffset>
		<ymp_tc>00:51</ymp_tc>
		<ymp_txt>To determine the concentrations at Q=infinity, we carry out a limiting reagent computation, as discussed in library item [insert link to ice1_p2 item page].</ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>27</ymp_idx>
		<ymp_xAbsolute>77.5</ymp_xAbsolute>
		<ymp_yAbsolute>1852.4</ymp_yAbsolute>
		<ymp_xOffset>167.8</ymp_xOffset>
		<ymp_yOffset>84.5</ymp_yOffset>
		<ymp_tc>00:53</ymp_tc>
		<ymp_txt>We begin by determining the limiting reagent. We divide each of the reactant concentrations by the corresponding stoichiometric coefficient. </ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>28</ymp_idx>
		<ymp_xAbsolute>154.15</ymp_xAbsolute>
		<ymp_yAbsolute>1920.3</ymp_yAbsolute>
		<ymp_xOffset>86.5</ymp_xOffset>
		<ymp_yOffset>42.6</ymp_yOffset>
		<ymp_tc>00:55</ymp_tc>
		<ymp_txt>The smallest number corresponds to the limiting reagent, in this case L. </ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>29</ymp_idx>
		<ymp_xAbsolute>293.85</ymp_xAbsolute>
		<ymp_yAbsolute>1808.2</ymp_yAbsolute>
		<ymp_xOffset>263.1</ymp_xOffset>
		<ymp_yOffset>78.2</ymp_yOffset>
		<ymp_tc>00:57</ymp_tc>
		<ymp_txt>We next determine the change in all of the concentrations. Since L is the limiting reagent, it is totally consumed, corresponding to a change of -3.0 and a resulting concentration of 0. </ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>30</ymp_idx>
		<ymp_xAbsolute>230.3</ymp_xAbsolute>
		<ymp_yAbsolute>1807.75</ymp_yAbsolute>
		<ymp_xOffset>333.0</ymp_xOffset>
		<ymp_yOffset>161.4</ymp_yOffset>
		<ymp_tc>00:59</ymp_tc>
		<ymp_txt>From the change in concentration of L, we can use the appropriate stoichiometric ratios to determine the change in the other species' concentrations.</ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>31</ymp_idx>
		<ymp_xAbsolute>70.4</ymp_xAbsolute>
		<ymp_yAbsolute>1986.65</ymp_yAbsolute>
		<ymp_xOffset>440.3</ymp_xOffset>
		<ymp_yOffset>137.8</ymp_yOffset>
		<ymp_tc>01:01</ymp_tc>
		<ymp_txt>We now use the Q=infinity position as an initial condition for finding the equilibrium concentrations, i.e. those at which Q=K. Remember, we shifted the reaction to the Q=infinity position so that the Q=K expression would be easier to solve algebraically.</ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>32</ymp_idx>
		<ymp_xAbsolute>243.95</ymp_xAbsolute>
		<ymp_yAbsolute>2094.05</ymp_yAbsolute>
		<ymp_xOffset>182.2</ymp_xOffset>
		<ymp_yOffset>9.5</ymp_yOffset>
		<ymp_tc>01:03</ymp_tc>
		<ymp_txt>We introduce a variable x that captures the extent to which the reaction shifts towards reactants. The change in product and reactant concentrations have opposite signs, and x is multiplied by the stoichiometric coefficients of each species. </ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>33</ymp_idx>
		<ymp_xAbsolute>51.7</ymp_xAbsolute>
		<ymp_yAbsolute>2113.6</ymp_yAbsolute>
		<ymp_xOffset>482.8</ymp_xOffset>
		<ymp_yOffset>127.6</ymp_yOffset>
		<ymp_tc>01:05</ymp_tc>
		<ymp_txt>This leads to resulting concentrations expressed in terms of x, which we can insert into the expression for the reaction quotient, Q. By setting Q equal to K, we obtain an expression that we solve to determine the x that leads to equilibrium concentrations.</ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>34</ymp_idx>
		<ymp_xAbsolute>89.75</ymp_xAbsolute>
		<ymp_yAbsolute>2279.95</ymp_yAbsolute>
		<ymp_xOffset>190.4</ymp_xOffset>
		<ymp_yOffset>170.8</ymp_yOffset>
		<ymp_tc>01:07</ymp_tc>
		<ymp_txt>To solve Q=K for x, we first expand the denominator to get a polynomial.</ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>35</ymp_idx>
		<ymp_xAbsolute>76.4</ymp_xAbsolute>
		<ymp_yAbsolute>2424.35</ymp_yAbsolute>
		<ymp_xOffset>231.1</ymp_xOffset>
		<ymp_yOffset>124.3</ymp_yOffset>
		<ymp_tc>01:09</ymp_tc>
		<ymp_txt>We then cross multiply and rearrange terms to get a cubic equation. </ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>36</ymp_idx>
		<ymp_xAbsolute>303.8</ymp_xAbsolute>
		<ymp_yAbsolute>2470.9</ymp_yAbsolute>
		<ymp_xOffset>244.3</ymp_xOffset>
		<ymp_yOffset>90.5</ymp_yOffset>
		<ymp_tc>01:11</ymp_tc>
		<ymp_txt>A cubic polynomial has three roots, meaning there are three values for x that will cause this cubic polynomial to be zero. You can obtain these using a modern calculator. The results are shown here.</ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>37</ymp_idx>
		<ymp_xAbsolute>458.95</ymp_xAbsolute>
		<ymp_yAbsolute>2492.25</ymp_yAbsolute>
		<ymp_xOffset>141.4</ymp_xOffset>
		<ymp_yOffset>63.8</ymp_yOffset>
		<ymp_tc>01:13</ymp_tc>
		<ymp_txt>All chemical systems we will consider have a single unique equilibrium state. We will therefore always find only one root that gives reasonable results, i.e. that leads to all concentrations having positive values. Since our table shows that the resulting [L] = 2x, the solutions that give negative x will lead to negative [L] and so can be rejected. This leaves only the third root, x=0.130.</ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>38</ymp_idx>
		<ymp_xAbsolute>67.6</ymp_xAbsolute>
		<ymp_yAbsolute>2590.3</ymp_yAbsolute>
		<ymp_xOffset>377.8</ymp_xOffset>
		<ymp_yOffset>109.8</ymp_yOffset>
		<ymp_tc>01:15</ymp_tc>
		<ymp_txt>We can put this value for x back into our ICE table to get the equilibrium concentrations. </ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>39</ymp_idx>
		<ymp_xAbsolute>85.25</ymp_xAbsolute>
		<ymp_yAbsolute>2732.4</ymp_yAbsolute>
		<ymp_xOffset>500.1</ymp_xOffset>
		<ymp_yOffset>98.2</ymp_yOffset>
		<ymp_tc>01:17</ymp_tc>
		<ymp_txt>We should always check to confirm that our equilibrium concentrations obey Q=K. Our concentrations pass this test. If they did not, we could go back and check our algebra to find where we went wrong.</ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>40</ymp_idx>
		<ymp_xAbsolute>76.8</ymp_xAbsolute>
		<ymp_yAbsolute>2754.1</ymp_yAbsolute>
		<ymp_xOffset>491.2</ymp_xOffset>
		<ymp_yOffset>136.6</ymp_yOffset>
		<ymp_tc>01:19</ymp_tc>
		<ymp_txt>These equilibrium concentrations are identical to those we obtained above. This must be the case, because all we did was start from a different initial position along the progress of reaction coordinate. The reaction will reach the same equilibrium position from any point along the progress of reaction coordinate. (see link: [page of future library module progress of reaction].)</ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>41</ymp_idx>
		<ymp_xAbsolute>69.55</ymp_xAbsolute>
		<ymp_yAbsolute>2972.3</ymp_yAbsolute>
		<ymp_xOffset>498.9</ymp_xOffset>
		<ymp_yOffset>139.6</ymp_yOffset>
		<ymp_tc>01:21</ymp_tc>
		<ymp_txt>Our goal in starting from Q=infinity, instead of the given initial position, was to simply the algebra. Here is a side-by-side comparison of the ICE tables obtained from each of the two starting points. The Q=infinity starting point leads to simpler algebra because [L] takes a simpler from, (2x) as opposed to (3.0-2x). Since [L] is raised to the second power in the expression for Q, this simplifies the algebraic manipulations. </ymp_txt>
	</ymp_slice>

	<ymp_slice>
		<ymp_idx>42</ymp_idx>
		<ymp_xAbsolute>224.2</ymp_xAbsolute>
		<ymp_yAbsolute>3114.25</ymp_yAbsolute>
		<ymp_xOffset>234.8</ymp_xOffset>
		<ymp_yOffset>27.7</ymp_yOffset>
		<ymp_tc>01:23</ymp_tc>
		<ymp_txt>The simpler form for [L] also made it easier to identify those roots for which [L] was negative: since [L] = 2x, any negative values of x could be immediately rejected. For large or small values of K, much more substantial simplifications can be obtained by moving to alternative initial positions (see link: [page of future library module progress of reaction].) </ymp_txt>
	</ymp_slice>
</ymp_presentation>


text:
/*jslint vars: true, plusplus: true, devel: true, browser: true, nomen: true, maxerr: 50 */
/*global define: false, $: false, _: false, Backbone: false, require: false, console: false*/

define(function(require, exports, module) {
	'use strict';

	var BoxView = Backbone.View.extend({
		className: 'box',
		events: {
			'mousedown': 'select'
		},
		initialize: function() {
			_.bindAll(this, 'render', 'dragStopHandler');
			this.model.on('change', this.render);
			this.$el.draggable({
				stop: this.dragStopHandler
			});
		},
		render: function() {

			if (this.model.get('selected')) {
				this.$el.addClass('selected');
			} else {
				this.$el.removeClass('selected');
			}

			this.$el.css({
				'top': this.model.get('top'),
				'left': this.model.get('left')
			});

			return this;
		},
		select: function(e) {
			this.smash(e);
			this.model.set({
				'selected': true
			});
		},
		dragStopHandler: function(e, ui) {
			this.model.store();
			this.model.set({
				'top': ui.position.top,
				'left': ui.position.left
			});
		},
		smash: function(e) {
			e.preventDefault();
		}
	});

	return BoxView;

});

redpajama_set_name: RedPajamaGithub


text:
<ion-view view-title="Dashboard">
  <ion-content class="padding">

Count ( react + angular)

Clicks ( react + angular)

Count ( angular )

Clicks ( angular )

    <button class="button button-block button-positive" ng-click="addToCounter()">+</button>

    <button class="button button-block button-assertive" ng-click="subtractFromCounter()">-</button>

  </ion-content>
</ion-view>


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Array_Manipulator
{
    class Program
    {
        static void Main(string[] args)
        {
            var numbers = Console.ReadLine().Split(' ').Select(long.Parse).ToList();

            var startedCommand = Console.ReadLine();

            while(startedCommand!="print")
            {
                var command = startedCommand.Split(' ').ToList();

                if(command[0]=="add")
                {
                    AddNum(command, numbers);
                }

                if(command[0]=="addMany")
                {
                    AddManyNum(command, numbers);
                }
                if(command[0]=="contains")
                {
                    PrintIndexOfContainElement(command, numbers);
                }
                if(command[0]=="remove")
                {
                    RemoveAtSpecifiedIndex(command, numbers);
                }
                if(command[0]=="shift")
                {
                    ShiftToTheLeft(command, numbers);
                }
                if(command[0]=="sumPairs")
                {
                    List<long> newList = new List<long>();
                    for (int i = 0; i < numbers.Count - 1; i += 2)
                    {
                        newList.Add(numbers[i] + numbers[i + 1]);
                    }
                    if (numbers.Count % 2 == 1)
                    {
                        newList.Add(numbers[numbers.Count - 1]);
                    }
                    numbers = newList;

                }
                startedCommand = Console.ReadLine();
            }

            Console.WriteLine($"[{string.Join(", ",numbers)}]");
        }

        static void ShiftToTheLeft(List<string> command, List<long> numbers)
        {
            for (int i = 0; i < int.Parse(command[1]); i++)
            {
                long lastElement = numbers[0];

                for (int j = 0; j < numbers.Count-1; j++)
                {
                    numbers[j] = numbers[j + 1];
                }
                numbers[numbers.Count - 1]=lastElement;
            }
        }

        static void RemoveAtSpecifiedIndex(List<string> command, List<long> numbers)
        {
            numbers.RemoveAt(int.Parse(command[1]));
        }

        static void PrintIndexOfContainElement(List<string> command, List<long> numbers)
        {
            var index = -1;
            for (int i = 0; i < numbers.Count; i++)
            {
                if(int.Parse(command[1])==numbers[i])
                {
                    index = i;
                    break;
                }
            }

            Console.WriteLine(index);
        }

        static void AddManyNum(List<string> command, List<long> numbers)
        {
            for (int i = command.Count-1; i >=2 ; i--)
            {
                numbers.Insert(int.Parse(command[1]), int.Parse(command[i]));
            }
        }

        static void AddNum(List<string> command, List<long> numbers)
        {
            numbers.Insert(int.Parse(command[1]), int.Parse(command[2]));
        }
    }
}


text:
librato-snippets
================

Some wiki-pages with code snippets detailing API examples in various languages.
This is an incomplete work in progress.

## Choose your language:

 - [shell](/content/shell.md)
 - [Ruby](/content/ruby.md)
 - [Java](/content/java.md)
 - [Python](/content/python.md)
 - [Go](/content/go.md)


text:
#import "ChineseSkillNew-Structs.h"
#import "iPhone4DataModelViewController.h"
#import "AVAudioPlayerDelegate.h"
#import "UITextViewDelegate.h"

@class UIButton, Model_db_sentence, UILabel, NSString, UIImageView, AVAudioPlayer, Model_db_sentence060, UIWriteChineseSentenceTextView;

__attribute__((visibility("hidden")))
@interface iPhone4Sentence6ViewController : iPhone4DataModelViewController <AVAudioPlayerDelegate, UITextViewDelegate> {
	BOOL _keyboardIsShown;
	UILabel* _todoLabel;
	UILabel* _stemLabel;
	UIButton* _audioButton;
	UIButton* _slowaudioButton;
	UIWriteChineseSentenceTextView* _answerTextView;
	UIImageView* _answerTextBGView;
	UILabel* _informationLabel;
	Model_db_sentence* _m_data;
	Model_db_sentence060* _m_model;
	AVAudioPlayer* _m_avPlayer;
	int _nCurAnswer;
	int _nResult;
	int _screenOrientation;
	int _interfaceorientation;
	int _playAudioCount;
}
@property(assign, nonatomic) __weak UIImageView* answerTextBGView;
@property(assign, nonatomic) __weak UIWriteChineseSentenceTextView* answerTextView;
@property(assign, nonatomic) __weak UIButton* audioButton;
@property(readonly, copy) NSString* debugDescription;
@property(readonly, copy) NSString* description;
@property(readonly, assign) unsigned hash;
@property(assign, nonatomic) __weak UILabel* informationLabel;
@property(assign) int interfaceorientation;
@property(assign) BOOL keyboardIsShown;
@property(retain, nonatomic) AVAudioPlayer* m_avPlayer;
@property(retain, nonatomic) Model_db_sentence* m_data;
@property(retain, nonatomic) Model_db_sentence060* m_model;
@property(assign) int nCurAnswer;
@property(assign) int nResult;
@property(assign, nonatomic) int playAudioCount;
@property(assign) int screenOrientation;
@property(assign, nonatomic) __weak UIButton* slowaudioButton;
@property(assign, nonatomic) __weak UILabel* stemLabel;
@property(readonly, assign) Class superclass;
@property(assign, nonatomic) __weak UILabel* todoLabel;
- (id)initWithNibName:(id)nibName bundle:(id)bundle;
- (void).cxx_destruct;
- (void)BeginEnableCheckButton:(id)button;
- (id)CheckResult;
- (void)InitModelData:(id)data Data:(id)data2;
- (void)PlaySlowAudio;
- (void)PlayWordAudio;
- (id)ReplacePinyinTangue:(id)tangue;
- (void)audioPlayerDidFinishPlaying:(id)audioPlayer successfully:(BOOL)successfully;
- (void)didReceiveMemoryWarning;
- (void)hide:(id)hide;
- (CGSize)keyboardSize:(id)size;
- (void)keyboardWillHide:(id)keyboard;
- (void)keyboardWillShow:(id)keyboard;
- (void)playWordSlowSound:(id)sound;
- (void)playWordSound:(id)sound;
- (void)textViewDidChange:(id)textView;
- (void)viewDidAppear:(BOOL)view;
- (void)viewDidLoad;
- (void)viewDidUnload;
@end


text:
module Dasheets
  module DSL
    class Cheatsheet < Base
      attr_reader :categories
      define_attrs :title, :short_name
      define_markdown_attrs :introduction, :notes

      def initialize(&block)
        @categories = []
        super(&block)
      end

      def category(&block)
        @categories << Dasheets::DSL::Category.new(&block)
      end
    end
  end
end


text:
/** @jsx jsx */
import { ReactNode, RefCallback } from 'react';
import { jsx } from '@emotion/react';
import { CommonPropsAndClassName, CSSObjectWithLabel, GroupBase } from '../types';
export interface OptionProps<Option = unknown, IsMulti extends boolean = boolean, Group extends GroupBase<Option> = GroupBase<Option>> extends CommonPropsAndClassName<Option, IsMulti, Group> {
    /** The children to be rendered. */
    children: ReactNode;
    /** Inner ref to DOM Node */
    innerRef: RefCallback<HTMLDivElement>;
    /** props passed to the wrapping element for the group. */
    innerProps: JSX.IntrinsicElements['div'];
    /** Text to be displayed representing the option. */
    label: string;
    /** Type is used by the menu to determine whether this is an option or a group.
      In the case of option this is always `option`. **/
    type: 'option';
    /** The data of the selected option. */
    data: Option;
    /** Whether the option is disabled. */
    isDisabled: boolean;
    /** Whether the option is focused. */
    isFocused: boolean;
    /** Whether the option is selected. */
    isSelected: boolean;
}
export declare const optionCSS: <Option, IsMulti extends boolean, Group extends GroupBase<Option>>({ isDisabled, isFocused, isSelected, theme: { spacing, colors }, }: OptionProps<Option, IsMulti, Group>) => CSSObjectWithLabel;
declare const Option: <Option, IsMulti extends boolean, Group extends GroupBase<Option>>(props: OptionProps<Option, IsMulti, Group>) => jsx.JSX.Element;
export default Option;


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <title>Weex HTML5</title>
  <meta name="apple-mobile-web-app-capable" content="yes" />
  <meta name="apple-mobile-web-app-status-bar-style" content="black" />
  <meta name="apple-touch-fullscreen" content="yes" />
  <meta name="format-detection" content="telephone=no, email=no" />


text:
<?xml version="1.0" encoding="UTF-8"?>

<recipeml version="0.5">
  <recipe>
    <head>
      <title>Baked Stuffed Yams with Pecans</title>
      <categories>
        <cat>Potatoes</cat></categories>
      <yield>4</yield></head>
    <ingredients>
      <ing>
        <amt>
          <qty>4</qty>
          <unit/></amt>
        <item>Louisiana yams; baked</item></ing>
      <ing>
        <amt>
          <qty>1/3</qty>
          <unit>cups</unit></amt>
        <item>Butter or margarine</item></ing>
      <ing>
        <amt>
          <qty>1/3</qty>
          <unit>cups</unit></amt>
        <item>Light cream</item></ing>
      <ing>
        <amt>
          <qty>1/3</qty>
          <unit>cups</unit></amt>
        <item>Chopped pecans</item></ing>
      <ing>
        <amt>
          <qty>1</qty>
          <unit>teaspoon</unit></amt>
        <item>Salt</item></ing></ingredients>
    <directions>
      <step>  Cut yams in half lengthwise and scoop from shells. Mash yams with butter or
  margarine and light cream. Add pecans and salt; mix well. Pile yam mixture
  into shells. Broil 3 to 4 inches from source of heat about 5 minutes, or
  until lightly browned. Top with pecan halves if desired.

  NOTES : This booklet was prepared by the Louisiana Sweet Potato Commission.

  Recipe by: 75 Easy Yam Recipes with a Romantic Past

  Posted to MC-Recipe Digest V1 #891 by NGavlak@aol.com on Nov 8, 1997

</step></directions></recipe></recipeml>


text:
using System;
using System.Collections.Generic;
using Microsoft.Practices.Unity;

namespace ServiceBridge.Unity
{
    /// <summary>
    /// Event argument for the <see cref="IServiceContainer.Registering"/> event raised in <see cref="UnityServiceContainer"/>.
    /// </summary>
    public class UnityServiceRegisterEventArgs : ServiceRegisterEventArgs
    {
        internal UnityServiceRegisterEventArgs(Type serviceType, Type implementType, string serviceName, ServiceLifetime lifetime)
            : base(serviceType, implementType, serviceName, lifetime)
        {
        }

        /// <summary>
        /// Gets the injection members for the Unity service mapping.
        /// </summary>
        public List<InjectionMember> InjectionMembers { get; } = new List<InjectionMember>();
    }
}


text:
layout: articles
title: Articles - Item (Cover + Excerpt)
permalink: /articles/item-cover-excerpt.html
key: articles-item-cover-excerpt
cover: /docs/assets/images/axure/articles-item-cover-excerpt.jpg
articles:
  data_source: site.sample_page
  show_excerpt: true
---

<div class="article__content" markdown="1">

---

Article list with cover and excerpt.

<!--more-->

**front matter:**

    ---
    layout: articles
    title: Articles - Item (Cover + Excerpt)
    articles:
      data_source: site.sample_page
      show_excerpt: true
    ---

</div>


text:
// NOTE: This file was generated by the ServiceGenerator.

// ----------------------------------------------------------------------------
// API:
//   Knowledge Graph Search API (kgsearch/v1)
// Description:
//   Searches the Google Knowledge Graph for entities.
// Documentation:
//   https://developers.google.com/knowledge-graph/

#import <GoogleAPIClientForREST/GTLRQuery.h>

#if GTLR_RUNTIME_VERSION != 3000
#error This file was generated by a different version of ServiceGenerator which is incompatible with this GTLR library source.
#endif

// Generated comments include content from the discovery document; avoid them
// causing warnings since clang's checks are some what arbitrary.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdocumentation"

NS_ASSUME_NONNULL_BEGIN

/**
 *  Parent class for other Kgsearch query classes.
 */
@interface GTLRKgsearchQuery : GTLRQuery

/** Selector specifying which fields to include in a partial response. */
@property(nonatomic, copy, nullable) NSString *fields;

@end

/**
 *  Searches Knowledge Graph for entities that match the constraints. A list of
 *  matched entities will be returned in response, which will be in JSON-LD
 *  format and compatible with http://schema.org
 *
 *  Method: kgsearch.entities.search
 */
@interface GTLRKgsearchQuery_EntitiesSearch : GTLRKgsearchQuery

/**
 *  The list of entity id to be used for search instead of query string. To
 *  specify multiple ids in the HTTP request, repeat the parameter in the URL as
 *  in ...?ids=A&ids=B
 */
@property(nonatomic, strong, nullable) NSArray<NSString *> *ids;

/** Enables indenting of json results. */
@property(nonatomic, assign) BOOL indent;

/**
 *  The list of language codes (defined in ISO 693) to run the query with, e.g.
 *  'en'.
 */
@property(nonatomic, strong, nullable) NSArray<NSString *> *languages;

/** Limits the number of entities to be returned. */
@property(nonatomic, assign) NSInteger limit;

/** Enables prefix match against names and aliases of entities */
@property(nonatomic, assign) BOOL prefix;

/** The literal query string for search. */
@property(nonatomic, copy, nullable) NSString *query;

/**
 *  Restricts returned entities with these types, e.g. Person (as defined in
 *  http://schema.org/Person). If multiple types are specified, returned
 *  entities will contain one or more of these types.
 */
@property(nonatomic, strong, nullable) NSArray<NSString *> *types;

/**
 *  Fetches a @c GTLRKgsearch_SearchResponse.
 *
 *  Searches Knowledge Graph for entities that match the constraints. A list of
 *  matched entities will be returned in response, which will be in JSON-LD
 *  format and compatible with http://schema.org
 *
 *  @return GTLRKgsearchQuery_EntitiesSearch
 */
+ (instancetype)query;

@end

NS_ASSUME_NONNULL_END

#pragma clang diagnostic pop


text:
var executeCommand = require('./command/');
var makeConfig = require('./util/makeConfig');

module.exports = function (command, options, quiet) {
  var config = makeConfig(command, options, quiet);
  return executeCommand(command, config, quiet);
};


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Bull. N. Y. St. Mus. 1(2): 13 (1887)

#### Original name
Inocybe infelix var. brevipes Peck

### Remarks
null


text:
from rest_framework import serializers

from api.utils import QueryFieldsMixin
from .models import Document, Label

class StringListField(serializers.ListField):
    child = serializers.CharField(required=False)

class LabelSerializer(serializers.ModelSerializer):
    class Meta:
        model = Label
        exclude = ('document', 'created', 'modified')

class DocumentListSerializer(QueryFieldsMixin, serializers.ModelSerializer):
    label = LabelSerializer(read_only=True)

    class Meta:
        model = Document
        fields = ('pk', 'title', 'date', 'subject','sign', 'doctype',
                  'docnum', 'label', 'created', 'modified',)

class DocumentGetSerializer(serializers.ModelSerializer):
    label = LabelSerializer(read_only=True)

    class Meta:
        model = Document
        fields = ('pk', 'title', 'date', 'sign', 'signtitle', 'doctype',
                  'docnum', 'label', 'created', 'modified', 'body', 'raw_body', 'label')

class VisualizationPostSerializer(serializers.Serializer):
    document_ls_one = StringListField(allow_empty=True, default=None)
    document_ls_two = StringListField(allow_empty=True, default=None)
    theme_one = serializers.CharField(max_length=15, required=False)
    theme_two = serializers.CharField(max_length=15, required=False)
    task_id = serializers.CharField(max_length=100, required=False)

    # html_output = serializers.FilePathField(path='/vagrant/core/generated/', default='')

    def validate(self, data):
        """
        Check that document references aren't the same.
        :return:
        """

        themes = ['mnchn', 'adolescent', 'geriatric', 'specpop']

        A = data.get('theme_one', None) is None
        B = data.get('theme_two', None) is None
        C = data.get('document_ls_one', None) is None
        D = data.get('document_ls_two', None) is None

        if not A and not B:
            if data['theme_one'].lower() == data['theme_two'].lower():
                raise serializers.ValidationError('Provided themes should not be the same.')
            elif not data['theme_one'].lower() in themes or not data['theme_two'].lower() in themes:
                raise serializers.ValidationError('Provided themes are not found.')

            data['type'] = 'theme'

        elif not C and not D:
            if set.intersection(set(data.get('document_ls_one', None)),
                                set(data.get('document_ls_two', None))):
                raise serializers.ValidationError('Provided documents lists have similar values.')

            try:
                # Constanly hits the DB! Maybe use a Cuckoo filter here.
                data['doc_ls_one_id'] = [Document.objects.get(title=doc).pk
                                                for doc in data['document_ls_one']]
                data['doc_ls_two_id'] = [Document.objects.get(title=doc).pk
                                                for doc in data['document_ls_two']]
                data['type'] = 'document_list'

            except Exception as e:
                raise serializers.ValidationError('Documents not found: ' + str(e))

        else:
            raise serializers.ValidationError('Provided documents or themes are insufficient.')

        return data

class VisualizationGetSerializer(serializers.Serializer):
    task_id = serializers.CharField(max_length=100, default='')
    task_status = serializers.CharField(max_length=100, default='')
    filename = serializers.CharField(max_length=100, default='')


text:
package name.marmac.bankanalyzer.dal.impl.jpa.nosql.properties;

/**
 * Created by marcomaccio on 19/02/2016.
 */
public class DataStoreProperties {

    private String nosqlHost;
    private String nosqlPort;
    private String nosqlDatabase;

    public String getNosqlHost() {
        return nosqlHost;
    }

    public void setNosqlHost(String nosqlHost) {
        this.nosqlHost = nosqlHost;
    }

    public String getNosqlPort() {
        return nosqlPort;
    }

    public void setNosqlPort(String nosqlPort) {
        this.nosqlPort = nosqlPort;
    }

    public String getNosqlDatabase() {
        return nosqlDatabase;
    }

    public void setNosqlDatabase(String nosqlDatabase) {
        this.nosqlDatabase = nosqlDatabase;
    }

}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

	<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">
	<TITLE>Projet PAM - Pilotage activité monétique</TITLE>
	<META NAME="GENERATOR" CONTENT="OpenOffice.org 3.3  (Win32)">
	<META NAME="CREATED" CONTENT="0;0">
	<META NAME="CHANGEDBY" CONTENT="Jacques Ambayrac">
	<META NAME="CHANGED" CONTENT="20111020;10315739">
	<META NAME="Originator" CONTENT="Microsoft Word 11">
	<META NAME="ProgId" CONTENT="Word.Document">
	<META NAME="CHANGEDBY" CONTENT="Jacques Ambayrac">
	<META NAME="CHANGEDBY" CONTENT="Jacques Ambayrac">
	<META NAME="CHANGEDBY" CONTENT="Jacques Ambayrac">
	<META NAME="CHANGEDBY" CONTENT="Jacques Ambayrac">
	<META NAME="Originator" CONTENT="Microsoft Word 11">
	<META NAME="ProgId" CONTENT="Word.Document">
	<META NAME="CHANGEDBY" CONTENT="Jacques Ambayrac">
	<META NAME="Originator" CONTENT="Microsoft Word 11">
	<META NAME="ProgId" CONTENT="Word.Document">
	<META NAME="CHANGEDBY" CONTENT="Jacques Ambayrac">
	<META NAME="Originator" CONTENT="Microsoft Word 11">
	<META NAME="ProgId" CONTENT="Word.Document">
	<META NAME="CHANGEDBY" CONTENT="Jacques Ambayrac">
	<META NAME="Originator" CONTENT="Microsoft Word 11">
	<META NAME="ProgId" CONTENT="Word.Document">
	<META NAME="CHANGEDBY" CONTENT="Jacques Ambayrac">
	<META NAME="Originator" CONTENT="Microsoft Word 11">
	<META NAME="ProgId" CONTENT="Word.Document">
	<META NAME="CHANGEDBY" CONTENT="Jacques Ambayrac">
	<META NAME="Originator" CONTENT="Microsoft Word 11">
	<META NAME="ProgId" CONTENT="Word.Document">
	<META NAME="CHANGEDBY" CONTENT="Jacques Ambayrac">
	<META NAME="Originator" CONTENT="Microsoft Word 11">
	<META NAME="ProgId" CONTENT="Word.Document">
	<META NAME="CHANGEDBY" CONTENT="Jacques Ambayrac">
	<META NAME="Originator" CONTENT="Microsoft Word 11">
	<META NAME="ProgId" CONTENT="Word.Document">
	<META NAME="CHANGEDBY" CONTENT="Jacques Ambayrac">
	<META NAME="Originator" CONTENT="Microsoft Word 11">
	<META NAME="ProgId" CONTENT="Word.Document">
	<META NAME="CHANGEDBY" CONTENT="Jacques Ambayrac">
	<META NAME="Originator" CONTENT="Microsoft Word 11">
	<META NAME="ProgId" CONTENT="Word.Document">
	<META NAME="CHANGEDBY" CONTENT="Jacques Ambayrac">
	<META NAME="Originator" CONTENT="Microsoft Word 11">
	<META NAME="ProgId" CONTENT="Word.Document">
	<META NAME="CHANGEDBY" CONTENT="Jacques Ambayrac">
	<META NAME="Originator" CONTENT="Microsoft Word 11">
	<META NAME="ProgId" CONTENT="Word.Document">
	<META NAME="CHANGEDBY" CONTENT="Jacques Ambayrac">
	<META NAME="Originator" CONTENT="Microsoft Word 11">
	<META NAME="ProgId" CONTENT="Word.Document">
	<META NAME="CHANGEDBY" CONTENT="Jacques Ambayrac">

Table of
contents Close window

<META NAME="CHANGEDBY" CONTENT="Jacques Ambayrac"><META NAME="CHANGEDBY" CONTENT="Jacques Ambayrac">2)
Cards portfolio

Each subsidiary has to produce two times a year
the number of issued cards and actives
cards on the 30 of June and the 31 of December. Each product is
described by features, technical type, usage, etc. The subsidiary has
to provide data regarding transactions and volumes (amounts). See in
appendix I the detailed image of cards form.

********************


text:
"""WMI RDF values."""

from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals

from grr_response_core.lib.rdfvalues import structs as rdf_structs
from grr_response_proto import sysinfo_pb2

class WMIActiveScriptEventConsumer(rdf_structs.RDFProtoStruct):
  protobuf = sysinfo_pb2.WMIActiveScriptEventConsumer

class WMICommandLineEventConsumer(rdf_structs.RDFProtoStruct):
  protobuf = sysinfo_pb2.WMICommandLineEventConsumer


text:
class Scene;
class Light;
class CullingManager
{
public:
	CullingManager();
	~CullingManager();
	void DebugRender(Camera * maincam, Scene* target);
	void UpdateMainPassFrustumCulling(Camera * maincam, Scene * target);

	void ProcessObject(GameObject* CurrentObj, Camera * maincam, int& cullcount);

	void UpdateCullingForShadowLight(Light * light, Scene* target);
	CullingFrustum* GetFustrum();
private:
	CullingFrustum Frustum;

};


text:
Track::Track(int tid){

    id = 0;
    if(tid <= 0) return;

    DB::Result r = DB::query(
        "SELECT tracks.title, tracks.user_id, users.name, tracks.visible, tracks.date, extract(epoch from tracks.date) FROM tracks, users "
        "WHERE tracks.id = " + number(tid) + " AND tracks.user_id = users.id");

    if(!r.empty()){
        id = tid;
        title = r[0][0];
        artist = User(number(r[0][1]), r[0][2]);
        visible = r[0][3] == "t";
        date = r[0][4],
        timestamp = r[0][5];
    }

}

std::string Track::url() const{
    return (std::string) "/track/" + number(id);
}

void Track::fill(Dict *d) const{
    d->SetIntValue("TID", id);
    d->SetValue("TITLE", title);
    d->ShowSection(visible ? "IS_VISIBLE" : "IS_HIDDEN");
    d->SetValue("DATE", date);
    d->SetValue("TIMESTAMP", timestamp);
    d->SetValue("DAY", formatTime(date, "%B %-d, %Y"));
    artist.fill(d);
    d->ShowSection(Art(id) ? "HAS_ART" : "NO_ART");
}

Dict* Track::player(Dict *d, bool fallback) const{
    Dict *p = d->AddIncludeDictionary("PLAYER");
    p->SetFilename("html/player.tpl");
    fill(p);
    p->SetIntValue("LIST", id);
    if(fallback) p->ShowSection("FALLBACK");
    return p;
}

void Track::deleteTrack() {
    log("Deleting track: " + title + " (" + number(id) + ")");

    Art art(id);
    if(art) art.remove();
    Audio(this).unlink();

    Playlist::removeTrack(id);
    DB::query("DELETE FROM events WHERE track_id = " + number(id));
    DB::query("DELETE FROM featured_tracks WHERE track_id = " + number(id));
    DB::query("DELETE FROM favorites WHERE type = 'track' AND ref = " + number(id));
    DB::query("DELETE FROM user_features WHERE type = 'track' AND ref = " + number(id));
    DB::query("DELETE FROM tracks WHERE id = " + number(id));
}


text:
namespace SoftFX.Extended.Core
{
    static class HResults
    {
        #region Standard Constants

        public const int E_FAIL =               unchecked((int)0x80000008);
        public const int S_OK =    0;
        public const int S_FALSE = 1;

        #endregion

        #region Standard Error Constants

        public const int E_POINTER =            unchecked((int)0x80000005);
        public const int E_INVALIDARG =         unchecked((int)0x80000003);
        public const int E_OUTOFMEMORY =        unchecked((int)0x8007000E);
        public const int E_NOTIMPL =            unchecked((int)0x80000001);

        #endregion

        #region Constants

        // customer's bit
        public const int FX_CODE_CUSTOMER =     unchecked((int)0x20000000);

        public const int FX_CODE_SUCCESS =      unchecked((int)(0x00000000 | FX_CODE_CUSTOMER));
        public const int FX_CODE_INFORMATION =  unchecked((int)(0x40000000 | FX_CODE_CUSTOMER));
        public const int FX_CODE_WARNING =      unchecked((int)(0x80000000 | FX_CODE_CUSTOMER));
        public const int FX_CODE_ERROR =        unchecked((int)(0xC0000000 | FX_CODE_CUSTOMER));

        public const int FX_CODE_START = 0;

        public const int FX_CODE_ERROR_SEND =           ((FX_CODE_START + 0) | FX_CODE_ERROR);
        public const int FX_CODE_ERROR_TIMEOUT =        ((FX_CODE_START + 1) | FX_CODE_ERROR);
        public const int FX_CODE_ERROR_RECEIVE =        ((FX_CODE_START + 2) | FX_CODE_ERROR);
        public const int FX_CODE_ERROR_EXCEPTION =      ((FX_CODE_START + 3) | FX_CODE_ERROR);
        public const int FX_CODE_ERROR_REJECT =         ((FX_CODE_START + 7) | FX_CODE_ERROR);
        public const int FX_CODE_ERROR_LOGOUT =         ((FX_CODE_START + 8) | FX_CODE_ERROR);
        public const int FX_CODE_ERROR_INVALID_HANDLE = ((FX_CODE_START + 9) | FX_CODE_ERROR);

        #endregion

        public static bool Succeeded(int status)
        {
            return status >= 0;
        }

        public static bool Failed(int status)
        {
            return status < 0;
        }
    }
}


text:
#include "mitkLineMapper2D.h"
#include "mitkPointSet.h"
#include "mitkBaseRenderer.h"
#include "mitkPlaneGeometry.h"
#include "mitkColorProperty.h"
#include "mitkProperties.h"
#include <vtkLinearTransform.h>
#include "mitkPointSet.h"
#include "mitkGL.h"

mitk::LineMapper2D::LineMapper2D()
: mitk::PointSetGLMapper2D()
{

}

mitk::LineMapper2D::~LineMapper2D()
{
}

const mitk::PointSet *mitk::LineMapper2D::GetInput(void)
{
  return static_cast<const mitk::PointSet * > ( GetDataNode()->GetData() );
}

void mitk::LineMapper2D::Paint(mitk::BaseRenderer * renderer)
{

  bool visible = true;
  GetDataNode()->GetVisibility(visible, renderer, "visible");
  if(!visible) return;

  bool updateNeccesary = true;//!!!! @TODO !??!!

  if (updateNeccesary)
  {
    mitk::PointSet::Pointer input  = const_cast<mitk::PointSet*>(this->GetInput());
    mitk::DisplayGeometry::Pointer displayGeometry = renderer->GetDisplayGeometry();
    assert(displayGeometry.IsNotNull());

    //apply color and opacity read from the PropertyList
    ApplyColorAndOpacityProperties(renderer);

    vtkLinearTransform* transform = GetDataNode()->GetVtkTransform();

    //List of the Points
    PointSet::DataType::PointsContainerConstIterator it, end;
    it = input->GetPointSet()->GetPoints()->Begin();
    end = input->GetPointSet()->GetPoints()->End();//the last before end, because lines from n to n+1
    if (end!=it)  // otherwise PointSet is empty
        end--;

    //bool list for the selection of the points
    PointSet::DataType::PointDataContainerIterator selIt, selItNext;
    selIt=input->GetPointSet()->GetPointData()->Begin();

    int j=0;
    while(it!=end)
    {
      mitk::Point3D p, q, projected_p, projected_q;
      float vtkp[3];
      itk2vtk(it->Value(), vtkp);
      transform->TransformPoint(vtkp, vtkp);
      vtk2itk(vtkp,p);

      //next point n+1
      it++;
      itk2vtk(it->Value(), vtkp);
      transform->TransformPoint(vtkp, vtkp);
      vtk2itk(vtkp,q);
      it--;

      displayGeometry->Project(p, projected_p);
      displayGeometry->Project(q, projected_q);

      Vector3D diffp=p-projected_p, diffq=q-projected_q;
      if((diffp.GetSquaredNorm()<4.0) &&
         (diffq.GetSquaredNorm()<4.0))
      {
        Point2D p2d, q2d, tmp;

        displayGeometry->Map(projected_p, p2d);
        displayGeometry->WorldToDisplay(p2d, p2d);
        displayGeometry->Map(projected_q, q2d);
        displayGeometry->WorldToDisplay(q2d, q2d);

        //outlined, cause iterators behave strange and multiple points can't be selected anyway by now!
        //selItNext = selIt++;//Iterator to the next Element, cause only when the two points ar selected, then the Line is Selected
        //if (selIt->Value() && selItNext->Value())//selected
        //{
        //  float colorSel[]={1.0,0.0,0.6}; //for selected!

        //  //current color for changing to a diferent color if selected
        //  float currCol[4];
        //  glGetFloatv(GL_CURRENT_COLOR,currCol);

        //  glColor3f(colorSel[0],colorSel[1],colorSel[2]);//red

        //  glBegin (GL_LINES);
        //    glVertex2f(p2d[0], p2d[1]);
        //    glVertex2f(q2d[0], q2d[1]);
        //  glEnd ();

        //  glColor3f(currCol[0],currCol[1],currCol[2]);//the color before changing to select!

        //}
        //else
        //{
          glBegin (GL_LINES);
            glVertex2f(p2d[0], p2d[1]);
            glVertex2f(q2d[0], q2d[1]);
          glEnd ();
        //}
      }
      ++it;
      ++selIt;
       j++;
    }
    //drawing the points
    PointSetGLMapper2D::Paint(renderer);
  }
}


text:
package org.springframework.boot.cloud.cloudfoundry;

import org.junit.Test;

import org.springframework.boot.cloud.CloudFoundryVcapEnvironmentPostProcessor;
import org.springframework.boot.testutil.EnvironmentTestUtils;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import static org.assertj.core.api.Assertions.assertThat;

/**
 * Tests for {@link CloudFoundryVcapEnvironmentPostProcessor}.
 *
 * @author Dave Syer
 * @author Andy Wilkinson
 */
public class CloudFoundryVcapEnvironmentPostProcessorTests {

	private final CloudFoundryVcapEnvironmentPostProcessor initializer = new CloudFoundryVcapEnvironmentPostProcessor();

	private final ConfigurableApplicationContext context = new AnnotationConfigApplicationContext();

	@Test
	public void testApplicationProperties() {
		EnvironmentTestUtils.addEnvironment(this.context,
				"VCAP_APPLICATION:{\"application_users\":[],"
						+ "\"instance_id\":\"bb7935245adf3e650dfb7c58a06e9ece\","
						+ "\"instance_index\":0,\"version\":\"3464e092-1c13-462e-a47c-807c30318a50\","
						+ "\"name\":\"foo\",\"uris\":[\"foo.cfapps.io\"],"
						+ "\"started_at\":\"2013-05-29 02:37:59 +0000\","
						+ "\"started_at_timestamp\":1369795079,"
						+ "\"host\":\"0.0.0.0\",\"port\":61034,"
						+ "\"limits\":{\"mem\":128,\"disk\":1024,\"fds\":16384},"
						+ "\"version\":\"3464e092-1c13-462e-a47c-807c30318a50\","
						+ "\"name\":\"dsyerenv\",\"uris\":[\"dsyerenv.cfapps.io\"],"
						+ "\"users\":[],\"start\":\"2013-05-29 02:37:59 +0000\","
						+ "\"state_timestamp\":1369795079}");
		this.initializer.postProcessEnvironment(this.context.getEnvironment(), null);
		assertThat(
				this.context.getEnvironment().getProperty("vcap.application.instance_id"))
						.isEqualTo("bb7935245adf3e650dfb7c58a06e9ece");
	}

	@Test
	public void testApplicationUris() {
		EnvironmentTestUtils.addEnvironment(this.context,
				"VCAP_APPLICATION:{\"instance_id\":\"bb7935245adf3e650dfb7c58a06e9ece\",\"instance_index\":0,\"uris\":[\"foo.cfapps.io\"]}");
		this.initializer.postProcessEnvironment(this.context.getEnvironment(), null);
		assertThat(this.context.getEnvironment().getProperty("vcap.application.uris[0]"))
				.isEqualTo("foo.cfapps.io");
	}

	@Test
	public void testUnparseableApplicationProperties() {
		EnvironmentTestUtils.addEnvironment(this.context, "VCAP_APPLICATION:");
		this.initializer.postProcessEnvironment(this.context.getEnvironment(), null);
		assertThat(getProperty("vcap")).isNull();
	}

	@Test
	public void testNullApplicationProperties() {
		EnvironmentTestUtils.addEnvironment(this.context,
				"VCAP_APPLICATION:{\"application_users\":null,"
						+ "\"instance_id\":\"bb7935245adf3e650dfb7c58a06e9ece\","
						+ "\"instance_index\":0,\"version\":\"3464e092-1c13-462e-a47c-807c30318a50\","
						+ "\"name\":\"foo\",\"uris\":[\"foo.cfapps.io\"],"
						+ "\"started_at\":\"2013-05-29 02:37:59 +0000\","
						+ "\"started_at_timestamp\":1369795079,"
						+ "\"host\":\"0.0.0.0\",\"port\":61034,"
						+ "\"limits\":{\"mem\":128,\"disk\":1024,\"fds\":16384},"
						+ "\"version\":\"3464e092-1c13-462e-a47c-807c30318a50\","
						+ "\"name\":\"dsyerenv\",\"uris\":[\"dsyerenv.cfapps.io\"],"
						+ "\"users\":[],\"start\":\"2013-05-29 02:37:59 +0000\","
						+ "\"state_timestamp\":1369795079}");
		this.initializer.postProcessEnvironment(this.context.getEnvironment(), null);
		assertThat(getProperty("vcap")).isNull();
	}

	@Test
	public void testServiceProperties() {
		EnvironmentTestUtils.addEnvironment(this.context,
				"VCAP_SERVICES:{\"rds-mysql-n/a\":[{"
						+ "\"name\":\"mysql\",\"label\":\"rds-mysql-n/a\","
						+ "\"plan\":\"10mb\",\"credentials\":{"
						+ "\"name\":\"d04fb13d27d964c62b267bbba1cffb9da\","
						+ "\"hostname\":\"mysql-service-public.clqg2e2w3ecf.us-east-1.rds.amazonaws.com\","
						+ "\"ssl\":true,\"location\":null,"
						+ "\"host\":\"mysql-service-public.clqg2e2w3ecf.us-east-1.rds.amazonaws.com\","
						+ "\"port\":3306,\"user\":\"urpRuqTf8Cpe6\",\"username\":"
						+ "\"urpRuqTf8Cpe6\",\"password\":\"pxLsGVpsC9A5S\"}}]}");
		this.initializer.postProcessEnvironment(this.context.getEnvironment(), null);
		assertThat(getProperty("vcap.services.mysql.name")).isEqualTo("mysql");
		assertThat(getProperty("vcap.services.mysql.credentials.port")).isEqualTo("3306");
		assertThat(getProperty("vcap.services.mysql.credentials.ssl")).isEqualTo("true");
		assertThat(getProperty("vcap.services.mysql.credentials.location")).isEqualTo("");
	}

	@Test
	public void testServicePropertiesWithoutNA() {
		EnvironmentTestUtils.addEnvironment(this.context,
				"VCAP_SERVICES:{\"rds-mysql\":[{"
						+ "\"name\":\"mysql\",\"label\":\"rds-mysql\",\"plan\":\"10mb\","
						+ "\"credentials\":{\"name\":\"d04fb13d27d964c62b267bbba1cffb9da\","
						+ "\"hostname\":\"mysql-service-public.clqg2e2w3ecf.us-east-1.rds.amazonaws.com\","
						+ "\"host\":\"mysql-service-public.clqg2e2w3ecf.us-east-1.rds.amazonaws.com\","
						+ "\"port\":3306,\"user\":\"urpRuqTf8Cpe6\","
						+ "\"username\":\"urpRuqTf8Cpe6\","
						+ "\"password\":\"pxLsGVpsC9A5S\"}}]}");
		this.initializer.postProcessEnvironment(this.context.getEnvironment(), null);
		assertThat(getProperty("vcap.services.mysql.name")).isEqualTo("mysql");
		assertThat(getProperty("vcap.services.mysql.credentials.port")).isEqualTo("3306");
	}

	private String getProperty(String key) {
		return this.context.getEnvironment().getProperty(key);
	}
}


text:
<!DOCTYPE html>

    <title>WhiteDevil Shop</title>
    <base href="/">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="https://opensource.keycdn.com/fontawesome/4.7.0/font-awesome.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Lato:400,700" rel="stylesheet">
    <link rel="stylesheet" href="styles.css">

    <my-app>

    </my-app>


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">

<title>OGRE Manual v1.8 ('Byatis'): 5.6.2 Vertex Declarations</title>

<meta name="description" content="OGRE Manual v1.8 ('Byatis'): 5.6.2 Vertex Declarations">
<meta name="keywords" content="OGRE Manual v1.8 ('Byatis'): 5.6.2 Vertex Declarations">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="texi2html 1.70">
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">

[ < ]
[ > ]

[ << ]
[ Up ]
[ >> ]

[Top]
[Contents]
[Index]
[ ? ]

 5.6.2 Vertex Declarations

Vertex declarations define the vertex inputs used to render the geometry you want to appear on the screen. Basically this means that for each vertex, you want to feed a certain set of data into the graphics pipeline, which (you hope) will affect how it all looks when the triangles are drawn. Vertex declarations let you pull items of data (which we call vertex elements, represented by the VertexElement class) from any number of buffers, both shared and dedicated to that particular element. It's your job to ensure that the contents of the buffers make sense when interpreted in the way that your VertexDeclaration indicates that they should.

To add an element to a VertexDeclaration, you call it's addElement method. The parameters to this method are:

 source

This tells the declaration which buffer the element is to be pulled from. Note that this is just an index, which may range from 0 to one less than the number of buffers which are being bound as sources of vertex data. See section Vertex Buffer Bindings for information on how a real buffer is bound to a source index. Storing the source of the vertex element this way (rather than using a buffer pointer) allows you to rebind the source of a vertex very easily, without changing the declaration of the vertex format itself.

 offset

Tells the declaration how far in bytes the element is offset from the start of each whole vertex in this buffer. This will be 0 if this is the only element being sourced from this buffer, but if other elements are there then it may be higher. A good way of thinking of this is the size of all vertex elements which precede this element in the buffer.

 type

This defines the data type of the vertex input, including it's size. This is an important element because as GPUs become more advanced, we can no longer assume that position input will always require 3 floating point numbers, because programmable vertex pipelines allow full control over the inputs and outputs. This part of the element definition covers the basic type and size, e.g. VET_FLOAT3 is 3 floating point numbers - the meaning of the data is dealt with in the next parameter.

 semantic

This defines the meaning of the element - the GPU will use this to determine what to use this input for, and programmable vertex pipelines will use this to identify which semantic to map the input to. This can identify the element as positional data, normal data, texture coordinate data, etc. See the API reference for full details of all the options.

 index

This parameter is only required when you supply more than one element of the same semantic in one vertex declaration. For example, if you supply more than one set of texture coordinates, you would set first sets index to 0, and the second set to 1.

You can repeat the call to addElement for as many elements as you have in your vertex input structures. There are also useful methods on VertexDeclaration for locating elements within a declaration - see the API reference for full details.

 Important Considerations

Whilst in theory you have completely full reign over the format of you vertices, in reality there are some restrictions. Older DirectX hardware imposes a fixed ordering on the elements which are pulled from each buffer; specifically any hardware prior to DirectX 9 may impose the following restrictions:

VertexElements should be added in the following order, and the order of the elements within any shared buffer should be as follows:

 Positions

 Blending weights

 Normals

 Diffuse colours

 Specular colours

 Texture coordinates (starting at 0, listed in order, with no gaps)

You must not have unused gaps in your buffers which are not referenced by any VertexElement

You must not cause the buffer & offset settings of 2 VertexElements to overlap

OpenGL and DirectX 9 compatible hardware are not required to follow these strict limitations, so you might find, for example that if you broke these rules your application would run under OpenGL and under DirectX on recent cards, but it is not guaranteed to run on older hardware under DirectX unless you stick to the above rules. For this reason you're advised to abide by them!

[ < ]
[ > ]

[ << ]
[ Up ]
[ >> ]

[Top]
[Contents]
[Index]
[ ? ]

  This document was generated by David Rogers on May, 26 2012 using texi2html 1.70.


text:
<?php
namespace NinjaTooken\CommonBundle\Command;

use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\HttpFoundation\Request;

class NewsletterCommand extends ContainerAwareCommand
{
    protected function configure()
    {
        $this
            ->setName('newsletter:send')
            ->setDescription('Envoi de la newsletter')
			->addOption(
				'all',
				null,
				InputOption::VALUE_NONE,
				'Envoi à tous les inscrits ?'
			)
        ;
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $container = $this->getContainer();
        $session = $container->get('session');
        $template = $container->get('twig')->loadTemplate('::newsletter.html.twig');
        $translator = $container->get('translator');
        $route = $container->get('router');
        $em = $container->get('doctrine')->getManager();
        $mailer = $container->get('mailer');

        $from = array($container->getParameter('mail_contact') => $container->getParameter('mail_name'));

        $output->writeln('---start');

        // boucle sur les différents utilisateurs
		$restrict = " old_id=641 AND";
		if ($input->getOption('all'))
			$restrict = "";

        $request = 'SELECT id, username, email, auto_login, locale FROM nt_user WHERE'.$restrict.' enabled=1 AND locked=0 AND receive_newsletter=1 AND confirmation_token IS NULL ORDER BY id ASC LIMIT ';
        $start = 0;
        $num = 100;
        $i = 1;
        $stmt = $em->getConnection()->prepare($request.$start.','.$num);
        $stmt->execute();
        $users = $stmt->fetchAll();
        while(count($users)>0){
            foreach($users as $user){
                $username = $user['username'];
                $email = $user['email'];
                $locale = $user['locale'];
                if(empty($locale))
                    $locale = 'fr';
                $auto_login = $user['auto_login'];
                if(empty($auto_login))
                    $auto_login = null;

                // construit le contenu
                $translator->setLocale($locale);
                $body = $template->render(array(
                    'email' => $email,
                    'username' => $username,
                    'message' => $translator->trans('newsletter.newsite', array(
                        '%username%' => $username,
                        '%autologin%' => $auto_login?$route->generate('ninja_tooken_user_autologin', array(
                            'autologin' => $auto_login,
                            '_locale' => $locale
                        ), true):$route->generate('ninja_tooken_homepage', array(
                            '_locale' => $locale
                        ), true)
                    ), 'common'),
                    'locale' => $locale
                ));

                // envoi les messages
                $message = \Swift_Message::newInstance()
                    ->setSubject('[Ninjatooken] nouveau message de la part de '.$username)
                    ->setFrom($from)
                    ->setTo($email)
                    ->setContentType("text/html")
                    ->setBody($body);
                $mailer->send($message);

                $output->writeln($i." ".$username.' ('.$email.')');
                $i++;
            }
            $start += $num;

            // en cas de "spool", vide la queue
            // http://symfony.com/fr/doc/master/cookbook/email/spool.html
            /*$spool = $mailer->getTransport()->getSpool();
            $transport = $container->get('swiftmailer.transport.real');
            $spool->flushQueue($transport);*/

            $stmt = $em->getConnection()->prepare($request.$start.','.$num);
            $stmt->execute();
            $users = $stmt->fetchAll();
        }
        $output->writeln('---end');
    }
}


text:
title: Persae
playwright: Van Badham
period: Edinburgh
season: Edinburgh
season_sort: 500
venue: Underbelly

prod_shots: TwwS6j

crew:
 - role: Director
   name: Sam Grafton

cast:
 - role: Jean
   name: Maia Gibbs
 - name: Eleanor Yates
 - name: Georgie Strawson
 - name: Henry Proffitt
 - name: Charlie Dupre

links:
  - type: Review
    href: https://web.archive.org/web/20080905181103/http://www.newtheatre.org.uk/extra/persae.html
    publisher: The Scotsman
    author: Andrea Mullaney
    title: "Persae"
    rating: 4/5
    quote: "Badham - an Australian working in Britain - clearly wants to show that it's not just an American war and that, as this week's news reminds us, we're all involved."
  - type: Review
    href: http://www.su-web2.nottingham.ac.uk/~impact/?p=515
    snapshot: c3PjL
    publisher: Impact Nottingham
    title: "Persae (Iron Belly, Edinburgh)"
    date: 2006-09-23
    quote: "For both its execution and its topicality, Persae attracted a great deal of positive critical attention from major publications The Stage, Three Weeks, The Scotsman and The Independent who referred to the play as "…The darkest and most incendiary politics on the fringe." Theatre may be an ancient medium, but Persae proved that in the Information Age its message still pierces the clamour with deadly accuracy."
---


text:
Pouring Rain
============

Pouring Rain is a framework for distributed data transfer over unreliable network using Luby Transform codes.

See `test-client.py` and `test-server.py` for usage.

Introduction
============

**Problem:** How to transfer data over (unreliable) network as fast as possible?

**Solution:** Use distributed stateless transfer mechanism with error correction.

Key points:

* Transfer time T(K) = 1.25/K where K = number of servers.
	* This means that T(5) = 0.25 (**four** times faster than from a single server!)
* M packets ( M is slighty larger than N ) needs to be received in order to construct the original message (composes of N packets).
* Total independece of transfer:
	* All packets are independent of each other so they don't have to come from the same machine.
	* No ordering of packets is required.
	* Tolerates packet loss and unavailability of source machines
	* Only requirement is to receive enough unique packets to construct the original file.
	* Can be started, stopped and restarted arbitrarily. Servers doesn't need to know what you have received so far.
* Runs on UDP so no TCP overhead on the transfer.
* Server load (also disk io) is indepedent of how many clients it serves.

Operating principles
============

1. Each resource in the network has a unique 64 bit identifier.
2. When a client wants to retrieve that resource it sends a "subscribe" packet to each server it knows.
3. If that resource is found on server, the server starts to stream packets to client.
4. After a certain amount of time the server stops streaming to that client (UDP is used as protocol so there is no way to know is the client is still receiving).
5. In order to receive packets the client sends periodically the "subscribe" packet to each server.
6. When the client is able to reconstruct the resource it sends a "unsubscribe" packet to each server and the servers stop to stream packets to client.

Technical notes
============

* Currently maximum transferred payload size is 4 Mb. Comes from 64 ipv4 datagrams.
* As there is no connection (udp), a heartbeat message is sent periodically in order to keep stream running

Future
============

* C / C++ implementation for more performance and smaller footprint

Murky Waters
============

Murky Waters is a distributed data store implemented using Pouring Rain. It adds "propagate" feature to Pouring Rain, which is used to replicate data over a
PR cluster. It also caches locally all entries it fetches from the cluster.


text:
package org.lilyproject.tools.tester;

import org.joda.time.DateTime;

import java.io.*;
import java.util.*;

/**
 * Keeps metrics for a certain interval and prints them out when the interval ends.
 */
public class DurationMetrics {
    private Map<String, Metric> metrics = new TreeMap<String, Metric>();
    private int intervalDuration = 1000 * 30;
    private DateTime intervalStartedAt;
    private DateTime startedAt;
    private PrintStream reportStream;

    public DurationMetrics(File file) throws FileNotFoundException {
        this(new PrintStream(new FileOutputStream(file)));
    }

    public DurationMetrics(PrintStream reportStream) {
        this.reportStream = reportStream;
    }

    public DurationMetrics() {
        this(System.out);
    }

    public void finish() {
        // print one last report
        printReport();
        reportStream.close();
    }

    public synchronized void increment(String name, int duration) {
        if (intervalStartedAt == null) {
            // it's our very first value
            intervalStartedAt = new DateTime();
            startedAt = new DateTime();
        }

        if (System.currentTimeMillis() - intervalStartedAt.getMillis() >= intervalDuration) {
            printReport();
            for (Metric metric : metrics.values()) {
                metric.rollInterval();
            }
            intervalStartedAt = new DateTime();
        }

        Metric metric = metrics.get(name);
        if (metric == null) {
            metric = new Metric();
            metrics.put(name, metric);
        }

        metric.add(duration);
    }

    public void printReport() {
        if (intervalStartedAt == null) {
            return;
        }

        long now = System.currentTimeMillis();
        long actualIntervalDuration = now - intervalStartedAt.getMillis();

        reportStream.println("+-----------------------------------------------------------------------------------------------------------------------+");
        reportStream.println("| Interval started at: " + intervalStartedAt + " (duration: " + (actualIntervalDuration / 1000) + "s).");
        reportStream.println("| Measurements started at: " + startedAt + " (duration: " + ((now - startedAt.getMillis()) / 1000) + "s)");
        reportStream.println("+------------------------------+----------+----------+----------+----------+----------+--------------+------------------+");
        reportStream.println("| Name                         | Op count | Average  | Median   | Minimum  | Maximum  | All time ops | All time average |");
        reportStream.println("+------------------------------+----------+----------+----------+----------+----------+--------------+------------------+");

        for (Map.Entry<String, Metric> entry : metrics.entrySet()) {
            String name = entry.getKey();
            Metric metric = entry.getValue();

            reportStream.printf ("|%1$-30.30s|%2$10d|%3$10.2f|%4$10.2f|%5$10d|%6$10d|%7$14d|%8$18.2f|\n",
                    name, metric.getIntervalCount(), metric.getIntervalAverage(), metric.getIntervalMedian(),
                    metric.getIntervalMin(), metric.getIntervalMax(), metric.getAllTimeCount(),
                    metric.getAllTimeAverage());
        }

        reportStream.println("+------------------------------+----------+----------+----------+----------+----------+--------------+------------------+");
        reportStream.flush();
    }

    private static class Metric {
        private List<Integer> durations = new ArrayList<Integer>(1000);

        int intervalCount;
        long intervalDuration;
        int intervalMin;
        int intervalMax;

        int allTimeCount;
        int allTimeDuration;

        public Metric() {
            rollInterval();
        }

        public void add(int duration) {
            intervalCount++;
            intervalDuration += duration;
            allTimeCount++;
            allTimeDuration += duration;

            if (duration < intervalMin)
                intervalMin = duration;

            if (duration > intervalMax)
                intervalMax = duration;

            durations.add(duration);
        }

        public void rollInterval() {
            intervalCount = 0;
            intervalDuration = 0;
            intervalMin = Integer.MAX_VALUE;
            intervalMax = 0;
            durations.clear();
        }

        public int getIntervalCount() {
            return intervalCount;
        }

        public int getAllTimeCount() {
            return allTimeCount;
        }

        public double getIntervalAverage() {
            return intervalCount == 0 ? 0 : (double)intervalDuration / (double)intervalCount;
        }

        public double getAllTimeAverage() {
            return allTimeCount == 0 ? 0 : (double)allTimeDuration / (double)allTimeCount;
        }

        public int getIntervalMin() {
            return intervalCount == 0 ? 0 : intervalMin;
        }

        public int getIntervalMax() {
            return intervalMax;
        }

        public double getIntervalMedian() {
            if (durations.size() == 0)
                return 0;

            Collections.sort(durations);
            int middle = durations.size() / 2;

            if (durations.size() % 2 == 1) {
                return durations.get(middle);
            } else {
                return (durations.get(middle - 1) + durations.get(middle)) / 2d;
            }
        }
    }
}


text:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TextDrawer = void 0;
const tslib_1 = require("tslib");
const Utils_1 = require("../Utils");
const Enums_1 = require("../Enums");
class TextDrawer {
    init(container) {
        var _a;
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            const options = container.options;
            if (Utils_1.Utils.isInArray(Enums_1.ShapeType.char, options.particles.shape.type) ||
                Utils_1.Utils.isInArray(Enums_1.ShapeType.character, options.particles.shape.type)) {
                const shapeOptions = ((_a = options.particles.shape.options[Enums_1.ShapeType.character]) !== null && _a !== void 0 ? _a : options.particles.shape.options[Enums_1.ShapeType.char]);
                if (shapeOptions instanceof Array) {
                    for (const character of shapeOptions) {
                        yield Utils_1.Utils.loadFont(character);
                    }
                }
                else {
                    if (shapeOptions !== undefined) {
                        yield Utils_1.Utils.loadFont(shapeOptions);
                    }
                }
            }
        });
    }
    draw(context, particle, radius) {
        const character = particle.shapeData;
        if (character === undefined) {
            return;
        }
        const textData = character.value;
        if (textData === undefined) {
            return;
        }
        const textParticle = particle;
        if (textParticle.text === undefined) {
            textParticle.text =
                textData instanceof Array ? Utils_1.Utils.itemFromArray(textData, particle.randomIndexData) : textData;
        }
        const text = textParticle.text;
        const style = character.style;
        const weight = character.weight;
        const size = Math.round(radius) * 2;
        const font = character.font;
        const fill = particle.fill;
        const offsetX = (text.length * radius) / 2;
        context.font = `${style} ${weight} ${size}px "${font}"`;
        const pos = {
            x: -offsetX,
            y: radius / 2,
        };
        if (fill) {
            context.fillText(text, pos.x, pos.y);
        }
        else {
            context.strokeText(text, pos.x, pos.y);
        }
    }
}
exports.TextDrawer = TextDrawer;


text:
<?php

if (!defined('UPDRAFTPLUS_DIR')) die('No direct access allowed');

// $options is passed in
$default_options = array(
	'include_uploader' => true,
	'include_opera_warning' => false,
	'will_immediately_calculate_disk_space' => true,
	'include_whitespace_warning' => true,
	'include_header' => false,
);

foreach ($default_options as $k => $v) {
	if (!isset($options[$k])) $options[$k] = $v;
}

// $backup_history is passed in
if (false === $backup_history) $backup_history = UpdraftPlus_Backup_History::get_history();

if (!empty($options['include_header'])) echo '
'.__('Existing Backups', 'updraftplus').' ('.count($backup_history).')
';

?>

	<?php if (!empty($options['include_whitespace_warning'])) { ?>

			<?php echo ''.__('Warning', 'updraftplus').': '.__('Your WordPress installation has a problem with outputting extra whitespace. This can corrupt backups that you download from here.', 'updraftplus').' '.__('Follow this link for more information', 'updraftplus').'';?>

	<?php }
	$bom_warning = $updraftplus_admin->get_bom_warning_text();
	if (!empty($bom_warning)) {
	?>

	<?php
	echo $bom_warning;
	?>

	<?php
	}
	$updraftplus_admin->take_backup_content();
	?>

<?php echo __('Existing Backups', 'updraftplus');?> <?php echo count($backup_history);?>

			<?php
				echo UpdraftPlus_Filesystem_Functions::web_server_disk_space($options['will_immediately_calculate_disk_space']);
			?>

				<?php _e('More tasks:', 'updraftplus');?>
				<?php
					if (!empty($options['include_uploader'])) {
					?>
					<a class="updraft_uploader_toggle" href="<?php echo UpdraftPlus::get_current_clean_url();?>"><?php _e('Upload backup files', 'updraftplus'); ?> |
					<?php
					}
				?>
				<a href="<?php echo UpdraftPlus::get_current_clean_url();?>" class="updraft_rescan_local" title="<?php echo __('Press here to look inside your UpdraftPlus directory (in your web hosting space) for any new backup sets that you have uploaded.', 'updraftplus').' '.__('The location of this directory is set in the expert settings, in the Settings tab.', 'updraftplus'); ?>"><?php _e('Rescan local folder for new backup sets', 'updraftplus');?>
				| <a href="<?php echo UpdraftPlus::get_current_clean_url();?>" class="updraft_rescan_remote" title="<?php _e('Press here to look inside your remote storage methods for any existing backup sets (from any site, if they are stored in the same folder).', 'updraftplus'); ?>"><?php _e('Rescan remote storage', 'updraftplus');?>

			<?php if (!empty($options['include_opera_warning'])) { ?>

<?php _e('Opera web browser', 'updraftplus');?>: <?php _e('If you are using this, then turn Turbo/Road mode off.', 'updraftplus');?>

			<?php } ?>

		<?php
			if (!empty($options['include_uploader'])) {
			?>

			<div id="updraft-plupload-modal" style="display:none;" title="<?php _e('UpdraftPlus - Upload backup files', 'updraftplus'); ?>">

<?php _e("Upload files into UpdraftPlus.", 'updraftplus');?> <?php echo htmlspecialchars(__('Or, you can place them manually into your UpdraftPlus directory (usually wp-content/updraft), e.g. via FTP, and then use the "rescan" link above.', 'updraftplus'));?>

			<?php
			if (version_compare($updraftplus->get_wordpress_version(), '3.3', '<')) {
				echo ''.sprintf(__('This feature requires %s version %s or later', 'updraftplus'), 'WordPress', '3.3').'';
			} else {
				?>

<?php _e('Drop backup files here', 'updraftplus'); ?>

<?php _ex('or', 'Uploader: Drop backup files here - or - Select Files'); ?>

<input id="plupload-browse-button" type="button" value="<?php esc_attr_e('Select Files'); ?>" class="button" />

				<?php
			}
			?>

		<?php
			}
		?>

			<?php echo UpdraftPlus_Backup_History::existing_backup_table($backup_history); ?>


text:
'use strict';

import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import 'rxjs/add/operator/debounceTime';
import 'rxjs/add/operator/distinctUntilChanged';
import 'rxjs/add/operator/retry';
import _ from 'lodash';

import { ProfileService } from '../profile.service';
import { LocationService } from '../../shared/location.service';
import { Location } from '../../shared/location.model';
import { User } from '../../shared/auth/user.model';

/** Component that handles the edit profile form page. */
@Component({
	selector: 'tbv-profile-edit',
	templateUrl: 'client/profile/edit/edit-profile.component.html',
	styleUrls: ['client/profile/edit/edit-profile.component.css'],
})
export class EditProfileComponent implements OnInit {

	private profileForm: FormGroup;
	private model: User;
	private locations: Location[];

	constructor(
		private profileService: ProfileService,
		private locationService: LocationService,
		private fb: FormBuilder,
		private router: Router,
	) { }

	/** Requests the authenticated user's profile. */
	ngOnInit() {
		this.profileService.find().subscribe(
			user => {
				this.model = user;
				this.profileForm = this.fb.group({
					'name': [user.name, Validators.required],
					'nickname': [user.nickname],
					'location': [user.location, Validators.required],
				});
				this.watchLocation();
			},
			this.redirectOnError.bind(this)
		);
	}

	/** Provides autocomplete functionality for the 'location' field. */
	private watchLocation() {
		this.profileForm.get('location').valueChanges
			.debounceTime(400).distinctUntilChanged()
			.filter(value => value.length > 2)
			.flatMap(value => this.locationService.search(2, value))
			.retry() // so 404 will re-subscribe
			.subscribe(
				locations => this.locations = locations,
				this.redirectOnError.bind(this)
			);
	}

	/** Handler for the autocomplete's choose item event */
	onChoose(location: Location) {
		this.locations = null;
		this.profileForm.get('location').setValue(location);
	}

	/** Submit button event handler. */
	onSubmit() {
		// TODO should update auth0 profile
		_.assign(this.model, this.profileForm.value);
		this.profileService.save(this.model).subscribe(
			user => this.router.navigate(['profile', this.model._key]),
			this.redirectOnError.bind(this)
		);
	}

	/** Cancel button event handler. */
	onCancel() {
		this.router.navigate(['profile', this.model._key]);
	}

	/** Toggles visibility of the error message for the given field. */
	showError(control: string) {
		return this.profileForm.get(control).valid ? "hidden" : "inherit";
	}

	get user() { return this.model; }

	private redirectOnError(error: { status: any }) {
		this.router.navigate(['/error', error.status], { skipLocationChange: true });
	}

}


text:
import uuid

try:
    from neutron.extensions import loadbalancer
except ImportError:
    from neutron_lbaas.extensions import loadbalancer

from neutron.openstack.common import uuidutils
from vnc_api.vnc_api import IdPermsType, NoIdError
from vnc_api.vnc_api import LoadbalancerMember, LoadbalancerMemberType

from resource_manager import ResourceManager

class LoadbalancerMemberManager(ResourceManager):
    _loadbalancer_member_type_mapping = {
        'admin_state': 'admin_state_up',
        'status': 'status',
        'protocol_port': 'protocol_port',
        'weight': 'weight',
        'address': 'address',
    }

    @property
    def property_type_mapping(self):
        return self._loadbalancer_member_type_mapping

    def make_properties(self, member):
        props = LoadbalancerMemberType()
        for key, mapping in self._loadbalancer_member_type_mapping.iteritems():
            if mapping in member:
                setattr(props, key, member[mapping])
        return props

    def _get_member_pool_id(self, member):
        pool_uuid = member.parent_uuid
        return pool_uuid

    def make_dict(self, member, fields=None):
        res = {'id': member.uuid,
               'pool_id': member.parent_uuid,
               'status': self._get_object_status(member)}

        try:
            pool = self._api.loadbalancer_pool_read(id=member.parent_uuid)
            res['tenant_id'] = pool.parent_uuid.replace('-', '')
        except NoIdError:
            pass

        props = member.get_loadbalancer_member_properties()
        for key, mapping in self._loadbalancer_member_type_mapping.iteritems():
            value = getattr(props, key, None)
            if value is not None:
                res[mapping] = value

        return self._fields(res, fields)

    def resource_read(self, id):
        return self._api.loadbalancer_member_read(id=id)

    def resource_list(self, tenant_id=None):
        """ In order to retrive all the members for a specific tenant
        the code iterates through all the pools.
        """
        if tenant_id is None:
            return self._api.loadbalancer_members_list()

        pool_list = self._api.loadbalancer_pools_list(tenant_id)
        if 'loadbalancer-pools' not in pool_list:
            return {}

        member_list = []
        for pool in pool_list['loadbalancer-pools']:
            pool_members = self._api.loadbalancer_members_list(
                parent_id=pool['uuid'])
            if 'loadbalancer-members' in pool_members:
                member_list.extend(pool_members['loadbalancer-members'])

        response = {'loadbalancer-members': member_list}
        return response

    def get_collection(self, context, filters=None, fields=None):
        """ Optimize the query for members in a pool.
        """
        if 'pool_id' not in filters:
            return super(LoadbalancerMemberManager, self).get_collection(
                context, filters, fields)

        member_list = []
        for pool in filters['pool_id']:
            pool_members = self._api.loadbalancer_members_list(
                parent_id=pool)
            if 'loadbalancer-members' in pool_members:
                member_list.extend(pool_members['loadbalancer-members'])

        response = []
        for m in member_list:
            res = self._get_resource_dict(m['uuid'], filters, fields)
            if res is not None and self._is_authorized(context, res):
                response.append(res)

        return response

    def resource_update(self, obj):
        return self._api.loadbalancer_member_update(obj)

    def resource_delete(self, id):
        return self._api.loadbalancer_member_delete(id=id)

    def get_exception_notfound(self, id=None):
        return loadbalancer.MemberNotFound(member_id=id)

    def get_exception_inuse(self, id=None):
        pass

    @property
    def neutron_name(self):
        return "member"

    @property
    def resource_name_plural(self):
        return "loadbalancer-members"

    def create(self, context, member):
        """
        Create a loadbalancer_member object.
        """
        m = member['member']
        try:
            pool = self._api.loadbalancer_pool_read(id=m['pool_id'])
        except NoIdError:
            raise loadbalancer.PoolNotFound(pool_id=m['pool_id'])

        tenant_id = self._get_tenant_id_for_create(context, m)
        if str(uuid.UUID(tenant_id)) != pool.parent_uuid:
            raise n_exc.NotAuthorized()

        obj_uuid = uuidutils.generate_uuid()
        props = self.make_properties(m)
        id_perms = IdPermsType(enable=True)

        member_db = LoadbalancerMember(
            obj_uuid, pool, loadbalancer_member_properties=props,
            id_perms=id_perms)
        member_db.uuid = obj_uuid

        self._api.loadbalancer_member_create(member_db)
        return self.make_dict(member_db)

    def update_properties(self, member_db, id, m):
        props = member_db.get_loadbalancer_member_properties()
        if self.update_properties_subr(props, m):
            member_db.set_loadbalancer_member_properties(props)
            return True
        return False

    def update_object(self, member_db, id, m):
        old_pool_id = self._get_member_pool_id(member_db)
        if 'pool_id' in m and m['pool_id'] != old_pool_id:
            pool_id = m['pool_id']
        else:
            pool_id = old_pool_id

        try:
            pool = self._api.loadbalancer_pool_read(id=pool_id)
        except NoIdError:
            raise loadbalancer.PoolNotFound(pool_id=pool_id)

        if pool_id != old_pool_id:
            db_props = member_db.get_loadbalancer_member_properties()
            members = pool.get_loadbalancer_members()
            for member in members or []:
                member_obj = self._api.loadbalancer_member_read(
                    id=member['uuid'])
                props = member_obj.get_loadbalancer_member_properties()
                if ((props.get_address() == db_props.get_address()) and
                    (props.get_protocol_port() == db_props.get_protocol_port())):
                    raise loadbalancer.MemberExists(
                        address=props.get_address(),
                        port=props.get_protocol_port(),
                        pool=m['pool_id'])

        # delete member from old pool
        props = member_db.get_loadbalancer_member_properties()
        obj_uuid = member_db.uuid
        self._api.loadbalancer_member_delete(id=member_db.uuid)

        # create member for the new pool with same uuid and props
        id_perms = IdPermsType(enable=True)
        member_obj = LoadbalancerMember(
            obj_uuid, pool, loadbalancer_member_properties=props,
            id_perms=id_perms)
        member_obj.uuid = obj_uuid
        self._api.loadbalancer_member_create(member_obj)

        return True


text:
import subprocess
import os
import argparse

from . import vectorize_config_parser

if os.name == 'posix':
    try:
        defaultgimp = subprocess.check_output(["which", "gimp"])[:-1]
    except subprocess.CalledProcessError:
        defaultgimp = '/Applications/Gimp.app/Contents/MacOS/gimp-2.8'
else:
    defaultgimp = '/Applications/Gimp.app/Contents/MacOS/gimp-2.8'

author_information = 'NYPL Labs Map Vectorizer v0.2 by Mauricio Giraldo Arteaga @mgiraldo / @nypl_labs / Thomas Levine (https://thomaslevine.com)'

parser = argparse.ArgumentParser(description = author_information)
parser.add_argument('inputfile', metavar = '<input file or dir>')
if os.path.isfile(defaultgimp):
    parser.add_argument('--gimp-path', default = defaultgimp)
else:
    parser.add_argument('--gimp-path', required = True)
parser.add_argument('--chunksize', default = 50000,
                    help = 'how to split the mega polygon file')

# Load the default vectorize_config
fn = os.path.abspath(os.path.join(__file__, '..', 'vectorize_config_default.txt'))
def vectorize_config(fn):
    if os.path.isfile(fn):
        with open(fn) as fp:
            vectorize_config = vectorize_config_parser.parse(fp)
        return vectorize_config
    else:
        raise ValueError('%s is not a file.' % fn)

parser.add_argument('--image-processing-configuration-file', '-p',
                    default = vectorize_config(fn), type = vectorize_config,
                    dest = 'vectorize_config')


text:
alias rsync="rsync --partial --progress --human-readable --compress"
alias less="less --ignore-case --raw-control-chars"
alias mkdir="mkdir -vp"
alias cp="cp -irv"
alias rm="rm -iv"
alias mv="mv -iv"
alias df="df -H"
alias bc="bc -lq"

# git aliases
## Git CLone
alias gcl='git clone'
## Git Pull (Get)
alias gget='git pull'
## Git Put (Push)
alias gput='git push'
## Git Status
alias gs='git status'
## Git ComMit Message
alias gcmm='git commit -m'
## Git SHow
alias gsh='git show'
## Git Show HEAD@{N}
gshn () {
  ([ -z "$1" ] || [ $(($1)) -lt 0 ]) && echo 'Invalid integer!' && return
  git show HEAD@{$1}
}

# platform-specific aliases
if [ $LINUX ]; then
  alias ls='ls --color=auto'

elif [ $DARWIN ]; then
  # `fuck` for `thefuck` if it's installed
  command -v thefuck >/dev/null 2>&1 && {
    eval "$(thefuck --alias)"
  }

  # `buu` to update and upgrade `brew` if `brew` exists
  command -v brew >/dev/null 2>&1 && {
    alias buu='brew update && brew upgrade'
  }

elif [ $WINDOWS ]; then
  # alias for the `clear` command at cygwin
  alias clear='printf "\033c"'
fi


text:
//
//  CroppableBitmapRep.h
//  ImageManip
//
//  Created by Alex Nichol on 7/12/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "BitmapContextManipulator.h"

@protocol BitmapCropManipulator

@optional
- (void)cropFrame:(CGRect)frame;
- (void)cropTopFrame:(CGRect)frame;
- (void)cropTopEllipse:(CGRect)frame;
- (CGImageRef)croppedImageWithFrame:(CGRect)frame;

@end

@interface BitmapCropManipulator : BitmapContextManipulator {

}

/**
 * Cuts a part of the bitmap out for a new bitmap.
 * @param frame The rectangle from which a portion of the image will
 * be cut.
 * The coordinates for this start at (0,0).
 * @discussion The coordinates for this method begin in the bottom
 * left corner.  For a coordinate system starting from the top
 * left corner, use cropTopFrame: instead.
 */
- (void)cropFrame:(CGRect)frame;

/**
 * Cuts a part of the bitmap out for a new bitmap.
 * @param frame The rectangle from which a portion of the image will
 * be cut.
 * The coordinates for this start at (0,0).
 * @discussion The coordinates for this method begin in the top
 * left corner.  For a coordinate system starting from the bottom
 * left corner, use cropFrame: instead.
 */
- (void)cropTopFrame:(CGRect)frame;

/**
 * Cuts an ellipse of the bitmap out for a new bitmap.
 * @param frame The rectangle around the ellipse to be cut. The
 * coordinates for this start at (0,0).
 * @discussion The coordinates for this method begin in the top
 * left corner.  There is no alternative.
 */
- (void)cropTopEllipse:(CGRect)frame;

/**
 * Creates a new CGImageRef by cutting out a portion of this one.
 * This takes its behavoir from cropFrame.
 * @return An autoreleased CGImageRef that has been cropped from this
 * image.
 */
- (CGImageRef)croppedImageWithFrame:(CGRect)frame;

@end


text:
require "csv"

module ResourceRows
  extend ActiveSupport::Concern

  included do
    attr_accessor :user

    attribute :rows, String

    validates :rows, presence: true

    def self.row_model(model)
      define_method :new_resources do
        @new_resources ||= attrs_list.map { |attrs| model.new(attrs) }
      end
    end

    def valid?
      super && new_resources.all?(&:valid?)
    end

    def save!
      new_resources_with_user.each(&:save_and_create_activity!)
    end

    private

    def parsed_rows
      # Replace double quote to avoid `CSV::MalformedCSVError`
      rows = self.rows.gsub(/"/, "__double_quote__")

      CSV.parse(rows).map do |row_columns|
        row_columns.map { |column| column&.gsub("__double_quote__", '"')&.strip }
      end
    end

    def new_resources_with_user
      @new_resources_with_user ||= new_resources.map do |resource|
        resource.user = @user
        resource
      end
    end
  end
end