text:
<?xml version="1.0" encoding="ISO-8859-1"?><RECIPES>
<RECIPE>
 <NAME>Clone Triple Karmeliet</NAME>
 <VERSION>1</VERSION>
 <TYPE>All Grain</TYPE>
 <BREWER>Erik</BREWER>
 <ASST_BREWER></ASST_BREWER>
 <BATCH_SIZE>5.5000000</BATCH_SIZE>
 <BOIL_SIZE>7.8200000</BOIL_SIZE>
 <BOIL_TIME>90.0000000</BOIL_TIME>
 <EFFICIENCY>60.0000000</EFFICIENCY>
 <HOPS>
<HOP>
 <NAME>Hallertau</NAME>
 <VERSION>1</VERSION>
 <ORIGIN>Germany</ORIGIN>
 <ALPHA>3.8000000</ALPHA>
 <AMOUNT>0.0081743</AMOUNT>
 <USE>Boil</USE>
 <TIME>90.0000000</TIME>
 <NOTES>Very long history in German Lagers and its aromatic and flavor properties help to describe generations of beers from the area.
Used for: German Ales, Pilsners, German/US/Canadian Lagers, Wheat Beers
Aroma: Pleasant, mild spicy flavor, clean, neutral flavor
Substitutes: Crystal, Liberty, Hallertauer Mittelfrueh
Storage: Fair (50-60% AA after 6 months at 20 C)
3.5-5.5% AA / 3-4% Beta</NOTES>
 <TYPE>Aroma</TYPE>
 <FORM>Pellet</FORM>
 <BETA>2.8000000</BETA>
 <HSI>55.0000000</HSI>
 <DISPLAY_AMOUNT>8.17 g</DISPLAY_AMOUNT>
 <INVENTORY>0.00 g</INVENTORY>
 <DISPLAY_TIME>90.0 min</DISPLAY_TIME>
</HOP>
<HOP>
 <NAME>Hallertau</NAME>
 <VERSION>1</VERSION>
 <ORIGIN>Germany</ORIGIN>
 <ALPHA>4.8000000</ALPHA>
 <AMOUNT>0.0024186</AMOUNT>
 <USE>Boil</USE>
 <TIME>15.0000000</TIME>
 <NOTES>Very long history in German Lagers and its aromatic and flavor properties help to describe generations of beers from the area.
Used for: German Ales, Pilsners, German/US/Canadian Lagers, Wheat Beers
Aroma: Pleasant, mild spicy flavor, clean, neutral flavor
Substitutes: Crystal, Liberty, Hallertauer Mittelfrueh
Storage: Fair (50-60% AA after 6 months at 20 C)
3.5-5.5% AA / 3-4% Beta</NOTES>
 <TYPE>Aroma</TYPE>
 <FORM>Pellet</FORM>
 <BETA>4.0000000</BETA>
 <HSI>55.0000000</HSI>
 <DISPLAY_AMOUNT>2.42 g</DISPLAY_AMOUNT>
 <INVENTORY>0.00 g</INVENTORY>
 <DISPLAY_TIME>15.0 min</DISPLAY_TIME>
</HOP>
</HOPS>

 <FERMENTABLES>
<FERMENTABLE>
 <NAME>Lager Malt</NAME>
 <VERSION>1</VERSION>
 <TYPE>Grain</TYPE>
 <AMOUNT>1.7494269</AMOUNT>
 <YIELD>82.5000000</YIELD>
 <COLOR>3.9400000</COLOR>
 <ADD_AFTER_BOIL>FALSE</ADD_AFTER_BOIL>
 <ORIGIN></ORIGIN>
 <SUPPLIER></SUPPLIER>
 <NOTES>Very light lager malt used to make Pilsners, Lagers and other light beers.  May be used as a base malt.</NOTES>
 <COARSE_FINE_DIFF>1.5000000</COARSE_FINE_DIFF>
 <MOISTURE>4.0000000</MOISTURE>
 <DIASTATIC_POWER>100.0000000</DIASTATIC_POWER>
 <PROTEIN>11.0000000</PROTEIN>
 <MAX_IN_BATCH>100.0000000</MAX_IN_BATCH>
 <RECOMMEND_MASH>TRUE</RECOMMEND_MASH>
 <IBU_GAL_PER_LB>0.0000000</IBU_GAL_PER_LB>
 <DISPLAY_AMOUNT>1749.43 g</DISPLAY_AMOUNT>
 <INVENTORY>0.00 g</INVENTORY>
 <POTENTIAL>1.0379500</POTENTIAL>
 <DISPLAY_COLOR>3.9 EBC</DISPLAY_COLOR>
 <EXTRACT_SUBSTITUTE>Pilsner Liquid Extract</EXTRACT_SUBSTITUTE>
</FERMENTABLE>
<FERMENTABLE>
 <NAME>Wheat Malt (Gambrinus)</NAME>
 <VERSION>1</VERSION>
 <TYPE>Grain</TYPE>
 <AMOUNT>0.2842819</AMOUNT>
 <YIELD>84.0000000</YIELD>
 <COLOR>4.5310000</COLOR>
 <ADD_AFTER_BOIL>FALSE</ADD_AFTER_BOIL>
 <ORIGIN>Canada</ORIGIN>
 <SUPPLIER>Gambrunus</SUPPLIER>
 <NOTES>Processed from the finest Canadian wheat available, this wheat malt may be used in wheat beers of all types.</NOTES>
 <COARSE_FINE_DIFF>1.5000000</COARSE_FINE_DIFF>
 <MOISTURE>4.5000000</MOISTURE>
 <DIASTATIC_POWER>74.0000000</DIASTATIC_POWER>
 <PROTEIN>12.0000000</PROTEIN>
 <MAX_IN_BATCH>60.0000000</MAX_IN_BATCH>
 <RECOMMEND_MASH>TRUE</RECOMMEND_MASH>
 <IBU_GAL_PER_LB>0.0000000</IBU_GAL_PER_LB>
 <DISPLAY_AMOUNT>284.28 g</DISPLAY_AMOUNT>
 <INVENTORY>0.00 g</INVENTORY>
 <POTENTIAL>1.0386400</POTENTIAL>
 <DISPLAY_COLOR>4.5 EBC</DISPLAY_COLOR>
 <EXTRACT_SUBSTITUTE>Wheat Liquid Extract</EXTRACT_SUBSTITUTE>
</FERMENTABLE>
<FERMENTABLE>
 <NAME>Oats, Malted (Thomas Fawcett)</NAME>
 <VERSION>1</VERSION>
 <TYPE>Grain</TYPE>
 <AMOUNT>0.1530749</AMOUNT>
 <YIELD>71.7000000</YIELD>
 <COLOR>3.9400000</COLOR>
 <ADD_AFTER_BOIL>FALSE</ADD_AFTER_BOIL>
 <ORIGIN>United Kingdom</ORIGIN>
 <SUPPLIER>Thomas Fawcett & Sons</SUPPLIER>
 <NOTES>Malted oats - used in stouts and porters to add body and head retention as well as a unique flavor.</NOTES>
 <COARSE_FINE_DIFF>1.5000000</COARSE_FINE_DIFF>
 <MOISTURE>4.0000000</MOISTURE>
 <DIASTATIC_POWER>0.0000000</DIASTATIC_POWER>
 <PROTEIN>13.0000000</PROTEIN>
 <MAX_IN_BATCH>10.0000000</MAX_IN_BATCH>
 <RECOMMEND_MASH>TRUE</RECOMMEND_MASH>
 <IBU_GAL_PER_LB>0.0000000</IBU_GAL_PER_LB>
 <DISPLAY_AMOUNT>153.07 g</DISPLAY_AMOUNT>
 <INVENTORY>0.00 g</INVENTORY>
 <POTENTIAL>1.0329820</POTENTIAL>
 <DISPLAY_COLOR>3.9 EBC</DISPLAY_COLOR>
 <EXTRACT_SUBSTITUTE>Carafoam</EXTRACT_SUBSTITUTE>
</FERMENTABLE>
<FERMENTABLE>
 <NAME>Candi Sugar, Clear</NAME>
 <VERSION>1</VERSION>
 <TYPE>Sugar</TYPE>
 <AMOUNT>0.1404998</AMOUNT>
 <YIELD>78.3000000</YIELD>
 <COLOR>0.9850000</COLOR>
 <ADD_AFTER_BOIL>FALSE</ADD_AFTER_BOIL>
 <ORIGIN>Belgium</ORIGIN>
 <SUPPLIER></SUPPLIER>
 <NOTES>Crystalized Candi Sugar (Sucrose) used in many Belgian Tripels, Dubbels, and holiday ales.  Adds head retention and sweet aroma to beer.  Darker variants also add color.</NOTES>
 <COARSE_FINE_DIFF>1.5000000</COARSE_FINE_DIFF>
 <MOISTURE>4.0000000</MOISTURE>
 <DIASTATIC_POWER>120.0000000</DIASTATIC_POWER>
 <PROTEIN>11.7000000</PROTEIN>
 <MAX_IN_BATCH>20.0000000</MAX_IN_BATCH>
 <RECOMMEND_MASH>FALSE</RECOMMEND_MASH>
 <IBU_GAL_PER_LB>0.0000000</IBU_GAL_PER_LB>
 <DISPLAY_AMOUNT>140.50 g</DISPLAY_AMOUNT>
 <INVENTORY>0.00 g</INVENTORY>
 <POTENTIAL>1.0360180</POTENTIAL>
 <DISPLAY_COLOR>1.0 EBC</DISPLAY_COLOR>
 <EXTRACT_SUBSTITUTE></EXTRACT_SUBSTITUTE>
</FERMENTABLE>
</FERMENTABLES>

 <MISCS>
<MISC>
 <NAME>Licorice Root</NAME>
 <VERSION>1</VERSION>
 <TYPE>Flavor</TYPE>
 <USE>Boil</USE>
 <AMOUNT>0.003697</AMOUNT>
 <TIME>15.00</TIME>
 <AMOUNT_IS_WEIGHT>FALSE</AMOUNT_IS_WEIGHT>
 <USE_FOR>Licorice Flavor</USE_FOR>
 <NOTES>Traditionally used in dark beers such as Porters and Stouts, this root imparts a very distinct licorice flavor and is surprisingly sweet. It contains Glycyrrhizin, a substance 50 times sweeter than sugar! Use about 1/2 - 1 ounce per 5 gallons and add for the last few minutes of the boil. </NOTES>
 <DISPLAY_AMOUNT>0.12 oz</DISPLAY_AMOUNT>
 <INVENTORY>0.00 oz</INVENTORY>
 <DISPLAY_TIME>15.0 mins</DISPLAY_TIME>
 <BATCH_SIZE>18.93 l</BATCH_SIZE>
</MISC>
<MISC>
 <NAME>Orange Peel, Sweet</NAME>
 <VERSION>1</VERSION>
 <TYPE>Spice</TYPE>
 <USE>Boil</USE>
 <AMOUNT>0.009759</AMOUNT>
 <TIME>5.00</TIME>
 <AMOUNT_IS_WEIGHT>FALSE</AMOUNT_IS_WEIGHT>
 <USE_FOR>Holiday Beers</USE_FOR>
 <NOTES>Adds a Conitreau or Grand Marnier flavor to your beer.  Used primarily in Belgian Strong Ale and Holiday Ales to add a sweet orange flavor and aroma.</NOTES>
 <DISPLAY_AMOUNT>0.33 oz</DISPLAY_AMOUNT>
 <INVENTORY>0.00 oz</INVENTORY>
 <DISPLAY_TIME>5.0 mins</DISPLAY_TIME>
 <BATCH_SIZE>18.93 l</BATCH_SIZE>
</MISC>
<MISC>
 <NAME>Coriander Seed</NAME>
 <VERSION>1</VERSION>
 <TYPE>Spice</TYPE>
 <USE>Boil</USE>
 <AMOUNT>0.002588</AMOUNT>
 <TIME>0.00</TIME>
 <AMOUNT_IS_WEIGHT>FALSE</AMOUNT_IS_WEIGHT>
 <USE_FOR>Belgian Wit</USE_FOR>
 <NOTES>Used in Belgian Wit, Whites, and Holiday ales.  Very good when used in light wheat ales.  Often used with Bitter Orange Peel.</NOTES>
 <DISPLAY_AMOUNT>0.09 oz</DISPLAY_AMOUNT>
 <INVENTORY>0.00 oz</INVENTORY>
 <DISPLAY_TIME>0.0 mins</DISPLAY_TIME>
 <BATCH_SIZE>18.93 l</BATCH_SIZE>
</MISC>
</MISCS>

 <YEASTS>
<YEAST>
 <NAME>SafBrew Specialty Ale</NAME>
 <VERSION>1</VERSION>
 <TYPE>Ale</TYPE>
 <FORM>Dry</FORM>
 <AMOUNT>0.0236590</AMOUNT>
 <AMOUNT_IS_WEIGHT>FALSE</AMOUNT_IS_WEIGHT>
 <LABORATORY>DCL/Fermentis</LABORATORY>
 <PRODUCT_ID>T-58</PRODUCT_ID>
 <MIN_TEMPERATURE>15.5555556</MIN_TEMPERATURE>
 <MAX_TEMPERATURE>22.2222222</MAX_TEMPERATURE>
 <FLOCCULATION>Medium</FLOCCULATION>
 <ATTENUATION>73.0000000</ATTENUATION>
 <NOTES>Estery, somewhat spicy ale yeast. Solid yeast formation at end of fermentation.  Widely used for bottle and cask conditioning.</NOTES>
 <BEST_FOR>Complex ales.</BEST_FOR>
 <MAX_REUSE>5</MAX_REUSE>
 <TIMES_CULTURED>0</TIMES_CULTURED>
 <ADD_TO_SECONDARY>FALSE</ADD_TO_SECONDARY>
 <DISPLAY_AMOUNT>23.66 ml</DISPLAY_AMOUNT>
 <DISP_MIN_TEMP>15.6 C</DISP_MIN_TEMP>
 <DISP_MAX_TEMP>22.2 C</DISP_MAX_TEMP>
 <INVENTORY>0.0 pkg</INVENTORY>
 <CULTURE_DATE>14/06/03</CULTURE_DATE>
</YEAST>
</YEASTS>

 <STYLE>
 <NAME>Belgian Tripel</NAME>
 <VERSION>1</VERSION>
 <CATEGORY>Belgian Strong Ale</CATEGORY>
 <CATEGORY_NUMBER>18</CATEGORY_NUMBER>
 <STYLE_LETTER>C</STYLE_LETTER>
 <STYLE_GUIDE>BJCP 2008</STYLE_GUIDE>
 <TYPE>Ale</TYPE>
 <OG_MIN>1.0750000</OG_MIN>
 <OG_MAX>1.0850000</OG_MAX>
 <FG_MIN>1.0080000</FG_MIN>
 <FG_MAX>1.0140000</FG_MAX>
 <IBU_MIN>20.0000000</IBU_MIN>
 <IBU_MAX>40.0000000</IBU_MAX>
 <COLOR_MIN>8.8650000</COLOR_MIN>
 <COLOR_MAX>13.7900000</COLOR_MAX>
 <CARB_MIN>2.4000000</CARB_MIN>
 <CARB_MAX>3.0000000</CARB_MAX>
 <ABV_MAX>9.5000000</ABV_MAX>
 <ABV_MIN>7.5000000</ABV_MIN>
 <NOTES>Strongly resembles a Strong Golden Ale but slightly darker and somewhat fuller-bodied. Usually has a
more rounded malt flavor but should not be sweet. Originally popularized by the Trappist monastery at Westmalle. High in alcohol but does not taste strongly of alcohol. The best examples are sneaky, not obvious. High carbonation and attenuation helps to bring out the many flavors and to increase the perception of a dry finish. Most Trappist versions have at least 30 IBUs and are very dry. Traditionally bottle-conditioned (“refermented in the bottle”).</NOTES>
 <PROFILE>Aroma: Complex with moderate to significant spiciness, moderate fruity esters and low alcohol and hop aromas. Generous spicy, peppery, sometimes clove-like phenols. Esters are often reminiscent of citrus fruits such as oranges, but may sometimes have a slight banana character. A low yet distinctive spicy, floral, sometimes perfumy hop character is usually found. Alcohols are soft, spicy and low in intensity. No hot alcohol or solventy aromas. The malt character is light. No diacetyl.
Appearance: Deep yellow to deep gold in color. Good clarity. Effervescent. Long-lasting, creamy, rocky, white head resulting in characteristic “Belgian lace” on the glass as it fades.
Flavor: Marriage of spicy, fruity and alcohol flavors supported by a soft malt character. Low to moderate phenols are peppery in character. Esters are reminiscent of citrus fruit such as orange or sometimes lemon. A low to moderate spicy hop character is usually found. Alcohols are soft, spicy, often a bit sweet and low in intensity. Bitterness is typically medium to high from a combination of hop bitterness and yeast-produced phenolics. Substantial carbonation and bitterness lends a dry finish with a moderately bitter aftertaste. No diacetyl.
Mouthfeel: Medium-light to medium body, although lighter than the substantial gravity would suggest (thanks to sugar and high carbonation). High alcohol content adds a pleasant creaminess but little to no obvious warming sensation. No hot alcohol or solventy character. Always effervescent. Never astringent.</PROFILE>
 <INGREDIENTS>The light color and relatively light body for a beer of this strength are the result of using Pilsner malt and up to 20% white sugar. Noble hops or Styrian Goldings are commonly used. Belgian yeast strains are used – those that produce fruity esters, spicy phenolics and higher alcohols – often aided by slightly warmer fermentation temperatures. Spice additions are generally not traditional, and if used, should not be recognizable as such. Fairly soft water.</INGREDIENTS>
 <EXAMPLES>Westmalle Tripel, La Rulles Tripel, St. Bernardus Tripel, Chimay Cinq Cents (White), Watou Tripel, Val-Dieu Triple, Affligem Tripel, Grimbergen Tripel, La Trappe Tripel, Witkap Pater Tripel, Corsendonk Abbey Pale Ale, St. Feuillien Tripel, Bink Tripel, Tripel Karmeliet, New Belgium Trippel, Unibroue La Fin du Monde, Dragonmead Final Absolution, Allagash Tripel Reserve, Victory Golden Monkey</EXAMPLES>
 <DISPLAY_OG_MIN>1.075 SG</DISPLAY_OG_MIN>
 <DISPLAY_OG_MAX>1.085 SG</DISPLAY_OG_MAX>
 <DISPLAY_FG_MIN>1.008 SG</DISPLAY_FG_MIN>
 <DISPLAY_FG_MAX>1.014 SG</DISPLAY_FG_MAX>
 <DISPLAY_COLOR_MIN>8.9 EBC</DISPLAY_COLOR_MIN>
 <DISPLAY_COLOR_MAX>13.8 EBC</DISPLAY_COLOR_MAX>
 <OG_RANGE>1,075-1,085 SG</OG_RANGE>
 <FG_RANGE>1,008-1,014 SG</FG_RANGE>
 <IBU_RANGE>20,0-40,0 IBUs</IBU_RANGE>
 <CARB_RANGE>2,40-3,00 Vols</CARB_RANGE>
 <COLOR_RANGE>8,9-13,8 EBC</COLOR_RANGE>
 <ABV_RANGE>7,50-9,50 %</ABV_RANGE>
</STYLE>

 <EQUIPMENT>
 <NAME>02 - 7L, 2.5L Top Up, No Sparge</NAME>
 <VERSION>1</VERSION>
 <BOIL_SIZE>7.8200000</BOIL_SIZE>
 <BATCH_SIZE>5.5000000</BATCH_SIZE>
 <TUN_VOLUME>9.0000000</TUN_VOLUME>
 <TUN_WEIGHT>4.5359200</TUN_WEIGHT>
 <TUN_SPECIFIC_HEAT>0.3000000</TUN_SPECIFIC_HEAT>
 <TOP_UP_WATER>0.0000000</TOP_UP_WATER>
 <TRUB_CHILLER_LOSS>0.0000000</TRUB_CHILLER_LOSS>
 <EVAP_RATE>17.9028133</EVAP_RATE>
 <BOIL_TIME>90.0000000</BOIL_TIME>
 <CALC_BOIL_VOLUME>TRUE</CALC_BOIL_VOLUME>
 <LAUTER_DEADSPACE>0.0000000</LAUTER_DEADSPACE>
 <TOP_UP_KETTLE>3.0000000</TOP_UP_KETTLE>
 <HOP_UTILIZATION>100.0000000</HOP_UTILIZATION>
 <COOLING_LOSS_PCT>4.0000000</COOLING_LOSS_PCT>
 <NOTES></NOTES>
 <DISPLAY_BOIL_SIZE>7.82 l</DISPLAY_BOIL_SIZE>
 <DISPLAY_BATCH_SIZE>5.50 l</DISPLAY_BATCH_SIZE>
 <DISPLAY_TUN_VOLUME>9.00 l</DISPLAY_TUN_VOLUME>
 <DISPLAY_TUN_WEIGHT>4535.92 g</DISPLAY_TUN_WEIGHT>
 <DISPLAY_TOP_UP_WATER>0.00 l</DISPLAY_TOP_UP_WATER>
 <DISPLAY_TRUB_CHILLER_LOSS>0.00 l</DISPLAY_TRUB_CHILLER_LOSS>
 <DISPLAY_LAUTER_DEADSPACE>0.00 l</DISPLAY_LAUTER_DEADSPACE>
 <DISPLAY_TOP_UP_KETTLE>3.00 l</DISPLAY_TOP_UP_KETTLE>
</EQUIPMENT>

 <MASH>
 <NAME>01 - No Sparge, Full Body</NAME>
 <VERSION>1</VERSION>
 <GRAIN_TEMP>22.2000000</GRAIN_TEMP>
 <TUN_TEMP>22.2000000</TUN_TEMP>
 <SPARGE_TEMP>75.6000000</SPARGE_TEMP>
 <PH>5.2000000</PH>
 <TUN_WEIGHT>160.0000000</TUN_WEIGHT>
 <TUN_SPECIFIC_HEAT>0.3000000</TUN_SPECIFIC_HEAT>
 <EQUIP_ADJUST>TRUE</EQUIP_ADJUST>
 <NOTES>Brew in a bag method where the full boil volume is mashed within the boil vessel and then the grains are withdrawn at the end of the mash.  No active sparging is required.  This is a medium body beer profile.</NOTES>
 <DISPLAY_GRAIN_TEMP>22.2 C</DISPLAY_GRAIN_TEMP>
 <DISPLAY_TUN_TEMP>22.2 C</DISPLAY_TUN_TEMP>
 <DISPLAY_SPARGE_TEMP>75.6 C</DISPLAY_SPARGE_TEMP>
 <DISPLAY_TUN_WEIGHT>4535.92 g</DISPLAY_TUN_WEIGHT>
<MASH_STEPS>
<MASH_STEP>
 <NAME>Saccharification</NAME>
 <VERSION>1</VERSION>
 <TYPE>Infusion</TYPE>
 <INFUSE_AMOUNT>7.0080900</INFUSE_AMOUNT>
 <STEP_TIME>30.0000000</STEP_TIME>
 <STEP_TEMP>63.0000000</STEP_TEMP>
 <RAMP_TIME>10.0000000</RAMP_TIME>
 <END_TEMP>63.0000000</END_TEMP>
 <DESCRIPTION>Add 7,01 l of water at 75,8 C</DESCRIPTION>
 <WATER_GRAIN_RATIO>3,205 l/kg</WATER_GRAIN_RATIO>
 <DECOCTION_AMT>0.00 l</DECOCTION_AMT>
 <INFUSE_TEMP>75.8 C</INFUSE_TEMP>
 <DISPLAY_STEP_TEMP>63.0 C</DISPLAY_STEP_TEMP>
 <DISPLAY_INFUSE_AMT>7.01 l</DISPLAY_INFUSE_AMT>
</MASH_STEP>
<MASH_STEP>
 <NAME>Mash Step</NAME>
 <VERSION>1</VERSION>
 <TYPE>Temperature</TYPE>
 <INFUSE_AMOUNT>0.0008071</INFUSE_AMOUNT>
 <STEP_TIME>30.0000000</STEP_TIME>
 <STEP_TEMP>68.0000000</STEP_TEMP>
 <RAMP_TIME>4.0000000</RAMP_TIME>
 <END_TEMP>68.0000000</END_TEMP>
 <DESCRIPTION>Add 0,00 l of water and heat to 68,0 C over 4 min</DESCRIPTION>
 <WATER_GRAIN_RATIO>3,205 l/kg</WATER_GRAIN_RATIO>
 <DECOCTION_AMT>0.00 l</DECOCTION_AMT>
 <INFUSE_TEMP>68.0 C</INFUSE_TEMP>
 <DISPLAY_STEP_TEMP>68.0 C</DISPLAY_STEP_TEMP>
 <DISPLAY_INFUSE_AMT>0.00 l</DISPLAY_INFUSE_AMT>
</MASH_STEP>
<MASH_STEP>
 <NAME>Mash Step</NAME>
 <VERSION>1</VERSION>
 <TYPE>Temperature</TYPE>
 <INFUSE_AMOUNT>0.0008071</INFUSE_AMOUNT>
 <STEP_TIME>5.0000000</STEP_TIME>
 <STEP_TEMP>73.0000000</STEP_TEMP>
 <RAMP_TIME>4.0000000</RAMP_TIME>
 <END_TEMP>73.0000000</END_TEMP>
 <DESCRIPTION>Add 0,00 l of water and heat to 73,0 C over 4 min</DESCRIPTION>
 <WATER_GRAIN_RATIO>3,205 l/kg</WATER_GRAIN_RATIO>
 <DECOCTION_AMT>0.00 l</DECOCTION_AMT>
 <INFUSE_TEMP>73.0 C</INFUSE_TEMP>
 <DISPLAY_STEP_TEMP>73.0 C</DISPLAY_STEP_TEMP>
 <DISPLAY_INFUSE_AMT>0.00 l</DISPLAY_INFUSE_AMT>
</MASH_STEP>
<MASH_STEP>
 <NAME>Mash Step</NAME>
 <VERSION>1</VERSION>
 <TYPE>Temperature</TYPE>
 <INFUSE_AMOUNT>0.0002615</INFUSE_AMOUNT>
 <STEP_TIME>10.0000000</STEP_TIME>
 <STEP_TEMP>77.0000000</STEP_TEMP>
 <RAMP_TIME>4.0000000</RAMP_TIME>
 <END_TEMP>77.0000000</END_TEMP>
 <DESCRIPTION>Add 0,00 l of water and heat to 77,0 C over 4 min</DESCRIPTION>
 <WATER_GRAIN_RATIO>3,206 l/kg</WATER_GRAIN_RATIO>
 <DECOCTION_AMT>0.00 l</DECOCTION_AMT>
 <INFUSE_TEMP>77.0 C</INFUSE_TEMP>
 <DISPLAY_STEP_TEMP>77.0 C</DISPLAY_STEP_TEMP>
 <DISPLAY_INFUSE_AMT>0.00 l</DISPLAY_INFUSE_AMT>
</MASH_STEP>
</MASH_STEPS>

</MASH>

 <NOTES>Boiled 90 minutes.

1074 = 4,8
= 7,8</NOTES>
 <TASTE_NOTES>Apres 3 semaines de conditionnement, forts fusels qui cachent l'orange et la coriandre.

Apres 3 mois, les fusels sont bien moins présents et les saveur plus subtiles.</TASTE_NOTES>
 <TASTE_RATING>30.0000000</TASTE_RATING>
 <OG>1.0700000</OG>
 <FG>1.0160000</FG>
 <CARBONATION>2.3000000</CARBONATION>
 <FERMENTATION_STAGES>1</FERMENTATION_STAGES>
 <PRIMARY_AGE>14.0000000</PRIMARY_AGE>
 <PRIMARY_TEMP>21.0000000</PRIMARY_TEMP>
 <SECONDARY_AGE>10.0000000</SECONDARY_AGE>
 <SECONDARY_TEMP>18.3333333</SECONDARY_TEMP>
 <TERTIARY_AGE>7.0000000</TERTIARY_AGE>
 <AGE>14.0000000</AGE>
 <AGE_TEMP>20.0000000</AGE_TEMP>
 <CARBONATION_USED>Bottle with 30,12 g Corn Sugar</CARBONATION_USED>
 <FORCED_CARBONATION>TRUE</FORCED_CARBONATION>
 <PRIMING_SUGAR_NAME>Corn Sugar</PRIMING_SUGAR_NAME>
 <PRIMING_SUGAR_EQUIV>1.0000000</PRIMING_SUGAR_EQUIV>
 <KEG_PRIMING_FACTOR>0.5000000</KEG_PRIMING_FACTOR>
 <CARBONATION_TEMP>21.1111111</CARBONATION_TEMP>
 <DISPLAY_CARB_TEMP>21.1 C</DISPLAY_CARB_TEMP>
 <DATE>19/02/17</DATE>
 <EST_OG>1.083 SG</EST_OG>
 <EST_FG>1.019 SG</EST_FG>
 <EST_COLOR>11.0 EBC</EST_COLOR>
 <IBU>16.7 IBUs</IBU>
 <IBU_METHOD>Tinseth</IBU_METHOD>
 <EST_ABV>8.4 %</EST_ABV>
 <ABV>7.1 %</ABV>
 <ACTUAL_EFFICIENCY>49.8 %</ACTUAL_EFFICIENCY>
 <CALORIES>670.3 kcal/l</CALORIES>
 <DISPLAY_BATCH_SIZE>5.50 l</DISPLAY_BATCH_SIZE>
 <DISPLAY_BOIL_SIZE>7.82 l</DISPLAY_BOIL_SIZE>
 <DISPLAY_OG>1.070 SG</DISPLAY_OG>
 <DISPLAY_FG>1.016 SG</DISPLAY_FG>
 <DISPLAY_PRIMARY_TEMP>21.0 C</DISPLAY_PRIMARY_TEMP>
 <DISPLAY_SECONDARY_TEMP>18.3 C</DISPLAY_SECONDARY_TEMP>
 <DISPLAY_TERTIARY_TEMP>18.3 C</DISPLAY_TERTIARY_TEMP>
 <DISPLAY_AGE_TEMP>20.0 C</DISPLAY_AGE_TEMP>
</RECIPE>
</RECIPES>


text:
import * as ParameterParser from 'azure-pipelines-tasks-azurermdeploycommon/operations/ParameterParserUtility'

import { AzureRmWebAppDeploymentProvider } from './AzureRmWebAppDeploymentProvider';
import { DeploymentType } from '../taskparameters';
import { FileTransformsUtility } from 'azure-pipelines-tasks-azurermdeploycommon/operations/FileTransformsUtility.js';
import { PackageType } from 'azure-pipelines-tasks-azurermdeploycommon/webdeployment-common/packageUtility';

import tl = require('azure-pipelines-task-lib/task');

const removeRunFromZipAppSetting: string = '-WEBSITE_RUN_FROM_PACKAGE -WEBSITE_RUN_FROM_ZIP';
var deployUtility = require('azure-pipelines-tasks-azurermdeploycommon/webdeployment-common/utility.js');
var zipUtility = require('azure-pipelines-tasks-azurermdeploycommon/webdeployment-common/ziputility.js');

export class WindowsWebAppZipDeployProvider extends AzureRmWebAppDeploymentProvider {

    private zipDeploymentID: string;

    public async DeployWebAppStep() {
        let deploymentMethodtelemetry = '{"deploymentMethod":"Zip Deploy"}';
        console.log("##vso[telemetry.publish area=TaskDeploymentMethod;feature=AzureWebAppDeployment]" + deploymentMethodtelemetry);

        var webPackage = await FileTransformsUtility.applyTransformations(this.taskParams.Package.getPath(), this.taskParams.WebConfigParameters, this.taskParams.Package.getPackageType());

        if(this.taskParams.DeploymentType === DeploymentType.zipDeploy) {
            var _isMSBuildPackage = await this.taskParams.Package.isMSBuildPackage();
            if(_isMSBuildPackage) {
                throw Error(tl.loc("Publishusingzipdeploynotsupportedformsbuildpackage"));
            }
            else if(this.taskParams.Package.getPackageType() === PackageType.war) {
                throw Error(tl.loc("Publishusingzipdeploydoesnotsupportwarfile"));
            }
        }

        if(tl.stats(webPackage).isDirectory()) {
            let tempPackagePath = deployUtility.generateTemporaryFolderOrZipPath(tl.getVariable('AGENT.TEMPDIRECTORY'), false);
            webPackage = await zipUtility.archiveFolder(webPackage, "", tempPackagePath);
            tl.debug("Compressed folder into zip " +  webPackage);
        }

        tl.debug("Initiated deployment via kudu service for webapp package : ");
        if (!!this.appServiceUtility) {
            var deleteApplicationSetting = ParameterParser.parse(removeRunFromZipAppSetting)
            var isNewValueUpdated: boolean = await this.appServiceUtility.updateAndMonitorAppSettings(null, deleteApplicationSetting);

            if(!isNewValueUpdated) {
                await this.kuduServiceUtility.warmpUp();
            }
        } else {
            await this.kuduServiceUtility.warmpUp();
        }

        this.zipDeploymentID = await this.kuduServiceUtility.deployUsingZipDeploy(webPackage);

        await this.PostDeploymentStep();
    }

    public async UpdateDeploymentStatus(isDeploymentSuccess: boolean) {
        await super.UpdateDeploymentStatus(isDeploymentSuccess);
        if(this.kuduServiceUtility) {
            if(this.zipDeploymentID && this.activeDeploymentID && isDeploymentSuccess) {
                await this.kuduServiceUtility.postZipDeployOperation(this.zipDeploymentID, this.activeDeploymentID);
            }
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
import {Type, isPresent} from 'angular2/src/facade/lang';
import {RouteLifecycleHook, CanActivate} from './lifecycle_annotations_impl';
import {reflector} from 'angular2/src/core/reflection/reflection';

export function hasLifecycleHook(e: RouteLifecycleHook, type): boolean {
  if (!(type instanceof Type)) return false;
  return e.name in (<any>type).prototype;
}

export function getCanActivateHook(type): Function {
  var annotations = reflector.annotations(type);
  for (let i = 0; i < annotations.length; i += 1) {
    let annotation = annotations[i];
    if (annotation instanceof CanActivate) {
      return annotation.fn;
    }
  }

  return null;
}


text:
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')

class ConnectionMockTest < Test::Unit::TestCase
  include Steam

  def setup
    @connection = Connection::Mock.new
    @url  = 'http://localhost:3000/'
    @body = <<-body
      <html>
        <head>
          <script src="/javascripts/script.js" type="text/javascript"></script>
        </head>
      </html>
    body
  end

  def test_call
    @connection.mock(:get, @url, @body)
    status, headers, response = @connection.call(Request.new(:url => @url).env)
    assert_equal [@body], response.body
  end

  def test_mock_with_response
    @connection.mock(:get, @url, Rack::Response.new(@body, 200, { 'Content-Type' => 'text/css' }))
    assert_response('Content-Type' => 'text/css')
  end

  def test_mock_with_string
    @connection.mock(:get, @url, @body)
    assert_response
  end

  def test_mock_with_array_without_content_type
    @connection.mock(:get, @url, [@body, 201, { 'foo' => 'bar' }])
    assert_response(201, 'foo' => 'bar')
  end

  def test_mock_with_array_with_content_type
    @connection.mock(:get, @url, [@body, 201, { 'Content-Type' => 'text/css' }])
    assert_response(201, 'Content-Type' => 'text/css')
  end

  protected

    def assert_response(*args)
      headers = args.last.is_a?(Hash) ? args.pop : {}
      headers = { 'Content-Type' => 'text/html' }.merge(headers)
      status = args.pop || 200

      response = @connection.response('GET', @url)

      assert response.is_a?(Rack::Response)
      assert_equal [@body], response.body
      assert_equal status, response.status
      assert_equal headers['Content-Type'], response.header['Content-Type']
    end
end


text:
// Just a helper script for MS Edge

// If chrome isn't defined, check for browser or msBrowser and use those instead.
if (typeof msBrowser !== 'undefined') {
    chrome = msBrowser;
} else if (typeof browser !== 'undefined') {
    chrome = browser;
}


text:
require 'rails_helper'

RSpec.describe Task, type: :model do
  context 'validation & association' do
    before { build(:task) }

    it { is_expected.to validate_presence_of(:name) }

    it { is_expected.to belong_to(:project) }

    it { is_expected.to have_many(:comments).dependent(:destroy) }
  end

  context 'acts_as_list' do
    let(:task1) { create(:task, position: 1) }
    let(:task2) { create(:task, project: task1.project, position: 2) }

    it 'move bottom' do
      expect(task1.position).to eq 1
      expect(task2.position).to eq 2
      task1.insert_at(2)
      task2.reload
      expect(task1.position).to eq 2
      expect(task2.position).to eq 1
    end
  end
end


text:
Discussions

Discussions

          Loading...


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policymap [
  <!ELEMENT policymap (policy)+>
  <!ATTLIST policymap xmlns CDATA #FIXED ''>
  <!ELEMENT policy EMPTY>
  <!ATTLIST policy xmlns CDATA #FIXED '' domain NMTOKEN #REQUIRED
    name NMTOKEN #IMPLIED pattern CDATA #IMPLIED rights NMTOKEN #IMPLIED
    stealth NMTOKEN #IMPLIED value CDATA #IMPLIED>
]>
<!--
  Configure ImageMagick policies.

  Domains include system, delegate, coder, filter, path, or resource.

  Rights include none, read, write, execute and all.  Use | to combine them,
  for example: "read | write" to permit read from, or write to, a path.

  Use a glob expression as a pattern.

  Suppose we do not want users to process MPEG video images:

    <policy domain="delegate" rights="none" pattern="mpeg:decode" />

  Here we do not want users reading images from HTTP:

    <policy domain="coder" rights="none" pattern="HTTP" />

  The /repository file system is restricted to read only.  We use a glob
  expression to match all paths that start with /repository:

    <policy domain="path" rights="read" pattern="/repository/*" />

  Lets prevent users from executing any image filters:

    <policy domain="filter" rights="none" pattern="*" />

  Any large image is cached to disk rather than memory:

    <policy domain="resource" name="area" value="1GP"/>

  Define arguments for the memory, map, area, width, height and disk resources
  with SI prefixes (.e.g 100MB).  In addition, resource policies are maximums
  for each instance of ImageMagick (e.g. policy memory limit 1GB, -limit 2GB
  exceeds policy maximum so memory limit is 1GB).

  Rules are processed in order.  Here we want to restrict ImageMagick to only
  read or write a small subset of proven web-safe image types:

    <policy domain="delegate" rights="none" pattern="*" />
    <policy domain="filter" rights="none" pattern="*" />
    <policy domain="coder" rights="none" pattern="*" />
    <policy domain="coder" rights="read|write" pattern="{GIF,JPEG,PNG,WEBP}" />
-->
<policymap>
  <!-- <policy domain="system" name="shred" value="2"/> -->
  <!-- <policy domain="system" name="precision" value="6"/> -->
  <!-- <policy domain="system" name="memory-map" value="anonymous"/> -->
  <!-- <policy domain="system" name="max-memory-request" value="256MiB"/> -->
  <!-- <policy domain="resource" name="temporary-path" value="/tmp"/> -->
  <policy domain="resource" name="memory" value="256MiB"/>
  <policy domain="resource" name="map" value="512MiB"/>
  <policy domain="resource" name="width" value="16KP"/>
  <policy domain="resource" name="height" value="16KP"/>
  <!-- <policy domain="resource" name="list-length" value="128"/> -->
  <policy domain="resource" name="area" value="128MB"/>
  <policy domain="resource" name="disk" value="8GiB"/>
  <!-- <policy domain="resource" name="file" value="768"/> -->
  <!-- <policy domain="resource" name="thread" value="4"/> -->
  <!-- <policy domain="resource" name="throttle" value="0"/> -->
  <!-- <policy domain="resource" name="time" value="3600"/> -->
  <!-- <policy domain="coder" rights="none" pattern="MVG" /> -->
  <!-- <policy domain="module" rights="none" pattern="{PS,PDF,XPS}" /> -->
  <!-- <policy domain="delegate" rights="none" pattern="HTTPS" /> -->
  <!-- <policy domain="path" rights="none" pattern="@*" /> -->
  <!-- <policy domain="cache" name="memory-map" value="anonymous"/> -->
  <!-- <policy domain="cache" name="synchronize" value="True"/> -->
  <!-- <policy domain="cache" name="shared-secret" value="passphrase" stealth="true"/> -->
  <!-- <policy domain="system" name="pixel-cache-memory" value="anonymous"/> -->
  <!-- <policy domain="system" name="shred" value="2"/> -->
  <!-- <policy domain="system" name="precision" value="6"/> -->
  <!-- not needed due to the need to use explicitly by mvg: -->
  <!-- <policy domain="delegate" rights="none" pattern="MVG" /> -->
  <!-- use curl -->
  <policy domain="delegate" rights="none" pattern="URL" />
  <policy domain="delegate" rights="none" pattern="HTTPS" />
  <policy domain="delegate" rights="none" pattern="HTTP" />
  <!-- in order to avoid to get image with password text -->
  <policy domain="path" rights="none" pattern="@*"/>
  <!-- disable ghostscript format types -->
  <policy domain="coder" rights="none" pattern="PS" />
  <policy domain="coder" rights="none" pattern="PS2" />
  <policy domain="coder" rights="none" pattern="PS3" />
  <policy domain="coder" rights="none" pattern="EPS" />
  <!-- <policy domain="coder" rights="none" pattern="PDF" /> -->
  <policy domain="coder" rights="none" pattern="XPS" />
  <!-- allow ghostscript to PDF conversions -->
  <policy domain="coder" rights="read|write" pattern="PDF" />
</policymap>


text:
 Meta Presupuestal

   Meta Presupuestal

                                                            <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#ventana_registrar_meta" >

                                                                Nuevo</button>

                                                          #
                                                           Año
                                                           Número de meta
                                                           Nombre de la meta
                                                        Opción

          <button type="button" class="close" data-dismiss="modal">×</button>

Registrar Meta Presupuestal

                <form class="form-horizontal form-label-left"  id="form_AddMeta" action="<?php echo base_url(); ?>Meta/AddMeta" method="POST" >

                            Año Meta

                              <input id="txt_anio_meta" name="txt_anio_meta" class="form-control col-md-7 col-xs-12" data-validate-length-range="6" data-validate-words="2" name="name"  placeholder="Año" required="required" type="number"  value="2017">

                        Correlativo Meta*

                          <input id="txt_correlativo_meta" name="txt_correlativo_meta" class="form-control col-md-7 col-xs-12" data-validate-length-range="6" data-validate-words="2" name="name"  placeholder="Correlativo Meta" required="required" type="number" >

                        Nombre de la Meta *

                          <textarea id="txt_nombre_meta" name="txt_nombre_meta" placeholder="Nombre de la meta" class="form-control col-md-7 col-xs-12"></textarea>

                          <button id="send" type="submit" class="btn btn-success">

                            Guardar
                          </button>
                          <button type="submit" class="btn btn-danger" data-dismiss="modal">

                            Cancelar
                          </button>

                </form>

          <button type="button" class="close" data-dismiss="modal">×</button>

Registrar Meta Presupuestal

                <form class="form-horizontal form-label-left"  id="form_EditMetaPresupuestal" action="<?php echo base_url(); ?>Meta/EditarMetaPresupuestal" method="POST" >
                <input id="txt_id_meta" name="txt_id_meta" class="form-control col-md-7 col-xs-12"  type="hidden"  >

                            Año Meta

                              <input id="txt_anio_meta_m" name="txt_anio_meta_m" class="form-control col-md-7 col-xs-12" data-validate-length-range="6" data-validate-words="2" name="name"  placeholder="Año" required="required" type="number"  value="2017">

                        Correlativo Meta*

                          <input id="txt_correlativo_meta_m" name="txt_correlativo_meta_m" class="form-control col-md-7 col-xs-12" data-validate-length-range="6" data-validate-words="2" name="name"  placeholder="Correlativo Meta" required="required" type="number" >

                        Nombre de la Meta *

                          <textarea id="txt_nombre_meta_m" name="txt_nombre_meta_m" placeholder="Nombre de la meta" class="form-control col-md-7 col-xs-12"></textarea>

                          <button id="send" type="submit" class="btn btn-success">

                            Guardar
                          </button>
                          <button type="submit" class="btn btn-danger" data-dismiss="modal">

                            Cancelar
                          </button>

                </form>


text: trabajo-tools


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

<document xmlns="http://maven.apache.org/XDOC/2.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">

    <title>Before Execution File Filters</title>


text:
package ai.verta.client.entities

import java.time.LocalDateTime
import java.time.format.DateTimeFormatter

import ai.verta.client.entities.subobjects.Tags
import ai.verta.swagger._public.modeldb.model.{ModeldbAddExperimentTags, ModeldbCreateExperimentRun, ModeldbDeleteExperimentTags, ModeldbExperiment}
import ai.verta.swagger.client.ClientSet

import scala.concurrent.ExecutionContext
import scala.util.Try

class Experiment(val clientSet: ClientSet, val proj: Project, val expt: ModeldbExperiment) extends Taggable {
  def getOrCreateExperimentRun(name: String = "")(implicit ec: ExecutionContext) = {
    val internalName = if (name == "") LocalDateTime.now.format(DateTimeFormatter.ofPattern("YYYY/MM/dd HH:mm:ss.SSSS")) else name

    GetOrCreateEntity.getOrCreate[ExperimentRun](
      get = () => {
        clientSet.experimentRunService.ExperimentRunService_getExperimentRunByName(Some(internalName), expt.id)
          .map(r => if (r.experiment_run.isEmpty) null else new ExperimentRun(clientSet, this, r.experiment_run.get))
      },
      create = () => {
        clientSet.experimentRunService.ExperimentRunService_createExperimentRun(ModeldbCreateExperimentRun(
          name = Some(internalName),
          experiment_id = expt.id,
          project_id = proj.proj.id // TODO: remove since we can get from the experiment
        ))
          .map(r => if (r.experiment_run.isEmpty) null else new ExperimentRun(clientSet, this, r.experiment_run.get))
      }
    )
  }

  def tags()(implicit ec: ExecutionContext) = new Tags(clientSet, ec, this)

  override def getTags()(implicit ec: ExecutionContext): Try[List[String]] = {
    clientSet.experimentService.ExperimentService_getExperimentTags(expt.id)
      .map(r => r.tags.getOrElse(Nil))
  }

  override def delTags(tags: List[String])(implicit ec: ExecutionContext): Try[Unit] = {
    clientSet.experimentService.ExperimentService_deleteExperimentTags(ModeldbDeleteExperimentTags(
      id = expt.id,
      tags = Some(tags)
    ))
      .map(_ => {})
  }

  override def addTags(tags: List[String])(implicit ec: ExecutionContext): Try[Unit] = {
    clientSet.experimentService.ExperimentService_addExperimentTags(ModeldbAddExperimentTags(
      id = expt.id,
      tags = Some(tags)
    ))
      .map(_ => {})
  }
}


text:
create table
  testInsertOverwriteWithCompression (col1 int4, col2 int4, col3 float8)
USING csv
WITH ('csvfile.delimiter'='|','compression.codec'='org.apache.hadoop.io.compress.DeflateCodec');


text:
package io.netty.handler.codec.http2;

import static io.netty.handler.codec.http.HttpMethod.GET;
import static io.netty.handler.codec.http.HttpMethod.POST;
import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1;
import static io.netty.handler.codec.http2.Http2CodecUtil.ignoreSettingsHandler;
import static io.netty.handler.codec.http2.Http2TestUtil.as;
import static io.netty.util.CharsetUtil.UTF_8;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyBoolean;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.anyShort;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import io.netty.bootstrap.Bootstrap;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.ChannelPromise;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.handler.codec.http.DefaultFullHttpRequest;
import io.netty.handler.codec.http.FullHttpRequest;
import io.netty.handler.codec.http.HttpHeaders;
import io.netty.handler.codec.http.HttpRequest;
import io.netty.util.NetUtil;
import io.netty.util.concurrent.Future;

import java.net.InetSocketAddress;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;

/**
 * Testing the {@link Http2ToHttpConnectionHandler} for {@link FullHttpRequest} objects into HTTP/2 frames
 */
public class DefaultHttp2ToHttpConnectionHandlerTest {

    @Mock
    private Http2FrameListener clientListener;

    @Mock
    private Http2FrameListener serverListener;

    private ServerBootstrap sb;
    private Bootstrap cb;
    private Channel serverChannel;
    private Channel clientChannel;
    private volatile CountDownLatch requestLatch;
    private Http2TestUtil.FrameCountDown serverFrameCountDown;

    @Before
    public void setup() throws Exception {
        MockitoAnnotations.initMocks(this);
    }

    @After
    public void teardown() throws Exception {
        serverChannel.close().sync();
        Future<?> serverGroup = sb.group().shutdownGracefully(0, 0, TimeUnit.MILLISECONDS);
        Future<?> serverChildGroup = sb.childGroup().shutdownGracefully(0, 0, TimeUnit.MILLISECONDS);
        Future<?> clientGroup = cb.group().shutdownGracefully(0, 0, TimeUnit.MILLISECONDS);
        serverGroup.sync();
        serverChildGroup.sync();
        clientGroup.sync();
    }

    @Test
    public void testJustHeadersRequest() throws Exception {
        bootstrapEnv(3);
        final FullHttpRequest request = new DefaultFullHttpRequest(HTTP_1_1, GET, "/example");
        try {
            final HttpHeaders httpHeaders = request.headers();
            httpHeaders.set(HttpUtil.ExtensionHeaderNames.STREAM_ID.text(), 5);
            httpHeaders.set(HttpHeaders.Names.HOST,
                    "http://my-user_name@www.example.org:5555/example");
            httpHeaders.set(HttpUtil.ExtensionHeaderNames.AUTHORITY.text(), "www.example.org:5555");
            httpHeaders.set(HttpUtil.ExtensionHeaderNames.SCHEME.text(), "http");
            httpHeaders.add("foo", "goo");
            httpHeaders.add("foo", "goo2");
            httpHeaders.add("foo2", "goo2");
            final Http2Headers http2Headers =
                    new DefaultHttp2Headers().method(as("GET")).path(as("/example"))
                            .authority(as("www.example.org:5555")).scheme(as("http"))
                            .add(as("foo"), as("goo")).add(as("foo"), as("goo2"))
                            .add(as("foo2"), as("goo2"));
            ChannelPromise writePromise = newPromise();
            ChannelFuture writeFuture = clientChannel.writeAndFlush(request, writePromise);

            writePromise.awaitUninterruptibly(2, SECONDS);
            assertTrue(writePromise.isSuccess());
            writeFuture.awaitUninterruptibly(2, SECONDS);
            assertTrue(writeFuture.isSuccess());
            awaitRequests();
            verify(serverListener).onHeadersRead(any(ChannelHandlerContext.class), eq(5),
                    eq(http2Headers), eq(0), anyShort(), anyBoolean(), eq(0), eq(true));
            verify(serverListener, never()).onDataRead(any(ChannelHandlerContext.class), anyInt(),
                    any(ByteBuf.class), anyInt(), anyBoolean());
        } finally {
            request.release();
        }
    }

    @Test
    public void testRequestWithBody() throws Exception {
        final String text = "foooooogoooo";
        final ByteBuf data = Unpooled.copiedBuffer(text, UTF_8);
        final List<String> receivedBuffers = Collections.synchronizedList(new ArrayList<String>());
        doAnswer(new Answer<Void>() {
            @Override
            public Void answer(InvocationOnMock in) throws Throwable {
                receivedBuffers.add(((ByteBuf) in.getArguments()[2]).toString(UTF_8));
                return null;
            }
        }).when(serverListener).onDataRead(any(ChannelHandlerContext.class), eq(3),
                any(ByteBuf.class), eq(0), eq(true));
        bootstrapEnv(4);
        try {
            final HttpRequest request = new DefaultFullHttpRequest(HTTP_1_1, POST, "/example", data.retain());
            final HttpHeaders httpHeaders = request.headers();
            httpHeaders.set(HttpHeaders.Names.HOST, "http://your_user-name123@www.example.org:5555/example");
            httpHeaders.add("foo", "goo");
            httpHeaders.add("foo", "goo2");
            httpHeaders.add("foo2", "goo2");
            final Http2Headers http2Headers =
                    new DefaultHttp2Headers().method(as("POST")).path(as("/example"))
                            .authority(as("www.example.org:5555")).scheme(as("http"))
                            .add(as("foo"), as("goo")).add(as("foo"), as("goo2"))
                            .add(as("foo2"), as("goo2"));
            ChannelPromise writePromise = newPromise();
            ChannelFuture writeFuture = clientChannel.writeAndFlush(request, writePromise);

            writePromise.awaitUninterruptibly(2, SECONDS);
            assertTrue(writePromise.isSuccess());
            writeFuture.awaitUninterruptibly(2, SECONDS);
            assertTrue(writeFuture.isSuccess());
            awaitRequests();
            verify(serverListener).onHeadersRead(any(ChannelHandlerContext.class), eq(3), eq(http2Headers), eq(0),
                    anyShort(), anyBoolean(), eq(0), eq(false));
            verify(serverListener).onDataRead(any(ChannelHandlerContext.class), eq(3), any(ByteBuf.class), eq(0),
                    eq(true));
            assertEquals(1, receivedBuffers.size());
            assertEquals(text, receivedBuffers.get(0));
        } finally {
            data.release();
        }
    }

    private void bootstrapEnv(int requestCountDown) throws Exception {
        requestLatch = new CountDownLatch(requestCountDown);

        sb = new ServerBootstrap();
        cb = new Bootstrap();

        sb.group(new NioEventLoopGroup(), new NioEventLoopGroup());
        sb.channel(NioServerSocketChannel.class);
        sb.childHandler(new ChannelInitializer<Channel>() {
            @Override
            protected void initChannel(Channel ch) throws Exception {
                ChannelPipeline p = ch.pipeline();
                serverFrameCountDown = new Http2TestUtil.FrameCountDown(serverListener, requestLatch);
                p.addLast(new Http2ToHttpConnectionHandler(true, serverFrameCountDown));
                p.addLast(ignoreSettingsHandler());
            }
        });

        cb.group(new NioEventLoopGroup());
        cb.channel(NioSocketChannel.class);
        cb.handler(new ChannelInitializer<Channel>() {
            @Override
            protected void initChannel(Channel ch) throws Exception {
                ChannelPipeline p = ch.pipeline();
                p.addLast(new Http2ToHttpConnectionHandler(false, clientListener));
                p.addLast(ignoreSettingsHandler());
            }
        });

        serverChannel = sb.bind(new InetSocketAddress(0)).sync().channel();
        int port = ((InetSocketAddress) serverChannel.localAddress()).getPort();

        ChannelFuture ccf = cb.connect(new InetSocketAddress(NetUtil.LOCALHOST, port));
        assertTrue(ccf.awaitUninterruptibly().isSuccess());
        clientChannel = ccf.channel();
    }

    private void awaitRequests() throws Exception {
        assertTrue(requestLatch.await(2, SECONDS));
    }

    private ChannelHandlerContext ctx() {
        return clientChannel.pipeline().firstContext();
    }

    private ChannelPromise newPromise() {
        return ctx().newPromise();
    }
}


text:
import turf from '@turf/helpers';
import clustersKmeans from '@turf/clusters-kmeans';

/**
 * Clusters points
 * @param data {array} - source data
 * @param accessors {object} - key to accessor mapping.
 *   keys will be used to add results back to the datum.
 *   accessor should return a [longitude, latitude] pair.
 */
export function clusterPoints(data, accessors) {
  const clusteredData = data.map(d => ({...d}));

  const allPoints = [];

  data.forEach((d, index) => {
    for (const key in accessors) {
      const p = turf.point(accessors[key](d), {index, key});
      allPoints.push(p);
    }
  });

  // Calculate clusters using K-means: https://en.wikipedia.org/wiki/K-means_clustering)
  clustersKmeans(turf.featureCollection(allPoints)).features
  .forEach(p => {
    const {index, key, centroid} = p.properties;
    clusteredData[index][key] = centroid;
  });

  return clusteredData;
}


text:
import {
  Cursor,
  Dict,
  ElementBuilder,
  Environment,
  Helper,
  Option,
  RenderResult,
} from '@glimmer/interfaces';
import { serializeBuilder } from '@glimmer/node';
import { createConstRef, Reference } from '@glimmer/reference';
import { ASTPluginBuilder, PrecompileOptions } from '@glimmer/syntax';
import { assign, castToSimple } from '@glimmer/util';
import createHTMLDocument from '@simple-dom/document';
import {
  ElementNamespace,
  SimpleDocument,
  SimpleDocumentFragment,
  SimpleElement,
  SimpleNode,
  SimpleText,
} from '@simple-dom/interface';
import { ComponentKind } from '../../components';
import { replaceHTML, toInnerHTML } from '../../dom/simple-utils';
import { UserHelper } from '../../helpers';
import { TestModifierConstructor } from '../../modifiers';
import RenderDelegate, { RenderDelegateOptions } from '../../render-delegate';
import { BaseEnv } from '../env';
import { JitDelegateContext, JitTestDelegateContext } from '../jit/delegate';
import {
  registerComponent,
  registerHelper,
  registerInternalHelper,
  registerModifier,
} from '../jit/register';
import { TestJitRegistry } from '../jit/registry';
import { renderTemplate } from '../jit/render';
import { TestJitRuntimeResolver } from '../jit/resolver';
import { debugRehydration, DebugRehydrationBuilder } from './builder';

export interface RehydrationStats {
  clearedNodes: SimpleNode[];
}

export class RehydrationDelegate implements RenderDelegate {
  static readonly isEager = false;
  static readonly style = 'rehydration';

  private plugins: ASTPluginBuilder[] = [];

  public clientEnv: JitTestDelegateContext;
  public serverEnv: JitTestDelegateContext;

  private clientResolver: TestJitRuntimeResolver;
  private serverResolver: TestJitRuntimeResolver;

  protected clientRegistry: TestJitRegistry;
  protected serverRegistry: TestJitRegistry;

  public clientDoc: SimpleDocument;
  public serverDoc: SimpleDocument;

  public rehydrationStats!: RehydrationStats;

  private self: Option<Reference> = null;

  constructor(options?: RenderDelegateOptions) {
    let delegate = assign(options?.env ?? {}, BaseEnv);

    this.clientDoc = castToSimple(document);
    this.clientRegistry = new TestJitRegistry();
    this.clientResolver = new TestJitRuntimeResolver(this.clientRegistry);
    this.clientEnv = JitDelegateContext(this.clientDoc, this.clientResolver, delegate);

    this.serverDoc = createHTMLDocument();
    this.serverRegistry = new TestJitRegistry();
    this.serverResolver = new TestJitRuntimeResolver(this.serverRegistry);
    this.serverEnv = JitDelegateContext(this.serverDoc, this.serverResolver, delegate);
  }

  getInitialElement(): SimpleElement {
    return this.clientDoc.createElement('div');
  }

  createElement(tagName: string): SimpleElement {
    return this.clientDoc.createElement(tagName);
  }

  createTextNode(content: string): SimpleText {
    return this.clientDoc.createTextNode(content);
  }

  createElementNS(namespace: ElementNamespace, tagName: string): SimpleElement {
    return this.clientDoc.createElementNS(namespace, tagName);
  }

  createDocumentFragment(): SimpleDocumentFragment {
    return this.clientDoc.createDocumentFragment();
  }

  getElementBuilder(env: Environment, cursor: Cursor): ElementBuilder {
    if (cursor.element instanceof Node) {
      return debugRehydration(env, cursor);
    }

    return serializeBuilder(env, cursor);
  }

  renderServerSide(
    template: string,
    context: Dict<unknown>,
    takeSnapshot: () => void,
    element: SimpleElement | undefined = undefined
  ): string {
    element = element || this.serverDoc.createElement('div');
    let cursor = { element, nextSibling: null };
    let { env } = this.serverEnv.runtime;

    // Emulate server-side render
    renderTemplate(
      template,
      this.serverEnv,
      this.getSelf(env, context),
      this.getElementBuilder(env, cursor),
      this.precompileOptions
    );

    takeSnapshot();
    return this.serialize(element);
  }

  getSelf(_env: Environment, context: unknown): Reference {
    if (!this.self) {
      this.self = createConstRef(context, 'this');
    }

    return this.self;
  }

  serialize(element: SimpleElement): string {
    return toInnerHTML(element);
  }

  renderClientSide(template: string, context: Dict<unknown>, element: SimpleElement): RenderResult {
    let env = this.clientEnv.runtime.env;
    this.self = null;

    // Client-side rehydration
    let cursor = { element, nextSibling: null };
    let builder = this.getElementBuilder(env, cursor) as DebugRehydrationBuilder;
    let result = renderTemplate(
      template,
      this.clientEnv,
      this.getSelf(env, context),
      builder,
      this.precompileOptions
    );

    this.rehydrationStats = {
      clearedNodes: builder['clearedNodes'],
    };

    return result;
  }

  renderTemplate(
    template: string,
    context: Dict<unknown>,
    element: SimpleElement,
    snapshot: () => void
  ): RenderResult {
    let serialized = this.renderServerSide(template, context, snapshot);
    replaceHTML(element, serialized);
    qunitFixture().appendChild(element);

    return this.renderClientSide(template, context, element);
  }

  registerPlugin(plugin: ASTPluginBuilder): void {
    this.plugins.push(plugin);
  }

  registerComponent(type: ComponentKind, _testType: string, name: string, layout: string): void {
    registerComponent(this.clientRegistry, type, name, layout);
    registerComponent(this.serverRegistry, type, name, layout);
  }

  registerHelper(name: string, helper: UserHelper): void {
    registerHelper(this.clientRegistry, name, helper);
    registerHelper(this.serverRegistry, name, helper);
  }

  registerInternalHelper(name: string, helper: Helper) {
    registerInternalHelper(this.clientRegistry, name, helper);
    registerInternalHelper(this.serverRegistry, name, helper);
  }

  registerModifier(name: string, ModifierClass: TestModifierConstructor): void {
    registerModifier(this.clientRegistry, name, ModifierClass);
    registerModifier(this.serverRegistry, name, ModifierClass);
  }

  private get precompileOptions(): PrecompileOptions {
    return {
      plugins: {
        ast: this.plugins,
      },
    };
  }
}

export function qunitFixture(): SimpleElement {
  return castToSimple(document.getElementById('qunit-fixture')!);
}


text:
import { Column, Entity, PrimaryGeneratedColumn } from "../../../../src";

@Entity()
export class User {

    @PrimaryGeneratedColumn()
    id: number;

    @Column()
    firstName: string;

    @Column()
    lastName: string;

}


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.facebook.presto.hive;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.openjdk.jol.info.ClassLayout;

import java.util.Objects;

import static com.facebook.presto.hive.metastore.MetastoreUtil.HIVE_DEFAULT_DYNAMIC_PARTITION;
import static com.google.common.base.MoreObjects.toStringHelper;
import static java.util.Objects.requireNonNull;

public final class HivePartitionKey
{
    private static final int INSTANCE_SIZE = ClassLayout.parseClass(HivePartitionKey.class).instanceSize() +
            ClassLayout.parseClass(String.class).instanceSize() * 2;

    private final String name;
    private final String value;

    @JsonCreator
    public HivePartitionKey(
            @JsonProperty("name") String name,
            @JsonProperty("value") String value)
    {
        requireNonNull(name, "name is null");
        requireNonNull(value, "value is null");

        this.name = name;
        this.value = value.equals(HIVE_DEFAULT_DYNAMIC_PARTITION) ? "\\N" : value;
    }

    @JsonProperty
    public String getName()
    {
        return name;
    }

    @JsonProperty
    public String getValue()
    {
        return value;
    }

    public int getEstimatedSizeInBytes()
    {
        return INSTANCE_SIZE + name.length() * Character.BYTES + value.length() * Character.BYTES;
    }

    @Override
    public String toString()
    {
        return toStringHelper(this)
                .add("name", name)
                .add("value", value)
                .toString();
    }

    @Override
    public int hashCode()
    {
        return Objects.hash(name, value);
    }

    @Override
    public boolean equals(Object obj)
    {
        if (this == obj) {
            return true;
        }
        if (obj == null || getClass() != obj.getClass()) {
            return false;
        }
        HivePartitionKey other = (HivePartitionKey) obj;
        return Objects.equals(this.name, other.name) &&
                Objects.equals(this.value, other.value);
    }
}


text:
#ifndef UCS_CONFIG_H_
#define UCS_CONFIG_H_

#include "types.h"

#include <ucs/type/status.h>
#include <stddef.h>
#include <stdio.h>

/**
 * UCS global options.
 */
typedef struct {

    /* Log level above which log messages will be printed */
    ucs_log_level_t          log_level;

    /* Log file */
    char                     *log_file;

    /* Size of log buffer for one message */
    size_t                   log_buffer_size;

    /* Maximal amount of packet data to print per packet */
    size_t                   log_data_size;

    /* Handle errors mode */
    ucs_handle_error_t       handle_errors;

    /* Error signals */
    UCS_CONFIG_ARRAY_FIELD(int, signals) error_signals;

    /* If not NULL, attach gdb to the process in case of error */
    char                     *gdb_command;

    /* Signal number which causes to enter debug mode */
    unsigned                 debug_signo;

    /* File name to dump instrumentation records to */
    char                     *instrument_file;

    /* Limit for instrumentation data size */
    size_t                   instrument_max_size;

    /* Max. events per context, will be removed in the future */
    unsigned                 async_max_events;

    /* Destination for statistics: udp:host:port / file:path / stdout
     */
    char                     *stats_dest;

    /* Trigger to dump statistics */
    char                     *stats_trigger;

    /* Named pipe file path for tuning.
     */
    char                     *tuning_path;

    /* Number of performance stall loops to perform */
    size_t                   perf_stall_loops;

    /* Signal number used by async handler (for signal mode) */
    unsigned                 async_signo;

    /* Destination for detailed memory tracking results: none / stdout / stderr
     */
    char                     *memtrack_dest;

} ucs_global_opts_t;

extern ucs_global_opts_t ucs_global_opts;

void ucs_global_opts_init();
ucs_status_t ucs_global_opts_set_value(const char *name, const char *value);
ucs_status_t ucs_global_opts_clone(void *dst);
void ucs_global_opts_release();
void ucs_global_opts_print(FILE *stream, const char *title,
                           ucs_config_print_flags_t print_flags);

#endif


text:
<?php

require_once(__DIR__ . '/../Bancard/autoload.php');

$redis = new Redis();
$redis->pconnect('127.0.0.1', 6379);

$id = $redis->incr("LlevaUno:Bancard:shop_process_id");

$data = [
    'shop_process_id'   => $id,
    'amount'            => $_POST['amount'],
    'currency'          => 'PYG',
    'additional_data'   => '',
    'description'       => $_POST['description']
];

var_dump($data);

try {
    $request = LlevaUno\Bancard\Operations\PreAuthorization\PreAuthorization::init($data)->send();
} catch (Exception $e) {
    die($e->getMessage());
}

$redis->hSet(
    "LlevaUno:Bancard:PreAuthorization:PreAuthorization:{$id}",
    "shop_process_id",
    "$id"
);

$redis->hSet(
    "LlevaUno:Bancard:PreAuthorization:PreAuthorization:{$id}",
    "data",
    json_encode($data)
);

$redis->hSet(
    "LlevaUno:Bancard:PreAuthorization:PreAuthorization:{$id}",
    "request",
    $request->json()
);

$redis->hSet(
    "LlevaUno:Bancard:PreAuthorization:PreAuthorization:{$id}",
    "response",
    json_encode($request->response)
);

var_dump($request->redirect_to);


text:
Ice Cream Magic creates robust ice cream formulations based on the user's desired flavor base.

##Overview

##Usage


text:
package org.sirix.index;

import org.brackit.xquery.xdm.DocumentException;
import org.brackit.xquery.xdm.node.Node;

/**
 * Materializable structure.
 *
 * @author Sebastian Baechle
 *
 */
public interface Materializable {
  /**
   * Materialize the object as a {@link Node} tree
   *
   * @return the root of the materialized tree
   * @throws DocumentException
   */
  public Node<?> materialize() throws DocumentException;

  /**
   * Initializes the materialized locator facet
   *
   * @param root root of the materialized facet subtree
   * @throws DocumentException
   */
  public void init(Node<?> root) throws DocumentException;
}


text:
"""
Alternative convolution implementations for Theano
"""

import numpy as np

import theano.tensor as T

# 1D convolutions

def conv1d_sc(input, filters, image_shape=None, filter_shape=None,
              border_mode='valid', subsample=(1,), filter_flip=True):
    """
    using conv2d with a single input channel
    """
    if border_mode not in ('valid', 0, (0,)):
        raise RuntimeError("Unsupported border_mode for conv1d_sc: "
                           "%s" % border_mode)

    if image_shape is None:
        image_shape_sc = None
    else:
        # (b, c, i0) to (b, 1, c, i0)
        image_shape_sc = (image_shape[0], 1, image_shape[1], image_shape[2])

    if filter_shape is None:
        filter_shape_sc = None
    else:
        filter_shape_sc = (filter_shape[0], 1, filter_shape[1],
                           filter_shape[2])

    input_sc = input.dimshuffle(0, 'x', 1, 2)
    # We need to flip the channels dimension because it will be convolved over.
    filters_sc = filters.dimshuffle(0, 'x', 1, 2)[:, :, ::-1, :]

    conved = T.nnet.conv2d(input_sc, filters_sc, image_shape_sc,
                           filter_shape_sc, subsample=(1, subsample[0]),
                           filter_flip=filter_flip)
    return conved[:, :, 0, :]  # drop the unused dimension

def conv1d_mc0(input, filters, image_shape=None, filter_shape=None,
               border_mode='valid', subsample=(1,), filter_flip=True):
    """
    using conv2d with width == 1
    """
    if image_shape is None:
        image_shape_mc0 = None
    else:
        # (b, c, i0) to (b, c, 1, i0)
        image_shape_mc0 = (image_shape[0], image_shape[1], 1, image_shape[2])

    if filter_shape is None:
        filter_shape_mc0 = None
    else:
        filter_shape_mc0 = (filter_shape[0], filter_shape[1], 1,
                            filter_shape[2])

    if isinstance(border_mode, tuple):
        (border_mode,) = border_mode
    if isinstance(border_mode, int):
        border_mode = (0, border_mode)

    input_mc0 = input.dimshuffle(0, 1, 'x', 2)
    filters_mc0 = filters.dimshuffle(0, 1, 'x', 2)

    conved = T.nnet.conv2d(
        input_mc0, filters_mc0, image_shape_mc0, filter_shape_mc0,
        subsample=(1, subsample[0]), border_mode=border_mode,
        filter_flip=filter_flip)
    return conved[:, :, 0, :]  # drop the unused dimension

def conv1d_mc1(input, filters, image_shape=None, filter_shape=None,
               border_mode='valid', subsample=(1,), filter_flip=True):
    """
    using conv2d with height == 1
    """
    if image_shape is None:
        image_shape_mc1 = None
    else:
        # (b, c, i0) to (b, c, i0, 1)
        image_shape_mc1 = (image_shape[0], image_shape[1], image_shape[2], 1)

    if filter_shape is None:
        filter_shape_mc1 = None
    else:
        filter_shape_mc1 = (filter_shape[0], filter_shape[1],
                            filter_shape[2], 1)

    if isinstance(border_mode, tuple):
        (border_mode,) = border_mode
    if isinstance(border_mode, int):
        border_mode = (border_mode, 0)

    input_mc1 = input.dimshuffle(0, 1, 2, 'x')
    filters_mc1 = filters.dimshuffle(0, 1, 2, 'x')

    conved = T.nnet.conv2d(
        input_mc1, filters_mc1, image_shape_mc1, filter_shape_mc1,
        subsample=(subsample[0], 1), border_mode=border_mode,
        filter_flip=filter_flip)
    return conved[:, :, :, 0]  # drop the unused dimension

def conv1d_unstrided(input, filters, image_shape, filter_shape,
                     border_mode='valid', subsample=(1,), filter_flip=True,
                     implementation=conv1d_sc):
    """
    perform a strided 1D convolution by reshaping input and filters so that the
    stride becomes 1. This function requires that the filter length is a
    multiple of the stride. It also truncates the input to have a length
    that is a multiple of the stride.
    """
    batch_size, num_input_channels, input_length = image_shape
    num_filters, num_input_channels_, filter_length = filter_shape
    stride = subsample[0]

    if filter_length % stride > 0:
        raise RuntimeError("Filter length (%d) is not a multiple of the "
                           "stride (%d)" % (filter_length, stride))
    # TODO: test if this works for border_mode='full'
    if border_mode not in ('valid', 0, (0,)):
        raise RuntimeError("Unsupported border_mode for conv1d_unstrided: "
                           "%s" % border_mode)

    num_steps = filter_length // stride

    # input sizes need to be multiples of the strides,
    # truncate to correct sizes.
    truncated_length = (input_length // stride) * stride
    input_truncated = input[:, :, :truncated_length]

    r_input_shape = (batch_size, num_input_channels,
                     truncated_length // stride, stride)
    r_input = input_truncated.reshape(r_input_shape)

    # fold strides into the feature maps dimension (input)
    r_input_folded_shape = (batch_size, num_input_channels * stride,
                            truncated_length // stride)
    r_input_folded = r_input.dimshuffle(
        0, 1, 3, 2).reshape(r_input_folded_shape)

    r_filter_shape = (num_filters, num_input_channels, num_steps, stride)
    r_filters_flipped = filters[:, :, ::-1].reshape(r_filter_shape)

    # fold strides into the feature maps dimension (filters)
    r_filter_folded_shape = (num_filters, num_input_channels * stride,
                             num_steps)
    r_filters_flipped_folded = r_filters_flipped.dimshuffle(
        0, 1, 3, 2).reshape(r_filter_folded_shape)
    r_filters_folded = r_filters_flipped_folded[:, :, ::-1]  # unflip

    return implementation(r_input_folded, r_filters_folded,
                          r_input_folded_shape, r_filter_folded_shape,
                          border_mode, subsample=(1,), filter_flip=filter_flip)

def conv1d_sd(input, filters, image_shape, filter_shape, border_mode='valid',
              subsample=(1,), filter_flip=True):
    """
    using a single dot product
    """
    if border_mode not in ('valid', 0, (0,)):
        raise RuntimeError("Unsupported border_mode for conv1d_sd: "
                           "%s" % border_mode)

    batch_size, num_input_channels, input_length = image_shape
    num_filters, num_input_channels_, filter_length = filter_shape
    stride = subsample[0]

    if filter_length % stride > 0:
        raise RuntimeError("Filter length (%d) is not a multiple of the "
                           "stride (%d)" % (filter_length, stride))

    num_steps = filter_length // stride
    output_length = (input_length - filter_length + stride) // stride

    # pad the input so all the shifted dot products fit inside.
    # shape is (b, c, l)
    padded_length = ((input_length // filter_length) * filter_length +
                     (num_steps - 1) * stride)

    # at this point, it is possible that the padded_length is SMALLER than the
    # input size. so then we have to truncate first.
    truncated_length = min(input_length, padded_length)
    input_truncated = input[:, :, :truncated_length]

    input_padded_shape = (batch_size, num_input_channels, padded_length)
    input_padded = T.zeros(input_padded_shape)
    input_padded = T.set_subtensor(input_padded[:, :, :truncated_length],
                                   input_truncated)

    inputs = []
    for num in range(num_steps):
        shift = num * stride
        length = (padded_length - shift) // filter_length

        r_input_shape = (batch_size, num_input_channels, length, filter_length)
        r_input = input_padded[
            :, :, shift:length * filter_length + shift].reshape(r_input_shape)

        inputs.append(r_input)

    inputs_stacked = T.stack(*inputs)  # shape is (n, b, c, w, f)
    filters_flipped = filters[:, :, ::-1] if filter_flip else filters

    r_conved = T.tensordot(inputs_stacked, filters_flipped,
                           np.asarray([[2, 4], [1, 2]]))
    # resulting shape is (n, b, w, n_filters)
    # output needs to be (b, n_filters, w * n)
    r_conved = r_conved.dimshuffle(1, 3, 2, 0)  # (b, n_filters, w, n)
    conved = r_conved.reshape((r_conved.shape[0], r_conved.shape[1],
                               r_conved.shape[2] * r_conved.shape[3]))
    # result is (b, n_f, l)

    # remove padding
    return conved[:, :, :output_length]

def conv1d_md(input, filters, image_shape, filter_shape, border_mode='valid',
              subsample=(1,), filter_flip=True):
    """
    using multiple dot products
    """
    if border_mode not in ('valid', 0, (0,)):
        raise RuntimeError("Unsupported border_mode for conv1d_md: "
                           "%s" % border_mode)

    batch_size, num_input_channels, input_length = image_shape
    num_filters, num_input_channels_, filter_length = filter_shape
    stride = subsample[0]

    if filter_length % stride > 0:
        raise RuntimeError("Filter length (%d) is not a multiple of the "
                           "stride (%d)" % (filter_length, stride))

    num_steps = filter_length // stride
    output_length = (input_length - filter_length + stride) // stride
    output_shape = (batch_size, num_filters, output_length)

    filters_flipped = filters[:, :, ::-1] if filter_flip else filters

    conved = T.zeros(output_shape)

    for num in range(num_steps):
        shift = num * stride
        length = (input_length - shift) // filter_length

        if length == 0:
            # we can safely skip this product, it doesn't contribute to the
            # final convolution.
            continue

        r_input_shape = (batch_size, num_input_channels, length, filter_length)
        r_input = input[
            :, :, shift:length * filter_length + shift].reshape(r_input_shape)

        # shape (b, l, n_filters)
        r_conved = T.tensordot(r_input, filters_flipped,
                               np.asarray([[1, 3], [1, 2]]))
        r_conved = r_conved.dimshuffle(0, 2, 1)  # shape is (b, n_filters, l)
        conved = T.set_subtensor(conved[:, :, num::num_steps], r_conved)

    return conved

# TODO: conv1d_md_channelslast?

# 2D convolutions

# TODO


text:
package com.onboard.service.collaboration.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.hankcs.hanlp.HanLP;
import com.onboard.domain.mapper.KeywordMapper;
import com.onboard.domain.mapper.model.KeywordExample;
import com.onboard.domain.model.Keyword;
import com.onboard.domain.model.User;
import com.onboard.domain.model.type.BaseProjectItem;
import com.onboard.domain.model.type.Recommendable;
import com.onboard.service.collaboration.KeywordService;

/**
 * {@link com.onboard.service.collaboration.KeywordService} Service implementation
 *
 * @generated_by_elevenframework
 *
 */
@Transactional
@Service("keywordServiceBean")
public class KeywordServiceImpl implements KeywordService {

    @Autowired
    private KeywordMapper keywordMapper;

    @Override
    public List<Keyword> getKeywordsByUser(int userId, int start, int limit) {
        Keyword keyword = new Keyword(false);
        keyword.setAttachType(new User().getType());
        keyword.setAttachId(userId);
        KeywordExample keywordExample = new KeywordExample(keyword);
        keywordExample.setOrderByClause("tfidf desc");
        keywordExample.setStart(start);
        keywordExample.setLimit(limit);
        return keywordMapper.selectByExample(keywordExample);
    }

    @Override
    public List<Keyword> getKeywordsByUserByCompany(int companyId, int userId, int start, int limit) {
        Keyword keyword = new Keyword(false);
        keyword.setAttachType(new User().getType());
        keyword.setAttachId(userId);
        keyword.setCompanyId(companyId);
        KeywordExample keywordExample = new KeywordExample(keyword);
        keywordExample.setOrderByClause("tfidf desc");
        keywordExample.setStart(start);
        keywordExample.setLimit(limit);
        return keywordMapper.selectByExample(keywordExample);
    }

    @Override
    public void generateOrUpdateKeywordsByIdentifiable(Recommendable identifiable) {
        deleteKeywordsByIdentifiable(identifiable);
        List<String> keywords = HanLP.extractKeyword(identifiable.generateText(), PER_IDENTIFIABLE_KEYWORD_COUNT);
        for (String keyword : keywords) {
            keywordMapper.insert(generateKeywordObjectByIdentifiableAndString(identifiable, keyword));
        }
    }

    private Keyword generateKeywordObjectByIdentifiableAndString(BaseProjectItem identifiable, String keyword) {
        Keyword result = new Keyword(false);
        result.setAttachType(identifiable.getType());
        result.setAttachId(identifiable.getId());
        result.setCompanyId(identifiable.getCompanyId());
        result.setProjectId(identifiable.getProjectId());
        result.setKeyword(keyword);
        result.setTimes(1l);
        return result;
    }

    private Keyword generateUserKeywordObject(int companyId, int projectId, int userId, String keyword) {
        Keyword result = new Keyword(false);
        result.setAttachType(new User().getType());
        result.setAttachId(userId);
        result.setCompanyId(companyId);
        result.setProjectId(projectId);
        result.setKeyword(keyword);
        return result;
    }

    @Override
    public void deleteKeywordsByIdentifiable(Recommendable identifiable) {
        Keyword keyword = new Keyword(false);
        keyword.setAttachId(identifiable.getId());
        keyword.setAttachType(identifiable.getType());
        KeywordExample keywordExample = new KeywordExample(keyword);
        List<Keyword> keywords = keywordMapper.selectByExample(keywordExample);
        if (null != keywords && 0 != keywords.size()) {
            for (Keyword toDeleteKeyword : keywords) {
                toDeleteKeyword.setDeleted(true);
                keywordMapper.updateByPrimaryKey(toDeleteKeyword);
            }
        }
    }

    @Override
    public List<String> getKeywordsByText(String text) {
        return HanLP.extractKeyword(text, PER_IDENTIFIABLE_KEYWORD_COUNT);
    }

    @Override
    public void addKeywordToUser(Recommendable identifiable, int userId) {
        Keyword keywordExample = new Keyword(false);
        keywordExample.setAttachId(identifiable.getId());
        keywordExample.setAttachType(identifiable.getType());
        List<Keyword> attachKeywords = keywordMapper.selectByExample(new KeywordExample(keywordExample));
        if (attachKeywords != null) {
            for (Keyword keyword : attachKeywords) {
                List<Keyword> existUserKeywords = keywordMapper.selectByExample(new KeywordExample(generateUserKeywordObject(
                        identifiable.getCompanyId(), identifiable.getProjectId(), userId, keyword.getKeyword())));
                if (null == existUserKeywords || 0 == existUserKeywords.size()) {
                    Keyword newKeyword = generateUserKeywordObject(identifiable.getCompanyId(), identifiable.getProjectId(),
                            userId, keyword.getKeyword());
                    newKeyword.setTimes(1l);
                    keywordMapper.insert(newKeyword);
                } else {
                    for (Keyword existUserKeyword : existUserKeywords) {
                        existUserKeyword.addTimes(1);
                        keywordMapper.updateByPrimaryKey(existUserKeyword);
                    }
                }
            }
        }
    }

    /**
     * 获取tfidf
     *
     * @param keyword
     *            关键词
     * @param times
     *            关键词的次数
     * @param userId
     *            关联的用户
     * @param userIds
     *            所有用户id
     * @param userKeywordMap
     *            用户关键词映射
     * @return
     */
    private Double getTfidf(String keyword, long times, int userId, Map<Integer, List<Keyword>> userKeywordMap) {
        long wordCount = times;
        long totalCount = 1;
        List<Keyword> userKeywords = userKeywordMap.get(userId);
        if (userKeywords == null) {
            userKeywords = Lists.newArrayList();
        }
        for (Keyword userKeyword : userKeywords) {
            totalCount += userKeyword.getTimes();
        }
        double tf = (double) wordCount / totalCount;
        long totalDocumentCount = userKeywordMap.keySet().size();
        long includeWordDocumentCount = 1;
        for (Integer thisUserId : userKeywordMap.keySet()) {
            List<Keyword> thisUserKeywords = userKeywordMap.get(thisUserId);
            boolean containKeyword = false;
            for (Keyword thisKeyword : thisUserKeywords) {
                if (thisKeyword.getKeyword().equals(keyword)) {
                    containKeyword = true;
                    break;
                }
            }
            if (containKeyword) {
                includeWordDocumentCount++;
            }
        }
        double idf = Math.log((double) totalDocumentCount / includeWordDocumentCount);
        return tf * idf;
    }

    @Override
    public void deleteKeywordByExample(KeywordExample keywordExample) {
        List<Keyword> keywords = keywordMapper.selectByExample(keywordExample);
        for (Keyword keyword : keywords) {
            keyword.setDeleted(true);
            keywordMapper.updateByPrimaryKey(keyword);
        }
    }

    @Override
    public void regenerateKeywordTfidf() {
        Keyword keywordExample = new Keyword(false);
        keywordExample.setAttachType(new User().getType());
        List<Keyword> projectKeywords = keywordMapper.selectByExample(new KeywordExample(keywordExample));
        Map<Integer, List<Keyword>> userKeywordMap = Maps.newHashMap();
        for (Keyword keyword : projectKeywords) {
            if (userKeywordMap.containsKey(keyword.getAttachId())) {
                List<Keyword> userKeywords = userKeywordMap.get(keyword.getAttachId());
                userKeywords.add(keyword);
                userKeywordMap.put(keyword.getAttachId(), userKeywords);
            } else {
                userKeywordMap.put(keyword.getAttachId(), Lists.newArrayList(keyword));
            }
        }
        for (Keyword keyword : projectKeywords) {
            Double beforeTfidf = keyword.getTfidf();
            keyword.setTfidf(getTfidf(keyword.getKeyword(), keyword.getTimes(), keyword.getAttachId(), userKeywordMap));
            if (keyword.getTfidf() != beforeTfidf) {
                keywordMapper.updateByPrimaryKey(keyword);
            }
        }
    }
}


text:
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

using System.Management.Automation;
using Xunit;
using Microsoft.WindowsAzure.Commands.Test.Utilities.Websites;
using Microsoft.WindowsAzure.Commands.Utilities.Websites;
using Microsoft.WindowsAzure.Commands.Websites.WebJobs;
using Microsoft.WindowsAzure.WebSitesExtensions.Models;
using Moq;

namespace Microsoft.WindowsAzure.Commands.Test.Websites
{

    public class NewAzureWebsiteJobTests : WebsitesTestBase
    {
        private const string websiteName = "website1";

        private const string slot = "staging";

        private Mock<IWebsitesClient> websitesClientMock;

        private NewAzureWebsiteJobCommand cmdlet;

        private Mock<ICommandRuntime> commandRuntimeMock;

        public NewAzureWebsiteJobTests()
        {
            websitesClientMock = new Mock<IWebsitesClient>();
            commandRuntimeMock = new Mock<ICommandRuntime>();
            cmdlet = new NewAzureWebsiteJobCommand()
            {
                CommandRuntime = commandRuntimeMock.Object,
                WebsitesClient = websitesClientMock.Object,
                Name = websiteName,
                Slot = slot
            };
        }

        [Fact]
        public void CreatesTriggeredWebJob()
        {
            // Setup
            string jobName = "myWebJob";
            string jobFile = "job.bat";
            WebJobType jobType = WebJobType.Triggered;
            PSTriggeredWebJob output = new PSTriggeredWebJob() { JobName = jobName, JobType = jobType };
            websitesClientMock.Setup(f => f.CreateWebJob(websiteName, slot, jobName, jobType, jobFile)).Returns(output);
            cmdlet.JobName = jobName;
            cmdlet.JobType = jobType;
            cmdlet.JobFile = jobFile;

            // Test
            cmdlet.ExecuteCmdlet();

            // Assert
            websitesClientMock.Verify(f => f.CreateWebJob(websiteName, slot, jobName, jobType, jobFile), Times.Once());
            commandRuntimeMock.Verify(f => f.WriteObject(output), Times.Once());
        }
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>

<TEI xmlns="http://www.tei-c.org/ns/1.0">
  <teiHeader>
    <fileDesc>
      <titleStmt>
        <title>Carta de Federico García Lorca a José María Chacón y Calvo</title>
        <editor xml:id="MIH">Mayda Herrera</editor>
      </titleStmt>
      <publicationStmt>

Proyecto Lorca en Cuba. SPA 322

      </publicationStmt>
      <sourceDesc>
        <msDesc>
          <msIdentifier>
            <settlement>Coral Gables, Florida</settlement>
            <repository>Library Digital Collections, University of Miami</repository>
            <collection corresp="http://merrick.library.miami.edu/cdm/search/collection/chc5324/"
              >Federico García Lorca Papers</collection>
            <idno
              corresp="http://merrick.library.miami.edu/cdm/compoundobject/collection/chc5324/id/28/rec/11"
              >chc5324000018</idno>
          </msIdentifier>
          <msContents>
            <msItem>
              <docAuthor><forename>Federico</forename>
                <surname>García Lorca</surname>
              </docAuthor>
              <docTitle>
                <titlePart>Carta de Federico García Lorca a José María Chacón y Calvo</titlePart>
              </docTitle>
              <docImprint>
                <pubPlace>Madrid, España</pubPlace>
              </docImprint>
              <docDate when="1923">julio 1923</docDate>
              <note type="correspondencia">
                <persName type="emisor">Federico García Lorca</persName>
                <persName type="destinatario">José María Chacón y Calvo</persName>
              </note>
              <note type="contenido">

 Esta carta fué escrita por Federico Garcia Lorca a su amigo Chacón en julio del
                  año 1923, cuando residía en Madrid en la Residencia de Estudiantes, ubicada en la
                  dirección 5253, Burgos. Por lo que la carta expresa, Lorca planeaba viajar a
                  Granada al día siguiente y el escritor usa esta misiva a modo de despedida de su
                  amigo Chacón. En la carta se mencionan otras personas importantes como Dulce María
                  Loynaz una joven poeta cubana. También habla con mucha familiaridad de Gustavo
                  Duran (a quien llama Gustavito) quien fuera un compositor español a quien Lorca
                  conoció tomando clases de piano en dicha residencia. Lo interesante de esta carta
                  es los sentimientos que Lorca expresa abiertamente hacia su amigo cubano, Chacón.
                  Lorca improvisa versos, que son plasmados brillantemente en la carta, acompañados
                  de dibujos de Cuba y su campiña, dedicados a su amigo entrañable. Es bueno
                  destacar que la carta va acompañada de una nota de puño y letra de Chacón que nos
                  sugiere que la misma es una copia de una carta original de Federiquín (como el
                  cubano le llamaba a Lorca cariñosamente) (EpComp: 190; Ripoll 3: 51).

              </note>
            </msItem>
          </msContents>
          <physDesc>
            <objectDesc form="carta">
              <supportDesc>
                <extent><dimensions>
                    <height>27cm</height>
                    <width>21cm</width>
                  </dimensions></extent>
              </supportDesc>
            </objectDesc>
          </physDesc>
        </msDesc>
      </sourceDesc>
    </fileDesc>
  </teiHeader>

  <text>

          <pb facs="../images/Richter/18_1.jpg" n="recto"/>
          <ab>Copia de una carta de <lb/>
            <hi rendition="subrayado">Federiquín</hi></ab>

            <opener>
              <salute>Queridísimo Pepe María:</salute>
            </opener>

 He venido a despedirme de tí. Mañana a las 10 de la mañana<lb/> me voy a
              Granada.

¡Como lo siento! Pienso con tristeza que no te voy a ver en <lb/> mucho tiempo y que
              seguramente te acordarás poco de mí.<lb/> ¿Te podré ver antes de mi partida? El libro
              para Loynaz te<lb/> lo dejare en poder de Almagro y además varios libros para que tú
              <lb/> los envíes a Cuba. A la una y media llámame a la Resi[dencia de Estudiantes
              5253] por si me quieres dejar algo.

He venido tan temprano porque Gustavito Durán no quiere <lb/> separarse de mí ni un
              minuto.

            <closer><salute>Adiós cubano; ya sabes cuanto <lb/> te quiere</salute>
              <signed>Federico </signed>
            </closer>

            <lg>
              <l>Regalo lírico</l>
              <l>sobre el pianísimo</l>
              <l>del oro</l>
              <l>mi chopo</l>
              <l>solo</l>
              <l>sin un pajarillo</l>
              <l>armonioso</l>
            </lg>

          <pb facs="../images/Richter/18_2.jpg" n="verso"/>

            <lg>
              <l>y yo con la tarde</l>
              <l>sobre mis hombros</l>
              <l>como un corderito</l>
              <l>muerto por el lobo,</l>
              <l>bajo el pianísimo </l>
              <l>del oro </l>
            </lg>

Este bomboncillo lírico te lo dejo encima de tu mesa para <lb/> que te lo comas, sin
              quitarle su envoltura de brisa dorada <lb/> ¡Adiós!

            <ab> Adiós José María<lb/> (que tu alma triste) y lírica <lb/> duerma sobre la frente
              de<lb/> la palmera altísima,<lb/> ¡Cuba sobre los mares!</ab>
            <ab>Tu alma vieja y niña<lb/> de estrella a estrella, de <lb/> brisa en brisa. </ab>

              <ab>Aquí dibujada una palmera</ab>

              <ab>Aquí dibujado un poeta febríl que dice estos versos</ab>

              <ab>Aquí un paisaje representado un campo y un bohío cubano </ab>

            <lg>
              <l>Copla cubana:</l>
              <l>Lloran sobre el mar de Cuba</l>
              <l>enormes flores bermejas,</l>
              <l>sobre la isla perdida</l>
              <l>el aire amarillo tiembla!</l>
            </lg>

  </text>
</TEI>


text:
#ifndef CPP_INCLUDE_LIBXTREEMFS_OPTIONS_H_
#define CPP_INCLUDE_LIBXTREEMFS_OPTIONS_H_

#include <stdint.h>

#include <boost/function.hpp>
#include <boost/program_options.hpp>
#include <iostream>
#include <string>
#include <vector>

#include "libxtreemfs/typedefs.h"
#include "libxtreemfs/user_mapping.h"

namespace xtreemfs {

namespace rpc {
class SSLOptions;
}  // namespace rpc

enum XtreemFSServiceType {
  kDIR, kMRC
};

class Options {
 public:
  /** Query function which returns 1 when the request was interrupted.
   *
   * @note the boost::function typedef could be replaced with
   *       typedef int (*query_function)(void);
   *       which would also works without changes, but would not support
   *       functor objects
   */
  typedef boost::function0<int> CheckIfInterruptedQueryFunction;

  /** Sets the default values. */
  Options();

  virtual ~Options() {}

  /** Generates boost::program_options description texts. */
  void GenerateProgramOptionsDescriptions();

  /** Set options parsed from command line.
   *
   * However, it does not set dir_volume_url and does not call
   * ParseVolumeAndDir().
   *
   * @throws InvalidCommandLineParametersException
   * @throws InvalidURLException */
  std::vector<std::string> ParseCommandLine(int argc, char** argv);

  /** Extract volume name and dir service address from dir_volume_url. */
  void ParseURL(XtreemFSServiceType service_type);

  /** Outputs usage of the command line parameters of all options. */
  virtual std::string ShowCommandLineHelp();

  /** Outputs usage of the command line parameters of volume creation
   *  relevant options. */
  std::string ShowCommandLineHelpVolumeCreationAndDeletion();

  /** Outputs usage of the command line parameters of volume deletion/listing
   *  relevant options. */
  std::string ShowCommandLineHelpVolumeListing();

  /** Returns the version string and prepends "component". */
  std::string ShowVersion(const std::string& component);

  /** Returns true if required SSL options are set. */
  bool SSLEnabled() const;

  /** Creates a new SSLOptions object based on the value of the members:
   *  - ssl_pem_key_path
   *  - ssl_pem_cert_path
   *  - ssl_pem_key_pass
   *  - ssl_pem_trusted_certs_path
   *  - ssl_pkcs12_path
   *  - ssl_pkcs12_pass
   *  - grid_ssl || protocol
   *  - verify_certificates
   *  - ignore_verify_errors
   *  - ssl_method
   *
   * @remark Ownership is transferred to caller. May be NULL.
   */
  xtreemfs::rpc::SSLOptions* GenerateSSLOptions() const;

  // Version information.
  std::string version_string;

  // XtreemFS URL Options.
  /** URL to the Volume.
   *
   * Format:[pbrpc://]service-hostname[:port](,[pbrpc://]service-hostname2[:port])*[/volume_name].  // NOLINT
   *
   * Depending on the type of operation the service-hostname has to point to the
   * DIR (to open/"mount" a volume) or the MRC (create/delete/list volumes).
   * Depending on this type, the default port differs (DIR: 32638; MRC: 32636).
   */
  std::string xtreemfs_url;
  /** Usually extracted from xtreemfs_url (Form: ip-address:port).
   *
   * Depending on the application, it may contain the addresses of DIR replicas
   * (e.g., mount.xtreemfs) or MRC replicas (e.g., mkfs.xtreemfs). */
  ServiceAddresses service_addresses;
  /** Usually extracted from xtreemfs_url. */
  std::string volume_name;
  /** Usually extracted from xtreemfs_url. */
  std::string protocol;
  /** Mount point on local system (set by ParseCommandLine()). */
  std::string mount_point;

  // General options.
  /** Log level as string (EMERG|ALERT|CRIT|ERR|WARNING|NOTICE|INFO|DEBUG). */
  std::string log_level_string;
  /** If not empty, the output will be logged to a file. */
  std::string log_file_path;
  /** True, if "-h" was specified. */
  bool show_help;
  /** True, if argc == 1 was at ParseCommandLine(). */
  bool empty_arguments_list;
  /** True, if -V/--version was specified and the version will be shown only .*/
  bool show_version;

  // Optimizations.
  /** Maximum number of entries of the StatCache */
  uint64_t metadata_cache_size;
  /** Time to live for MetadataCache entries. */
  uint64_t metadata_cache_ttl_s;
  /** Enable asynchronous writes */
  bool enable_async_writes;
  /** Maximum number of pending async write requests per file. */
  int async_writes_max_requests;
  /** Maximum write request size per async write. Should be equal to the lowest
   *  upper bound in the system (e.g. an object size, or the FUSE limit). */
  int async_writes_max_request_size_kb;
  /** Number of retrieved entries per readdir request. */
  int readdir_chunk_size;
  /** True, if atime requests are enabled in Fuse/not ignored by the library. */
  bool enable_atime;

  // Error Handling options.
  /** How often shall a failed operation get retried? */
  int max_tries;
  /** How often shall a failed read operation get retried? */
  int max_read_tries;
  /** How often shall a failed write operation get retried? */
  int max_write_tries;
  /** How often shall a view be tried to renewed? */
  int max_view_renewals;
  /** How long to wait after a failed request at least? */
  int retry_delay_s;
  /** Maximum time until a connection attempt will be aborted. */
  int32_t connect_timeout_s;
  /** Maximum time until a request will be aborted and the response returned. */
  int32_t request_timeout_s;
  /** The RPC Client closes connections after "linger_timeout_s" time of
   *  inactivity. */
  int32_t linger_timeout_s;

#ifdef HAS_OPENSSL
  // SSL options.
  std::string ssl_pem_cert_path;
  std::string ssl_pem_key_path;
  std::string ssl_pem_key_pass;
  std::string ssl_pem_trusted_certs_path;
  std::string ssl_pkcs12_path;
  std::string ssl_pkcs12_pass;
  /** True, if the XtreemFS Grid-SSL Mode (only SSL handshake, no encryption of
   *  data itself) shall be used. */
  bool grid_ssl;

  /** True if certificates shall be verified. */
  bool ssl_verify_certificates;
  /** List of openssl verify error codes to ignore during verification and
   * accept anyway. Only used when ssl_verify_certificates = true. */
  std::vector<int> ssl_ignore_verify_errors;

  /** SSL version that this client should accept. */
  std::string ssl_method_string;
#endif  // HAS_OPENSSL

  // Grid Support options.
  /** True if the Globus user mapping shall be used. */
  bool grid_auth_mode_globus;
  /** True if the Unicore user mapping shall be used. */
  bool grid_auth_mode_unicore;
  /** Location of the gridmap file. */
  std::string grid_gridmap_location;
  /** Default Location of the Globus gridmap file. */
  std::string grid_gridmap_location_default_globus;
  /** Default Location of the Unicore gridmap file. */
  std::string grid_gridmap_location_default_unicore;
  /** Periodic interval after which the gridmap file will be reloaded. */
  int grid_gridmap_reload_interval_m;

  // Vivaldi Options
  /** Enables the vivaldi coordinate calculation for the client. */
  bool vivaldi_enable;
  /** Enables sending the coordinates to the DIR after each recalculation. This
   *  is only needed to add the clients to the vivaldi visualization at the cost
   *  of some additional traffic between client and DIR.") */
  bool vivaldi_enable_dir_updates;
  /** The file where the vivaldi coordinates should be saved after each
   *  recalculation. */
  std::string vivaldi_filename;
  /** The interval between coordinate recalculations. Also see
   *  vivaldi_recalculation_epsilon_s. */
  int vivaldi_recalculation_interval_s;
  /** The recalculation interval will be randomly chosen from
   *  vivaldi_recalculation_inverval_s +/- vivaldi_recalculation_epsilon_s */
  int vivaldi_recalculation_epsilon_s;
  /** Number of coordinate recalculations before updating the list of OSDs. */
  int vivaldi_max_iterations_before_updating;
  /** Maximal number of retries when requesting coordinates from another
   *  vivaldi node. */
  int vivaldi_max_request_retries;

  // Advanced XtreemFS options.
  /** Interval for periodic file size updates in seconds. */
  int periodic_file_size_updates_interval_s;
  /** Interval for periodic xcap renewal in seconds. */
  int periodic_xcap_renewal_interval_s;
  /** Skewness of the Zipf distribution used for vivaldi OSD selection */
  double vivaldi_zipf_generator_skew;

  /** May contain all previous options in key=value pair lists. */
  std::vector<std::string> alternative_options_list;

  // Internal options, not available from the command line interface.
  /** If not NULL, called to find out if request was interrupted. */
  CheckIfInterruptedQueryFunction was_interrupted_function;

  // NOTE: Deprecated options are no longer needed as members

  // Additional User mapping.
  /** Type of the UserMapping used to translate between local/global names. */
  UserMapping::UserMappingType additional_user_mapping_type;

 private:
  /** Reads password from stdin and stores it in 'password'. */
  void ReadPasswordFromStdin(const std::string& msg, std::string* password);

  /** This functor template can be used as argument for the notifier() method
   *  of boost::options. It is specifically used to create a warning whenever
   *  a deprecated option is used, but is not limited to that purpose.
   *  The CreateMsgOptionHandler function template can be used to instantiate it
   *  without explicit template type specification. Instead the type inferred
   *  from the value given by the corresponding member variable.
   */
  template<typename T>
  class MsgOptionHandler {
   public:
    typedef void result_type;
    MsgOptionHandler(std::string msg)
     : msg_(msg) { }
    void operator()(const T& value) {
      std::cerr << "Warning: Deprecated option used: " << msg_ << std::endl;
    }
   private:
    const std::string msg_;
  };

  /** See MsgOptionHandler */
  template<typename T>
  MsgOptionHandler<T> CreateMsgOptionHandler(const T&, std::string msg) {
    return MsgOptionHandler<T>(msg);
  }

  // Sums of options.
  /** Contains all boost program options, needed for parsing. */
  boost::program_options::options_description all_descriptions_;

  /** Contains descriptions of all visible options (no advanced and
   *  deprecated options). Used by ShowCommandLineHelp().*/
  boost::program_options::options_description visible_descriptions_;

  /** Set to true if GenerateProgramOptionsDescriptions() was executed. */
  bool all_descriptions_initialized_;

  // Options itself.
  /** Description of general options (Logging, help). */
  boost::program_options::options_description general_;

  /** Description of options which improve performance. */
  boost::program_options::options_description optimizations_;

  /** Description of timeout options etc. */
  boost::program_options::options_description error_handling_;

#ifdef HAS_OPENSSL
  /** Description of SSL related options. */
  boost::program_options::options_description ssl_options_;
#endif  // HAS_OPENSSL

  /** Description of options of the Grid support. */
  boost::program_options::options_description grid_options_;

  /** Description of the Vivaldi options */
  boost::program_options::options_description vivaldi_options_;

  // Hidden options.
  /** Description of options of the Grid support. */
  boost::program_options::options_description xtreemfs_advanced_options_;

  /** Deprecated options which are kept to ensure backward compatibility. */
  boost::program_options::options_description deprecated_options_;

  /** Specify all previous options in key=value pair lists. */
  boost::program_options::options_description alternative_options_;
};

}  // namespace xtreemfs

#endif  // CPP_INCLUDE_LIBXTREEMFS_OPTIONS_H_