code
stringlengths 3
1.05M
| repo_name
stringlengths 4
116
| path
stringlengths 3
942
| language
stringclasses 30
values | license
stringclasses 15
values | size
int32 3
1.05M
|
---|---|---|---|---|---|
+++
date = "2009-03-11T17:33:44+09:00"
draft = false
title = "manを実行すると \"WARNING: old character encoding and/or character set\" とエラーを吐く時の対処"
categories = ["memo"]
+++
manを実行すると以下のようなエラーになることがある。
```text
XXX
XXX WARNING: old character encoding and/or character set
XXX
```
いろいろ調べた結果、libiconvが悪さしていた。/usr/bin/iconvではなく、/usr/local/bin/iconvを見に行っていたのが原因だった。/usr/local/bin/iconvのファイル名を変更したら治った。
| nobu666/nobu666.com | content/2009/03/11/756.md | Markdown | mit | 587 |
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Partial Public Class MostKills
'''<summary>
'''Topinfobar1 control.
'''</summary>
'''<remarks>
'''Auto-generated field.
'''To modify move field declaration from designer file to code-behind file.
'''</remarks>
Protected WithEvents Topinfobar1 As Global.sklone.TopInfoBar
'''<summary>
'''lblRulerName control.
'''</summary>
'''<remarks>
'''Auto-generated field.
'''To modify move field declaration from designer file to code-behind file.
'''</remarks>
Protected WithEvents lblRulerName As Global.System.Web.UI.WebControls.Label
'''<summary>
'''tblScores control.
'''</summary>
'''<remarks>
'''Auto-generated field.
'''To modify move field declaration from designer file to code-behind file.
'''</remarks>
Protected WithEvents tblScores As Global.System.Web.UI.WebControls.Table
'''<summary>
'''BottomInfoBar1 control.
'''</summary>
'''<remarks>
'''Auto-generated field.
'''To modify move field declaration from designer file to code-behind file.
'''</remarks>
Protected WithEvents BottomInfoBar1 As Global.SKlone.BottomInfoBar
End Class
| jamend/SKlone | SKlone/scripts/MostKills.aspx.designer.vb | Visual Basic | mit | 1,611 |
package sblectric.lightningcraft.worldgen.structure.underworld;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.world.World;
import net.minecraft.world.gen.structure.StructureBoundingBox;
import sblectric.lightningcraft.blocks.BlockStone;
import sblectric.lightningcraft.dimensions.ChunkProviderUnderworld;
import sblectric.lightningcraft.entities.EntityUnderworldSilverfish;
import sblectric.lightningcraft.init.LCBlocks;
import sblectric.lightningcraft.init.LCItems;
import sblectric.lightningcraft.ref.Material;
import sblectric.lightningcraft.ref.Metal.Ingot;
import sblectric.lightningcraft.ref.RefMisc;
import sblectric.lightningcraft.util.IntList;
import sblectric.lightningcraft.util.WeightedRandomChestContent;
import sblectric.lightningcraft.util.WorldUtils;
import sblectric.lightningcraft.worldgen.structure.Feature;
import sblectric.lightningcraft.worldgen.structure.LootChestGroup;
public class UnderworldRampart extends Feature {
// loot chests
private static final int nChests = 5;
private static final int minStacks = 2;
private static final int maxStacks = 5;
// Blocks to use
private static final Block mainBlock = LCBlocks.stoneBlock;
private static final int mainMeta = BlockStone.THUNDER_BRICK;
private static final int secMeta = BlockStone.UNDER_BRICK;
private static final Block stairBlock = LCBlocks.thunderStairs;
private static final Block slabBlock = LCBlocks.slabBlock;
private static final int slabMeta = 0;
private static final Block lightBlock = LCBlocks.lightBlock;
private static final Block windowBlock = Blocks.IRON_BARS;
private static final Block lapisBlock = LCBlocks.stoneBlock;
private static final int lapisMeta = BlockStone.UNDER_BRICK_CHISELED;
private static final Block wallBlock = LCBlocks.wallBlock;
private static final Block ladderBlock = Blocks.LADDER;
private static final Block cannonBlock = LCBlocks.lightningCannon;
private static final Block accentBlock = Blocks.OBSIDIAN;
private static final Block tntBlock = LCBlocks.underTNT;
private static final Block weakBlock = LCBlocks.corruptStone;
public UnderworldRampart() {
this(new Random(), 0, 0);
}
public UnderworldRampart(Random rand, int x, int z)
{
super(rand, x, 64, z, 51, 30, 51, false); // no rotation
this.spawnMinY = 190;
this.spawnMaxY = 240;
// outside chests
lootChests = new LootChestGroup(nChests, minStacks, maxStacks, new WeightedRandomChestContent[]
{new WeightedRandomChestContent(Items.GOLDEN_APPLE, 0, 1, 3, 5), new WeightedRandomChestContent(Items.ENDER_EYE, 0, 1, 8, 15),
new WeightedRandomChestContent(LCItems.ingot, Ingot.ELEC, 2, 7, 20), new WeightedRandomChestContent(Items.EMERALD, 0, 1, 3, 20),
new WeightedRandomChestContent(LCItems.golfClub, 0, 1, 1, 8), new WeightedRandomChestContent(Items.IRON_INGOT, 0, 3, 7, 20),
new WeightedRandomChestContent(Items.GOLD_INGOT, 0, 3, 7, 20), new WeightedRandomChestContent(Items.DIAMOND_HOE, 0, 1, 1, 1),
new WeightedRandomChestContent(LCItems.skySword, 0, 1, 1, 1), new WeightedRandomChestContent(LCItems.skyAxe, 0, 1, 1, 1),
new WeightedRandomChestContent(LCItems.elecSword, 0, 1, 1, 1)});
// middle chest: trapped, with a bunch of ichor
lootChests.setChestContents(2, new WeightedRandomChestContent[]{new WeightedRandomChestContent(LCItems.material, Material.ICHOR, 10, 30, 100)});
lootChests.setIsTrapped(2, true);
lootChests.setStackMinMax(2, 1, 1);
}
/** Water temple spawn mechanics */
@Override
protected boolean findSpawnPosition(World world, StructureBoundingBox box, int yoff)
{
if (this.structY >= 0) {
if(RefMisc.DEBUG) System.out.println("Structure already exists @ (" + this.boundingBox.minX + ", " + this.boundingBox.minZ + ")");
return true;
} else {
if(RefMisc.DEBUG) System.out.println("Spawn check initiated at (" + this.boundingBox.minX + ", " + this.boundingBox.minZ + ")");
// get ready
Integer s1, s2, s3, s4, middle;
int xCenter = WorldUtils.getStructureCenter(this.boundingBox).getX();
int zCenter = WorldUtils.getStructureCenter(this.boundingBox).getZ();
// load extra chunks
ChunkProviderUnderworld.rampartLoadingExtraChunks = true;
try {
for(int i = -4; !WorldUtils.checkChunksExist(world, this.boundingBox.minX, this.spawnMinY, this.boundingBox.minZ, this.boundingBox.maxX, this.spawnMaxY, this.boundingBox.maxZ) && i <= 4; i++) {
for(int j = -4; !WorldUtils.checkChunksExist(world, this.boundingBox.minX, 0, this.boundingBox.minZ, this.boundingBox.maxX, 255, this.boundingBox.maxZ) && j <= 4; j++) {
if(!(world.getChunkProvider().getLoadedChunk(this.boundingBox.minX / 16 + i, this.boundingBox.minZ / 16 + j) == null))
world.getChunkProvider().provideChunk(this.boundingBox.minX / 16 + i, this.boundingBox.minZ / 16 + j);
}
}
} catch(Exception e) {
System.out.println("Underworld Rampart chunk error occurred: crash averted");
}
ChunkProviderUnderworld.rampartLoadingExtraChunks = false;
// check each support
s1 = WorldUtils.getOpenCeiling(world, this.boundingBox.minX, zCenter, this.spawnMinY, this.spawnMaxY, 4);
s2 = WorldUtils.getOpenCeiling(world, xCenter, this.boundingBox.minZ, this.spawnMinY, this.spawnMaxY, 4);
s3 = WorldUtils.getOpenCeiling(world, this.boundingBox.maxX, zCenter, this.spawnMinY, this.spawnMaxY, 4);
s4 = WorldUtils.getOpenCeiling(world, xCenter, this.boundingBox.maxZ, this.spawnMinY, this.spawnMaxY, 4);
// now check the middle
middle = WorldUtils.getOpenCeiling(world, xCenter, zCenter, this.spawnMinY, this.spawnMaxY, this.scatteredFeatureSizeY);
// make sure the test points are successful
if(s1 != null && s2 != null && s3 != null && s4 != null && middle != null) {
// now add them to a list
IntList l = (IntList)new IntList().join(s1, s2, s3, s4);
// terrain variance is key
if(l.variance() <= 10) {
this.structY = l.max() + 2 - this.scatteredFeatureSizeY; // root it in the ceiling
if(RefMisc.DEBUG) System.out.println("Spawn success at position (" + this.boundingBox.minX + ", " + this.spawnMinY + ", " + this.boundingBox.minZ + ")");
this.boundingBox.offset(0, this.structY - this.boundingBox.minY + yoff, 0);
return true;
} else {
if(RefMisc.DEBUG) System.out.println("Too much variance (" + l.variance() + ")");
}
} else {
if(RefMisc.DEBUG) System.out.println("Structure point(s) missing");
}
if(RefMisc.DEBUG) System.out.println("Spawn failed at position (" + this.boundingBox.minX + ", " + this.boundingBox.minZ + ")");
return false;
}
}
/**
* second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes
* Mineshafts at the end, it adds Fences...
*/
@Override
public boolean addComponentParts(World world, Random rand, StructureBoundingBox box)
{
if (!this.findSpawnPosition(world, box, 0)) {
return false;
} else {
// add those blocks!
this.addBlock(world, 0, 29, 24, stairBlock, 4);
this.addBlock(world, 0, 29, 26, stairBlock, 4);
this.addBlock(world, 1, 28, 24, stairBlock, 4);
this.addBlock(world, 1, 28, 26, stairBlock, 4);
this.addBlock(world, 1, 29, 24, lapisBlock, lapisMeta);
this.addBlock(world, 1, 29, 26, lapisBlock, lapisMeta);
this.addBlock(world, 1, 30, 24, stairBlock, 1);
this.addBlock(world, 1, 30, 26, stairBlock, 1);
this.addBlock(world, 2, 27, 24, stairBlock, 4);
this.addBlock(world, 2, 27, 26, stairBlock, 4);
this.addBlock(world, 2, 28, 24, lapisBlock, lapisMeta);
this.addBlock(world, 2, 28, 26, lapisBlock, lapisMeta);
this.addBlock(world, 2, 29, 24, stairBlock, 1);
this.addBlock(world, 2, 29, 26, stairBlock, 1);
this.addBlock(world, 3, 26, 24, stairBlock, 4);
this.addBlock(world, 3, 26, 26, stairBlock, 4);
this.addBlock(world, 3, 27, 24, lapisBlock, lapisMeta);
this.addBlock(world, 3, 27, 26, lapisBlock, lapisMeta);
this.addBlock(world, 3, 28, 24, stairBlock, 1);
this.addBlock(world, 3, 28, 26, stairBlock, 1);
this.addBlock(world, 4, 25, 24, stairBlock, 4);
this.addBlock(world, 4, 25, 26, stairBlock, 4);
this.addBlock(world, 4, 26, 24, lapisBlock, lapisMeta);
this.addBlock(world, 4, 26, 26, lapisBlock, lapisMeta);
this.addBlock(world, 4, 27, 24, stairBlock, 1);
this.addBlock(world, 4, 27, 26, stairBlock, 1);
this.addBlock(world, 5, 24, 24, stairBlock, 4);
this.addBlock(world, 5, 24, 26, stairBlock, 4);
this.addBlock(world, 5, 25, 24, lapisBlock, lapisMeta);
this.addBlock(world, 5, 25, 26, lapisBlock, lapisMeta);
this.addBlock(world, 5, 26, 24, stairBlock, 1);
this.addBlock(world, 5, 26, 26, stairBlock, 1);
this.addBlock(world, 6, 13, 25, mainBlock, mainMeta);
this.addBlock(world, 6, 14, 25, cannonBlock, 0);
this.addBlock(world, 6, 23, 24, stairBlock, 4);
this.addBlock(world, 6, 23, 26, stairBlock, 4);
this.addBlock(world, 6, 24, 24, lapisBlock, lapisMeta);
this.addBlock(world, 6, 24, 26, lapisBlock, lapisMeta);
this.addBlock(world, 6, 25, 24, stairBlock, 1);
this.addBlock(world, 6, 25, 26, stairBlock, 1);
this.addBlock(world, 7, 13, 25, mainBlock, mainMeta);
this.addBlock(world, 7, 22, 24, stairBlock, 4);
this.addBlock(world, 7, 22, 26, stairBlock, 4);
this.addBlock(world, 7, 23, 24, lapisBlock, lapisMeta);
this.addBlock(world, 7, 23, 26, lapisBlock, lapisMeta);
this.addBlock(world, 7, 24, 24, stairBlock, 1);
this.addBlock(world, 7, 24, 26, stairBlock, 1);
this.addBlock(world, 8, 10, 25, stairBlock, 4);
this.addBlock(world, 8, 11, 25, mainBlock, secMeta);
this.addBlock(world, 8, 12, 24, stairBlock, 4);
this.addBlock(world, 8, 12, 25, mainBlock, secMeta);
this.addBlock(world, 8, 12, 26, stairBlock, 4);
this.addBlock(world, 8, 13, 24, mainBlock, mainMeta);
this.addBlock(world, 8, 13, 25, mainBlock, mainMeta);
this.addBlock(world, 8, 13, 26, mainBlock, mainMeta);
this.addBlock(world, 8, 14, 24, mainBlock, mainMeta);
this.addBlock(world, 8, 14, 25, stairBlock, 0);
this.addBlock(world, 8, 14, 26, mainBlock, mainMeta);
this.addBlock(world, 8, 15, 24, mainBlock, mainMeta);
this.addBlock(world, 8, 15, 25, windowBlock, 0);
this.addBlock(world, 8, 15, 26, mainBlock, mainMeta);
this.addBlock(world, 8, 16, 24, mainBlock, mainMeta);
this.addBlock(world, 8, 16, 25, windowBlock, 0);
this.addBlock(world, 8, 16, 26, mainBlock, mainMeta);
this.addBlock(world, 8, 17, 24, mainBlock, mainMeta);
this.addBlock(world, 8, 17, 25, windowBlock, 0);
this.addBlock(world, 8, 17, 26, mainBlock, mainMeta);
this.addBlock(world, 8, 18, 24, stairBlock, 0);
this.addBlock(world, 8, 18, 25, stairBlock, 4);
this.addBlock(world, 8, 18, 26, stairBlock, 0);
this.addBlock(world, 8, 19, 25, stairBlock, 0);
this.addBlock(world, 8, 21, 24, stairBlock, 4);
this.addBlock(world, 8, 21, 26, stairBlock, 4);
this.addBlock(world, 8, 22, 24, lapisBlock, lapisMeta);
this.addBlock(world, 8, 22, 26, lapisBlock, lapisMeta);
this.addBlock(world, 8, 23, 24, stairBlock, 1);
this.addBlock(world, 8, 23, 26, stairBlock, 1);
this.addBlock(world, 9, 8, 25, stairBlock, 4);
this.addBlock(world, 9, 9, 24, slabBlock, 8 + slabMeta);
this.addBlock(world, 9, 9, 25, lapisBlock, lapisMeta);
this.addBlock(world, 9, 9, 26, slabBlock, 8 + slabMeta);
this.addBlock(world, 9, 10, 24, mainBlock, secMeta);
this.addBlock(world, 9, 10, 26, mainBlock, secMeta);
this.addBlock(world, 9, 11, 24, mainBlock, secMeta);
this.addBlock(world, 9, 11, 26, mainBlock, secMeta);
this.addBlock(world, 9, 12, 23, stairBlock, 6);
this.addBlock(world, 9, 12, 24, mainBlock, secMeta);
this.addBlock(world, 9, 12, 26, mainBlock, secMeta);
this.addBlock(world, 9, 12, 27, stairBlock, 7);
this.addBlock(world, 9, 13, 23, mainBlock, mainMeta);
this.addBlock(world, 9, 13, 24, mainBlock, mainMeta);
this.addBlock(world, 9, 13, 25, mainBlock, mainMeta);
this.addBlock(world, 9, 13, 26, mainBlock, mainMeta);
this.addBlock(world, 9, 13, 27, mainBlock, mainMeta);
this.addBlock(world, 9, 14, 23, mainBlock, mainMeta);
this.addBlock(world, 9, 14, 27, mainBlock, mainMeta);
this.addBlock(world, 9, 15, 23, mainBlock, mainMeta);
this.addBlock(world, 9, 15, 27, mainBlock, mainMeta);
this.addBlock(world, 9, 16, 23, mainBlock, mainMeta);
this.addBlock(world, 9, 16, 27, mainBlock, mainMeta);
this.addBlock(world, 9, 17, 23, mainBlock, mainMeta);
this.addBlock(world, 9, 17, 27, mainBlock, mainMeta);
this.addBlock(world, 9, 18, 23, stairBlock, 2);
this.addBlock(world, 9, 18, 24, stairBlock, 5);
this.addBlock(world, 9, 18, 26, stairBlock, 5);
this.addBlock(world, 9, 18, 27, stairBlock, 3);
this.addBlock(world, 9, 19, 24, mainBlock, secMeta);
this.addBlock(world, 9, 19, 25, mainBlock, secMeta);
this.addBlock(world, 9, 19, 26, mainBlock, secMeta);
this.addBlock(world, 9, 20, 24, stairBlock, 4);
this.addBlock(world, 9, 20, 25, stairBlock, 0);
this.addBlock(world, 9, 20, 26, stairBlock, 4);
this.addBlock(world, 9, 21, 24, lapisBlock, lapisMeta);
this.addBlock(world, 9, 21, 26, lapisBlock, lapisMeta);
this.addBlock(world, 9, 22, 24, stairBlock, 1);
this.addBlock(world, 9, 22, 26, stairBlock, 1);
this.addBlock(world, 10, 4, 25, wallBlock, 0);
this.addBlock(world, 10, 5, 25, wallBlock, 0);
this.addBlock(world, 10, 6, 25, wallBlock, 0);
this.addBlock(world, 10, 7, 25, wallBlock, 0);
this.addBlock(world, 10, 8, 24, stairBlock, 6);
this.addBlock(world, 10, 8, 25, lightBlock, 0);
this.addBlock(world, 10, 8, 26, stairBlock, 7);
this.addBlock(world, 10, 9, 24, lapisBlock, lapisMeta);
this.addBlock(world, 10, 9, 26, lapisBlock, lapisMeta);
this.addBlock(world, 10, 10, 23, stairBlock, 6);
this.addBlock(world, 10, 10, 27, stairBlock, 7);
this.addBlock(world, 10, 11, 23, mainBlock, secMeta);
this.addBlock(world, 10, 11, 27, mainBlock, secMeta);
this.addBlock(world, 10, 12, 23, mainBlock, secMeta);
this.addBlock(world, 10, 12, 27, mainBlock, secMeta);
this.addBlock(world, 10, 13, 21, mainBlock, mainMeta);
this.addBlock(world, 10, 13, 22, mainBlock, mainMeta);
this.addBlock(world, 10, 13, 23, mainBlock, mainMeta);
this.addBlock(world, 10, 13, 24, mainBlock, mainMeta);
// this.addBlock(world, 10, 13, 25, mainBlock, mainMeta);
this.addBlock(world, 10, 13, 26, mainBlock, mainMeta);
this.addBlock(world, 10, 13, 27, mainBlock, mainMeta);
this.addBlock(world, 10, 13, 28, mainBlock, mainMeta);
this.addBlock(world, 10, 13, 29, mainBlock, mainMeta);
this.addBlock(world, 10, 14, 21, cannonBlock, 0);
this.addBlock(world, 10, 14, 23, stairBlock, 2);
this.addBlock(world, 10, 14, 27, stairBlock, 3);
this.addBlock(world, 10, 14, 29, cannonBlock, 0);
this.addBlock(world, 10, 15, 23, windowBlock, 0);
this.addBlock(world, 10, 15, 27, windowBlock, 0);
this.addBlock(world, 10, 16, 23, windowBlock, 0);
this.addBlock(world, 10, 16, 27, windowBlock, 0);
this.addBlock(world, 10, 17, 23, windowBlock, 0);
this.addBlock(world, 10, 17, 27, windowBlock, 0);
this.addBlock(world, 10, 18, 23, mainBlock, mainMeta);
this.addBlock(world, 10, 18, 27, stairBlock, 7);
this.addBlock(world, 10, 19, 23, stairBlock, 2);
this.addBlock(world, 10, 19, 24, mainBlock, secMeta);
this.addBlock(world, 10, 19, 25, wallBlock, 0);
this.addBlock(world, 10, 19, 26, mainBlock, secMeta);
this.addBlock(world, 10, 19, 27, stairBlock, 3);
this.addBlock(world, 10, 20, 24, lapisBlock, lapisMeta);
this.addBlock(world, 10, 20, 25, lightBlock, 0);
this.addBlock(world, 10, 20, 26, lapisBlock, lapisMeta);
this.addBlock(world, 10, 21, 24, stairBlock, 1);
this.addBlock(world, 10, 21, 25, slabBlock, slabMeta);
this.addBlock(world, 10, 21, 26, stairBlock, 1);
this.addBlock(world, 11, 8, 25, stairBlock, 5);
this.addBlock(world, 11, 9, 24, slabBlock, 8 + slabMeta);
this.addBlock(world, 11, 9, 25, lapisBlock, lapisMeta);
this.addBlock(world, 11, 9, 26, slabBlock, 8 + slabMeta);
this.addBlock(world, 11, 10, 24, mainBlock, secMeta);
this.addBlock(world, 11, 10, 26, mainBlock, secMeta);
this.addBlock(world, 11, 11, 24, mainBlock, secMeta);
this.addBlock(world, 11, 11, 26, mainBlock, secMeta);
this.addBlock(world, 11, 12, 23, stairBlock, 6);
this.addBlock(world, 11, 12, 24, mainBlock, secMeta);
this.addBlock(world, 11, 12, 26, mainBlock, secMeta);
this.addBlock(world, 11, 12, 27, stairBlock, 7);
this.addBlock(world, 11, 13, 23, mainBlock, mainMeta);
this.addBlock(world, 11, 13, 24, mainBlock, mainMeta);
this.addBlock(world, 11, 13, 25, mainBlock, mainMeta);
this.addBlock(world, 11, 13, 26, mainBlock, mainMeta);
this.addBlock(world, 11, 13, 27, mainBlock, mainMeta);
this.addBlock(world, 11, 14, 23, mainBlock, mainMeta);
this.addBlock(world, 11, 14, 27, mainBlock, mainMeta);
this.addBlock(world, 11, 15, 23, mainBlock, mainMeta);
this.addBlock(world, 11, 15, 27, mainBlock, mainMeta);
this.addBlock(world, 11, 16, 23, mainBlock, mainMeta);
this.addBlock(world, 11, 16, 27, mainBlock, mainMeta);
this.addBlock(world, 11, 17, 23, mainBlock, mainMeta);
this.addBlock(world, 11, 17, 27, mainBlock, mainMeta);
this.addBlock(world, 11, 18, 23, stairBlock, 2);
this.addBlock(world, 11, 18, 24, stairBlock, 4);
this.addBlock(world, 11, 18, 26, stairBlock, 4);
this.addBlock(world, 11, 18, 27, stairBlock, 3);
this.addBlock(world, 11, 19, 24, mainBlock, secMeta);
this.addBlock(world, 11, 19, 25, mainBlock, secMeta);
this.addBlock(world, 11, 19, 26, mainBlock, secMeta);
this.addBlock(world, 11, 20, 24, stairBlock, 1);
this.addBlock(world, 11, 20, 25, stairBlock, 1);
this.addBlock(world, 11, 20, 26, stairBlock, 1);
this.addBlock(world, 12, 10, 25, stairBlock, 5);
this.addBlock(world, 12, 11, 25, mainBlock, secMeta);
this.addBlock(world, 12, 12, 24, stairBlock, 5);
this.addBlock(world, 12, 12, 25, mainBlock, secMeta);
this.addBlock(world, 12, 12, 26, stairBlock, 5);
this.addBlock(world, 12, 13, 24, mainBlock, mainMeta);
this.addBlock(world, 12, 13, 25, mainBlock, mainMeta);
this.addBlock(world, 12, 13, 26, mainBlock, mainMeta);
this.addBlock(world, 12, 14, 24, mainBlock, mainMeta);
this.addBlock(world, 12, 14, 26, mainBlock, mainMeta);
this.addBlock(world, 12, 15, 24, mainBlock, mainMeta);
this.addBlock(world, 12, 15, 26, mainBlock, mainMeta);
this.addBlock(world, 12, 16, 24, mainBlock, mainMeta);
this.addBlock(world, 12, 16, 26, mainBlock, mainMeta);
this.addBlock(world, 12, 17, 24, mainBlock, mainMeta);
this.addBlock(world, 12, 17, 26, mainBlock, mainMeta);
this.addBlock(world, 12, 18, 24, lapisBlock, lapisMeta);
this.addBlock(world, 12, 18, 25, stairBlock, 5);
this.addBlock(world, 12, 18, 26, lapisBlock, lapisMeta);
this.addBlock(world, 12, 19, 24, stairBlock, 1);
this.addBlock(world, 12, 19, 25, stairBlock, 1);
this.addBlock(world, 12, 19, 26, stairBlock, 1);
this.addBlock(world, 13, 12, 25, slabBlock, 8 + slabMeta);
this.addBlock(world, 13, 13, 24, stairBlock, 6);
this.addBlock(world, 13, 13, 25, mainBlock, mainMeta);
this.addBlock(world, 13, 13, 26, stairBlock, 7);
this.addBlock(world, 13, 14, 24, wallBlock, 0);
this.addBlock(world, 13, 14, 26, wallBlock, 0);
this.addBlock(world, 13, 16, 24, stairBlock, 4);
this.addBlock(world, 13, 16, 26, stairBlock, 4);
this.addBlock(world, 13, 17, 24, lapisBlock, lapisMeta);
this.addBlock(world, 13, 17, 26, lapisBlock, lapisMeta);
this.addBlock(world, 13, 18, 24, stairBlock, 1);
this.addBlock(world, 13, 18, 26, stairBlock, 1);
this.addBlock(world, 14, 12, 25, slabBlock, 8 + slabMeta);
this.addBlock(world, 14, 13, 24, stairBlock, 6);
this.addBlock(world, 14, 13, 25, mainBlock, mainMeta);
this.addBlock(world, 14, 13, 26, stairBlock, 7);
this.addBlock(world, 14, 14, 24, wallBlock, 0);
this.addBlock(world, 14, 14, 26, wallBlock, 0);
this.addBlock(world, 14, 15, 24, wallBlock, 0);
this.addBlock(world, 14, 15, 26, wallBlock, 0);
this.addBlock(world, 14, 16, 24, lapisBlock, lapisMeta);
this.addBlock(world, 14, 16, 26, lapisBlock, lapisMeta);
this.addBlock(world, 14, 17, 24, stairBlock, 1);
this.addBlock(world, 14, 17, 26, stairBlock, 1);
this.addBlock(world, 15, 12, 25, slabBlock, 8 + slabMeta);
this.addBlock(world, 15, 13, 24, stairBlock, 6);
this.addBlock(world, 15, 13, 25, mainBlock, mainMeta);
this.addBlock(world, 15, 13, 26, stairBlock, 7);
this.addBlock(world, 15, 14, 24, wallBlock, 0);
this.addBlock(world, 15, 14, 26, wallBlock, 0);
this.addBlock(world, 15, 15, 24, lapisBlock, lapisMeta);
this.addBlock(world, 15, 15, 26, lapisBlock, lapisMeta);
this.addBlock(world, 15, 16, 24, stairBlock, 1);
this.addBlock(world, 15, 16, 26, stairBlock, 1);
this.addBlock(world, 16, 12, 25, slabBlock, 8 + slabMeta);
this.addBlock(world, 16, 13, 24, stairBlock, 4);
this.addBlock(world, 16, 13, 25, mainBlock, mainMeta);
this.addBlock(world, 16, 13, 26, stairBlock, 4);
this.addBlock(world, 16, 14, 24, lapisBlock, lapisMeta);
this.addBlock(world, 16, 14, 26, lapisBlock, lapisMeta);
this.addBlock(world, 16, 15, 24, stairBlock, 1);
this.addBlock(world, 16, 15, 26, stairBlock, 1);
this.addBlock(world, 17, 12, 24, stairBlock, 4);
this.addBlock(world, 17, 12, 25, slabBlock, 8 + slabMeta);
this.addBlock(world, 17, 12, 26, stairBlock, 4);
this.addBlock(world, 17, 13, 24, mainBlock, mainMeta);
this.addBlock(world, 17, 13, 25, mainBlock, mainMeta);
this.addBlock(world, 17, 13, 26, mainBlock, mainMeta);
this.addBlock(world, 17, 14, 24, stairBlock, 1);
this.addBlock(world, 17, 14, 26, stairBlock, 1);
this.addBlock(world, 18, 11, 24, slabBlock, 8 + slabMeta);
this.addBlock(world, 18, 11, 26, slabBlock, 8 + slabMeta);
this.addBlock(world, 18, 12, 24, mainBlock, mainMeta);
this.addBlock(world, 18, 12, 25, slabBlock, 8 + slabMeta);
this.addBlock(world, 18, 12, 26, mainBlock, mainMeta);
this.addBlock(world, 18, 13, 23, stairBlock, 4);
this.addBlock(world, 18, 13, 24, mainBlock, mainMeta);
this.addBlock(world, 18, 13, 25, mainBlock, mainMeta);
this.addBlock(world, 18, 13, 26, mainBlock, mainMeta);
this.addBlock(world, 18, 13, 27, stairBlock, 4);
this.addBlock(world, 18, 14, 23, wallBlock, 0);
this.addBlock(world, 18, 14, 27, wallBlock, 0);
this.addBlock(world, 19, 12, 24, stairBlock, 5);
this.addBlock(world, 19, 12, 25, slabBlock, 8 + slabMeta);
this.addBlock(world, 19, 12, 26, stairBlock, 5);
this.addBlock(world, 19, 13, 23, mainBlock, mainMeta);
this.addBlock(world, 19, 13, 24, mainBlock, mainMeta);
this.addBlock(world, 19, 13, 25, mainBlock, mainMeta);
this.addBlock(world, 19, 13, 26, mainBlock, mainMeta);
this.addBlock(world, 19, 13, 27, mainBlock, mainMeta);
this.addBlock(world, 19, 14, 21, wallBlock, 0);
this.addBlock(world, 19, 14, 22, wallBlock, 0);
this.addBlock(world, 19, 14, 23, mainBlock, mainMeta);
this.addBlock(world, 19, 14, 27, mainBlock, mainMeta);
this.addBlock(world, 19, 14, 28, wallBlock, 0);
this.addBlock(world, 19, 14, 29, wallBlock, 0);
this.addBlock(world, 19, 15, 23, mainBlock, mainMeta);
this.addBlock(world, 19, 15, 27, mainBlock, mainMeta);
this.addBlock(world, 19, 16, 23, stairBlock, 2);
this.addBlock(world, 19, 16, 24, stairBlock, 7);
this.addBlock(world, 19, 16, 26, stairBlock, 6);
this.addBlock(world, 19, 16, 27, stairBlock, 3);
this.addBlock(world, 19, 17, 24, cannonBlock, 0);
this.addBlock(world, 19, 17, 26, cannonBlock, 0);
this.addBlock(world, 20, 12, 25, slabBlock, 8 + slabMeta);
this.addBlock(world, 20, 13, 22, mainBlock, mainMeta);
this.addBlock(world, 20, 13, 23, mainBlock, mainMeta);
this.addBlock(world, 20, 13, 24, mainBlock, mainMeta);
this.addBlock(world, 20, 13, 25, mainBlock, mainMeta);
this.addBlock(world, 20, 13, 26, mainBlock, mainMeta);
this.addBlock(world, 20, 13, 27, mainBlock, mainMeta);
this.addBlock(world, 20, 13, 28, mainBlock, mainMeta);
this.addBlock(world, 20, 14, 20, wallBlock, 0);
this.addBlock(world, 20, 14, 21, wallBlock, 0);
this.addBlock(world, 20, 14, 23, stairBlock, 1);
this.addBlock(world, 20, 14, 27, stairBlock, 1);
this.addBlock(world, 20, 14, 29, wallBlock, 0);
this.addBlock(world, 20, 14, 30, wallBlock, 0);
this.addBlock(world, 21, 12, 24, stairBlock, 4);
this.addBlock(world, 21, 12, 25, slabBlock, 8 + slabMeta);
this.addBlock(world, 21, 12, 26, stairBlock, 4);
this.addBlock(world, 21, 13, 10, mainBlock, mainMeta);
this.addBlock(world, 21, 13, 21, mainBlock, mainMeta);
this.addBlock(world, 21, 13, 22, mainBlock, mainMeta);
this.addBlock(world, 21, 13, 23, mainBlock, mainMeta);
this.addBlock(world, 21, 13, 24, mainBlock, mainMeta);
this.addBlock(world, 21, 13, 25, stairBlock, 1);
this.addBlock(world, 21, 13, 26, mainBlock, mainMeta);
this.addBlock(world, 21, 13, 27, mainBlock, mainMeta);
this.addBlock(world, 21, 13, 28, mainBlock, mainMeta);
this.addBlock(world, 21, 13, 29, mainBlock, mainMeta);
this.addBlock(world, 21, 13, 40, mainBlock, mainMeta);
this.addBlock(world, 21, 14, 10, cannonBlock, 0);
this.addBlock(world, 21, 14, 19, wallBlock, 0);
this.addBlock(world, 21, 14, 20, wallBlock, 0);
this.addBlock(world, 21, 14, 30, wallBlock, 0);
this.addBlock(world, 21, 14, 31, wallBlock, 0);
this.addBlock(world, 21, 14, 40, cannonBlock, 0);
this.addBlock(world, 22, 12, 23, stairBlock, 4);
this.addBlock(world, 22, 12, 24, mainBlock, mainMeta);
this.addBlock(world, 22, 12, 25, mainBlock, mainMeta);
this.addBlock(world, 22, 12, 26, mainBlock, mainMeta);
this.addBlock(world, 22, 12, 27, stairBlock, 4);
this.addBlock(world, 22, 13, 10, mainBlock, mainMeta);
this.addBlock(world, 22, 13, 20, mainBlock, mainMeta);
this.addBlock(world, 22, 13, 21, mainBlock, mainMeta);
this.addBlock(world, 22, 13, 22, mainBlock, mainMeta);
this.addBlock(world, 22, 13, 23, mainBlock, mainMeta);
this.addBlock(world, 22, 13, 24, stairBlock, 3);
this.addBlock(world, 22, 13, 25, accentBlock, 0);
this.addBlock(world, 22, 13, 26, stairBlock, 2);
this.addBlock(world, 22, 13, 27, mainBlock, mainMeta);
this.addBlock(world, 22, 13, 28, mainBlock, mainMeta);
this.addBlock(world, 22, 13, 29, mainBlock, mainMeta);
this.addBlock(world, 22, 13, 30, mainBlock, mainMeta);
this.addBlock(world, 22, 13, 40, mainBlock, mainMeta);
this.addBlock(world, 22, 14, 19, wallBlock, 0);
this.addBlock(world, 22, 14, 31, wallBlock, 0);
this.addBlock(world, 23, 8, 23, mainBlock, mainMeta);
this.addBlock(world, 23, 8, 24, stairBlock, 4);
this.addBlock(world, 23, 8, 25, stairBlock, 4);
this.addBlock(world, 23, 8, 26, stairBlock, 4);
this.addBlock(world, 23, 8, 27, mainBlock, mainMeta);
this.addBlock(world, 23, 9, 23, wallBlock, 0);
this.addBlock(world, 23, 9, 25, cannonBlock, 0);
this.addBlock(world, 23, 9, 27, wallBlock, 0);
this.addBlock(world, 23, 10, 10, stairBlock, 4);
this.addBlock(world, 23, 10, 23, wallBlock, 0);
this.addBlock(world, 23, 10, 27, wallBlock, 0);
this.addBlock(world, 23, 10, 40, stairBlock, 4);
this.addBlock(world, 23, 11, 10, mainBlock, secMeta);
this.addBlock(world, 23, 11, 23, wallBlock, 0);
this.addBlock(world, 23, 11, 27, wallBlock, 0);
this.addBlock(world, 23, 11, 40, mainBlock, secMeta);
this.addBlock(world, 23, 12, 9, stairBlock, 4);
this.addBlock(world, 23, 12, 10, mainBlock, secMeta);
this.addBlock(world, 23, 12, 11, stairBlock, 4);
this.addBlock(world, 23, 12, 22, stairBlock, 6);
this.addBlock(world, 23, 12, 23, mainBlock, mainMeta);
this.addBlock(world, 23, 12, 27, mainBlock, mainMeta);
this.addBlock(world, 23, 12, 28, stairBlock, 7);
this.addBlock(world, 23, 12, 39, stairBlock, 4);
this.addBlock(world, 23, 12, 40, mainBlock, secMeta);
this.addBlock(world, 23, 12, 41, stairBlock, 4);
this.addBlock(world, 23, 13, 9, mainBlock, mainMeta);
this.addBlock(world, 23, 13, 10, mainBlock, mainMeta);
this.addBlock(world, 23, 13, 11, mainBlock, mainMeta);
this.addBlock(world, 23, 13, 18, stairBlock, 6);
this.addBlock(world, 23, 13, 19, mainBlock, mainMeta);
this.addBlock(world, 23, 13, 20, mainBlock, mainMeta);
this.addBlock(world, 23, 13, 21, mainBlock, mainMeta);
this.addBlock(world, 23, 13, 22, mainBlock, mainMeta);
this.addBlock(world, 23, 13, 23, mainBlock, secMeta);
this.addBlock(world, 23, 13, 24, mainBlock, mainMeta);
this.addBlock(world, 23, 13, 25, stairBlock, 0);
this.addBlock(world, 23, 13, 26, mainBlock, mainMeta);
this.addBlock(world, 23, 13, 27, mainBlock, secMeta);
this.addBlock(world, 23, 13, 28, mainBlock, mainMeta);
this.addBlock(world, 23, 13, 29, mainBlock, mainMeta);
this.addBlock(world, 23, 13, 30, mainBlock, mainMeta);
this.addBlock(world, 23, 13, 31, mainBlock, mainMeta);
this.addBlock(world, 23, 13, 32, stairBlock, 7);
this.addBlock(world, 23, 13, 39, mainBlock, mainMeta);
this.addBlock(world, 23, 13, 40, mainBlock, mainMeta);
this.addBlock(world, 23, 13, 41, mainBlock, mainMeta);
this.addBlock(world, 23, 14, 9, mainBlock, mainMeta);
this.addBlock(world, 23, 14, 10, stairBlock, 0);
this.addBlock(world, 23, 14, 11, mainBlock, mainMeta);
this.addBlock(world, 23, 14, 18, wallBlock, 0);
this.addBlock(world, 23, 14, 19, mainBlock, mainMeta);
this.addBlock(world, 23, 14, 20, stairBlock, 3);
this.addBlock(world, 23, 14, 30, stairBlock, 2);
this.addBlock(world, 23, 14, 31, mainBlock, mainMeta);
this.addBlock(world, 23, 14, 32, wallBlock, 0);
this.addBlock(world, 23, 14, 39, mainBlock, mainMeta);
this.addBlock(world, 23, 14, 40, stairBlock, 0);
this.addBlock(world, 23, 14, 41, mainBlock, mainMeta);
this.addBlock(world, 23, 15, 9, mainBlock, mainMeta);
this.addBlock(world, 23, 15, 10, windowBlock, 0);
this.addBlock(world, 23, 15, 11, mainBlock, mainMeta);
this.addBlock(world, 23, 15, 19, mainBlock, mainMeta);
this.addBlock(world, 23, 15, 31, mainBlock, mainMeta);
this.addBlock(world, 23, 15, 39, mainBlock, mainMeta);
this.addBlock(world, 23, 15, 40, windowBlock, 0);
this.addBlock(world, 23, 15, 41, mainBlock, mainMeta);
this.addBlock(world, 23, 16, 9, mainBlock, mainMeta);
this.addBlock(world, 23, 16, 10, windowBlock, 0);
this.addBlock(world, 23, 16, 11, mainBlock, mainMeta);
this.addBlock(world, 23, 16, 19, stairBlock, 0);
this.addBlock(world, 23, 16, 31, stairBlock, 0);
this.addBlock(world, 23, 16, 39, mainBlock, mainMeta);
this.addBlock(world, 23, 16, 40, windowBlock, 0);
this.addBlock(world, 23, 16, 41, mainBlock, mainMeta);
this.addBlock(world, 23, 17, 9, mainBlock, mainMeta);
this.addBlock(world, 23, 17, 10, windowBlock, 0);
this.addBlock(world, 23, 17, 11, mainBlock, mainMeta);
this.addBlock(world, 23, 17, 39, mainBlock, mainMeta);
this.addBlock(world, 23, 17, 40, windowBlock, 0);
this.addBlock(world, 23, 17, 41, mainBlock, mainMeta);
this.addBlock(world, 23, 18, 9, stairBlock, 0);
this.addBlock(world, 23, 18, 10, stairBlock, 4);
this.addBlock(world, 23, 18, 11, stairBlock, 0);
this.addBlock(world, 23, 18, 39, stairBlock, 0);
this.addBlock(world, 23, 18, 40, mainBlock, mainMeta);
this.addBlock(world, 23, 18, 41, stairBlock, 0);
this.addBlock(world, 23, 19, 10, stairBlock, 0);
this.addBlock(world, 23, 19, 40, stairBlock, 0);
this.addBlock(world, 24, 1, 25, wallBlock, 0);
this.addBlock(world, 24, 7, 24, stairBlock, 4);
this.addBlock(world, 24, 7, 25, stairBlock, 4);
this.addBlock(world, 24, 7, 26, stairBlock, 7);
this.addBlock(world, 24, 8, 10, stairBlock, 4);
this.addBlock(world, 24, 8, 23, stairBlock, 6);
this.addBlock(world, 24, 8, 24, mainBlock, mainMeta);
this.addBlock(world, 24, 8, 25, mainBlock, mainMeta);
this.addBlock(world, 24, 8, 26, mainBlock, mainMeta);
this.addBlock(world, 24, 8, 27, stairBlock, 7);
this.addBlock(world, 24, 8, 40, stairBlock, 4);
this.addBlock(world, 24, 9, 9, slabBlock, 8 + slabMeta);
this.addBlock(world, 24, 9, 10, lapisBlock, lapisMeta);
this.addBlock(world, 24, 9, 11, slabBlock, 8 + slabMeta);
this.addBlock(world, 24, 9, 39, slabBlock, 8 + slabMeta);
this.addBlock(world, 24, 9, 40, lapisBlock, lapisMeta);
this.addBlock(world, 24, 9, 41, slabBlock, 8 + slabMeta);
this.addBlock(world, 24, 10, 9, mainBlock, secMeta);
this.addBlock(world, 24, 10, 11, mainBlock, secMeta);
this.addBlock(world, 24, 10, 39, mainBlock, secMeta);
this.addBlock(world, 24, 10, 41, mainBlock, secMeta);
this.addBlock(world, 24, 11, 9, mainBlock, secMeta);
this.addBlock(world, 24, 11, 11, mainBlock, secMeta);
this.addBlock(world, 24, 11, 18, slabBlock, 8 + slabMeta);
this.addBlock(world, 24, 11, 32, slabBlock, 8 + slabMeta);
this.addBlock(world, 24, 11, 39, mainBlock, secMeta);
this.addBlock(world, 24, 11, 41, mainBlock, secMeta);
this.addBlock(world, 24, 12, 8, stairBlock, 6);
this.addBlock(world, 24, 12, 9, mainBlock, secMeta);
this.addBlock(world, 24, 12, 11, mainBlock, secMeta);
this.addBlock(world, 24, 12, 12, stairBlock, 7);
this.addBlock(world, 24, 12, 17, stairBlock, 6);
this.addBlock(world, 24, 12, 18, mainBlock, mainMeta);
this.addBlock(world, 24, 12, 19, stairBlock, 7);
this.addBlock(world, 24, 12, 21, stairBlock, 6);
this.addBlock(world, 24, 12, 22, mainBlock, mainMeta);
this.addBlock(world, 24, 12, 28, mainBlock, mainMeta);
this.addBlock(world, 24, 12, 29, stairBlock, 7);
this.addBlock(world, 24, 12, 31, stairBlock, 6);
this.addBlock(world, 24, 12, 32, mainBlock, mainMeta);
this.addBlock(world, 24, 12, 33, stairBlock, 7);
this.addBlock(world, 24, 12, 38, stairBlock, 6);
this.addBlock(world, 24, 12, 39, mainBlock, secMeta);
this.addBlock(world, 24, 12, 41, mainBlock, secMeta);
this.addBlock(world, 24, 12, 42, stairBlock, 7);
this.addBlock(world, 24, 13, 8, mainBlock, mainMeta);
this.addBlock(world, 24, 13, 9, mainBlock, mainMeta);
this.addBlock(world, 24, 13, 10, mainBlock, mainMeta);
this.addBlock(world, 24, 13, 11, mainBlock, mainMeta);
this.addBlock(world, 24, 13, 12, mainBlock, mainMeta);
this.addBlock(world, 24, 13, 13, stairBlock, 4);
this.addBlock(world, 24, 13, 14, stairBlock, 4);
this.addBlock(world, 24, 13, 15, stairBlock, 4);
this.addBlock(world, 24, 13, 16, stairBlock, 6);
this.addBlock(world, 24, 13, 17, mainBlock, mainMeta);
this.addBlock(world, 24, 13, 18, mainBlock, mainMeta);
this.addBlock(world, 24, 13, 19, mainBlock, mainMeta);
this.addBlock(world, 24, 13, 20, mainBlock, mainMeta);
this.addBlock(world, 24, 13, 21, mainBlock, mainMeta);
this.addBlock(world, 24, 13, 22, stairBlock, 1);
this.addBlock(world, 24, 13, 23, mainBlock, mainMeta);
this.addBlock(world, 24, 13, 24, mainBlock, mainMeta);
this.addBlock(world, 24, 13, 25, lapisBlock, lapisMeta);
this.addBlock(world, 24, 13, 26, mainBlock, mainMeta);
this.addBlock(world, 24, 13, 27, mainBlock, mainMeta);
this.addBlock(world, 24, 13, 28, stairBlock, 1);
this.addBlock(world, 24, 13, 29, mainBlock, mainMeta);
this.addBlock(world, 24, 13, 30, mainBlock, mainMeta);
this.addBlock(world, 24, 13, 31, mainBlock, mainMeta);
this.addBlock(world, 24, 13, 32, mainBlock, mainMeta);
this.addBlock(world, 24, 13, 33, mainBlock, mainMeta);
this.addBlock(world, 24, 13, 34, stairBlock, 7);
this.addBlock(world, 24, 13, 35, stairBlock, 4);
this.addBlock(world, 24, 13, 36, stairBlock, 4);
this.addBlock(world, 24, 13, 37, stairBlock, 4);
this.addBlock(world, 24, 13, 38, mainBlock, mainMeta);
this.addBlock(world, 24, 13, 39, mainBlock, mainMeta);
this.addBlock(world, 24, 13, 40, mainBlock, mainMeta);
this.addBlock(world, 24, 13, 41, mainBlock, mainMeta);
this.addBlock(world, 24, 13, 42, mainBlock, mainMeta);
this.addBlock(world, 24, 14, 8, mainBlock, mainMeta);
this.addBlock(world, 24, 14, 12, mainBlock, mainMeta);
this.addBlock(world, 24, 14, 13, wallBlock, 0);
this.addBlock(world, 24, 14, 14, wallBlock, 0);
this.addBlock(world, 24, 14, 15, wallBlock, 0);
this.addBlock(world, 24, 14, 16, lapisBlock, lapisMeta);
this.addBlock(world, 24, 14, 17, stairBlock, 3);
this.addBlock(world, 24, 14, 24, wallBlock, 0);
this.addBlock(world, 24, 14, 26, wallBlock, 0);
this.addBlock(world, 24, 14, 33, stairBlock, 2);
this.addBlock(world, 24, 14, 34, lapisBlock, lapisMeta);
this.addBlock(world, 24, 14, 35, wallBlock, 0);
this.addBlock(world, 24, 14, 36, wallBlock, 0);
this.addBlock(world, 24, 14, 37, wallBlock, 0);
this.addBlock(world, 24, 14, 38, mainBlock, mainMeta);
this.addBlock(world, 24, 14, 42, mainBlock, mainMeta);
this.addBlock(world, 24, 15, 8, mainBlock, mainMeta);
this.addBlock(world, 24, 15, 12, mainBlock, mainMeta);
this.addBlock(world, 24, 15, 14, wallBlock, 0);
this.addBlock(world, 24, 15, 15, lapisBlock, lapisMeta);
this.addBlock(world, 24, 15, 16, stairBlock, 3);
this.addBlock(world, 24, 15, 24, wallBlock, 0);
this.addBlock(world, 24, 15, 26, wallBlock, 0);
this.addBlock(world, 24, 15, 34, stairBlock, 2);
this.addBlock(world, 24, 15, 35, lapisBlock, lapisMeta);
this.addBlock(world, 24, 15, 36, wallBlock, 0);
this.addBlock(world, 24, 15, 38, mainBlock, mainMeta);
this.addBlock(world, 24, 15, 42, mainBlock, mainMeta);
this.addBlock(world, 24, 16, 8, mainBlock, mainMeta);
this.addBlock(world, 24, 16, 12, mainBlock, mainMeta);
this.addBlock(world, 24, 16, 13, stairBlock, 6);
this.addBlock(world, 24, 16, 14, lapisBlock, lapisMeta);
this.addBlock(world, 24, 16, 15, stairBlock, 3);
this.addBlock(world, 24, 16, 19, stairBlock, 5);
this.addBlock(world, 24, 16, 24, stairBlock, 0);
this.addBlock(world, 24, 16, 25, stairBlock, 0);
this.addBlock(world, 24, 16, 26, stairBlock, 0);
this.addBlock(world, 24, 16, 31, stairBlock, 5);
this.addBlock(world, 24, 16, 35, stairBlock, 2);
this.addBlock(world, 24, 16, 36, lapisBlock, lapisMeta);
this.addBlock(world, 24, 16, 37, stairBlock, 7);
this.addBlock(world, 24, 16, 38, mainBlock, mainMeta);
this.addBlock(world, 24, 16, 42, mainBlock, mainMeta);
this.addBlock(world, 24, 17, 8, mainBlock, mainMeta);
this.addBlock(world, 24, 17, 12, mainBlock, mainMeta);
this.addBlock(world, 24, 17, 13, lapisBlock, lapisMeta);
this.addBlock(world, 24, 17, 14, stairBlock, 3);
this.addBlock(world, 24, 17, 19, cannonBlock, 0);
this.addBlock(world, 24, 17, 31, cannonBlock, 0);
this.addBlock(world, 24, 17, 36, stairBlock, 2);
this.addBlock(world, 24, 17, 37, lapisBlock, lapisMeta);
this.addBlock(world, 24, 17, 38, mainBlock, mainMeta);
this.addBlock(world, 24, 17, 42, mainBlock, mainMeta);
this.addBlock(world, 24, 18, 8, stairBlock, 2);
this.addBlock(world, 24, 18, 9, stairBlock, 7);
this.addBlock(world, 24, 18, 11, stairBlock, 6);
this.addBlock(world, 24, 18, 12, lapisBlock, lapisMeta);
this.addBlock(world, 24, 18, 13, stairBlock, 3);
this.addBlock(world, 24, 18, 37, stairBlock, 2);
this.addBlock(world, 24, 18, 38, lapisBlock, lapisMeta);
this.addBlock(world, 24, 18, 39, stairBlock, 7);
this.addBlock(world, 24, 18, 41, stairBlock, 6);
this.addBlock(world, 24, 18, 42, stairBlock, 3);
this.addBlock(world, 24, 19, 9, mainBlock, secMeta);
this.addBlock(world, 24, 19, 10, mainBlock, secMeta);
this.addBlock(world, 24, 19, 11, mainBlock, secMeta);
this.addBlock(world, 24, 19, 12, stairBlock, 3);
this.addBlock(world, 24, 19, 38, stairBlock, 2);
this.addBlock(world, 24, 19, 39, mainBlock, secMeta);
this.addBlock(world, 24, 19, 40, mainBlock, secMeta);
this.addBlock(world, 24, 19, 41, mainBlock, secMeta);
this.addBlock(world, 24, 20, 9, stairBlock, 6);
this.addBlock(world, 24, 20, 10, lapisBlock, lapisMeta);
this.addBlock(world, 24, 20, 11, stairBlock, 3);
this.addBlock(world, 24, 20, 39, stairBlock, 2);
this.addBlock(world, 24, 20, 40, lapisBlock, lapisMeta);
this.addBlock(world, 24, 20, 41, stairBlock, 7);
this.addBlock(world, 24, 21, 8, stairBlock, 6);
this.addBlock(world, 24, 21, 9, lapisBlock, lapisMeta);
this.addBlock(world, 24, 21, 10, stairBlock, 3);
this.addBlock(world, 24, 21, 40, stairBlock, 2);
this.addBlock(world, 24, 21, 41, lapisBlock, lapisMeta);
this.addBlock(world, 24, 21, 42, stairBlock, 7);
this.addBlock(world, 24, 22, 7, stairBlock, 6);
this.addBlock(world, 24, 22, 8, lapisBlock, lapisMeta);
this.addBlock(world, 24, 22, 9, stairBlock, 3);
this.addBlock(world, 24, 22, 41, stairBlock, 2);
this.addBlock(world, 24, 22, 42, lapisBlock, lapisMeta);
this.addBlock(world, 24, 22, 43, stairBlock, 7);
this.addBlock(world, 24, 23, 6, stairBlock, 6);
this.addBlock(world, 24, 23, 7, lapisBlock, lapisMeta);
this.addBlock(world, 24, 23, 8, stairBlock, 3);
this.addBlock(world, 24, 23, 42, stairBlock, 2);
this.addBlock(world, 24, 23, 43, lapisBlock, lapisMeta);
this.addBlock(world, 24, 23, 44, stairBlock, 7);
this.addBlock(world, 24, 24, 5, stairBlock, 6);
this.addBlock(world, 24, 24, 6, lapisBlock, lapisMeta);
this.addBlock(world, 24, 24, 7, stairBlock, 3);
this.addBlock(world, 24, 24, 43, stairBlock, 2);
this.addBlock(world, 24, 24, 44, lapisBlock, lapisMeta);
this.addBlock(world, 24, 24, 45, stairBlock, 7);
this.addBlock(world, 24, 25, 4, stairBlock, 6);
this.addBlock(world, 24, 25, 5, lapisBlock, lapisMeta);
this.addBlock(world, 24, 25, 6, stairBlock, 3);
this.addBlock(world, 24, 25, 44, stairBlock, 2);
this.addBlock(world, 24, 25, 45, lapisBlock, lapisMeta);
this.addBlock(world, 24, 25, 46, stairBlock, 7);
this.addBlock(world, 24, 26, 3, stairBlock, 6);
this.addBlock(world, 24, 26, 4, lapisBlock, lapisMeta);
this.addBlock(world, 24, 26, 5, stairBlock, 3);
this.addBlock(world, 24, 26, 45, stairBlock, 2);
this.addBlock(world, 24, 26, 46, lapisBlock, lapisMeta);
this.addBlock(world, 24, 26, 47, stairBlock, 7);
this.addBlock(world, 24, 27, 2, stairBlock, 6);
this.addBlock(world, 24, 27, 3, lapisBlock, lapisMeta);
this.addBlock(world, 24, 27, 4, stairBlock, 3);
this.addBlock(world, 24, 27, 46, stairBlock, 2);
this.addBlock(world, 24, 27, 47, lapisBlock, lapisMeta);
this.addBlock(world, 24, 27, 48, stairBlock, 7);
this.addBlock(world, 24, 28, 1, stairBlock, 6);
this.addBlock(world, 24, 28, 2, lapisBlock, lapisMeta);
this.addBlock(world, 24, 28, 3, stairBlock, 3);
this.addBlock(world, 24, 28, 47, stairBlock, 2);
this.addBlock(world, 24, 28, 48, lapisBlock, lapisMeta);
this.addBlock(world, 24, 28, 49, stairBlock, 7);
this.addBlock(world, 24, 29, 0, stairBlock, 6);
this.addBlock(world, 24, 29, 1, lapisBlock, lapisMeta);
this.addBlock(world, 24, 29, 2, stairBlock, 3);
this.addBlock(world, 24, 29, 48, stairBlock, 2);
this.addBlock(world, 24, 29, 49, lapisBlock, lapisMeta);
this.addBlock(world, 24, 29, 50, stairBlock, 7);
this.addBlock(world, 24, 30, 1, stairBlock, 3);
this.addBlock(world, 24, 30, 49, stairBlock, 2);
this.addBlock(world, 25, 0, 25, wallBlock, 0);
this.addBlock(world, 25, 1, 24, wallBlock, 0);
this.addBlock(world, 25, 1, 25, wallBlock, 0);
this.addBlock(world, 25, 1, 26, wallBlock, 0);
this.addBlock(world, 25, 2, 25, wallBlock, 0);
this.addBlock(world, 25, 3, 25, wallBlock, 0);
this.addBlock(world, 25, 4, 10, wallBlock, 0);
this.addBlock(world, 25, 4, 25, wallBlock, 0);
this.addBlock(world, 25, 4, 40, wallBlock, 0);
this.addBlock(world, 25, 5, 10, wallBlock, 0);
this.addBlock(world, 25, 5, 25, wallBlock, 0);
this.addBlock(world, 25, 5, 40, wallBlock, 0);
this.addBlock(world, 25, 6, 10, wallBlock, 0);
this.addBlock(world, 25, 6, 25, wallBlock, 0);
this.addBlock(world, 25, 6, 40, wallBlock, 0);
this.addBlock(world, 25, 7, 10, wallBlock, 0);
this.addBlock(world, 25, 7, 24, stairBlock, 6);
this.addBlock(world, 25, 7, 25, lightBlock, 0);
this.addBlock(world, 25, 7, 26, stairBlock, 7);
this.addBlock(world, 25, 7, 40, wallBlock, 0);
this.addBlock(world, 25, 8, 9, stairBlock, 6);
this.addBlock(world, 25, 8, 10, lightBlock, 0);
this.addBlock(world, 25, 8, 11, stairBlock, 7);
this.addBlock(world, 25, 8, 23, stairBlock, 6);
this.addBlock(world, 25, 8, 24, mainBlock, mainMeta);
this.addBlock(world, 25, 8, 25, mainBlock, mainMeta);
this.addBlock(world, 25, 8, 26, mainBlock, mainMeta);
this.addBlock(world, 25, 8, 27, stairBlock, 7);
this.addBlock(world, 25, 8, 39, stairBlock, 6);
this.addBlock(world, 25, 8, 40, lightBlock, 0);
this.addBlock(world, 25, 8, 41, stairBlock, 7);
this.addBlock(world, 25, 9, 9, lapisBlock, lapisMeta);
this.addBlock(world, 25, 9, 11, lapisBlock, lapisMeta);
this.addBlock(world, 25, 9, 23, cannonBlock, 0);
this.addBlock(world, 25, 9, 25, mainBlock, mainMeta);
this.addBlock(world, 25, 9, 27, cannonBlock, 0);
this.addBlock(world, 25, 9, 39, lapisBlock, lapisMeta);
this.addBlock(world, 25, 9, 41, lapisBlock, lapisMeta);
this.addBlock(world, 25, 10, 8, stairBlock, 6);
this.addBlock(world, 25, 10, 12, stairBlock, 7);
this.addBlock(world, 25, 10, 25, mainBlock, mainMeta);
this.addBlock(world, 25, 10, 38, stairBlock, 6);
this.addBlock(world, 25, 10, 42, stairBlock, 7);
this.addBlock(world, 25, 11, 8, mainBlock, secMeta);
this.addBlock(world, 25, 11, 12, mainBlock, secMeta);
this.addBlock(world, 25, 11, 25, mainBlock, mainMeta);
this.addBlock(world, 25, 11, 38, mainBlock, secMeta);
this.addBlock(world, 25, 11, 42, mainBlock, secMeta);
this.addBlock(world, 25, 12, 8, mainBlock, secMeta);
this.addBlock(world, 25, 12, 12, mainBlock, secMeta);
this.addBlock(world, 25, 12, 13, slabBlock, 8 + slabMeta);
this.addBlock(world, 25, 12, 14, slabBlock, 8 + slabMeta);
this.addBlock(world, 25, 12, 15, slabBlock, 8 + slabMeta);
this.addBlock(world, 25, 12, 16, slabBlock, 8 + slabMeta);
this.addBlock(world, 25, 12, 17, slabBlock, 8 + slabMeta);
this.addBlock(world, 25, 12, 18, slabBlock, 8 + slabMeta);
this.addBlock(world, 25, 12, 19, slabBlock, 8 + slabMeta);
this.addBlock(world, 25, 12, 20, slabBlock, 8 + slabMeta);
this.addBlock(world, 25, 12, 21, slabBlock, 8 + slabMeta);
this.addBlock(world, 25, 12, 22, mainBlock, mainMeta);
this.addBlock(world, 25, 12, 25, tntBlock, 0);
this.addBlock(world, 25, 12, 28, mainBlock, mainMeta);
this.addBlock(world, 25, 12, 29, slabBlock, 8 + slabMeta);
this.addBlock(world, 25, 12, 30, slabBlock, 8 + slabMeta);
this.addBlock(world, 25, 12, 31, slabBlock, 8 + slabMeta);
this.addBlock(world, 25, 12, 32, slabBlock, 8 + slabMeta);
this.addBlock(world, 25, 12, 33, slabBlock, 8 + slabMeta);
this.addBlock(world, 25, 12, 34, slabBlock, 8 + slabMeta);
this.addBlock(world, 25, 12, 35, slabBlock, 8 + slabMeta);
this.addBlock(world, 25, 12, 36, slabBlock, 8 + slabMeta);
this.addBlock(world, 25, 12, 37, slabBlock, 8 + slabMeta);
this.addBlock(world, 25, 12, 38, mainBlock, secMeta);
this.addBlock(world, 25, 12, 42, mainBlock, secMeta);
this.addBlock(world, 25, 13, 6, mainBlock, mainMeta);
this.addBlock(world, 25, 13, 7, mainBlock, mainMeta);
this.addBlock(world, 25, 13, 8, mainBlock, mainMeta);
this.addBlock(world, 25, 13, 9, mainBlock, mainMeta);
//this.addBlock(world, 25, 13, 10, mainBlock, mainMeta);
this.addBlock(world, 25, 13, 11, mainBlock, mainMeta);
this.addBlock(world, 25, 13, 12, mainBlock, mainMeta);
this.addBlock(world, 25, 13, 13, mainBlock, mainMeta);
this.addBlock(world, 25, 13, 14, mainBlock, mainMeta);
this.addBlock(world, 25, 13, 15, mainBlock, mainMeta);
this.addBlock(world, 25, 13, 16, mainBlock, mainMeta);
this.addBlock(world, 25, 13, 17, mainBlock, mainMeta);
this.addBlock(world, 25, 13, 18, mainBlock, mainMeta);
this.addBlock(world, 25, 13, 19, mainBlock, mainMeta);
this.addBlock(world, 25, 13, 20, mainBlock, mainMeta);
this.addBlock(world, 25, 13, 21, stairBlock, 3);
this.addBlock(world, 25, 13, 22, accentBlock, 0);
this.addBlock(world, 25, 13, 23, stairBlock, 2);
this.addBlock(world, 25, 13, 24, lapisBlock, lapisMeta);
//this.addBlock(world, 25, 13, 25, weakBlock, 0); // coal below the chest
this.addBlock(world, 25, 13, 26, lapisBlock, lapisMeta);
this.addBlock(world, 25, 13, 27, stairBlock, 3);
this.addBlock(world, 25, 13, 28, accentBlock, 0);
this.addBlock(world, 25, 13, 29, stairBlock, 2);
this.addBlock(world, 25, 13, 30, mainBlock, mainMeta);
this.addBlock(world, 25, 13, 31, mainBlock, mainMeta);
this.addBlock(world, 25, 13, 32, mainBlock, mainMeta);
this.addBlock(world, 25, 13, 33, mainBlock, mainMeta);
this.addBlock(world, 25, 13, 34, mainBlock, mainMeta);
this.addBlock(world, 25, 13, 35, mainBlock, mainMeta);
this.addBlock(world, 25, 13, 36, mainBlock, mainMeta);
this.addBlock(world, 25, 13, 37, mainBlock, mainMeta);
this.addBlock(world, 25, 13, 38, mainBlock, mainMeta);
this.addBlock(world, 25, 13, 39, mainBlock, mainMeta);
//this.addBlock(world, 25, 13, 40, mainBlock, mainMeta);
this.addBlock(world, 25, 13, 41, mainBlock, mainMeta);
this.addBlock(world, 25, 13, 42, mainBlock, mainMeta);
this.addBlock(world, 25, 13, 43, mainBlock, mainMeta);
this.addBlock(world, 25, 13, 44, mainBlock, mainMeta);
this.addBlock(world, 25, 14, 6, cannonBlock, 0);
this.addBlock(world, 25, 14, 8, stairBlock, 2);
this.addBlock(world, 25, 14, 42, stairBlock, 3);
this.addBlock(world, 25, 14, 44, cannonBlock, 0);
this.addBlock(world, 25, 15, 8, windowBlock, 0);
this.addBlock(world, 25, 15, 42, windowBlock, 0);
this.addBlock(world, 25, 16, 8, windowBlock, 0);
this.addBlock(world, 25, 16, 24, stairBlock, 2);
this.addBlock(world, 25, 16, 25, lightBlock, 0);
this.addBlock(world, 25, 16, 26, stairBlock, 3);
this.addBlock(world, 25, 16, 42, windowBlock, 0);
this.addBlock(world, 25, 17, 8, windowBlock, 0);
this.addBlock(world, 25, 17, 25, slabBlock, slabMeta);
this.addBlock(world, 25, 17, 42, windowBlock, 0);
this.addBlock(world, 25, 18, 8, stairBlock, 6);
this.addBlock(world, 25, 18, 12, stairBlock, 7);
this.addBlock(world, 25, 18, 38, stairBlock, 6);
this.addBlock(world, 25, 18, 42, stairBlock, 7);
this.addBlock(world, 25, 19, 8, stairBlock, 2);
this.addBlock(world, 25, 19, 9, mainBlock, secMeta);
this.addBlock(world, 25, 19, 10, wallBlock, 0);
this.addBlock(world, 25, 19, 11, mainBlock, secMeta);
this.addBlock(world, 25, 19, 12, stairBlock, 3);
this.addBlock(world, 25, 19, 38, stairBlock, 2);
this.addBlock(world, 25, 19, 39, mainBlock, secMeta);
this.addBlock(world, 25, 19, 40, wallBlock, 0);
this.addBlock(world, 25, 19, 41, mainBlock, secMeta);
this.addBlock(world, 25, 19, 42, stairBlock, 3);
this.addBlock(world, 25, 20, 9, stairBlock, 2);
this.addBlock(world, 25, 20, 10, lightBlock, 0);
this.addBlock(world, 25, 20, 11, stairBlock, 3);
this.addBlock(world, 25, 20, 39, stairBlock, 2);
this.addBlock(world, 25, 20, 40, lightBlock, 0);
this.addBlock(world, 25, 20, 41, stairBlock, 3);
this.addBlock(world, 25, 21, 10, slabBlock, slabMeta);
this.addBlock(world, 25, 21, 40, slabBlock, slabMeta);
this.addBlock(world, 26, 1, 25, wallBlock, 0);
this.addBlock(world, 26, 7, 24, stairBlock, 6);
this.addBlock(world, 26, 7, 25, stairBlock, 5);
this.addBlock(world, 26, 7, 26, stairBlock, 7);
this.addBlock(world, 26, 8, 10, stairBlock, 5);
this.addBlock(world, 26, 8, 23, stairBlock, 6);
this.addBlock(world, 26, 8, 24, mainBlock, mainMeta);
this.addBlock(world, 26, 8, 25, mainBlock, mainMeta);
this.addBlock(world, 26, 8, 26, mainBlock, mainMeta);
this.addBlock(world, 26, 8, 27, stairBlock, 7);
this.addBlock(world, 26, 8, 40, stairBlock, 5);
this.addBlock(world, 26, 9, 9, slabBlock, 8 + slabMeta);
this.addBlock(world, 26, 9, 10, lapisBlock, lapisMeta);
this.addBlock(world, 26, 9, 11, slabBlock, 8 + slabMeta);
this.addBlock(world, 26, 9, 39, slabBlock, 8 + slabMeta);
this.addBlock(world, 26, 9, 40, lapisBlock, lapisMeta);
this.addBlock(world, 26, 9, 41, slabBlock, 8 + slabMeta);
this.addBlock(world, 26, 10, 9, mainBlock, secMeta);
this.addBlock(world, 26, 10, 11, mainBlock, secMeta);
this.addBlock(world, 26, 10, 39, mainBlock, secMeta);
this.addBlock(world, 26, 10, 41, mainBlock, secMeta);
this.addBlock(world, 26, 11, 9, mainBlock, secMeta);
this.addBlock(world, 26, 11, 11, mainBlock, secMeta);
this.addBlock(world, 26, 11, 18, slabBlock, 8 + slabMeta);
this.addBlock(world, 26, 11, 32, slabBlock, 8 + slabMeta);
this.addBlock(world, 26, 11, 39, mainBlock, secMeta);
this.addBlock(world, 26, 11, 41, mainBlock, secMeta);
this.addBlock(world, 26, 12, 8, stairBlock, 6);
this.addBlock(world, 26, 12, 9, mainBlock, secMeta);
this.addBlock(world, 26, 12, 11, mainBlock, secMeta);
this.addBlock(world, 26, 12, 12, stairBlock, 7);
this.addBlock(world, 26, 12, 17, stairBlock, 6);
this.addBlock(world, 26, 12, 18, mainBlock, mainMeta);
this.addBlock(world, 26, 12, 19, stairBlock, 7);
this.addBlock(world, 26, 12, 21, stairBlock, 6);
this.addBlock(world, 26, 12, 22, mainBlock, mainMeta);
this.addBlock(world, 26, 12, 28, mainBlock, mainMeta);
this.addBlock(world, 26, 12, 29, stairBlock, 7);
this.addBlock(world, 26, 12, 31, stairBlock, 6);
this.addBlock(world, 26, 12, 32, mainBlock, mainMeta);
this.addBlock(world, 26, 12, 33, stairBlock, 7);
this.addBlock(world, 26, 12, 38, stairBlock, 6);
this.addBlock(world, 26, 12, 39, mainBlock, secMeta);
this.addBlock(world, 26, 12, 41, mainBlock, secMeta);
this.addBlock(world, 26, 12, 42, stairBlock, 7);
this.addBlock(world, 26, 13, 8, mainBlock, mainMeta);
this.addBlock(world, 26, 13, 9, mainBlock, mainMeta);
this.addBlock(world, 26, 13, 10, mainBlock, mainMeta);
this.addBlock(world, 26, 13, 11, mainBlock, mainMeta);
this.addBlock(world, 26, 13, 12, mainBlock, mainMeta);
this.addBlock(world, 26, 13, 13, stairBlock, 5);
this.addBlock(world, 26, 13, 14, stairBlock, 5);
this.addBlock(world, 26, 13, 15, stairBlock, 5);
this.addBlock(world, 26, 13, 16, stairBlock, 6);
this.addBlock(world, 26, 13, 17, mainBlock, mainMeta);
this.addBlock(world, 26, 13, 18, mainBlock, mainMeta);
this.addBlock(world, 26, 13, 19, mainBlock, mainMeta);
this.addBlock(world, 26, 13, 20, mainBlock, mainMeta);
this.addBlock(world, 26, 13, 21, mainBlock, mainMeta);
this.addBlock(world, 26, 13, 22, stairBlock, 0);
this.addBlock(world, 26, 13, 23, mainBlock, mainMeta);
this.addBlock(world, 26, 13, 24, mainBlock, mainMeta);
this.addBlock(world, 26, 13, 25, lapisBlock, lapisMeta);
this.addBlock(world, 26, 13, 26, mainBlock, mainMeta);
this.addBlock(world, 26, 13, 27, mainBlock, mainMeta);
this.addBlock(world, 26, 13, 28, stairBlock, 0);
this.addBlock(world, 26, 13, 29, mainBlock, mainMeta);
this.addBlock(world, 26, 13, 30, mainBlock, mainMeta);
this.addBlock(world, 26, 13, 31, mainBlock, mainMeta);
this.addBlock(world, 26, 13, 32, mainBlock, mainMeta);
this.addBlock(world, 26, 13, 33, mainBlock, mainMeta);
this.addBlock(world, 26, 13, 34, stairBlock, 7);
this.addBlock(world, 26, 13, 35, stairBlock, 5);
this.addBlock(world, 26, 13, 36, stairBlock, 5);
this.addBlock(world, 26, 13, 37, stairBlock, 5);
this.addBlock(world, 26, 13, 38, mainBlock, mainMeta);
this.addBlock(world, 26, 13, 39, mainBlock, mainMeta);
this.addBlock(world, 26, 13, 40, mainBlock, mainMeta);
this.addBlock(world, 26, 13, 41, mainBlock, mainMeta);
this.addBlock(world, 26, 13, 42, mainBlock, mainMeta);
this.addBlock(world, 26, 14, 8, mainBlock, mainMeta);
this.addBlock(world, 26, 14, 12, mainBlock, mainMeta);
this.addBlock(world, 26, 14, 13, wallBlock, 0);
this.addBlock(world, 26, 14, 14, wallBlock, 0);
this.addBlock(world, 26, 14, 15, wallBlock, 0);
this.addBlock(world, 26, 14, 16, lapisBlock, lapisMeta);
this.addBlock(world, 26, 14, 17, stairBlock, 3);
this.addBlock(world, 26, 14, 24, wallBlock, 0);
this.addBlock(world, 26, 14, 26, wallBlock, 0);
this.addBlock(world, 26, 14, 33, stairBlock, 2);
this.addBlock(world, 26, 14, 34, lapisBlock, lapisMeta);
this.addBlock(world, 26, 14, 35, wallBlock, 0);
this.addBlock(world, 26, 14, 36, wallBlock, 0);
this.addBlock(world, 26, 14, 37, wallBlock, 0);
this.addBlock(world, 26, 14, 38, mainBlock, mainMeta);
this.addBlock(world, 26, 14, 42, mainBlock, mainMeta);
this.addBlock(world, 26, 15, 8, mainBlock, mainMeta);
this.addBlock(world, 26, 15, 12, mainBlock, mainMeta);
this.addBlock(world, 26, 15, 14, wallBlock, 0);
this.addBlock(world, 26, 15, 15, lapisBlock, lapisMeta);
this.addBlock(world, 26, 15, 16, stairBlock, 3);
this.addBlock(world, 26, 15, 24, wallBlock, 0);
this.addBlock(world, 26, 15, 26, wallBlock, 0);
this.addBlock(world, 26, 15, 34, stairBlock, 2);
this.addBlock(world, 26, 15, 35, lapisBlock, lapisMeta);
this.addBlock(world, 26, 15, 36, wallBlock, 0);
this.addBlock(world, 26, 15, 38, mainBlock, mainMeta);
this.addBlock(world, 26, 15, 42, mainBlock, mainMeta);
this.addBlock(world, 26, 16, 8, mainBlock, mainMeta);
this.addBlock(world, 26, 16, 12, mainBlock, mainMeta);
this.addBlock(world, 26, 16, 13, stairBlock, 6);
this.addBlock(world, 26, 16, 14, lapisBlock, lapisMeta);
this.addBlock(world, 26, 16, 15, stairBlock, 3);
this.addBlock(world, 26, 16, 19, stairBlock, 4);
this.addBlock(world, 26, 16, 24, stairBlock, 1);
this.addBlock(world, 26, 16, 25, stairBlock, 1);
this.addBlock(world, 26, 16, 26, stairBlock, 3);
this.addBlock(world, 26, 16, 31, stairBlock, 4);
this.addBlock(world, 26, 16, 35, stairBlock, 2);
this.addBlock(world, 26, 16, 36, lapisBlock, lapisMeta);
this.addBlock(world, 26, 16, 37, stairBlock, 7);
this.addBlock(world, 26, 16, 38, mainBlock, mainMeta);
this.addBlock(world, 26, 16, 42, mainBlock, mainMeta);
this.addBlock(world, 26, 17, 8, mainBlock, mainMeta);
this.addBlock(world, 26, 17, 12, mainBlock, mainMeta);
this.addBlock(world, 26, 17, 13, lapisBlock, lapisMeta);
this.addBlock(world, 26, 17, 14, stairBlock, 3);
this.addBlock(world, 26, 17, 19, cannonBlock, 0);
this.addBlock(world, 26, 17, 31, cannonBlock, 0);
this.addBlock(world, 26, 17, 36, stairBlock, 2);
this.addBlock(world, 26, 17, 37, lapisBlock, lapisMeta);
this.addBlock(world, 26, 17, 38, mainBlock, mainMeta);
this.addBlock(world, 26, 17, 42, mainBlock, mainMeta);
this.addBlock(world, 26, 18, 8, stairBlock, 2);
this.addBlock(world, 26, 18, 9, stairBlock, 7);
this.addBlock(world, 26, 18, 11, stairBlock, 6);
this.addBlock(world, 26, 18, 12, lapisBlock, lapisMeta);
this.addBlock(world, 26, 18, 13, stairBlock, 3);
this.addBlock(world, 26, 18, 37, stairBlock, 2);
this.addBlock(world, 26, 18, 38, lapisBlock, lapisMeta);
this.addBlock(world, 26, 18, 39, stairBlock, 7);
this.addBlock(world, 26, 18, 41, stairBlock, 6);
this.addBlock(world, 26, 18, 42, stairBlock, 3);
this.addBlock(world, 26, 19, 9, mainBlock, secMeta);
this.addBlock(world, 26, 19, 10, mainBlock, secMeta);
this.addBlock(world, 26, 19, 11, mainBlock, secMeta);
this.addBlock(world, 26, 19, 12, stairBlock, 3);
this.addBlock(world, 26, 19, 38, stairBlock, 2);
this.addBlock(world, 26, 19, 39, mainBlock, secMeta);
this.addBlock(world, 26, 19, 40, mainBlock, secMeta);
this.addBlock(world, 26, 19, 41, mainBlock, secMeta);
this.addBlock(world, 26, 20, 9, stairBlock, 6);
this.addBlock(world, 26, 20, 10, lapisBlock, lapisMeta);
this.addBlock(world, 26, 20, 11, stairBlock, 3);
this.addBlock(world, 26, 20, 39, stairBlock, 2);
this.addBlock(world, 26, 20, 40, lapisBlock, lapisMeta);
this.addBlock(world, 26, 20, 41, stairBlock, 7);
this.addBlock(world, 26, 21, 8, stairBlock, 6);
this.addBlock(world, 26, 21, 9, lapisBlock, lapisMeta);
this.addBlock(world, 26, 21, 10, stairBlock, 3);
this.addBlock(world, 26, 21, 40, stairBlock, 2);
this.addBlock(world, 26, 21, 41, lapisBlock, lapisMeta);
this.addBlock(world, 26, 21, 42, stairBlock, 7);
this.addBlock(world, 26, 22, 7, stairBlock, 6);
this.addBlock(world, 26, 22, 8, lapisBlock, lapisMeta);
this.addBlock(world, 26, 22, 9, stairBlock, 3);
this.addBlock(world, 26, 22, 41, stairBlock, 2);
this.addBlock(world, 26, 22, 42, lapisBlock, lapisMeta);
this.addBlock(world, 26, 22, 43, stairBlock, 7);
this.addBlock(world, 26, 23, 6, stairBlock, 6);
this.addBlock(world, 26, 23, 7, lapisBlock, lapisMeta);
this.addBlock(world, 26, 23, 8, stairBlock, 3);
this.addBlock(world, 26, 23, 42, stairBlock, 2);
this.addBlock(world, 26, 23, 43, lapisBlock, lapisMeta);
this.addBlock(world, 26, 23, 44, stairBlock, 7);
this.addBlock(world, 26, 24, 5, stairBlock, 6);
this.addBlock(world, 26, 24, 6, lapisBlock, lapisMeta);
this.addBlock(world, 26, 24, 7, stairBlock, 3);
this.addBlock(world, 26, 24, 43, stairBlock, 2);
this.addBlock(world, 26, 24, 44, lapisBlock, lapisMeta);
this.addBlock(world, 26, 24, 45, stairBlock, 7);
this.addBlock(world, 26, 25, 4, stairBlock, 6);
this.addBlock(world, 26, 25, 5, lapisBlock, lapisMeta);
this.addBlock(world, 26, 25, 6, stairBlock, 3);
this.addBlock(world, 26, 25, 44, stairBlock, 2);
this.addBlock(world, 26, 25, 45, lapisBlock, lapisMeta);
this.addBlock(world, 26, 25, 46, stairBlock, 7);
this.addBlock(world, 26, 26, 3, stairBlock, 6);
this.addBlock(world, 26, 26, 4, lapisBlock, lapisMeta);
this.addBlock(world, 26, 26, 5, stairBlock, 3);
this.addBlock(world, 26, 26, 45, stairBlock, 2);
this.addBlock(world, 26, 26, 46, lapisBlock, lapisMeta);
this.addBlock(world, 26, 26, 47, stairBlock, 7);
this.addBlock(world, 26, 27, 2, stairBlock, 6);
this.addBlock(world, 26, 27, 3, lapisBlock, lapisMeta);
this.addBlock(world, 26, 27, 4, stairBlock, 3);
this.addBlock(world, 26, 27, 46, stairBlock, 2);
this.addBlock(world, 26, 27, 47, lapisBlock, lapisMeta);
this.addBlock(world, 26, 27, 48, stairBlock, 7);
this.addBlock(world, 26, 28, 1, stairBlock, 6);
this.addBlock(world, 26, 28, 2, lapisBlock, lapisMeta);
this.addBlock(world, 26, 28, 3, stairBlock, 3);
this.addBlock(world, 26, 28, 47, stairBlock, 2);
this.addBlock(world, 26, 28, 48, lapisBlock, lapisMeta);
this.addBlock(world, 26, 28, 49, stairBlock, 7);
this.addBlock(world, 26, 29, 0, stairBlock, 6);
this.addBlock(world, 26, 29, 1, lapisBlock, lapisMeta);
this.addBlock(world, 26, 29, 2, stairBlock, 3);
this.addBlock(world, 26, 29, 48, stairBlock, 2);
this.addBlock(world, 26, 29, 49, lapisBlock, lapisMeta);
this.addBlock(world, 26, 29, 50, stairBlock, 7);
this.addBlock(world, 26, 30, 1, stairBlock, 3);
this.addBlock(world, 26, 30, 49, stairBlock, 2);
this.addBlock(world, 27, 8, 23, mainBlock, mainMeta);
this.addBlock(world, 27, 8, 24, stairBlock, 5);
this.addBlock(world, 27, 8, 25, stairBlock, 5);
this.addBlock(world, 27, 8, 26, stairBlock, 5);
this.addBlock(world, 27, 8, 27, mainBlock, mainMeta);
this.addBlock(world, 27, 9, 23, wallBlock, 0);
this.addBlock(world, 27, 9, 25, cannonBlock, 0);
this.addBlock(world, 27, 9, 27, wallBlock, 0);
this.addBlock(world, 27, 10, 10, stairBlock, 5);
this.addBlock(world, 27, 10, 23, wallBlock, 0);
this.addBlock(world, 27, 10, 27, wallBlock, 0);
this.addBlock(world, 27, 10, 40, stairBlock, 5);
this.addBlock(world, 27, 11, 10, mainBlock, secMeta);
this.addBlock(world, 27, 11, 23, wallBlock, 0);
this.addBlock(world, 27, 11, 27, wallBlock, 0);
this.addBlock(world, 27, 11, 40, mainBlock, secMeta);
this.addBlock(world, 27, 12, 9, stairBlock, 5);
this.addBlock(world, 27, 12, 10, mainBlock, secMeta);
this.addBlock(world, 27, 12, 11, stairBlock, 5);
this.addBlock(world, 27, 12, 22, stairBlock, 6);
this.addBlock(world, 27, 12, 23, mainBlock, mainMeta);
this.addBlock(world, 27, 12, 27, mainBlock, mainMeta);
this.addBlock(world, 27, 12, 28, stairBlock, 7);
this.addBlock(world, 27, 12, 39, stairBlock, 5);
this.addBlock(world, 27, 12, 40, mainBlock, secMeta);
this.addBlock(world, 27, 12, 41, stairBlock, 5);
this.addBlock(world, 27, 13, 9, mainBlock, mainMeta);
this.addBlock(world, 27, 13, 10, mainBlock, mainMeta);
this.addBlock(world, 27, 13, 11, mainBlock, mainMeta);
this.addBlock(world, 27, 13, 18, stairBlock, 6);
this.addBlock(world, 27, 13, 19, mainBlock, mainMeta);
this.addBlock(world, 27, 13, 20, mainBlock, mainMeta);
this.addBlock(world, 27, 13, 21, mainBlock, mainMeta);
this.addBlock(world, 27, 13, 22, mainBlock, mainMeta);
this.addBlock(world, 27, 13, 23, mainBlock, secMeta);
this.addBlock(world, 27, 13, 24, mainBlock, mainMeta);
this.addBlock(world, 27, 13, 25, stairBlock, 1);
this.addBlock(world, 27, 13, 26, mainBlock, mainMeta);
this.addBlock(world, 27, 13, 27, mainBlock, secMeta);
this.addBlock(world, 27, 13, 28, mainBlock, mainMeta);
this.addBlock(world, 27, 13, 29, mainBlock, mainMeta);
this.addBlock(world, 27, 13, 30, mainBlock, mainMeta);
this.addBlock(world, 27, 13, 31, mainBlock, mainMeta);
this.addBlock(world, 27, 13, 32, stairBlock, 7);
this.addBlock(world, 27, 13, 39, mainBlock, mainMeta);
this.addBlock(world, 27, 13, 40, mainBlock, mainMeta);
this.addBlock(world, 27, 13, 41, mainBlock, mainMeta);
this.addBlock(world, 27, 14, 9, mainBlock, mainMeta);
this.addBlock(world, 27, 14, 10, stairBlock, 1);
this.addBlock(world, 27, 14, 11, mainBlock, mainMeta);
this.addBlock(world, 27, 14, 18, wallBlock, 0);
this.addBlock(world, 27, 14, 19, mainBlock, mainMeta);
this.addBlock(world, 27, 14, 20, stairBlock, 3);
this.addBlock(world, 27, 14, 30, stairBlock, 2);
this.addBlock(world, 27, 14, 31, mainBlock, mainMeta);
this.addBlock(world, 27, 14, 32, wallBlock, 0);
this.addBlock(world, 27, 14, 39, mainBlock, mainMeta);
this.addBlock(world, 27, 14, 40, stairBlock, 1);
this.addBlock(world, 27, 14, 41, mainBlock, mainMeta);
this.addBlock(world, 27, 15, 9, mainBlock, mainMeta);
this.addBlock(world, 27, 15, 10, windowBlock, 0);
this.addBlock(world, 27, 15, 11, mainBlock, mainMeta);
this.addBlock(world, 27, 15, 19, mainBlock, mainMeta);
this.addBlock(world, 27, 15, 31, mainBlock, mainMeta);
this.addBlock(world, 27, 15, 39, mainBlock, mainMeta);
this.addBlock(world, 27, 15, 40, windowBlock, 0);
this.addBlock(world, 27, 15, 41, mainBlock, mainMeta);
this.addBlock(world, 27, 16, 9, mainBlock, mainMeta);
this.addBlock(world, 27, 16, 10, windowBlock, 0);
this.addBlock(world, 27, 16, 11, mainBlock, mainMeta);
this.addBlock(world, 27, 16, 19, stairBlock, 1);
this.addBlock(world, 27, 16, 31, stairBlock, 1);
this.addBlock(world, 27, 16, 39, mainBlock, mainMeta);
this.addBlock(world, 27, 16, 40, windowBlock, 0);
this.addBlock(world, 27, 16, 41, mainBlock, mainMeta);
this.addBlock(world, 27, 17, 9, mainBlock, mainMeta);
this.addBlock(world, 27, 17, 10, windowBlock, 0);
this.addBlock(world, 27, 17, 11, mainBlock, mainMeta);
this.addBlock(world, 27, 17, 39, mainBlock, mainMeta);
this.addBlock(world, 27, 17, 40, windowBlock, 0);
this.addBlock(world, 27, 17, 41, mainBlock, mainMeta);
this.addBlock(world, 27, 18, 9, stairBlock, 1);
this.addBlock(world, 27, 18, 10, mainBlock, mainMeta);
this.addBlock(world, 27, 18, 11, stairBlock, 1);
this.addBlock(world, 27, 18, 39, stairBlock, 1);
this.addBlock(world, 27, 18, 40, stairBlock, 5);
this.addBlock(world, 27, 18, 41, stairBlock, 1);
this.addBlock(world, 27, 19, 10, stairBlock, 1);
this.addBlock(world, 27, 19, 40, stairBlock, 1);
this.addBlock(world, 28, 12, 23, stairBlock, 5);
this.addBlock(world, 28, 12, 24, mainBlock, mainMeta);
this.addBlock(world, 28, 12, 25, mainBlock, mainMeta);
this.addBlock(world, 28, 12, 26, mainBlock, mainMeta);
this.addBlock(world, 28, 12, 27, stairBlock, 5);
this.addBlock(world, 28, 13, 10, mainBlock, mainMeta);
this.addBlock(world, 28, 13, 20, mainBlock, mainMeta);
this.addBlock(world, 28, 13, 21, mainBlock, mainMeta);
this.addBlock(world, 28, 13, 22, mainBlock, mainMeta);
this.addBlock(world, 28, 13, 23, mainBlock, mainMeta);
this.addBlock(world, 28, 13, 24, stairBlock, 3);
this.addBlock(world, 28, 13, 25, accentBlock, 0);
this.addBlock(world, 28, 13, 26, stairBlock, 2);
this.addBlock(world, 28, 13, 27, mainBlock, mainMeta);
this.addBlock(world, 28, 13, 28, mainBlock, mainMeta);
this.addBlock(world, 28, 13, 29, mainBlock, mainMeta);
this.addBlock(world, 28, 13, 30, mainBlock, mainMeta);
this.addBlock(world, 28, 13, 40, mainBlock, mainMeta);
this.addBlock(world, 28, 14, 19, wallBlock, 0);
this.addBlock(world, 28, 14, 31, wallBlock, 0);
this.addBlock(world, 29, 12, 24, stairBlock, 5);
this.addBlock(world, 29, 12, 25, slabBlock, 8 + slabMeta);
this.addBlock(world, 29, 12, 26, stairBlock, 5);
this.addBlock(world, 29, 13, 10, mainBlock, mainMeta);
this.addBlock(world, 29, 13, 21, mainBlock, mainMeta);
this.addBlock(world, 29, 13, 22, mainBlock, mainMeta);
this.addBlock(world, 29, 13, 23, mainBlock, mainMeta);
this.addBlock(world, 29, 13, 24, mainBlock, mainMeta);
this.addBlock(world, 29, 13, 25, stairBlock, 0);
this.addBlock(world, 29, 13, 26, mainBlock, mainMeta);
this.addBlock(world, 29, 13, 27, mainBlock, mainMeta);
this.addBlock(world, 29, 13, 28, mainBlock, mainMeta);
this.addBlock(world, 29, 13, 29, mainBlock, mainMeta);
this.addBlock(world, 29, 13, 40, mainBlock, mainMeta);
this.addBlock(world, 29, 14, 10, cannonBlock, 0);
this.addBlock(world, 29, 14, 19, wallBlock, 0);
this.addBlock(world, 29, 14, 20, wallBlock, 0);
this.addBlock(world, 29, 14, 30, wallBlock, 0);
this.addBlock(world, 29, 14, 31, wallBlock, 0);
this.addBlock(world, 29, 14, 40, cannonBlock, 0);
this.addBlock(world, 30, 12, 25, slabBlock, 8 + slabMeta);
this.addBlock(world, 30, 13, 22, mainBlock, mainMeta);
this.addBlock(world, 30, 13, 23, mainBlock, mainMeta);
this.addBlock(world, 30, 13, 24, mainBlock, mainMeta);
this.addBlock(world, 30, 13, 25, mainBlock, mainMeta);
this.addBlock(world, 30, 13, 26, mainBlock, mainMeta);
this.addBlock(world, 30, 13, 27, mainBlock, mainMeta);
this.addBlock(world, 30, 13, 28, mainBlock, mainMeta);
this.addBlock(world, 30, 14, 20, wallBlock, 0);
this.addBlock(world, 30, 14, 21, wallBlock, 0);
this.addBlock(world, 30, 14, 23, stairBlock, 0);
this.addBlock(world, 30, 14, 27, stairBlock, 0);
this.addBlock(world, 30, 14, 29, wallBlock, 0);
this.addBlock(world, 30, 14, 30, wallBlock, 0);
this.addBlock(world, 31, 12, 24, stairBlock, 4);
this.addBlock(world, 31, 12, 25, slabBlock, 8 + slabMeta);
this.addBlock(world, 31, 12, 26, stairBlock, 4);
this.addBlock(world, 31, 13, 23, mainBlock, mainMeta);
this.addBlock(world, 31, 13, 24, mainBlock, mainMeta);
this.addBlock(world, 31, 13, 25, mainBlock, mainMeta);
this.addBlock(world, 31, 13, 26, mainBlock, mainMeta);
this.addBlock(world, 31, 13, 27, mainBlock, mainMeta);
this.addBlock(world, 31, 14, 21, wallBlock, 0);
this.addBlock(world, 31, 14, 22, wallBlock, 0);
this.addBlock(world, 31, 14, 23, mainBlock, mainMeta);
this.addBlock(world, 31, 14, 27, mainBlock, mainMeta);
this.addBlock(world, 31, 14, 28, wallBlock, 0);
this.addBlock(world, 31, 14, 29, wallBlock, 0);
this.addBlock(world, 31, 15, 23, mainBlock, mainMeta);
this.addBlock(world, 31, 15, 27, mainBlock, mainMeta);
this.addBlock(world, 31, 16, 23, stairBlock, 2);
this.addBlock(world, 31, 16, 24, stairBlock, 7);
this.addBlock(world, 31, 16, 26, stairBlock, 6);
this.addBlock(world, 31, 16, 27, stairBlock, 3);
this.addBlock(world, 31, 17, 24, cannonBlock, 0);
this.addBlock(world, 31, 17, 26, cannonBlock, 0);
this.addBlock(world, 32, 11, 24, slabBlock, 8 + slabMeta);
this.addBlock(world, 32, 11, 26, slabBlock, 8 + slabMeta);
this.addBlock(world, 32, 12, 24, mainBlock, mainMeta);
this.addBlock(world, 32, 12, 25, slabBlock, 8 + slabMeta);
this.addBlock(world, 32, 12, 26, mainBlock, mainMeta);
this.addBlock(world, 32, 13, 23, stairBlock, 5);
this.addBlock(world, 32, 13, 24, mainBlock, mainMeta);
this.addBlock(world, 32, 13, 25, mainBlock, mainMeta);
this.addBlock(world, 32, 13, 26, mainBlock, mainMeta);
this.addBlock(world, 32, 13, 27, stairBlock, 5);
this.addBlock(world, 32, 14, 23, wallBlock, 0);
this.addBlock(world, 32, 14, 27, wallBlock, 0);
this.addBlock(world, 33, 12, 24, stairBlock, 5);
this.addBlock(world, 33, 12, 25, slabBlock, 8 + slabMeta);
this.addBlock(world, 33, 12, 26, stairBlock, 5);
this.addBlock(world, 33, 13, 24, mainBlock, mainMeta);
this.addBlock(world, 33, 13, 25, mainBlock, mainMeta);
this.addBlock(world, 33, 13, 26, mainBlock, mainMeta);
this.addBlock(world, 33, 14, 24, stairBlock, 0);
this.addBlock(world, 33, 14, 26, stairBlock, 0);
this.addBlock(world, 34, 12, 25, slabBlock, 8 + slabMeta);
this.addBlock(world, 34, 13, 24, stairBlock, 5);
this.addBlock(world, 34, 13, 25, mainBlock, mainMeta);
this.addBlock(world, 34, 13, 26, stairBlock, 5);
this.addBlock(world, 34, 14, 24, lapisBlock, lapisMeta);
this.addBlock(world, 34, 14, 26, lapisBlock, lapisMeta);
this.addBlock(world, 34, 15, 24, stairBlock, 0);
this.addBlock(world, 34, 15, 26, stairBlock, 0);
this.addBlock(world, 35, 12, 25, slabBlock, 8 + slabMeta);
this.addBlock(world, 35, 13, 24, stairBlock, 6);
this.addBlock(world, 35, 13, 25, mainBlock, mainMeta);
this.addBlock(world, 35, 13, 26, stairBlock, 7);
this.addBlock(world, 35, 14, 24, wallBlock, 0);
this.addBlock(world, 35, 14, 26, wallBlock, 0);
this.addBlock(world, 35, 15, 24, lapisBlock, lapisMeta);
this.addBlock(world, 35, 15, 26, lapisBlock, lapisMeta);
this.addBlock(world, 35, 16, 24, stairBlock, 0);
this.addBlock(world, 35, 16, 26, stairBlock, 0);
this.addBlock(world, 36, 12, 25, slabBlock, 8 + slabMeta);
this.addBlock(world, 36, 13, 24, stairBlock, 6);
this.addBlock(world, 36, 13, 25, mainBlock, mainMeta);
this.addBlock(world, 36, 13, 26, stairBlock, 7);
this.addBlock(world, 36, 14, 24, wallBlock, 0);
this.addBlock(world, 36, 14, 26, wallBlock, 0);
this.addBlock(world, 36, 15, 24, wallBlock, 0);
this.addBlock(world, 36, 15, 26, wallBlock, 0);
this.addBlock(world, 36, 16, 24, lapisBlock, lapisMeta);
this.addBlock(world, 36, 16, 26, lapisBlock, lapisMeta);
this.addBlock(world, 36, 17, 24, stairBlock, 0);
this.addBlock(world, 36, 17, 26, stairBlock, 0);
this.addBlock(world, 37, 12, 25, slabBlock, 8 + slabMeta);
this.addBlock(world, 37, 13, 24, stairBlock, 6);
this.addBlock(world, 37, 13, 25, mainBlock, mainMeta);
this.addBlock(world, 37, 13, 26, stairBlock, 7);
this.addBlock(world, 37, 14, 24, wallBlock, 0);
this.addBlock(world, 37, 14, 26, wallBlock, 0);
this.addBlock(world, 37, 16, 24, stairBlock, 5);
this.addBlock(world, 37, 16, 26, stairBlock, 5);
this.addBlock(world, 37, 17, 24, lapisBlock, lapisMeta);
this.addBlock(world, 37, 17, 26, lapisBlock, lapisMeta);
this.addBlock(world, 37, 18, 24, stairBlock, 0);
this.addBlock(world, 37, 18, 26, stairBlock, 0);
this.addBlock(world, 38, 10, 25, stairBlock, 4);
this.addBlock(world, 38, 11, 25, mainBlock, secMeta);
this.addBlock(world, 38, 12, 24, stairBlock, 4);
this.addBlock(world, 38, 12, 25, mainBlock, secMeta);
this.addBlock(world, 38, 12, 26, stairBlock, 4);
this.addBlock(world, 38, 13, 24, mainBlock, mainMeta);
this.addBlock(world, 38, 13, 25, mainBlock, mainMeta);
this.addBlock(world, 38, 13, 26, mainBlock, mainMeta);
this.addBlock(world, 38, 14, 24, mainBlock, mainMeta);
this.addBlock(world, 38, 14, 26, mainBlock, mainMeta);
this.addBlock(world, 38, 15, 24, mainBlock, mainMeta);
this.addBlock(world, 38, 15, 26, mainBlock, mainMeta);
this.addBlock(world, 38, 16, 24, mainBlock, mainMeta);
this.addBlock(world, 38, 16, 26, mainBlock, mainMeta);
this.addBlock(world, 38, 17, 24, mainBlock, mainMeta);
this.addBlock(world, 38, 17, 26, mainBlock, mainMeta);
this.addBlock(world, 38, 18, 24, lapisBlock, lapisMeta);
this.addBlock(world, 38, 18, 25, stairBlock, 4);
this.addBlock(world, 38, 18, 26, lapisBlock, lapisMeta);
this.addBlock(world, 38, 19, 24, stairBlock, 0);
this.addBlock(world, 38, 19, 25, stairBlock, 0);
this.addBlock(world, 38, 19, 26, stairBlock, 0);
this.addBlock(world, 39, 8, 25, stairBlock, 4);
this.addBlock(world, 39, 9, 24, slabBlock, 8 + slabMeta);
this.addBlock(world, 39, 9, 25, lapisBlock, lapisMeta);
this.addBlock(world, 39, 9, 26, slabBlock, 8 + slabMeta);
this.addBlock(world, 39, 10, 24, mainBlock, secMeta);
this.addBlock(world, 39, 10, 26, mainBlock, secMeta);
this.addBlock(world, 39, 11, 24, mainBlock, secMeta);
this.addBlock(world, 39, 11, 26, mainBlock, secMeta);
this.addBlock(world, 39, 12, 23, stairBlock, 6);
this.addBlock(world, 39, 12, 24, mainBlock, secMeta);
this.addBlock(world, 39, 12, 26, mainBlock, secMeta);
this.addBlock(world, 39, 12, 27, stairBlock, 7);
this.addBlock(world, 39, 13, 23, mainBlock, mainMeta);
this.addBlock(world, 39, 13, 24, mainBlock, mainMeta);
this.addBlock(world, 39, 13, 25, mainBlock, mainMeta);
this.addBlock(world, 39, 13, 26, mainBlock, mainMeta);
this.addBlock(world, 39, 13, 27, mainBlock, mainMeta);
this.addBlock(world, 39, 14, 23, mainBlock, mainMeta);
this.addBlock(world, 39, 14, 27, mainBlock, mainMeta);
this.addBlock(world, 39, 15, 23, mainBlock, mainMeta);
this.addBlock(world, 39, 15, 27, mainBlock, mainMeta);
this.addBlock(world, 39, 16, 23, mainBlock, mainMeta);
this.addBlock(world, 39, 16, 27, mainBlock, mainMeta);
this.addBlock(world, 39, 17, 23, mainBlock, mainMeta);
this.addBlock(world, 39, 17, 27, mainBlock, mainMeta);
this.addBlock(world, 39, 18, 23, stairBlock, 2);
this.addBlock(world, 39, 18, 24, stairBlock, 5);
this.addBlock(world, 39, 18, 26, stairBlock, 5);
this.addBlock(world, 39, 18, 27, stairBlock, 3);
this.addBlock(world, 39, 19, 24, mainBlock, secMeta);
this.addBlock(world, 39, 19, 25, mainBlock, secMeta);
this.addBlock(world, 39, 19, 26, mainBlock, secMeta);
this.addBlock(world, 39, 20, 24, stairBlock, 0);
this.addBlock(world, 39, 20, 25, stairBlock, 0);
this.addBlock(world, 39, 20, 26, stairBlock, 0);
this.addBlock(world, 40, 4, 25, wallBlock, 0);
this.addBlock(world, 40, 5, 25, wallBlock, 0);
this.addBlock(world, 40, 6, 25, wallBlock, 0);
this.addBlock(world, 40, 7, 25, wallBlock, 0);
this.addBlock(world, 40, 8, 24, stairBlock, 6);
this.addBlock(world, 40, 8, 25, lightBlock, 0);
this.addBlock(world, 40, 8, 26, stairBlock, 7);
this.addBlock(world, 40, 9, 24, lapisBlock, lapisMeta);
this.addBlock(world, 40, 9, 26, lapisBlock, lapisMeta);
this.addBlock(world, 40, 10, 23, stairBlock, 6);
this.addBlock(world, 40, 10, 27, stairBlock, 7);
this.addBlock(world, 40, 11, 23, mainBlock, secMeta);
this.addBlock(world, 40, 11, 27, mainBlock, secMeta);
this.addBlock(world, 40, 12, 23, mainBlock, secMeta);
this.addBlock(world, 40, 12, 27, mainBlock, secMeta);
this.addBlock(world, 40, 13, 21, mainBlock, mainMeta);
this.addBlock(world, 40, 13, 22, mainBlock, mainMeta);
this.addBlock(world, 40, 13, 23, mainBlock, mainMeta);
this.addBlock(world, 40, 13, 24, mainBlock, mainMeta);
//this.addBlock(world, 40, 13, 25, mainBlock, mainMeta);
this.addBlock(world, 40, 13, 26, mainBlock, mainMeta);
this.addBlock(world, 40, 13, 27, mainBlock, mainMeta);
this.addBlock(world, 40, 13, 28, mainBlock, mainMeta);
this.addBlock(world, 40, 13, 29, mainBlock, mainMeta);
this.addBlock(world, 40, 14, 21, cannonBlock, 0);
this.addBlock(world, 40, 14, 23, stairBlock, 2);
this.addBlock(world, 40, 14, 27, stairBlock, 3);
this.addBlock(world, 40, 14, 29, cannonBlock, 0);
this.addBlock(world, 40, 15, 23, windowBlock, 0);
this.addBlock(world, 40, 15, 27, windowBlock, 0);
this.addBlock(world, 40, 16, 23, windowBlock, 0);
this.addBlock(world, 40, 16, 27, windowBlock, 0);
this.addBlock(world, 40, 17, 23, windowBlock, 0);
this.addBlock(world, 40, 17, 27, windowBlock, 0);
this.addBlock(world, 40, 18, 23, stairBlock, 6);
this.addBlock(world, 40, 18, 27, mainBlock, mainMeta);
this.addBlock(world, 40, 19, 23, stairBlock, 2);
this.addBlock(world, 40, 19, 24, mainBlock, secMeta);
this.addBlock(world, 40, 19, 25, wallBlock, 0);
this.addBlock(world, 40, 19, 26, mainBlock, secMeta);
this.addBlock(world, 40, 19, 27, stairBlock, 3);
this.addBlock(world, 40, 20, 24, lapisBlock, lapisMeta);
this.addBlock(world, 40, 20, 25, lightBlock, 0);
this.addBlock(world, 40, 20, 26, lapisBlock, lapisMeta);
this.addBlock(world, 40, 21, 24, stairBlock, 0);
this.addBlock(world, 40, 21, 25, slabBlock, slabMeta);
this.addBlock(world, 40, 21, 26, stairBlock, 0);
this.addBlock(world, 41, 8, 25, stairBlock, 5);
this.addBlock(world, 41, 9, 24, slabBlock, 8 + slabMeta);
this.addBlock(world, 41, 9, 25, lapisBlock, lapisMeta);
this.addBlock(world, 41, 9, 26, slabBlock, 8 + slabMeta);
this.addBlock(world, 41, 10, 24, mainBlock, secMeta);
this.addBlock(world, 41, 10, 26, mainBlock, secMeta);
this.addBlock(world, 41, 11, 24, mainBlock, secMeta);
this.addBlock(world, 41, 11, 26, mainBlock, secMeta);
this.addBlock(world, 41, 12, 23, stairBlock, 6);
this.addBlock(world, 41, 12, 24, mainBlock, secMeta);
this.addBlock(world, 41, 12, 26, mainBlock, secMeta);
this.addBlock(world, 41, 12, 27, stairBlock, 7);
this.addBlock(world, 41, 13, 23, mainBlock, mainMeta);
this.addBlock(world, 41, 13, 24, mainBlock, mainMeta);
this.addBlock(world, 41, 13, 25, mainBlock, mainMeta);
this.addBlock(world, 41, 13, 26, mainBlock, mainMeta);
this.addBlock(world, 41, 13, 27, mainBlock, mainMeta);
this.addBlock(world, 41, 14, 23, mainBlock, mainMeta);
this.addBlock(world, 41, 14, 27, mainBlock, mainMeta);
this.addBlock(world, 41, 15, 23, mainBlock, mainMeta);
this.addBlock(world, 41, 15, 27, mainBlock, mainMeta);
this.addBlock(world, 41, 16, 23, mainBlock, mainMeta);
this.addBlock(world, 41, 16, 27, mainBlock, mainMeta);
this.addBlock(world, 41, 17, 23, mainBlock, mainMeta);
this.addBlock(world, 41, 17, 27, mainBlock, mainMeta);
this.addBlock(world, 41, 18, 23, stairBlock, 2);
this.addBlock(world, 41, 18, 24, stairBlock, 4);
this.addBlock(world, 41, 18, 26, stairBlock, 4);
this.addBlock(world, 41, 18, 27, stairBlock, 3);
this.addBlock(world, 41, 19, 24, mainBlock, secMeta);
this.addBlock(world, 41, 19, 25, mainBlock, secMeta);
this.addBlock(world, 41, 19, 26, mainBlock, secMeta);
this.addBlock(world, 41, 20, 24, stairBlock, 5);
this.addBlock(world, 41, 20, 25, stairBlock, 1);
this.addBlock(world, 41, 20, 26, stairBlock, 5);
this.addBlock(world, 41, 21, 24, lapisBlock, lapisMeta);
this.addBlock(world, 41, 21, 26, lapisBlock, lapisMeta);
this.addBlock(world, 41, 22, 24, stairBlock, 0);
this.addBlock(world, 41, 22, 26, stairBlock, 0);
this.addBlock(world, 42, 10, 25, stairBlock, 5);
this.addBlock(world, 42, 11, 25, mainBlock, secMeta);
this.addBlock(world, 42, 12, 24, stairBlock, 5);
this.addBlock(world, 42, 12, 25, mainBlock, secMeta);
this.addBlock(world, 42, 12, 26, stairBlock, 5);
this.addBlock(world, 42, 13, 24, mainBlock, mainMeta);
this.addBlock(world, 42, 13, 25, mainBlock, mainMeta);
this.addBlock(world, 42, 13, 26, mainBlock, mainMeta);
this.addBlock(world, 42, 14, 24, mainBlock, mainMeta);
this.addBlock(world, 42, 14, 25, stairBlock, 1);
this.addBlock(world, 42, 14, 26, mainBlock, mainMeta);
this.addBlock(world, 42, 15, 24, mainBlock, mainMeta);
this.addBlock(world, 42, 15, 25, windowBlock, 0);
this.addBlock(world, 42, 15, 26, mainBlock, mainMeta);
this.addBlock(world, 42, 16, 24, mainBlock, mainMeta);
this.addBlock(world, 42, 16, 25, windowBlock, 0);
this.addBlock(world, 42, 16, 26, mainBlock, mainMeta);
this.addBlock(world, 42, 17, 24, mainBlock, mainMeta);
this.addBlock(world, 42, 17, 25, windowBlock, 0);
this.addBlock(world, 42, 17, 26, mainBlock, mainMeta);
this.addBlock(world, 42, 18, 24, stairBlock, 1);
this.addBlock(world, 42, 18, 25, stairBlock, 5);
this.addBlock(world, 42, 18, 26, stairBlock, 1);
this.addBlock(world, 42, 19, 25, stairBlock, 1);
this.addBlock(world, 42, 21, 24, stairBlock, 5);
this.addBlock(world, 42, 21, 26, stairBlock, 5);
this.addBlock(world, 42, 22, 24, lapisBlock, lapisMeta);
this.addBlock(world, 42, 22, 26, lapisBlock, lapisMeta);
this.addBlock(world, 42, 23, 24, stairBlock, 0);
this.addBlock(world, 42, 23, 26, stairBlock, 0);
this.addBlock(world, 43, 13, 25, mainBlock, mainMeta);
this.addBlock(world, 43, 22, 24, stairBlock, 5);
this.addBlock(world, 43, 22, 26, stairBlock, 5);
this.addBlock(world, 43, 23, 24, lapisBlock, lapisMeta);
this.addBlock(world, 43, 23, 26, lapisBlock, lapisMeta);
this.addBlock(world, 43, 24, 24, stairBlock, 0);
this.addBlock(world, 43, 24, 26, stairBlock, 0);
this.addBlock(world, 44, 13, 25, mainBlock, mainMeta);
this.addBlock(world, 44, 14, 25, cannonBlock, 0);
this.addBlock(world, 44, 23, 24, stairBlock, 5);
this.addBlock(world, 44, 23, 26, stairBlock, 5);
this.addBlock(world, 44, 24, 24, lapisBlock, lapisMeta);
this.addBlock(world, 44, 24, 26, lapisBlock, lapisMeta);
this.addBlock(world, 44, 25, 24, stairBlock, 0);
this.addBlock(world, 44, 25, 26, stairBlock, 0);
this.addBlock(world, 45, 24, 24, stairBlock, 5);
this.addBlock(world, 45, 24, 26, stairBlock, 5);
this.addBlock(world, 45, 25, 24, lapisBlock, lapisMeta);
this.addBlock(world, 45, 25, 26, lapisBlock, lapisMeta);
this.addBlock(world, 45, 26, 24, stairBlock, 0);
this.addBlock(world, 45, 26, 26, stairBlock, 0);
this.addBlock(world, 46, 25, 24, stairBlock, 5);
this.addBlock(world, 46, 25, 26, stairBlock, 5);
this.addBlock(world, 46, 26, 24, lapisBlock, lapisMeta);
this.addBlock(world, 46, 26, 26, lapisBlock, lapisMeta);
this.addBlock(world, 46, 27, 24, stairBlock, 0);
this.addBlock(world, 46, 27, 26, stairBlock, 0);
this.addBlock(world, 47, 26, 24, stairBlock, 5);
this.addBlock(world, 47, 26, 26, stairBlock, 5);
this.addBlock(world, 47, 27, 24, lapisBlock, lapisMeta);
this.addBlock(world, 47, 27, 26, lapisBlock, lapisMeta);
this.addBlock(world, 47, 28, 24, stairBlock, 0);
this.addBlock(world, 47, 28, 26, stairBlock, 0);
this.addBlock(world, 48, 27, 24, stairBlock, 5);
this.addBlock(world, 48, 27, 26, stairBlock, 5);
this.addBlock(world, 48, 28, 24, lapisBlock, lapisMeta);
this.addBlock(world, 48, 28, 26, lapisBlock, lapisMeta);
this.addBlock(world, 48, 29, 24, stairBlock, 0);
this.addBlock(world, 48, 29, 26, stairBlock, 0);
this.addBlock(world, 49, 28, 24, stairBlock, 5);
this.addBlock(world, 49, 28, 26, stairBlock, 5);
this.addBlock(world, 49, 29, 24, lapisBlock, lapisMeta);
this.addBlock(world, 49, 29, 26, lapisBlock, lapisMeta);
this.addBlock(world, 49, 30, 24, stairBlock, 0);
this.addBlock(world, 49, 30, 26, stairBlock, 0);
this.addBlock(world, 50, 29, 24, stairBlock, 5);
this.addBlock(world, 50, 29, 26, stairBlock, 5);
// ladders
this.addBlock(world, 24, 9, 25, ladderBlock, 4);
this.addBlock(world, 24, 10, 25, ladderBlock, 4);
this.addBlock(world, 24, 11, 25, ladderBlock, 4);
this.addBlock(world, 25, 9, 24, ladderBlock, 2);
this.addBlock(world, 25, 9, 26, ladderBlock, 3);
this.addBlock(world, 25, 10, 24, ladderBlock, 2);
this.addBlock(world, 25, 10, 26, ladderBlock, 3);
this.addBlock(world, 25, 11, 24, ladderBlock, 2);
this.addBlock(world, 25, 11, 26, ladderBlock, 3);
this.addBlock(world, 26, 9, 25, ladderBlock, 5);
this.addBlock(world, 26, 10, 25, ladderBlock, 5);
this.addBlock(world, 26, 11, 25, ladderBlock, 5);
// place the spawners
Class e = EntityUnderworldSilverfish.class;
this.addSpawner(world, 10, 13, 25, e);
this.addSpawner(world, 25, 13, 10, e);
this.addSpawner(world, 25, 13, 25, e); // middle
this.addSpawner(world, 25, 13, 40, e);
this.addSpawner(world, 40, 13, 25, e);
// place the loot chests
lootChests.setChestPlaced(0, this.generateStructureChestContents(world, box, rand, 10, 14, 25, 5, 0));
lootChests.setChestPlaced(1, this.generateStructureChestContents(world, box, rand, 25, 14, 10, 3, 1));
lootChests.setChestPlaced(2, this.generateStructureChestContents(world, box, rand, 25, 14, 25, 4, 2)); // middle
lootChests.setChestPlaced(3, this.generateStructureChestContents(world, box, rand, 25, 14, 40, 2, 3));
lootChests.setChestPlaced(4, this.generateStructureChestContents(world, box, rand, 40, 14, 25, 4, 4));
return true;
}
}
}
| sblectric/LightningCraft | src/main/java/sblectric/lightningcraft/worldgen/structure/underworld/UnderworldRampart.java | Java | mit | 94,538 |
var dist = 'dist';
//var dist = 'D:/2016/myproject/cas-webapp/src/main/webapp/WEB-INF/view/default';
var gulp = require('gulp'),
usemin = require('gulp-usemin'),
wrap = require('gulp-wrap'),
connect = require('gulp-connect'),
watch = require('gulp-watch'),
minifyCss = require('gulp-minify-css'),
minifyJs = require('gulp-uglify'),
concat = require('gulp-concat'),
less = require('gulp-less'),
rename = require('gulp-rename'),
minifyHTML = require('gulp-minify-html');
var paths = {
scripts: 'src/js/**/*.*',
styles: 'src/less/**/*.*',
images: 'src/img/**/*.*',
templates: 'src/templates/**/*.html',
index: 'src/index.html',
bower_fonts: 'src/components/**/*.{ttf,woff,eof,svg,woff2}',
data:'src/data/**/*.*'
};
/**
* Handle bower components from index
*/
gulp.task('usemin', function() {
return gulp.src(paths.index)
.pipe(usemin({
js: [minifyJs(), 'concat'],
css: [minifyCss({keepSpecialComments: 0}), 'concat']
}))
.pipe(gulp.dest('dist/'));
});
/**
* Copy assets
*/
gulp.task('build-assets', ['copy-bower_fonts']);
gulp.task('copy-bower_fonts', function() {
return gulp.src(paths.bower_fonts)
.pipe(rename({
dirname: '/fonts'
}))
.pipe(gulp.dest('dist/lib'));
});
/**
* Handle custom files
*/
gulp.task('build-custom', ['custom-images', 'custom-js', 'custom-less', 'custom-templates','custom-data']);
gulp.task('custom-images', function() {
return gulp.src(paths.images)
.pipe(gulp.dest('dist/img'));
});
gulp.task('custom-js', function() {
return gulp.src(paths.scripts)
.pipe(minifyJs())
.pipe(concat('eWorkUI.min.js'))
.pipe(gulp.dest('dist/js'));
});
gulp.task('custom-less', function() {
return gulp.src(paths.styles)
.pipe(less())
.pipe(concat('eWorkUI.min.css'))
.pipe(gulp.dest('dist/css'));
});
gulp.task('custom-templates', function() {
return gulp.src(paths.templates)
.pipe(minifyHTML())
.pipe(gulp.dest('dist/templates'));
});
gulp.task('custom-data', function() {
return gulp.src(paths.data)
.pipe(gulp.dest(dist+'/data'));
});
/**
* Watch custom files
*/
gulp.task('watch', function() {
gulp.watch([paths.images], ['custom-images']);
gulp.watch([paths.styles], ['custom-less']);
gulp.watch([paths.scripts], ['custom-js']);
gulp.watch([paths.templates], ['custom-templates']);
gulp.watch([paths.index], ['usemin']);
});
/**
* Live reload server
*/
gulp.task('webserver', function() {
connect.server({
root: 'dist',
livereload: true,
port: 8888
});
});
gulp.task('livereload', function() {
gulp.src(['dist/**/*.*'])
.pipe(watch())
.pipe(connect.reload());
});
/**
* Gulp tasks
*/
gulp.task('build', ['usemin', 'build-assets', 'build-custom']);
gulp.task('default', ['build', 'webserver', 'livereload', 'watch']); | zly2014/ework-ui | gulpfile.js | JavaScript | mit | 2,992 |
#define BOOST_TEST_MODULE Domecoin Test Suite
#include <boost/test/unit_test.hpp>
#include <boost/filesystem.hpp>
#include "db.h"
#include "txdb.h"
#include "main.h"
#include "wallet.h"
#include "util.h"
CWallet* pwalletMain;
CClientUIInterface uiInterface;
extern bool fPrintToConsole;
extern void noui_connect();
struct TestingSetup {
CCoinsViewDB *pcoinsdbview;
boost::filesystem::path pathTemp;
boost::thread_group threadGroup;
TestingSetup() {
fPrintToDebugger = true; // don't want to write to debug.log file
noui_connect();
bitdb.MakeMock();
pathTemp = GetTempPath() / strprintf("test_domecoin_%lu_%i", (unsigned long)GetTime(), (int)(GetRand(100000)));
boost::filesystem::create_directories(pathTemp);
mapArgs["-datadir"] = pathTemp.string();
pblocktree = new CBlockTreeDB(1 << 20, true);
pcoinsdbview = new CCoinsViewDB(1 << 23, true);
pcoinsTip = new CCoinsViewCache(*pcoinsdbview);
InitBlockIndex();
bool fFirstRun;
pwalletMain = new CWallet("wallet.dat");
pwalletMain->LoadWallet(fFirstRun);
RegisterWallet(pwalletMain);
nScriptCheckThreads = 3;
for (int i=0; i < nScriptCheckThreads-1; i++)
threadGroup.create_thread(&ThreadScriptCheck);
}
~TestingSetup()
{
threadGroup.interrupt_all();
threadGroup.join_all();
delete pwalletMain;
pwalletMain = NULL;
delete pcoinsTip;
delete pcoinsdbview;
delete pblocktree;
bitdb.Flush(true);
boost::filesystem::remove_all(pathTemp);
}
};
BOOST_GLOBAL_FIXTURE(TestingSetup);
void Shutdown(void* parg)
{
exit(0);
}
void StartShutdown()
{
exit(0);
}
| domecoin/domecoin | src/test/test_bitcoin.cpp | C++ | mit | 1,753 |
# My Ledger Pal
__This is a Work In Progress__
My ledger pal helps me to import CSV reports produced by my bank.
Usage:
mypl.py <bank> <input> [-o OUTPUT] [-i --interactive] [-d --debug]
mypl.py (-l | --list) [-d --debug]
mypl.py (-h | --help)
mypl.py --version
Options:
<bank> My bank.
<input> Input CSV file.
-d --debug Print callstack.
-h --help Show this help.
-i --interactive Will ask me for information about the posts before
writing them to my ledger file.
-l --list List the available banks.
-o OUTPUT My ledger file where to export the posts.
--version Show version.
| syl20bnr/myledgerpal | README.md | Markdown | mit | 759 |
package net.plusmid.mensaberlin.views;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.text.TextPaint;
import android.util.AttributeSet;
import android.view.View;
import android.widget.GridLayout;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import net.plusmid.mensaberlin.R;
import net.plusmid.mensaberlin.mensa.Dish;
public class DishView extends GridLayout {
private Dish mDish;
private View mRootView;
public DishView(Context context) {
super(context);
init(context);
}
public DishView(Context context, AttributeSet attrs) {
super(context, attrs);
init(context);
}
public DishView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init(context);
}
private void init(Context context) {
mRootView = inflate(context, R.layout.view_dish, this);
updateDish(mRootView, mDish);
}
public void setDish(Dish dish) {
mDish = dish;
updateDish(mRootView, dish);
}
private void updateDish(View rootView, Dish dish) {
if (rootView == null || dish == null)
return;
TextView textName = (TextView) rootView.findViewById(R.id.text_name);
TextView textDesc = (TextView) rootView.findViewById(R.id.text_desc);
TextView textPrice = (TextView) rootView.findViewById(R.id.text_price);
// LinearLayout layoutProps = (LinearLayout) rootView.findViewById(R.id.layout_props);
textName.setText(dish.name);
if (dish.desc == null || dish.desc.equals("")) {
textDesc.setVisibility(View.GONE);
} else {
textDesc.setText(dish.desc);
}
textPrice.setText(String.format("%2.2f €", dish.price[0]));
}
}
| noxer/mensa-berlin | app/src/main/java/net/plusmid/mensaberlin/views/DishView.java | Java | mit | 2,007 |
<?php
namespace Umpirsky\ListGenerator\Exporter;
interface ExporterInterface
{
/**
* Exports data into specific format.
*
* @param array $data
* @return string
*/
public function export(array $data);
}
| umpirsky/list-generator | src/Umpirsky/ListGenerator/Exporter/ExporterInterface.php | PHP | mit | 239 |
---
layout: post
title: Tractable classes of satisfiability problems
---
We now discuss two special cases of satisfiability problems that can be
solved in polynomial time, Horn SAT and 2-SAT. These problems define
subclasses of general CNF formulas which satisfy some specific
structure. By restricting the expressive power of the language, these
subclasses of problems become easier to solve. The algorithms for
solving these problems are essentially based on unit propagation.
## Horn SAT
We begin with the relevant definitions for a Horn formula:
- A literal is a positive literal if it is some variable. A literal is
a negative literal if it is the negation of some variable.
- A clause is positive if all of the literals are positive. A clause
is negative if all of the literals are negative.
- A clause is Horn if it has at most one literal that is positive. For
example, the implication $$(p\land q)\Rightarrow z$$ is equivalent to
$$\neg p\lor\neg q\lor z$$ which is horn.
- A formula is Horn if it is a formula formed by the conjunction of
Horn clauses. For example, the formula
$${\left(\neg p\lor\neg q\lor z\right)}\land{\left(q\lor\neg z\right)}$$
is Horn while
$${\left(\neg p\lor q\lor z\right)}\land{\left(q\lor\neg z\right)}$$
is not Horn.
**Lemma**: Let $$S$$ be a set of unsatisfiable clauses. Then $$S$$ contains
at least one positive clause and one negative clause.
***Proof***: Suppose that the formula contains no positive clause. Then
every clause contains at least one negative literal. We can satisfy the
formula with a truth assignment that assigns false to all of the
variables.
**Theorem**: Let $$S$$ be a set of Horn clauses. Let $$S'$$ be the set of
clauses obtained by running unit propagation on $$S$$. Then $$S'$$ is
satisfiable if and only if the empty clause does not belong to $$S'$$.
***Proof*** ($$\Rightarrow$$): If the empty clause belongs to $$S'$$, then
$$S'$$ cannot be satisfiable because unit propagation is sound.
***Proof*** ($$\Leftarrow$$): If $$S$$ is horn, then $$S'$$ is also horn.
Assume $$S'$$ is unsatisfiable. By Lemma 1, $$S'$$ contains at least 1
positive clause and 1 negative clause. A clause that is both positive
and horn must either be a unit clause or an empty clause. We cannot
derive a unit clause since we’ve run unit propagation until a fixed
point, so there must exist an empty clause.
## 2-SAT
A formula is in k-CNF if it is in CNF and each clause has at most k
literals. For example, the formula
$${\left(p\lor q\right)}\land{\left(r\lor s\right)}$$ is in 2-CNF while
$${\left(p\lor q\right)}\land{\left(r\lor s\lor t\right)}$$ is not in
2-CNF. The following algorithm can be used to determine the
satisfiability of a 2-CNF formula in polynomial time.
1. \$${\Gamma}\leftarrow KB$$
2. while $${\Gamma}$$ is not empty do:
1. \$$L\leftarrow\text{pick a literal from }{\Gamma}$$
2. \$${\Delta}\leftarrow\text{UP}({\Gamma},L)$$
3. if $$\{\}\in{\Delta}$$ then
1. \$${\Delta}\leftarrow\text{UP}({\Gamma},\neg L)$$
2. if $$\{\}\in{\Delta}$$ then return unsatisfiable
4. \$${\Gamma}\leftarrow{\Delta}$$
3. Return satisfiable
**Lemma**: If $${\Gamma}$$ is a 2-CNF formula in which the literal $$L$$
occurs, then either:
1. UP$$(\Gamma,L)$$ contains the empty clause $$\{\}$$, so
$${\Gamma}\models\neg L$$.
2. UP$$(\Gamma,L)$$ is a proper subset of $${\Gamma}$$.
***Proof***: For each clause, we consider one of the three cases.
1. If the clause contains $$L$$, then the clause is satisfied.
2. If the clause contains $$\neg L$$, then this clause becomes a unit
clause and unit propagation is triggered.
3. Otherwise, the clause remains unchanged.
***Proof of correctness*** ($$\Rightarrow$$): If the algorithm returns
satisfiable, the formula is satisfiable since the algorithm relies on
unit propagation and branching.
***Proof of correctness*** ($$\Leftarrow$$): Consider the formula
$${\Gamma}$$ at the beginning of the iteration in which we return
unsatisfiable. Since $${\Gamma}$$ is a 2-CNF formula,
$${\Gamma}\subseteq KB$$ (meaning the set of clauses in $${\Gamma}$$ is
always a subset of the clauses in $$KB$$ ), so if $${\Gamma}$$ is
unsatisfiable, then $$KB$$ is unsatisfiable. We know that both
$${\Gamma}\land L$$ and $${\Gamma}\land\neg L$$ are unsatisfiable. This
implies that $${\Gamma}$$ is unsatisfiable, so $$KB$$ is unsatisfiable.
| mhzhu1/cs323-notes | logic/tractable/index.md | Markdown | mit | 4,428 |
---
layout: post
title: "An Effective Software Developer"
date: 2016-01-01 12:00:00
last_modified_at: 2016-01-01 12:00:00
excerpt: "Giordano Scalzo is a software developer with more than 20 years of experience..."
categories: personal
tags: personal
image:
feature: giordanoscalzo-cover.jpg
topPosition: 0px
bgContrast: dark
bgGradientOpacity: darker
syntaxHighlighter: no
---
<blockquote class="u--startsWithDoubleQuote">"Effective: from Latin effectivus, from efficere 'accomplish'.
Successful in producing a desired or intended result - Oxford Dictionary of English</blockquote>
#### About
As it 's hard to describe yourself, I think the best way to define myself is "*effective software developer*."
**I'm pragmatic, not dogmatic**: too often an experienced developer tends to follow rules or best practices without asking himself if they are effective or not. Although I'm a long time Agile practitioner, I'm ready to put some practices aside if this helps to reach the goal quicker. I usually keep the practices that contribute to reducing the time to get feedback, like continuous integration, build automation, etc., but I don't follow any more vanity metrics like code coverage or the number of tests: wrong or evil, too many tests are an anti-pattern exactly like no tests.
**I know how to research for answers**: it's not just know how to use Google or Stack Overflow, but knowing how to find the root cause of a problem, how to spot similar patterns in a problem I already solved. Most problems, or features to implement, are situational, and you cannot rely on forums or brute force solution, but you need to have enough experience to find the best way to solve them.
**I have passion**: although the passion is not value for my clients, I couldn't be at the top of my profession if I wouldn't love my job.
Since I was a kid programming with my **ZXSpectrum**, I'm excited about building programs, learning new technologies, solving problems. When I focus on a challenge, I abandon all other my priorities, and I'm truly into that problem: it doesn't matter, if it is a client work, a personal pet project, if I'm in the office, or in a crowded tube, I **must** finish it!
**I'm leaving my ego at the door**: when working in a team, I'm pursuing the goal of having a very efficient team, and even if I'm the most experienced team member, I give other team members the opportunity to learn, experiment, fail, and eventually succeed: my goal is to increase the capacity of the team. Doing everything by myself, although it could be faster in the short term, is not sustainable in the long term, and it is, of course, disrespecting for the other members of the team.
#### Achievements
* I've written two books on Swift: [Swift by Example](https://www.packtpub.com/application-development/swift-example) and [Swift 2 by Example](http://swift-by-example.com):
<div class="img img--fullContainer img--16xLeading" style="background-image: url({{ site.baseurl_posts_img }}swiftbyexamplebooks.png);"></div>
* I've implemented a Flappy Bird in Swift the same day Apple released it:
<iframe src="//www.slideshare.net/slideshow/embed_code/key/6iDH7iR8k0JDec" width="595" height="485" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" style="border:1px solid #CCC; border-width:1px; margin-bottom:5px; max-width: 100%;" allowfullscreen> </iframe> <div style="margin-bottom:5px"> <strong> <a href="//www.slideshare.net/giordano/how-to-clone-flappy-bird-in-swift" title="How to Clone Flappy Bird in Swift" target="_blank">How to Clone Flappy Bird in Swift</a> </strong> from <strong><a target="_blank" href="//www.slideshare.net/giordano">Giordano Scalzo</a></strong> </div>
* I've implemented the software for hardware devices actually sold in Apple Stores:
<div class="img img--fullContainer img--14xLeading" style="background-image: url({{ site.baseurl_posts_img }}plus-weather.jpg);"></div>
* I swiftly relocated from Italy to London with my wife and two kids in less than a week.
#### Visual Resume
I really enjoy to do presentation, and I think that presenting yourself using a visual way is more engaging than a dry CV:
<iframe src="//www.slideshare.net/slideshow/embed_code/key/csqg1JS11sQXgr" width="595" height="485" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" style="border:1px solid #CCC; border-width:1px; margin-bottom:5px; max-width: 100%;" allowfullscreen> </iframe> <div style="margin-bottom:5px"> <strong> <a href="//www.slideshare.net/giordano/10-minutes-of-me-giordano-scalzos-visual-resume" title="10 minutes of me: Giordano Scalzo's Visual Resume" target="_blank">10 minutes of me: Giordano Scalzo's Visual Resume</a> </strong> from <strong><a target="_blank" href="//www.slideshare.net/giordano">Giordano Scalzo</a></strong> </div>
| gscalzo/gscalzo.github.io | _posts/2016-01-01-an-effective-software-developer.markdown | Markdown | mit | 4,819 |
using System;
using System.Reflection;
namespace NuSelfUpdate
{
public class EntryAssemblyAppVersionProvider : IAppVersionProvider
{
public Version CurrentVersion
{
get { return Assembly.GetEntryAssembly().GetName().Version; }
}
}
} | caleb-vear/NuSelfUpdate | src/NuSelfUpdate/EntryAssemblyAppVersionProvider.cs | C# | mit | 296 |
<body class="hold-transition skin-blue sidebar-mini sidebar-collapse">
<!-- CSS Pedido -->
<link rel="stylesheet" href="<?= base_url('assets/css/pedido.css') ?>">
<!-- JS Pedido -->
<script src="<?= base_url('scripts/js/pedido.js?cache=') . time() ?>"></script>
<div class="wrapper">
<!-- Menu -->
<?php if ($this->session->userdata('user_vt')): ?>
<?php require_once(APPPATH . '/views/menu_vt.php'); ?>
<?php else: ?>
<?php require_once(APPPATH . '/views/menu_client.php'); ?>
<?php endif; ?>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
Gerar Pedidos
</h1>
<ol class="breadcrumb">
<li>
<a href="<?= base_url('./main/dashboard') ?>"><i class="fa fa-dashboard"></i> Dashboard</a>
</li>
<li>
<a href="<?= base_url('./pedido') ?>"><i class="fa fa-list" aria-hidden="true"></i> Pedidos</a>
</li>
<li class="active">Solicitar</li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-xs-12">
<div class="container-fluid box box-primary" id="box-frm-pedido">
<div class="box-header with-border">
<span class="text-danger">*</span> Campo com preenchimento obrigatório
</div>
<form role="form" name="frm_cad_pedido" id="frm_cad_pedido">
<div class="box-body">
<div class="form-group">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-10 col-lg-10">
<label for="id_empresa">CNPJ - Razão Social<span class="text-danger">*</span></label>
<div class="controls">
<select class="form-control" name="id_empresa" id="id_empresa" required="true">
<?php
if (is_array($empresa)):
foreach ($empresa as $value):
echo "<option value='$value->id_empresa_pk'>$value->cnpj - $value->nome_razao</option>";
endforeach;
endif;
?>
</select>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-10 col-lg-10">
<label for="id_end_entrega">Endereço para Entrega<span class="text-danger">*</span></label>
<div class="controls">
<select class="form-control" name="id_end_entrega" id="id_end_entrega" required="true">
<option value="">Selecione</option>
<?php
if (is_array($end_entrega)):
foreach ($end_entrega as $value):
echo "<option value='$value->id_endereco_empresa_pk' selected='selected'>$value->logradouro, nº $value->numero, $value->bairro - CEP: $value->cep</option>";
endforeach;
endif;
?>
</select>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-10 col-lg-10">
<label for="nome_resp">Nome do Responsável<span class="text-danger">*</span></label>
<div class="controls">
<input type="text" class="form-control" id="nome_resp" name="nome_resp" placeholder="Nome do Responsável" maxlength="250" value="<?= isset($empresa[0]->resp_recebimento) ? $empresa[0]->resp_recebimento : '' ?>" required="true">
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-xs-12 col-sm-10 col-md-8 col-lg-6">
<label for="id_periodo">Período<span class="text-danger">*</span></label>
<div class="controls">
<select class="form-control" name="id_periodo" id="id_periodo">
<option value="">Todos</option>
<?php
if (is_array($periodo)):
foreach ($periodo as $value):
echo "<option value='$value->id_periodo_pk'>$value->periodo</option>";
endforeach;
endif;
?>
</select>
</div>
<p class="help-block danger">
Selecione se for gerar o pedido para outro período
</p>
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-xs-12 col-sm-10 col-md-8 col-lg-6">
<label for="id_depto">Departamento<span class="text-danger">*</span></label>
<div class="controls">
<select class="form-control" name="id_depto" id="id_depto">
<option value="">Todos</option>
<?php
if (is_array($deptos)):
foreach ($deptos as $value):
echo "<option value='$value->id_departamento_pk'>$value->departamento</option>";
endforeach;
endif;
?>
</select>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-xs-9 col-sm-5 col-md-5 col-lg-4">
<label for="dt_pgto">Data de Pagamento<span class="text-danger">*</span></label>
<div class="controls">
<div class="input-group">
<div class="input-group-addon">
<i class="fa fa-calendar"></i>
</div>
<input type="text" class="datepicker form-control" data-date-format="dd/mm/yyyy" name="dt_pgto" id="dt_pgto" placeholder="dd/mm/aaaa" value="" maxlength="10" readonly required="true">
</div>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-xs-12 col-sm-10 col-md-8 col-lg-6">
<label for="periodo">Período de Utilização<span class="text-danger">*</span></label>
<div class="controls">
<div class="input-group">
<div class="input-group-addon">
<i class="fa fa-calendar"></i>
</div>
<input type="text" class="form-control" name="periodo" id="periodo" placeholder="dd/mm/aaaa - dd/mm/aaaa" value="" maxlength="23" readonly required="true">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="box-footer">
<button type="submit" id="btn_cad_pedido" name="btn_cad_pedido" class="btn btn-success">Prosseguir</button>
<button type="reset" id="limpar" name="limpar" class="btn btn-primary">Limpar</button>
</div>
</form>
</div>
</div>
</div>
</section>
</div>
<!-- /.content-wrapper -->
<!-- Main Footer -->
<?php require_once(APPPATH . '/views/main_footer.php'); ?>
</div>
| willfreire/gerenciador | application/views/pedido/pedido_solicitar.php | PHP | mit | 12,100 |
/*
* Qt4 bitcoin GUI.
*
* W.J. van der Laan 2011-2012
* The Bitcoin Developers 2011-2012
*/
#include "bitcoingui.h"
#include "transactiontablemodel.h"
#include "addressbookpage.h"
#include "messagepage.h"
#include "sendcoinsdialog.h"
#include "signverifymessagedialog.h"
#include "optionsdialog.h"
#include "aboutdialog.h"
#include "clientmodel.h"
#include "walletmodel.h"
#include "messagemodel.h"
#include "editaddressdialog.h"
#include "optionsmodel.h"
#include "transactiondescdialog.h"
#include "addresstablemodel.h"
#include "transactionview.h"
#include "overviewpage.h"
#include "statisticspage.h"
#include "blockbrowser.h"
#include "marketbrowser.h"
#include "masternodemanager.h"
#include "darksend.h"
#include "mintingview.h"
#include "multisigdialog.h"
#include "bitcoinunits.h"
#include "guiconstants.h"
#include "askpassphrasedialog.h"
#include "notificator.h"
#include "guiutil.h"
#include "rpcconsole.h"
#include "wallet.h"
#ifdef Q_OS_MAC
#include "macdockiconhandler.h"
#endif
#include <QApplication>
#include <QMainWindow>
#include <QMenuBar>
#include <QMenu>
#include <QIcon>
#include <QTabWidget>
#include <QVBoxLayout>
#include <QToolBar>
#include <QStatusBar>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QLocale>
#include <QMessageBox>
#include <QMimeData>
#include <QProgressBar>
#include <QStackedWidget>
#include <QDateTime>
#include <QMovie>
#include <QFileDialog>
#include <QDesktopServices>
#include <QTimer>
#include <QDragEnterEvent>
#include <QUrl>
#include <QStyle>
#include <QStyleFactory>
#include <QTextStream>
#include <QTextDocument>
#include <iostream>
extern CWallet* pwalletMain;
extern int64_t nLastCoinStakeSearchInterval;
double GetPoSKernelPS();
#define VERTICAL_TOOBAR_STYLESHEET "QToolBar {\
border:none;\
height:100%;\
padding-top:20px;\
text-align: left;\
}\
QToolButton {\
min-width:180px;\
background-color: transparent;\
border: 1px solid #707070;\
border-radius: 3px;\
margin: 3px;\
padding-left: 5px;\
/*padding-right:50px;*/\
padding-top:5px;\
width:100%;\
text-align: left;\
padding-bottom:5px;\
}\
QToolButton:pressed {\
background-color: #31363B;\
border: 1px solid silver;\
}\
QToolButton:hover {\
background-color: #31363B;\
border: 1px solid #707070;\
}"
#define HORIZONTAL_TOOLBAR_STYLESHEET "QToolBar {\
border: 1px solid #707070;\
background: 1px solid #31363B;\
font-weight: bold;\
}"
ActiveLabel::ActiveLabel(const QString & text, QWidget * parent):
QLabel(parent){}
void ActiveLabel::mouseReleaseEvent(QMouseEvent * event)
{
emit clicked();
}
BitcoinGUI::BitcoinGUI(QWidget *parent):
QMainWindow(parent),
clientModel(0),
walletModel(0),
encryptWalletAction(0),
changePassphraseAction(0),
unlockWalletAction(0),
lockWalletAction(0),
aboutQtAction(0),
trayIcon(0),
notificator(0),
rpcConsole(0),
nWeight(0),
prevBlocks(0),
spinnerFrame(0),
nBlocksInLastPeriod(0),
nLastBlocks(0)
{
resize(1300, 400);
setWindowTitle(tr("Bzlcoin") + " - " + tr("Wallet"));
#ifndef Q_OS_MAC
qApp->setWindowIcon(QIcon(":icons/bzlcoin"));
setWindowIcon(QIcon(":icons/bzlcoin"));
#else
setUnifiedTitleAndToolBarOnMac(true);
QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
// TODO: Theme switching :)
QFile f(":qdarkstyle/style.qss");
if (f.exists())
{
f.open(QFile::ReadOnly | QFile::Text);
QTextStream ts(&f);
qApp->setStyleSheet(ts.readAll());
}
else
QApplication::setStyle(QStyleFactory::create("Fusion"));
// Accept D&D of URIs
setAcceptDrops(true);
// Create actions for the toolbar, menu bar and tray/dock icon
createActions();
// Create application menu bar
createMenuBar();
// Create the toolbars
createToolBars();
// Create the tray icon (or setup the dock icon)
createTrayIcon();
// Create tabs
overviewPage = new OverviewPage();
statisticsPage = new StatisticsPage(this);
blockBrowser = new BlockBrowser(this);
marketBrowser = new MarketBrowser(this);
multisigPage = new MultisigDialog(this);
//chatWindow = new ChatWindow(this);
transactionsPage = new QWidget(this);
QVBoxLayout *vbox = new QVBoxLayout();
transactionView = new TransactionView(this);
vbox->addWidget(transactionView);
transactionsPage->setLayout(vbox);
mintingPage = new QWidget(this);
QVBoxLayout *vboxMinting = new QVBoxLayout();
mintingView = new MintingView(this);
vboxMinting->addWidget(mintingView);
mintingPage->setLayout(vboxMinting);
addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);
receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab);
sendCoinsPage = new SendCoinsDialog(this);
messagePage = new MessagePage(this);
masternodeManagerPage = new MasternodeManager(this);
signVerifyMessageDialog = new SignVerifyMessageDialog(this);
centralWidget = new QStackedWidget(this);
centralWidget->addWidget(overviewPage);
centralWidget->addWidget(transactionsPage);
centralWidget->addWidget(mintingPage);
centralWidget->addWidget(addressBookPage);
centralWidget->addWidget(receiveCoinsPage);
centralWidget->addWidget(sendCoinsPage);
centralWidget->addWidget(messagePage);
centralWidget->addWidget(statisticsPage);
centralWidget->addWidget(blockBrowser);
centralWidget->addWidget(masternodeManagerPage);
centralWidget->addWidget(marketBrowser);
//centralWidget->addWidget(chatWindow);
setCentralWidget(centralWidget);
// Create status bar
statusBar();
// Status bar notification icons
QFrame *frameBlocks = new QFrame();
frameBlocks->setContentsMargins(0,0,0,0);
frameBlocks->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
frameBlocksLayout->setContentsMargins(3,0,3,0);
frameBlocksLayout->setSpacing(3);
labelEncryptionIcon = new ActiveLabel();
labelStakingIcon = new QLabel();
labelConnectionsIcon = new QLabel();
labelBlocksIcon = new QLabel();
frameBlocksLayout->addStretch();
frameBlocksLayout->addWidget(labelEncryptionIcon);
frameBlocksLayout->addStretch();
frameBlocksLayout->addWidget(labelStakingIcon);
frameBlocksLayout->addStretch();
frameBlocksLayout->addWidget(labelConnectionsIcon);
frameBlocksLayout->addStretch();
frameBlocksLayout->addWidget(labelBlocksIcon);
frameBlocksLayout->addStretch();
if (GetBoolArg("-staking", true))
{
QTimer *timerStakingIcon = new QTimer(labelStakingIcon);
connect(timerStakingIcon, SIGNAL(timeout()), this, SLOT(updateStakingIcon()));
timerStakingIcon->start(30 * 1000);
updateStakingIcon();
}
connect(labelEncryptionIcon, SIGNAL(clicked()), unlockWalletAction, SLOT(trigger()));
// Progress bar and label for blocks download
progressBarLabel = new QLabel();
progressBarLabel->setVisible(false);
progressBar = new QProgressBar();
progressBar->setAlignment(Qt::AlignCenter);
progressBar->setVisible(false);
// Override style sheet for progress bar for styles that have a segmented progress bar,
// as they make the text unreadable (workaround for issue #1071)
// See https://qt-project.org/doc/qt-4.8/gallery.html
QString curStyle = qApp->style()->metaObject()->className();
if(curStyle == "QWindowsStyle" || curStyle == "QWindowsXPStyle")
{
progressBar->setStyleSheet("QProgressBar { background-color: #e8e8e8; border: 1px solid grey; border-radius: 7px; padding: 1px; text-align: center; } QProgressBar::chunk { background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #FF8000, stop: 1 orange); border-radius: 7px; margin: 0px; }");
}
statusBar()->addWidget(progressBarLabel);
statusBar()->addWidget(progressBar);
statusBar()->addPermanentWidget(frameBlocks);
// Clicking on a transaction on the overview page simply sends you to transaction history page
connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage()));
connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex)));
// Double-clicking on a transaction on the transaction history page shows details
connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));
rpcConsole = new RPCConsole(this);
connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));
// Clicking on "Verify Message" in the address book sends you to the verify message tab
connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString)));
// Clicking on "Sign Message" in the receive coins page sends you to the sign message tab
connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString)));
gotoOverviewPage();
}
BitcoinGUI::~BitcoinGUI()
{
if(trayIcon) // Hide tray icon, as deleting will let it linger until quit (on Ubuntu)
trayIcon->hide();
#ifdef Q_OS_MAC
delete appMenuBar;
#endif
}
void BitcoinGUI::createActions()
{
QActionGroup *tabGroup = new QActionGroup(this);
overviewAction = new QAction(QIcon(":/icons/overview"), tr("&Overview"), this);
overviewAction->setToolTip(tr("Show general overview of wallet"));
overviewAction->setCheckable(true);
overviewAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_1));
tabGroup->addAction(overviewAction);
statisticsAction = new QAction(QIcon(":/icons/statistics"), tr("&Statistics"), this);
statisticsAction->setToolTip(tr("View statistics"));
statisticsAction->setCheckable(true);
tabGroup->addAction(statisticsAction);
blockAction = new QAction(QIcon(":/icons/block"), tr("&Block Explorer"), this);
blockAction->setToolTip(tr("Explore the Bzlcoin Blockchain"));
blockAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_6));
blockAction->setCheckable(true);
tabGroup->addAction(blockAction);
marketAction = new QAction(QIcon(":/icons/mark"), tr("&Market"), this);
marketAction->setToolTip(tr("Market Data"));
marketAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_7));
marketAction->setCheckable(true);
tabGroup->addAction(marketAction);
//chatAction = new QAction(QIcon(":/icons/msg"), tr("&Social"), this);
//chatAction->setToolTip(tr("View chat"));
//chatAction->setCheckable(true);
//tabGroup->addAction(chatAction);
sendCoinsAction = new QAction(QIcon(":/icons/send"), tr("&Send coins"), this);
sendCoinsAction->setToolTip(tr("Send coins to a Bzlcoin address"));
sendCoinsAction->setCheckable(true);
sendCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_2));
tabGroup->addAction(sendCoinsAction);
receiveCoinsAction = new QAction(QIcon(":/icons/receiving_addresses"), tr("&Receive coins"), this);
receiveCoinsAction->setToolTip(tr("Show the list of addresses for receiving payments"));
receiveCoinsAction->setCheckable(true);
receiveCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_3));
tabGroup->addAction(receiveCoinsAction);
historyAction = new QAction(QIcon(":/icons/history"), tr("&Transactions"), this);
historyAction->setToolTip(tr("Browse transaction history"));
historyAction->setCheckable(true);
historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4));
tabGroup->addAction(historyAction);
addressBookAction = new QAction(QIcon(":/icons/address-book"), tr("&Address Book"), this);
addressBookAction->setToolTip(tr("Edit the list of stored addresses and labels"));
addressBookAction->setCheckable(true);
addressBookAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_5));
tabGroup->addAction(addressBookAction);
messageAction = new QAction(QIcon(":/icons/msg"), tr("&Messages"), this);
messageAction->setToolTip(tr("View and Send Encrypted messages"));
messageAction->setCheckable(true);
messageAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_8));
tabGroup->addAction(messageAction);
mintingAction = new QAction(QIcon(":/icons/stake"), tr("&Staking"), this);
mintingAction->setToolTip(tr("Show your staking capacity"));
mintingAction->setCheckable(true);
mintingAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_9));
tabGroup->addAction(mintingAction);
masternodeManagerAction = new QAction(QIcon(":/icons/mn"), tr("&Masternodes"), this);
masternodeManagerAction->setToolTip(tr("Show Bzlcoin Masternodes status and configure your nodes."));
masternodeManagerAction->setCheckable(true);
tabGroup->addAction(masternodeManagerAction);
multisigAction = new QAction(QIcon(":/icons/multi"), tr("Multisig"), this);
tabGroup->addAction(multisigAction);
connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage()));
connect(blockAction, SIGNAL(triggered()), this, SLOT(gotoBlockBrowser()));
connect(statisticsAction, SIGNAL(triggered()), this, SLOT(gotoStatisticsPage()));
connect(marketAction, SIGNAL(triggered()), this, SLOT(gotoMarketBrowser()));
//connect(chatAction, SIGNAL(triggered()), this, SLOT(gotoChatPage()));
connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage()));
connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage()));
connect(mintingAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(mintingAction, SIGNAL(triggered()), this, SLOT(gotoMintingPage()));
connect(masternodeManagerAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(masternodeManagerAction, SIGNAL(triggered()), this, SLOT(gotoMasternodeManagerPage()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage()));
connect(addressBookAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(addressBookAction, SIGNAL(triggered()), this, SLOT(gotoAddressBookPage()));
connect(messageAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(messageAction, SIGNAL(triggered()), this, SLOT(gotoMessagePage()));
connect(multisigAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(multisigAction, SIGNAL(triggered()), this, SLOT(gotoMultisigPage()));
quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this);
quitAction->setToolTip(tr("Quit application"));
quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q));
quitAction->setMenuRole(QAction::QuitRole);
aboutAction = new QAction(QIcon(":/icons/bitcoin"), tr("&About Bzlcoin"), this);
aboutAction->setToolTip(tr("Show information about Bzlcoin"));
aboutAction->setMenuRole(QAction::AboutRole);
aboutQtAction = new QAction(QIcon(":/trolltech/qmessagebox/images/qtlogo-64.png"), tr("About &Qt"), this);
aboutQtAction->setToolTip(tr("Show information about Qt"));
aboutQtAction->setMenuRole(QAction::AboutQtRole);
optionsAction = new QAction(QIcon(":/icons/options"), tr("&Options..."), this);
optionsAction->setToolTip(tr("Modify configuration options for Bzlcoin"));
optionsAction->setMenuRole(QAction::PreferencesRole);
toggleHideAction = new QAction(QIcon(":/icons/bitcoin"), tr("&Show / Hide"), this);
encryptWalletAction = new QAction(QIcon(":/icons/lock_closed"), tr("&Encrypt Wallet..."), this);
encryptWalletAction->setToolTip(tr("Encrypt or decrypt wallet"));
encryptWalletAction->setCheckable(true);
backupWalletAction = new QAction(QIcon(":/icons/filesave"), tr("&Backup Wallet..."), this);
backupWalletAction->setToolTip(tr("Backup wallet to another location"));
changePassphraseAction = new QAction(QIcon(":/icons/key"), tr("&Change Passphrase..."), this);
changePassphraseAction->setToolTip(tr("Change the passphrase used for wallet encryption"));
unlockWalletAction = new QAction(QIcon(":/icons/lock_open"), tr("&Unlock Wallet..."), this);
unlockWalletAction->setToolTip(tr("Unlock wallet"));
lockWalletAction = new QAction(QIcon(":/icons/lock_closed"), tr("&Lock Wallet"), this);
lockWalletAction->setToolTip(tr("Lock wallet"));
signMessageAction = new QAction(QIcon(":/icons/edit"), tr("Sign &message..."), this);
verifyMessageAction = new QAction(QIcon(":/icons/transaction_0"), tr("&Verify message..."), this);
exportAction = new QAction(QIcon(":/icons/export"), tr("&Export..."), this);
exportAction->setToolTip(tr("Export the data in the current tab to a file"));
openRPCConsoleAction = new QAction(QIcon(":/icons/debugwindow"), tr("&Debug window"), this);
openRPCConsoleAction->setToolTip(tr("Open debugging and diagnostic console"));
openInfoAction = new QAction(QApplication::style()->standardIcon(QStyle::SP_MessageBoxInformation), tr("&Information"), this);
openInfoAction->setStatusTip(tr("Show diagnostic information"));
openGraphAction = new QAction(QIcon(":/icons/connect_4"), tr("&Network Monitor"), this);
openGraphAction->setStatusTip(tr("Show network monitor"));
openConfEditorAction = new QAction(QIcon(":/icons/edit"), tr("Open Wallet &Configuration File"), this);
openConfEditorAction->setStatusTip(tr("Open configuration file"));
openMNConfEditorAction = new QAction(QIcon(":/icons/edit"), tr("Open &Masternode Configuration File"), this);
openMNConfEditorAction->setStatusTip(tr("Open Masternode configuration file"));
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
connect(aboutAction, SIGNAL(triggered()), this, SLOT(aboutClicked()));
connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
connect(optionsAction, SIGNAL(triggered()), this, SLOT(optionsClicked()));
connect(toggleHideAction, SIGNAL(triggered()), this, SLOT(toggleHidden()));
connect(encryptWalletAction, SIGNAL(triggered(bool)), this, SLOT(encryptWallet(bool)));
connect(backupWalletAction, SIGNAL(triggered()), this, SLOT(backupWallet()));
connect(changePassphraseAction, SIGNAL(triggered()), this, SLOT(changePassphrase()));
connect(unlockWalletAction, SIGNAL(triggered()), this, SLOT(unlockWallet()));
connect(lockWalletAction, SIGNAL(triggered()), this, SLOT(lockWallet()));
connect(signMessageAction, SIGNAL(triggered()), this, SLOT(gotoSignMessageTab()));
connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(gotoVerifyMessageTab()));
// Jump directly to tabs in RPC-console
connect(openInfoAction, SIGNAL(triggered()), this, SLOT(showInfo()));
connect(openRPCConsoleAction, SIGNAL(triggered()), this, SLOT(showConsole()));
connect(openGraphAction, SIGNAL(triggered()), this, SLOT(showGraph()));
// Open configs from menu
connect(openConfEditorAction, SIGNAL(triggered()), this, SLOT(showConfEditor()));
connect(openMNConfEditorAction, SIGNAL(triggered()), this, SLOT(showMNConfEditor()));
}
void BitcoinGUI::createMenuBar()
{
#ifdef Q_OS_MAC
// Create a decoupled menu bar on Mac which stays even if the window is closed
appMenuBar = new QMenuBar();
#else
// Get the main window's menu bar on other platforms
appMenuBar = menuBar();
#endif
// Configure the menus
QMenu *file = appMenuBar->addMenu(tr("&File"));
file->addAction(exportAction);
file->addAction(multisigAction);
file->addAction(signMessageAction);
file->addAction(verifyMessageAction);
file->addSeparator();
file->addAction(quitAction);
QMenu *settings = appMenuBar->addMenu(tr("&Settings"));
settings->addAction(encryptWalletAction);
settings->addAction(backupWalletAction);
settings->addAction(changePassphraseAction);
settings->addAction(unlockWalletAction);
settings->addAction(lockWalletAction);
settings->addSeparator();
settings->addAction(optionsAction);
QMenu *tools = appMenuBar->addMenu(tr("&Tools"));
tools->addAction(openInfoAction);
tools->addAction(openRPCConsoleAction);
tools->addAction(openGraphAction);
tools->addSeparator();
tools->addAction(openConfEditorAction);
tools->addAction(openMNConfEditorAction);
QMenu *help = appMenuBar->addMenu(tr("&Help"));
help->addAction(openRPCConsoleAction);
help->addSeparator();
help->addAction(aboutAction);
help->addAction(aboutQtAction);
}
void BitcoinGUI::createToolBars()
{
mainIcon = new QLabel (this);
mainIcon->setPixmap(QPixmap(":images/vertical"));
mainIcon->show();
mainToolbar = addToolBar(tr("Tabs toolbar"));
mainToolbar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
mainToolbar->addWidget(mainIcon);
mainToolbar->addAction(overviewAction);
mainToolbar->addAction(sendCoinsAction);
mainToolbar->addAction(receiveCoinsAction);
mainToolbar->addAction(historyAction);
mainToolbar->addAction(mintingAction);
mainToolbar->addAction(addressBookAction);
mainToolbar->addAction(messageAction);
mainToolbar->addAction(statisticsAction);
mainToolbar->addAction(blockAction);
mainToolbar->addAction(masternodeManagerAction);
mainToolbar->addAction(marketAction);
secondaryToolbar = addToolBar(tr("Actions toolbar"));
secondaryToolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
secondaryToolbar->addAction(exportAction);
secondaryToolbar->addSeparator();
secondaryToolbar->addAction(openRPCConsoleAction);
secondaryToolbar->addAction(openGraphAction);
secondaryToolbar->addSeparator();
secondaryToolbar->addAction(lockWalletAction);
secondaryToolbar->addAction(unlockWalletAction);
secondaryToolbar->addAction(encryptWalletAction);
secondaryToolbar->addAction(changePassphraseAction);
secondaryToolbar->addSeparator();
removeToolBar(secondaryToolbar);
addToolBar(Qt::BottomToolBarArea, secondaryToolbar);
secondaryToolbar->show();
connect(mainToolbar, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(mainToolbarOrientation(Qt::Orientation)));
connect(secondaryToolbar, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(secondaryToolbarOrientation(Qt::Orientation)));
mainToolbarOrientation(mainToolbar->orientation());
secondaryToolbarOrientation(secondaryToolbar->orientation());
}
/*void BitcoinGUI::checkTOU()
{
bool agreed_to_tou = false;
boost::filesystem::path pathDebug = GetDataDir() / ".agreed_to_tou";
if (FILE *file = fopen(pathDebug.string().c_str(), "r")) {
file=file;
fclose(file);
agreed_to_tou = true;
}
if(!agreed_to_tou){
TermsOfUse dlg(this);
dlg.exec();
}
}
*/
void BitcoinGUI::setClientModel(ClientModel *clientModel)
{
this->clientModel = clientModel;
if(clientModel)
{
// Replace some strings and icons, when using the testnet
if(clientModel->isTestNet())
{
setWindowTitle(windowTitle() + QString(" ") + tr("[testnet]"));
#ifndef Q_OS_MAC
qApp->setWindowIcon(QIcon(":icons/bitcoin_testnet"));
setWindowIcon(QIcon(":icons/bitcoin_testnet"));
#else
MacDockIconHandler::instance()->setIcon(QIcon(":icons/bitcoin_testnet"));
#endif
if(trayIcon)
{
trayIcon->setToolTip(tr("Bzlcoin client") + QString(" ") + tr("[testnet]"));
trayIcon->setIcon(QIcon(":/icons/toolbar_testnet"));
toggleHideAction->setIcon(QIcon(":/icons/toolbar_testnet"));
}
aboutAction->setIcon(QIcon(":/icons/toolbar_testnet"));
}
// Keep up to date with client
setNumConnections(clientModel->getNumConnections());
connect(clientModel, SIGNAL(numConnectionsChanged(int)), this, SLOT(setNumConnections(int)));
nClientUpdateTime = GetTime();
setNumBlocks(clientModel->getNumBlocks(), clientModel->getNumBlocksOfPeers());
connect(clientModel, SIGNAL(numBlocksChanged(int,int)), this, SLOT(setNumBlocks(int,int)));
// Report errors from network/worker thread
connect(clientModel, SIGNAL(error(QString,QString,bool)), this, SLOT(error(QString,QString,bool)));
rpcConsole->setClientModel(clientModel);
addressBookPage->setOptionsModel(clientModel->getOptionsModel());
receiveCoinsPage->setOptionsModel(clientModel->getOptionsModel());
}
}
void BitcoinGUI::setWalletModel(WalletModel *walletModel)
{
this->walletModel = walletModel;
if(walletModel)
{
// Report errors from wallet thread
connect(walletModel, SIGNAL(error(QString,QString,bool)), this, SLOT(error(QString,QString,bool)));
// Put transaction list in tabs
transactionView->setModel(walletModel);
mintingView->setModel(walletModel);
overviewPage->setModel(walletModel);
addressBookPage->setModel(walletModel->getAddressTableModel());
receiveCoinsPage->setModel(walletModel->getAddressTableModel());
sendCoinsPage->setModel(walletModel);
signVerifyMessageDialog->setModel(walletModel);
statisticsPage->setModel(clientModel);
blockBrowser->setModel(clientModel);
marketBrowser->setModel(clientModel);
masternodeManagerPage->setWalletModel(walletModel);
multisigPage->setModel(walletModel);
//chatWindow->setModel(clientModel);
setEncryptionStatus(walletModel->getEncryptionStatus());
connect(walletModel, SIGNAL(encryptionStatusChanged(int)), this, SLOT(setEncryptionStatus(int)));
// Balloon pop-up for new transaction
connect(walletModel->getTransactionTableModel(), SIGNAL(rowsInserted(QModelIndex,int,int)),
this, SLOT(incomingTransaction(QModelIndex,int,int)));
// Ask for passphrase if needed
connect(walletModel, SIGNAL(requireUnlock()), this, SLOT(unlockWallet()));
}
}
void BitcoinGUI::setMessageModel(MessageModel *messageModel)
{
this->messageModel = messageModel;
if(messageModel)
{
// Report errors from message thread
connect(messageModel, SIGNAL(error(QString,QString,bool)), this, SLOT(error(QString,QString,bool)));
// Put transaction list in tabs
messagePage->setModel(messageModel);
// Balloon pop-up for new message
connect(messageModel, SIGNAL(rowsInserted(QModelIndex,int,int)),
this, SLOT(incomingMessage(QModelIndex,int,int)));
}
}
void BitcoinGUI::createTrayIcon()
{
QMenu *trayIconMenu;
#ifndef Q_OS_MAC
trayIcon = new QSystemTrayIcon(this);
trayIconMenu = new QMenu(this);
trayIcon->setContextMenu(trayIconMenu);
trayIcon->setToolTip(tr("Bzlcoin client"));
trayIcon->setIcon(QIcon(":/icons/toolbar"));
connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
this, SLOT(trayIconActivated(QSystemTrayIcon::ActivationReason)));
trayIcon->show();
#else
// Note: On Mac, the dock icon is used to provide the tray's functionality.
MacDockIconHandler *dockIconHandler = MacDockIconHandler::instance();
dockIconHandler->setMainWindow((QMainWindow *)this);
trayIconMenu = dockIconHandler->dockMenu();
#endif
// Configuration of the tray icon (or dock icon) icon menu
trayIconMenu->addAction(toggleHideAction);
trayIconMenu->addSeparator();
trayIconMenu->addAction(sendCoinsAction);
trayIconMenu->addAction(receiveCoinsAction);
trayIconMenu->addSeparator();
trayIconMenu->addAction(multisigAction);
trayIconMenu->addSeparator();
trayIconMenu->addAction(signMessageAction);
trayIconMenu->addAction(verifyMessageAction);
trayIconMenu->addSeparator();
trayIconMenu->addAction(optionsAction);
trayIconMenu->addAction(openRPCConsoleAction);
#ifndef Q_OS_MAC // This is built-in on Mac
trayIconMenu->addSeparator();
trayIconMenu->addAction(quitAction);
#endif
notificator = new Notificator(qApp->applicationName(), trayIcon, this);
}
#ifndef Q_OS_MAC
void BitcoinGUI::trayIconActivated(QSystemTrayIcon::ActivationReason reason)
{
if(reason == QSystemTrayIcon::Trigger)
{
// Click on system tray icon triggers show/hide of the main window
toggleHideAction->trigger();
}
}
#endif
void BitcoinGUI::optionsClicked()
{
if(!clientModel || !clientModel->getOptionsModel())
return;
OptionsDialog dlg;
dlg.setModel(clientModel->getOptionsModel());
dlg.exec();
}
void BitcoinGUI::aboutClicked()
{
AboutDialog dlg;
dlg.setModel(clientModel);
dlg.exec();
}
void BitcoinGUI::setNumConnections(int count)
{
QString icon;
switch(count)
{
case 0: icon = ":/icons/connect_0"; break;
case 1: case 2: case 3: icon = ":/icons/connect_1"; break;
case 4: case 5: case 6: icon = ":/icons/connect_2"; break;
case 7: case 8: case 9: icon = ":/icons/connect_3"; break;
default: icon = ":/icons/connect_4"; break;
}
labelConnectionsIcon->setPixmap(QIcon(icon).pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
labelConnectionsIcon->setToolTip(tr("%n active connection(s) to Bzlcoin network", "", count));
}
void BitcoinGUI::setNumBlocks(int count, int nTotalBlocks)
{
// don't bother showing anything if we have no connection to the network
if (!clientModel || clientModel->getNumConnections() == 0)
{
progressBarLabel->setText(tr("Connecting to Bzlcoin network..."));
progressBarLabel->setVisible(true);
progressBar->setVisible(false);
return;
}
QString strStatusBarWarnings = clientModel->getStatusBarWarnings();
QString tooltip;
QString nRemainingTime;
if (nLastBlocks == 0)
nLastBlocks = pindexBest->nHeight;
if (count > nLastBlocks && GetTime() - nClientUpdateTime > BPS_PERIOD) {
nBlocksInLastPeriod = count - nLastBlocks;
nLastBlocks = count;
nClientUpdateTime = GetTime();
}
if (nBlocksInLastPeriod>0)
nBlocksPerSec = nBlocksInLastPeriod / BPS_PERIOD;
else
nBlocksPerSec = 0;
if (nBlocksPerSec>0) {
nRemainingTime = QDateTime::fromTime_t((nTotalBlocks - count) / nBlocksPerSec).toUTC().toString("hh'h'mm'm'");
}
QDateTime lastBlockDate = clientModel->getLastBlockDate();
int secs = lastBlockDate.secsTo(QDateTime::currentDateTime());
QString text;
// Represent time from last generated block in human readable text
if(secs <= 0)
{
// Fully up to date. Leave text empty.
}
else if(secs < 60)
{
text = tr("%n second(s) ago","",secs);
}
else if(secs < 60*60)
{
text = tr("%n minute(s) ago","",secs/60);
}
else if(secs < 24*60*60)
{
text = tr("%n hour(s) ago","",secs/(60*60));
}
else
{
text = tr("%n day(s) ago","",secs/(60*60*24));
}
if (count < nTotalBlocks || secs > 30*30)
{
int nRemainingBlocks = nTotalBlocks - count;
float nPercentageDone = count / (nTotalBlocks * 0.01f);
if (strStatusBarWarnings.isEmpty())
{
progressBarLabel->setText(tr("Synchronizing with network..."));
progressBarLabel->setVisible(true);
if (nBlocksPerSec>0)
progressBar->setFormat(tr("~%1 block(s) remaining (est: %2 at %3 blocks/sec)").arg(nRemainingBlocks).arg(nRemainingTime).arg(nBlocksPerSec));
else
progressBar->setFormat(tr("~%n block(s) remaining", "", nRemainingBlocks));
progressBar->setMaximum(nTotalBlocks);
progressBar->setValue(count);
progressBar->setVisible(true);
}
tooltip = tr("Catching up...") + QString("<br>") + tooltip;
labelBlocksIcon->setPixmap(QIcon(QString(":/movies/res/movies/spinner-%1.png").arg(spinnerFrame, 3, 10, QChar('0'))).pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
spinnerFrame = (spinnerFrame + 1) % 36;
overviewPage->showOutOfSyncWarning(true);
tooltip = tr("Downloaded %1 of %2 blocks of transaction history (%3% done).").arg(count).arg(nTotalBlocks).arg(nPercentageDone, 0, 'f', 2);
}
else
{
if (strStatusBarWarnings.isEmpty())
progressBarLabel->setVisible(false);
tooltip = tr("Up to date") + QString(".<br>") + tooltip;
labelBlocksIcon->setPixmap(QIcon(":/icons/synced").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
overviewPage->showOutOfSyncWarning(false);
progressBar->setVisible(false);
tooltip = tr("Downloaded %1 blocks of transaction history.").arg(count);
}
// Override progressBarLabel text and hide progress bar, when we have warnings to display
if (!strStatusBarWarnings.isEmpty())
{
progressBarLabel->setText(strStatusBarWarnings);
progressBarLabel->setVisible(true);
progressBar->setVisible(false);
}
if(!text.isEmpty())
{
tooltip += QString("<br>");
tooltip += tr("Last received block was generated %1.").arg(text);
}
// Don't word-wrap this (fixed-width) tooltip
tooltip = QString("<nobr>") + tooltip + QString("</nobr>");
labelBlocksIcon->setToolTip(tooltip);
progressBarLabel->setToolTip(tooltip);
progressBar->setToolTip(tooltip);
}
void BitcoinGUI::error(const QString &title, const QString &message, bool modal)
{
// Report errors from network/worker thread
if(modal)
{
QMessageBox::critical(this, title, message, QMessageBox::Ok, QMessageBox::Ok);
} else {
notificator->notify(Notificator::Critical, title, message);
}
}
void BitcoinGUI::changeEvent(QEvent *e)
{
QMainWindow::changeEvent(e);
#ifndef Q_OS_MAC // Ignored on Mac
if(e->type() == QEvent::WindowStateChange)
{
if(clientModel && clientModel->getOptionsModel()->getMinimizeToTray())
{
QWindowStateChangeEvent *wsevt = static_cast<QWindowStateChangeEvent*>(e);
if(!(wsevt->oldState() & Qt::WindowMinimized) && isMinimized())
{
QTimer::singleShot(0, this, SLOT(hide()));
e->ignore();
}
}
}
#endif
}
void BitcoinGUI::closeEvent(QCloseEvent *event)
{
if(clientModel)
{
#ifndef Q_OS_MAC // Ignored on Mac
if(!clientModel->getOptionsModel()->getMinimizeToTray() &&
!clientModel->getOptionsModel()->getMinimizeOnClose())
{
qApp->quit();
}
#endif
}
QMainWindow::closeEvent(event);
}
void BitcoinGUI::askFee(qint64 nFeeRequired, bool *payFee)
{
QString strMessage =
tr("This transaction is over the size limit. You can still send it for a fee of %1, "
"which goes to the nodes that process your transaction and helps to support the network. "
"Do you want to pay the fee?").arg(
BitcoinUnits::formatWithUnit(BitcoinUnits::BTC, nFeeRequired));
QMessageBox::StandardButton retval = QMessageBox::question(
this, tr("Confirm transaction fee"), strMessage,
QMessageBox::Yes|QMessageBox::Cancel, QMessageBox::Yes);
*payFee = (retval == QMessageBox::Yes);
}
void BitcoinGUI::incomingTransaction(const QModelIndex & parent, int start, int end)
{
if(!walletModel || !clientModel)
return;
TransactionTableModel *ttm = walletModel->getTransactionTableModel();
qint64 amount = ttm->index(start, TransactionTableModel::Amount, parent)
.data(Qt::EditRole).toULongLong();
if(!clientModel->inInitialBlockDownload())
{
// On new transaction, make an info balloon
// Unless the initial block download is in progress, to prevent balloon-spam
QString date = ttm->index(start, TransactionTableModel::Date, parent)
.data().toString();
QString type = ttm->index(start, TransactionTableModel::Type, parent)
.data().toString();
QString address = ttm->index(start, TransactionTableModel::ToAddress, parent)
.data().toString();
QIcon icon = qvariant_cast<QIcon>(ttm->index(start,
TransactionTableModel::ToAddress, parent)
.data(Qt::DecorationRole));
notificator->notify(Notificator::Information,
(amount)<0 ? tr("Sent transaction") :
tr("Incoming transaction"),
tr("Date: %1\n"
"Amount: %2\n"
"Type: %3\n"
"Address: %4\n")
.arg(date)
.arg(BitcoinUnits::formatWithUnit(walletModel->getOptionsModel()->getDisplayUnit(), amount, true))
.arg(type)
.arg(address), icon);
}
}
void BitcoinGUI::incomingMessage(const QModelIndex & parent, int start, int end)
{
if(!messageModel)
return;
MessageModel *mm = messageModel;
if (mm->index(start, MessageModel::TypeInt, parent).data().toInt() == MessageTableEntry::Received)
{
QString sent_datetime = mm->index(start, MessageModel::ReceivedDateTime, parent).data().toString();
QString from_address = mm->index(start, MessageModel::FromAddress, parent).data().toString();
QString to_address = mm->index(start, MessageModel::ToAddress, parent).data().toString();
QString message = mm->index(start, MessageModel::Message, parent).data().toString();
QTextDocument html;
html.setHtml(message);
QString messageText(html.toPlainText());
notificator->notify(Notificator::Information,
tr("Incoming Message"),
tr("Date: %1\n"
"From Address: %2\n"
"To Address: %3\n"
"Message: %4\n")
.arg(sent_datetime)
.arg(from_address)
.arg(to_address)
.arg(messageText));
};
}
void BitcoinGUI::showDebugWindow()
{
rpcConsole->showNormal();
rpcConsole->show();
rpcConsole->raise();
rpcConsole->activateWindow();
}
void BitcoinGUI::showInfo()
{
rpcConsole->setTabFocus(RPCConsole::TAB_INFO);
showDebugWindow();
}
void BitcoinGUI::showConsole()
{
rpcConsole->setTabFocus(RPCConsole::TAB_CONSOLE);
showDebugWindow();
}
void BitcoinGUI::showGraph()
{
rpcConsole->setTabFocus(RPCConsole::TAB_GRAPH);
showDebugWindow();
}
void BitcoinGUI::showConfEditor()
{
boost::filesystem::path pathConfig = GetConfigFile();
/* Open bzlcoin.conf with the associated application */
if (boost::filesystem::exists(pathConfig)) {
QDesktopServices::openUrl(QUrl::fromLocalFile(QString::fromStdString(pathConfig.string())));
} else {
QMessageBox::warning(this, tr("No bzlcoin.conf"),
tr("Your bzlcoin.conf does not exist! Please create one in your Bzlcoin data directory."),
QMessageBox::Ok, QMessageBox::Ok);
}
//GUIUtil::openConfigfile();
}
void BitcoinGUI::showMNConfEditor()
{
boost::filesystem::path pathMNConfig = GetMasternodeConfigFile();
/* Open masternode.conf with the associated application */
if (boost::filesystem::exists(pathMNConfig)) {
QDesktopServices::openUrl(QUrl::fromLocalFile(QString::fromStdString(pathMNConfig.string())));
} else {
QMessageBox::warning(this, tr("No masternode.conf"),
tr("Your masternode.conf does not exist! Please create one in your Bzlcoin data directory."),
QMessageBox::Ok, QMessageBox::Ok);
}
//GUIUtil::openMNConfigfile();
}
void BitcoinGUI::gotoOverviewPage()
{
overviewAction->setChecked(true);
centralWidget->setCurrentWidget(overviewPage);
exportAction->setEnabled(false);
disconnect(exportAction, SIGNAL(triggered()), 0, 0);
}
void BitcoinGUI::gotoMarketBrowser()
{
marketAction->setChecked(true);
centralWidget->setCurrentWidget(marketBrowser);
exportAction->setEnabled(false);
disconnect(exportAction, SIGNAL(triggered()), 0, 0);
}
void BitcoinGUI::gotoMasternodeManagerPage()
{
masternodeManagerAction->setChecked(true);
centralWidget->setCurrentWidget(masternodeManagerPage);
exportAction->setEnabled(false);
disconnect(exportAction, SIGNAL(triggered()), 0, 0);
}
void BitcoinGUI::gotoMultisigPage()
{
multisigPage->show();
multisigPage->setFocus();
}
void BitcoinGUI::gotoMintingPage()
{
mintingAction->setChecked(true);
centralWidget->setCurrentWidget(mintingPage);
exportAction->setEnabled(true);
disconnect(exportAction, SIGNAL(triggered()), 0, 0);
connect(exportAction, SIGNAL(triggered()), mintingView, SLOT(exportClicked()));
}
void BitcoinGUI::gotoBlockBrowser()
{
blockAction->setChecked(true);
centralWidget->setCurrentWidget(blockBrowser);
exportAction->setEnabled(false);
disconnect(exportAction, SIGNAL(triggered()), 0, 0);
}
void BitcoinGUI::gotoStatisticsPage()
{
statisticsAction->setChecked(true);
centralWidget->setCurrentWidget(statisticsPage);
exportAction->setEnabled(false);
disconnect(exportAction, SIGNAL(triggered()), 0, 0);
}
void BitcoinGUI::gotoHistoryPage()
{
historyAction->setChecked(true);
centralWidget->setCurrentWidget(transactionsPage);
exportAction->setEnabled(true);
disconnect(exportAction, SIGNAL(triggered()), 0, 0);
connect(exportAction, SIGNAL(triggered()), transactionView, SLOT(exportClicked()));
}
void BitcoinGUI::gotoAddressBookPage()
{
addressBookAction->setChecked(true);
centralWidget->setCurrentWidget(addressBookPage);
exportAction->setEnabled(true);
disconnect(exportAction, SIGNAL(triggered()), 0, 0);
connect(exportAction, SIGNAL(triggered()), addressBookPage, SLOT(exportClicked()));
}
void BitcoinGUI::gotoReceiveCoinsPage()
{
receiveCoinsAction->setChecked(true);
centralWidget->setCurrentWidget(receiveCoinsPage);
exportAction->setEnabled(true);
disconnect(exportAction, SIGNAL(triggered()), 0, 0);
connect(exportAction, SIGNAL(triggered()), receiveCoinsPage, SLOT(exportClicked()));
}
void BitcoinGUI::gotoSendCoinsPage()
{
sendCoinsAction->setChecked(true);
centralWidget->setCurrentWidget(sendCoinsPage);
exportAction->setEnabled(false);
disconnect(exportAction, SIGNAL(triggered()), 0, 0);
}
void BitcoinGUI::gotoMessagePage()
{
messageAction->setChecked(true);
centralWidget->setCurrentWidget(messagePage);
exportAction->setEnabled(true);
disconnect(exportAction, SIGNAL(triggered()), 0, 0);
connect(exportAction, SIGNAL(triggered()), messagePage, SLOT(exportClicked()));
}
/*
void BitcoinGUI::gotoChatPage()
{
chatAction->setChecked(true);
centralWidget->setCurrentWidget(chatWindow);
exportAction->setEnabled(true);
disconnect(exportAction, SIGNAL(triggered()), 0, 0);
}
*/
void BitcoinGUI::gotoSignMessageTab(QString addr)
{
// call show() in showTab_SM()
signVerifyMessageDialog->showTab_SM(true);
if(!addr.isEmpty())
signVerifyMessageDialog->setAddress_SM(addr);
}
void BitcoinGUI::gotoVerifyMessageTab(QString addr)
{
// call show() in showTab_VM()
signVerifyMessageDialog->showTab_VM(true);
if(!addr.isEmpty())
signVerifyMessageDialog->setAddress_VM(addr);
}
void BitcoinGUI::dragEnterEvent(QDragEnterEvent *event)
{
// Accept only URIs
if(event->mimeData()->hasUrls())
event->acceptProposedAction();
}
void BitcoinGUI::dropEvent(QDropEvent *event)
{
if(event->mimeData()->hasUrls())
{
int nValidUrisFound = 0;
QList<QUrl> uris = event->mimeData()->urls();
foreach(const QUrl &uri, uris)
{
if (sendCoinsPage->handleURI(uri.toString()))
nValidUrisFound++;
}
// if valid URIs were found
if (nValidUrisFound)
gotoSendCoinsPage();
else
notificator->notify(Notificator::Warning, tr("URI handling"), tr("URI can not be parsed! This can be caused by an invalid Bzlcoin address or malformed URI parameters."));
}
event->acceptProposedAction();
}
void BitcoinGUI::handleURI(QString strURI)
{
// URI has to be valid
if (sendCoinsPage->handleURI(strURI))
{
showNormalIfMinimized();
gotoSendCoinsPage();
}
else
notificator->notify(Notificator::Warning, tr("URI handling"), tr("URI can not be parsed! This can be caused by an invalid Bzlcoin address or malformed URI parameters."));
}
void BitcoinGUI::mainToolbarOrientation(Qt::Orientation orientation)
{
if(orientation == Qt::Horizontal)
{
mainIcon->setPixmap(QPixmap(":images/horizontal"));
mainIcon->setAlignment(Qt::AlignLeft);
mainIcon->show();
mainToolbar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
mainToolbar->setStyleSheet(HORIZONTAL_TOOLBAR_STYLESHEET);
messageAction->setIconText(tr("&Messages"));
}
else
{
mainIcon->setPixmap(QPixmap(":images/vertical"));
mainIcon->setAlignment(Qt::AlignCenter);
mainIcon->show();
mainToolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
mainToolbar->setStyleSheet(VERTICAL_TOOBAR_STYLESHEET);
messageAction->setIconText(tr("Encrypted &Messages"));
}
}
void BitcoinGUI::secondaryToolbarOrientation(Qt::Orientation orientation)
{
secondaryToolbar->setStyleSheet(orientation == Qt::Horizontal ? HORIZONTAL_TOOLBAR_STYLESHEET : VERTICAL_TOOBAR_STYLESHEET);
}
void BitcoinGUI::setEncryptionStatus(int status)
{
switch(status)
{
case WalletModel::Unencrypted:
labelEncryptionIcon->hide();
encryptWalletAction->setChecked(false);
changePassphraseAction->setEnabled(false);
unlockWalletAction->setVisible(false);
lockWalletAction->setVisible(false);
encryptWalletAction->setEnabled(true);
break;
case WalletModel::Unlocked:
disconnect(labelEncryptionIcon, SIGNAL(clicked()), unlockWalletAction, SLOT(trigger()));
disconnect(labelEncryptionIcon, SIGNAL(clicked()), lockWalletAction, SLOT(trigger()));
connect (labelEncryptionIcon, SIGNAL(clicked()), lockWalletAction, SLOT(trigger()));
labelEncryptionIcon->show();
labelEncryptionIcon->setPixmap(QIcon(":/icons/lock_open").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
labelEncryptionIcon->setToolTip(tr("Wallet is <b>encrypted</b> and currently <b>unlocked</b>")); // TODO: Click to lock + translations
encryptWalletAction->setChecked(true);
changePassphraseAction->setEnabled(true);
unlockWalletAction->setVisible(false);
lockWalletAction->setVisible(true);
encryptWalletAction->setEnabled(false); // TODO: decrypt currently not supported
break;
case WalletModel::Locked:
disconnect(labelEncryptionIcon, SIGNAL(clicked()), unlockWalletAction, SLOT(trigger()));
disconnect(labelEncryptionIcon, SIGNAL(clicked()), lockWalletAction, SLOT(trigger()));
connect (labelEncryptionIcon, SIGNAL(clicked()), unlockWalletAction, SLOT(trigger()));
labelEncryptionIcon->show();
labelEncryptionIcon->setPixmap(QIcon(":/icons/lock_closed").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
labelEncryptionIcon->setToolTip(tr("Wallet is <b>encrypted</b> and currently <b>locked</b>")); // TODO: Click to unlock + translations
encryptWalletAction->setChecked(true);
changePassphraseAction->setEnabled(true);
unlockWalletAction->setVisible(true);
lockWalletAction->setVisible(false);
encryptWalletAction->setEnabled(false); // TODO: decrypt currently not supported
break;
}
}
void BitcoinGUI::encryptWallet(bool status)
{
if(!walletModel)
return;
AskPassphraseDialog dlg(status ? AskPassphraseDialog::Encrypt:
AskPassphraseDialog::Decrypt, this);
dlg.setModel(walletModel);
dlg.exec();
setEncryptionStatus(walletModel->getEncryptionStatus());
}
void BitcoinGUI::backupWallet()
{
QString saveDir = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
QString filename = QFileDialog::getSaveFileName(this, tr("Backup Wallet"), saveDir, tr("Wallet Data (*.dat)"));
if(!filename.isEmpty()) {
if(!walletModel->backupWallet(filename)) {
QMessageBox::warning(this, tr("Backup Failed"), tr("There was an error trying to save the wallet data to the new location."));
}
}
}
void BitcoinGUI::changePassphrase()
{
AskPassphraseDialog dlg(AskPassphraseDialog::ChangePass, this);
dlg.setModel(walletModel);
dlg.exec();
}
void BitcoinGUI::unlockWallet()
{
if(!walletModel)
return;
// Unlock wallet when requested by wallet model
if(walletModel->getEncryptionStatus() == WalletModel::Locked)
{
AskPassphraseDialog::Mode mode = sender() == unlockWalletAction ?
AskPassphraseDialog::UnlockStaking : AskPassphraseDialog::Unlock;
AskPassphraseDialog dlg(mode, this);
dlg.setModel(walletModel);
dlg.exec();
}
}
void BitcoinGUI::lockWallet()
{
if(!walletModel)
return;
walletModel->setWalletLocked(true);
}
void BitcoinGUI::showNormalIfMinimized(bool fToggleHidden)
{
// activateWindow() (sometimes) helps with keyboard focus on Windows
if (isHidden())
{
show();
activateWindow();
}
else if (isMinimized())
{
showNormal();
activateWindow();
}
else if (GUIUtil::isObscured(this))
{
raise();
activateWindow();
}
else if(fToggleHidden)
hide();
}
void BitcoinGUI::toggleHidden()
{
showNormalIfMinimized(true);
}
void BitcoinGUI::updateWeight()
{
if (!pwalletMain)
return;
TRY_LOCK(cs_main, lockMain);
if (!lockMain)
return;
TRY_LOCK(pwalletMain->cs_wallet, lockWallet);
if (!lockWallet)
return;
uint64_t nMinWeight = 0, nMaxWeight = 0;
pwalletMain->GetStakeWeight(*pwalletMain, nMinWeight, nMaxWeight, nWeight);
}
void BitcoinGUI::updateStakingIcon()
{
updateWeight();
if (nLastCoinStakeSearchInterval && nWeight)
{
uint64_t nNetworkWeight = GetPoSKernelPS();
unsigned nEstimateTime = nTargetSpacing * nNetworkWeight / nWeight;
QString text;
if (nEstimateTime < 60)
{
text = tr("%n second(s)", "", nEstimateTime);
}
else if (nEstimateTime < 60*60)
{
text = tr("%n minute(s)", "", nEstimateTime/60);
}
else if (nEstimateTime < 24*60*60)
{
text = tr("%n hour(s)", "", nEstimateTime/(60*60));
}
else
{
text = tr("%n day(s)", "", nEstimateTime/(60*60*24));
}
labelStakingIcon->setPixmap(QIcon(":/icons/staking_on").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
labelStakingIcon->setToolTip(tr("Staking.<br>Your weight is %1<br>Network weight is %2<br>Expected time to earn reward is %3").arg(nWeight).arg(nNetworkWeight).arg(text));
}
else
{
labelStakingIcon->setPixmap(QIcon(":/icons/staking_off").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
if (pwalletMain && pwalletMain->IsLocked())
labelStakingIcon->setToolTip(tr("Not staking because wallet is locked"));
else if (vNodes.empty())
labelStakingIcon->setToolTip(tr("Not staking because wallet is offline"));
else if (IsInitialBlockDownload())
labelStakingIcon->setToolTip(tr("Not staking because wallet is syncing"));
else if (!nWeight)
labelStakingIcon->setToolTip(tr("Not staking because you don't have mature coins<br>Coins take 8 hours to mature."));
else
labelStakingIcon->setToolTip(tr("Not staking"));
}
}
| bzlcoin/bzlcoin | src/qt/bitcoingui.cpp | C++ | mit | 52,537 |
<?php
namespace EasyCorp\Bundle\EasyAdminBundle\Field\Configurator;
use EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext;
use EasyCorp\Bundle\EasyAdminBundle\Contracts\Field\FieldConfiguratorInterface;
use EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto;
use EasyCorp\Bundle\EasyAdminBundle\Dto\FieldDto;
use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
use EasyCorp\Bundle\EasyAdminBundle\Form\Type\EaFormRowType;
/**
* @author Javier Eguiluz <[email protected]>
*/
final class FormConfigurator implements FieldConfiguratorInterface
{
public function supports(FieldDto $field, EntityDto $entityDto): bool
{
return FormField::class === $field->getFieldFqcn();
}
public function configure(FieldDto $field, EntityDto $entityDto, AdminContext $context): void
{
// if label is NULL, its value is autogenerated from the property name.
// But property names don't make sense for this kind of special field, so
// make the label FALSE to not display it
if (null === $field->getLabel()) {
$field->setLabel(false);
}
if (EaFormRowType::class === $field->getFormType()) {
$breakpointName = $field->getCustomOption(FormField::OPTION_ROW_BREAKPOINT);
if ('' === $breakpointName) {
// this empty string is "the name" used for XS size, when no real breakpoint is applied
$cssClasses = 'flex-fill';
} else {
$cssClasses = sprintf('d-none d-%s-flex flex-%s-fill', $breakpointName, $breakpointName);
}
$field->setFormTypeOption('row_attr.class', $field->getFormTypeOption('row_attr.class').' '.$cssClasses);
}
}
}
| javiereguiluz/EasyAdminBundle | src/Field/Configurator/FormConfigurator.php | PHP | mit | 1,726 |
<?php
/*
* Copyright 2014 Google Inc.
*
* 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.
*/
class Google_Service_CloudMachineLearningEngine_GoogleCloudMlV1beta1OperationMetadata extends Google_Model
{
public $createTime;
public $endTime;
public $isCancellationRequested;
public $modelName;
public $operationType;
public $startTime;
protected $versionType = 'Google_Service_CloudMachineLearningEngine_GoogleCloudMlV1beta1Version';
protected $versionDataType = '';
public function setCreateTime($createTime)
{
$this->createTime = $createTime;
}
public function getCreateTime()
{
return $this->createTime;
}
public function setEndTime($endTime)
{
$this->endTime = $endTime;
}
public function getEndTime()
{
return $this->endTime;
}
public function setIsCancellationRequested($isCancellationRequested)
{
$this->isCancellationRequested = $isCancellationRequested;
}
public function getIsCancellationRequested()
{
return $this->isCancellationRequested;
}
public function setModelName($modelName)
{
$this->modelName = $modelName;
}
public function getModelName()
{
return $this->modelName;
}
public function setOperationType($operationType)
{
$this->operationType = $operationType;
}
public function getOperationType()
{
return $this->operationType;
}
public function setStartTime($startTime)
{
$this->startTime = $startTime;
}
public function getStartTime()
{
return $this->startTime;
}
public function setVersion(Google_Service_CloudMachineLearningEngine_GoogleCloudMlV1beta1Version $version)
{
$this->version = $version;
}
public function getVersion()
{
return $this->version;
}
}
| dwivivagoal/KuizMilioner | application/libraries/php-google-sdk/google/apiclient-services/src/Google/Service/CloudMachineLearningEngine/GoogleCloudMlV1beta1OperationMetadata.php | PHP | mit | 2,240 |
<?php $this->load->view('include/header.php'); ?>
<section id="container" >
<?php $this->load->view('include/navbar.php'); ?>
<?php $this->load->view('include/sidebar.php'); ?>
<!--sidebar end-->
<!--main content start-->
<section id="main-content">
<section class="wrapper">
<!-- page start-->
<div class="row">
<div class="col-lg-12">
<section class="panel">
<header class="panel-heading">
Ajouter un langage
<span class="tools pull-right">
<a class="fa fa-chevron-down" href="javascript:;"></a>
<a class="fa fa-cog" href="javascript:;"></a>
<a class="fa fa-times" href="javascript:;"></a>
</span>
</header>
<div class="panel-body">
<div class=" form">
<form class="form-horizontal " id="form-add-language" method="post" action="<?php echo site_url('/add-language/submit'); ?>">
<div class="row-fluid">
<h4 class=""> General Information</h4>
<hr>
<div class="form-group ">
<label for="cname" class="control-label col-lg-3">Nom du langage *</label>
<div class="col-lg-6">
<input class="form-control" type="text" name="language" placeholder="Language" required />
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3">Color</label>
<div class="col-md-4 col-xs-11">
<div data-color-format="rgb" data-color="rgb(255, 146, 180)" class="input-append colorpicker-default color">
<input type="text" readonly="" name="colorlanguage" value="" class="form-control">
<span class=" input-group-btn add-on">
<button class="btn btn-white" type="button" style="padding: 8px">
<i style="background-color: rgb(124, 66, 84);"></i>
</button>
</span>
</div>
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-3 col-lg-6">
<button class="btn btn-primary" type="submit">Save</button>
<button class="btn btn-default" type="button">Cancel</button>
</div>
</div>
</form>
</div>
</div>
</section>
</div>
</div>
<!-- page end-->
</section>
</section>
<!--main content end-->
</section>
<?php $this->load->view('include/footer.php'); ?> | Callquent/websites-management | application/views/add-language.php | PHP | mit | 3,599 |
//----------------------------------------------------------------//
// Copyright (c) 2010-2011 Zipline Games, Inc.
// All Rights Reserved.
// http://getmoai.com
//----------------------------------------------------------------//
package com.gam400.moai;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;
import android.content.Context;
import android.opengl.GLSurfaceView;
import android.os.Handler;
import android.os.Looper;
import android.view.MotionEvent;
// Moai
import com.ziplinegames.moai.*;
//================================================================//
// MoaiView
//================================================================//
public class MoaiView extends GLSurfaceView {
private boolean mForceLandscape;
private Handler mHandler;
private int mHeight;
private Runnable mUpdateRunnable;
private int mWidth;
private static final long AKU_UPDATE_FREQUENCY = 1000 / 60; // 60 Hz, in milliseconds
//----------------------------------------------------------------//
public MoaiView ( Context context, int width, int height, int glesVersion ) {
super ( context );
// If the screen is locked when the view is created, the orientation
// may initially be portrait because the lock screen is portrait
// orientation, so we need to compensate and force landscape. This,
// of course, assumes that you're locking your application to landscape
// mode in the manifest. If your application is portrait or supports
// multiple orientations, you'll have to edit the manfifest, set this
// setting to false, and may have to make other adjustments to properly
// handle orientation changes.
mForceLandscape = true;
setScreenDimensions ( width, height );
Moai.setScreenSize ( mWidth, mHeight );
if ( glesVersion >= 0x20000 ) {
// NOTE: Must be set before the renderer is set.
setEGLContextClientVersion ( 2 );
}
// Create a handler that we can use to post to the main thread and a pseudo-
// periodic runnable that will handle calling Moai.update on the main thread.
mHandler = new Handler ( Looper.getMainLooper ());
mUpdateRunnable = new Runnable () {
public void run () {
Moai.update ();
mHandler.postDelayed ( mUpdateRunnable , AKU_UPDATE_FREQUENCY );
}
};
setRenderer ( new MoaiRenderer ());
onPause (); // Pause rendering until restarted by the activity lifecycle.
}
//================================================================//
// Public methods
//================================================================//
//----------------------------------------------------------------//
@Override
public void onSizeChanged ( int newWidth, int newHeight, int oldWidth, int oldHeight ) {
setScreenDimensions ( newWidth, newHeight );
Moai.setViewSize ( mWidth, mHeight );
}
//----------------------------------------------------------------//
public void pause ( boolean paused ) {
if ( paused ) {
mHandler.removeCallbacks ( mUpdateRunnable );
Moai.pause ( true );
setRenderMode ( GLSurfaceView.RENDERMODE_WHEN_DIRTY );
onPause ();
}
else {
onResume ();
setRenderMode ( GLSurfaceView.RENDERMODE_CONTINUOUSLY );
Moai.pause ( false );
mHandler.postDelayed ( mUpdateRunnable , AKU_UPDATE_FREQUENCY );
}
}
//================================================================//
// MotionEvent methods
//================================================================//
//----------------------------------------------------------------//
@Override
public boolean onTouchEvent ( MotionEvent event ) {
boolean isDown = true;
switch( event.getActionMasked() )
{
case MotionEvent.ACTION_CANCEL:
/*Moai.enqueueTouchEventCancel(
Moai.InputDevice.INPUT_DEVICE.ordinal (),
Moai.InputSensor.SENSOR_TOUCH.ordinal ()
);*/
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_POINTER_UP:
isDown = false;
case MotionEvent.ACTION_DOWN:
case MotionEvent.ACTION_POINTER_DOWN:
{
final int pointerIndex = event.getActionIndex();
int pointerId = event.getPointerId ( pointerIndex );
Moai.enqueueTouchEvent (
Moai.InputDevice.INPUT_DEVICE.ordinal (),
Moai.InputSensor.SENSOR_TOUCH.ordinal (),
pointerId,
isDown,
Math.round ( event.getX ( pointerIndex )),
Math.round ( event.getY ( pointerIndex )),
1
);
break;
}
case MotionEvent.ACTION_MOVE:
default:
{
final int pointerCount = event.getPointerCount ();
for ( int pointerIndex = 0; pointerIndex < pointerCount; ++pointerIndex ) {
int pointerId = event.getPointerId ( pointerIndex );
Moai.enqueueTouchEvent (
Moai.InputDevice.INPUT_DEVICE.ordinal (),
Moai.InputSensor.SENSOR_TOUCH.ordinal (),
pointerId,
isDown,
Math.round ( event.getX ( pointerIndex )),
Math.round ( event.getY ( pointerIndex )),
1
);
}
break;
}
}
return true;
}
//================================================================//
// Private methods
//================================================================//
//----------------------------------------------------------------//
public void setScreenDimensions ( int width, int height ) {
if ( mForceLandscape && ( height > width )) {
mWidth = height;
mHeight = width;
}
else {
mWidth = width;
mHeight = height;
}
}
//================================================================//
// MoaiRenderer
//================================================================//
private class MoaiRenderer implements GLSurfaceView.Renderer {
private boolean mRunScriptsExecuted = false;
//----------------------------------------------------------------//
public void onDrawFrame ( GL10 gl ) {
Moai.render ();
}
//----------------------------------------------------------------//
public void onSurfaceChanged ( GL10 gl, int width, int height ) {
MoaiLog.i ( "MoaiRenderer onSurfaceChanged: surface CHANGED" );
setScreenDimensions ( width, height );
Moai.setViewSize ( mWidth, mHeight );
}
//----------------------------------------------------------------//
public void onSurfaceCreated ( GL10 gl, EGLConfig config ) {
MoaiLog.i ( "MoaiRenderer onSurfaceCreated: surface CREATED" );
Moai.detectGraphicsContext ();
if ( !mRunScriptsExecuted ) {
mRunScriptsExecuted = true;
mHandler.postAtFrontOfQueue ( new Runnable () {
public void run () {
MoaiLog.i ( "MoaiRenderer onSurfaceCreated: Running game scripts" );
runScripts ( new String [] { "../init.lua", "main.lua" } );
Moai.startSession ( false );
Moai.setApplicationState ( Moai.ApplicationState.APPLICATION_RUNNING );
}
});
} else {
mHandler.post ( new Runnable () {
public void run () {
Moai.startSession ( true );
Moai.setApplicationState ( Moai.ApplicationState.APPLICATION_RUNNING );
}
});
}
}
//----------------------------------------------------------------//
private void runScripts ( String [] filenames ) {
for ( String file : filenames ) {
MoaiLog.i ( "MoaiRenderer runScripts: Running " + file + " script" );
Moai.runScript ( file );
}
}
}
} | kennethlombardi/moai-graphics | engine/projects/android/src/com/gam400/moai/MoaiView.java | Java | mit | 7,431 |
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>CodeMirror: Pig Latin mode</title>
<link rel="stylesheet" href="../../../../web/lib/codeMirror/lib/codemirror.css">
<script src="../../../../web/lib/codeMirror/lib/codemirror.js"></script>
<script src="../../../../web/lib/codeMirror/mode/pig/pig.js"></script>
<link rel="stylesheet" href="../../../../web/lib/codeMirror/doc/docs.css">
<style>.CodeMirror {border: 2px inset #dee;}</style>
</head>
<body>
<h1>CodeMirror: Pig Latin mode</h1>
<form><textarea id="code" name="code">
-- Apache Pig (Pig Latin Language) Demo
/*
This is a multiline comment.
*/
a = LOAD "\path\to\input" USING PigStorage('\t') AS (x:long, y:chararray, z:bytearray);
b = GROUP a BY (x,y,3+4);
c = FOREACH b GENERATE flatten(group) as (x,y), SUM(group.$2) as z;
STORE c INTO "\path\to\output";
--
</textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
lineNumbers: true,
indentUnit: 4,
mode: "text/x-pig"
});
</script>
<p>
Simple mode that handles Pig Latin language.
</p>
<p><strong>MIME type defined:</strong> <code>text/x-pig</code>
(PIG code)
</html>
| ldjking/wbscreen | web/wb/5editor/codeMirror/mode/pig/index.html | HTML | mit | 1,245 |
import FormIoAppConnectionForm from './FormIoApp'
export default {
[FormIoAppConnectionForm.service]: FormIoAppConnectionForm
} | lizhaogai/lyda-dada-v | app/containers/LydaDataVPage/DataSourcePage/ConnectionForms/index.js | JavaScript | mit | 130 |
// Hierarchical State Machine (HSM)
//
// Copyright (c) 2013 Antonio Maiorano
//
// Distributed under the MIT License (MIT)
// (See accompanying file LICENSE.txt or copy at
// http://opensource.org/licenses/MIT)
/// \file rtti.h
/// \brief Utilities to uniquely identify States via standard or custom RTTI.
#include "config.h"
#ifndef HSM_RTTI_H
#define HSM_RTTI_H
#if HSM_CPP_RTTI
#include <typeinfo>
namespace hsm {
// We use standard C++ RTTI
// We need a copyable wrapper around std::type_info since std::type_info is non-copyable
struct StateTypeIdStorage
{
StateTypeIdStorage() : m_typeInfo(0) { }
StateTypeIdStorage(const std::type_info& typeInfo) { m_typeInfo = &typeInfo; }
hsm_bool operator==(const StateTypeIdStorage& rhs) const
{
HSM_ASSERT_MSG(m_typeInfo != 0, "m_typeInfo was not properly initialized");
return *m_typeInfo == *rhs.m_typeInfo;
}
const std::type_info* m_typeInfo;
};
typedef const StateTypeIdStorage& StateTypeId;
template <typename StateType>
StateTypeId GetStateType()
{
static StateTypeIdStorage stateTypeId(typeid(StateType));
return stateTypeId;
}
} // namespace hsm
// DEFINE_HSM_STATE is NOT necessary; however, we define it here to nothing to make it easier to
// test switching between compiler RTTI enabled or disabled.
#define DEFINE_HSM_STATE(__StateName__)
#else // !HSM_CPP_RTTI
namespace hsm {
// Standard C++ RTTI is not available, so we roll our own custom RTTI. All states are required to use the
// DEFINE_HSM_STATE macro, which makes use of the input name of the state as the unique identifier. String
// compares are used to determine equality.
// Like std::type_info, we need to be able test equality and get a unique name
struct StateTypeIdStorage
{
StateTypeIdStorage(const hsm_char* aStateName = 0) : mStateName(aStateName) {}
hsm_bool operator==(const StateTypeIdStorage& rhs) const
{
HSM_ASSERT_MSG(mStateName != 0, "StateTypeId was not properly initialized");
return STRCMP(mStateName, rhs.mStateName) == 0;
}
const hsm_char* mStateName;
};
typedef const StateTypeIdStorage& StateTypeId;
template <typename StateType>
StateTypeId GetStateType()
{
return StateType::GetStaticStateType();
}
} // namespace hsm
// Must use this macro in every State to add RTTI support.
#define DEFINE_HSM_STATE(__StateName__) \
static hsm::StateTypeId GetStaticStateType() { static hsm::StateTypeIdStorage sStateTypeId(HSM_TEXT(#__StateName__)); return sStateTypeId; } \
virtual hsm::StateTypeId DoGetStateType() const { return GetStaticStateType(); } \
virtual const hsm_char* DoGetStateDebugName() const { return HSM_TEXT(#__StateName__); }
#endif // !HSM_CPP_RTTI
#endif // HSM_RTTI_H
| amaiorano/ZeldaDS | Game/ZeldaDS/arm9/source/external/hsm/include/hsm/rtti.h | C | mit | 2,676 |
<html><body>
<h4>Windows 10 x64 (18362.449)</h4><br>
<h2>_MM_GRAPHICS_VAD_FLAGS</h2>
<font face="arial"> +0x000 Lock : Pos 0, 1 Bit<br>
+0x000 LockContended : Pos 1, 1 Bit<br>
+0x000 DeleteInProgress : Pos 2, 1 Bit<br>
+0x000 NoChange : Pos 3, 1 Bit<br>
+0x000 VadType : Pos 4, 3 Bits<br>
+0x000 Protection : Pos 7, 5 Bits<br>
+0x000 PreferredNode : Pos 12, 6 Bits<br>
+0x000 PageSize : Pos 18, 2 Bits<br>
+0x000 PrivateMemoryAlwaysSet : Pos 20, 1 Bit<br>
+0x000 WriteWatch : Pos 21, 1 Bit<br>
+0x000 FixedLargePageSize : Pos 22, 1 Bit<br>
+0x000 ZeroFillPagesOptional : Pos 23, 1 Bit<br>
+0x000 GraphicsAlwaysSet : Pos 24, 1 Bit<br>
+0x000 GraphicsUseCoherentBus : Pos 25, 1 Bit<br>
+0x000 GraphicsPageProtection : Pos 26, 3 Bits<br>
</font></body></html> | epikcraw/ggool | public/Windows 10 x64 (18362.449)/_MM_GRAPHICS_VAD_FLAGS.html | HTML | mit | 873 |
/**
* places where the stocks are
*/
import {Place} from '../type/model.d.ts'
import * as mongoose from 'mongoose'
import * as autoIncr from 'mongoose-auto-increment'
import {OrderModel} from './order'
import {StockState} from '../lib/stock_state'
const modelName = 'Place'
export let PlaceSchema = new mongoose.Schema({
address: String,
description: String,
internalStock: { default: true, type: Boolean },
name: {
index: { unique: true },
lowercase: true,
required: true,
trim: true,
type: String
}
})
// Plugins
PlaceSchema.plugin(autoIncr.plugin, modelName)
// hooks
PlaceSchema.pre('save', (next) => {
// let place = this
next()
})
// block delete if orders with this placeId remains
PlaceSchema.pre('remove', function (next: Function): void {
let errMsg = 'Orders with this place remain in the database'
OrderModel.find({ placeIdSource: this._id }).exec()
.then((orderList1) => {
if (orderList1.length > 0) {
return next(new Error(errMsg))
}
OrderModel.find({ placeIdDestination: this._id }).exec()
.then((orderList2) => {
if (orderList2.length > 0) {
return next(new Error(errMsg))
}
next()
}, err => { return next(err) })
}, err => { return next(err) })
})
PlaceSchema.methods.getStockState = async function (): Promise<Object> {
try {
let placeStockState = new StockState(this._id)
let stockObject = await placeStockState.toObject()
return stockObject
} catch (err) {
throw err
}
}
export let PlaceModel = mongoose.model<Place>(modelName, PlaceSchema)
| chipp972/ont-manager_back | app/model/place.ts | TypeScript | mit | 1,586 |
# == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# email :string default(""), not null
# encrypted_password :string default(""), not null
# reset_password_token :string
# reset_password_sent_at :datetime
# remember_created_at :datetime
# sign_in_count :integer default(0), not null
# current_sign_in_at :datetime
# last_sign_in_at :datetime
# current_sign_in_ip :string
# last_sign_in_ip :string
# created_at :datetime not null
# updated_at :datetime not null
# name :string
# role_id :integer
# avatar_file_name :string
# avatar_content_type :string
# avatar_file_size :integer
# avatar_updated_at :datetime
#
# Indexes
#
# index_users_on_email (email) UNIQUE
# index_users_on_reset_password_token (reset_password_token) UNIQUE
# index_users_on_role_id (role_id)
#
class User < ApplicationRecord
require_dependency 'user/constants_and_validations'
require_dependency 'user/callbacks'
has_many :books, dependent: :destroy
has_many :reviews, dependent: :destroy
belongs_to :role
before_validation :set_default_role
after_create :send_notifcations
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
# has_attached_file :avatar, styles: { medium: "200x200>", thumb: "100x100>" }, default_url: "/images/:style/missing.png"
# validates_attachment :avatar, content_type: { content_type: /\Aimage\/.*\Z/ }
# validates_attachment_file_name :avatar, matches: [/png\z/, /jpe?g\z/]
# USER_ROLES = {:registered=> 1,:banned=> 2,:moderator=> 3,:admin=> 4}
Role_id_to_name = Hash[*ROLES.map{ |i| [i[1], i[0]] }.flatten]
Role_name_to_id = Hash[*ROLES.map{ |i| [i[0], i[1]] }.flatten]
def user_role
Role_id_to_name[self.role_id]
end
private
def set_default_role
# self.role ||= Role.find_by_name('registered')
self.role ||= Role.find(Role_name_to_id[:registered])
end
end
| siddharth1001/good_reads | app/models/user.rb | Ruby | mit | 2,281 |
--TEST--
AMQPConnection constructor with both timeout and read_timeout parameters in credentials
--SKIPIF--
<?php if (!extension_loaded("amqp")) print "skip"; ?>
--FILE--
<?php
$credentials = array('timeout' => 101.101, 'read_timeout' => 202.202);
$cnn = new AMQPConnection($credentials);
var_dump($cnn->getReadTimeout());
?>
--EXPECTF--
Notice: AMQPConnection::__construct(): Parameter 'timeout' is deprecated, 'read_timeout' used instead in %s on line 3
float(202.202)
| cmorenokkatoo/kkatooapp | amqp-1.8.0beta2/tests/amqpconnection_construct_with_timeout_and_read_timeout.phpt | PHP | mit | 471 |
(function () {
'use strict';
module.exports = function (gulp, plugins, config) {
return function () {
var firstRun = plugins.cached.caches['html'] ? false : true;
return gulp.src(config.buildPath + '/**/*.html')
.pipe(plugins.if(global.isWatching, plugins.cached('html')))
.pipe(plugins.if(global.isWatching && !firstRun, plugins.a11y()))
.pipe(plugins.if(global.isWatching && !firstRun, plugins.a11y.reporter()))
;
};
};
})();
| jkeddy/rocketbelt | gulp-tasks/a11y.js | JavaScript | mit | 486 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
namespace ResxDiffLib {
public class ResxDocument {
public IList<ResxData> Data { get; set; }
private readonly XDocument _xml;
public ResxDocument(XDocument xml) {
if (xml.Root == null || xml.Root.Name != "root") {
throw new ArgumentException("No <root> element found");
}
Data = xml.Root.Elements("data").Select(elem => new ResxData(elem)).ToList();
_xml = new XDocument(xml);
}
public XDocument ToXml() {
if (_xml == null) return null;
var xml = new XDocument(_xml);
xml.Root.Elements("data").Remove();
xml.Root.Add(Data.Select(data => data.ToXml()).ToArray());
return xml;
}
}
}
| tomwadley/resx-diff | ResxDiff/ResxDocument.cs | C# | mit | 863 |
<p class="well well-sm" ng-if="!vm.initialized"><i class="fa fa-refresh fa-spin fa-2x"></i></p>
<p class="well well-sm" ng-if="vm.initialized && !vm.favourites.length">You don't have any favourites yet :-)</p>
<table class="table table-hover" ng-if="vm.initialized && vm.favourites.length > 0">
<tbody>
<tr ng-repeat="favourite in vm.favourites">
<td class="snug text-center">
<img ng-if="favourite.Poster !== 'N/A'" ng-src="/ImageProxy/?url={{favourite.Poster}}" />
</td>
<td>
<div class="pull-right">
<button type="button" class="btn btn-danger" uib-tooltip="Remove from collection" ng-click="vm.removeFromFavourites(favourite)"><i class="fa fa-trash"></i></button>
</div>
<h4>{{favourite.Title}} ({{favourite.Year}})</h4>
<p>
<span class="label label-info">{{favourite.Rated}}</span>
<span class="label label-default text-capitalize" ng-if="favourite.Type === 'episode'">Episode</span>
<span class="label label-primary text-capitalize" ng-if="favourite.Type === 'series'">Series</span>
<span class="label label-success text-capitalize" ng-if="favourite.Type === 'movie'">Movie</span>
<span class="label label-warning text-capitalize" ng-if="favourite.Type === 'game'">Game</span>
</p>
<p>{{favourite.Plot}}</p>
<dl>
<dt>Actors:</dt>
<dd>{{favourite.Actors}}</dd>
<dt>Awards:</dt>
<dd>{{favourite.Awards}}</dd>
</dl>
</td>
</tr>
</tbody>
</table> | LarsVonQualen/Filmstrip | Filmstrip/Filmstrip/app/areas/collection/FavouritesOverview.html | HTML | mit | 1,769 |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WinCR.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WinCR.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap circle {
get {
object obj = ResourceManager.GetObject("circle", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}
| holzenky/wincr | WinCR/Properties/Resources.Designer.cs | C# | mit | 3,139 |
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: db/LoginHistory.proto
#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include "db/LoginHistory.pb.h"
#include <algorithm>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/once.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
// @@protoc_insertion_point(includes)
namespace db {
namespace {
const ::google::protobuf::Descriptor* LoginRecored_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
LoginRecored_reflection_ = NULL;
const ::google::protobuf::Descriptor* PlayerLoginHistory_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
PlayerLoginHistory_reflection_ = NULL;
const ::google::protobuf::Descriptor* LoginHistory_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
LoginHistory_reflection_ = NULL;
const ::google::protobuf::Descriptor* LoginHistory__PrimaryKey_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
LoginHistory__PrimaryKey_reflection_ = NULL;
const ::google::protobuf::Descriptor* LoginHistory__MaxLength_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
LoginHistory__MaxLength_reflection_ = NULL;
const ::google::protobuf::Descriptor* LoginHistory__Index_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
LoginHistory__Index_reflection_ = NULL;
const ::google::protobuf::Descriptor* LoginLatest_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
LoginLatest_reflection_ = NULL;
const ::google::protobuf::Descriptor* LoginLatest__PrimaryKey_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
LoginLatest__PrimaryKey_reflection_ = NULL;
} // namespace
void protobuf_AssignDesc_db_2fLoginHistory_2eproto() {
protobuf_AddDesc_db_2fLoginHistory_2eproto();
const ::google::protobuf::FileDescriptor* file =
::google::protobuf::DescriptorPool::generated_pool()->FindFileByName(
"db/LoginHistory.proto");
GOOGLE_CHECK(file != NULL);
LoginRecored_descriptor_ = file->message_type(0);
static const int LoginRecored_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(LoginRecored, area_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(LoginRecored, time_),
};
LoginRecored_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
LoginRecored_descriptor_,
LoginRecored::default_instance_,
LoginRecored_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(LoginRecored, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(LoginRecored, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(LoginRecored));
PlayerLoginHistory_descriptor_ = file->message_type(1);
static const int PlayerLoginHistory_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PlayerLoginHistory, latestlogin_),
};
PlayerLoginHistory_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
PlayerLoginHistory_descriptor_,
PlayerLoginHistory::default_instance_,
PlayerLoginHistory_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PlayerLoginHistory, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PlayerLoginHistory, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(PlayerLoginHistory));
LoginHistory_descriptor_ = file->message_type(2);
static const int LoginHistory_offsets_[3] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(LoginHistory, gid_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(LoginHistory, area_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(LoginHistory, history_),
};
LoginHistory_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
LoginHistory_descriptor_,
LoginHistory::default_instance_,
LoginHistory_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(LoginHistory, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(LoginHistory, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(LoginHistory));
LoginHistory__PrimaryKey_descriptor_ = LoginHistory_descriptor_->nested_type(0);
static const int LoginHistory__PrimaryKey_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(LoginHistory__PrimaryKey, gid_),
};
LoginHistory__PrimaryKey_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
LoginHistory__PrimaryKey_descriptor_,
LoginHistory__PrimaryKey::default_instance_,
LoginHistory__PrimaryKey_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(LoginHistory__PrimaryKey, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(LoginHistory__PrimaryKey, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(LoginHistory__PrimaryKey));
LoginHistory__MaxLength_descriptor_ = LoginHistory_descriptor_->nested_type(1);
static const int LoginHistory__MaxLength_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(LoginHistory__MaxLength, openid_),
};
LoginHistory__MaxLength_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
LoginHistory__MaxLength_descriptor_,
LoginHistory__MaxLength::default_instance_,
LoginHistory__MaxLength_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(LoginHistory__MaxLength, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(LoginHistory__MaxLength, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(LoginHistory__MaxLength));
LoginHistory__Index_descriptor_ = LoginHistory_descriptor_->nested_type(2);
static const int LoginHistory__Index_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(LoginHistory__Index, gid_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(LoginHistory__Index, openid_),
};
LoginHistory__Index_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
LoginHistory__Index_descriptor_,
LoginHistory__Index::default_instance_,
LoginHistory__Index_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(LoginHistory__Index, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(LoginHistory__Index, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(LoginHistory__Index));
LoginLatest_descriptor_ = file->message_type(3);
static const int LoginLatest_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(LoginLatest, gid_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(LoginLatest, area_),
};
LoginLatest_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
LoginLatest_descriptor_,
LoginLatest::default_instance_,
LoginLatest_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(LoginLatest, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(LoginLatest, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(LoginLatest));
LoginLatest__PrimaryKey_descriptor_ = LoginLatest_descriptor_->nested_type(0);
static const int LoginLatest__PrimaryKey_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(LoginLatest__PrimaryKey, gid_),
};
LoginLatest__PrimaryKey_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
LoginLatest__PrimaryKey_descriptor_,
LoginLatest__PrimaryKey::default_instance_,
LoginLatest__PrimaryKey_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(LoginLatest__PrimaryKey, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(LoginLatest__PrimaryKey, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(LoginLatest__PrimaryKey));
}
namespace {
GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_);
inline void protobuf_AssignDescriptorsOnce() {
::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_,
&protobuf_AssignDesc_db_2fLoginHistory_2eproto);
}
void protobuf_RegisterTypes(const ::std::string&) {
protobuf_AssignDescriptorsOnce();
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
LoginRecored_descriptor_, &LoginRecored::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
PlayerLoginHistory_descriptor_, &PlayerLoginHistory::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
LoginHistory_descriptor_, &LoginHistory::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
LoginHistory__PrimaryKey_descriptor_, &LoginHistory__PrimaryKey::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
LoginHistory__MaxLength_descriptor_, &LoginHistory__MaxLength::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
LoginHistory__Index_descriptor_, &LoginHistory__Index::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
LoginLatest_descriptor_, &LoginLatest::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
LoginLatest__PrimaryKey_descriptor_, &LoginLatest__PrimaryKey::default_instance());
}
} // namespace
void protobuf_ShutdownFile_db_2fLoginHistory_2eproto() {
delete LoginRecored::default_instance_;
delete LoginRecored_reflection_;
delete PlayerLoginHistory::default_instance_;
delete PlayerLoginHistory_reflection_;
delete LoginHistory::default_instance_;
delete LoginHistory_reflection_;
delete LoginHistory__PrimaryKey::default_instance_;
delete LoginHistory__PrimaryKey_reflection_;
delete LoginHistory__MaxLength::default_instance_;
delete LoginHistory__MaxLength_reflection_;
delete LoginHistory__Index::default_instance_;
delete LoginHistory__Index_reflection_;
delete LoginLatest::default_instance_;
delete LoginLatest_reflection_;
delete LoginLatest__PrimaryKey::default_instance_;
delete LoginLatest__PrimaryKey_reflection_;
}
void protobuf_AddDesc_db_2fLoginHistory_2eproto() {
static bool already_here = false;
if (already_here) return;
already_here = true;
GOOGLE_PROTOBUF_VERIFY_VERSION;
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
"\n\025db/LoginHistory.proto\022\002db\"*\n\014LoginReco"
"red\022\014\n\004area\030\001 \002(\r\022\014\n\004time\030\002 \002(\r\";\n\022Playe"
"rLoginHistory\022%\n\013latestLogin\030\001 \003(\0132\020.db."
"LoginRecored\"\267\001\n\014LoginHistory\022\013\n\003gid\030\001 \002"
"(\004\022\014\n\004area\030\002 \002(\r\022\'\n\007history\030\003 \001(\0132\026.db.P"
"layerLoginHistory\032\032\n\013_PrimaryKey\022\013\n\003gid\030"
"\001 \001(\r\032 \n\n_MaxLength\022\022\n\006openid\030\001 \001(\r:\00232\032"
"%\n\006_Index\022\013\n\003gid\030\001 \001(\t\022\016\n\006openid\030\002 \001(\t\"D"
"\n\013LoginLatest\022\013\n\003gid\030\001 \002(\004\022\014\n\004area\030\002 \002(\r"
"\032\032\n\013_PrimaryKey\022\013\n\003gid\030\001 \001(\r", 388);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"db/LoginHistory.proto", &protobuf_RegisterTypes);
LoginRecored::default_instance_ = new LoginRecored();
PlayerLoginHistory::default_instance_ = new PlayerLoginHistory();
LoginHistory::default_instance_ = new LoginHistory();
LoginHistory__PrimaryKey::default_instance_ = new LoginHistory__PrimaryKey();
LoginHistory__MaxLength::default_instance_ = new LoginHistory__MaxLength();
LoginHistory__Index::default_instance_ = new LoginHistory__Index();
LoginLatest::default_instance_ = new LoginLatest();
LoginLatest__PrimaryKey::default_instance_ = new LoginLatest__PrimaryKey();
LoginRecored::default_instance_->InitAsDefaultInstance();
PlayerLoginHistory::default_instance_->InitAsDefaultInstance();
LoginHistory::default_instance_->InitAsDefaultInstance();
LoginHistory__PrimaryKey::default_instance_->InitAsDefaultInstance();
LoginHistory__MaxLength::default_instance_->InitAsDefaultInstance();
LoginHistory__Index::default_instance_->InitAsDefaultInstance();
LoginLatest::default_instance_->InitAsDefaultInstance();
LoginLatest__PrimaryKey::default_instance_->InitAsDefaultInstance();
::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_db_2fLoginHistory_2eproto);
}
// Force AddDescriptors() to be called at static initialization time.
struct StaticDescriptorInitializer_db_2fLoginHistory_2eproto {
StaticDescriptorInitializer_db_2fLoginHistory_2eproto() {
protobuf_AddDesc_db_2fLoginHistory_2eproto();
}
} static_descriptor_initializer_db_2fLoginHistory_2eproto_;
// ===================================================================
#ifndef _MSC_VER
const int LoginRecored::kAreaFieldNumber;
const int LoginRecored::kTimeFieldNumber;
#endif // !_MSC_VER
LoginRecored::LoginRecored()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:db.LoginRecored)
}
void LoginRecored::InitAsDefaultInstance() {
}
LoginRecored::LoginRecored(const LoginRecored& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:db.LoginRecored)
}
void LoginRecored::SharedCtor() {
_cached_size_ = 0;
area_ = 0u;
time_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
LoginRecored::~LoginRecored() {
// @@protoc_insertion_point(destructor:db.LoginRecored)
SharedDtor();
}
void LoginRecored::SharedDtor() {
if (this != default_instance_) {
}
}
void LoginRecored::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* LoginRecored::descriptor() {
protobuf_AssignDescriptorsOnce();
return LoginRecored_descriptor_;
}
const LoginRecored& LoginRecored::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_db_2fLoginHistory_2eproto();
return *default_instance_;
}
LoginRecored* LoginRecored::default_instance_ = NULL;
LoginRecored* LoginRecored::New() const {
return new LoginRecored;
}
void LoginRecored::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<LoginRecored*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
ZR_(area_, time_);
#undef OFFSET_OF_FIELD_
#undef ZR_
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool LoginRecored::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:db.LoginRecored)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// required uint32 area = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &area_)));
set_has_area();
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_time;
break;
}
// required uint32 time = 2;
case 2: {
if (tag == 16) {
parse_time:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &time_)));
set_has_time();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:db.LoginRecored)
return true;
failure:
// @@protoc_insertion_point(parse_failure:db.LoginRecored)
return false;
#undef DO_
}
void LoginRecored::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:db.LoginRecored)
// required uint32 area = 1;
if (has_area()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->area(), output);
}
// required uint32 time = 2;
if (has_time()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->time(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:db.LoginRecored)
}
::google::protobuf::uint8* LoginRecored::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:db.LoginRecored)
// required uint32 area = 1;
if (has_area()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->area(), target);
}
// required uint32 time = 2;
if (has_time()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->time(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:db.LoginRecored)
return target;
}
int LoginRecored::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// required uint32 area = 1;
if (has_area()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->area());
}
// required uint32 time = 2;
if (has_time()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->time());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void LoginRecored::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const LoginRecored* source =
::google::protobuf::internal::dynamic_cast_if_available<const LoginRecored*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void LoginRecored::MergeFrom(const LoginRecored& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_area()) {
set_area(from.area());
}
if (from.has_time()) {
set_time(from.time());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void LoginRecored::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void LoginRecored::CopyFrom(const LoginRecored& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool LoginRecored::IsInitialized() const {
if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false;
return true;
}
void LoginRecored::Swap(LoginRecored* other) {
if (other != this) {
std::swap(area_, other->area_);
std::swap(time_, other->time_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata LoginRecored::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = LoginRecored_descriptor_;
metadata.reflection = LoginRecored_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int PlayerLoginHistory::kLatestLoginFieldNumber;
#endif // !_MSC_VER
PlayerLoginHistory::PlayerLoginHistory()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:db.PlayerLoginHistory)
}
void PlayerLoginHistory::InitAsDefaultInstance() {
}
PlayerLoginHistory::PlayerLoginHistory(const PlayerLoginHistory& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:db.PlayerLoginHistory)
}
void PlayerLoginHistory::SharedCtor() {
_cached_size_ = 0;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
PlayerLoginHistory::~PlayerLoginHistory() {
// @@protoc_insertion_point(destructor:db.PlayerLoginHistory)
SharedDtor();
}
void PlayerLoginHistory::SharedDtor() {
if (this != default_instance_) {
}
}
void PlayerLoginHistory::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* PlayerLoginHistory::descriptor() {
protobuf_AssignDescriptorsOnce();
return PlayerLoginHistory_descriptor_;
}
const PlayerLoginHistory& PlayerLoginHistory::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_db_2fLoginHistory_2eproto();
return *default_instance_;
}
PlayerLoginHistory* PlayerLoginHistory::default_instance_ = NULL;
PlayerLoginHistory* PlayerLoginHistory::New() const {
return new PlayerLoginHistory;
}
void PlayerLoginHistory::Clear() {
latestlogin_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool PlayerLoginHistory::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:db.PlayerLoginHistory)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// repeated .db.LoginRecored latestLogin = 1;
case 1: {
if (tag == 10) {
parse_latestLogin:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_latestlogin()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(10)) goto parse_latestLogin;
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:db.PlayerLoginHistory)
return true;
failure:
// @@protoc_insertion_point(parse_failure:db.PlayerLoginHistory)
return false;
#undef DO_
}
void PlayerLoginHistory::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:db.PlayerLoginHistory)
// repeated .db.LoginRecored latestLogin = 1;
for (int i = 0; i < this->latestlogin_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, this->latestlogin(i), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:db.PlayerLoginHistory)
}
::google::protobuf::uint8* PlayerLoginHistory::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:db.PlayerLoginHistory)
// repeated .db.LoginRecored latestLogin = 1;
for (int i = 0; i < this->latestlogin_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
1, this->latestlogin(i), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:db.PlayerLoginHistory)
return target;
}
int PlayerLoginHistory::ByteSize() const {
int total_size = 0;
// repeated .db.LoginRecored latestLogin = 1;
total_size += 1 * this->latestlogin_size();
for (int i = 0; i < this->latestlogin_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->latestlogin(i));
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void PlayerLoginHistory::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const PlayerLoginHistory* source =
::google::protobuf::internal::dynamic_cast_if_available<const PlayerLoginHistory*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void PlayerLoginHistory::MergeFrom(const PlayerLoginHistory& from) {
GOOGLE_CHECK_NE(&from, this);
latestlogin_.MergeFrom(from.latestlogin_);
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void PlayerLoginHistory::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void PlayerLoginHistory::CopyFrom(const PlayerLoginHistory& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool PlayerLoginHistory::IsInitialized() const {
if (!::google::protobuf::internal::AllAreInitialized(this->latestlogin())) return false;
return true;
}
void PlayerLoginHistory::Swap(PlayerLoginHistory* other) {
if (other != this) {
latestlogin_.Swap(&other->latestlogin_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata PlayerLoginHistory::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = PlayerLoginHistory_descriptor_;
metadata.reflection = PlayerLoginHistory_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int LoginHistory__PrimaryKey::kGidFieldNumber;
#endif // !_MSC_VER
LoginHistory__PrimaryKey::LoginHistory__PrimaryKey()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:db.LoginHistory._PrimaryKey)
}
void LoginHistory__PrimaryKey::InitAsDefaultInstance() {
}
LoginHistory__PrimaryKey::LoginHistory__PrimaryKey(const LoginHistory__PrimaryKey& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:db.LoginHistory._PrimaryKey)
}
void LoginHistory__PrimaryKey::SharedCtor() {
_cached_size_ = 0;
gid_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
LoginHistory__PrimaryKey::~LoginHistory__PrimaryKey() {
// @@protoc_insertion_point(destructor:db.LoginHistory._PrimaryKey)
SharedDtor();
}
void LoginHistory__PrimaryKey::SharedDtor() {
if (this != default_instance_) {
}
}
void LoginHistory__PrimaryKey::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* LoginHistory__PrimaryKey::descriptor() {
protobuf_AssignDescriptorsOnce();
return LoginHistory__PrimaryKey_descriptor_;
}
const LoginHistory__PrimaryKey& LoginHistory__PrimaryKey::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_db_2fLoginHistory_2eproto();
return *default_instance_;
}
LoginHistory__PrimaryKey* LoginHistory__PrimaryKey::default_instance_ = NULL;
LoginHistory__PrimaryKey* LoginHistory__PrimaryKey::New() const {
return new LoginHistory__PrimaryKey;
}
void LoginHistory__PrimaryKey::Clear() {
gid_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool LoginHistory__PrimaryKey::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:db.LoginHistory._PrimaryKey)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 gid = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &gid_)));
set_has_gid();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:db.LoginHistory._PrimaryKey)
return true;
failure:
// @@protoc_insertion_point(parse_failure:db.LoginHistory._PrimaryKey)
return false;
#undef DO_
}
void LoginHistory__PrimaryKey::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:db.LoginHistory._PrimaryKey)
// optional uint32 gid = 1;
if (has_gid()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->gid(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:db.LoginHistory._PrimaryKey)
}
::google::protobuf::uint8* LoginHistory__PrimaryKey::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:db.LoginHistory._PrimaryKey)
// optional uint32 gid = 1;
if (has_gid()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->gid(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:db.LoginHistory._PrimaryKey)
return target;
}
int LoginHistory__PrimaryKey::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 gid = 1;
if (has_gid()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->gid());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void LoginHistory__PrimaryKey::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const LoginHistory__PrimaryKey* source =
::google::protobuf::internal::dynamic_cast_if_available<const LoginHistory__PrimaryKey*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void LoginHistory__PrimaryKey::MergeFrom(const LoginHistory__PrimaryKey& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_gid()) {
set_gid(from.gid());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void LoginHistory__PrimaryKey::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void LoginHistory__PrimaryKey::CopyFrom(const LoginHistory__PrimaryKey& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool LoginHistory__PrimaryKey::IsInitialized() const {
return true;
}
void LoginHistory__PrimaryKey::Swap(LoginHistory__PrimaryKey* other) {
if (other != this) {
std::swap(gid_, other->gid_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata LoginHistory__PrimaryKey::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = LoginHistory__PrimaryKey_descriptor_;
metadata.reflection = LoginHistory__PrimaryKey_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#ifndef _MSC_VER
const int LoginHistory__MaxLength::kOpenidFieldNumber;
#endif // !_MSC_VER
LoginHistory__MaxLength::LoginHistory__MaxLength()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:db.LoginHistory._MaxLength)
}
void LoginHistory__MaxLength::InitAsDefaultInstance() {
}
LoginHistory__MaxLength::LoginHistory__MaxLength(const LoginHistory__MaxLength& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:db.LoginHistory._MaxLength)
}
void LoginHistory__MaxLength::SharedCtor() {
_cached_size_ = 0;
openid_ = 32u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
LoginHistory__MaxLength::~LoginHistory__MaxLength() {
// @@protoc_insertion_point(destructor:db.LoginHistory._MaxLength)
SharedDtor();
}
void LoginHistory__MaxLength::SharedDtor() {
if (this != default_instance_) {
}
}
void LoginHistory__MaxLength::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* LoginHistory__MaxLength::descriptor() {
protobuf_AssignDescriptorsOnce();
return LoginHistory__MaxLength_descriptor_;
}
const LoginHistory__MaxLength& LoginHistory__MaxLength::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_db_2fLoginHistory_2eproto();
return *default_instance_;
}
LoginHistory__MaxLength* LoginHistory__MaxLength::default_instance_ = NULL;
LoginHistory__MaxLength* LoginHistory__MaxLength::New() const {
return new LoginHistory__MaxLength;
}
void LoginHistory__MaxLength::Clear() {
openid_ = 32u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool LoginHistory__MaxLength::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:db.LoginHistory._MaxLength)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 openid = 1 [default = 32];
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &openid_)));
set_has_openid();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:db.LoginHistory._MaxLength)
return true;
failure:
// @@protoc_insertion_point(parse_failure:db.LoginHistory._MaxLength)
return false;
#undef DO_
}
void LoginHistory__MaxLength::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:db.LoginHistory._MaxLength)
// optional uint32 openid = 1 [default = 32];
if (has_openid()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->openid(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:db.LoginHistory._MaxLength)
}
::google::protobuf::uint8* LoginHistory__MaxLength::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:db.LoginHistory._MaxLength)
// optional uint32 openid = 1 [default = 32];
if (has_openid()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->openid(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:db.LoginHistory._MaxLength)
return target;
}
int LoginHistory__MaxLength::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 openid = 1 [default = 32];
if (has_openid()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->openid());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void LoginHistory__MaxLength::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const LoginHistory__MaxLength* source =
::google::protobuf::internal::dynamic_cast_if_available<const LoginHistory__MaxLength*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void LoginHistory__MaxLength::MergeFrom(const LoginHistory__MaxLength& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_openid()) {
set_openid(from.openid());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void LoginHistory__MaxLength::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void LoginHistory__MaxLength::CopyFrom(const LoginHistory__MaxLength& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool LoginHistory__MaxLength::IsInitialized() const {
return true;
}
void LoginHistory__MaxLength::Swap(LoginHistory__MaxLength* other) {
if (other != this) {
std::swap(openid_, other->openid_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata LoginHistory__MaxLength::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = LoginHistory__MaxLength_descriptor_;
metadata.reflection = LoginHistory__MaxLength_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#ifndef _MSC_VER
const int LoginHistory__Index::kGidFieldNumber;
const int LoginHistory__Index::kOpenidFieldNumber;
#endif // !_MSC_VER
LoginHistory__Index::LoginHistory__Index()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:db.LoginHistory._Index)
}
void LoginHistory__Index::InitAsDefaultInstance() {
}
LoginHistory__Index::LoginHistory__Index(const LoginHistory__Index& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:db.LoginHistory._Index)
}
void LoginHistory__Index::SharedCtor() {
::google::protobuf::internal::GetEmptyString();
_cached_size_ = 0;
gid_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
openid_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
LoginHistory__Index::~LoginHistory__Index() {
// @@protoc_insertion_point(destructor:db.LoginHistory._Index)
SharedDtor();
}
void LoginHistory__Index::SharedDtor() {
if (gid_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete gid_;
}
if (openid_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete openid_;
}
if (this != default_instance_) {
}
}
void LoginHistory__Index::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* LoginHistory__Index::descriptor() {
protobuf_AssignDescriptorsOnce();
return LoginHistory__Index_descriptor_;
}
const LoginHistory__Index& LoginHistory__Index::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_db_2fLoginHistory_2eproto();
return *default_instance_;
}
LoginHistory__Index* LoginHistory__Index::default_instance_ = NULL;
LoginHistory__Index* LoginHistory__Index::New() const {
return new LoginHistory__Index;
}
void LoginHistory__Index::Clear() {
if (_has_bits_[0 / 32] & 3) {
if (has_gid()) {
if (gid_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
gid_->clear();
}
}
if (has_openid()) {
if (openid_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
openid_->clear();
}
}
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool LoginHistory__Index::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:db.LoginHistory._Index)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional string gid = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_gid()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->gid().data(), this->gid().length(),
::google::protobuf::internal::WireFormat::PARSE,
"gid");
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_openid;
break;
}
// optional string openid = 2;
case 2: {
if (tag == 18) {
parse_openid:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_openid()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->openid().data(), this->openid().length(),
::google::protobuf::internal::WireFormat::PARSE,
"openid");
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:db.LoginHistory._Index)
return true;
failure:
// @@protoc_insertion_point(parse_failure:db.LoginHistory._Index)
return false;
#undef DO_
}
void LoginHistory__Index::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:db.LoginHistory._Index)
// optional string gid = 1;
if (has_gid()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->gid().data(), this->gid().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"gid");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
1, this->gid(), output);
}
// optional string openid = 2;
if (has_openid()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->openid().data(), this->openid().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"openid");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
2, this->openid(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:db.LoginHistory._Index)
}
::google::protobuf::uint8* LoginHistory__Index::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:db.LoginHistory._Index)
// optional string gid = 1;
if (has_gid()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->gid().data(), this->gid().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"gid");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
1, this->gid(), target);
}
// optional string openid = 2;
if (has_openid()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->openid().data(), this->openid().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"openid");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
2, this->openid(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:db.LoginHistory._Index)
return target;
}
int LoginHistory__Index::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional string gid = 1;
if (has_gid()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->gid());
}
// optional string openid = 2;
if (has_openid()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->openid());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void LoginHistory__Index::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const LoginHistory__Index* source =
::google::protobuf::internal::dynamic_cast_if_available<const LoginHistory__Index*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void LoginHistory__Index::MergeFrom(const LoginHistory__Index& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_gid()) {
set_gid(from.gid());
}
if (from.has_openid()) {
set_openid(from.openid());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void LoginHistory__Index::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void LoginHistory__Index::CopyFrom(const LoginHistory__Index& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool LoginHistory__Index::IsInitialized() const {
return true;
}
void LoginHistory__Index::Swap(LoginHistory__Index* other) {
if (other != this) {
std::swap(gid_, other->gid_);
std::swap(openid_, other->openid_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata LoginHistory__Index::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = LoginHistory__Index_descriptor_;
metadata.reflection = LoginHistory__Index_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#ifndef _MSC_VER
const int LoginHistory::kGidFieldNumber;
const int LoginHistory::kAreaFieldNumber;
const int LoginHistory::kHistoryFieldNumber;
#endif // !_MSC_VER
LoginHistory::LoginHistory()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:db.LoginHistory)
}
void LoginHistory::InitAsDefaultInstance() {
history_ = const_cast< ::db::PlayerLoginHistory*>(&::db::PlayerLoginHistory::default_instance());
}
LoginHistory::LoginHistory(const LoginHistory& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:db.LoginHistory)
}
void LoginHistory::SharedCtor() {
_cached_size_ = 0;
gid_ = GOOGLE_ULONGLONG(0);
area_ = 0u;
history_ = NULL;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
LoginHistory::~LoginHistory() {
// @@protoc_insertion_point(destructor:db.LoginHistory)
SharedDtor();
}
void LoginHistory::SharedDtor() {
if (this != default_instance_) {
delete history_;
}
}
void LoginHistory::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* LoginHistory::descriptor() {
protobuf_AssignDescriptorsOnce();
return LoginHistory_descriptor_;
}
const LoginHistory& LoginHistory::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_db_2fLoginHistory_2eproto();
return *default_instance_;
}
LoginHistory* LoginHistory::default_instance_ = NULL;
LoginHistory* LoginHistory::New() const {
return new LoginHistory;
}
void LoginHistory::Clear() {
if (_has_bits_[0 / 32] & 7) {
gid_ = GOOGLE_ULONGLONG(0);
area_ = 0u;
if (has_history()) {
if (history_ != NULL) history_->::db::PlayerLoginHistory::Clear();
}
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool LoginHistory::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:db.LoginHistory)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// required uint64 gid = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &gid_)));
set_has_gid();
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_area;
break;
}
// required uint32 area = 2;
case 2: {
if (tag == 16) {
parse_area:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &area_)));
set_has_area();
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_history;
break;
}
// optional .db.PlayerLoginHistory history = 3;
case 3: {
if (tag == 26) {
parse_history:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_history()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:db.LoginHistory)
return true;
failure:
// @@protoc_insertion_point(parse_failure:db.LoginHistory)
return false;
#undef DO_
}
void LoginHistory::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:db.LoginHistory)
// required uint64 gid = 1;
if (has_gid()) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(1, this->gid(), output);
}
// required uint32 area = 2;
if (has_area()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->area(), output);
}
// optional .db.PlayerLoginHistory history = 3;
if (has_history()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, this->history(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:db.LoginHistory)
}
::google::protobuf::uint8* LoginHistory::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:db.LoginHistory)
// required uint64 gid = 1;
if (has_gid()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(1, this->gid(), target);
}
// required uint32 area = 2;
if (has_area()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->area(), target);
}
// optional .db.PlayerLoginHistory history = 3;
if (has_history()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
3, this->history(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:db.LoginHistory)
return target;
}
int LoginHistory::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// required uint64 gid = 1;
if (has_gid()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->gid());
}
// required uint32 area = 2;
if (has_area()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->area());
}
// optional .db.PlayerLoginHistory history = 3;
if (has_history()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->history());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void LoginHistory::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const LoginHistory* source =
::google::protobuf::internal::dynamic_cast_if_available<const LoginHistory*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void LoginHistory::MergeFrom(const LoginHistory& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_gid()) {
set_gid(from.gid());
}
if (from.has_area()) {
set_area(from.area());
}
if (from.has_history()) {
mutable_history()->::db::PlayerLoginHistory::MergeFrom(from.history());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void LoginHistory::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void LoginHistory::CopyFrom(const LoginHistory& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool LoginHistory::IsInitialized() const {
if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false;
if (has_history()) {
if (!this->history().IsInitialized()) return false;
}
return true;
}
void LoginHistory::Swap(LoginHistory* other) {
if (other != this) {
std::swap(gid_, other->gid_);
std::swap(area_, other->area_);
std::swap(history_, other->history_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata LoginHistory::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = LoginHistory_descriptor_;
metadata.reflection = LoginHistory_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int LoginLatest__PrimaryKey::kGidFieldNumber;
#endif // !_MSC_VER
LoginLatest__PrimaryKey::LoginLatest__PrimaryKey()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:db.LoginLatest._PrimaryKey)
}
void LoginLatest__PrimaryKey::InitAsDefaultInstance() {
}
LoginLatest__PrimaryKey::LoginLatest__PrimaryKey(const LoginLatest__PrimaryKey& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:db.LoginLatest._PrimaryKey)
}
void LoginLatest__PrimaryKey::SharedCtor() {
_cached_size_ = 0;
gid_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
LoginLatest__PrimaryKey::~LoginLatest__PrimaryKey() {
// @@protoc_insertion_point(destructor:db.LoginLatest._PrimaryKey)
SharedDtor();
}
void LoginLatest__PrimaryKey::SharedDtor() {
if (this != default_instance_) {
}
}
void LoginLatest__PrimaryKey::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* LoginLatest__PrimaryKey::descriptor() {
protobuf_AssignDescriptorsOnce();
return LoginLatest__PrimaryKey_descriptor_;
}
const LoginLatest__PrimaryKey& LoginLatest__PrimaryKey::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_db_2fLoginHistory_2eproto();
return *default_instance_;
}
LoginLatest__PrimaryKey* LoginLatest__PrimaryKey::default_instance_ = NULL;
LoginLatest__PrimaryKey* LoginLatest__PrimaryKey::New() const {
return new LoginLatest__PrimaryKey;
}
void LoginLatest__PrimaryKey::Clear() {
gid_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool LoginLatest__PrimaryKey::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:db.LoginLatest._PrimaryKey)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 gid = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &gid_)));
set_has_gid();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:db.LoginLatest._PrimaryKey)
return true;
failure:
// @@protoc_insertion_point(parse_failure:db.LoginLatest._PrimaryKey)
return false;
#undef DO_
}
void LoginLatest__PrimaryKey::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:db.LoginLatest._PrimaryKey)
// optional uint32 gid = 1;
if (has_gid()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->gid(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:db.LoginLatest._PrimaryKey)
}
::google::protobuf::uint8* LoginLatest__PrimaryKey::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:db.LoginLatest._PrimaryKey)
// optional uint32 gid = 1;
if (has_gid()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->gid(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:db.LoginLatest._PrimaryKey)
return target;
}
int LoginLatest__PrimaryKey::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 gid = 1;
if (has_gid()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->gid());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void LoginLatest__PrimaryKey::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const LoginLatest__PrimaryKey* source =
::google::protobuf::internal::dynamic_cast_if_available<const LoginLatest__PrimaryKey*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void LoginLatest__PrimaryKey::MergeFrom(const LoginLatest__PrimaryKey& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_gid()) {
set_gid(from.gid());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void LoginLatest__PrimaryKey::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void LoginLatest__PrimaryKey::CopyFrom(const LoginLatest__PrimaryKey& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool LoginLatest__PrimaryKey::IsInitialized() const {
return true;
}
void LoginLatest__PrimaryKey::Swap(LoginLatest__PrimaryKey* other) {
if (other != this) {
std::swap(gid_, other->gid_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata LoginLatest__PrimaryKey::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = LoginLatest__PrimaryKey_descriptor_;
metadata.reflection = LoginLatest__PrimaryKey_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#ifndef _MSC_VER
const int LoginLatest::kGidFieldNumber;
const int LoginLatest::kAreaFieldNumber;
#endif // !_MSC_VER
LoginLatest::LoginLatest()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:db.LoginLatest)
}
void LoginLatest::InitAsDefaultInstance() {
}
LoginLatest::LoginLatest(const LoginLatest& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:db.LoginLatest)
}
void LoginLatest::SharedCtor() {
_cached_size_ = 0;
gid_ = GOOGLE_ULONGLONG(0);
area_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
LoginLatest::~LoginLatest() {
// @@protoc_insertion_point(destructor:db.LoginLatest)
SharedDtor();
}
void LoginLatest::SharedDtor() {
if (this != default_instance_) {
}
}
void LoginLatest::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* LoginLatest::descriptor() {
protobuf_AssignDescriptorsOnce();
return LoginLatest_descriptor_;
}
const LoginLatest& LoginLatest::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_db_2fLoginHistory_2eproto();
return *default_instance_;
}
LoginLatest* LoginLatest::default_instance_ = NULL;
LoginLatest* LoginLatest::New() const {
return new LoginLatest;
}
void LoginLatest::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<LoginLatest*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
ZR_(gid_, area_);
#undef OFFSET_OF_FIELD_
#undef ZR_
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool LoginLatest::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:db.LoginLatest)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// required uint64 gid = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &gid_)));
set_has_gid();
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_area;
break;
}
// required uint32 area = 2;
case 2: {
if (tag == 16) {
parse_area:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &area_)));
set_has_area();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:db.LoginLatest)
return true;
failure:
// @@protoc_insertion_point(parse_failure:db.LoginLatest)
return false;
#undef DO_
}
void LoginLatest::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:db.LoginLatest)
// required uint64 gid = 1;
if (has_gid()) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(1, this->gid(), output);
}
// required uint32 area = 2;
if (has_area()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->area(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:db.LoginLatest)
}
::google::protobuf::uint8* LoginLatest::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:db.LoginLatest)
// required uint64 gid = 1;
if (has_gid()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(1, this->gid(), target);
}
// required uint32 area = 2;
if (has_area()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->area(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:db.LoginLatest)
return target;
}
int LoginLatest::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// required uint64 gid = 1;
if (has_gid()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->gid());
}
// required uint32 area = 2;
if (has_area()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->area());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void LoginLatest::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const LoginLatest* source =
::google::protobuf::internal::dynamic_cast_if_available<const LoginLatest*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void LoginLatest::MergeFrom(const LoginLatest& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_gid()) {
set_gid(from.gid());
}
if (from.has_area()) {
set_area(from.area());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void LoginLatest::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void LoginLatest::CopyFrom(const LoginLatest& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool LoginLatest::IsInitialized() const {
if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false;
return true;
}
void LoginLatest::Swap(LoginLatest* other) {
if (other != this) {
std::swap(gid_, other->gid_);
std::swap(area_, other->area_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata LoginLatest::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = LoginLatest_descriptor_;
metadata.reflection = LoginLatest_reflection_;
return metadata;
}
// @@protoc_insertion_point(namespace_scope)
} // namespace db
// @@protoc_insertion_point(global_scope)
| jj4jj/playground | proto/gen/db/LoginHistory.pb.cc | C++ | mit | 75,894 |
---
layout: page
title: Chrome Valley Entertainment Party
date: 2016-05-24
author: Joe Mcdowell
tags: weekly links, java
status: published
summary: Duis nunc quam, pharetra ac interdum non, lobortis in est.
banner: images/banner/wedding.jpg
booking:
startDate: 01/28/2016
endDate: 02/01/2016
ctyhocn: ISTKBHX
groupCode: CVEP
published: true
---
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam eu tortor mi. Etiam consectetur, magna sit amet placerat placerat, lorem metus volutpat erat, sit amet facilisis eros nunc sed ipsum. Aliquam tempus, dui quis tempor consequat, ipsum est varius ipsum, nec rhoncus velit metus viverra tellus. Pellentesque porttitor sapien sed blandit eleifend. In rhoncus lacus vitae erat luctus interdum. Vivamus maximus cursus quam vitae venenatis. Suspendisse potenti. Ut ac condimentum tellus. Aliquam magna ante, lacinia nec tortor a, elementum egestas massa.
* Etiam accumsan justo eu lobortis sodales
* Pellentesque quis massa viverra, volutpat enim et, iaculis leo
* Cras ut mi vel sem rutrum laoreet ut in tellus.
Donec pharetra gravida facilisis. Aenean porta augue mauris, ut gravida sem aliquam a. Curabitur tempus non augue sit amet mattis. Curabitur id ipsum egestas, eleifend tellus convallis, euismod lacus. Aliquam aliquam sagittis sodales. Integer nunc odio, condimentum non risus quis, mattis tincidunt urna. Pellentesque congue, est a tempor bibendum, arcu quam facilisis tortor, at hendrerit turpis libero in dolor. Proin auctor arcu id elit ultrices, id blandit mi imperdiet. Nam vulputate nunc ut lacus semper porta. Nulla dictum eu lacus et vulputate. Donec viverra arcu ac arcu mollis pellentesque. Fusce orci dui, eleifend quis tincidunt id, tincidunt at tellus.
| KlishGroup/prose-pogs | pogs/I/ISTKBHX/CVEP/index.md | Markdown | mit | 1,739 |
package aquostv
import "errors"
type AQUOS_SCREEN_SIZE struct {
COMMAND string
STATUS string
TOGGLE string
NORMAL string
SMART_ZOOM string
WIDE string
CINEMA string
FULL string
FULL_1 string
FULL_2 string
UNDER_SCAN string
DOT_BY_DOT string
}
func initScreenSize() *AQUOS_SCREEN_SIZE {
return &AQUOS_SCREEN_SIZE{
COMMAND: "WIDE",
STATUS: "????",
TOGGLE: "0000",
NORMAL: "0001",
SMART_ZOOM: "0002",
WIDE: "0003",
CINEMA: "0004",
FULL: "0005",
FULL_1: "0006",
FULL_2: "0007",
UNDER_SCAN: "0008",
DOT_BY_DOT: "0009",
}
}
func (tv *TV) screenSize() {
switch tv.responseRaw {
case "OK":
tv.responseDescription = "OK"
case "ERR":
tv.responseDescription = "ERR"
case "1":
tv.responseDescription = "NORMAL"
case "2":
tv.responseDescription = "SMART_ZOOM"
case "3":
tv.responseDescription = "WIDE"
case "4":
tv.responseDescription = "CINEMA"
case "5":
tv.responseDescription = "FULL"
case "6":
tv.responseDescription = "FULL_1"
case "7":
tv.responseDescription = "FULL_2"
case "8":
tv.responseDescription = "UNDER_SCAN"
case "9":
tv.responseDescription = "DOT_BY_DOT"
default:
tv.responseError = errors.New("Unknown ERROR.")
}
}
| tknhs/aquostv | screensize.go | GO | mit | 1,278 |
C $Header$
C $Name$
CBOP
C !ROUTINE: CPL_TAVE.h
C !INTERFACE:
C include "CPL_TAVE.h"
C !DESCRIPTION:
C \bv
C *==========================================================*
C | CPL_TAVE.h
C | o Header for CPL time-average diagnostics
C *==========================================================*
C | Declares global arrays used for holding/accumulating
C | diagnostic output from CPL.
C *==========================================================*
C \ev
CEOP
#ifdef COMPONENT_MODULE
#ifdef ALLOW_TIMEAVE
C-- COMMON /CPL_TAVE_VARS/ Time average CPL-variables
C CPL_timeAve :: Cumulated time [s]
C SLPtave :: Atmospheric Sea-Level pressure [Pa=N/m2]
C HFtave :: Net surface heat-flux [W/m2, +=upward]
C QSWtave :: Net shortwave heat flux [W/m2, +=upward]
C TXtave :: Surface stress [Pa=N/m2], zonal compon.
C TYtave :: Surface stress [Pa=N/m2], merid compon.
C FWtave :: Net fresh water flux (=E-P-R) [kg/m2/s, +=upward]
C SFxtave :: Salt flux (from sea-ice) [psu.kg/m2/s, +=upward]
C SICtave :: Sea-ice mass [kg/m2]
C MXLtave :: Ocean mixed-layer depth [m]
C SSTtave :: Ocean surface temperature [oC]
C SSStave :: Ocean surface salinity [psu]
C vSqtave :: Ocean surface velocity square [m2/s2]
C aC02tave :: CO2 level in atm [parts by volume]
C sWSpdtave :: Surface wind speed [m/s]
C iceftave :: Fraction of ocean covered by seaice
C fCO2tave :: Flux of CO2 from ocean->atm [mol/m2/s]
COMMON /CPL_TAVE_VARS/
& CPL_timeAve,
& SLPtave, HFtave, QSWtave,
& TXtave, TYtave,
& FWtave, SFxtave, SICtave,
& MXLtave, SSTtave, SSStave, vSqtave
#ifdef ALLOW_DIC
& , aCO2tave, sWSpdtave,
& iceftave, fCO2tave
#endif /* ALLOW_DIC */
_RL CPL_timeAve(nSx,nSy)
_RL SLPtave (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
_RL HFtave (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
_RL QSWtave (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
_RL TXtave (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
_RL TYtave (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
_RL FWtave (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
_RL SFxtave (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
_RL SICtave (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
_RL MXLtave (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
_RL SSTtave (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
_RL SSStave (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
_RL vSqtave (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
#ifdef ALLOW_DIC
_RL aCO2tave (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
_RL sWSpdtave (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
_RL iceftave (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
_RL fCO2tave (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
#endif /* ALLOW_DIC */
#endif /* ALLOW_TIMEAVE */
#endif /* COMPONENT_MODULE */
CEH3 ;;; Local Variables: ***
CEH3 ;;; mode:fortran ***
CEH3 ;;; End: ***
| altMITgcm/MITgcm66h | pkg/ocn_compon_interf/CPL_TAVE.h | C | mit | 3,129 |
<div id='upcoming_info'>
<div id='upcoming_list_box'>
<!-- dvr_upcoming_list -->
</div>
</div>
| demonrik/HDHR-DVRUI | app/style/upcoming_list.html | HTML | mit | 104 |
<?php
// autoload.php @generated by Composer
require_once __DIR__ . '/composer' . '/autoload_real.php';
return ComposerAutoloaderInit8a71b68d824f49abb163917c18b73821::getLoader();
| Aethia/MultimediaBackEnd | vendor/autoload.php | PHP | mit | 183 |
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>three.js webgl - materials - shaders [Monjori]</title>
<meta charset="utf-8">
<style type="text/css">
body {
color: #ffffff;
font-family:Monospace;
font-size:13px;
text-align:center;
font-weight: bold;
background-color: #000000;
margin: 0px;
overflow: hidden;
}
#info {
position: absolute;
top: 0px; width: 100%;
padding: 5px;
}
a {
color: #ffffff;
}
#oldie a { color:#da0 }
</style>
</head>
<body>
<div id="container"></div>
<div id="info"><a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - shader demo. featuring <a href="http://www.pouet.net/prod.php?which=52761" target="_blank">Monjori by Mic</a></div>
<script type="text/javascript" src="../build/Three.js"></script>
<script type="text/javascript" src="js/Detector.js"></script>
<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
<script type="text/javascript" src="js/Stats.js"></script>
<script id="vertexShader" type="x-shader/x-vertex">
void main()
{
gl_Position = vec4( position, 1.0 );
}
</script>
<script id="fragmentShader" type="x-shader/x-fragment">
#ifdef GL_ES
precision highp float;
#endif
uniform vec2 resolution;
uniform float time;
void main(void)
{
vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / resolution.xy;
float a = time*40.0;
float d,e,f,g=1.0/40.0,h,i,r,q;
e=400.0*(p.x*0.5+0.5);
f=400.0*(p.y*0.5+0.5);
i=200.0+sin(e*g+a/150.0)*20.0;
d=200.0+cos(f*g/2.0)*18.0+cos(e*g)*7.0;
r=sqrt(pow(i-e,2.0)+pow(d-f,2.0));
q=f/r;
e=(r*cos(q))-a/2.0;f=(r*sin(q))-a/2.0;
d=sin(e*g)*176.0+sin(e*g)*164.0+r;
h=((f+d)+a/2.0)*g;
i=cos(h+r*p.x/1.3)*(e+e+a)+cos(q*g*6.0)*(r+h/3.0);
h=sin(f*g)*144.0-sin(e*g)*212.0*p.x;
h=(h+(f-e)*q+sin(r-(a+h)/7.0)*10.0+i/4.0)*g;
i+=cos(h*2.3*sin(a/350.0-q))*184.0*sin(q-(r*4.3+a/12.0)*g)+tan(r*g+h)*184.0*cos(r*g+h);
i=mod(i/5.6,256.0)/64.0;
if(i<0.0) i+=4.0;
if(i>=2.0) i=4.0-i;
d=r/350.0;
d+=sin(d*d*8.0)*0.52;
f=(sin(a*g)+1.0)/2.0;
gl_FragColor=vec4(vec3(f*i/1.6,i/2.0+d/13.0,i)*d*p.x+vec3(i/1.3+d/8.0,i/2.0+d/18.0,i)*d*(1.0-p.x),1.0);
}
</script>
<script type="text/javascript">
if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
var container, stats;
var camera, scene, renderer;
var uniforms, material, mesh;
var mouseX = 0, mouseY = 0,
lat = 0, lon = 0, phy = 0, theta = 0;
var windowHalfX = window.innerWidth / 2;
var windowHalfY = window.innerHeight / 2;
init();
animate();
function init() {
container = document.getElementById( 'container' );
camera = new THREE.Camera();
camera.position.z = 1;
scene = new THREE.Scene();
uniforms = {
time: { type: "f", value: 1.0 },
resolution: { type: "v2", value: new THREE.Vector2() }
};
material = new THREE.MeshShaderMaterial( {
uniforms: uniforms,
vertexShader: document.getElementById( 'vertexShader' ).textContent,
fragmentShader: document.getElementById( 'fragmentShader' ).textContent
} );
mesh = new THREE.Mesh( new THREE.Plane( 2, 2 ), material );
scene.addObject( mesh );
renderer = new THREE.WebGLRenderer();
container.appendChild( renderer.domElement );
stats = new Stats();
stats.domElement.style.position = 'absolute';
stats.domElement.style.top = '0px';
container.appendChild( stats.domElement );
onWindowResize();
window.addEventListener( 'resize', onWindowResize, false );
}
function onWindowResize( event ) {
uniforms.resolution.value.x = window.innerWidth;
uniforms.resolution.value.y = window.innerHeight;
renderer.setSize( window.innerWidth, window.innerHeight );
}
//
function animate() {
requestAnimationFrame( animate );
render();
stats.update();
}
function render() {
uniforms.time.value += 0.05;
renderer.render( scene, camera );
}
</script>
</body>
</html>
| pixelfly9/web3DModeler.js | examples/webgl_shader.html | HTML | mit | 4,088 |
package com.supyuan.util.tuple;
/**
* 五元组
* @param <A>
* @param <B>
* @param <C>
* @param <D>
* @param <E>
*/
public class FiveTuple<A, B, C, D, E> extends FourTuple<A, B, C, D> {
public final E fifth;
public FiveTuple(A a, B b, C c, D d, E e) {
super(a, b, c, d);
fifth = e;
}
public String toString() {
return "(" + first + ", " + second + ", " + third + ", " + fourth
+ ", " + fifth + ")";
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((fifth == null) ? 0 : fifth.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!super.equals(obj)) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
@SuppressWarnings("rawtypes")
FiveTuple other = (FiveTuple) obj;
if (fifth == null) {
if (other.fifth != null) {
return false;
}
} else if (!fifth.equals(other.fifth)) {
return false;
}
return true;
}
@Override
public int size() {
return 5;
}
@Override
public Object[] toArray() {
return new Object[]{first, second, third, fourth, fifth};
}
}
| jackcuishao/jfinal-admin | src/main/java/com/supyuan/util/tuple/FiveTuple.java | Java | mit | 1,193 |
# RAT
Inspired by:
- Cholo (C) 1986 Solid Image
- Cholo (C) 2005 Ovine By Design
## Installing
Requires three.min.js and helvetiker_regular.typeface.js to run.
## Quick Guide
Use [W],[S],[A], and [D] to move, and the mouse to look around.
Find the computer in the room and select the mission file with [1]. It will
provide more information. | DrKylstein/rat | README.md | Markdown | mit | 347 |
const DrawCard = require('../../drawcard.js');
class RecruiterForTheWatch extends DrawCard {
setupCardAbilities(ability) {
this.persistentEffect({
match: this,
effect: ability.effects.optionalStandDuringStanding()
});
this.action({
title: 'Take control of character',
phase: 'marshal',
cost: ability.costs.kneelSelf(),
target: {
activePromptTitle: 'Select character with printed cost 2 or less',
cardCondition: card => card.getType() === 'character' && card.location === 'play area' &&
card.controller !== this.controller && card.getPrintedCost() <= 2
},
handler: context => {
this.game.addMessage('{0} kneels {1} to take control of {2}', this.controller, this, context.target);
this.lastingEffect(ability => ({
until: {
onCardStood: event => event.card === this,
onCardLeftPlay: event => event.card === this || event.card === context.target
},
match: context.target,
effect: ability.effects.takeControl(this.controller)
}));
}
});
}
}
RecruiterForTheWatch.code = '06045';
module.exports = RecruiterForTheWatch;
| DukeTax/throneteki | server/game/cards/06.3-TFoA/RecruiterForTheWatch.js | JavaScript | mit | 1,391 |
/*
Stream.cpp - adds parsing methods to Stream class
Copyright (c) 2008 David A. Mellis. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Created July 2011
parsing functions based on TextFinder library by Michael Margolis
findMulti/findUntil routines written by Jim Leonard/Xuth
*/
#include "Arduino.h"
#include "Stream.h"
#define PARSE_TIMEOUT 1000 // default number of milli-seconds to wait
#define NO_SKIP_CHAR 1 // a magic char not found in a valid ASCII numeric field
// private method to read stream with timeout
int Stream::timedRead()
{
int c;
_startMillis = millis();
do {
c = read();
if (c >= 0) return c;
} while(millis() - _startMillis < _timeout);
return -1; // -1 indicates timeout
}
// private method to peek stream with timeout
int Stream::timedPeek()
{
int c;
_startMillis = millis();
do {
c = peek();
if (c >= 0) return c;
} while(millis() - _startMillis < _timeout);
return -1; // -1 indicates timeout
}
// returns peek of the next digit in the stream or -1 if timeout
// discards non-numeric characters
int Stream::peekNextDigit()
{
int c;
while (1) {
c = timedPeek();
if (c < 0) return c; // timeout
if (c == '-') return c;
if (c >= '0' && c <= '9') return c;
read(); // discard non-numeric
}
}
// Public Methods
//////////////////////////////////////////////////////////////
void Stream::setTimeout(unsigned long timeout) // sets the maximum number of milliseconds to wait
{
_timeout = timeout;
}
// find returns true if the target string is found
bool Stream::find(char *target)
{
return findUntil(target, strlen(target), NULL, 0);
}
// reads data from the stream until the target string of given length is found
// returns true if target string is found, false if timed out
bool Stream::find(char *target, size_t length)
{
return findUntil(target, length, NULL, 0);
}
// as find but search ends if the terminator string is found
bool Stream::findUntil(char *target, char *terminator)
{
return findUntil(target, strlen(target), terminator, strlen(terminator));
}
// reads data from the stream until the target string of the given length is found
// search terminated if the terminator string is found
// returns true if target string is found, false if terminated or timed out
bool Stream::findUntil(char *target, size_t targetLen, char *terminator, size_t termLen)
{
if (terminator == NULL) {
MultiTarget t[1] = {{target, targetLen, 0}};
return findMulti(t, 1) == 0 ? true : false;
} else {
MultiTarget t[2] = {{target, targetLen, 0}, {terminator, termLen, 0}};
return findMulti(t, 2) == 0 ? true : false;
}
}
// returns the first valid (long) integer value from the current position.
// initial characters that are not digits (or the minus sign) are skipped
// function is terminated by the first character that is not a digit.
long Stream::parseInt()
{
return parseInt(NO_SKIP_CHAR); // terminate on first non-digit character (or timeout)
}
// as above but a given skipChar is ignored
// this allows format characters (typically commas) in values to be ignored
long Stream::parseInt(char skipChar)
{
bool isNegative = false;
long value = 0;
int c;
c = peekNextDigit();
// ignore non numeric leading characters
if(c < 0)
return 0; // zero returned if timeout
do{
if(c == skipChar)
; // ignore this charactor
else if(c == '-')
isNegative = true;
else if(c >= '0' && c <= '9') // is c a digit?
value = value * 10 + c - '0';
read(); // consume the character we got with peek
c = timedPeek();
}
while( (c >= '0' && c <= '9') || c == skipChar );
if(isNegative)
value = -value;
return value;
}
// as parseInt but returns a floating point value
float Stream::parseFloat()
{
return parseFloat(NO_SKIP_CHAR);
}
// as above but the given skipChar is ignored
// this allows format characters (typically commas) in values to be ignored
float Stream::parseFloat(char skipChar){
bool isNegative = false;
bool isFraction = false;
long value = 0;
char c;
float fraction = 1.0;
c = peekNextDigit();
// ignore non numeric leading characters
if(c < 0)
return 0; // zero returned if timeout
do{
if(c == skipChar)
; // ignore
else if(c == '-')
isNegative = true;
else if (c == '.')
isFraction = true;
else if(c >= '0' && c <= '9') { // is c a digit?
value = value * 10 + c - '0';
if(isFraction)
fraction *= 0.1f;
}
read(); // consume the character we got with peek
c = timedPeek();
}
while( (c >= '0' && c <= '9') || c == '.' || c == skipChar );
if(isNegative)
value = -value;
if(isFraction)
return value * fraction;
else
return (float)value;
}
// read characters from stream into buffer
// terminates if length characters have been read, or timeout (see setTimeout)
// returns the number of characters placed in the buffer
// the buffer is NOT null terminated.
//
size_t Stream::readBytes(char *buffer, size_t length)
{
size_t count = 0;
while (count < length) {
int c = timedRead();
if (c < 0) break;
*buffer++ = (char)c;
count++;
}
return count;
}
// as readBytes with terminator character
// terminates if length characters have been read, timeout, or if the terminator character detected
// returns the number of characters placed in the buffer (0 means no valid data found)
size_t Stream::readBytesUntil(char terminator, char *buffer, size_t length)
{
if (length < 1) return 0;
size_t index = 0;
while (index < length) {
int c = timedRead();
if (c < 0 || c == terminator) break;
*buffer++ = (char)c;
index++;
}
return index; // return number of characters, not including null terminator
}
String Stream::readString()
{
String ret;
int c = timedRead();
while (c >= 0)
{
ret += (char)c;
c = timedRead();
}
return ret;
}
String Stream::readStringUntil(char terminator)
{
String ret;
int c = timedRead();
while (c >= 0 && c != terminator)
{
ret += (char)c;
c = timedRead();
}
return ret;
}
int Stream::findMulti( struct Stream::MultiTarget *targets, int tCount) {
// any zero length target string automatically matches and would make
// a mess of the rest of the algorithm.
for (struct MultiTarget *t = targets; t < targets+tCount; ++t) {
if (t->len <= 0)
return t - targets;
}
while (1) {
int c = timedRead();
if (c < 0)
return -1;
for (struct MultiTarget *t = targets; t < targets+tCount; ++t) {
// the simple case is if we match, deal with that first.
if (c == t->str[t->index]) {
if (++t->index == t->len)
return t - targets;
else
continue;
}
// if not we need to walk back and see if we could have matched further
// down the stream (ie '1112' doesn't match the first position in '11112'
// but it will match the second position so we can't just reset the current
// index to 0 when we find a mismatch.
if (t->index == 0)
continue;
int origIndex = t->index;
do {
--t->index;
// first check if current char works against the new current index
if (c != t->str[t->index])
continue;
// if it's the only char then we're good, nothing more to check
if (t->index == 0) {
t->index++;
break;
}
// otherwise we need to check the rest of the found string
int diff = origIndex - t->index;
size_t i;
for (i = 0; i < t->index; ++i) {
if (t->str[i] != t->str[i + diff])
break;
}
// if we successfully got through the previous loop then our current
// index is good.
if (i == t->index) {
t->index++;
break;
}
// otherwise we just try the next index
} while (t->index);
}
}
// unreachable
return -1;
}
| ms-iot/lightning | SDKFromArduino/source/Stream.cpp | C++ | mit | 8,685 |
<?php
/* TwigBundle:Exception:error.atom.twig */
class __TwigTemplate_8042861317bd89a23eb7e5b69872d417c01282c341e6b1c74097f4dcf62680bd extends Twig_Template
{
public function __construct(Twig_Environment $env)
{
parent::__construct($env);
$this->parent = false;
$this->blocks = array(
);
}
protected function doDisplay(array $context, array $blocks = array())
{
// line 1
$this->env->loadTemplate("TwigBundle:Exception:error.xml.twig")->display($context);
}
public function getTemplateName()
{
return "TwigBundle:Exception:error.atom.twig";
}
public function getDebugInfo()
{
return array ( 19 => 1,);
}
}
| equipelesexperts/new-expert | app/cache/dev/twig/80/42/861317bd89a23eb7e5b69872d417c01282c341e6b1c74097f4dcf62680bd.php | PHP | mit | 725 |
require "spec_helper"
require "benchmark"
users = []
50.times { users << User.create! }
group = Group.create!
users.each { |u| u.follow(group) }
Benchmark.bmbm do |x|
x.report("before") { group.followers }
end
RSpec.configure do |c|
c.before(:all) { DatabaseCleaner[:mongoid].strategy = [:deletion] }
c.before(:each) { DatabaseCleaner.clean }
end
| joe1chen/mongo_followable | spec/mongo/performance_spec.rb | Ruby | mit | 358 |
package cz.pfreiberg.knparser.domain.rizeni;
import java.util.Date;
import cz.pfreiberg.knparser.domain.DomainWithDate;
import cz.pfreiberg.knparser.util.VfkUtil;
/**
*
* Třída reprezentující
* "Přiřazení listin k nemovitostem, vlastnictví a jiným právním vztahům".
*
* @author Petr Freiberg ([email protected])
*
*/
public class RList implements DomainWithDate {
private Long id;
private Integer stavDat;
private Date datumVzniku;
private Date datumZaniku;
private Integer priznakKontextu;
private Long rizeniIdVzniku;
private Long rizeniIdZaniku;
private Long listinId;
private Long parId;
private Long budId;
private Long jedId;
private Long opsubId;
private Long jpvId;
private Date datumVzniku2;
private Long rizeniIdVzniku2;
private Long psId;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Integer getStavDat() {
return stavDat;
}
public void setStavDat(Integer stavDat) {
this.stavDat = stavDat;
}
public Date getDatumVzniku() {
return datumVzniku;
}
public void setDatumVzniku(Date datumVzniku) {
this.datumVzniku = datumVzniku;
}
public Date getDatumZaniku() {
return datumZaniku;
}
public void setDatumZaniku(Date datumZaniku) {
this.datumZaniku = datumZaniku;
}
public Integer getPriznakKontextu() {
return priznakKontextu;
}
public void setPriznakKontextu(Integer priznakKontextu) {
this.priznakKontextu = priznakKontextu;
}
public Long getRizeniIdVzniku() {
return rizeniIdVzniku;
}
public void setRizeniIdVzniku(Long rizeniIdVzniku) {
this.rizeniIdVzniku = rizeniIdVzniku;
}
public Long getRizeniIdZaniku() {
return rizeniIdZaniku;
}
public void setRizeniIdZaniku(Long rizeniIdZaniku) {
this.rizeniIdZaniku = rizeniIdZaniku;
}
public Long getListinId() {
return listinId;
}
public void setListinId(Long listinId) {
this.listinId = listinId;
}
public Long getParId() {
return parId;
}
public void setParId(Long parId) {
this.parId = parId;
}
public Long getBudId() {
return budId;
}
public void setBudId(Long budId) {
this.budId = budId;
}
public Long getJedId() {
return jedId;
}
public void setJedId(Long jedId) {
this.jedId = jedId;
}
public Long getOpsubId() {
return opsubId;
}
public void setOpsubId(Long opsubId) {
this.opsubId = opsubId;
}
public Long getJpvId() {
return jpvId;
}
public void setJpvId(Long jpvId) {
this.jpvId = jpvId;
}
public Date getDatumVzniku2() {
return datumVzniku2;
}
public void setDatumVzniku2(Date datumVzniku2) {
this.datumVzniku2 = datumVzniku2;
}
public Long getRizeniIdVzniku2() {
return rizeniIdVzniku2;
}
public void setRizeniIdVzniku2(Long rizeniIdVzniku2) {
this.rizeniIdVzniku2 = rizeniIdVzniku2;
}
public Long getPsId() {
return psId;
}
public void setPsId(Long psId) {
this.psId = psId;
}
@Override
public String toString() {
return "" + VfkUtil.formatValue(id) + ","
+ VfkUtil.formatValue(stavDat) + ","
+ VfkUtil.formatValue(datumVzniku) + ","
+ VfkUtil.formatValue(datumZaniku) + ","
+ VfkUtil.formatValue(priznakKontextu) + ","
+ VfkUtil.formatValue(rizeniIdVzniku) + ","
+ VfkUtil.formatValue(rizeniIdZaniku) + ","
+ VfkUtil.formatValue(listinId) + ","
+ VfkUtil.formatValue(parId) + ","
+ VfkUtil.formatValue(budId) + ","
+ VfkUtil.formatValue(jedId) + ","
+ VfkUtil.formatValue(opsubId) + ","
+ VfkUtil.formatValue(jpvId) + ","
+ VfkUtil.formatValue(datumVzniku2) + ","
+ VfkUtil.formatValue(rizeniIdVzniku2) + ","
+ VfkUtil.formatValue(psId)
+ VfkUtil.getTerminator();
}
}
| pfreiberg/knparser | src/main/java/cz/pfreiberg/knparser/domain/rizeni/RList.java | Java | mit | 3,843 |
class Sprue::Worker < Sprue::Agent
# == Extensions ===========================================================
# == Constants ============================================================
# == Properties ===========================================================
# == Class Methods ========================================================
# == Instance Methods =====================================================
protected
def handle_job(job)
job.perform(self) and job.delete!
true
end
end
| twg/sprue | lib/sprue/worker.rb | Ruby | mit | 520 |
using inSyca.foundation.framework.application;
using inSyca.foundation.framework.application.windowsforms;
using inSyca.foundation.framework.diagnostics;
using System.Collections.Generic;
using System.Windows.Forms;
namespace inSyca.foundation.framework.configurator
{
public partial class uc_information : uc_info
{
internal uc_information(configXml _configFile, List<IInformation> _information)
: base(_configFile, _information)
{
InitializeComponent();
}
internal uc_information(configXml _configFile, IInformation _information)
: base(_configFile, _information)
{
InitializeComponent();
}
override protected void LoadConfiguration()
{
base.LoadConfiguration();
propertyComponent.AddProperty("Foundation Framework Version", information[0].Version, string.Empty, "inSyca Foundation", typeof(string), true, false);
propertyComponent.AddProperty("Location", configFile.configFileName, string.Empty, "inSyca Foundation", typeof(string), true, false);
propertyComponent.AddProperty("Configurator Version", Application.ProductVersion, string.Empty, "inSyca Foundation", typeof(string), true, false);
}
}
}
| iwekardum/inSyca-Suite | inSyca.foundation.framework/inSyca.foundation.framework_40/inSyca.fd.fr.configurator_40/uc_information.cs | C# | mit | 1,323 |
\hypertarget{program__main_8cpp}{}\section{program\+\_\+main.\+cpp File Reference}
\label{program__main_8cpp}\index{program\+\_\+main.\+cpp@{program\+\_\+main.\+cpp}}
{\ttfamily \#include \char`\"{}Employee\+Manager.\+hpp\char`\"{}}\\*
Include dependency graph for program\+\_\+main.\+cpp\+:
% FIG 0
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item
int \hyperlink{program__main_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4}{main} ()
\end{DoxyCompactItemize}
\subsection{Function Documentation}
\index{program\+\_\+main.\+cpp@{program\+\_\+main.\+cpp}!main@{main}}
\index{main@{main}!program\+\_\+main.\+cpp@{program\+\_\+main.\+cpp}}
\subsubsection[{\texorpdfstring{main()}{main()}}]{\setlength{\rightskip}{0pt plus 5cm}int main (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}\hypertarget{program__main_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4}{}\label{program__main_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4}
| Rachels-Courses/CS250-Data-Structures | Assignments/Projects/2017-08/starter files/Project 3 - Binary Search Trees/docs/latex/program__main_8cpp.tex | TeX | mit | 918 |
package jsbeautifier
import "strings"
// Copyright (c) 2014 Ditashi Sayomi
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
type outputline struct {
parent *output
character_count int
indent_count int
items []string
empty bool
}
func (self *outputline) get_character_count() int {
return self.character_count
}
func (self *outputline) is_empty() bool {
return self.empty
}
func (self *outputline) set_indent(level int) {
self.character_count = self.parent.baseIndentLength + level*self.parent.indent_length
self.indent_count = level
}
func (self *outputline) last() string {
if !self.is_empty() {
return self.items[len(self.items)-1]
} else {
return ""
}
}
func (self *outputline) push(input string) {
self.items = append(self.items, input)
self.character_count += len(input)
self.empty = false
}
func (self *outputline) remove_indent() {
if self.indent_count > 0 {
self.indent_count -= 1
self.character_count -= self.parent.indent_length
}
}
func (self *outputline) trim() {
for self.last() == " " {
self.items = self.items[:len(self.items)-1]
self.character_count -= 1
}
self.empty = len(self.items) == 0
}
func (self *outputline) String() string {
result := ""
if !self.is_empty() {
if self.indent_count >= 0 {
result = self.parent.indent_cache[self.indent_count]
}
result += strings.Join(self.items, "")
}
return result
}
func NewLine(parent *output) *outputline {
return &outputline{parent, 0, -1, make([]string, 0), true}
}
| ditashi/jsbeautifier-go | jsbeautifier/outputline.go | GO | mit | 2,541 |
<?php
namespace Nascom\TeamleaderApiClient\Request\Meeting;
use Nascom\TeamleaderApiClient\Request\AbstractPostRequest;
/**
* Class CreateMeetingRequest
*
* @package Nascom\TeamleaderApiClient\Request\Meeting
*/
class CreateMeetingRequest extends AbstractPostRequest
{
/**
* CreateMeetingRequest constructor.
*
* @param $start_date
* @param $user_id
* @param $title
* @param $description
* @param $duration
* @param array $options
* Optional parameters:
* - milestone_id
*/
public function __construct($start_date, $user_id, $title, $description, $duration, array $options = [])
{
$this->options = $options;
$this->setStartDate($start_date);
$this->setUserId($user_id);
$this->setTitle($title);
$this->setDescription($description);
$this->setDuration($duration);
}
/**
* @param $start_date
*/
public function setStartDate($start_date)
{
$this->options['start_date'] = $start_date;
}
/**
* @param $user_id
*/
public function setUserId($user_id)
{
$this->options['user_id'] = $user_id;
}
/**
* @param $title
*/
public function setTitle($title)
{
$this->options['title'] = $title;
}
/**
* @param $description
*/
public function setDescription($description)
{
$this->options['description'] = $description;
}
/**
* @param $duration
*/
public function setDuration($duration)
{
$this->options['duration'] = $duration;
}
/**
* @return string
*/
public function getUri()
{
return 'addMeeting.php';
}
}
| Nascom/TeamleaderApiClient | src/Request/Meeting/CreateMeetingRequest.php | PHP | mit | 1,733 |
# Generated by Django 2.2.17 on 2021-02-03 13:38
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("monitorings", "0019_auto_20210128_2204"),
("monitorings", "0019_auto_20210128_1209"),
]
operations = []
| watchdogpolska/feder | feder/monitorings/migrations/0020_merge_20210203_1338.py | Python | mit | 277 |
from utils import CanadianJurisdiction
class Mississauga(CanadianJurisdiction):
classification = 'legislature'
division_id = 'ocd-division/country:ca/csd:3521005'
division_name = 'Mississauga'
name = 'Mississauga City Council'
url = 'http://www.city.mississauga.on.ca'
| opencivicdata/scrapers-ca | ca_on_mississauga/__init__.py | Python | mit | 291 |
/*
* Copyright 2016 Red Hat, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
* 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 org.openfact.provider;
import java.util.LinkedList;
import java.util.List;
import java.util.ServiceLoader;
/**
* @author <a href="mailto:[email protected]">Stian Thorgersen</a>
*/
public class DefaultProviderLoader implements ProviderLoader {
private ClassLoader classLoader;
public DefaultProviderLoader(ClassLoader classLoader) {
this.classLoader = classLoader;
}
@Override
public List<Spi> loadSpis() {
LinkedList<Spi> list = new LinkedList<>();
for (Spi spi : ServiceLoader.load(Spi.class, classLoader)) {
list.add(spi);
}
return list;
}
@Override
public List<ProviderFactory> load(Spi spi) {
LinkedList<ProviderFactory> list = new LinkedList<ProviderFactory>();
for (ProviderFactory f : ServiceLoader.load(spi.getProviderFactoryClass(), classLoader)) {
list.add(f);
}
return list;
}
}
| openfact/openfact-temp | services/src/main/java/org/openfact/provider/DefaultProviderLoader.java | Java | mit | 1,617 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GalaSoft.MvvmLight;
using System.ComponentModel;
using System.Text.RegularExpressions;
namespace AirlineTicketOffice.Model.Models
{
public class CashierModel:ObservableObject, IDataErrorInfo
{
private int cashierID;
public int CashierID
{
get { return cashierID; }
set { Set(() => CashierID, ref cashierID, value); }
}
private int numberOfOffices;
public int NumberOfOffices
{
get { return numberOfOffices; }
set { Set(() => NumberOfOffices, ref numberOfOffices, value); }
}
private string fullName;
public string FullName
{
get { return fullName; }
set { Set(() => FullName, ref fullName, value); }
}
#region realisation IdataErrorInfo
public string Error
{
get
{
return null;
}
}
public string this[string columnName]
{
get
{
switch (columnName)
{
case "NumberOfOffices":
if (CheckBlankLine(this.numberOfOffices.ToString()))
return "Please enter a Office Number";
if (CheckOfficeNumber() == false)
return "You must specify the Office Number (Example: 777)";
break;
case "FullName":
if (CheckBlankLine(this.FullName))
return "Please enter a Full Name";
if (this.FullName.Length < 3 || this.FullName.Length > 50)
return "You must specify the name of the country (Example: Finland)";
break;
default:
throw new ArgumentException(
"Unrecognized property: " + columnName);
}
return string.Empty;
}
}
private bool CheckOfficeNumber()
{
if (this.numberOfOffices < 0
|| this.numberOfOffices > Int32.MaxValue)
{
return false;
}
return true;
}
#endregion
#region methods
/// <summary>
/// Check WhiteSpace and Empty string.
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
private bool CheckBlankLine(string value)
{
if (string.IsNullOrWhiteSpace(value)
|| string.IsNullOrEmpty(value))
{
return true;
}
return false;
}
#endregion
}
} | VladTsiukin/AirlineTicketOffice | AirlineTicketOffice.Model/Models/CashierModel.cs | C# | mit | 2,935 |
package com.ae.sat.servers.master.service.file;
import com.mongodb.gridfs.GridFSDBFile;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.gridfs.GridFsCriteria;
import org.springframework.data.mongodb.gridfs.GridFsTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.multipart.MultipartFile;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
/**
* Created by ae on 8-10-16.
*/
@Controller
public class MongoFileService implements FileService {
@Autowired
private GridFsTemplate gridFsTemplate;
@Override
public void createOrUpdate(InputStream is, String name) throws IOException {
Optional<GridFSDBFile> existing = maybeLoadFile(name);
if (existing.isPresent()) {
gridFsTemplate.delete(getFilenameQuery(name));
}
gridFsTemplate.store(is, name).save();
}
@Override
public List<String> list() throws IOException {
return getFiles().stream()
.map(GridFSDBFile::getFilename)
.collect(Collectors.toList());
}
@Override
public byte[] get(String name) throws IOException {
Optional<GridFSDBFile> optionalCreated = maybeLoadFile(name);
if (optionalCreated.isPresent()) {
GridFSDBFile created = optionalCreated.get();
ByteArrayOutputStream os = new ByteArrayOutputStream();
created.writeTo(os);
return os.toByteArray();
} else {
return null;
}
}
private List<GridFSDBFile> getFiles() {
return gridFsTemplate.find(null);
}
private Optional<GridFSDBFile> maybeLoadFile(String name) {
GridFSDBFile file = gridFsTemplate.findOne(getFilenameQuery(name));
return Optional.ofNullable(file);
}
private static Query getFilenameQuery(String name) {
return Query.query(GridFsCriteria.whereFilename().is(name));
}
}
| AE9999/MiniCLOUD | server/src/main/java/com/ae/sat/servers/master/service/file/MongoFileService.java | Java | mit | 2,181 |
# frozen_string_literal: true
require "dry/system/loader/autoloading"
require "dry/system/component"
require "dry/system/config/namespace"
require "dry/system/identifier"
RSpec.describe Dry::System::Loader::Autoloading do
describe "#require!" do
subject(:loader) { described_class }
let(:component) {
Dry::System::Component.new(
Dry::System::Identifier.new("test.not_loaded_const"),
namespace: Dry::System::Config::Namespace.default_root
)
}
before do
allow(loader).to receive(:require)
allow(Test).to receive(:const_missing)
end
it "loads the constant " do
loader.require!(component)
expect(loader).not_to have_received(:require)
expect(Test).to have_received(:const_missing).with :NotLoadedConst
end
it "returns self" do
expect(loader.require!(component)).to eql loader
end
end
end
| dryrb/dry-component | spec/unit/loader/autoloading_spec.rb | Ruby | mit | 893 |
package fscache
import (
"fmt"
"path/filepath"
"regexp"
"time"
)
// An arbitrary object that can be stringified by fmt.Sprint().
//
// The stringification is filtered to ensure it doesn't contain characters
// that are invalid on Windows, which has the most restrictive filesystem.
// The "bad" characters (\, /, :, *, ?, ", <, >, |) are replaced with _.
//
// On a list of CacheKeys, the last component is taken to represent a file
// and all the other components represent the intermediary directories.
// This means that it's not possible to have subkeys of an existing file key.
//
// NOTE: when running on Windows, directories that start with a '.' get the
// '.' replaced by a '_'. This is because regular Windows tools can't deal
// with directories starting with a dot.
type CacheKey interface{}
// All "bad characters" that can't go in Windows paths.
// It's a superset of the "bad characters" on other OSes, so this works.
var badPath = regexp.MustCompile(`[\\/:\*\?\"<>\|]`)
func Stringify(stuff ...CacheKey) []string {
ret := make([]string, len(stuff))
for i := range stuff {
s := fmt.Sprint(stuff[i])
ret[i] = badPath.ReplaceAllLiteralString(s, "_")
}
return ret
}
// Each key but the last is treated as a directory.
// The last key is treated as a regular file.
//
// This also means that cache keys that are file-backed
// cannot have subkeys.
func (cd *CacheDir) cachePath(key ...CacheKey) string {
parts := append([]string{cd.GetCacheDir()}, Stringify(key...)...)
p := filepath.Join(filterDots(parts...)...)
return p
}
var invalidPath = []CacheKey{".invalid"}
// Returns the time the given key was marked as invalid.
// If the key is valid, then calling IsZero() on the returned
// time will return true.
func (cd *CacheDir) GetInvalid(key ...CacheKey) (ts time.Time) {
invKey := append(invalidPath, key...)
if stat, err := cd.Stat(invKey...); err == nil {
ts = stat.ModTime()
}
return
}
// Checks if the given key is not marked as invalid, or if it is,
// checks if it was marked more than maxDuration time ago.
//
// Calls UnsetInvalid if the keys are valid.
func (cd *CacheDir) IsValid(maxDuration time.Duration, key ...CacheKey) bool {
ts := cd.GetInvalid(key...)
switch {
case ts.IsZero():
return true
case time.Now().Sub(ts) > maxDuration:
cd.UnsetInvalid(key...)
return true
default:
return false
}
}
// Deletes the given key and caches it as invalid.
func (cd *CacheDir) SetInvalid(key ...CacheKey) error {
invKey := append(invalidPath, key...)
cd.Delete(key...)
return cd.Touch(invKey...)
}
// Removes the given key from the invalid key cache.
func (cd *CacheDir) UnsetInvalid(key ...CacheKey) error {
invKey := append(invalidPath, key...)
return cd.Delete(invKey...)
}
| Kovensky/go-fscache | cachekey.go | GO | mit | 2,750 |
/*******************************************************************************
* Copyright (c) 2013, Esoteric Software
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/
#include <spine/SkeletonJson.h>
#include <math.h>
#include <stdio.h>
#include <math.h>
#include "Json.h"
#include <spine/extension.h>
#include <spine/RegionAttachment.h>
#include <spine/AtlasAttachmentLoader.h>
#ifdef __cplusplus
namespace spine {
#endif
typedef struct {
SkeletonJson super;
int ownsLoader;
} _Internal;
SkeletonJson* SkeletonJson_createWithLoader (AttachmentLoader* attachmentLoader) {
SkeletonJson* self = SUPER(NEW(_Internal));
self->scale = 1;
self->attachmentLoader = attachmentLoader;
return self;
}
SkeletonJson* SkeletonJson_create (Atlas* atlas) {
AtlasAttachmentLoader* attachmentLoader = AtlasAttachmentLoader_create(atlas);
SkeletonJson* self = SkeletonJson_createWithLoader(SUPER(attachmentLoader));
SUB_CAST(_Internal, self) ->ownsLoader = 1;
return self;
}
void SkeletonJson_dispose (SkeletonJson* self) {
if (SUB_CAST(_Internal, self) ->ownsLoader) AttachmentLoader_dispose(self->attachmentLoader);
FREE(self->error);
FREE(self);
}
void _SkeletonJson_setError (SkeletonJson* self, Json* root, const char* value1, const char* value2) {
char message[256];
int length;
FREE(self->error);
strcpy(message, value1);
length = strlen(value1);
if (value2) strncat(message + length, value2, 256 - length);
MALLOC_STR(self->error, message);
if (root) Json_dispose(root);
}
static float toColor (const char* value, int index) {
char digits[3];
char *error;
int color;
if (strlen(value) != 8) return -1;
value += index * 2;
digits[0] = *value;
digits[1] = *(value + 1);
digits[2] = '\0';
color = strtoul(digits, &error, 16);
if (*error != 0) return -1;
return color / (float)255;
}
static void readCurve (CurveTimeline* timeline, int frameIndex, Json* frame) {
Json* curve = Json_getItem(frame, "curve");
if (!curve) return;
if (curve->type == Json_String && strcmp(curve->valuestring, "stepped") == 0)
CurveTimeline_setStepped(timeline, frameIndex);
else if (curve->type == Json_Array) {
CurveTimeline_setCurve(timeline, frameIndex, Json_getItemAt(curve, 0)->valuefloat, Json_getItemAt(curve, 1)->valuefloat,
Json_getItemAt(curve, 2)->valuefloat, Json_getItemAt(curve, 3)->valuefloat);
}
}
static Animation* _SkeletonJson_readAnimation (SkeletonJson* self, Json* root, SkeletonData *skeletonData) {
Animation* animation;
Json* bones = Json_getItem(root, "bones");
int boneCount = bones ? Json_getSize(bones) : 0;
Json* slots = Json_getItem(root, "slots");
int slotCount = slots ? Json_getSize(slots) : 0;
int timelineCount = 0;
int i, ii, iii;
for (i = 0; i < boneCount; ++i)
timelineCount += Json_getSize(Json_getItemAt(bones, i));
for (i = 0; i < slotCount; ++i)
timelineCount += Json_getSize(Json_getItemAt(slots, i));
animation = Animation_create(root->name, timelineCount);
animation->timelineCount = 0;
skeletonData->animations[skeletonData->animationCount] = animation;
skeletonData->animationCount++;
for (i = 0; i < boneCount; ++i) {
int timelineCount;
Json* boneMap = Json_getItemAt(bones, i);
const char* boneName = boneMap->name;
int boneIndex = SkeletonData_findBoneIndex(skeletonData, boneName);
if (boneIndex == -1) {
Animation_dispose(animation);
_SkeletonJson_setError(self, root, "Bone not found: ", boneName);
return 0;
}
timelineCount = Json_getSize(boneMap);
for (ii = 0; ii < timelineCount; ++ii) {
float duration;
Json* timelineArray = Json_getItemAt(boneMap, ii);
int frameCount = Json_getSize(timelineArray);
const char* timelineType = timelineArray->name;
if (strcmp(timelineType, "rotate") == 0) {
RotateTimeline *timeline = RotateTimeline_create(frameCount);
timeline->boneIndex = boneIndex;
for (iii = 0; iii < frameCount; ++iii) {
Json* frame = Json_getItemAt(timelineArray, iii);
RotateTimeline_setFrame(timeline, iii, Json_getFloat(frame, "time", 0), Json_getFloat(frame, "angle", 0));
readCurve(SUPER(timeline), iii, frame);
}
animation->timelines[animation->timelineCount++] = (Timeline*)timeline;
duration = timeline->frames[frameCount * 2 - 2];
if (duration > animation->duration) animation->duration = duration;
} else {
int isScale = strcmp(timelineType, "scale") == 0;
if (isScale || strcmp(timelineType, "translate") == 0) {
float scale = isScale ? 1 : self->scale;
TranslateTimeline *timeline = isScale ? ScaleTimeline_create(frameCount) : TranslateTimeline_create(frameCount);
timeline->boneIndex = boneIndex;
for (iii = 0; iii < frameCount; ++iii) {
Json* frame = Json_getItemAt(timelineArray, iii);
TranslateTimeline_setFrame(timeline, iii, Json_getFloat(frame, "time", 0), Json_getFloat(frame, "x", 0) * scale,
Json_getFloat(frame, "y", 0) * scale);
readCurve(SUPER(timeline), iii, frame);
}
animation->timelines[animation->timelineCount++] = (Timeline*)timeline;
duration = timeline->frames[frameCount * 3 - 3];
if (duration > animation->duration) animation->duration = duration;
} else {
Animation_dispose(animation);
_SkeletonJson_setError(self, 0, "Invalid timeline type for a bone: ", timelineType);
return 0;
}
}
}
}
for (i = 0; i < slotCount; ++i) {
int timelineCount;
Json* slotMap = Json_getItemAt(slots, i);
const char* slotName = slotMap->name;
int slotIndex = SkeletonData_findSlotIndex(skeletonData, slotName);
if (slotIndex == -1) {
Animation_dispose(animation);
_SkeletonJson_setError(self, root, "Slot not found: ", slotName);
return 0;
}
timelineCount = Json_getSize(slotMap);
for (ii = 0; ii < timelineCount; ++ii) {
float duration;
Json* timelineArray = Json_getItemAt(slotMap, ii);
int frameCount = Json_getSize(timelineArray);
const char* timelineType = timelineArray->name;
if (strcmp(timelineType, "color") == 0) {
ColorTimeline *timeline = ColorTimeline_create(frameCount);
timeline->slotIndex = slotIndex;
for (iii = 0; iii < frameCount; ++iii) {
Json* frame = Json_getItemAt(timelineArray, iii);
const char* s = Json_getString(frame, "color", 0);
ColorTimeline_setFrame(timeline, iii, Json_getFloat(frame, "time", 0), toColor(s, 0), toColor(s, 1), toColor(s, 2),
toColor(s, 3));
readCurve(SUPER(timeline), iii, frame);
}
animation->timelines[animation->timelineCount++] = (Timeline*)timeline;
duration = timeline->frames[frameCount * 5 - 5];
if (duration > animation->duration) animation->duration = duration;
} else if (strcmp(timelineType, "attachment") == 0) {
AttachmentTimeline *timeline = AttachmentTimeline_create(frameCount);
timeline->slotIndex = slotIndex;
for (iii = 0; iii < frameCount; ++iii) {
Json* frame = Json_getItemAt(timelineArray, iii);
Json* name = Json_getItem(frame, "name");
AttachmentTimeline_setFrame(timeline, iii, Json_getFloat(frame, "time", 0),
name->type == Json_NULL ? 0 : name->valuestring);
}
animation->timelines[animation->timelineCount++] = (Timeline*)timeline;
duration = timeline->frames[frameCount - 1];
if (duration > animation->duration) animation->duration = duration;
} else {
Animation_dispose(animation);
_SkeletonJson_setError(self, 0, "Invalid timeline type for a slot: ", timelineType);
return 0;
}
}
}
return animation;
}
SkeletonData* SkeletonJson_readSkeletonDataFile (SkeletonJson* self, const char* path) {
int length;
SkeletonData* skeletonData;
const char* json = _Util_readFile(path, &length);
if (!json) {
_SkeletonJson_setError(self, 0, "Unable to read skeleton file: ", path);
return 0;
}
skeletonData = SkeletonJson_readSkeletonData(self, json);
FREE(json);
return skeletonData;
}
SkeletonData* SkeletonJson_readSkeletonData (SkeletonJson* self, const char* json) {
SkeletonData* skeletonData;
Json *root, *bones;
int i, ii, iii, boneCount;
Json* slots;
Json* skinsMap;
Json* animations;
FREE(self->error);
CONST_CAST(char*, self->error) = 0;
root = Json_create(json);
if (!root) {
_SkeletonJson_setError(self, 0, "Invalid skeleton JSON: ", Json_getError());
return 0;
}
skeletonData = SkeletonData_create();
bones = Json_getItem(root, "bones");
boneCount = Json_getSize(bones);
skeletonData->bones = MALLOC(BoneData*, boneCount);
for (i = 0; i < boneCount; ++i) {
Json* boneMap = Json_getItemAt(bones, i);
BoneData* boneData;
const char* boneName = Json_getString(boneMap, "name", 0);
BoneData* parent = 0;
const char* parentName = Json_getString(boneMap, "parent", 0);
if (parentName) {
parent = SkeletonData_findBone(skeletonData, parentName);
if (!parent) {
SkeletonData_dispose(skeletonData);
_SkeletonJson_setError(self, root, "Parent bone not found: ", parentName);
return 0;
}
}
boneData = BoneData_create(boneName, parent);
boneData->length = Json_getFloat(boneMap, "length", 0) * self->scale;
boneData->x = Json_getFloat(boneMap, "x", 0) * self->scale;
boneData->y = Json_getFloat(boneMap, "y", 0) * self->scale;
boneData->rotation = Json_getFloat(boneMap, "rotation", 0);
boneData->scaleX = Json_getFloat(boneMap, "scaleX", 1);
boneData->scaleY = Json_getFloat(boneMap, "scaleY", 1);
skeletonData->bones[i] = boneData;
skeletonData->boneCount++;
}
slots = Json_getItem(root, "slots");
if (slots) {
int slotCount = Json_getSize(slots);
skeletonData->slots = MALLOC(SlotData*, slotCount);
for (i = 0; i < slotCount; ++i) {
SlotData* slotData;
const char* color;
Json *attachmentItem;
Json* slotMap = Json_getItemAt(slots, i);
const char* slotName = Json_getString(slotMap, "name", 0);
const char* boneName = Json_getString(slotMap, "bone", 0);
BoneData* boneData = SkeletonData_findBone(skeletonData, boneName);
if (!boneData) {
SkeletonData_dispose(skeletonData);
_SkeletonJson_setError(self, root, "Slot bone not found: ", boneName);
return 0;
}
slotData = SlotData_create(slotName, boneData);
color = Json_getString(slotMap, "color", 0);
if (color) {
slotData->r = toColor(color, 0);
slotData->g = toColor(color, 1);
slotData->b = toColor(color, 2);
slotData->a = toColor(color, 3);
}
attachmentItem = Json_getItem(slotMap, "attachment");
if (attachmentItem) SlotData_setAttachmentName(slotData, attachmentItem->valuestring);
skeletonData->slots[i] = slotData;
skeletonData->slotCount++;
}
}
skinsMap = Json_getItem(root, "skins");
if (skinsMap) {
int skinCount = Json_getSize(skinsMap);
skeletonData->skins = MALLOC(Skin*, skinCount);
for (i = 0; i < skinCount; ++i) {
Json* slotMap = Json_getItemAt(skinsMap, i);
const char* skinName = slotMap->name;
Skin *skin = Skin_create(skinName);
int slotNameCount;
skeletonData->skins[i] = skin;
skeletonData->skinCount++;
if (strcmp(skinName, "default") == 0) skeletonData->defaultSkin = skin;
slotNameCount = Json_getSize(slotMap);
for (ii = 0; ii < slotNameCount; ++ii) {
Json* attachmentsMap = Json_getItemAt(slotMap, ii);
const char* slotName = attachmentsMap->name;
int slotIndex = SkeletonData_findSlotIndex(skeletonData, slotName);
int attachmentCount = Json_getSize(attachmentsMap);
for (iii = 0; iii < attachmentCount; ++iii) {
Attachment* attachment;
Json* attachmentMap = Json_getItemAt(attachmentsMap, iii);
const char* skinAttachmentName = attachmentMap->name;
const char* attachmentName = Json_getString(attachmentMap, "name", skinAttachmentName);
const char* typeString = Json_getString(attachmentMap, "type", "region");
AttachmentType type;
if (strcmp(typeString, "region") == 0)
type = ATTACHMENT_REGION;
else if (strcmp(typeString, "regionSequence") == 0)
type = ATTACHMENT_REGION_SEQUENCE;
else {
SkeletonData_dispose(skeletonData);
_SkeletonJson_setError(self, root, "Unknown attachment type: ", typeString);
return 0;
}
attachment = AttachmentLoader_newAttachment(self->attachmentLoader, skin, type, attachmentName);
if (!attachment) {
if (self->attachmentLoader->error1) {
SkeletonData_dispose(skeletonData);
_SkeletonJson_setError(self, root, self->attachmentLoader->error1, self->attachmentLoader->error2);
return 0;
}
continue;
}
if (attachment->type == ATTACHMENT_REGION || attachment->type == ATTACHMENT_REGION_SEQUENCE) {
RegionAttachment* regionAttachment = (RegionAttachment*)attachment;
regionAttachment->x = Json_getFloat(attachmentMap, "x", 0) * self->scale;
regionAttachment->y = Json_getFloat(attachmentMap, "y", 0) * self->scale;
regionAttachment->scaleX = Json_getFloat(attachmentMap, "scaleX", 1);
regionAttachment->scaleY = Json_getFloat(attachmentMap, "scaleY", 1);
regionAttachment->rotation = Json_getFloat(attachmentMap, "rotation", 0);
regionAttachment->width = Json_getFloat(attachmentMap, "width", 32) * self->scale;
regionAttachment->height = Json_getFloat(attachmentMap, "height", 32) * self->scale;
RegionAttachment_updateOffset(regionAttachment);
}
Skin_addAttachment(skin, slotIndex, skinAttachmentName, attachment);
}
}
}
}
animations = Json_getItem(root, "animations");
if (animations) {
int animationCount = Json_getSize(animations);
skeletonData->animations = MALLOC(Animation*, animationCount);
for (i = 0; i < animationCount; ++i) {
Json* animationMap = Json_getItemAt(animations, i);
_SkeletonJson_readAnimation(self, animationMap, skeletonData);
}
}
Json_dispose(root);
return skeletonData;
}
#ifdef __cplusplus
}
#endif
| ThirdPartyNinjas/NinjaParty | Dependencies/spine-c/src/spine/SkeletonJson.c | C | mit | 15,169 |
module.exports = class Crossover {
constructor() {};
//Consider which statistical approach will be used for pair breeding
pairBreed() {
};
};
| danielvfo/timetabling-ga | src/breeding/Crossover.js | JavaScript | mit | 154 |
#------------------------------------------------------------------------------
# _dd.py
#
# Parser for the jam 'd' debug flag output - which contains details of
# file dependencies, and inclusions.
#
# November 2015, Jonathan Loh
#------------------------------------------------------------------------------
"""jam -dd output parser"""
__all__ = (
"DDParser",
)
from ._base import BaseParser
class DDParser(BaseParser):
def parse_logfile(self, filename, debug_flag=False):
"""
Function to parse log files with '-dd' debug output.
Currently can read:
Depends x:y
Includes x:y """
with open(filename, errors="ignore") as f:
for line in f:
# Depending on the first word, add the relevant information to the database
#
# x depends on y
# x includes y
first_word = line.split(' ', 1)[0]
if first_word == "Depends" or first_word == "Includes":
x_y = line.split(' ', 1) [1]
x_garbage = x_y.split('\" : "', 1)[0] # includes the prefix '\"' which needs to be removed
y_garbage = x_y.split('\" : "', 1)[1] # includes an ending '\" ;' which needs to be removed
x = x_garbage.replace("\"", "")
y = y_garbage.replace("\" ;", "").replace("\n", "")
# Debug
if debug_flag == True:
if first_word == "Depends":
print (x, "depends on", y)
elif first_word == "Includes":
print (x, "includes", y)
# Add to the database
x_target = self.db.get_target(x)
y_target = self.db.get_target(y)
if first_word == "Depends":
x_target.add_dependency(y_target)
elif first_word == "Includes":
x_target.add_inclusion(y_target)
return None
| ensoft/jamjar | jamjar/parsers/_dd.py | Python | mit | 2,088 |
import postcss from 'postcss';
import stylehacks from '../';
import packageJson from '../../package.json';
function processCss(fixture, expected, options) {
return () =>
postcss(stylehacks(options))
.process(fixture, { from: undefined })
.then(({ css }) => expect(css).toBe(expected));
}
function passthroughCss(fixture, options) {
return processCss(fixture, fixture, options);
}
test('can be used as a postcss plugin', () => {
let css = 'h1 { _color: #ffffff }';
return postcss()
.use(stylehacks())
.process(css, { from: undefined })
.then((result) => {
expect(result.css).toBe('h1 { }');
});
});
test('can be used as a postcss plugin (2)', () => {
let css = 'h1 { _color: #ffffff }';
return postcss([stylehacks()])
.process(css, { from: undefined })
.then((result) => expect(result.css).toBe('h1 { }'));
});
test('can be used as a postcss plugin (3)', () => {
let css = 'h1 { _color: #ffffff }';
return postcss([stylehacks])
.process(css, { from: undefined })
.then((result) => {
expect(result.css).toBe('h1 { }');
});
});
test('should use the postcss plugin api', () => {
expect(stylehacks().postcssPlugin).toBe(packageJson.name);
});
test('should have a separate detect method', () => {
let counter = 0;
let plugin = postcss.plugin('test', () => {
return (css) => {
css.walkDecls((decl) => {
if (stylehacks.detect(decl)) {
counter++;
}
});
};
});
return postcss(plugin)
.process('h1 { _color: red; =color: black }', { from: undefined })
.then(() => expect(counter).toBe(2));
});
test('should have a separate detect method (2)', () => {
let counter = 0;
let plugin = postcss.plugin('test', () => {
return (css) => {
css.walkRules((rule) => {
if (stylehacks.detect(rule)) {
counter++;
}
});
};
});
return postcss(plugin)
.process('h1 { _color: red; =color: black }', { from: undefined })
.then(() => expect(counter).toBe(0));
});
test(
'should handle rules with empty selectors',
processCss('{ _color: red }', '{ }')
);
test(
'should pass through other comments in selectors',
passthroughCss('h1 /* => */ h2 {}')
);
test(
'should pass through css mixins',
passthroughCss(
`paper-card {
--paper-card-content: {
padding-top: 0;
};
margin: 0 auto 16px;
width: 768px;
max-width: calc(100% - 32px);
}`
)
);
test(
'should pass through css mixins (2)',
passthroughCss(
`paper-card {
--paper-card-header: {
height: 128px;
padding: 0 48px;
background: var(--primary-color);
@apply(--layout-vertical);
@apply(--layout-end-justified);
};
--paper-card-header-color: #FFF;
--paper-card-content: {
padding: 64px;
};
--paper-card-actions: {
@apply(--layout-horizontal);
@apply(--layout-end-justified);
};
width: 384px;
}`
)
);
| ben-eb/cssnano | packages/stylehacks/src/__tests__/api.js | JavaScript | mit | 3,088 |
// set up
var express = require('express');
var app = express();
var mongoose = require('mongoose'); // mongoose for mongodb
var morgan = require('morgan'); // log requests to the console
var bodyParser = require('body-parser'); // pull information from HTML POST
var methodOverride = require('method-override'); // simulate DELETE and PUT
mongoose.connect('mongodb://localhost/test');
// set express static dirname because else you will get a lot of errors regarding MIME-types with the res.sendFile function
app.use(express.static(__dirname + '/public'));
app.use(express.static(__dirname + '/public')); // set the static files location /public/img will be /img for users
app.use(morgan('dev')); // log every request to the console
app.use(bodyParser.urlencoded({'extended':'true'})); // parse application/x-www-form-urlencoded
app.use(bodyParser.json()); // parse application/json
app.use(bodyParser.json({ type: 'application/vnd.api+json' })); // parse application/vnd.api+json as json
app.use(methodOverride());
// define our Track model
var Track = mongoose.model('Track', {
track : Object,
});
// Routes
// get tracks
app.get('/api/tracks', function(req, res) {
Track.find(function(err, tracks) {
if (err) {
res.send(err);
}
res.json(tracks);
});
});
// create a track
app.post('/api/tracks', function(req, res) {
Track.create({
track: req.body,
done: false
}, function(err, track) {
if (err) {
res.send(err);
}
Track.find(function(err, tracks) {
if (err) {
res.send(err);
}
res.json(tracks);
});
});
});
// delete a track
app.delete('/api/tracks/:tracks_id', function(req,res) {
Track.remove({
_id : req.params.track_id
}, function(err, track) {
if (err) {
res.send(err);
}
Todo.find(function(err,todos) {
if (err) {
res.send(err);
}
res.json(tracks);
});
});
});
app.get('', function(req,res) {
res.sendFile('html/index.html', { root: __dirname + '/public/'});
});
// listen (start app with node server.js)
app.listen(9000);
console.log("App listening on port 9000");
| richardj/nowplaying | server.js | JavaScript | mit | 2,270 |
package in.suhj.eridown
import in.suhj.eridown.Parser._
import org.scalatest.FunSuite
class LeafBlockTest extends FunSuite {
test("***") {
assert(render("***") == "<hr />")
}
test("---") {
assert(render("---") == "<hr />")
}
test("___") {
assert(render("___") == "<hr />")
}
test("+++") {
assert(render("+++") == "<p>+++</p>")
}
test("===") {
assert(render("===") == "<p>===</p>")
}
test("--\n**\n__") {
assert(render("--\n**\n__") == "<p>--\n**\n__</p>")
}
test(" ***\n ***\n ***") {
assert(render(" ***\n ***\n ***") == "<hr /><hr /><hr />")
}
test(" *** 2") {
assert(render(" ***") == "<pre><code>***</code></pre>")
}
test("Foo\n ***") {
assert(render("Foo\n ***") == "<p>Foo\n***</p>")
}
test("_____________________________________") {
assert(render("_____________________________________") == "<hr />")
}
test(" - - -") {
assert(render(" - - -") == "<hr />")
}
test(" ** * ** * ** * **") {
assert(render(" ** * ** * ** * **") == "<hr />")
}
test("- - - -") {
assert(render("- - - -") == "<hr />")
}
test("- - - - ") {
assert(render("- - - - ") == "<hr />")
}
test("_ _ _ _ a\n\na------\n\n---a---") {
assert(render("_ _ _ _ a\n\na------\n\n---a---") == "<p>_ _ _ _ a</p><p>a------</p><p>---a---</p>")
}
test(" *-*") {
assert(render(" *-*") == "<p><em>-</em></p>")
}
test("- foo\n***\n- bar") {
assert(render("- foo\n***\n- bar") == "<ul><li>foo</li></ul><hr /><ul><li>bar</li></ul>")
}
test("Foo\n***\nbar") {
assert(render("Foo\n***\nbar") == "<p>Foo</p><hr /><p>bar</p>")
}
test("Foo\n---\nbar") {
assert(render("Foo\n---\nbar") == "<h2>Foo</h2><p>bar</p>")
}
test("* Foo\n* * *\n* Bar") {
assert(render("* Foo\n* * *\n* Bar") == "<ul><li>Foo</li></ul><hr /><ul><li>Bar</li></ul>")
}
test("- Foo\n- * * *") {
assert(render("- Foo\n- * * *") == "<ul><li>Foo</li><li><hr /></li></ul>")
}
}
| raon0211/eridown | src/test/scala/in/suhj/eridown/LeafBlockTest.scala | Scala | mit | 2,211 |
---
Layout: post
Title: Late Classes
---
Late classes are a pain because Miami Traffic is crazy!!
| peruvian0311/peruvian0311.github.io | _posts/2015-1-14-LateClasses.md | Markdown | mit | 99 |
package jagex.runescape.net.jaggrab;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.handler.codec.oneone.OneToOneDecoder;
/**
* A {@link OneToOneDecoder} for the JAGGRAB protocol.
* @author Graham
*/
public final class JagGrabRequestDecoder extends OneToOneDecoder {
@Override
protected Object decode(ChannelHandlerContext ctx, Channel c, Object msg) throws Exception {
if (msg instanceof String) {
String str = ((String) msg);
if (str.startsWith("JAGGRAB /")) {
String filePath = str.substring(8).trim();
return new JagGrabRequest(filePath);
} else {
throw new Exception("corrupted request line");
}
}
return msg;
}
}
| I-am-a-Cactus/World-Server | src/jagex/runescape/net/jaggrab/JagGrabRequestDecoder.java | Java | mit | 729 |
from __future__ import absolute_import
from . import proxmox_prov as pv
from .conftest import CHANGE_DATA, mergedict, DIB, DCH, DEXP
import pytest
# run with watch
# ptw -c ./library/
# sound:
# ptw -c --onfail "echo -e '\a'" ./library/
# ptw -c --onfail "paplay /usr/share/sounds/freedesktop/stereo/suspend-error.oga" ./library/
Adict = {'state': 'present', 'vmid': 333, 'hostname': 'myhost', 'node': 'A',
'onboot': False, 'ostemplate': None, 'delete': ['A', 'B']}
# This is much shorter!
@pytest.mark.parametrize('input', [
({'cores': 2}),
({'cores': 2, 'cpulimit': '0.5'}),
({'cores': 2, 'cpulimit': '0.5', 'delete': ['cores', 'cpulimit']}),
# pytest.mark.xfail(({'cores': 99}))
])
def test_get_vm_changes(input):
vm = pv.get_vm_by_id(201, pv.get_cluster_resources()['data'])
result = pv.get_vm_config(vm)
cfg = result['data']
data = CHANGE_DATA['201 basic'].copy()
data.update(input)
changes = pv.get_vm_changes(data, cfg, True)
assert changes == input
# @pytest.mark.skip()
@pytest.mark.parametrize('input, expect', [
(DIB[0].copy(), {}),
(mergedict(DIB[0], DCH[0]), DEXP[0]),
(mergedict(DIB[0], DCH[1]), DEXP[1]),
(mergedict(DIB[0], DCH[2]), DEXP[2]),
])
def test_get_vm_changes_disk(input, expect):
vm = pv.get_vm_by_id(201, pv.get_cluster_resources()['data'])
cfg = pv.get_vm_config(vm)['data']
changes = pv.get_vm_changes(input, cfg, True)
assert changes == expect
@pytest.mark.parametrize('input, expect', [
# dict to command line
({'storage': 'tank_multimedia', 'volume': 'subvol-201-disk-1',
'mp': '/multimedia', 'acl': True, 'size': '8G'},
'tank_multimedia:subvol-201-disk-1,mp=/multimedia,acl=1,size=8G'),
# command line to dict
('tank_multimedia:subvol-201-disk-1,mp=/multimedia,acl=0,size=8G',
{'storage': 'tank_multimedia', 'volume': 'subvol-201-disk-1',
'mp': '/multimedia', 'acl': False, 'size': '8G'}),
# dict to command line with dir mount and reverse
({'volume': '/mnt/dirmount',
'mp': '/dir_mount', 'size': '0G'},
'/mnt/dirmount,mp=/dir_mount,size=0G'),
('/mnt/dirmount,mp=/dir_mount,size=0G',
{'volume': '/mnt/dirmount',
'mp': '/dir_mount', 'size': '0G'}),
# simulate api returning 0T for 0 size
('/mnt/dirmount,mp=/dir_mount,size=0T',
{'volume': '/mnt/dirmount',
'mp': '/dir_mount', 'size': '0T'}),
# netX both ways
({'name': 'eth0', 'bridge': 'vmbr0', 'hwaddr': 'as:04:23:ds:32', 'ip': '192.168.2.1/24',},
'name=eth0,bridge=vmbr0,hwaddr=as:04:23:ds:32,ip=192.168.2.1/24'),
('name=eth0,bridge=vmbr0,firewall=0', {'name': 'eth0', 'bridge': 'vmbr0', 'firewall': False},),
('name=eth1,bridge=vmbr0,gw=192.168.178.1,hwaddr=B6:75:39:CC:46:B1,'
'ip=192.168.178.207/24,mtu=1400,tag=3,type=veth',
{'name': 'eth1', 'bridge': 'vmbr0', 'gw': '192.168.178.1', 'hwaddr':
'B6:75:39:CC:46:B1', 'ip': '192.168.178.207/24', 'mtu': '1400', 'tag': '3',
'type': 'veth'}),
# (, ,),
])
def test_convert_params(input, expect):
result = pv.convert_params(input)
assert result == expect
@pytest.mark.parametrize('input, pve_string, expect', [
({'acl': False, 'size': '10G'},
'tank_multimedia:subvol-201-disk-1,mp=/multimedia,acl=1,size=8G',
{'size': '10G', 'acl': False}),
({'storage': 'tank_multimedia', 'volume': 'subvol-201-disk-1', 'mp': '/change', 'acl': True, 'size': '10G'},
'tank_multimedia:subvol-201-disk-1,mp=/multimedia,acl=1,size=8G',
{'size': '10G', 'mp': '/change'}),
# (, ,),
])
def test_dict_diff(input, pve_string, expect):
changes = pv.get_dict_diff(input, pv.convert_params(pve_string))
assert changes == expect
@pytest.mark.parametrize('inp, exp', [
({'volume': 'local-zfs:subvol-101-disk-1', 'size': '4G'},
('local-zfs', 'subvol', 'subvol-101-disk-1', '4G')),
({'storage': 'local-zfs', 'volume': 'subvol-101-disk-1', 'size': '4G'},
('local-zfs', 'subvol', 'subvol-101-disk-1', '4G')),
({'volume': 'local-zfs:subvol-200-diskX'},
('local-zfs', 'subvol', 'subvol-200-diskX', '4G')),
({'volume': 'local:subvol-200-diskX', 'format': 'raw'},
('local', 'raw', 'subvol-200-diskX', '4G')),
({'storage': 'local-zfs', 'size': '6G'},
('local-zfs', None, None, '6G')),
# case user uses 0 for size 0G
({'volume': '/tank/directory', 'size': '0'},
(None, None, '/tank/directory', '0G')),
# ('bla', 'ba'),
])
def test_get_volume_params(inp, exp):
(sto, fmt, volname, sz) = pv.get_volume_params(inp)
assert (sto, fmt, volname, sz) == exp
def test_get_vm_config():
vm = pv.get_vm_by_id(201, pv.get_cluster_resources()['data'])
result = pv.get_vm_config(vm)
assert result['status_code'] == 200
cfg = result['data']
assert cfg['arch'] == 'amd64'
assert cfg['hostname'] == 'VM201'
def test_get_vm_by_id_simple():
vm = pv.get_vm_by_id(100, pv.get_cluster_resources()['data'])
# this is still vm data from the resource list
assert vm['vmid'] == 100
assert vm['name'] == 'testimi'
def test_get_vm_by_id_onlyid():
vm = pv.get_vm_by_id(201)
assert vm['vmid'] == 201
assert vm['name'] == 'VM201'
assert vm['id'] == 'lxc/201'
def test_get_vm_by_hostname_only():
vm2 = pv.get_vm_by_hostname('NotUnderThisName')
assert vm2 is None
vm = pv.get_vm_by_hostname('testimi')
assert vm['vmid'] == 100
assert vm['name'] == 'testimi'
assert vm['id'] == 'lxc/100'
@pytest.mark.parametrize('inp, exp', [
(100, 'stopped'),
# expects int
pytest.mark.xfail(('testimi', 'stopped')),
((100, 'moximoz'), 'stopped'),
(999, None),
(None, None),
# ('VMdoesnotexist', None),
((999, 'moximoz'), None),
])
def test_get_vm_status(inp, exp):
try:
st = pv.get_vm_status(*inp)
except TypeError:
st = pv.get_vm_status(inp)
assert st == exp
@pytest.mark.parametrize('inp, exp', [
((100, 'start'), ['UPID:moximoz', 'vzstart']),
((100, 'stop'), ['UPID:moximoz', 'vzstop']),
((999, 'stop'), ['vm does not exist']),
])
def test_set_vm_status(inp, exp):
try:
st = pv.set_vm_status(*inp)
except TypeError:
st = pv.set_vm_status(inp)
for e in exp:
if 'does not exist' not in e:
assert st.get('status_code') == 200
assert e in st.get('data')
@pytest.mark.parametrize('inp, exp', [
# doesn't exist
({'vmid': 999}, (True, False, {'status': 'FAIL'})),
# is stopped
({'vmid': 100}, (False, True, {'status': 'OK'})),
({'hostname': 'testimi'}, (False, True, {'status': 'OK'})),
# is running
({'vmid': 203}, (False, False, {'status': 'OK'})),
# is suspended
({'vmid': 204}, (False, True, {'status': 'OK'})),
])
def test_pve_ct_start(inp, exp):
e, ch, meta = pv.pve_ct_start(inp)
assert e == exp[0]
assert ch == exp[1]
assert list(exp[2].items())[0] in list(meta.items())
@pytest.mark.parametrize('inp, exp', [
# doesn't exist
({'vmid': 999}, (True, False, {'status': 'FAIL'})),
# is stopped
({'vmid': 100}, (False, False, {'status': 'OK'})),
({'hostname': 'testimi'}, (False, False, {'status': 'OK'})),
# is running
({'vmid': 203}, (False, True, {'status': 'OK'})),
# TBD status suspended, but suspending does not work here.
# ({'vmid': 204}, (False, True, {'status': 'OK'})),
])
def test_pve_ct_stop(inp, exp):
e, ch, meta = pv.pve_ct_stop(inp)
assert e == exp[0]
assert ch == exp[1]
assert list(exp[2].items())[0] in list(meta.items())
@pytest.mark.parametrize('inp, exp', [
# doesn't exist
({'vmid': 999}, (True, False, {'status': 'FAIL'})),
# is stopped
({'vmid': 100}, (False, False, {'status': 'OK'})),
({'hostname': 'testimi'}, (False, False, {'status': 'OK'})),
# is running
({'vmid': 203}, (False, True, {'status': 'OK'})),
({'vmid': 203, 'timeout': 40}, (False, True, {'status': 'OK'})),
])
def test_pve_ct_shutdown(inp, exp):
e, ch, meta = pv.pve_ct_shutdown(inp)
assert e == exp[0]
assert ch == exp[1]
assert list(exp[2].items())[0] in list(meta.items())
@pytest.mark.parametrize('inp, exp', [
# if vmid it just returns it.
({'vmid': 100}, 100),
({'vmid': 999}, 999),
({'vmid': 100, 'hostname': 'testimi'}, 100),
({'hostname': 'testimi'}, 100),
])
def test_get_vm_id(inp, exp):
vmid = pv.get_vm_id(inp)
assert vmid == exp
def test_get_cluster_resources():
res = pv.get_cluster_resources()
assert res['status_code'] == 200
assert res['data'][0]['type'] == 'lxc'
def test_get_api_dict_simple():
new = pv.get_api_dict(Adict)
assert Adict != new
assert new == {'hostname': 'myhost', 'vmid': 333, 'onboot': False,
'delete': ['A', 'B']}
def test_get_api_dict_remove_Nones():
new = pv.get_api_dict(Adict)
assert Adict != new
assert 'ostemplate' not in new
def test_get_api_dict_keep_Falsy():
new = pv.get_api_dict(Adict)
assert Adict != new
assert new['hostname'] == 'myhost'
assert new['onboot'] is False
def test_get_api_format_simple():
# new = pv.get_api_dict(Adict)
new = pv.get_api_dict({'hostname': 'my', 'onboot': False})
# line = pv.get_api_format(new, pv.API_PARAM_CONV)
line = pv.get_api_format(new)
assert line == "-hostname=my -onboot=0"
def test_get_api_format_with_delete():
new = pv.get_api_dict({'hostname': 'my', 'onboot': False,
'delete': ['cores', 'cpulimit']})
assert 'onboot' in new
line = pv.get_api_format(new, pv.API_PARAM_CONV)
assert line == "-hostname=my -onboot=0 -delete=cores,cpulimit"
| mozitat/ansible-role-proxmoxy | library/test_proxmox_prov.py | Python | mit | 11,083 |
require File.join(File.dirname(__FILE__), 'setup_test')
class SeoUrlsTest < Test::Unit::TestCase
def test_person_to_params
assert p = Person.create(:name => "Long John Silver")
assert_equal p.to_param, "1-long-john-silver"
end
def test_post_to_params
assert p = Post.create(:title => "My first post")
assert_equal p.to_param, "1-my-first-post"
end
def test_animal_to_params
assert a = Animal.create(:common_name => "Domestic cat")
assert_equal a.to_param, "1-domestic-cat"
end
end
| ebotech/seo_urls | test/seo_urls_test.rb | Ruby | mit | 532 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _04_Draw_a_Filled_Square
{
class Program
{
static void Main(string[] args)
{
int n = int.Parse(Console.ReadLine());
PrintSquare(n);
}
private static void PrintSquare(int n)
{
PrintStartEnd(n);
PrintBoddy(n);
PrintStartEnd(n);
}
private static void PrintBoddy(int n)
{
for (int i = 1; i < n-1; i++)
{
Console.Write('-');
for (int j = 1; j < n; j++)
{
Console.Write("\\/", n);
}
Console.WriteLine('-');
}
}
private static void PrintStartEnd(int n)
{
Console.WriteLine(new string('-', 2 * n));
}
}
} | akkirilov/SoftUniProject | 01_ProgrammingFundamentals/Homeworks/03_Methods and Debugging-Lab/04_Draw a Filled Square/Program.cs | C# | mit | 945 |
(function () {
'use strict';
angular
.module('ionic-seed', [
'ionic',
'ngCordova',
'ionic-seed.view'
])
.run(function ($rootScope, $ionicPlatform, $window) {
$ionicPlatform.ready(function () {
if ($window.cordova && $window.cordova.plugins &&
$window.cordova.plugins.Keyboard) {
$window.cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
$window.cordova.plugins.Keyboard.disableScroll(true);
}
if ($window.StatusBar) {
$window.StatusBar.styleLightContent();
}
});
});
})();
| uloco/ionic-seed | app/app.js | JavaScript | mit | 606 |
## 스프링 부트의 에러 페이지 ㅓ리
https://docs.spring.io/autorepo/docs/spring-boot/current/reference/htmlsingle/#boot-features-error-handling-custom-error-pages
https://www.baeldung.com/exception-handling-for-rest-with-spring
https://www.baeldung.com/spring-response-status-exception
관심사는 그 문제였다.
RestController 와, Controller 의 에러 응답 전략 차이이다.
무슨 말이냐면, Controller 의 에러의 경우 에러 페이지를 노출해야 한다. 즉 content-type: text/html 이 되어야한다.
RestController 는 content-type : text/plain 이나 application/json 을 보내줘야 한다. 문제가 되는 부분이 이런 부분이다.
흔히 우리가 Ajax 라고 하는 화면 입장에서 비동기방법으로 화면 갱신을 하는 기능이 최근 많아졌다. 이 경우 RestController 에서 처리하게 되는 데, RestController 의 에러 반환은 text/html 이 되어버릴 경우, 적절한 에러 표현이 어렵다. 예를 들어서 Jquery 의 Ajax Error catch 시에 응답온 status 가 4xx 5xx 라면 에러 핸들러에서 처리를 쉽게 할 수 있는 데, 이때 메세지 본문을 alert() 으로 띄우려고 한다면.. html 소스가 그대로 출력되어버릴 것이다. Content-type text/html 이기 때문이다. 사실 이 말은 서버에서 html 을 보내줬기 때문이다 라는 말이 더 정확하긴 하다.
이를 위해서 기존에 아래처럼 RestController 만을 위한 에러 핸들러를 등록했었다.
```java
@ControllerAdvice(annotations = RestController.class)
public class ErstControllerErrorAdvice {
@ExceptionHandler(Throwable.class)
public ResponseEntity someError(Throwable e) {
return new ResponseEntity<>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
}
}
```
이렇게 되면 text/plain 으로 500 status 로 반환이 된다. 문제는 위의 코드는 객체지향적이지 못하다. 그도 그럴 것이 가장 최고의 Throwable 을 잡아서 에러를 전부 캐치하기 때문에.. 디테일한 조정이 불가능하다. 예를 들어서 ```IllegalArgumentException``` 또는 ```InvalidParameterException``` 의 경우에는 시에는 400. Bad Request 로 보내고 싶을 때가 있다. 에러에 따른 httpStatus 를 지정하는 것이 포인트이기 때문에 나는 RuntimeException 을 확장한 개별 에러로 만들고, 해당 에러의 필드에 Subtype 에서 HttpStatus 를 가지도록 강제화했다.
아래와 같다.
```java
/**
* @author Jhun
* 2019-08-07
*/
public abstract class RestfulApiException extends RuntimeException {
public RestfulApiException(String message) {
super(message);
}
public RestfulApiException(String message, Throwable cause) {
super(message, cause);
}
public RestfulApiException(Throwable cause) {
super(cause);
}
public abstract HttpStatus getHttpStatus();
/**
* @author Jhun
* 2019-08-07
*/
public static class CustomHttpStatusError extends RestfulApiException{
private HttpStatus httpStatus;
public CustomHttpStatusError(String message, HttpStatus httpStatus) {
super(message);
this.httpStatus = httpStatus;
}
public CustomHttpStatusError(String message, Throwable cause, HttpStatus httpStatus) {
super(message, cause);
this.httpStatus = httpStatus;
}
public CustomHttpStatusError(Throwable cause, HttpStatus httpStatus) {
super(cause);
this.httpStatus = httpStatus;
}
@Override
public HttpStatus getHttpStatus() {
return this.httpStatus;
}
}
/**
* @author Jhun
* 2019-08-07
*/
public static class ApiInternalError extends RestfulApiException {
public ApiInternalError(String message) {
super(message);
}
public ApiInternalError(String message, Throwable cause) {
super(message, cause);
}
public ApiInternalError(Throwable cause) {
super(cause);
}
@Override
public HttpStatus getHttpStatus() {
return HttpStatus.INTERNAL_SERVER_ERROR;
}
}
/**
* @author Jhun
* 2019-08-07
*/
public static class BadRequestError extends RestfulApiException {
public BadRequestError(String message) {
super(message);
}
public BadRequestError(String message, Throwable cause) {
super(message, cause);
}
public BadRequestError(Throwable cause) {
super(cause);
}
@Override
public HttpStatus getHttpStatus() {
return HttpStatus.BAD_REQUEST;
}
}
}
```
getHttpStatus() 를 강제화함으로써 각 에러에서 Status 를 return 할수 있게 했다. 그리고 이를 restcontroller advice 에서 캐치하게 했다.
```java
@ControllerAdvice(annotations = RestController.class)
public class RestControllerAdvice {
@ExceptionHandler(RestfulApiException.class)
public ResponseEntity apiError(RestfulApiException e) {
return new ResponseEntity<>(e.getMessage(), e.getHttpStatus());
}
}
```
오우 멋지게되었다.
스프링 5 에서는 ```ResponseStatusException``` 라는 에러가 등장했다. 이 에러는 에러에 httpstatus 를 주입할 수 있게 되어 있다. 나는 이 녀석으로 에러를 throw 만 해도 자동적으로 content-type : text/html 이 아닌.. text/plain 이나 스프링에서 Exception 내부 속성들을 json 직렬화해서 보내줄 줄 알았다.. 실험을 해봤더니 내가 만든 RestfulApiException과 똑같이 에러를 구별하고 statuscode 를 얻기 위할 뿐인 녀석이다. ResponseStatusException 을 throw 해도 결국 에러는 spring boot 기준 /error/error.html 에 있는 전역 페이지를 응답하게 되고.. ResponseStatusException 의 에러 내용이 화면에 렌더링 될 뿐이다. 다만 차이점이 있다면, ResponseStatusException의 경우 error.html 이 응답될 때 HttpStatus 를 컨트롤할 수 있다는 점이 있다. ResponseStatusException 란 이름 그대로 HttpStatus 를 응답할 때 제어할 뿐이다. 결국 이 녀석도 내가 의도했던 Controller 와 RestController 의 개별적인 에러 context 전략을 취하려면 각각 개별적인 controller advice 를 두고 해야한다. 아래와 같이
```java
@ControllerAdvice(annotations = RestController.class)
public class RestControllerAdvice {
@ExceptionHandler(ResponseStatusException.class)
public ResponseEntity apiError(ResponseStatusException e) {
return new ResponseEntity<>(e.getMessage(), e.getStatus());
}
}
```
별 차이점이 없다. 차리라 그냥 내가 에러 모델링을 더 확장할 수 있게 직접 만든 걸 쓰는 것이 나을 것이다.
현재는 content-type 도 핸들링하는 걸 추가해서 최종적으로는 아래처럼 사용하고 있다.
```java
/**
* @author Jhun
* 2019-08-07
*/
@ControllerAdvice(annotations = RestController.class)
public class RestControllerAdvice {
@ExceptionHandler(RestfulApiException.class)
public ResponseEntity apiError(RestfulApiException e) {
return ResponseEntity.status(e.getHttpStatus())
.contentType(MediaType.APPLICATION_JSON_UTF8)
.body(new ApiErrorMessage(e.getMessage(), e.getHttpStatus().value()));
}
public static class ApiErrorMessage {
private String message;
private Integer status;
public ApiErrorMessage(String message, Integer status) {
this.message = message;
this.status = status;
}
public String getMessage() {
return message;
}
public Integer getStatus() {
return status;
}
}
}
``` | glqdlt/glqdlt.github.io | _stash/2017-02-03-스프링웹프로젝트의에러처리에대한이해.md | Markdown | mit | 7,935 |
# -*- coding:utf-8 -*-
# This code is automatically transpiled by Saklient Translator
import six
from ...errors.httpconflictexception import HttpConflictException
import saklient
str = six.text_type
# module saklient.cloud.errors.originalhashmismatchexception
class OriginalHashMismatchException(HttpConflictException):
## 要求された操作を行えません。オリジナルのデータを取得してからこのリクエストを行うまでの間に、他の変更が加わった可能性があります。
## @param {int} status
# @param {str} code=None
# @param {str} message=""
def __init__(self, status, code=None, message=""):
super(OriginalHashMismatchException, self).__init__(status, code, "要求された操作を行えません。オリジナルのデータを取得してからこのリクエストを行うまでの間に、他の変更が加わった可能性があります。" if message is None or message == "" else message)
| sakura-internet/saklient.python | saklient/cloud/errors/originalhashmismatchexception.py | Python | mit | 994 |
// Copyright (c) 2010 Satoshi Nakamoto
// Copyright (c) 2009-2012 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <boost/assign/list_of.hpp>
#include "base58.h"
#include "bitcoinrpc.h"
#include "db.h"
#include "init.h"
#include "main.h"
#include "net.h"
#include "wallet.h"
using namespace std;
using namespace boost;
using namespace boost::assign;
using namespace json_spirit;
//
// Utilities: convert hex-encoded Values
// (throws error if not hex).
//
uint256 ParseHashV(const Value& v, string strName)
{
string strHex;
if (v.type() == str_type)
strHex = v.get_str();
if (!IsHex(strHex)) // Note: IsHex("") is false
throw JSONRPCError(RPC_INVALID_PARAMETER, strName+" must be hexadecimal string (not '"+strHex+"')");
uint256 result;
result.SetHex(strHex);
return result;
}
uint256 ParseHashO(const Object& o, string strKey)
{
return ParseHashV(find_value(o, strKey), strKey);
}
vector<unsigned char> ParseHexV(const Value& v, string strName)
{
string strHex;
if (v.type() == str_type)
strHex = v.get_str();
if (!IsHex(strHex))
throw JSONRPCError(RPC_INVALID_PARAMETER, strName+" must be hexadecimal string (not '"+strHex+"')");
return ParseHex(strHex);
}
vector<unsigned char> ParseHexO(const Object& o, string strKey)
{
return ParseHexV(find_value(o, strKey), strKey);
}
void ScriptPubKeyToJSON(const CScript& scriptPubKey, Object& out)
{
txnouttype type;
vector<CTxDestination> addresses;
int nRequired;
out.push_back(Pair("asm", scriptPubKey.ToString()));
out.push_back(Pair("hex", HexStr(scriptPubKey.begin(), scriptPubKey.end())));
if (!ExtractDestinations(scriptPubKey, type, addresses, nRequired))
{
out.push_back(Pair("type", GetTxnOutputType(TX_NONSTANDARD)));
return;
}
out.push_back(Pair("reqSigs", nRequired));
out.push_back(Pair("type", GetTxnOutputType(type)));
Array a;
BOOST_FOREACH(const CTxDestination& addr, addresses)
a.push_back(CBitcoinAddress(addr).ToString());
out.push_back(Pair("addresses", a));
}
void TxToJSON(const CTransaction& tx, const uint256 hashBlock, Object& entry)
{
entry.push_back(Pair("txid", tx.GetHash().GetHex()));
entry.push_back(Pair("version", tx.nVersion));
entry.push_back(Pair("locktime", (boost::int64_t)tx.nLockTime));
Array vin;
BOOST_FOREACH(const CTxIn& txin, tx.vin)
{
Object in;
if (tx.IsCoinBase())
in.push_back(Pair("coinbase", HexStr(txin.scriptSig.begin(), txin.scriptSig.end())));
else
{
in.push_back(Pair("txid", txin.prevout.hash.GetHex()));
in.push_back(Pair("vout", (boost::int64_t)txin.prevout.n));
Object o;
o.push_back(Pair("asm", txin.scriptSig.ToString()));
o.push_back(Pair("hex", HexStr(txin.scriptSig.begin(), txin.scriptSig.end())));
in.push_back(Pair("scriptSig", o));
}
in.push_back(Pair("sequence", (boost::int64_t)txin.nSequence));
vin.push_back(in);
}
entry.push_back(Pair("vin", vin));
Array vout;
for (unsigned int i = 0; i < tx.vout.size(); i++)
{
const CTxOut& txout = tx.vout[i];
Object out;
out.push_back(Pair("value", ValueFromAmount(txout.nValue)));
out.push_back(Pair("n", (boost::int64_t)i));
Object o;
ScriptPubKeyToJSON(txout.scriptPubKey, o);
out.push_back(Pair("scriptPubKey", o));
vout.push_back(out);
}
entry.push_back(Pair("vout", vout));
if (hashBlock != 0)
{
entry.push_back(Pair("blockhash", hashBlock.GetHex()));
map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(hashBlock);
if (mi != mapBlockIndex.end() && (*mi).second)
{
CBlockIndex* pindex = (*mi).second;
if (pindex->IsInMainChain())
{
entry.push_back(Pair("confirmations", 1 + nBestHeight - pindex->nHeight));
entry.push_back(Pair("time", (boost::int64_t)pindex->nTime));
entry.push_back(Pair("blocktime", (boost::int64_t)pindex->nTime));
}
else
entry.push_back(Pair("confirmations", 0));
}
}
}
Value getrawtransaction(const Array& params, bool fHelp)
{
if (fHelp || params.size() < 1 || params.size() > 2)
throw runtime_error(
"getrawtransaction <txid> [verbose=0]\n"
"If verbose=0, returns a string that is\n"
"serialized, hex-encoded data for <txid>.\n"
"If verbose is non-zero, returns an Object\n"
"with information about <txid>.");
uint256 hash = ParseHashV(params[0], "parameter 1");
bool fVerbose = false;
if (params.size() > 1)
fVerbose = (params[1].get_int() != 0);
CTransaction tx;
uint256 hashBlock = 0;
if (!GetTransaction(hash, tx, hashBlock, true))
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "No information available about transaction");
CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION);
ssTx << tx;
string strHex = HexStr(ssTx.begin(), ssTx.end());
if (!fVerbose)
return strHex;
Object result;
result.push_back(Pair("hex", strHex));
TxToJSON(tx, hashBlock, result);
return result;
}
Value listunspent(const Array& params, bool fHelp)
{
if (fHelp || params.size() > 3)
throw runtime_error(
"listunspent [minconf=1] [maxconf=9999999] [\"address\",...]\n"
"Returns array of unspent transaction outputs\n"
"with between minconf and maxconf (inclusive) confirmations.\n"
"Optionally filtered to only include txouts paid to specified addresses.\n"
"Results are an array of Objects, each of which has:\n"
"{txid, vout, scriptPubKey, amount, confirmations}");
RPCTypeCheck(params, list_of(int_type)(int_type)(array_type));
int nMinDepth = 1;
if (params.size() > 0)
nMinDepth = params[0].get_int();
int nMaxDepth = 9999999;
if (params.size() > 1)
nMaxDepth = params[1].get_int();
set<CBitcoinAddress> setAddress;
if (params.size() > 2)
{
Array inputs = params[2].get_array();
BOOST_FOREACH(Value& input, inputs)
{
CBitcoinAddress address(input.get_str());
if (!address.IsValid())
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("Invalid Sansicoin address: ")+input.get_str());
if (setAddress.count(address))
throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, duplicated address: ")+input.get_str());
setAddress.insert(address);
}
}
Array results;
vector<COutput> vecOutputs;
assert(pwalletMain != NULL);
pwalletMain->AvailableCoins(vecOutputs, false);
BOOST_FOREACH(const COutput& out, vecOutputs)
{
if (out.nDepth < nMinDepth || out.nDepth > nMaxDepth)
continue;
if (setAddress.size())
{
CTxDestination address;
if (!ExtractDestination(out.tx->vout[out.i].scriptPubKey, address))
continue;
if (!setAddress.count(address))
continue;
}
int64 nValue = out.tx->vout[out.i].nValue;
const CScript& pk = out.tx->vout[out.i].scriptPubKey;
Object entry;
entry.push_back(Pair("txid", out.tx->GetHash().GetHex()));
entry.push_back(Pair("vout", out.i));
CTxDestination address;
if (ExtractDestination(out.tx->vout[out.i].scriptPubKey, address))
{
entry.push_back(Pair("address", CBitcoinAddress(address).ToString()));
if (pwalletMain->mapAddressBook.count(address))
entry.push_back(Pair("account", pwalletMain->mapAddressBook[address]));
}
entry.push_back(Pair("scriptPubKey", HexStr(pk.begin(), pk.end())));
if (pk.IsPayToScriptHash())
{
CTxDestination address;
if (ExtractDestination(pk, address))
{
const CScriptID& hash = boost::get<const CScriptID&>(address);
CScript redeemScript;
if (pwalletMain->GetCScript(hash, redeemScript))
entry.push_back(Pair("redeemScript", HexStr(redeemScript.begin(), redeemScript.end())));
}
}
entry.push_back(Pair("amount",ValueFromAmount(nValue)));
entry.push_back(Pair("confirmations",out.nDepth));
results.push_back(entry);
}
return results;
}
Value createrawtransaction(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 2)
throw runtime_error(
"createrawtransaction [{\"txid\":txid,\"vout\":n},...] {address:amount,...}\n"
"Create a transaction spending given inputs\n"
"(array of objects containing transaction id and output number),\n"
"sending to given address(es).\n"
"Returns hex-encoded raw transaction.\n"
"Note that the transaction's inputs are not signed, and\n"
"it is not stored in the wallet or transmitted to the network.");
RPCTypeCheck(params, list_of(array_type)(obj_type));
Array inputs = params[0].get_array();
Object sendTo = params[1].get_obj();
CTransaction rawTx;
BOOST_FOREACH(const Value& input, inputs)
{
const Object& o = input.get_obj();
uint256 txid = ParseHashO(o, "txid");
const Value& vout_v = find_value(o, "vout");
if (vout_v.type() != int_type)
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, missing vout key");
int nOutput = vout_v.get_int();
if (nOutput < 0)
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, vout must be positive");
CTxIn in(COutPoint(txid, nOutput));
rawTx.vin.push_back(in);
}
set<CBitcoinAddress> setAddress;
BOOST_FOREACH(const Pair& s, sendTo)
{
CBitcoinAddress address(s.name_);
if (!address.IsValid())
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("Invalid Sansicoin address: ")+s.name_);
if (setAddress.count(address))
throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, duplicated address: ")+s.name_);
setAddress.insert(address);
CScript scriptPubKey;
scriptPubKey.SetDestination(address.Get());
int64 nAmount = AmountFromValue(s.value_);
CTxOut out(nAmount, scriptPubKey);
rawTx.vout.push_back(out);
}
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
ss << rawTx;
return HexStr(ss.begin(), ss.end());
}
Value decoderawtransaction(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 1)
throw runtime_error(
"decoderawtransaction <hex string>\n"
"Return a JSON object representing the serialized, hex-encoded transaction.");
vector<unsigned char> txData(ParseHexV(params[0], "argument"));
CDataStream ssData(txData, SER_NETWORK, PROTOCOL_VERSION);
CTransaction tx;
try {
ssData >> tx;
}
catch (std::exception &e) {
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed");
}
Object result;
TxToJSON(tx, 0, result);
return result;
}
Value signrawtransaction(const Array& params, bool fHelp)
{
if (fHelp || params.size() < 1 || params.size() > 4)
throw runtime_error(
"signrawtransaction <hex string> [{\"txid\":txid,\"vout\":n,\"scriptPubKey\":hex,\"redeemScript\":hex},...] [<privatekey1>,...] [sighashtype=\"ALL\"]\n"
"Sign inputs for raw transaction (serialized, hex-encoded).\n"
"Second optional argument (may be null) is an array of previous transaction outputs that\n"
"this transaction depends on but may not yet be in the block chain.\n"
"Third optional argument (may be null) is an array of base58-encoded private\n"
"keys that, if given, will be the only keys used to sign the transaction.\n"
"Fourth optional argument is a string that is one of six values; ALL, NONE, SINGLE or\n"
"ALL|ANYONECANPAY, NONE|ANYONECANPAY, SINGLE|ANYONECANPAY.\n"
"Returns json object with keys:\n"
" hex : raw transaction with signature(s) (hex-encoded string)\n"
" complete : 1 if transaction has a complete set of signature (0 if not)"
+ HelpRequiringPassphrase());
RPCTypeCheck(params, list_of(str_type)(array_type)(array_type)(str_type), true);
vector<unsigned char> txData(ParseHexV(params[0], "argument 1"));
CDataStream ssData(txData, SER_NETWORK, PROTOCOL_VERSION);
vector<CTransaction> txVariants;
while (!ssData.empty())
{
try {
CTransaction tx;
ssData >> tx;
txVariants.push_back(tx);
}
catch (std::exception &e) {
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed");
}
}
if (txVariants.empty())
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Missing transaction");
// mergedTx will end up with all the signatures; it
// starts as a clone of the rawtx:
CTransaction mergedTx(txVariants[0]);
bool fComplete = true;
// Fetch previous transactions (inputs):
CCoinsView viewDummy;
CCoinsViewCache view(viewDummy);
{
LOCK(mempool.cs);
CCoinsViewCache &viewChain = *pcoinsTip;
CCoinsViewMemPool viewMempool(viewChain, mempool);
view.SetBackend(viewMempool); // temporarily switch cache backend to db+mempool view
BOOST_FOREACH(const CTxIn& txin, mergedTx.vin) {
const uint256& prevHash = txin.prevout.hash;
CCoins coins;
view.GetCoins(prevHash, coins); // this is certainly allowed to fail
}
view.SetBackend(viewDummy); // switch back to avoid locking mempool for too long
}
bool fGivenKeys = false;
CBasicKeyStore tempKeystore;
if (params.size() > 2 && params[2].type() != null_type)
{
fGivenKeys = true;
Array keys = params[2].get_array();
BOOST_FOREACH(Value k, keys)
{
CBitcoinSecret vchSecret;
bool fGood = vchSecret.SetString(k.get_str());
if (!fGood)
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid private key");
CKey key = vchSecret.GetKey();
tempKeystore.AddKey(key);
}
}
else
EnsureWalletIsUnlocked();
// Add previous txouts given in the RPC call:
if (params.size() > 1 && params[1].type() != null_type)
{
Array prevTxs = params[1].get_array();
BOOST_FOREACH(Value& p, prevTxs)
{
if (p.type() != obj_type)
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "expected object with {\"txid'\",\"vout\",\"scriptPubKey\"}");
Object prevOut = p.get_obj();
RPCTypeCheck(prevOut, map_list_of("txid", str_type)("vout", int_type)("scriptPubKey", str_type));
uint256 txid = ParseHashO(prevOut, "txid");
int nOut = find_value(prevOut, "vout").get_int();
if (nOut < 0)
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "vout must be positive");
vector<unsigned char> pkData(ParseHexO(prevOut, "scriptPubKey"));
CScript scriptPubKey(pkData.begin(), pkData.end());
CCoins coins;
if (view.GetCoins(txid, coins)) {
if (coins.IsAvailable(nOut) && coins.vout[nOut].scriptPubKey != scriptPubKey) {
string err("Previous output scriptPubKey mismatch:\n");
err = err + coins.vout[nOut].scriptPubKey.ToString() + "\nvs:\n"+
scriptPubKey.ToString();
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, err);
}
// what todo if txid is known, but the actual output isn't?
}
if ((unsigned int)nOut >= coins.vout.size())
coins.vout.resize(nOut+1);
coins.vout[nOut].scriptPubKey = scriptPubKey;
coins.vout[nOut].nValue = 0; // we don't know the actual output value
view.SetCoins(txid, coins);
// if redeemScript given and not using the local wallet (private keys
// given), add redeemScript to the tempKeystore so it can be signed:
if (fGivenKeys && scriptPubKey.IsPayToScriptHash())
{
RPCTypeCheck(prevOut, map_list_of("txid", str_type)("vout", int_type)("scriptPubKey", str_type)("redeemScript",str_type));
Value v = find_value(prevOut, "redeemScript");
if (!(v == Value::null))
{
vector<unsigned char> rsData(ParseHexV(v, "redeemScript"));
CScript redeemScript(rsData.begin(), rsData.end());
tempKeystore.AddCScript(redeemScript);
}
}
}
}
const CKeyStore& keystore = ((fGivenKeys || !pwalletMain) ? tempKeystore : *pwalletMain);
int nHashType = SIGHASH_ALL;
if (params.size() > 3 && params[3].type() != null_type)
{
static map<string, int> mapSigHashValues =
boost::assign::map_list_of
(string("ALL"), int(SIGHASH_ALL))
(string("ALL|ANYONECANPAY"), int(SIGHASH_ALL|SIGHASH_ANYONECANPAY))
(string("NONE"), int(SIGHASH_NONE))
(string("NONE|ANYONECANPAY"), int(SIGHASH_NONE|SIGHASH_ANYONECANPAY))
(string("SINGLE"), int(SIGHASH_SINGLE))
(string("SINGLE|ANYONECANPAY"), int(SIGHASH_SINGLE|SIGHASH_ANYONECANPAY))
;
string strHashType = params[3].get_str();
if (mapSigHashValues.count(strHashType))
nHashType = mapSigHashValues[strHashType];
else
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid sighash param");
}
bool fHashSingle = ((nHashType & ~SIGHASH_ANYONECANPAY) == SIGHASH_SINGLE);
// Sign what we can:
for (unsigned int i = 0; i < mergedTx.vin.size(); i++)
{
CTxIn& txin = mergedTx.vin[i];
CCoins coins;
if (!view.GetCoins(txin.prevout.hash, coins) || !coins.IsAvailable(txin.prevout.n))
{
fComplete = false;
continue;
}
const CScript& prevPubKey = coins.vout[txin.prevout.n].scriptPubKey;
txin.scriptSig.clear();
// Only sign SIGHASH_SINGLE if there's a corresponding output:
if (!fHashSingle || (i < mergedTx.vout.size()))
SignSignature(keystore, prevPubKey, mergedTx, i, nHashType);
// ... and merge in other signatures:
BOOST_FOREACH(const CTransaction& txv, txVariants)
{
txin.scriptSig = CombineSignatures(prevPubKey, mergedTx, i, txin.scriptSig, txv.vin[i].scriptSig);
}
if (!VerifyScript(txin.scriptSig, prevPubKey, mergedTx, i, SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_STRICTENC, 0))
fComplete = false;
}
Object result;
CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION);
ssTx << mergedTx;
result.push_back(Pair("hex", HexStr(ssTx.begin(), ssTx.end())));
result.push_back(Pair("complete", fComplete));
return result;
}
Value sendrawtransaction(const Array& params, bool fHelp)
{
if (fHelp || params.size() < 1 || params.size() > 2)
throw runtime_error(
"sendrawtransaction <hex string> [allowhighfees=false]\n"
"Submits raw transaction (serialized, hex-encoded) to local node and network.");
// parse hex string from parameter
vector<unsigned char> txData(ParseHexV(params[0], "parameter"));
CDataStream ssData(txData, SER_NETWORK, PROTOCOL_VERSION);
CTransaction tx;
bool fOverrideFees = false;
if (params.size() > 1)
fOverrideFees = params[1].get_bool();
// deserialize binary data stream
try {
ssData >> tx;
}
catch (std::exception &e) {
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed");
}
uint256 hashTx = tx.GetHash();
bool fHave = false;
CCoinsViewCache &view = *pcoinsTip;
CCoins existingCoins;
{
fHave = view.GetCoins(hashTx, existingCoins);
if (!fHave) {
// push to local node
CValidationState state;
if (!tx.AcceptToMemoryPool(state, true, false, NULL, !fOverrideFees))
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX rejected"); // TODO: report validation state
}
}
if (fHave) {
if (existingCoins.nHeight < 1000000000)
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "transaction already in block chain");
// Not in block, but already in the memory pool; will drop
// through to re-relay it.
} else {
SyncWithWallets(hashTx, tx, NULL, true);
}
RelayTransaction(tx, hashTx);
return hashTx.GetHex();
}
Value getnormalizedtxid(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 1)
throw runtime_error(
"getnormalizedtxid <hex string>\n"
"Return the normalized transaction ID.");
// parse hex string from parameter
vector<unsigned char> txData(ParseHexV(params[0], "parameter"));
CDataStream ssData(txData, SER_NETWORK, PROTOCOL_VERSION);
CTransaction tx;
// deserialize binary data stream
try {
ssData >> tx;
}
catch (std::exception &e) {
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed");
}
uint256 hashNormalized = tx.GetNormalizedHash();
return hashNormalized.GetHex();
}
| sansicoin/sansicoin | src/rpcrawtransaction.cpp | C++ | mit | 21,972 |
export SchedulerHaltedException
export sch_handle, halt!, exec!, get_dag_ids, add_thunk!
"Identifies a thunk by its ID, and preserves the thunk in the scheduler."
struct ThunkID
id::Int
ref::Union{DRef,Nothing}
end
ThunkID(id::Int) = ThunkID(id, nothing)
"A handle to the scheduler, used by dynamic thunks."
struct SchedulerHandle
thunk_id::ThunkID
out_chan::RemoteChannel
inp_chan::RemoteChannel
end
"Gets the scheduler handle for the currently-executing thunk."
sch_handle() = task_local_storage(:_dagger_sch_handle)::SchedulerHandle
"Thrown when the scheduler halts before finishing processing the DAG."
struct SchedulerHaltedException <: Exception end
"Thrown when a dynamic thunk encounters an exception in Dagger's utilities."
struct DynamicThunkException <: Exception
reason::String
end
struct RescheduleSignal end
function safepoint(state)
if state.halt.set
# Force dynamic thunks and listeners to terminate
for (inp_chan,out_chan) in values(state.worker_chans)
close(inp_chan)
close(out_chan)
end
# Throw out of scheduler
throw(SchedulerHaltedException())
end
end
"Processes dynamic messages from worker-executing thunks."
function dynamic_listener!(ctx, state)
task = current_task() # The scheduler's main task
listener_tasks = Task[]
for tid in keys(state.worker_chans)
inp_chan, out_chan = state.worker_chans[tid]
push!(listener_tasks, @async begin
while isopen(inp_chan) && !state.halt.set
tid, f, data = try
take!(inp_chan)
catch err
if !(unwrap_nested_exception(err) isa Union{SchedulerHaltedException,
ProcessExitedException,
InvalidStateException})
iob = IOContext(IOBuffer(), :color=>true)
println(iob, "Error in sending dynamic request:")
Base.showerror(iob, err)
Base.show_backtrace(iob, catch_backtrace())
println(iob)
seek(iob.io, 0)
write(stderr, iob)
end
break
end
res = try
(false, lock(state.lock) do
Base.invokelatest(f, ctx, state, task, tid, data)
end)
catch err
(true, RemoteException(CapturedException(err,catch_backtrace())))
end
try
put!(out_chan, res)
catch err
if !(unwrap_nested_exception(err) isa Union{SchedulerHaltedException,
ProcessExitedException,
InvalidStateException})
iob = IOContext(IOBuffer(), :color=>true)
println(iob, "Error in sending dynamic result:")
Base.showerror(iob, err)
Base.show_backtrace(iob, catch_backtrace())
println(iob)
seek(iob.io, 0)
write(stderr, iob)
end
end
end
end)
end
@async begin
wait(state.halt)
for ltask in listener_tasks
# TODO: Not sure why we need the @async here, but otherwise we
# don't stop all the listener tasks
@async Base.throwto(ltask, SchedulerHaltedException())
end
end
end
## Worker-side methods for dynamic communication
const DYNAMIC_EXEC_LOCK = Threads.ReentrantLock()
"Executes an arbitrary function within the scheduler, returning the result."
function exec!(f, h::SchedulerHandle, args...)
failed, res = lock(DYNAMIC_EXEC_LOCK) do
put!(h.out_chan, (h.thunk_id.id, f, args))
take!(h.inp_chan)
end
failed && throw(res)
res
end
"Commands the scheduler to halt execution immediately."
halt!(h::SchedulerHandle) = exec!(_halt, h, nothing)
function _halt(ctx, state, task, tid, _)
notify(state.halt)
put!(state.chan, (1, nothing, SchedulerHaltedException(), nothing))
Base.throwto(task, SchedulerHaltedException())
end
"Waits on a thunk to complete, and fetches its result."
function Base.fetch(h::SchedulerHandle, id::ThunkID)
future = ThunkFuture(Future(1))
exec!(_register_future!, h, future, id)
fetch(future; proc=thunk_processor())
end
"Waits on a thunk to complete, and fetches its result."
register_future!(h::SchedulerHandle, id::ThunkID, future::ThunkFuture) =
exec!(_register_future!, h, future, id)
function _register_future!(ctx, state, task, tid, (future, id)::Tuple{ThunkFuture,ThunkID})
tid != id.id || throw(DynamicThunkException("Cannot fetch own result"))
GC.@preserve id begin
thunk = unwrap_weak_checked(state.thunk_dict[id.id])
ownthunk = unwrap_weak_checked(state.thunk_dict[tid])
function dominates(target, t)
t == target && return true
# N.B. Skips expired tasks
task_inputs = filter(istask, Dagger.unwrap_weak.(t.inputs))
if any(_t->dominates(target, _t), task_inputs)
return true
end
return false
end
!dominates(ownthunk, thunk) || throw(DynamicThunkException("Cannot fetch result of dominated thunk"))
# TODO: Assert that future will be fulfilled
if haskey(state.cache, thunk)
put!(future, state.cache[thunk]; error=state.errored[thunk])
else
futures = get!(()->ThunkFuture[], state.futures, thunk)
push!(futures, future)
end
end
nothing
end
# TODO: Optimize wait() to not serialize a Chunk
"Waits on a thunk to complete."
function Base.wait(h::SchedulerHandle, id::ThunkID; future=ThunkFuture(1))
register_future!(h, id, future)
wait(future)
end
"Returns all Thunks IDs as a Dict, mapping a Thunk to its downstream dependents."
get_dag_ids(h::SchedulerHandle) =
exec!(_get_dag_ids, h, nothing)::Dict{ThunkID,Set{ThunkID}}
function _get_dag_ids(ctx, state, task, tid, _)
deps = Dict{ThunkID,Set{ThunkID}}()
for (id,thunk) in state.thunk_dict
thunk = unwrap_weak_checked(thunk)
# TODO: Get at `thunk_ref` for `thunk_id.ref`
thunk_id = ThunkID(id, nothing)
if haskey(state.waiting_data, thunk)
deps[thunk_id] = Set(map(t->ThunkID(t.id, nothing), collect(state.waiting_data[thunk])))
else
deps[thunk_id] = Set{ThunkID}()
end
end
deps
end
"Adds a new Thunk to the DAG."
add_thunk!(f, h::SchedulerHandle, args...; future=nothing, ref=nothing, kwargs...) =
exec!(_add_thunk!, h, f, args, kwargs, future, ref)
function _add_thunk!(ctx, state, task, tid, (f, args, kwargs, future, ref))
_args = map(arg->arg isa ThunkID ? state.thunk_dict[arg.id] : arg, args)
GC.@preserve _args begin
thunk = Thunk(f, _args...; kwargs...)
# Create a `DRef` to `thunk` so that the caller can preserve it
thunk_ref = poolset(thunk)
thunk_id = ThunkID(thunk.id, thunk_ref)
state.thunk_dict[thunk.id] = WeakThunk(thunk)
reschedule_inputs!(state, thunk)
if future !== nothing
# Ensure we attach a future before the thunk is scheduled
_register_future!(ctx, state, task, tid, (future, thunk_id))
end
if ref !== nothing
# Preserve the `EagerThunkFinalizer` through `thunk`
thunk.eager_ref = ref
end
put!(state.chan, RescheduleSignal())
return thunk_id
end
end
| shashi/ComputeFramework.jl | src/sch/dynamic.jl | Julia | mit | 7,891 |
# -*- coding: utf8 -*-
#
# 2015 Muthiah Annamalai <[email protected]>
#
units = (u'பூஜ்ஜியம்', u'ஒன்று', u'இரண்டு', u'மூன்று', u'நான்கு', u'ஐந்து', u'ஆறு', u'ஏழு', u'எட்டு', u'ஒன்பது', u'பத்து') # 0-10
teens = (u'பதினொன்று', u' பனிரண்டு', u'பதிமூன்று', u'பதினான்கு', u'பதினைந்து',u'பதினாறு', u'பதினேழு', u'பதினெட்டு', u'பத்தொன்பது') # 11-19
tens = (u'பத்து', u'இருபது', u'முப்பது', u'நாற்பது', u'ஐம்பது',u'அறுபது', u'எழுபது', u'எண்பது', u'தொன்னூறு') # 10-90
tens_suffix = (u'இருபத்தி', u'முப்பத்தி', u'நாற்பத்தி', u'ஐம்பத்தி', u'அறுபத்தி', u'எழுபத்தி', u'எண்பத்தி', u'தொன்னூற்றி') # 10+-90+
hundreds = ( u'நூறு', u'இருநூறு', u'முன்னூறு', u'நாநூறு',u'ஐநூறு', u'அறுநூறு', u'எழுநூறு', u'எண்ணூறு', u'தொள்ளாயிரம்') #100 – 900
hundreds_suffix = (u'நூற்றி', u'இருநூற்றி', u'முன்னூற்று', u'நாநூற்று', u'ஐநூற்று', u'அறுநூற்று', u'எழுநூற்று', u'எண்ணூற்று',u'தொள்ளாயிரத்து') #100+ – 900+
one_thousand_prefix = (u'ஓர்',None)
thousands = (u'ஆயிரம்',u'ஆயிரத்தி')
one_prefix = (u'ஒரு',None)
lakh = (u'இலட்சம்',u'இலட்சத்தி')
crore = (u'கோடி',u'கோடியே')
print sum(map(len,[units,teens,tens,tens_suffix,hundreds,hundreds_suffix,one_thousand_prefix,thousands,one_prefix,lakh,crore]))
count = 0
for word_list in [units, teens,tens,tens_suffix,hundreds,hundreds_suffix,one_thousand_prefix,thousands,one_prefix,lakh,crore]:
for word in word_list:
if not word:
break
print(u"%02d) %s"%(count,word))
count += 1
# 'C:\\Users\\muthu\\devel\\open-tamil\\examples\\pesum_kediyaram'
# import os; os.chdir('C:\\Users\\muthu\\devel\\open-tamil\\examples\\pesum_kediyaram') | atvKumar/open-tamil | examples/pesum_kediyaram/sorkal.py | Python | mit | 2,488 |
#!/bin/bash
KEYWORDS_BATS="\bbat(|s)\b|(micro|macro)bat"
KEYWORDS_BATS_EXCLUDE="baseball|cricket|bat(| )mitzvah|(cork|wood|aluminum|aluminium)(| )bat|(rouge|radar)(| )the(| )bat"
KEYWORDS_BATS_ALL="$KEYWORDS_BATS"
if [ "$1" == "" ]; #Normal operation
then
debug_start "Bats"
BATS=$(egrep -i "$KEYWORDS_BATS" "$NEWPAGES" | egrep -iv "$KEYWORDS_BATS_EXCLUDE")
categorize "BATS" "Bats"
debug_end "Bats"
fi | MW-autocat-script/MW-autocat-script | catscripts/Science/Biology/Animals/Vertebrates/Mammals/Placental_mammals/Bats/Bats.sh | Shell | mit | 419 |
#include "../../pe/include/pe19.h"
int pe19(int argc, char **argv);
| kittttttan/pe | cpp/cli/include/pe19.h | C | mit | 69 |
## This is the [header]
| Siedrix/paperpress | test/duplicate-paths/snippets/[header].md | Markdown | mit | 24 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_26) on Thu Feb 16 18:15:38 CET 2012 -->
<TITLE>
Uses of Class rabbit.html.HtmlEscapeUtils (RabbIT/4)
</TITLE>
<META NAME="date" CONTENT="2012-02-16">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class rabbit.html.HtmlEscapeUtils (RabbIT/4)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../rabbit/html/HtmlEscapeUtils.html" title="class in rabbit.html"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html?rabbit/html//class-useHtmlEscapeUtils.html" target="_top"><B>FRAMES</B></A>
<A HREF="HtmlEscapeUtils.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<CENTER>
<H2>
<B>Uses of Class<br>rabbit.html.HtmlEscapeUtils</B></H2>
</CENTER>
No usage of rabbit.html.HtmlEscapeUtils
<P>
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../rabbit/html/HtmlEscapeUtils.html" title="class in rabbit.html"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html?rabbit/html//class-useHtmlEscapeUtils.html" target="_top"><B>FRAMES</B></A>
<A HREF="HtmlEscapeUtils.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
</BODY>
</HTML>
| exratione/selenium-service-example | lib/testingbot-tunnel-1.16/lib/rabbit/htdocs/javadoc/rabbit/html/class-use/HtmlEscapeUtils.html | HTML | mit | 5,714 |
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2012 The Bitcoin Developers
// Copyright (c) 2011-2012 Litecoin Developers
// Copyright (c) 2013 Feathercoin Developers
// Copyright (c) 2014 GoodwillCoin.org
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
//
// Why base-58 instead of standard base-64 encoding?
// - Don't want 0OIl characters that look the same in some fonts and
// could be used to create visually identical looking account numbers.
// - A string with non-alphanumeric characters is not as easily accepted as an account number.
// - E-mail usually won't line-break if there's no punctuation to break at.
// - Doubleclicking selects the whole number as one word if it's all alphanumeric.
//
#ifndef BITCOIN_BASE58_H
#define BITCOIN_BASE58_H
#include <string>
#include <vector>
#include "bignum.h"
#include "key.h"
#include "script.h"
static const char* pszBase58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
// Encode a byte sequence as a base58-encoded string
inline std::string EncodeBase58(const unsigned char* pbegin, const unsigned char* pend)
{
CAutoBN_CTX pctx;
CBigNum bn58 = 58;
CBigNum bn0 = 0;
// Convert big endian data to little endian
// Extra zero at the end make sure bignum will interpret as a positive number
std::vector<unsigned char> vchTmp(pend-pbegin+1, 0);
reverse_copy(pbegin, pend, vchTmp.begin());
// Convert little endian data to bignum
CBigNum bn;
bn.setvch(vchTmp);
// Convert bignum to std::string
std::string str;
// Expected size increase from base58 conversion is approximately 137%
// use 138% to be safe
str.reserve((pend - pbegin) * 138 / 100 + 1);
CBigNum dv;
CBigNum rem;
while (bn > bn0)
{
if (!BN_div(&dv, &rem, &bn, &bn58, pctx))
throw bignum_error("EncodeBase58 : BN_div failed");
bn = dv;
unsigned int c = rem.getulong();
str += pszBase58[c];
}
// Leading zeroes encoded as base58 zeros
for (const unsigned char* p = pbegin; p < pend && *p == 0; p++)
str += pszBase58[0];
// Convert little endian std::string to big endian
reverse(str.begin(), str.end());
return str;
}
// Encode a byte vector as a base58-encoded string
inline std::string EncodeBase58(const std::vector<unsigned char>& vch)
{
return EncodeBase58(&vch[0], &vch[0] + vch.size());
}
// Decode a base58-encoded string psz into byte vector vchRet
// returns true if decoding is successful
inline bool DecodeBase58(const char* psz, std::vector<unsigned char>& vchRet)
{
CAutoBN_CTX pctx;
vchRet.clear();
CBigNum bn58 = 58;
CBigNum bn = 0;
CBigNum bnChar;
while (isspace(*psz))
psz++;
// Convert big endian string to bignum
for (const char* p = psz; *p; p++)
{
const char* p1 = strchr(pszBase58, *p);
if (p1 == NULL)
{
while (isspace(*p))
p++;
if (*p != '\0')
return false;
break;
}
bnChar.setulong(p1 - pszBase58);
if (!BN_mul(&bn, &bn, &bn58, pctx))
throw bignum_error("DecodeBase58 : BN_mul failed");
bn += bnChar;
}
// Get bignum as little endian data
std::vector<unsigned char> vchTmp = bn.getvch();
// Trim off sign byte if present
if (vchTmp.size() >= 2 && vchTmp.end()[-1] == 0 && vchTmp.end()[-2] >= 0x80)
vchTmp.erase(vchTmp.end()-1);
// Restore leading zeros
int nLeadingZeros = 0;
for (const char* p = psz; *p == pszBase58[0]; p++)
nLeadingZeros++;
vchRet.assign(nLeadingZeros + vchTmp.size(), 0);
// Convert little endian data to big endian
reverse_copy(vchTmp.begin(), vchTmp.end(), vchRet.end() - vchTmp.size());
return true;
}
// Decode a base58-encoded string str into byte vector vchRet
// returns true if decoding is successful
inline bool DecodeBase58(const std::string& str, std::vector<unsigned char>& vchRet)
{
return DecodeBase58(str.c_str(), vchRet);
}
// Encode a byte vector to a base58-encoded string, including checksum
inline std::string EncodeBase58Check(const std::vector<unsigned char>& vchIn)
{
// add 4-byte hash check to the end
std::vector<unsigned char> vch(vchIn);
uint256 hash = Hash(vch.begin(), vch.end());
vch.insert(vch.end(), (unsigned char*)&hash, (unsigned char*)&hash + 4);
return EncodeBase58(vch);
}
// Decode a base58-encoded string psz that includes a checksum, into byte vector vchRet
// returns true if decoding is successful
inline bool DecodeBase58Check(const char* psz, std::vector<unsigned char>& vchRet)
{
if (!DecodeBase58(psz, vchRet))
return false;
if (vchRet.size() < 4)
{
vchRet.clear();
return false;
}
uint256 hash = Hash(vchRet.begin(), vchRet.end()-4);
if (memcmp(&hash, &vchRet.end()[-4], 4) != 0)
{
vchRet.clear();
return false;
}
vchRet.resize(vchRet.size()-4);
return true;
}
// Decode a base58-encoded string str that includes a checksum, into byte vector vchRet
// returns true if decoding is successful
inline bool DecodeBase58Check(const std::string& str, std::vector<unsigned char>& vchRet)
{
return DecodeBase58Check(str.c_str(), vchRet);
}
/** Base class for all base58-encoded data */
class CBase58Data
{
protected:
// the version byte
unsigned char nVersion;
// the actually encoded data
std::vector<unsigned char> vchData;
CBase58Data()
{
nVersion = 0;
vchData.clear();
}
~CBase58Data()
{
// zero the memory, as it may contain sensitive data
if (!vchData.empty())
memset(&vchData[0], 0, vchData.size());
}
void SetData(int nVersionIn, const void* pdata, size_t nSize)
{
nVersion = nVersionIn;
vchData.resize(nSize);
if (!vchData.empty())
memcpy(&vchData[0], pdata, nSize);
}
void SetData(int nVersionIn, const unsigned char *pbegin, const unsigned char *pend)
{
SetData(nVersionIn, (void*)pbegin, pend - pbegin);
}
public:
bool SetString(const char* psz)
{
std::vector<unsigned char> vchTemp;
DecodeBase58Check(psz, vchTemp);
if (vchTemp.empty())
{
vchData.clear();
nVersion = 0;
return false;
}
nVersion = vchTemp[0];
vchData.resize(vchTemp.size() - 1);
if (!vchData.empty())
memcpy(&vchData[0], &vchTemp[1], vchData.size());
memset(&vchTemp[0], 0, vchTemp.size());
return true;
}
bool SetString(const std::string& str)
{
return SetString(str.c_str());
}
std::string ToString() const
{
std::vector<unsigned char> vch(1, nVersion);
vch.insert(vch.end(), vchData.begin(), vchData.end());
return EncodeBase58Check(vch);
}
int CompareTo(const CBase58Data& b58) const
{
if (nVersion < b58.nVersion) return -1;
if (nVersion > b58.nVersion) return 1;
if (vchData < b58.vchData) return -1;
if (vchData > b58.vchData) return 1;
return 0;
}
bool operator==(const CBase58Data& b58) const { return CompareTo(b58) == 0; }
bool operator<=(const CBase58Data& b58) const { return CompareTo(b58) <= 0; }
bool operator>=(const CBase58Data& b58) const { return CompareTo(b58) >= 0; }
bool operator< (const CBase58Data& b58) const { return CompareTo(b58) < 0; }
bool operator> (const CBase58Data& b58) const { return CompareTo(b58) > 0; }
};
/** base58-encoded Bitcoin addresses.
* Public-key-hash-addresses have version 0 (or 111 testnet).
* The data vector contains RIPEMD160(SHA256(pubkey)), where pubkey is the serialized public key.
* Script-hash-addresses have version 5 (or 196 testnet).
* The data vector contains RIPEMD160(SHA256(cscript)), where cscript is the serialized redemption script.
*/
class CBitcoinAddress;
class CBitcoinAddressVisitor : public boost::static_visitor<bool>
{
private:
CBitcoinAddress *addr;
public:
CBitcoinAddressVisitor(CBitcoinAddress *addrIn) : addr(addrIn) { }
bool operator()(const CKeyID &id) const;
bool operator()(const CScriptID &id) const;
bool operator()(const CNoDestination &no) const;
};
class CBitcoinAddress : public CBase58Data
{
public:
enum
{
PUBKEY_ADDRESS = 15,
SCRIPT_ADDRESS = 5,
PUBKEY_ADDRESS_TEST = 111,
SCRIPT_ADDRESS_TEST = 196,
};
bool Set(const CKeyID &id) {
SetData(fTestNet ? PUBKEY_ADDRESS_TEST : PUBKEY_ADDRESS, &id, 20);
return true;
}
bool Set(const CScriptID &id) {
SetData(fTestNet ? SCRIPT_ADDRESS_TEST : SCRIPT_ADDRESS, &id, 20);
return true;
}
bool Set(const CTxDestination &dest)
{
return boost::apply_visitor(CBitcoinAddressVisitor(this), dest);
}
bool IsValid() const
{
unsigned int nExpectedSize = 20;
bool fExpectTestNet = false;
switch(nVersion)
{
case PUBKEY_ADDRESS:
nExpectedSize = 20; // Hash of public key
fExpectTestNet = false;
break;
case SCRIPT_ADDRESS:
nExpectedSize = 20; // Hash of CScript
fExpectTestNet = false;
break;
case PUBKEY_ADDRESS_TEST:
nExpectedSize = 20;
fExpectTestNet = true;
break;
case SCRIPT_ADDRESS_TEST:
nExpectedSize = 20;
fExpectTestNet = true;
break;
default:
return false;
}
return fExpectTestNet == fTestNet && vchData.size() == nExpectedSize;
}
CBitcoinAddress()
{
}
CBitcoinAddress(const CTxDestination &dest)
{
Set(dest);
}
CBitcoinAddress(const std::string& strAddress)
{
SetString(strAddress);
}
CBitcoinAddress(const char* pszAddress)
{
SetString(pszAddress);
}
CTxDestination Get() const {
if (!IsValid())
return CNoDestination();
switch (nVersion) {
case PUBKEY_ADDRESS:
case PUBKEY_ADDRESS_TEST: {
uint160 id;
memcpy(&id, &vchData[0], 20);
return CKeyID(id);
}
case SCRIPT_ADDRESS:
case SCRIPT_ADDRESS_TEST: {
uint160 id;
memcpy(&id, &vchData[0], 20);
return CScriptID(id);
}
}
return CNoDestination();
}
bool GetKeyID(CKeyID &keyID) const {
if (!IsValid())
return false;
switch (nVersion) {
case PUBKEY_ADDRESS:
case PUBKEY_ADDRESS_TEST: {
uint160 id;
memcpy(&id, &vchData[0], 20);
keyID = CKeyID(id);
return true;
}
default: return false;
}
}
bool IsScript() const {
if (!IsValid())
return false;
switch (nVersion) {
case SCRIPT_ADDRESS:
case SCRIPT_ADDRESS_TEST: {
return true;
}
default: return false;
}
}
};
bool inline CBitcoinAddressVisitor::operator()(const CKeyID &id) const { return addr->Set(id); }
bool inline CBitcoinAddressVisitor::operator()(const CScriptID &id) const { return addr->Set(id); }
bool inline CBitcoinAddressVisitor::operator()(const CNoDestination &id) const { return false; }
/** A base58-encoded secret key */
class CBitcoinSecret : public CBase58Data
{
public:
enum
{
PRIVKEY_ADDRESS = CBitcoinAddress::PUBKEY_ADDRESS + 128,
PRIVKEY_ADDRESS_TEST = CBitcoinAddress::PUBKEY_ADDRESS_TEST + 128,
};
void SetSecret(const CSecret& vchSecret, bool fCompressed)
{
assert(vchSecret.size() == 32);
SetData(fTestNet ? PRIVKEY_ADDRESS_TEST : PRIVKEY_ADDRESS, &vchSecret[0], vchSecret.size());
if (fCompressed)
vchData.push_back(1);
}
CSecret GetSecret(bool &fCompressedOut)
{
CSecret vchSecret;
vchSecret.resize(32);
memcpy(&vchSecret[0], &vchData[0], 32);
fCompressedOut = vchData.size() == 33;
return vchSecret;
}
bool IsValid() const
{
bool fExpectTestNet = false;
switch(nVersion)
{
case PRIVKEY_ADDRESS:
break;
case PRIVKEY_ADDRESS_TEST:
fExpectTestNet = true;
break;
default:
return false;
}
return fExpectTestNet == fTestNet && (vchData.size() == 32 || (vchData.size() == 33 && vchData[32] == 1));
}
bool SetString(const char* pszSecret)
{
return CBase58Data::SetString(pszSecret) && IsValid();
}
bool SetString(const std::string& strSecret)
{
return SetString(strSecret.c_str());
}
CBitcoinSecret(const CSecret& vchSecret, bool fCompressed)
{
SetSecret(vchSecret, fCompressed);
}
CBitcoinSecret()
{
}
};
#endif
| goodwillcoin/GoodwillCoin | src/base58.h | C | mit | 13,279 |
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="blog_template.css">
<title>Blog Template</title>
</head>
<header>
<h1>Week 3: Pairing and Feedback</h1>
</header>
<body>
<section>
<article>
<h2>My Thoughts on Pairing</h2>
<img id="capture" src="http://blogs.atlassian.com/developer/pairon.jpg"></a>
<p>
Pairing is writing source code of a program with a team consisting of two individuals. I found it to be fun working with another person and I find it very beneficial when solving challenges. It definately makes coding feel more social. Furthermore, pairing feels more rewarding. I believe this was due to the sense of "hyperdrive" while writing the code because of the ability to bounce ideas off one another to achieve desired results in a timely fashion. I did not find my experiences to be frustrating at all but I know it could if your partner appears to be stubborn or reserved.
</p>
</article>
<article>
<h2>Feeling the Feedback</h2>
<p>
As of this moment, I have not received any feedback. However, I have written feedback to numerous individuals. Writing feedback was enjoyable. It helped me really analyze my classmates on a personal and intellectual scale. The hardest part about writing feedback is the wording. You want to make sure you write clear, kind, and actionable so your partner can improve their skillset. Feedback is important because it helps expose faults and guide an individuals development. Giving strong feedback is important for leadership (my favorite value) because it helps others achieve their own success.
</p>
</article>
</section>
</body> | kaiprt/kaiprt.github.io | blog/week3_cultural_blog.html | HTML | mit | 1,764 |
---
layout: post
title: "2014-12-26-Learning-Scala-Ch2"
description: ""
category: scala
tags: [programming]
---
This post summarises notes and/or exercise solutions of _Chapter 2 Working With Data: Literals, Values, Variables, and Types_ of [Learning Scala](http://chimera.labs.oreilly.com/books/1234000001798/index.html) by Jason Swartz. More complete solutions can be found [HERE](https://github.com/swartzrock/LearningScalaMaterials). Scala code is originally executed in a Eclipse Scala worksheet.
#### Notes
##### string interpolation and format
{% highlight r %}
val approx = 355/113f
println("Pi, using 355/113, is about " + approx + ".")
println(s"Pi, using 355/113, is about $approx.")
f"I wrote a new $approx%.3s today" // show 3.1
f"I wrote a new $approx%.4f today" // show 3.1416
val item = "apple"
s"How do you like them ${item}s"
{% endhighlight %}
##### regular expressions, see more [here](http://www.javacodegeeks.com/2011/10/scala-tutorial-regular-expressions.html)
{% highlight r %}
"Froggy went a' courting" matches ".* courting" // true
"milk, tea, muck".replaceAll("m[^ ]+k", "coffee") // coffee, tea, coffee
"milk, tea, muck" replaceFirst ("m[^ ]+k", "coffee") // coffee, tea, muck
val input = "Enjoying this apple 3.14159 times today"
val pattern = """.* apple ([\d.]+) times .*""".r
val pattern(amountText) = input
val amount = amountText.toDouble
{% endhighlight %}
##### relation among Scala types
{% highlight r %}
Numeric Types
<-- AnyVal <-- Char
Boolean
Any <-- Nothing
Collections
<-- AnyRef <-- Classes <-- Null
String
{% endhighlight %}
- The Unit type is unlike the other core types here (numeric and non-numeric) in that instead of denoting a type of data it denotes the lack of data.
- `&` and `&&`? - `|` (or `||`) don't evaluate the second argument if the first is sufficient
- Scala doesn't support automatic conversions to booleans eg non-null strings is not true, 0 is not false
##### type operations
{% highlight r %}
5.asInstanceOf[Long]
(7.0 / 5).getClass /* double */
"A".hashCode
20.toByte
47.toFloat
(3.0 / 4.0) toString
{% endhighlight %}
##### tuples
{% highlight r %}
val info = (5, "Korben", true)
val red = "red" -> "0xff0000"
val reversed = red._2 -> red._1
{% endhighlight %}
#### Exercises
##### 1. Write a new centigrade-to-fahrenheit conversion (using the formula `(x * 9/5) + 32`), saving each step of the conversion into separate values. What do you expect the type of each value will be?
{% highlight r %}
val celTemp = 22.5
val tempVal1 = celTemp * 9/5
val fahTemp = tempVal1 + 32
{% endhighlight %}
##### 2. Modify the centigrade-to-fahrenheit formula to return an integer instead of a floating-point number.
{% highlight r %}
fahTemp.toInt
{% endhighlight %}
##### 3. Using the input value 2.7255, generate the string **You owe $2.73 dollars**. Is this doable with string interpolation?
{% highlight r %}
val dol = 2.7255
s"You owe $dol dollars."
f"You owe $dol%.2f dollars."
{% endhighlight %}
##### 4. Is there a simpler way to write the following?
{% highlight r %}
val flag = false
val longResult = (flag == false)
val simpleResult = (false == false)
{% endhighlight %}
##### 5. Convert the number 128 to a Char, a String, a Double, and then back to an Int. Do you expect the original amount to be retained? Do you need any special conversion functions for this?
{% highlight r %}
val num = 128
val c = num.toChar
val s = c.toString
val d = s(0).toDouble // note not s.toDouble
val i = d.toInt
{% endhighlight %}
##### 6. Using the input string **Frank,123 Main,925-555-1943,95122** and regular expression matching, retrieve the telephone number. Can you convert each part of the telephone number to its own integer value? How would you store this in a tuple?
{% highlight r %}
val frank = "Frank,123 Main,925-555-1943,95122"
val numPattern = """.*,(\d{3})-(\d{3})-(\d{4}),.*""".r
val numPattern(num1,num2,num3) = frank
{% endhighlight %}
| jaehyeon-kim/jaehyeon-kim.github.io | _posts/2014-12-26-Learning-Scala-Ch2.md | Markdown | mit | 4,075 |
<HTML><HEAD>
<TITLE>Review for Winslow Boy, The (1999)</TITLE>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1 ALIGN="CENTER" CLASS="title"><A HREF="/Title?0155388">Winslow Boy, The (1999)</A></H1><H3 ALIGN=CENTER>reviewed by<BR><A HREF="/ReviewsBy?Kleszczewski,+Nicholas">Kleszczewski, Nicholas</A></H3><HR WIDTH="40%" SIZE="4">
<PRE>The Winslow Boy</PRE>
<P>Hitchcock would never claim to be an actor's director. His emphasis was in
letting the casting do the work, and was far more interested in the
structure of the film, with each of the actors being used as pawns. </P>
<P>David Mamet once wrote that his style is built on the same premise. Never
mind with emoting or getting into character, or finding the person's
interior motivation. Whooey. Come up with an ingenius screenplay, an
intricate puzzle, and cast actors who you trust will be believable from the
get-go. </P>
<P>To say David Mamet's name is to conjure up some of his great works. Not
only is he an accomplished playwright (_Speed-the-Plow_,_GlenGarry Glen
Ross_) and screenwriter (_The Untouchables_) but he has two movies in his
repertoire that would have made Hitchcock proud. _House of Games_ and last
year's _The Spanish Prisoner_. If you haven't seen them yet, do so.</P>
<P>So it is with this anticipation that I went to see _The Winslow Boy_, his
latest. It is altogether unique that it is the first film I've known in a
long, long, while that is rated G, but the film is really for adults. The
foul-mouthed characters of his R-rated films must be giggling somewhere.</P>
<P>Want a simple plot? Pre-teen Ronnie Winslow has just been expelled from
military school, with accusations that he has stolen a postal order. He
claims innocence. His father believes in him, and spends his estate's
riches to prove so. That's _it_.</P>
<P>Want a cruel joke? This film has all the components of a Hitchcock film,
only without Hitchcock. You have the premise of the wrongly accused, only
to not follow it up with who actually did it. We don't even see the too
much of the courtroom, and the triumphant climax is performed off-screen.</P>
<P>Instead, Mamet is far more concerned with the tensions within the family.
The patriarch (played effortlessly by Nigel Hawthorne), is quirky and
dignified, tough, caring, but a little reckless. So the daughter (Rebecca
Pidgeon) has no dowry for her engagement. So the elder son (Matthew
Pidgeon) can't go to college. </P>
<P>Okay, fine. But if false expectations can ruin a film, it certainly does so
here. The film is passable, but I long for the bite of the earlier Mamet.
This has nothing to do with the G rating. It has to do with showing scenes
that I expected to see.</P>
<P>Back to the actors-as-pawns directing methodology. Such a style works as
far as the actors themselves are well cast. Hawthorne--brilliant. Jeremy
Northam--fabulous. Rebecca Pidgeon--huh? </P>
<P>The poor girl just plain can't act. It would have been better if her words
were annunciated by a monotone voice-emulator than for her to say her lines.
I gave her the benefit of the doubt in _Prisoner_, only because I just
didn't know who she was. But here she is, at the beginnings of the suffrage
movement, angry that she cannot marry, and she has the same, pause,
utterance-of-lines-and-no-more schtick.</P>
<P>I can enjoy period pieces as the next guy, and I can appreciate it when the
director goes out on a limb to try something new. However, _The Winslow
Boy_ bored me.</P>
<PRE>Nick Scale (1 to 10): 6</PRE>
<HR><P CLASS=flush><SMALL>The review above was posted to the
<A HREF="news:rec.arts.movies.reviews">rec.arts.movies.reviews</A> newsgroup (<A HREF="news:de.rec.film.kritiken">de.rec.film.kritiken</A> for German reviews).<BR>
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.<BR>
Please direct comments/criticisms of the review to relevant newsgroups.<BR>
Broken URLs inthe reviews are the responsibility of the author.<BR>
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
</SMALL></P>
<P ALIGN=CENTER>Related links: <A HREF="/Reviews/">index of all rec.arts.movies.reviews reviews</A></P>
</P></BODY></HTML>
| xianjunzhengbackup/code | data science/machine_learning_for_the_web/chapter_4/movie/18430.html | HTML | mit | 4,447 |
module Merb::RenderMixin
# So we can do raise TemplateNotFound
include Merb::ControllerExceptions
# ==== Parameters
# base<Module>:: Module that is including RenderMixin (probably a controller)
def self.included(base)
base.class_eval do
class_inheritable_accessor :_layout, :_cached_templates
end
end
# Render the specified item, with the specified options.
#
# ==== Parameters
# thing<String, Symbol, nil>::
# The thing to render. This will default to the current action
# opts<Hash>:: An options hash (see below)
#
# ==== Options (opts)
# :format<Symbol>:: A registered mime-type format
# :template<String>::
# The path to the template relative to the template root
# :status<~to_i>::
# The status to send to the client. Typically, this would be an integer
# (200), or a Merb status code (Accepted)
# :layout<~to_s>::
# A layout to use instead of the default. This should be relative to the
# layout root. By default, the layout will be either the controller_name or
# application. If you want to use an alternative content-type than the one
# that the base template was rendered as, you will need to do :layout =>
# "foo.#{content_type}" (i.e. "foo.json")
#
# ==== Returns
# String:: The rendered template, including layout, if appropriate.
#
# ==== Raises
# TemplateNotFound:: There is no template for the specified location.
#
# ==== Alternatives
# If you pass a Hash as the first parameter, it will be moved to opts and
# "thing" will be the current action
#---
# @public
def render(thing = nil, opts = {})
# render :format => :xml means render nil, :format => :xml
opts, thing = thing, nil if thing.is_a?(Hash)
# If you don't specify a thing to render, assume they want to render the current action
thing ||= action_name.to_sym
# Content negotiation
opts[:format] ? (self.content_type = opts[:format]) : content_type
# Handle options (:status)
_handle_options!(opts)
# Do we have a template to try to render?
if thing.is_a?(Symbol) || opts[:template]
template_method, template_location = _template_for(thing, content_type, controller_name, opts)
# Raise an error if there's no template
raise TemplateNotFound, "No template found at #{template_location}.*" \
unless template_method && self.respond_to?(template_method)
# Call the method in question and throw the content for later consumption by the layout
throw_content(:for_layout, self.send(template_method))
# Do we have a string to render?
elsif thing.is_a?(String)
# Throw it for later consumption by the layout
throw_content(:for_layout, thing)
end
# If we find a layout, use it. Otherwise, just render the content thrown for layout.
layout = opts[:layout] != false && _get_layout(opts[:layout])
layout ? send(layout) : catch_content(:for_layout)
end
# Renders an object using to registered transform method based on the
# negotiated content-type, if a template does not exist. For instance, if the
# content-type is :json, Merb will first look for current_action.json.*.
# Failing that, it will run object.to_json.
#
# ==== Parameter
# object<Object>::
# An object that responds_to? the transform method registered for the
# negotiated mime-type.
# thing<String, Symbol>::
# The thing to attempt to render via #render before calling the transform
# method on the object. Defaults to nil.
# opts<Hash>:: An options hash that will be passed on to #render
#
# ==== Returns
# String::
# The rendered template or if no template is found, the transformed object.
#
# ==== Raises
# NotAcceptable::
# If there is no transform method for the specified mime-type or the object
# does not respond to the transform method.
#
# ==== Alternatives
# A string in the second parameter will be interpreted as a template:
# display @object, "path/to/foo"
# #=> display @object, nil, :template => "path/to/foo"
#
# A hash in the second parameters will be interpreted as opts:
# display @object, :layout => "zoo"
# #=> display @object, nil, :layout => "zoo"
#
# ==== Note
# The transformed object will not be used in a layout unless a :layout is
# explicitly passed in the opts.
def display(object, thing = nil, opts = {})
# display @object, "path/to/foo" means display @object, nil, :template => "path/to/foo"
# display @object, :template => "path/to/foo" means display @object, nil, :template => "path/to/foo"
opts[:template], thing = thing, nil if thing.is_a?(String) || thing.is_a?(Hash)
# Try to render without the object
render(thing || action_name.to_sym, opts)
# If the render fails (i.e. a template was not found)
rescue TemplateNotFound
# Figure out what to transform and raise NotAcceptable unless there's a transform method assigned
transform = Merb.mime_transform_method(content_type)
raise NotAcceptable unless transform && object.respond_to?(transform)
# Throw the transformed object for later consumption by the layout
throw_content(:for_layout, object.send(transform))
# Only use a layout if one was specified
if opts[:layout]
# Look for the layout under the default layout directly. If it's not found, reraise
# the TemplateNotFound error
template = _template_location(opts[:layout], layout.index(".") ? content_type : nil, "layout")
layout = _template_for(_template_root / template) ||
(raise TemplateNotFound, "No layout found at #{_template_root / template}.*")
# If the layout was found, call it
send(layout)
# Otherwise, just render the transformed object
else
catch_content(:for_layout)
end
end
# Render a partial template.
#
# ==== Parameters
# template<~to_s>::
# The path to the template, relative to the current controller or the
# template root. If the template contains a "/", Merb will search for it
# relative to the template root; otherwise, Merb will search for it
# relative to the current controller.
# opts<Hash>:: A hash of options (see below)
#
# ==== Options (opts)
# :with<Object, Array>::
# An object or an array of objects that will be passed into the partial.
# :as<~to_sym>:: The local name of the :with Object inside of the partial.
# :format<Symbol>:: The mime format that you want the partial to be in (:js, :html, etc.)
# others::
# A Hash object names and values that will be the local names and values
# inside the partial.
#
# ==== Example
# partial :foo, :hello => @object
#
# The "_foo" partial will be called, relative to the current controller,
# with a local variable of +hello+ inside of it, assigned to @object.
def partial(template, opts={})
# partial :foo becomes "#{controller_name}/_foo"
# partial "foo/bar" becomes "foo/_bar"
template = template.to_s
kontroller = (m = template.match(/.*(?=\/)/)) ? m[0] : controller_name
template = "_#{File.basename(template)}"
template_method, template_location = _template_for(template, opts.delete(:format) || content_type, kontroller)
(@_old_partial_locals ||= []).push @_merb_partial_locals
if opts.key?(:with)
with = opts.delete(:with)
as = opts.delete(:as) || template_location.match(%r[.*/_([^\.]*)])[1]
@_merb_partial_locals = opts
sent_template = [with].flatten.map do |temp|
@_merb_partial_locals[as.to_sym] = temp
send(template_method)
end.join
else
@_merb_partial_locals = opts
sent_template = send(template_method)
end
@_merb_partial_locals = @_old_partial_locals.pop
sent_template
end
# Take the options hash and handle it as appropriate.
#
# ==== Parameters
# opts<Hash>:: The options hash that was passed into render.
#
# ==== Options
# :status<~to_i>::
# The status of the response will be set to opts[:status].to_i
#
# ==== Returns
# Hash:: The options hash that was passed in.
def _handle_options!(opts)
self.status = opts[:status].to_i if opts[:status]
opts
end
# Get the layout that should be used. The content-type will be appended to
# the layout unless the layout already contains a "." in it.
#
# If no layout was passed in, this method will look for one with the same
# name as the controller, and finally one in "application.#{content_type}".
#
# ==== Parameters
# layout<~to_s>:: A layout, relative to the layout root. Defaults to nil.
#
# ==== Returns
# String:: The method name that corresponds to the found layout.
#
# ==== Raises
# TemplateNotFound::
# If a layout was specified (either via layout in the class or by passing
# one in to this method), and not found. No error will be raised if no
# layout was specified, and the default layouts were not found.
def _get_layout(layout = nil)
if _layout && !layout
layout = _layout.instance_of?(Symbol) && self.respond_to?(_layout, true) ? send(_layout) : _layout
end
layout = layout.to_s if layout
# If a layout was provided, throw an error if it's not found
if layout
template_method, template_location = _template_for(layout, layout.index(".") ? nil : content_type, "layout")
raise TemplateNotFound, "No layout found at #{template_location}" unless template_method
template_method
# If a layout was not provided, try the default locations
else
template, location = _template_for(controller_name, content_type, "layout")
template, location = _template_for("application", content_type, "layout") unless template
template
end
end
# Iterate over the template roots in reverse order, and return the template
# and template location of the first match.
#
# ==== Parameters
# thing<Object>:: The controller action.
# content_type<~to_s>:: The content type. Defaults to nil.
# controller<~to_s>:: The name of the controller. Defaults to nil.
#
# ==== Options (opts)
# :template<String>::
# The location of the template to use. Defaults to whatever matches this
# thing, content_type and controller.
#
# ==== Returns
# Array[Symbol, String]::
# A pair consisting of the template method and location.
def _template_for(thing, content_type, controller=nil, opts={})
template_method = nil
template_location = nil
self.class._template_roots.reverse_each do |root, template_location|
template_location = root / (opts[:template] || self.send(template_location, thing, content_type, controller))
template_method = Merb::Template.template_for(template_location)
break if template_method && self.respond_to?(template_method)
end
[template_method, template_location]
end
# Called in templates to get at content thrown in another template. The
# results of rendering a template are automatically thrown into :for_layout,
# so catch_content or catch_content(:for_layout) can be used inside layouts
# to get the content rendered by the action template.
#
# ==== Parameters
# obj<Object>:: The key in the thrown_content hash. Defaults to :for_layout.
#---
# @public
def catch_content(obj = :for_layout)
@_caught_content[obj]
end
# Called in templates to store up content for later use. Takes a string
# and/or a block. First, the string is evaluated, and then the block is
# captured using the capture() helper provided by the template languages. The
# two are concatenated together.
#
# ==== Parameters
# obj<Object>:: The key in the thrown_content hash.
# string<String>:: Textual content. Defaults to nil.
# &block:: A block to be evaluated and concatenated to string.
#
# ==== Raises
# ArgumentError:: Neither string nor block given.
#
# ==== Example
# throw_content(:foo, "Foo")
# catch_content(:foo) #=> "Foo"
#---
# @public
def throw_content(obj, string = nil, &block)
unless string || block_given?
raise ArgumentError, "You must pass a block or a string into throw_content"
end
@_caught_content[obj] = string.to_s << (block_given? ? capture(&block) : "")
end
end
| kneath/greed | framework/merb-core/lib/merb-core/controller/mixins/render.rb | Ruby | mit | 12,376 |

[](https://travis-ci.org/nlohmann/json)
[](https://ci.appveyor.com/project/nlohmann/json)
[](https://coveralls.io/r/nlohmann/json)
[](http://melpon.org/wandbox/permlink/GnGKwji06WeVonlI)
[](http://nlohmann.github.io/json)
[](https://raw.githubusercontent.com/nlohmann/json/master/LICENSE.MIT)
[](https://github.com/nlohmann/json/releases)
[](http://github.com/nlohmann/json/issues)
## Design goals
There are myriads of [JSON](http://json.org) libraries out there, and each may even have its reason to exist. Our class had these design goals:
- **Intuitive syntax**. In languages such as Python, JSON feels like a first class data type. We used all the operator magic of modern C++ to achieve the same feeling in your code. Check out the [examples below](#examples) and you know, what I mean.
- **Trivial integration**. Our whole code consists of a single header file `json.hpp`. That's it. No library, no subproject, no dependencies, no complex build system. The class is written in vanilla C++11. All in all, everything should require no adjustment of your compiler flags or project settings.
- **Serious testing**. Our class is heavily [unit-tested](https://github.com/nlohmann/json/blob/master/test/json_unit.cc) and covers [100%](https://coveralls.io/r/nlohmann/json) of the code, including all exceptional behavior. Furthermore, we checked with [Valgrind](http://valgrind.org) that there are no memory leaks.
Other aspects were not so important to us:
- **Memory efficiency**. Each JSON object has an overhead of one pointer (the maximal size of a union) and one enumeration element (1 byte). The default generalization uses the following C++ data types: `std::string` for strings, `int64_t` or `double` for numbers, `std::map` for objects, `std::vector` for arrays, and `bool` for Booleans. However, you can template the generalized class `basic_json` to your needs.
- **Speed**. We currently implement the parser as naive [recursive descent parser](http://en.wikipedia.org/wiki/Recursive_descent_parser) with hand coded string handling. It is fast enough, but a [LALR-parser](http://en.wikipedia.org/wiki/LALR_parser) with a decent regular expression processor should be even faster (but would consist of more files which makes the integration harder).
## Integration
The single required source, file `json.hpp` is in the `src` directory or [released here](https://github.com/nlohmann/json/releases). All you need to do is add
```cpp
#include "json.hpp"
// for convenience
using json = nlohmann::json;
```
to the files you want to use JSON objects. That's it. Do not forget to set the necessary switches to enable C++11 (e.g., `-std=c++11` for GCC and Clang).
## Supported compilers
Though it's 2015 already, the support for C++11 is still a bit sparse. Currently, the following compilers are known to work:
- GCC 4.9 - 5.2
- Clang 3.4 - 3.7
- Microsoft Visual C++ 14.0 RC
Note using GCC 4.8, the unit tests cannot be compiled due to a [bug in the preprocessor](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55971).
I would be happy to learn about other compilers/versions.
## Examples
Here are some examples to give you an idea how to use the class.
Assume you want to create the JSON object
```json
{
"pi": 3.141,
"happy": true,
"name": "Niels",
"nothing": null,
"answer": {
"everything": 42
},
"list": [1, 0, 2],
"object": {
"currency": "USD",
"value": 42.99
}
}
```
With the JSON class, you could write:
```cpp
// create an empty structure (null)
json j;
// add a number that is stored as double (note the implicit conversion of j to an object)
j["pi"] = 3.141;
// add a Boolean that is stored as bool
j["happy"] = true;
// add a string that is stored as std::string
j["name"] = "Niels";
// add another null object by passing nullptr
j["nothing"] = nullptr;
// add an object inside the object
j["answer"]["everything"] = 42;
// add an array that is stored as std::vector (using an initializer list)
j["list"] = { 1, 0, 2 };
// add another object (using an initializer list of pairs)
j["object"] = { {"currency", "USD"}, {"value", 42.99} };
// instead, you could also write (which looks very similar to the JSON above)
json j2 = {
{"pi", 3.141},
{"happy", true},
{"name", "Niels"},
{"nothing", nullptr},
{"answer", {
{"everything", 42}
}},
{"list", {1, 0, 2}},
{"object", {
{"currency", "USD"},
{"value", 42.99}
}}
};
```
Note that in all these cases, you never need to "tell" the compiler which JSON value you want to use. If you want to be explicit or express some edge cases, the functions `json::array` and `json::object` will help:
```cpp
// a way to express the empty array []
json empty_array_explicit = json::array();
// ways to express the empty object {}
json empty_object_implicit = json({});
json empty_object_explicit = json::object();
// a way to express an _array_ of key/value pairs [["currency", "USD"], ["value", 42.99]]
json array_not_object = { json::array({"currency", "USD"}), json::array({"value", 42.99}) };
```
### Serialization / Deserialization
You can create an object (deserialization) by appending `_json` to a string literal:
```cpp
// create object from string literal
json j = "{ \"happy\": true, \"pi\": 3.141 }"_json;
// or even nicer (thanks http://isocpp.org/blog/2015/01/json-for-modern-cpp)
auto j2 = R"(
{
"happy": true,
"pi": 3.141
}
)"_json;
// or explicitly
auto j3 = json::parse("{ \"happy\": true, \"pi\": 3.141 }");
```
You can also get a string representation (serialize):
```cpp
// explicit conversion to string
std::string s = j.dump(); // {\"happy\":true,\"pi\":3.141}
// serialization with pretty printing
// pass in the amount of spaces to indent
std::cout << j.dump(4) << std::endl;
// {
// "happy": true,
// "pi": 3.141
// }
```
You can also use streams to serialize and deserialize:
```cpp
// deserialize from standard input
json j;
std::cin >> j;
// serialize to standard output
std::cout << j;
// the setw manipulator was overloaded to set the indentation for pretty printing
std::cout << std::setw(4) << j << std::endl;
```
These operators work for any subclasses of `std::istream` or `std::ostream`.
### STL-like access
We designed the JSON class to behave just like an STL container. In fact, it satisfies the [**ReversibleContainer**](http://en.cppreference.com/w/cpp/concept/ReversibleContainer) requirement.
```cpp
// create an array using push_back
json j;
j.push_back("foo");
j.push_back(1);
j.push_back(true);
// iterate the array
for (json::iterator it = j.begin(); it != j.end(); ++it) {
std::cout << *it << '\n';
}
// range-based for
for (auto element : j) {
std::cout << element << '\n';
}
// getter/setter
const std::string tmp = j[0];
j[1] = 42;
bool foo = j.at(2);
// other stuff
j.size(); // 3 entries
j.empty(); // false
j.type(); // json::value_t::array
j.clear(); // the array is empty again
// convenience type checkers
j.is_null();
j.is_boolean();
j.is_number();
j.is_object();
j.is_array();
j.is_string();
// comparison
j == "[\"foo\", 1, true]"_json; // true
// create an object
json o;
o["foo"] = 23;
o["bar"] = false;
o["baz"] = 3.141;
// special iterator member functions for objects
for (json::iterator it = o.begin(); it != o.end(); ++it) {
std::cout << it.key() << " : " << it.value() << "\n";
}
// find an entry
if (o.find("foo") != o.end()) {
// there is an entry with key "foo"
}
// or simpler using count()
int foo_present = o.count("foo"); // 1
int fob_present = o.count("fob"); // 0
// delete an entry
o.erase("foo");
```
### Conversion from STL containers
Any sequence container (`std::array`, `std::vector`, `std::deque`, `std::forward_list`, `std::list`) whose values can be used to construct JSON types (e.g., integers, floating point numbers, Booleans, string types, or again STL containers described in this section) can be used to create a JSON array. The same holds for similar associative containers (`std::set`, `std::multiset`, `std::unordered_set`, `std::unordered_multiset`), but in these cases the order of the elements of the array depends how the elements are ordered in the respective STL container.
```cpp
std::vector<int> c_vector {1, 2, 3, 4};
json j_vec(c_vector);
// [1, 2, 3, 4]
std::deque<double> c_deque {1.2, 2.3, 3.4, 5.6};
json j_deque(c_deque);
// [1.2, 2.3, 3.4, 5.6]
std::list<bool> c_list {true, true, false, true};
json j_list(c_list);
// [true, true, false, true]
std::forward_list<int64_t> c_flist {12345678909876, 23456789098765, 34567890987654, 45678909876543};
json j_flist(c_flist);
// [12345678909876, 23456789098765, 34567890987654, 45678909876543]
std::array<unsigned long, 4> c_array {{1, 2, 3, 4}};
json j_array(c_array);
// [1, 2, 3, 4]
std::set<std::string> c_set {"one", "two", "three", "four", "one"};
json j_set(c_set); // only one entry for "one" is used
// ["four", "one", "three", "two"]
std::unordered_set<std::string> c_uset {"one", "two", "three", "four", "one"};
json j_uset(c_uset); // only one entry for "one" is used
// maybe ["two", "three", "four", "one"]
std::multiset<std::string> c_mset {"one", "two", "one", "four"};
json j_mset(c_mset); // only one entry for "one" is used
// maybe ["one", "two", "four"]
std::unordered_multiset<std::string> c_umset {"one", "two", "one", "four"};
json j_umset(c_umset); // both entries for "one" are used
// maybe ["one", "two", "one", "four"]
```
Likewise, any associative key-value containers (`std::map`, `std::multimap`, `std::unordered_map`, `std::unordered_multimap`) whose keys are can construct an `std::string` and whose values can be used to construct JSON types (see examples above) can be used to to create a JSON object. Note that in case of multimaps only one key is used in the JSON object and the value depends on the internal order of the STL container.
```cpp
std::map<std::string, int> c_map { {"one", 1}, {"two", 2}, {"three", 3} };
json j_map(c_map);
// {"one": 1, "two": 2, "three": 3}
std::unordered_map<const char*, double> c_umap { {"one", 1.2}, {"two", 2.3}, {"three", 3.4} };
json j_umap(c_umap);
// {"one": 1.2, "two": 2.3, "three": 3.4}
std::multimap<std::string, bool> c_mmap { {"one", true}, {"two", true}, {"three", false}, {"three", true} };
json j_mmap(c_mmap); // only one entry for key "three" is used
// maybe {"one": true, "two": true, "three": true}
std::unordered_multimap<std::string, bool> c_ummap { {"one", true}, {"two", true}, {"three", false}, {"three", true} };
json j_ummap(c_ummap); // only one entry for key "three" is used
// maybe {"one": true, "two": true, "three": true}
```
### Implicit conversions
The type of the JSON object is determined automatically by the expression to store. Likewise, the stored value is implicitly converted.
```cpp
/// strings
std::string s1 = "Hello, world!";
json js = s1;
std::string s2 = js;
// Booleans
bool b1 = true;
json jb = b1;
bool b2 = jb;
// numbers
int i = 42;
json jn = i;
double f = jn;
// etc.
```
You can also explicitly ask for the value:
```cpp
std::string vs = js.get<std::string>();
bool vb = jb.get<bool>();
int vi = jn.get<int>();
// etc.
```
## License
<img align="right" src="http://opensource.org/trademarks/opensource/OSI-Approved-License-100x137.png">
The class is licensed under the [MIT License](http://opensource.org/licenses/MIT):
Copyright © 2013-2015 [Niels Lohmann](http://nlohmann.me)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
## Thanks
I deeply appreciate the help of the following people.
- [Teemperor](https://github.com/Teemperor) implemented CMake support and lcov integration, realized escape and Unicode handling in the string parser, and fixed the JSON serialization.
- [elliotgoodrich](https://github.com/elliotgoodrich) fixed an issue with double deletion in the iterator classes.
- [kirkshoop](https://github.com/kirkshoop) made the iterators of the class composable to other libraries.
- [wancw](https://github.com/wanwc) fixed a bug that hindered the class to compile with Clang.
- Tomas Åblad found a bug in the iterator implementation.
- [Joshua C. Randall](https://github.com/jrandall) fixed a bug in the floating-point serialization.
- [Aaron Burghardt](https://github.com/aburgh) implemented code to parse streams incrementally. Furthermore, he greatly improved the parser class by allowing the definition of a filter function to discard undesired elements while parsing.
- [Daniel Kopeček](https://github.com/dkopecek) fixed a bug in the compilation with GCC 5.0.
- [Florian Weber](https://github.com/Florianjw) fixed a bug in and improved the performance of the comparison operators.
- [Eric Cornelius](https://github.com/EricMCornelius) pointed out a bug in the handling with NaN and infinity values. He also improved the performance of the string escaping.
- [易思龙](https://github.com/likebeta) implemented a conversion from anonymous enums.
- [kepkin](https://github.com/kepkin) patiently pushed forward the support for Microsoft Visual studio.
- [gregmarr](https://github.com/gregmarr) simplified the implementation of reverse iterators.
- [Caio Luppi](https://github.com/caiovlp) fixed a bug in the Unicode handling.
- [dariomt](https://github.com/dariomt) fixed some typos in the examples.
- [Daniel Frey](https://github.com/d-frey) cleaned up some pointers and implemented exception-safe memory allocation.
- [Colin Hirsch](https://github.com/ColinH) took care of a small namespace issue.
- [Huu Nguyen](https://github.com/whoshuu) correct a variable name in the documentation.
- [Silverweed](https://github.com/silverweed) overloaded `parse()` to accept an rvalue reference.
- [dariomt](https://github.com/dariomt) fixed a subtlety in MSVC type support.
- [ZahlGraf](https://github.com/ZahlGraf) added a workaround that allows compilation using Android NDK.
- [whackashoe](https://github.com/whackashoe) replaced a function that was marked as unsafe by Visual Studio.
- [406345](https://github.com/406345) fixed two small warnings.
Thanks a lot for helping out!
## Execute unit tests
To compile and run the tests, you need to execute
```sh
$ make
$ ./json_unit "*"
===============================================================================
All tests passed (3341774 assertions in 27 test cases)
```
For more information, have a look at the file [.travis.yml](https://github.com/nlohmann/json/blob/master/.travis.yml).
| bobismijnnaam/bobetex | json-master/README.md | Markdown | mit | 16,045 |
## 0.1.0 (2016-03-13)
- Initial stable release.
| kidSk/cmpnSite | API/public/node_modules/typhonjs-ast-walker/CHANGELOG.md | Markdown | mit | 48 |
a {
outline: 0 !important;
}
.mon-app {
min-height: 100vh;
margin-top: 60px;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
}
.mon-app > div {
-webkit-box-flex: 1;
-webkit-flex: 1;
-ms-flex: 1;
flex: 1;
}
@media screen and (max-width: 700px) {
.mon-app > div {
max-width: 100%;
}
}
.mon-stared {
color: #BD362F !important;
}
.mon-stared:hover,
.mon-stared:active,
.mon-stared:focus {
text-decoration: none;
opacity: 0.6;
}
.mon-muted {
color: #3c3c3c;
text-decoration: none;
}
.mon-muted:hover,
.mon-muted:active {
color: #1b6d85;
text-decoration: none;
}
.mon-padding-title {
padding-left: 20px;
border-left: 5px solid #0b97c4;
}
.mon-disabled {
display: none !important;
}
.mon-main {
min-height: 100%;
-webkit-box-flex: 1;
-webkit-flex: 1;
-ms-flex: 1;
flex: 1;
}
@media screen and (max-width: 450px) {
.mon-main {
margin: 0 !important;
}
}
.mon-table {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
-webkit-align-content: center;
-ms-flex-line-pack: center;
align-content: center;
min-height: 100vh;
}
.mon-table > div {
margin: 0 auto;
color: #999;
}
@media screen and (min-width: 500px) {
.mon-table > div {
font-size: 5rem;
}
}
@media screen and (max-width: 500px) {
.mon-table > div {
font-size: 3rem;
}
}
.mon-star {
display: inline-block;
}
.mon-star > a {
margin: 0;
}
.mon-substitute {
font-size: 1.2rem;
}
.mon-star .mon-fadeOut {
font-size: 1.2rem;
-webkit-transform: translate(0, 30px);
-ms-transform: translate(0, 30px);
transform: translate(0, 30px);
-webkit-transition: all linear 0.2s;
transition: all linear 0.2s;
}
.mon-padding {
padding: 10px;
color: #5e5e5e;
}
.mon-bg-title {
font-size: 30px;
}
.mon-nav {
background-color: #393c40;
width: 100%;
}
.mon-nav>ul {
width: 100%;
}
.mon-nav span {
font-size: 1.5rem;
color: lightgray;
}
.mon-nav a {
color: #fff !important;
}
.mon-nav a:hover,
.mon-nav a:hover span {
color: grey !important;
}
.mon-subnav {
text-align: center;
margin-right: 20px !important;
}
.mon-user-nav {
padding: 10px 15px !important;
}
.mon-subnav img {
border-radius: 50%;
}
.mon-subnav a {
color: dimgray !important;
}
.mon-user > span:first-child {
color: #ddd;
font-size: 14px;
}
.mon-user > span {
color: #28342f;
font-size: 16px;
}
.mon-home * {
text-align: center;
}
.icon-name {
font-size: 30px;
color: #EE3B3B;
font-weight: 600;
text-shadow: 0 0 5px #EE9572;
}
/*动漫效果*/
.animated {
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
-webkit-animation-duration: 1s;
animation-duration: 1s;
}
@-webkit-keyframes fadeInUp {
0% {
opacity: 0;
-webkit-transform: translateY(20px);
transform: translateY(20px);
}
100% {
opacity: 1;
-webkit-transform: translateY(0);
transform: translateY(0);
}
}
@keyframes fadeInUp {
0% {
opacity: 0;
-webkit-transform: translateY(20px);
transform: translateY(20px);
}
100% {
opacity: 1;
-webkit-transform: translateY(0);
transform: translateY(0);
}
}
.fadeInUp {
-webkit-animation-name: fadeInUp;
animation-name: fadeInUp;
}
@-webkit-keyframes fadeIn {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@keyframes fadeIn {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
.fadeIn {
-webkit-animation-name: fadeIn;
animation-name: fadeIn;
}
@-webkit-keyframes fadeOut {
0% {
opacity: 1;
}
100% {
opacity: 0;
}
}
@keyframes fadeOut {
0% {
opacity: 1;
}
100% {
opacity: 0;
}
}
.fadeOut {
-webkit-animation-name: fadeOut;
animation-name: fadeOut;
}
@-webkit-keyframes flipInX {
0% {
-webkit-transform: perspective(800px) rotate3d(1, 0, 0, 90deg);
transform: perspective(800px) rotate3d(1, 0, 0, 90deg);
-webkit-transition-timing-function: ease-in;
transition-timing-function: ease-in;
opacity: 0;
}
40% {
-webkit-transform: perspective(800px) rotate3d(1, 0, 0, -20deg);
transform: perspective(800px) rotate3d(1, 0, 0, -20deg);
-webkit-transition-timing-function: ease-in;
transition-timing-function: ease-in;
}
60% {
-webkit-transform: perspective(800px) rotate3d(1, 0, 0, 10deg);
transform: perspective(800px) rotate3d(1, 0, 0, 10deg);
opacity: 1;
}
80% {
-webkit-transform: perspective(800px) rotate3d(1, 0, 0, -5deg);
transform: perspective(800px) rotate3d(1, 0, 0, -5deg);
}
100% {
-webkit-transform: perspective(800px);
transform: perspective(800px);
}
}
@keyframes flipInX {
0% {
-webkit-transform: perspective(800px) rotate3d(1, 0, 0, 90deg);
transform: perspective(800px) rotate3d(1, 0, 0, 90deg);
-webkit-transition-timing-function: ease-in;
transition-timing-function: ease-in;
opacity: 0;
}
40% {
-webkit-transform: perspective(800px) rotate3d(1, 0, 0, -20deg);
transform: perspective(800px) rotate3d(1, 0, 0, -20deg);
-webkit-transition-timing-function: ease-in;
transition-timing-function: ease-in;
}
60% {
-webkit-transform: perspective(800px) rotate3d(1, 0, 0, 10deg);
transform: perspective(800px) rotate3d(1, 0, 0, 10deg);
opacity: 1;
}
80% {
-webkit-transform: perspective(800px) rotate3d(1, 0, 0, -5deg);
transform: perspective(800px) rotate3d(1, 0, 0, -5deg);
}
100% {
-webkit-transform: perspective(800px);
transform: perspective(800px);
}
}
.flipInX {
-webkit-backface-visibility: visible !important;
backface-visibility: visible !important;
-webkit-animation-name: flipInX;
animation-name: flipInX;
}
@-webkit-keyframes flipOutX {
0% {
-webkit-transform: perspective(400px);
transform: perspective(400px);
}
30% {
-webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg);
transform: perspective(400px) rotate3d(1, 0, 0, -20deg);
opacity: 1;
}
100% {
-webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg);
transform: perspective(400px) rotate3d(1, 0, 0, 90deg);
opacity: 0;
}
}
@keyframes flipOutX {
0% {
-webkit-transform: perspective(400px);
transform: perspective(400px);
}
30% {
-webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg);
transform: perspective(400px) rotate3d(1, 0, 0, -20deg);
opacity: 1;
}
100% {
-webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg);
transform: perspective(400px) rotate3d(1, 0, 0, 90deg);
opacity: 0;
}
}
.flipOutX {
-webkit-animation-name: flipOutX;
animation-name: flipOutX;
-webkit-backface-visibility: visible !important;
backface-visibility: visible !important;
}
@-webkit-keyframes pulse {
0% {
opacity: 1;
}
16.666% {
opacity: 1;
}
100% {
opacity: 0;
}
}
@keyframes pulse {
0% {
opacity: 1;
}
16.666% {
opacity: 1;
}
100% {
opacity: 0;
}
}
@-webkit-keyframes shake {
0%,
100% {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
10%,
30%,
50%,
70%,
90% {
-webkit-transform: translate3d(-10px, 0, 0);
transform: translate3d(-10px, 0, 0);
}
20%,
40%,
60%,
80% {
-webkit-transform: translate3d(10px, 0, 0);
transform: translate3d(10px, 0, 0);
}
}
@keyframes shake {
0%,
100% {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
10%,
30%,
50%,
70%,
90% {
-webkit-transform: translate3d(-10px, 0, 0);
transform: translate3d(-10px, 0, 0);
}
20%,
40%,
60%,
80% {
-webkit-transform: translate3d(10px, 0, 0);
transform: translate3d(10px, 0, 0);
}
}
.shake {
-webkit-animation-name: shake;
animation-name: shake;
}
.search-btn {
color: #2C2C2C !important;
}
/* 搜索按钮样式 */
@media screen and (min-width: 450px) {
.search-btn {
margin-left: 10px;
}
}
@media screen and (max-width: 450px) {
.search-btn {
display: block;
width: 100%;
}
}
/**
* 页脚
*/
.mon-footer {
position: relative;
z-index: 100;
display: block;
background-color: #515151;
font-size: 16px;
overflow: hidden;
padding: 20px;
color: #ddd;
margin-top: 50px;
}
.mon-footer p {
font-size: 20px;
}
.mon-footer a {
color: #fff;
margin: 10px 20px 0 0;
}
.mon-footer a:hover,
.mon-footer a:focus {
color: #5e5e5e;
text-decoration: none;
}
/**
* 登陆,注册
*/
.mon-other-login {
padding: 10px 20px;
text-align: center;
}
.mon-other-login > a {
color: #999;
margin-left: 20px;
}
.mon-other-login > a:hover {
color: #111;
text-decoration: none;
}
.mon-other-login span {
font-size: 30px;
}
.form-legend {
margin-bottom: 5px;
}
.form-legend > span,
.form-change > a {
font-size: 25px;
}
.form-change {
float: right;
color: #999;
}
.form-change:hover {
-webkit-transition: all 0.3s linear;
transition: all 0.3s linear;
-webkit-transform: translateX(10px);
-ms-transform: translateX(10px);
transform: translateX(10px);
text-decoration: none;
}
.sign-form {
display: none;
}
/**
* user
*/
.mon-center {
text-align: center;
position: relative;
}
.mon-user-name {
font-size: 25px;
font-weight: 800;
color: #5e5e5e;
text-align: center;
position: relative;
}
.mon-vcard-stats {
border-top: 1px solid #ddd;
border-bottom: 1px solid #ddd;
width: 100%;
}
.mon-vcard-stats > a {
width: 33%;
padding: 10px;
text-align: center;
}
.mon-vcard-stats .mon-link {
display: inline-block;
padding: 10px 5px;
color: #00b3ee;
text-decoration: none;
font-weight: 500;
text-align: center;
position: relative;
}
.mon-link:hover {
cursor: pointer;
opacity: 0.8;
}
.mon-vcard-stats span {
display: block;
width: 100%;
font-size: 30px;
}
.mon-vcard-stats b {
color: #999;
font-weight: 800;
}
.mon-ability-list > li {
border-bottom: 1px solid #d4d4d4;
font-size: 16px;
}
.mon-ability-list span.fa {
color: #fff;
margin-right: 20px;
}
.mon-ability-list a {
color: #fff;
}
.mon-ability-list a.active {
font-weight: 800;
background-color: grey;
}
.mon-ability-list a.active span {
color: #43CD80;
}
.mon-contribute > li {
border-bottom: 1px dashed #d4d4d4;
border-left: 3px solid #5e5e5e;
}
/* 设置*/
.mon-account span {
font-size: 25px;
margin-right: 20px;
}
/* followers*/
.listgroup {
padding: 5px 10px;
background-color: #EEEED1;
margin-bottom: 10px;
position: relative;
}
.position {
line-height: 80px;
height: 80px;
font-size: 50px;
color: #5e5e5e;
}
.followers-name > a {
font-size: 30px !important;
color: #5e5e5e;
}
.followers-name > a:hover {
text-decoration: none;
}
.followers-intro {
font-size: 16px;
line-height: 25px;
}
.listgroup .follow {
position: absolute;
top: 10px;
right: 30px;
}
.follow > span {
margin-right: 10px;
}
.follow > a {
display: inline-block;
height: 20px;
min-width: 40px;
padding-left: 5px;
padding-right: 5px;
line-height: 20px;
text-align: center;
color: #fff;
background-color: #EE5C42;
}
.follow > a:hover,
.follow > a:visited,
.follow > a:focus {
text-decoration: none;
color: #d4d4d4;
opacity: 0.7;
}
/* 文章投稿 */
.mon-post-btn {
margin-top: 20px;
}
.mon-post-btn .fa {
margin-right: 5px;
}
/* 登陆 */
.mon-login span {
font-size: 30px;
margin: 20px;
}
| Toreant/monster_admin | public/css/app/app.css | CSS | mit | 12,009 |
import io
import unittest
from unittest.mock import patch
from kattis import k_password
###############################################################################
class SampleInput(unittest.TestCase):
'''Problem statement sample inputs and outputs'''
def test_sample_input_1(self):
'''Run and assert problem statement sample 1 input and output.'''
inputs = []
inputs.append('2')
inputs.append('123456 0.6666')
inputs.append('qwerty 0.3334')
inputs = '\n'.join(inputs) + '\n'
outputs = '1.3334\n'
with patch('sys.stdin', io.StringIO(inputs)) as stdin,\
patch('sys.stdout', new_callable=io.StringIO) as stdout:
k_password.main()
self.assertEqual(stdout.getvalue(), outputs)
self.assertEqual(stdin.read(), '')
def test_sample_input_2(self):
'''Run and assert problem statement sample 2 input and output.'''
inputs = []
inputs.append('3')
inputs.append('qwerty 0.5432')
inputs.append('123456 0.3334')
inputs.append('password 0.1234')
inputs = '\n'.join(inputs) + '\n'
outputs = '1.5802\n'
with patch('sys.stdin', io.StringIO(inputs)) as stdin,\
patch('sys.stdout', new_callable=io.StringIO) as stdout:
k_password.main()
self.assertEqual(stdout.getvalue(), outputs)
self.assertEqual(stdin.read(), '')
###############################################################################
if __name__ == '__main__':
unittest.main()
| ivanlyon/exercises | test/test_k_password.py | Python | mit | 1,584 |
import {assert} from 'chai';
import FlatMap from '../../lib/utils/flatmap';
describe('faltmap.FlatMap', function () {
let src = {a: 1, b: {c: {d: 1}, e: {g: 1}}};
it('should get value deep cloned default, shallow clone with isDeepClone is false', function () {
let flated = new FlatMap(src);
let deepB = flated.get('b');
let shallowB = flated.get('b', false);
assert.notEqual(src.b, deepB);
assert.deepEqual(src.b, deepB);
assert.equal(src.b.c, shallowB.c);
let deepBC = flated.get('b', new Set(['b.c']));
// 浅拷贝指定的属性
assert.equal(src.b.c, deepBC.c);
// 深拷贝其他属性
assert.notEqual(src.b.e, deepBC.e);
assert.deepEqual(src.b.e, deepBC.e);
});
it('should FlatMap.getSrc() deep cloned default, shallow clone with shallowClonePropSet', function () {
let flated = new FlatMap(src);
let deepSrc = flated.getSrc();
let shallowB = flated.get('b', false);
let shallowSrc = flated.getSrc(false);
assert.notEqual(deepSrc.b.c, shallowB.c);
assert.deepEqual(deepSrc.b, shallowB);
assert.equal(shallowSrc.b.c, shallowB.c);
let deepBC = flated.get('b', new Set(['b.c']));
// 浅拷贝指定的属性
assert.equal(shallowSrc.b.c, deepBC.c);
assert.notEqual(shallowSrc.b.e, deepBC.e);
assert.deepEqual(shallowSrc.b.e, deepBC.e);
});
it('should change FlatMap.getSrc() value when patch or put', function () {
let triggered = [];
let shallowSet = new Set('b');
let flated = new FlatMap({a: 1, b: {c: 2}});
flated.patch({b: {d: 1}}, (query, value) => {
triggered.push([query, value]);
});
assert.ok(triggered.length);
assert.deepEqual([['b.d', 1], ['b', {c: 2, d: 1}]], triggered);
assert.deepEqual(flated.getSrc(shallowSet).b, flated.get('b', shallowSet));
assert.deepEqual(flated.getSrc().b, flated.get('b', shallowSet));
triggered = [];
flated.put('b', {e: 1}, (query, value) => {
triggered.push([query, value]);
});
assert.ok(triggered.length);
assert.deepEqual([
['b', {e: 1}],
['b.c', undefined],
['b.d', undefined],
['b.e', 1]], triggered);
assert.deepEqual(flated.getSrc(shallowSet).b, flated.get('b', shallowSet));
});
it('should change all when put entirely', function () {
let triggered = [];
let flated = new FlatMap({a: 1, b: {c: 2}});
let cover = {a: 1, b: {e: 1}};
flated.put('', cover, (query, value) => {
triggered.push([query, value]);
});
assert.ok(triggered.length);
assert.deepEqual([
['', cover],
['b.c', undefined],
['b.e', 1],
['b', cover.b]], triggered);
assert.deepEqual(flated.getSrc(null, false), flated.get('', null, false));
});
});
| wenshin/clearflux | test/utils/flatmap.js | JavaScript | mit | 2,749 |
using GW2PAO.Infrastructure.Interfaces;
using GW2PAO.Properties;
using Microsoft.Practices.Prism.Mvvm;
using System.ComponentModel.Composition;
namespace GW2PAO.Modules.Cycles.ViewModels
{
[Export(typeof(CycleSettingsViewModel))]
public class CycleSettingsViewModel : BindableBase, ISettingsViewModel
{
/// <summary>
/// Heading for the settings view
/// </summary>
public string SettingsHeader
{
get { return Resources.Cycles; }
}
/// <summary>
/// The event user data
/// </summary>
public CyclesUserData UserData
{
get;
private set;
}
/// <summary>
/// Default constructor
/// </summary>
/// <param name="userData">The events user data</param>
[ImportingConstructor]
public CycleSettingsViewModel(CyclesUserData userData)
{
this.UserData = userData;
}
}
} | kirkerafael/gw2pao | GW2PAO/Modules/Cycles/ViewModels/CycleSettingsViewModel.cs | C# | mit | 820 |
/*!The Treasure Box Library
*
* TBox is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* TBox is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with TBox;
* If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
*
* Copyright (C) 2009 - 2015, ruki All rights reserved.
*
* @author ruki
* @file prefix.h
*
*/
#ifndef TB_STRING_PREFIX_H
#define TB_STRING_PREFIX_H
/* //////////////////////////////////////////////////////////////////////////////////////
* includes
*/
#include "../prefix.h"
#endif
| szszss/CharmingTremblePlus | lib/tbox/src/tbox/string/prefix.h | C | mit | 1,032 |
[](http://badge.fury.io/js/signal-emitter)
# signal-emitter
EventEmitter-backed Signals
| jasonkarns/signal-emitter | README.md | Markdown | mit | 148 |
describe('AppCtrl', function () {
describe('isCurrentUrl', function () {
var AppCtrl, $location, $scope;
it('should pass a dummy test', function () {
expect(true).toBeTruthy();
});
});
});
| cgjerdingen/AngularFunKata | src/app/app.spec.js | JavaScript | mit | 237 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>paramcoq: Not compatible</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.11.2 / paramcoq - 1.1.1+coq8.7</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
paramcoq
<small>
1.1.1+coq8.7
<span class="label label-info">Not compatible</span>
</small>
</h1>
<p><em><script>document.write(moment("2020-08-17 11:46:38 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2020-08-17 11:46:38 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-threads base
base-unix base
conf-findutils 1 Virtual package relying on findutils
conf-m4 1 Virtual package relying on m4
coq 8.11.2 Formal proof management system
num 1.3 The legacy Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.10.0 The OCaml compiler (virtual package)
ocaml-base-compiler 4.10.0 Official release 4.10.0
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.8.1 A library manager for OCaml
# opam file:
opam-version: "2.0"
synopsis: "Paramcoq"
name: "coq-paramcoq"
version: "1.1.1+coq8.7"
maintainer: "Pierre Roux <[email protected]>"
homepage: "https://github.com/coq-community/paramcoq"
dev-repo: "git+https://github.com/coq-community/paramcoq.git"
bug-reports: "https://github.com/coq-community/paramcoq/issues"
license: "MIT"
build: [make "-j%{jobs}%"]
install: [make "install"]
remove: ["rm" "-R" "%{lib}%/coq/user-contrib/Param"]
depends: [
"ocaml"
"coq" {>= "8.7.2" & < "8.8~"}
]
tags: [
"keyword:paramcoq"
"keyword:parametricity"
"keyword:ocaml module"
"category:paramcoq"
"category:Miscellaneous/Coq Extensions"
"logpath:Param"
]
authors: [
"Chantal Keller (Inria, École polytechnique)"
"Marc Lasson (ÉNS de Lyon)"
"Abhishek Anand"
"Pierre Roux"
"Emilio Jesús Gallego Arias"
"Cyril Cohen"
"Matthieu Sozeau"
]
flags: light-uninstall
url {
src:
"https://github.com/coq-community/paramcoq/releases/download/v1.1.1+coq8.7/coq-paramcoq.1.1.1+coq8.7.tgz"
checksum: "md5=3eb94ccdb53e6dfc7f0d74b3cd1a5db5"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-paramcoq.1.1.1+coq8.7 coq.8.11.2</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.11.2).
The following dependencies couldn't be met:
- coq-paramcoq -> coq < 8.8~ -> ocaml < 4.10
base of this switch (use `--unlock-base' to force)
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-paramcoq.1.1.1+coq8.7</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
<small>Sources are on <a href="https://github.com/coq-bench">GitHub</a>. © Guillaume Claret.</small>
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| coq-bench/coq-bench.github.io | clean/Linux-x86_64-4.10.0-2.0.6/released/8.11.2/paramcoq/1.1.1+coq8.7.html | HTML | mit | 7,018 |
require 'spec_helper'
require 'usaidwat/algo'
require 'usaidwat/count'
module USaidWat
module Application
describe CountCommand do
before(:all) do
Struct.new('Comment', :subreddit, :body)
end
let (:stub) { Class.new { include CountCommand }.new }
let(:comments) do
c1 = Array.new(20) { Struct::Comment.new('AskReddit') }
c2 = Array.new(20) { Struct::Comment.new('programming') }
c3 = Array.new(19) { Struct::Comment.new('Python') }
c4 = Array.new(20) { Struct::Comment.new('books') }
c5 = Array.new(21) { Struct::Comment.new('ruby') }
c1 + c2 + c3 + c4 + c5
end
describe '#algorithm' do
it 'sorts entries by subreddit name' do
expect(stub.algorithm(true)).to eq(USaidWat::Algorithms::CountAlgorithm)
end
it 'sorts entries by count' do
expect(stub.algorithm(false)).to eq(USaidWat::Algorithms::LexicographicalAlgorithm)
end
end
describe '#partition' do
it 'partitions data and returns the longest subreddit' do
res = stub.partition(comments, false)
expect(res.longest).to eq('programming'.length)
end
it 'partitions data and returns the partitioned data' do
res = stub.partition(comments, false)
expect(res.counts.count).to eq(5)
expect(res.counts.first.first).to eq('AskReddit')
expect(res.counts.last.first).to eq('ruby')
end
it 'partitions data, sorting by count, and returns the longest subreddit' do
res = stub.partition(comments, true)
expect(res.longest).to eq('programming'.length)
end
it 'partitions data, sorting by count, and returns the partitioned data' do
res = stub.partition(comments, true)
expect(res.counts.count).to eq(5)
expect(res.counts.first.first).to eq('ruby')
expect(res.counts.last.first).to eq('Python')
end
end
end
end
end
| mdippery/usaidwat | spec/usaidwat/count_spec.rb | Ruby | mit | 2,019 |
//
// Users Controller
//
'use strict';
module.exports = function() {
var _ = require('lodash'),
helpers = require('./../core/helpers');
var app = this.app,
core = this.core,
middlewares = this.middlewares,
models = this.models,
User = models.user;
//
// Routes
//
app.get('/users', middlewares.requireLogin, function(req, res) {
req.io.route('users:list');
});
app.get('/users/:id', middlewares.requireLogin, function(req, res) {
req.io.route('users:get');
});
//
// Sockets
//
app.io.route('users', {
list: function(req, res) {
var options = {
skip: req.param('skip'),
take: req.param('take')
};
options = helpers.sanitizeQuery(options, {
defaults: {
take: 500
},
maxTake: 5000
});
var find = User.find({
organizationDomain: req.user.organizationDomain,
isVerified: true
});
if (options.skip) {
find.skip(options.skip);
}
if (options.take) {
find.limit(options.take);
}
find.exec(function(err, users) {
if (err) {
console.log(err);
return res.status(400).json(err);
}
res.json(users);
});
},
get: function(req, res) {
var identifier = req.param('id');
User.findByIdentifier(identifier, function (err, user) {
if (err) {
console.error(err);
return res.status(400).json(err);
}
if (!user) {
return res.sendStatus(404);
}
res.json(user);
});
}
});
};
| madnanbashir/stitch1 | app/controllers/users.js | JavaScript | mit | 1,994 |
import gulp from 'gulp'
import browserify from 'browserify'
import source from 'vinyl-source-stream'
import buffer from 'vinyl-buffer'
import uglify from 'gulp-uglify'
import babelify from 'babelify'
import rename from 'gulp-rename'
// Agregado presets y plugins en .babelrc o en package.json plugin: "transform-regenerator"
gulp.task('scripts', () => {
return browserify('./src/main.js')
.transform(babelify)
.bundle()
.on('error', (err) => {
console.log(err)
this.emit('end')
})
.pipe(source('main.js'))
.pipe(buffer())
.pipe(rename('index.js'))
.pipe(gulp.dest('./build/js'))
.pipe(uglify())
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('./src/js'))
.pipe(gulp.dest('./build/js'))
.pipe(gulp.dest('./public/js'))
})
| alexballera/carlisle-dev | tasks/scripts.js | JavaScript | mit | 762 |
<?php
namespace ShinyDeploy\Domain\Database;
use Defuse\Crypto\Exception\CryptoException;
use Defuse\Crypto\Key;
use Exception;
use Lcobucci\JWT\Configuration;
use Lcobucci\JWT\Signer\Hmac\Sha256;
use Lcobucci\JWT\Signer\Key\InMemory;
use Lcobucci\JWT\Validation\Constraint\IdentifiedBy;
use Lcobucci\JWT\Validation\Constraint\IssuedBy;
use ShinyDeploy\Core\Crypto\KeyCrypto;
use ShinyDeploy\Core\Crypto\PasswordCrypto;
use ShinyDeploy\Exceptions\AuthException;
use ShinyDeploy\Exceptions\CryptographyException;
use ShinyDeploy\Exceptions\DatabaseException;
use ShinyDeploy\Exceptions\MissingDataException;
class Auth extends DatabaseDomain
{
/**
* Generates JWT.
*
* @param string $username
* @param string $userEncryptionKey
* @param string $clientId
* @return string
*/
public function generateToken(string $username, string $userEncryptionKey, string $clientId): string
{
try {
$signer = new Sha256();
$key = InMemory::plainText($this->config->get('auth.secret'));
$config = Configuration::forSymmetricSigner($signer, $key);
$now = new \DateTimeImmutable();
$builder = $config->builder();
$token = $builder->issuedBy('ShinyDeploy')
->identifiedBy($clientId)
->issuedAt($now)
->canOnlyBeUsedAfter($now)
->expiresAt($now->modify('+8 hour'))
->withClaim('usr', $username)
->withClaim('uek', $userEncryptionKey)
->getToken($signer, $key);
return $token->toString();
} catch (Exception $e) {
$this->logger->error(
'Token Exception: ' . $e->getMessage() . ' (' . $e->getFile() . ': ' . $e->getLine() . ')'
);
return '';
}
}
/**
* Checks if JWT is valid/not manipulated.
*
* @param string $token
* @param string $clientId
* @return boolean
*/
public function validateToken(string $token, string $clientId): bool
{
try {
$signer = new Sha256();
$key = InMemory::plainText($this->config->get('auth.secret'));
$config = Configuration::forSymmetricSigner($signer, $key);
$parsedToken = $config->parser()->parse($token);
$config->setValidationConstraints(
new IssuedBy('ShinyDeploy'),
new IdentifiedBy($clientId)
);
return $config->validator()->validate($parsedToken, ...$config->validationConstraints());
} catch (Exception $e) {
$this->logger->error(
'Token Exception: ' . $e->getMessage() . ' (' . $e->getFile() . ': ' . $e->getLine() . ')'
);
return false;
}
}
/**
* Checks whether a user exists in database.
*
* @param string $username
* @throws MissingDataException
* @return bool
*/
public function userExists(string $username): bool
{
if (empty($username)) {
throw new MissingDataException('Username can not be empty.');
}
try {
$statement = "SELECT `id` FROM users WHERE `username` = %s";
$userId = (int)$this->db->prepare($statement, $username)->getValue();
return ($userId > 0);
} catch (DatabaseException $e) {
$this->logger->error(
'Database Exception: ' . $e->getMessage() . ' (' . $e->getFile() . ': ' . $e->getLine() . ')'
);
return false;
}
}
/**
* Fetches password-hash for username from database.
*
* @param string $username
* @return string
* @throws MissingDataException
*/
public function getPasswordHashByUsername(string $username): string
{
if (empty($username)) {
throw new MissingDataException('Username can not be empty.');
}
try {
$statement = "SELECT `password` FROM users WHERE `username` = %s";
$passwordHash = $this->db->prepare($statement, $username)->getValue();
return $passwordHash ?? '';
} catch (DatabaseException $e) {
$this->logger->error(
'Database Exception: ' . $e->getMessage() . ' (' . $e->getFile() . ': ' . $e->getLine() . ')'
);
return '';
}
}
/**
* Fetches users encryption key and decryptes it with given password.
*
* @param string $username
* @param string $password
* @return string
* @throws CryptographyException
* @throws DatabaseException
* @throws MissingDataException
*/
public function getUserKeyByUsername(string $username, string $password): string
{
if (empty($username)) {
throw new MissingDataException('Username can not be empty.');
}
if (empty($password)) {
throw new MissingDataException('Password can not be empty.');
}
$passwordCrypto = new PasswordCrypto();
$statement = "SELECT `user_key` FROM users WHERE `username` = %s";
$userKeyEncrypted = $this->db->prepare($statement, $username)->getValue();
return $passwordCrypto->decrypt($userKeyEncrypted, $password);
}
/**
* Fetches encryption key from database identified by username.
*
* @param string $username
* @return string
* @throws MissingDataException
* @throws DatabaseException
*/
public function getEncryptionKeyByUsername(string $username): string
{
if (empty($username)) {
throw new MissingDataException('Username can not be empty.');
}
$statement = "SELECT `encryption_key` FROM users WHERE `username` = %s";
return $this->db->prepare($statement, $username)->getValue();
}
/**
* Fetches encryption key for given user.
*
* @param string $username
* @param string $password
* @return string
* @throws AuthException
* @throws MissingDataException
*/
public function getEncryptionKeyByUsernameAndPassword(string $username, string $password): string
{
try {
$userKey = $this->getUserKeyByUsername($username, $password);
$encryptionKey = $this->getEncryptionKeyByUsername($username);
if (empty($encryptionKey)) {
throw new AuthException('Could not fetch encryption key for given username.');
}
$keyCrypto = new KeyCrypto();
$encryptionKeyDecrypted = $keyCrypto->decryptString($encryptionKey, $userKey);
if (empty($encryptionKeyDecrypted)) {
throw new AuthException('Could not decrypt encryption key.');
}
return $encryptionKeyDecrypted;
} catch (CryptographyException $e) {
$this->logger->error(
'Cryptography Exception: ' . $e->getMessage() . ' (' . $e->getFile() . ': ' . $e->getLine() . ')'
);
throw new AuthException('Could not get encryption key for username. Cryptography error.');
} catch (DatabaseException $e) {
$this->logger->error(
'Database Exception: ' . $e->getMessage() . ' (' . $e->getFile() . ': ' . $e->getLine() . ')'
);
throw new AuthException('Could not get encryption key for username. Database error.');
}
}
/**
* Fetches users encryption key using username and password from JWT.
*
* @param string $token
* @throws MissingDataException
* @throws AuthException
* @return string
*/
public function getEncryptionKeyFromToken(string $token): string
{
if (empty($token)) {
throw new MissingDataException('Token can not be empty');
}
try {
$signer = new Sha256();
$key = InMemory::plainText($this->config->get('auth.secret'));
$config = Configuration::forSymmetricSigner($signer, $key);
$parsedToken = $config->parser()->parse($token);
$username = $parsedToken->claims()->get('usr');
$userEncryptionKey = $parsedToken->claims()->get('uek');
if (empty($username) || empty($userEncryptionKey)) {
throw new AuthException('Could not get username from token.');
}
$encryptionKey = $this->getEncryptionKeyByUsername($username);
if (empty($encryptionKey)) {
throw new AuthException('Could not get encryption key.');
}
$keyCrypto = new KeyCrypto();
$encryptionKeyDecrypted = $keyCrypto->decryptString($encryptionKey, $userEncryptionKey);
if (empty($encryptionKeyDecrypted)) {
throw new AuthException('Could not decrypt encryption key.');
}
return $encryptionKeyDecrypted;
} catch (CryptographyException $e) {
$this->logger->error(
'Cryptography Exception: ' . $e->getMessage() . ' (' . $e->getFile() . ': ' . $e->getLine() . ')'
);
throw new AuthException('Could not get key from token. Cryptography error.');
} catch (DatabaseException $e) {
$this->logger->error(
'Database Exception: ' . $e->getMessage() . ' (' . $e->getFile() . ': ' . $e->getLine() . ')'
);
throw new AuthException('Could not get key from token. Database error.');
}
}
/**
* Creates a new user and saves item to database.
*
* @param string $username
* @param string $password
* @param string $systemKey
* @return bool
* @throws MissingDataException
*/
public function createUser(string $username, string $password, string $systemKey): bool
{
if (empty($username)) {
throw new MissingDataException('Username can not be empty.');
}
if (empty($password)) {
throw new MissingDataException('Password can not be empty.');
}
if (empty($systemKey)) {
throw new MissingDataException('System password can not be empty.');
}
try {
// generate new user key
$userKey = Key::createNewRandomKey()->saveToAsciiSafeString();
// encrypt system key with user key:
$keyCrypto = new KeyCrypto();
$systemKeyEncrypted = $keyCrypto->encryptString($systemKey, $userKey);
// encrypt user key with password:
$passwordCrypto = new PasswordCrypto();
$userKeyEncrypted = $passwordCrypto->encrypt($userKey, $password);
// hash password
$passwordHash = hash('sha256', $password);
// store new user in database
$statement = "INSERT INTO users (`username`,`password`,`user_key`,`encryption_key`) VALUES (%s,%s,%s,%s)";
return $this->db->prepare(
$statement,
$username,
$passwordHash,
$userKeyEncrypted,
$systemKeyEncrypted
)->execute();
} catch (CryptoException $e) {
$this->logger->error(
'Crypto Exception: ' . $e->getMessage() . ' (' . $e->getFile() . ': ' . $e->getLine() . ')'
);
return false;
} catch (CryptographyException $e) {
$this->logger->error(
'Cryptography Exception: ' . $e->getMessage() . ' (' . $e->getFile() . ': ' . $e->getLine() . ')'
);
return false;
} catch (DatabaseException $e) {
$this->logger->error(
'Database Exception: ' . $e->getMessage() . ' (' . $e->getFile() . ': ' . $e->getLine() . ')'
);
return false;
}
}
/**
* Saves new system-user to database.
*
* @param string $password
* @return bool
* @throws MissingDataException
* @throws CryptographyException
*/
public function createSystemUser(string $password): bool
{
if (empty($password)) {
throw new MissingDataException('Password can not be empty.');
}
try {
$passwordHash = hash('sha256', $password);
$keys = $this->generateSystemUserEncryptionKeys($password);
if (empty($keys)) {
return false;
}
$statement = "INSERT INTO users (`username`,`password`,`user_key`,`encryption_key`) VALUES (%s,%s,%s,%s)";
return $this->db->prepare(
$statement,
'system',
$passwordHash,
$keys['user_key'],
$keys['encryption_key']
)->execute();
} catch (DatabaseException $e) {
$this->logger->error(
'Database Exception: ' . $e->getMessage() . ' (' . $e->getFile() . ': ' . $e->getLine() . ')'
);
return false;
}
}
/**
* Update password for given user.
*
* @param string $username
* @param string $password
* @param string $systemKey
* @return bool
*/
public function updateUserPassword(string $username, string $password, string $systemKey): bool
{
try {
// generate new user key
$userKey = Key::createNewRandomKey()->saveToAsciiSafeString();
// encrypt system key with user key:
$keyCrypto = new KeyCrypto();
$systemKeyEncrypted = $keyCrypto->encryptString($systemKey, $userKey);
// encrypt user key with password:
$passwordCrypto = new PasswordCrypto();
$userKeyEncrypted = $passwordCrypto->encrypt($userKey, $password);
// hash password
$passwordHash = hash('sha256', $password);
// update user
$statement = "UPDATE users
SET
`password` = %s,
`user_key` = %s,
`encryption_key` = %s
WHERE `username` = %s
LIMIT 1";
return $this->db->prepare(
$statement,
$passwordHash,
$userKeyEncrypted,
$systemKeyEncrypted,
$username
)->execute();
} catch (CryptoException $e) {
$this->logger->error(
'Crypto Exception: ' . $e->getMessage() . ' (' . $e->getFile() . ': ' . $e->getLine() . ')'
);
return false;
} catch (CryptographyException $e) {
$this->logger->error(
'Cryptography Exception: ' . $e->getMessage() . ' (' . $e->getFile() . ': ' . $e->getLine() . ')'
);
return false;
} catch (DatabaseException $e) {
$this->logger->error(
'Database Exception: ' . $e->getMessage() . ' (' . $e->getFile() . ': ' . $e->getLine() . ')'
);
return false;
}
}
/**
* Updates encryption key for system user.
*
* @param string $key
* @throws DatabaseException
* @throws MissingDataException
*/
public function updateSystemEncryptionKey(string $key): void
{
if (empty($key)) {
throw new MissingDataException('Encryption key can not be empty.');
}
$statement = "UPDATE users SET `encryption_key` = %s WHERE `username` = 'system'";
$this->db->prepare($statement, $key)->execute();
}
/**
* Checks if an API password is valid.
*
* @param string $apiKey
* @param string $apiPassword
* @return bool
*/
public function apiPasswordIsValid(string $apiKey, string $apiPassword): bool
{
if (empty($apiKey) || empty($apiPassword)) {
return false;
}
try {
$passwordHash = hash('sha256', $apiPassword . $this->config->get('auth.secret'));
$statement = "SELECT api_key FROM api_keys WHERE `password` = %s";
$apiKeyDb = $this->db->prepare($statement, $passwordHash)->getValue();
if (empty($apiKeyDb)) {
return false;
}
return ($apiKeyDb === $apiKey);
} catch (DatabaseException $e) {
$this->logger->error(
'Database Exception: ' . $e->getMessage() . ' (' . $e->getFile() . ': ' . $e->getLine() . ')'
);
return false;
}
}
/**
* Generates new encryption key for system user.
*
* @param string $password
* @throws MissingDataException
* @throws CryptographyException
* @return array
*/
private function generateSystemUserEncryptionKeys(string $password): array
{
if (empty($password)) {
throw new MissingDataException('Password can not be empty.');
}
try {
// generate key:
$userKey = Key::createNewRandomKey()->saveToAsciiSafeString();
$systemKey = Key::createNewRandomKey()->saveToAsciiSafeString();
// encrypt keys:
$passwordCrypto = new PasswordCrypto();
$keyCrypto = new KeyCrypto();
return [
'user_key' => $passwordCrypto->encrypt($userKey, $password),
'encryption_key' => $keyCrypto->encryptString($systemKey, $userKey)
];
} catch (CryptoException $e) {
return [];
}
}
}
| nekudo/shiny_deploy | src/ShinyDeploy/Domain/Database/Auth.php | PHP | mit | 17,569 |
<?php
namespace Cachet\Counter;
/**
* Increments and decrements are not guaranteed to be fully atomic without a locker.
* They are atomic if the value is already set, but if it isn't there's no protection
* without a locker.
*/
class APCU implements \Cachet\Counter
{
public $prefix;
public $counterTTL;
public $locker;
private $cacheId = 'counter';
function __construct($prefix=null, \Cachet\Locker $locker=null, $counterTTL=null)
{
$this->counterTTL = $counterTTL;
$this->prefix = $prefix;
$this->locker = $locker;
}
/**
* @param string $key
* @param int $value
* @return void
*/
function set($key, $value)
{
if (!is_numeric($value)) {
throw new \InvalidArgumentException();
}
$formattedKey = \Cachet\Helper::formatKey([$this->prefix, $this->cacheId, $key]);
if (!apcu_store($formattedKey, $value, $this->counterTTL)) {
throw new \UnexpectedValueException("APC could not set the value at $formattedKey");
}
}
/**
* @param string $key
* @return int
*/
function value($key)
{
$formattedKey = \Cachet\Helper::formatKey([$this->prefix, $this->cacheId, $key]);
$value = apcu_fetch($formattedKey);
if (!is_numeric($value) && !is_bool($value) && $value !== null) {
$type = \Cachet\Helper::getType($value);
throw new \UnexpectedValueException(
"APC counter expected numeric value, found $type at key $key"
);
}
return $value ?: 0;
}
private function change($method, $key, $by)
{
$formattedKey = \Cachet\Helper::formatKey([$this->prefix, $this->cacheId, $key]);
$value = $method($formattedKey, abs($by), $success);
if (!$success) {
$check = false;
if ($this->locker) {
$this->locker->acquire($this->cacheId, $key);
$check = apcu_fetch($formattedKey);
if ($check !== false)
$value = $method($formattedKey, abs($by), $success);
}
if ($check === false) {
$this->set($key, $by);
$value = $by;
}
if ($this->locker) {
$this->locker->release($this->cacheId, $key);
}
}
return $value;
}
/**
* @param string $key
* @param int $by
* @return int
*/
function increment($key, $by=1)
{
return $this->change('apcu_inc', $key, $by);
}
/**
* @param string $key
* @param int $by
* @return int
*/
function decrement($key, $by=1)
{
return $this->change('apcu_dec', $key, -$by);
}
}
| shabbyrobe/cachet | src/Counter/APCU.php | PHP | mit | 2,782 |
<?php
/**
* This file is part of OXID eSales PayPal module.
*
* OXID eSales PayPal module is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* OXID eSales PayPal module is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with OXID eSales PayPal module. If not, see <http://www.gnu.org/licenses/>.
*
* @link http://www.oxid-esales.com
* @copyright (C) OXID eSales AG 2003-2015
*/
/**
* oePayPalPaymentValidator class for checking validation of PayPal payment for user and basket amount
*/
class oePayPalPaymentValidator
{
/**
* Basket price
*
* @var double $_dPrice
*/
protected $_dPrice;
/**
* Config object
*
* @var oxConfig $_oConfig
*/
protected $_oConfig = null;
/**
* User object
*
* @var oxUser $_oUser
*/
protected $_oUser = null;
/**
* Payment object
*
* @var oxPayment $_oPayment
*/
protected $_oPayment = null;
/**
* Check country in validator.
*
* @var bool
*/
protected $_blCheckCountry = true;
/**
* Basket price setter
*
* @param double $dPrice
*/
public function setPrice($dPrice)
{
$this->_dPrice = $dPrice;
}
/**
* Basket price getter
*
* @return double
*/
public function getPrice()
{
return $this->_dPrice;
}
/**
* Config object setter
*
* @param oxConfig $oConfig
*/
public function setConfig($oConfig)
{
$this->_oConfig = $oConfig;
}
/**
* Config object getter
*
* @return oxConfig
*/
public function getConfig()
{
return $this->_oConfig;
}
/**
* User object setter
*
* @param oxUser $oUser
*/
public function setUser($oUser)
{
$this->_oUser = $oUser;
}
/**
* User object getter
*
* @return oxUser
*/
public function getUser()
{
return $this->_oUser;
}
/**
* Payment object setter
*
* @param oxPayment $oPayment
*/
public function setPayment($oPayment)
{
$this->_oPayment = $oPayment;
}
/**
* Check country setter.
*
* @param boolean $blCheckCountry
*/
public function setCheckCountry($blCheckCountry)
{
$this->_blCheckCountry = $blCheckCountry;
}
/**
* Returns if country should be checked.
*
* @return boolean
*/
public function getCheckCountry()
{
return $this->_blCheckCountry;
}
/**
* Payment object getter
*
* @return oxPayment
*/
public function getPayment()
{
if (is_null($this->_oPayment)) {
$oPayPalPayment = oxNew('oxPayment');
$oPayPalPayment->load('oxidpaypal');
$this->setPayment($oPayPalPayment);
}
return $this->_oPayment;
}
/**
* Checks if PayPal payment is active
*
* @return boolean
*/
public function isPaymentActive()
{
$blResult = false;
if ($oPayPalPayment = $this->getPayment()) {
$blResult = $oPayPalPayment->oxpayments__oxactive->value ? true : false;
}
return $blResult;
}
/**
* Checks if payment is valid according to config, user and basket amount.
*
* @return boolean
*/
public function isPaymentValid()
{
$blIsValid = $this->isPaymentActive();
if ($blIsValid && !is_null($this->getPrice())) {
$blIsValid = $this->_checkPriceRange() && $this->_checkMinOrderPrice();
}
$oUser = $this->getUser();
if ($blIsValid && $oUser && $oUser->hasAccount()) {
$blIsValid = $this->_checkUserGroup();
}
if ($blIsValid && $oUser && $this->getCheckCountry()) {
$blIsValid = $this->_checkUserCountry();
}
return $blIsValid;
}
/**
* Checks if basket price is inside payment price range
* If range is not set check returns true
*
* @return bool
*/
protected function _checkPriceRange()
{
$blIsValid = true;
$oPayPalPayment = $this->getPayment();
if ($oPayPalPayment->oxpayments__oxfromamount->value != 0 ||
$oPayPalPayment->oxpayments__oxtoamount->value != 0
) {
$oCur = $this->getConfig()->getActShopCurrencyObject();
$dPrice = $this->getPrice() / $oCur->rate;
$blIsValid = (($dPrice >= $oPayPalPayment->oxpayments__oxfromamount->value) &&
($dPrice <= $oPayPalPayment->oxpayments__oxtoamount->value));
}
return $blIsValid;
}
/**
* Checks if basket price is higher than minimum order price
* If min price is not set check returns true
*
* @return bool
*/
protected function _checkMinOrderPrice()
{
$blIsValid = true;
if ($iMinOrderPrice = $this->getConfig()->getConfigParam('iMinOrderPrice')) {
$blIsValid = $this->getPrice() > $iMinOrderPrice;
}
return $blIsValid;
}
/**
* Checks if user country is among payment countries
* If payment countries are not set returns true
*
* @return bool
*/
protected function _checkUserCountry()
{
$blIsValid = true;
$oPayPalPayment = $this->getPayment();
$aCountries = $oPayPalPayment->getCountries();
if ($aCountries) {
$blIsValid = false;
foreach ($aCountries as $sCountryId) {
if ($sCountryId === $this->_getShippingCountryId()) {
$blIsValid = true;
break;
}
}
}
return $blIsValid;
}
/**
* Checks if user belongs group that is assigned to payment
* If payment does not have any groups assigned returns true
*
* @return bool
*/
protected function _checkUserGroup()
{
$blIsValid = true;
$oPayPalPayment = $this->getPayment();
$oGroups = $oPayPalPayment->getGroups();
if ($oGroups && $oGroups->count() > 0) {
$blIsValid = $this->_isUserAssignedToGroup($oGroups);
}
return $blIsValid;
}
/**
* Checks whether user is assigned to given groups array.
*
* @param oxList $oGroups
*
* @return bool
*/
protected function _isUserAssignedToGroup($oGroups)
{
$blIsValid = false;
$oUser = $this->getUser();
foreach ($oGroups as $oGroup) {
if ($oUser->inGroup($oGroup->getId())) {
$blIsValid = true;
break;
}
}
return $blIsValid;
}
/**
* Returns shipping country ID.
*
* @return string
*/
protected function _getShippingCountryId()
{
$oUser = $this->getUser();
if ($oUser->getSelectedAddressId()) {
$sCountryId = $oUser->getSelectedAddress()->oxaddress__oxcountryid->value;
} else {
$sCountryId = $oUser->oxuser__oxcountryid->value;
}
return $sCountryId;
}
}
| Olyvko/oxrom | modules/oe/oepaypal/models/oepaypalpaymentvalidator.php | PHP | mit | 7,667 |
require File.expand_path('./helper', File.dirname(__FILE__))
class MitStalkerTest < Minitest::Test
def fixture(name)
File.read File.join(File.dirname(__FILE__), 'fixtures', name)
end
def test_finger
assert_equal nil, MitStalker.finger('root', 'nosuchhostname.com'),
'Invalid hostname'
result = MitStalker.finger 'no_such_user', 'athena.dialup.mit.edu'
assert_operator(/no_such_user/, :=~, result,
"The finger response looks incorrect")
begin
MitStalker.finger_timeout = 1
start_time = Time.now
result = MitStalker.finger 'no_such_user', 'web.mit.edu'
assert_equal nil, result, 'Invalid timeout result'
assert_in_delta Time.now - start_time, 1, 0.2, 'Bad timeout duration'
ensure
MitStalker.finger_timeout = 10
end
end
def test_full_name
assert_equal 'Srinivas Devadas',
MitStalker.full_name_from_user_name('devadas'),
'normalized'
assert_equal 'Srinivas Devadas',
MitStalker.full_name_from_user_name('Devadas'),
'Capital letter in user name'
assert_equal nil, MitStalker.full_name_from_user_name('no_user')
end
def test_parse_mitdir_no_response
assert_equal [],
MitStalker.parse_mitdir_response(fixture('no_response.txt'))
end
def test_parse_mitdir_single_response
response = MitStalker.parse_mitdir_response fixture('single_response.txt')
assert_equal 1, response.length, 'Response should have 1 user'
assert_equal 'Costan, Victor Marius', response.first[:name]
assert_equal '[email protected]', response.first[:email]
assert_equal 'G', response.first[:year]
assert_equal 'Sidney-Pacific NW86-948C', response.first[:address]
assert_equal 'http://www.costan.us', response.first[:url]
assert_equal 'V-costan', response.first[:alias]
end
def test_parse_mitdir_multiple_responses
response = MitStalker.parse_mitdir_response fixture('multi_response.txt')
assert_equal 155, response.length, 'Response should have 110 users'
response.each do |user|
assert_operator(/Li/, :=~, user[:name], "Name doesn't match query")
assert_operator(/li/i, :=~, user[:alias], "Alias doesn't match query")
end
end
def test_name_vector
['Victor-Marius Costan', 'Victor Marius Costan', 'Costan, Victor-Marius',
'Costan, Victor Marius'].each do |name|
assert_equal ['Costan', 'Marius', 'Victor'], MitStalker.name_vector(name)
end
end
def test_refine_mitdir_response_by_name
MitStalker.expects(:finger).with('Y-li16', 'mitdir.mit.edu').
returns(fixture('single_response.txt')).once
multi_response = MitStalker.parse_mitdir_response(
fixture('multi_response.txt'))
user = MitStalker.refine_mitdir_response_by_name multi_response,
'Yan Ping Li'
assert_equal '[email protected]', user[:email], 'Wrong user information'
end
def test_refine_mitdir_response_by_email
MitStalker.expects(:finger).with('V-costan', 'mitdir.mit.edu').
returns(fixture('single_response.txt')).once
MitStalker.expects(:finger).with('A-li', 'mitdir.mit.edu').
returns(fixture('single_response2.txt')).once
mixed_response =
MitStalker.parse_mitdir_response fixture('mixed_response.txt')
user = MitStalker.refine_mitdir_response_by_email mixed_response.reverse,
'aliceli'
assert user, 'No user returned'
assert_equal 'Li, Alice', user[:name]
end
def test_flip_full_name
assert_equal 'Victor Marius Costan',
MitStalker.flip_full_name('Costan, Victor Marius'), 'flipped'
assert_equal 'Victor Marius Costan',
MitStalker.flip_full_name('Victor Marius Costan'), 'canonical'
end
def test_from_user_name
assert_equal nil, MitStalker.from_user_name('no_such_user')
info = MitStalker.from_user_name 'devadas'
assert info, 'No info returned'
assert_equal 'Devadas, Srinivas', info[:name]
info = MitStalker.from_user_name 'Devadas'
assert info, 'No info returned'
assert_equal 'Devadas, Srinivas', info[:name], 'capitalized user name'
info = MitStalker.from_user_name 'nickolai'
assert info, 'No info returned'
assert_equal 'Zeldovich, Nickolai', info[:name]
assert_equal 'Nickolai Zeldovich', info[:full_name]
end
end
| pwnall/mit_stalker | test/mit_stalker_test.rb | Ruby | mit | 4,475 |
#some arch specific variables for the url where we get "stage3.tar.bz2"
STAGE3_DIR_MIRROR="amd64"
STAGE3_ARCH_MIRROR="amd64"
| kakwa/genautoo | installer/lib/arch/amd64/A05_stage3.sh | Shell | mit | 126 |
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="canonical" href="https://stealthefish.com/archives/blog/archive/page/4/"/>
<title>Archive Page 4 | Andrea D. Blog</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css" id="tl-id-1" data-turbolinks-permanent />
<link rel="stylesheet" href="/css/css.css" data-turbolinks-permanent id="tl-id-2" />
<link rel="preload"
as="style"
href="https://fonts.googleapis.com/css?family=Raleway:200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i&subset=latin-ext&display=swap" id="tl-id-6" data-turbolinks-permanent />
<link rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Raleway:200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i&subset=latin-ext&display=swap"
media="all" onload="this.media='all'" id="tl-id-3" data-turbolinks-permanent />
<link rel="alternate" href="/atom.xml" title="Andrea D. Blog" type="application/atom+xml" id="tl-id-10" data-turbolinks-permanent>
<!-- icons start -->
<meta name="theme-color" content="#2c62b8">
<link rel="icon" href="/favicon/steal-fav512w.svg">
<link rel="apple-touch-icon" href="/favicon/steal-fav180w.png">
<!-- icons end -->
<!-- gallery start -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/SimpleLightbox/2.1.0/simpleLightbox.min.css" id="tl-id-4" data-turbolinks-permanent />
<script src="https://cdnjs.cloudflare.com/ajax/libs/SimpleLightbox/2.1.0/simpleLightbox.min.js" id="tl-id-5" data-turbolinks-permanent></script>
<!-- gallery end -->
<!-- og meta start -->
<meta name="description" content="...and definitely it steals the fish.">
<meta property="og:type" content="website">
<meta property="og:title" content="Andrea D. Blog">
<meta property="og:url" content="https://stealthefish.com/archives/blog/archive/page/4/">
<meta property="og:site_name" content="Andrea D. Blog">
<meta property="og:description" content="...and definitely it steals the fish.">
<meta property="og:locale" content="en_US">
<meta property="article:author" content="Andrea Dessi">
<meta property="article:tag" content="tech">
<meta property="article:tag" content=" development">
<meta property="article:tag" content=" me">
<meta property="article:tag" content=" web culture">
<meta name="twitter:card" content="summary">
<meta name="twitter:creator" content="@nkjoep">
<!-- og meta end -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/turbolinks/5.2.0/turbolinks.js" defer async></script>
<style>
.turbolinks-progress-bar {
height: 0.3rem;
background-color: var(--color-blue);
box-shadow: 1px 0px 5px 1px var(--color-button-shade1);
}
</style>
<meta name="generator" content="Hexo 4.2.1"><link rel="stylesheet" href="/css/prism-material-light.css" type="text/css">
<link rel="stylesheet" href="/css/prism-line-numbers.css" type="text/css"></head>
<body class="stealthefish">
<header class="stealthefish__header" id="tl-id-9" data-turbolinks-permanent>
<a href="/">Andrea D. Blog</a><nav class="stealthefish__header-nav">
<a href="https://twitter.com/nkjoep" target="_blank" rel="noopener"><span class="screen-reader-only">Twitter</span><img role="presentation" src="/img/tw.svg" alt="" /></a>
<a href="https://www.linkedin.com/in/andreadessi/" target="_blank" rel="noopener"><span class="screen-reader-only">LinkedIn</span><img role="presentation" src="/img/li.svg" alt="" /></a>
<a href="https://github.com/nkjoep" target="_blank" rel="noopener"><span class="screen-reader-only">GitHub</span><img role="presentation" src="/img/gh.svg" alt="" /></a>
<a href="/atom.xml"><span class="screen-reader-only">rss</span><img role="presentation" src="/img/rss.svg" alt="" /></a></nav>
</header>
<hr />
<main class="stealthefish__main">
archive.ejs
</main>
<hr />
<aside class="stealthefish__aside">
<h2>Projects</h2>
<p>
Experiments, tests and other stuff I've worked on. Have a look.
</p>
<ul class="stealthefish__list-inline">
<li>
<a href="https://github.com/NKjoep/hexo-blog-theme-starter" target="_blank" rel="noopener" title="A blank theme for Hexo to start building your own theme. A simple Hexo Theme boilerplate.">
<h3>hexo-blog-theme-starter</h3>
</a>
</li>
<li>
<a href="http://whatismyremoteip.herokuapp.com/" target="_blank" rel="noopener" title="Simple nodejs server which returns the remote ip of the request">
<h3>whatismyremoteip</h3>
</a>
</li>
<li>
<a href="http://stealthefish.com/hn-meets-modern-html/" title="This is my hack on how I'd like to read the Hack News with a better html structure.">
<h3>hn-meets-modern-html</h3>
</a>
</li>
<li>
<a href="https://nkjoep.github.io/i-love-markdown.css/" target="_blank" rel="noopener" title="Css that styles html as the original plain markdown text">
<h3>i-love-markdown.css</h3>
</a>
</li>
<li>
<a href="https://svg-to-symbol.herokuapp.com/" target="_blank" rel="noopener" title="Simple tool to convert SVG into Symbols.">
<h3>svg-to-symbol</h3>
</a>
</li>
<li>
<a href="https://nkjoep.github.com/CSV-Transformer/index.html" target="_blank" rel="noopener" title="A web tool that allow you to input a CSV formatted string and transform it into another applying certain rules.">
<h3>CSV-Transformer</h3>
</a>
</li>
<li>
<a href="https://stealthefish.com/qrcode-bookmarklet/" title="A bookmarklet that generates a qrcode containing the current URL.">
<h3>qrcode-bookmarklet</h3>
</a>
</li>
<li>
<a href="https://github.com/NKjoep/microsmith" target="_blank" rel="noopener" title="A static blog generator based on Metalsmith and inspired to Micro.blog">
<h3>microsmith</h3>
</a>
</li>
<li>
<a href="http://nkjoep.github.com/event-accelaration-test/octocat.html" target="_blank" rel="noopener" title="Browser Event Acceleration Test">
<h3>event-accelaration-test</h3>
</a>
</li>
<li>
<a href="https://github.com/NKjoep/vscode-mac-classic-theme" target="_blank" rel="noopener" title="">
<h3>vscode-mac-classic-theme</h3>
</a>
</li>
<li>
<a href="http://nkjoep.github.com/MooCells" target="_blank" rel="noopener" title="A MooTools library to manage form with "dependent fields".">
<h3>MooCells</h3>
</a>
</li>
<li>
<a href="http://nkjoep.github.com/EntandoPageModelsBuilder" target="_blank" rel="noopener" title="The easy tool to create your Entando™ Page Models in a click.">
<h3>EntandoPageModelsBuilder</h3>
</a>
</li>
<li>
<a href="https://github.com/NKjoep/jquery.entando.js" target="_blank" rel="noopener" title="Entando javascript utility with jQuery">
<h3>jquery.entando.js</h3>
</a>
</li>
<li>
<a href="http://stealthefish.com/bootstrap-swapon" title="">
<h3>bootstrap-swapon</h3>
</a>
</li>
<li>
<a href="https://github.com/NKjoep/jpstaticresourceeditor" target="_blank" rel="noopener" title="an experimental plugin for editing css and other static stuff of your jAPS Entando portal">
<h3>jpstaticresourceeditor</h3>
</a>
</li>
<li>
<a href="https://github.com/NKjoep/Entando-Plugin-Builder-for-ANT" target="_blank" rel="noopener" title="">
<h3>Entando-Plugin-Builder-for-ANT</h3>
</a>
</li>
<li>
<a href="https://github.com/NKjoep/dummy-jsp-image" target="_blank" rel="noopener" title="A jsp that outputs a parameterized image">
<h3>dummy-jsp-image</h3>
</a>
</li>
<li>
<a href="http://moocontentassist.altervista.org" target="_blank" rel="noopener" title="Content Assist Editor MooTools Based">
<h3>MooContentAssist</h3>
</a>
</li>
</ul>
</aside>
<hr />
<footer class="stealthefish__footer">
<section class="stealthefish__footer-credits">
<h2 class="screen-reader-only">Credits</h2>
<p>
© Andrea Dessì 2020.
</p>
<p>
All The Ideas are mine if not specified otherwise.
</p>
</section>
<section class="stealthefish__footer-pics">
<h2 class="screen-reader-only">Some pictures from me.</h2>
<a href="/img/footer/img1.jpg" title="Who doesn't like green screens?"
style="background: radial-gradient(circle, #208a47 40%, #fff 170%);">
<img src="/img/footer/img1.jpg" width="40" alt="" loading="lazy" />
</a><a href="/img/footer/img2.jpg" title="Frozen Berlin 2018"
style="background: radial-gradient(circle, #83828b 40%, #fff 170%);">
<img src="/img/footer/img2.jpg" width="40" alt="" loading="lazy" />
</a><a href="/img/footer/img3.jpg" title="Favorite office spot"
style="background: radial-gradient(circle, #695641 40%, #fff 170%);">
<img src="/img/footer/img3.jpg" width="40" alt="" loading="lazy" />
</a><a href="/img/footer/img4.jpg" title="Footsteps"
style="background: radial-gradient(circle, #8b8d8c 40%, #fff 170%);">
<img src="/img/footer/img4.jpg" width="40" alt="" loading="lazy" />
</a><a href="/img/footer/img5.jpg" title="End of the season 2017"
style="background: radial-gradient(circle, #476580 40%, #fff 170%);">
<img src="/img/footer/img5.jpg" width="40" alt="" loading="lazy" />
</a><a href="/img/footer/img6.jpg" title="Fernsehturm"
style="background: radial-gradient(circle, #7a879f 40%, #fff 170%);">
<img src="/img/footer/img6.jpg" width="40" alt="" loading="lazy" />
</a><a href="/img/footer/img7.jpg" title="Got used to it"
style="background: radial-gradient(circle, #786f4a 40%, #fff 170%);">
<img src="/img/footer/img7.jpg" width="40" alt="" loading="lazy" />
</a><a href="/img/footer/img8.jpg" title="And that was Easter"
style="background: radial-gradient(circle, #717473 40%, #fff 170%);">
<img src="/img/footer/img8.jpg" width="40" alt="" loading="lazy" />
</a><a href="/img/footer/img9.jpg" title="Kings"
style="background: radial-gradient(circle, #717667 40%, #fff 170%);">
<img src="/img/footer/img9.jpg" width="40" alt="" loading="lazy" />
</a><a href="/img/footer/img10.jpg" title="My city!"
style="background: radial-gradient(circle, #676e71 40%, #fff 170%);">
<img src="/img/footer/img10.jpg" width="40" alt="" loading="lazy" />
</a><a href="/img/footer/img11.jpg" title="Try not to sneeze"
style="background: radial-gradient(circle, #647068 40%, #fff 170%);">
<img src="/img/footer/img11.jpg" width="40" alt="" loading="lazy" />
</a><a href="/img/footer/img12.jpg" title="Pop it"
style="background: radial-gradient(circle, #0a0802 40%, #fff 170%);">
<img src="/img/footer/img12.jpg" width="40" alt="" loading="lazy" />
</a><a href="/img/footer/img13.jpg" title=""
style="background: radial-gradient(circle, #625856 40%, #fff 170%);">
<img src="/img/footer/img13.jpg" width="40" alt="" loading="lazy" />
</a><a href="/img/footer/img14.jpg" title="Yes, that's a frog. 🐸"
style="background: radial-gradient(circle, #838a7d 40%, #fff 170%);">
<img src="/img/footer/img14.jpg" width="40" alt="" loading="lazy" />
</a>
<script>
new SimpleLightbox({elements: '.stealthefish__footer-pics a'});
</script>
</section>
</footer>
</body>
</html>
| NKjoep/nkjoep.github.io | archives/blog/archive/page/4/index.html | HTML | mit | 13,361 |
class Ussd::DefaultController < ApplicationController
enable_sads
def index
@sads.title = "hello"
respond_with_sads
end
end
| innohub/sads_xml | test/dummy/app/controllers/ussd/default_controller.rb | Ruby | mit | 140 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.