code_text
stringlengths
604
999k
repo_name
stringlengths
4
100
file_path
stringlengths
4
873
language
stringclasses
23 values
license
stringclasses
15 values
size
int32
1.02k
999k
#!/usr/bin/env python import configparser, os from sys import argv, exit # filter for .ovpn-files def filterType(f): return f.endswith(".ovpn") # updates the openvpn settings in the vpn configuration if needed def updateOpenvpn(config, path): # get the correct .ovpn settings file ovpnPath = os.path.expanduser(path) filelist = os.listdir(ovpnPath) #filelist = filter(lambda x: not os.path.isdir(x), filelist) filelist = filter(filterType, filelist) s = config.get('vpn', 'remote') server = ''.join([letter for letter in s if not letter.isdigit()]) # remove digits from server adress searchString = "remote " + server + " " resFile = "" port = 0 for file in filelist: for line in open(ovpnPath + "/" + file): if line.startswith(searchString): resFile = file port = int(line.split(" ")[-1]) break # check if search was successful if resFile == "": exit("Error - no .ovpn File found to change the openvpn settings!") else: print("Using " + resFile + " to update the openvpn settings...") # get the settings from the .ovpn file # get .cert, .ca, .key & .ta-filenames getCa = getCert = getKey = getTa = "" for line in open(ovpnPath + "/" + resFile): if line.startswith("ca "): getCa = line.split(" ")[1] elif line.startswith("cert "): getCert = line.split(" ")[1] elif line.startswith("key "): getKey = line.split(" ")[1] elif line.startswith("tls-auth "): getTa = line.split(" ")[1] # dirty litte bugfix: montreal.ovpn, moscow.ovpn and chicaco.ovpn # only have a pkcs12-setting => guess the filenames from getTag sting if getCa == "" and getCert == "" and getKey == "": if getTa != "": serverPre = getTa[:2] getCa = serverPre + "ca.crt" getCert = serverPre + "client.crt" getKey = serverPre + "client.key" else: exit("Error reading settings from " + resFile + " config file.") # other settings config.set('vpn', 'cert', ovpnPath + "/" + getCert) config.set('vpn', 'ca', ovpnPath + "/" + getCa) config.set('vpn', 'key', ovpnPath + "/" + getKey) config.set('vpn', 'ta', ovpnPath + "/" + getTa) config.set('vpn', 'port', port) return config def main(): # error cases nArgs = len(argv) if nArgs not in (4,5): exit("Error, wrong arguments! Use pptool.py instead.") if os.getuid() != 0: print("Error: This function needs root permissions!") return fileName = str(argv[1]) newServer = str(argv[2]) conType = str(argv[3]) if conType == "openvpn": ovpnPath = str(argv[4]) vpnconf = configparser.RawConfigParser() vpnconf.read(fileName) # get vpn type serverString = "gateway" sType = vpnconf.get("vpn", "service-type") if sType.endswith(".openvpn") and conType == "openvpn": serverString = "remote" print("Updating with openvpn VPN connection") elif not (sType.endswith(".pptp") and conType == "pptp"): exit("Error: Invalid VPN-Type! (" + sType + ", tool-setting: " + conType + ") Please use pptp or openvpn.") else: print("\nUpdating pptp VPN connection...") # get old server oldServer = vpnconf.get("vpn", serverString) if oldServer != newServer: # Set new server print("Changing PP server from " + oldServer + " to " + newServer) vpnconf.set("vpn", serverString, newServer) if conType == "openvpn": vpnconf = updateOpenvpn(vpnconf, ovpnPath) with open(fileName, 'w') as configfile: vpnconf.write(configfile) print("New Server written to configuration.\n") return else: print("Server didn't change - nothing to do.") return if __name__ == '__main__': main()
pylight/P-2-Config-Tool
srv/set_server.py
Python
mit
3,545
from ctypes import LittleEndianStructure, Union, sizeof, c_ubyte, c_uint16, c_uint32 import collections import struct from msfat import TYPE_FAT12, TYPE_FAT16, TYPE_FAT32, SeekError from msfat.chkdsk import chkdsk import msfat.stream _FAT32_ENTRY_MASK = 0x0FFFFFFF _FAT12_EOC = 0xFF8 _FAT12_BAD = 0xFF7 _MIN_CLUSTER_NUM = 2 class _BiosParameterBlock16(LittleEndianStructure): # also used for FAT12 _pack_ = 1 _fields_ = [ ("BS_DrvNum", c_ubyte), # 0x00 for floppy, 0x80 for hard # Used by WinNT, other software should set to 0 when creating ("BS_Reserved1", c_ubyte), ("BS_BootSig", c_ubyte), # 0x29 means the following 3 fields are present ("BS_VolID", c_uint32), ("BS_VolLab", c_ubyte * 11), # should match volume dir entry in \. "NO NAME " if not set # not actually used in FAT type determination, but should be one of # "FAT12 ", "FAT16 ", "FAT " ("BS_FilSysType", c_ubyte * 8) ] class _BiosParameterBlock32(LittleEndianStructure): _pack_ = 1 _fields_ = [ ("BPB_FATSz32", c_uint32), ("BPB_ExtFlags", c_uint16), # See docs, but nothing to validate probably ("BPB_FSVer", c_uint16), # Version 0 seems to be the highest defined ("BPB_RootClus", c_uint32), # Should be 2, but not required ("BPB_FSInfo", c_uint16), ("BPB_BkBootSec", c_uint16), # Should be 6 ("BPB_Reserved", c_ubyte * 12), # Should be all \0 # Following are same as in BiosParameterBlock16, just different offsets ("BS_DrvNum", c_ubyte), ("BS_Reserved1", c_ubyte), ("BS_BootSig", c_ubyte), ("BS_VolID", c_uint32), ("BS_VolLab", c_ubyte * 11), # Should be "FAT32 " but as in BiosParameterBlock16, not actually # used in type determination ("BS_FilSysType", c_ubyte * 8) ] class _BiosParameterBlockUnion(Union): _fields_ = [ ("fat16", _BiosParameterBlock16), ("fat32", _BiosParameterBlock32) ] class BiosParameterBlock(LittleEndianStructure): _pack_ = 1 _anonymous_ = ("bpbex",) _fields_ = [ ("BS_jmpBoot", c_ubyte * 3), # \xeb.\x90|\xe9.. ("BS_OEMName", c_ubyte * 8), # informational only. "MSWIN4.1" recommended ("BPB_BytsPerSec", c_uint16), # 2^n where 9 <= n <= 12 ("BPB_SecPerClus", c_ubyte), # 2^n where 0 <= n <= 7, BPB_BytsPerSec * BPB_SecPerClus <= 32*1024 ("BPB_RsvdSecCnt", c_uint16), # > 0, FAT12 and FAT16 must be 1, FAT32 often 32 ("BPB_NumFATs", c_ubyte), # Should be 2 # This field * 32 must be an even multiple of BPB_BytsPerSec # i.e. Root entry count must not partially fill a sector # (entries are 32 bytes each) # Must be 0 on FAT32 # FAT16 recommended to be 512 ("BPB_RootEntCnt", c_uint16), # If 0, then see BOB_TotSec32. Otherwise use this value and # BPB_TotSec32 must be 0. Must be 0 on FAT32. # Can be less than the total # of sectors on disk. Must never be greater ("BPB_TotSec16", c_uint16), # 0xF0, 0xF8-0xFF. Should equal FAT[0]. 0xF0 for removable media, # 0xF8 for non-removable ("BPB_Media", c_ubyte), ("BPB_FATSz16", c_uint16), # must be 0 on FAT32, in which case see BPB_FATSz32 ("BPB_SecPerTrk", c_uint16), # check against MediaGeometry ("BPB_NumHeads", c_uint16), # check against MediaGeometry ("BPB_HiddSec", c_uint32), # 0 on non-partitioned disks, like floppies ("BPB_TotSec32", c_uint32), ("bpbex", _BiosParameterBlockUnion) ] _VolumeInfo = collections.namedtuple( "_VolumeInfo", [ "fat_type", "fat_type_id", # BS_FilSysType "oem_name", # BS_OEMName "bs_volume_id", # BS_VolID "bs_volume_name", # BS_VolLab "bytes_per_sector", # BPB_BytsPerSec "sectors_per_track", # BPB_SecPerTrk "head_count", # BPB_NumHeads "sector_count", # self._total_sector_count "single_fat_sector_count", # self._fat_sector_count "fat_count", # BPB_NumFATs "fat0_sector_start", # ?? "root_dir_sector_start", # self._root_dir_sector_start "root_dir_sector_count", # self._root_dir_sector_count "root_entry_count", # BPB_RootEntCnt "data_sector_start", # self._data_sector_start "data_sector_count", # self._data_sector_count "sectors_per_cluster", # BPB_SecPerClus "cluster_count" # self._cluster_count ] ) # Also, Sector[0][510] must == 0x55 and [0][511] must == 0xAA # FATSize = BPB_FATSz16 != 0 ? BPB_FATSz16 : BPB_FATSz32 # FirstDataSector is first sector of cluster 2, first legal cluster # FirstDataSector = BPB_RsvdSecCnt + (BPB_NumFATs * FATSize) + RootDirSectorCount # FirstSectorOfCluster(N) = ((N - 2) * BPB_SecPerClus) + FirstDataSector class FATVolume(object): def __init__(self, stream, geometry): self._stream = stream self._geometry = geometry self._bpb = None # mirror the value we want to use in here. maybe take it from geometry, # maybe use what we read from the boot sector. self._bytes_per_sector = 0 # some way of changing this self.active_fat_index = 0 self._root_dir_sector_count = -1 self._fat_sector_count = -1 self._total_sector_count = -1 self._data_sector_start = -1 self._data_sector_count = -1 self._cluster_count = -1 self.fat_type = None self._fat_buffer = None self._fat_buffer_sector = -1 self._init_bpb() self._init_calcs() self._determine_fat_type() def get_info(self): b = self._bpb bx = self.fat_type == TYPE_FAT32 and b.fat32 or b.fat16 return _VolumeInfo( self.fat_type, bytes(bx.BS_FilSysType), bytes(b.BS_OEMName), bx.BS_VolID, bytes(bx.BS_VolLab), b.BPB_BytsPerSec, b.BPB_SecPerTrk, b.BPB_NumHeads, self._total_sector_count, self._fat_sector_count, b.BPB_NumFATs, b.BPB_RsvdSecCnt, self._root_dir_sector_start, self._root_dir_sector_count, b.BPB_RootEntCnt, self._data_sector_start, self._data_sector_count, b.BPB_SecPerClus, self._cluster_count ) def chkdsk(self, user_log_func): chkdsk(self, user_log_func) def _open_root_dir(self): if self.fat_type == TYPE_FAT32: return self._open_cluster_chain(self._bpb.fat32.BPB_RootClus) else: return self._open_sector_run(self._root_dir_sector_start, self._root_dir_sector_count) def _open_sector_run(self, first_sector, count): return msfat.stream.SectorRunStream(self, first_sector, count) def _open_cluster_chain(self, first_cluster, expected_bytes=-1): return msfat.stream.ClusterChainStream(self, first_cluster, expected_bytes) def _seek_sector(self, sector, byte=0): if 0 <= sector < self._geometry.total_sector_count(): self._stream.seek(sector * self._geometry.sector_size + byte) else: raise SeekError("Invalid sector number", sector) def _is_valid_cluster_num(self, cluster): return _MIN_CLUSTER_NUM <= cluster <= self._max_cluster_num def _seek_cluster(self, cluster): if cluster < _MIN_CLUSTER_NUM: raise SeekError("Invalid cluster number", cluster) self._seek_sector(self._cluster_sector_start(cluster)) def _read(self, byte_count): return self._stream.read(byte_count) def _read_sector(self, sector): self._seek_sector(sector) return self._read(self._bytes_per_sector) def _read_cluster(self, cluster): self._seek_cluster(cluster) return self._read(self._bytes_per_sector * self._bpb.BPB_SecPerClus) def _init_bpb(self): self._seek_sector(0) bpbbuf = self._read(sizeof(BiosParameterBlock)) self._bpb = BiosParameterBlock.from_buffer_copy(bpbbuf) def _init_calcs(self): # you could use self._bpb.BPB_BytsPerSec # self._bytes_per_sector = self._bpb.BPB_BytsPerSec self._bytes_per_sector = self._geometry.sector_size self._bytes_per_cluster = self._bytes_per_sector * self._bpb.BPB_SecPerClus # you could use BPB_TotSec16 / BPB_TotSec32 # self._total_sector_count = self._calc_total_sector_count() self._total_sector_count = self._geometry.total_sector_count() self._fat_sector_count = self._calc_fat_sector_count() self._root_dir_sector_start = self._calc_root_dir_sector_start() self._root_dir_sector_count = self._calc_root_dir_sector_count() self._data_sector_start = self._calc_data_sector_start() self._data_sector_count = self._calc_data_sector_count() self._cluster_count = 0 if self._bpb.BPB_SecPerClus > 0: self._cluster_count = self._data_sector_count // self._bpb.BPB_SecPerClus self._max_cluster_num = self._cluster_count + 1 def _calc_total_sector_count(self): if self._bpb.BPB_TotSec16 != 0: return self._bpb.BPB_TotSec16 return self._bpb.BPB_TotSec32 def _calc_fat_sector_start(self): return self._bpb.BPB_RsvdSecCnt + self._fat_sector_count * self.active_fat_index def _calc_fat_sector_count(self): if self._bpb.BPB_FATSz16 != 0: return self._bpb.BPB_FATSz16 return self._bpb.fat32.BPB_FATSz32 def _calc_root_dir_sector_start(self): b = self._bpb return (b.BPB_RsvdSecCnt + self._fat_sector_count * b.BPB_NumFATs) def _calc_root_dir_sector_count(self): b = self._bpb # RootDirSectorCount = # ((BPB_RootEntCnt * 32) + (BPB_BytsPerSec - 1)) / BPB_BytsPerSec if b.BPB_RootEntCnt == 0: return 0 # adding bytes_per_sector - 1 has the effect of performing a ceil # when using integer division. don't need to ceil it twice byte_count = (b.BPB_RootEntCnt * 32) + (self._bytes_per_sector - 1) return byte_count // self._bytes_per_sector def _calc_data_sector_start(self): return self._root_dir_sector_start + self._root_dir_sector_count def _calc_data_sector_count(self): return self._total_sector_count - self._calc_data_sector_start() def _cluster_sector_start(self, n): return (n - 2) * self._bpb.BPB_SecPerClus + self._data_sector_start def _get_fat_offset(self, clustern): if self.fat_type == TYPE_FAT32: offset = clustern * 4 elif self.fat_type == TYPE_FAT16: offset = clustern * 2 else: offset = clustern + (clustern >> 1) # integer mul by 1.5, rounding down return divmod(offset, self._bytes_per_sector) def _get_fat_address(self, clustern): sec_offset, byte_offset = self._get_fat_offset(clustern) return (sec_offset + self._calc_fat_sector_start(), byte_offset) def _get_fat_entry(self, clustern): sec_num, sec_offset = self._get_fat_address(clustern) self._load_fat(sec_num) if self.fat_type == TYPE_FAT32: entry_bytes = self._fat_buffer[sec_offset : sec_offset + 4] return struct.unpack("I", entry_bytes)[0] & _FAT32_ENTRY_MASK entry_bytes = self._fat_buffer[sec_offset : sec_offset + 2] entry = struct.unpack("H", entry_bytes)[0] if self.fat_type == TYPE_FAT16: return entry # FAT12 case if clustern & 1: # odd-numbered clusters are stored in the high 12 bits of the 16 bit value return entry >> 4 # even-numbered clusters are stored in the low 12 return entry & 0x0FFF def _is_eoc(self, entry): return entry >= self._fat_eoc def _is_bad(self, entry): return entry == self._fat_bad def _load_fat(self, sectorn): if sectorn == self._fat_buffer_sector: return self._fat_buffer_sector = sectorn self._seek_sector(sectorn) self._fat_buffer = self._read(self._bytes_per_sector * 2) def _determine_fat_type(self): if self._cluster_count < 4085: self.fat_type = TYPE_FAT12 extrabits = 0 elif self._cluster_count < 65525: self.fat_type = TYPE_FAT16 extrabits = 0xF000 else: self.fat_type = TYPE_FAT32 extrabits = 0xFFFF000 self._fat_eoc = _FAT12_EOC | extrabits self._fat_bad = _FAT12_BAD | extrabits
yellcorp/floppy-recovery
msfat/volume.py
Python
mit
13,070
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2015 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "main.h" #include "addrman.h" #include "alert.h" #include "arith_uint256.h" #include "chainparams.h" #include "checkpoints.h" #include "checkqueue.h" #include "consensus/consensus.h" #include "consensus/merkle.h" #include "consensus/validation.h" #include "hash.h" #include "init.h" #include "merkleblock.h" #include "net.h" #include "policy/policy.h" #include "pow.h" #include "primitives/block.h" #include "primitives/transaction.h" #include "script/script.h" #include "script/sigcache.h" #include "script/standard.h" #include "tinyformat.h" #include "txdb.h" #include "txmempool.h" #include "ui_interface.h" #include "undo.h" #include "util.h" #include "utilmoneystr.h" #include "utilstrencodings.h" #include "validationinterface.h" #include <sstream> #include <boost/algorithm/string/replace.hpp> #include <boost/filesystem.hpp> #include <boost/filesystem/fstream.hpp> #include <boost/math/distributions/poisson.hpp> #include <boost/thread.hpp> using namespace std; #if defined(NDEBUG) # error "Bitcoin cannot be compiled without assertions." #endif /** * Global state */ CCriticalSection cs_main; BlockMap mapBlockIndex; CChain chainActive; CBlockIndex *pindexBestHeader = NULL; int64_t nTimeBestReceived = 0; CWaitableCriticalSection csBestBlock; CConditionVariable cvBlockChange; int nScriptCheckThreads = 0; bool fImporting = false; bool fReindex = false; bool fTxIndex = false; bool fHavePruned = false; bool fPruneMode = false; bool fIsBareMultisigStd = DEFAULT_PERMIT_BAREMULTISIG; bool fRequireStandard = true; unsigned int nBytesPerSigOp = DEFAULT_BYTES_PER_SIGOP; bool fCheckBlockIndex = false; bool fCheckpointsEnabled = DEFAULT_CHECKPOINTS_ENABLED; size_t nCoinCacheUsage = 5000 * 300; uint64_t nPruneTarget = 0; bool fAlerts = DEFAULT_ALERTS; int64_t nMaxTipAge = DEFAULT_MAX_TIP_AGE; bool fEnableReplacement = DEFAULT_ENABLE_REPLACEMENT; CFeeRate minRelayTxFee = CFeeRate(DEFAULT_MIN_RELAY_TX_FEE); CAmount maxTxFee = DEFAULT_TRANSACTION_MAXFEE; CTxMemPool mempool(::minRelayTxFee); struct COrphanTx { CTransaction tx; NodeId fromPeer; }; map<uint256, COrphanTx> mapOrphanTransactions GUARDED_BY(cs_main); map<uint256, set<uint256> > mapOrphanTransactionsByPrev GUARDED_BY(cs_main); void EraseOrphansFor(NodeId peer) EXCLUSIVE_LOCKS_REQUIRED(cs_main); /** * Returns true if there are nRequired or more blocks of minVersion or above * in the last Consensus::Params::nMajorityWindow blocks, starting at pstart and going backwards. */ static bool IsSuperMajority(int minVersion, const CBlockIndex* pstart, unsigned nRequired, const Consensus::Params& consensusParams); static void CheckBlockIndex(const Consensus::Params& consensusParams); /** Constant stuff for coinbase transactions we create: */ CScript COINBASE_FLAGS; const string strMessageMagic = "Bitcoin Signed Message:\n"; // Internal stuff namespace { struct CBlockIndexWorkComparator { bool operator()(CBlockIndex *pa, CBlockIndex *pb) const { // First sort by most total work, ... if (pa->nChainWork > pb->nChainWork) return false; if (pa->nChainWork < pb->nChainWork) return true; // ... then by earliest time received, ... if (pa->nSequenceId < pb->nSequenceId) return false; if (pa->nSequenceId > pb->nSequenceId) return true; // Use pointer address as tie breaker (should only happen with blocks // loaded from disk, as those all have id 0). if (pa < pb) return false; if (pa > pb) return true; // Identical blocks. return false; } }; CBlockIndex *pindexBestInvalid; /** * The set of all CBlockIndex entries with BLOCK_VALID_TRANSACTIONS (for itself and all ancestors) and * as good as our current tip or better. Entries may be failed, though, and pruning nodes may be * missing the data for the block. */ set<CBlockIndex*, CBlockIndexWorkComparator> setBlockIndexCandidates; /** Number of nodes with fSyncStarted. */ int nSyncStarted = 0; /** All pairs A->B, where A (or one of its ancestors) misses transactions, but B has transactions. * Pruned nodes may have entries where B is missing data. */ multimap<CBlockIndex*, CBlockIndex*> mapBlocksUnlinked; CCriticalSection cs_LastBlockFile; std::vector<CBlockFileInfo> vinfoBlockFile; int nLastBlockFile = 0; /** Global flag to indicate we should check to see if there are * block/undo files that should be deleted. Set on startup * or if we allocate more file space when we're in prune mode */ bool fCheckForPruning = false; /** * Every received block is assigned a unique and increasing identifier, so we * know which one to give priority in case of a fork. */ CCriticalSection cs_nBlockSequenceId; /** Blocks loaded from disk are assigned id 0, so start the counter at 1. */ uint32_t nBlockSequenceId = 1; /** * Sources of received blocks, saved to be able to send them reject * messages or ban them when processing happens afterwards. Protected by * cs_main. */ map<uint256, NodeId> mapBlockSource; /** * Filter for transactions that were recently rejected by * AcceptToMemoryPool. These are not rerequested until the chain tip * changes, at which point the entire filter is reset. Protected by * cs_main. * * Without this filter we'd be re-requesting txs from each of our peers, * increasing bandwidth consumption considerably. For instance, with 100 * peers, half of which relay a tx we don't accept, that might be a 50x * bandwidth increase. A flooding attacker attempting to roll-over the * filter using minimum-sized, 60byte, transactions might manage to send * 1000/sec if we have fast peers, so we pick 120,000 to give our peers a * two minute window to send invs to us. * * Decreasing the false positive rate is fairly cheap, so we pick one in a * million to make it highly unlikely for users to have issues with this * filter. * * Memory used: 1.3 MB */ boost::scoped_ptr<CRollingBloomFilter> recentRejects; uint256 hashRecentRejectsChainTip; /** Blocks that are in flight, and that are in the queue to be downloaded. Protected by cs_main. */ struct QueuedBlock { uint256 hash; CBlockIndex *pindex; //! Optional. int64_t nTime; //! Time of "getdata" request in microseconds. bool fValidatedHeaders; //! Whether this block has validated headers at the time of request. int64_t nTimeDisconnect; //! The timeout for this block request (for disconnecting a slow peer) }; map<uint256, pair<NodeId, list<QueuedBlock>::iterator> > mapBlocksInFlight; /** Number of blocks in flight with validated headers. */ int nQueuedValidatedHeaders = 0; /** Number of preferable block download peers. */ int nPreferredDownload = 0; /** Dirty block index entries. */ set<CBlockIndex*> setDirtyBlockIndex; /** Dirty block file entries. */ set<int> setDirtyFileInfo; } // anon namespace ////////////////////////////////////////////////////////////////////////////// // // Registration of network node signals. // namespace { struct CBlockReject { unsigned char chRejectCode; string strRejectReason; uint256 hashBlock; }; /** * Maintain validation-specific state about nodes, protected by cs_main, instead * by CNode's own locks. This simplifies asynchronous operation, where * processing of incoming data is done after the ProcessMessage call returns, * and we're no longer holding the node's locks. */ struct CNodeState { //! The peer's address CService address; //! Whether we have a fully established connection. bool fCurrentlyConnected; //! Accumulated misbehaviour score for this peer. int nMisbehavior; //! Whether this peer should be disconnected and banned (unless whitelisted). bool fShouldBan; //! String name of this peer (debugging/logging purposes). std::string name; //! List of asynchronously-determined block rejections to notify this peer about. std::vector<CBlockReject> rejects; //! The best known block we know this peer has announced. CBlockIndex *pindexBestKnownBlock; //! The hash of the last unknown block this peer has announced. uint256 hashLastUnknownBlock; //! The last full block we both have. CBlockIndex *pindexLastCommonBlock; //! The best header we have sent our peer. CBlockIndex *pindexBestHeaderSent; //! Whether we've started headers synchronization with this peer. bool fSyncStarted; //! Since when we're stalling block download progress (in microseconds), or 0. int64_t nStallingSince; list<QueuedBlock> vBlocksInFlight; int nBlocksInFlight; int nBlocksInFlightValidHeaders; //! Whether we consider this a preferred download peer. bool fPreferredDownload; //! Whether this peer wants invs or headers (when possible) for block announcements. bool fPreferHeaders; CNodeState() { fCurrentlyConnected = false; nMisbehavior = 0; fShouldBan = false; pindexBestKnownBlock = NULL; hashLastUnknownBlock.SetNull(); pindexLastCommonBlock = NULL; pindexBestHeaderSent = NULL; fSyncStarted = false; nStallingSince = 0; nBlocksInFlight = 0; nBlocksInFlightValidHeaders = 0; fPreferredDownload = false; fPreferHeaders = false; } }; /** Map maintaining per-node state. Requires cs_main. */ map<NodeId, CNodeState> mapNodeState; // Requires cs_main. CNodeState *State(NodeId pnode) { map<NodeId, CNodeState>::iterator it = mapNodeState.find(pnode); if (it == mapNodeState.end()) return NULL; return &it->second; } int GetHeight() { LOCK(cs_main); return chainActive.Height(); } void UpdatePreferredDownload(CNode* node, CNodeState* state) { nPreferredDownload -= state->fPreferredDownload; // Whether this node should be marked as a preferred download node. state->fPreferredDownload = (!node->fInbound || node->fWhitelisted) && !node->fOneShot && !node->fClient; nPreferredDownload += state->fPreferredDownload; } // Returns time at which to timeout block request (nTime in microseconds) int64_t GetBlockTimeout(int64_t nTime, int nValidatedQueuedBefore, const Consensus::Params &consensusParams) { return nTime + 500000 * consensusParams.nPowTargetSpacing * (4 + nValidatedQueuedBefore); } void InitializeNode(NodeId nodeid, const CNode *pnode) { LOCK(cs_main); CNodeState &state = mapNodeState.insert(std::make_pair(nodeid, CNodeState())).first->second; state.name = pnode->addrName; state.address = pnode->addr; } void FinalizeNode(NodeId nodeid) { LOCK(cs_main); CNodeState *state = State(nodeid); if (state->fSyncStarted) nSyncStarted--; if (state->nMisbehavior == 0 && state->fCurrentlyConnected) { AddressCurrentlyConnected(state->address); } BOOST_FOREACH(const QueuedBlock& entry, state->vBlocksInFlight) { nQueuedValidatedHeaders -= entry.fValidatedHeaders; mapBlocksInFlight.erase(entry.hash); } EraseOrphansFor(nodeid); nPreferredDownload -= state->fPreferredDownload; mapNodeState.erase(nodeid); } // Requires cs_main. // Returns a bool indicating whether we requested this block. bool MarkBlockAsReceived(const uint256& hash) { map<uint256, pair<NodeId, list<QueuedBlock>::iterator> >::iterator itInFlight = mapBlocksInFlight.find(hash); if (itInFlight != mapBlocksInFlight.end()) { CNodeState *state = State(itInFlight->second.first); nQueuedValidatedHeaders -= itInFlight->second.second->fValidatedHeaders; state->nBlocksInFlightValidHeaders -= itInFlight->second.second->fValidatedHeaders; state->vBlocksInFlight.erase(itInFlight->second.second); state->nBlocksInFlight--; state->nStallingSince = 0; mapBlocksInFlight.erase(itInFlight); return true; } return false; } // Requires cs_main. void MarkBlockAsInFlight(NodeId nodeid, const uint256& hash, const Consensus::Params& consensusParams, CBlockIndex *pindex = NULL) { CNodeState *state = State(nodeid); assert(state != NULL); // Make sure it's not listed somewhere already. MarkBlockAsReceived(hash); int64_t nNow = GetTimeMicros(); QueuedBlock newentry = {hash, pindex, nNow, pindex != NULL, GetBlockTimeout(nNow, nQueuedValidatedHeaders, consensusParams)}; nQueuedValidatedHeaders += newentry.fValidatedHeaders; list<QueuedBlock>::iterator it = state->vBlocksInFlight.insert(state->vBlocksInFlight.end(), newentry); state->nBlocksInFlight++; state->nBlocksInFlightValidHeaders += newentry.fValidatedHeaders; mapBlocksInFlight[hash] = std::make_pair(nodeid, it); } /** Check whether the last unknown block a peer advertized is not yet known. */ void ProcessBlockAvailability(NodeId nodeid) { CNodeState *state = State(nodeid); assert(state != NULL); if (!state->hashLastUnknownBlock.IsNull()) { BlockMap::iterator itOld = mapBlockIndex.find(state->hashLastUnknownBlock); if (itOld != mapBlockIndex.end() && itOld->second->nChainWork > 0) { if (state->pindexBestKnownBlock == NULL || itOld->second->nChainWork >= state->pindexBestKnownBlock->nChainWork) state->pindexBestKnownBlock = itOld->second; state->hashLastUnknownBlock.SetNull(); } } } /** Update tracking information about which blocks a peer is assumed to have. */ void UpdateBlockAvailability(NodeId nodeid, const uint256 &hash) { CNodeState *state = State(nodeid); assert(state != NULL); ProcessBlockAvailability(nodeid); BlockMap::iterator it = mapBlockIndex.find(hash); if (it != mapBlockIndex.end() && it->second->nChainWork > 0) { // An actually better block was announced. if (state->pindexBestKnownBlock == NULL || it->second->nChainWork >= state->pindexBestKnownBlock->nChainWork) state->pindexBestKnownBlock = it->second; } else { // An unknown block was announced; just assume that the latest one is the best one. state->hashLastUnknownBlock = hash; } } // Requires cs_main bool CanDirectFetch(const Consensus::Params &consensusParams) { return chainActive.Tip()->GetBlockTime() > GetAdjustedTime() - consensusParams.nPowTargetSpacing * 20; } // Requires cs_main bool PeerHasHeader(CNodeState *state, CBlockIndex *pindex) { if (state->pindexBestKnownBlock && pindex == state->pindexBestKnownBlock->GetAncestor(pindex->nHeight)) return true; if (state->pindexBestHeaderSent && pindex == state->pindexBestHeaderSent->GetAncestor(pindex->nHeight)) return true; return false; } /** Find the last common ancestor two blocks have. * Both pa and pb must be non-NULL. */ CBlockIndex* LastCommonAncestor(CBlockIndex* pa, CBlockIndex* pb) { if (pa->nHeight > pb->nHeight) { pa = pa->GetAncestor(pb->nHeight); } else if (pb->nHeight > pa->nHeight) { pb = pb->GetAncestor(pa->nHeight); } while (pa != pb && pa && pb) { pa = pa->pprev; pb = pb->pprev; } // Eventually all chain branches meet at the genesis block. assert(pa == pb); return pa; } /** Update pindexLastCommonBlock and add not-in-flight missing successors to vBlocks, until it has * at most count entries. */ void FindNextBlocksToDownload(NodeId nodeid, unsigned int count, std::vector<CBlockIndex*>& vBlocks, NodeId& nodeStaller) { if (count == 0) return; vBlocks.reserve(vBlocks.size() + count); CNodeState *state = State(nodeid); assert(state != NULL); // Make sure pindexBestKnownBlock is up to date, we'll need it. ProcessBlockAvailability(nodeid); if (state->pindexBestKnownBlock == NULL || state->pindexBestKnownBlock->nChainWork < chainActive.Tip()->nChainWork) { // This peer has nothing interesting. return; } if (state->pindexLastCommonBlock == NULL) { // Bootstrap quickly by guessing a parent of our best tip is the forking point. // Guessing wrong in either direction is not a problem. state->pindexLastCommonBlock = chainActive[std::min(state->pindexBestKnownBlock->nHeight, chainActive.Height())]; } // If the peer reorganized, our previous pindexLastCommonBlock may not be an ancestor // of its current tip anymore. Go back enough to fix that. state->pindexLastCommonBlock = LastCommonAncestor(state->pindexLastCommonBlock, state->pindexBestKnownBlock); if (state->pindexLastCommonBlock == state->pindexBestKnownBlock) return; std::vector<CBlockIndex*> vToFetch; CBlockIndex *pindexWalk = state->pindexLastCommonBlock; // Never fetch further than the best block we know the peer has, or more than BLOCK_DOWNLOAD_WINDOW + 1 beyond the last // linked block we have in common with this peer. The +1 is so we can detect stalling, namely if we would be able to // download that next block if the window were 1 larger. int nWindowEnd = state->pindexLastCommonBlock->nHeight + BLOCK_DOWNLOAD_WINDOW; int nMaxHeight = std::min<int>(state->pindexBestKnownBlock->nHeight, nWindowEnd + 1); NodeId waitingfor = -1; while (pindexWalk->nHeight < nMaxHeight) { // Read up to 128 (or more, if more blocks than that are needed) successors of pindexWalk (towards // pindexBestKnownBlock) into vToFetch. We fetch 128, because CBlockIndex::GetAncestor may be as expensive // as iterating over ~100 CBlockIndex* entries anyway. int nToFetch = std::min(nMaxHeight - pindexWalk->nHeight, std::max<int>(count - vBlocks.size(), 128)); vToFetch.resize(nToFetch); pindexWalk = state->pindexBestKnownBlock->GetAncestor(pindexWalk->nHeight + nToFetch); vToFetch[nToFetch - 1] = pindexWalk; for (unsigned int i = nToFetch - 1; i > 0; i--) { vToFetch[i - 1] = vToFetch[i]->pprev; } // Iterate over those blocks in vToFetch (in forward direction), adding the ones that // are not yet downloaded and not in flight to vBlocks. In the mean time, update // pindexLastCommonBlock as long as all ancestors are already downloaded, or if it's // already part of our chain (and therefore don't need it even if pruned). BOOST_FOREACH(CBlockIndex* pindex, vToFetch) { if (!pindex->IsValid(BLOCK_VALID_TREE)) { // We consider the chain that this peer is on invalid. return; } if (pindex->nStatus & BLOCK_HAVE_DATA || chainActive.Contains(pindex)) { if (pindex->nChainTx) state->pindexLastCommonBlock = pindex; } else if (mapBlocksInFlight.count(pindex->GetBlockHash()) == 0) { // The block is not already downloaded, and not yet in flight. if (pindex->nHeight > nWindowEnd) { // We reached the end of the window. if (vBlocks.size() == 0 && waitingfor != nodeid) { // We aren't able to fetch anything, but we would be if the download window was one larger. nodeStaller = waitingfor; } return; } vBlocks.push_back(pindex); if (vBlocks.size() == count) { return; } } else if (waitingfor == -1) { // This is the first already-in-flight block. waitingfor = mapBlocksInFlight[pindex->GetBlockHash()].first; } } } } } // anon namespace bool GetNodeStateStats(NodeId nodeid, CNodeStateStats &stats) { LOCK(cs_main); CNodeState *state = State(nodeid); if (state == NULL) return false; stats.nMisbehavior = state->nMisbehavior; stats.nSyncHeight = state->pindexBestKnownBlock ? state->pindexBestKnownBlock->nHeight : -1; stats.nCommonHeight = state->pindexLastCommonBlock ? state->pindexLastCommonBlock->nHeight : -1; BOOST_FOREACH(const QueuedBlock& queue, state->vBlocksInFlight) { if (queue.pindex) stats.vHeightInFlight.push_back(queue.pindex->nHeight); } return true; } void RegisterNodeSignals(CNodeSignals& nodeSignals) { nodeSignals.GetHeight.connect(&GetHeight); nodeSignals.ProcessMessages.connect(&ProcessMessages); nodeSignals.SendMessages.connect(&SendMessages); nodeSignals.InitializeNode.connect(&InitializeNode); nodeSignals.FinalizeNode.connect(&FinalizeNode); } void UnregisterNodeSignals(CNodeSignals& nodeSignals) { nodeSignals.GetHeight.disconnect(&GetHeight); nodeSignals.ProcessMessages.disconnect(&ProcessMessages); nodeSignals.SendMessages.disconnect(&SendMessages); nodeSignals.InitializeNode.disconnect(&InitializeNode); nodeSignals.FinalizeNode.disconnect(&FinalizeNode); } CBlockIndex* FindForkInGlobalIndex(const CChain& chain, const CBlockLocator& locator) { // Find the first block the caller has in the main chain BOOST_FOREACH(const uint256& hash, locator.vHave) { BlockMap::iterator mi = mapBlockIndex.find(hash); if (mi != mapBlockIndex.end()) { CBlockIndex* pindex = (*mi).second; if (chain.Contains(pindex)) return pindex; } } return chain.Genesis(); } CCoinsViewCache *pcoinsTip = NULL; CBlockTreeDB *pblocktree = NULL; ////////////////////////////////////////////////////////////////////////////// // // mapOrphanTransactions // bool AddOrphanTx(const CTransaction& tx, NodeId peer) EXCLUSIVE_LOCKS_REQUIRED(cs_main) { uint256 hash = tx.GetHash(); if (mapOrphanTransactions.count(hash)) return false; // Ignore big transactions, to avoid a // send-big-orphans memory exhaustion attack. If a peer has a legitimate // large transaction with a missing parent then we assume // it will rebroadcast it later, after the parent transaction(s) // have been mined or received. // 10,000 orphans, each of which is at most 5,000 bytes big is // at most 500 megabytes of orphans: unsigned int sz = tx.GetSerializeSize(SER_NETWORK, CTransaction::CURRENT_VERSION); if (sz > 5000) { LogPrint("mempool", "ignoring large orphan tx (size: %u, hash: %s)\n", sz, hash.ToString()); return false; } mapOrphanTransactions[hash].tx = tx; mapOrphanTransactions[hash].fromPeer = peer; BOOST_FOREACH(const CTxIn& txin, tx.vin) mapOrphanTransactionsByPrev[txin.prevout.hash].insert(hash); LogPrint("mempool", "stored orphan tx %s (mapsz %u prevsz %u)\n", hash.ToString(), mapOrphanTransactions.size(), mapOrphanTransactionsByPrev.size()); return true; } void static EraseOrphanTx(uint256 hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main) { map<uint256, COrphanTx>::iterator it = mapOrphanTransactions.find(hash); if (it == mapOrphanTransactions.end()) return; BOOST_FOREACH(const CTxIn& txin, it->second.tx.vin) { map<uint256, set<uint256> >::iterator itPrev = mapOrphanTransactionsByPrev.find(txin.prevout.hash); if (itPrev == mapOrphanTransactionsByPrev.end()) continue; itPrev->second.erase(hash); if (itPrev->second.empty()) mapOrphanTransactionsByPrev.erase(itPrev); } mapOrphanTransactions.erase(it); } void EraseOrphansFor(NodeId peer) { int nErased = 0; map<uint256, COrphanTx>::iterator iter = mapOrphanTransactions.begin(); while (iter != mapOrphanTransactions.end()) { map<uint256, COrphanTx>::iterator maybeErase = iter++; // increment to avoid iterator becoming invalid if (maybeErase->second.fromPeer == peer) { EraseOrphanTx(maybeErase->second.tx.GetHash()); ++nErased; } } if (nErased > 0) LogPrint("mempool", "Erased %d orphan tx from peer %d\n", nErased, peer); } unsigned int LimitOrphanTxSize(unsigned int nMaxOrphans) EXCLUSIVE_LOCKS_REQUIRED(cs_main) { unsigned int nEvicted = 0; while (mapOrphanTransactions.size() > nMaxOrphans) { // Evict a random orphan: uint256 randomhash = GetRandHash(); map<uint256, COrphanTx>::iterator it = mapOrphanTransactions.lower_bound(randomhash); if (it == mapOrphanTransactions.end()) it = mapOrphanTransactions.begin(); EraseOrphanTx(it->first); ++nEvicted; } return nEvicted; } bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64_t nBlockTime) { if (tx.nLockTime == 0) return true; if ((int64_t)tx.nLockTime < ((int64_t)tx.nLockTime < LOCKTIME_THRESHOLD ? (int64_t)nBlockHeight : nBlockTime)) return true; BOOST_FOREACH(const CTxIn& txin, tx.vin) if (!txin.IsFinal()) return false; return true; } bool CheckFinalTx(const CTransaction &tx, int flags) { AssertLockHeld(cs_main); // By convention a negative value for flags indicates that the // current network-enforced consensus rules should be used. In // a future soft-fork scenario that would mean checking which // rules would be enforced for the next block and setting the // appropriate flags. At the present time no soft-forks are // scheduled, so no flags are set. flags = std::max(flags, 0); // CheckFinalTx() uses chainActive.Height()+1 to evaluate // nLockTime because when IsFinalTx() is called within // CBlock::AcceptBlock(), the height of the block *being* // evaluated is what is used. Thus if we want to know if a // transaction can be part of the *next* block, we need to call // IsFinalTx() with one more than chainActive.Height(). const int nBlockHeight = chainActive.Height() + 1; // BIP113 will require that time-locked transactions have nLockTime set to // less than the median time of the previous block they're contained in. // When the next block is created its previous block will be the current // chain tip, so we use that to calculate the median time passed to // IsFinalTx() if LOCKTIME_MEDIAN_TIME_PAST is set. const int64_t nBlockTime = (flags & LOCKTIME_MEDIAN_TIME_PAST) ? chainActive.Tip()->GetMedianTimePast() : GetAdjustedTime(); return IsFinalTx(tx, nBlockHeight, nBlockTime); } unsigned int GetLegacySigOpCount(const CTransaction& tx) { unsigned int nSigOps = 0; BOOST_FOREACH(const CTxIn& txin, tx.vin) { nSigOps += txin.scriptSig.GetSigOpCount(false); } BOOST_FOREACH(const CTxOut& txout, tx.vout) { nSigOps += txout.scriptPubKey.GetSigOpCount(false); } return nSigOps; } unsigned int GetP2SHSigOpCount(const CTransaction& tx, const CCoinsViewCache& inputs) { if (tx.IsCoinBase()) return 0; unsigned int nSigOps = 0; for (unsigned int i = 0; i < tx.vin.size(); i++) { const CTxOut &prevout = inputs.GetOutputFor(tx.vin[i]); if (prevout.scriptPubKey.IsPayToScriptHash()) nSigOps += prevout.scriptPubKey.GetSigOpCount(tx.vin[i].scriptSig); } return nSigOps; } bool CheckTransaction(const CTransaction& tx, CValidationState &state) { // Basic checks that don't depend on any context if (tx.vin.empty()) return state.DoS(10, false, REJECT_INVALID, "bad-txns-vin-empty"); if (tx.vout.empty()) return state.DoS(10, false, REJECT_INVALID, "bad-txns-vout-empty"); // Size limits if (::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION) > MAX_BLOCK_SIZE) return state.DoS(100, false, REJECT_INVALID, "bad-txns-oversize"); // Check for negative or overflow output values CAmount nValueOut = 0; BOOST_FOREACH(const CTxOut& txout, tx.vout) { if (txout.nValue < 0) return state.DoS(100, false, REJECT_INVALID, "bad-txns-vout-negative"); if (txout.nValue > MAX_MONEY) return state.DoS(100, false, REJECT_INVALID, "bad-txns-vout-toolarge"); nValueOut += txout.nValue; if (!MoneyRange(nValueOut)) return state.DoS(100, false, REJECT_INVALID, "bad-txns-txouttotal-toolarge"); } // Check for duplicate inputs set<COutPoint> vInOutPoints; BOOST_FOREACH(const CTxIn& txin, tx.vin) { if (vInOutPoints.count(txin.prevout)) return state.DoS(100, false, REJECT_INVALID, "bad-txns-inputs-duplicate"); vInOutPoints.insert(txin.prevout); } if (tx.IsCoinBase()) { if (tx.vin[0].scriptSig.size() < 2 || tx.vin[0].scriptSig.size() > 100) return state.DoS(100, false, REJECT_INVALID, "bad-cb-length"); } else { BOOST_FOREACH(const CTxIn& txin, tx.vin) if (txin.prevout.IsNull()) return state.DoS(10, false, REJECT_INVALID, "bad-txns-prevout-null"); } return true; } void LimitMempoolSize(CTxMemPool& pool, size_t limit, unsigned long age) { int expired = pool.Expire(GetTime() - age); if (expired != 0) LogPrint("mempool", "Expired %i transactions from the memory pool\n", expired); std::vector<uint256> vNoSpendsRemaining; pool.TrimToSize(limit, &vNoSpendsRemaining); BOOST_FOREACH(const uint256& removed, vNoSpendsRemaining) pcoinsTip->Uncache(removed); } /** Convert CValidationState to a human-readable message for logging */ std::string FormatStateMessage(const CValidationState &state) { return strprintf("%s%s (code %i)", state.GetRejectReason(), state.GetDebugMessage().empty() ? "" : ", "+state.GetDebugMessage(), state.GetRejectCode()); } bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const CTransaction& tx, bool fLimitFree, bool* pfMissingInputs, bool fOverrideMempoolLimit, const CAmount nAbsurdFee, std::vector<uint256>& vHashTxnToUncache) { const uint256 hash = tx.GetHash(); AssertLockHeld(cs_main); if (pfMissingInputs) *pfMissingInputs = false; if (!CheckTransaction(tx, state)) return error("%s: CheckTransaction: %s, %s", __func__, hash.ToString(), FormatStateMessage(state)); // Coinbase is only valid in a block, not as a loose transaction if (tx.IsCoinBase()) return state.DoS(100, false, REJECT_INVALID, "coinbase"); // Rather not work on nonstandard transactions (unless -testnet/-regtest) string reason; if (fRequireStandard && !IsStandardTx(tx, reason)) return state.DoS(0, false, REJECT_NONSTANDARD, reason); // Only accept nLockTime-using transactions that can be mined in the next // block; we don't want our mempool filled up with transactions that can't // be mined yet. if (!CheckFinalTx(tx, STANDARD_LOCKTIME_VERIFY_FLAGS)) return state.DoS(0, false, REJECT_NONSTANDARD, "non-final"); // is it already in the memory pool? if (pool.exists(hash)) return state.Invalid(false, REJECT_ALREADY_KNOWN, "txn-already-in-mempool"); // Check for conflicts with in-memory transactions set<uint256> setConflicts; { LOCK(pool.cs); // protect pool.mapNextTx BOOST_FOREACH(const CTxIn &txin, tx.vin) { if (pool.mapNextTx.count(txin.prevout)) { const CTransaction *ptxConflicting = pool.mapNextTx[txin.prevout].ptx; if (!setConflicts.count(ptxConflicting->GetHash())) { // Allow opt-out of transaction replacement by setting // nSequence >= maxint-1 on all inputs. // // maxint-1 is picked to still allow use of nLockTime by // non-replacable transactions. All inputs rather than just one // is for the sake of multi-party protocols, where we don't // want a single party to be able to disable replacement. // // The opt-out ignores descendants as anyone relying on // first-seen mempool behavior should be checking all // unconfirmed ancestors anyway; doing otherwise is hopelessly // insecure. bool fReplacementOptOut = true; if (fEnableReplacement) { BOOST_FOREACH(const CTxIn &txin, ptxConflicting->vin) { if (txin.nSequence < std::numeric_limits<unsigned int>::max()-1) { fReplacementOptOut = false; break; } } } if (fReplacementOptOut) return state.Invalid(false, REJECT_CONFLICT, "txn-mempool-conflict"); setConflicts.insert(ptxConflicting->GetHash()); } } } } { CCoinsView dummy; CCoinsViewCache view(&dummy); CAmount nValueIn = 0; { LOCK(pool.cs); CCoinsViewMemPool viewMemPool(pcoinsTip, pool); view.SetBackend(viewMemPool); // do we already have it? bool fHadTxInCache = pcoinsTip->HaveCoinsInCache(hash); if (view.HaveCoins(hash)) { if (!fHadTxInCache) vHashTxnToUncache.push_back(hash); return state.Invalid(false, REJECT_ALREADY_KNOWN, "txn-already-known"); } // do all inputs exist? // Note that this does not check for the presence of actual outputs (see the next check for that), // and only helps with filling in pfMissingInputs (to determine missing vs spent). BOOST_FOREACH(const CTxIn txin, tx.vin) { if (!pcoinsTip->HaveCoinsInCache(txin.prevout.hash)) vHashTxnToUncache.push_back(txin.prevout.hash); if (!view.HaveCoins(txin.prevout.hash)) { if (pfMissingInputs) *pfMissingInputs = true; return false; // fMissingInputs and !state.IsInvalid() is used to detect this condition, don't set state.Invalid() } } // are the actual inputs available? if (!view.HaveInputs(tx)) return state.Invalid(false, REJECT_DUPLICATE, "bad-txns-inputs-spent"); // Bring the best block into scope view.GetBestBlock(); nValueIn = view.GetValueIn(tx); // we have all inputs cached now, so switch back to dummy, so we don't need to keep lock on mempool view.SetBackend(dummy); } // Check for non-standard pay-to-script-hash in inputs if (fRequireStandard && !AreInputsStandard(tx, view)) return state.Invalid(false, REJECT_NONSTANDARD, "bad-txns-nonstandard-inputs"); unsigned int nSigOps = GetLegacySigOpCount(tx); nSigOps += GetP2SHSigOpCount(tx, view); CAmount nValueOut = tx.GetValueOut(); CAmount nFees = nValueIn-nValueOut; // nModifiedFees includes any fee deltas from PrioritiseTransaction CAmount nModifiedFees = nFees; double nPriorityDummy = 0; pool.ApplyDeltas(hash, nPriorityDummy, nModifiedFees); CAmount inChainInputValue; double dPriority = view.GetPriority(tx, chainActive.Height(), inChainInputValue); // Keep track of transactions that spend a coinbase, which we re-scan // during reorgs to ensure COINBASE_MATURITY is still met. bool fSpendsCoinbase = false; BOOST_FOREACH(const CTxIn &txin, tx.vin) { const CCoins *coins = view.AccessCoins(txin.prevout.hash); if (coins->IsCoinBase()) { fSpendsCoinbase = true; break; } } CTxMemPoolEntry entry(tx, nFees, GetTime(), dPriority, chainActive.Height(), pool.HasNoInputsOf(tx), inChainInputValue, fSpendsCoinbase, nSigOps); unsigned int nSize = entry.GetTxSize(); // Check that the transaction doesn't have an excessive number of // sigops, making it impossible to mine. Since the coinbase transaction // itself can contain sigops MAX_STANDARD_TX_SIGOPS is less than // MAX_BLOCK_SIGOPS; we still consider this an invalid rather than // merely non-standard transaction. if ((nSigOps > MAX_STANDARD_TX_SIGOPS) || (nBytesPerSigOp && nSigOps > nSize / nBytesPerSigOp)) return state.DoS(0, false, REJECT_NONSTANDARD, "bad-txns-too-many-sigops", false, strprintf("%d", nSigOps)); CAmount mempoolRejectFee = pool.GetMinFee(GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000).GetFee(nSize); if (mempoolRejectFee > 0 && nModifiedFees < mempoolRejectFee) { return state.DoS(0, false, REJECT_INSUFFICIENTFEE, "mempool min fee not met", false, strprintf("%d < %d", nFees, mempoolRejectFee)); } else if (GetBoolArg("-relaypriority", DEFAULT_RELAYPRIORITY) && nModifiedFees < ::minRelayTxFee.GetFee(nSize) && !AllowFree(entry.GetPriority(chainActive.Height() + 1))) { // Require that free transactions have sufficient priority to be mined in the next block. return state.DoS(0, false, REJECT_INSUFFICIENTFEE, "insufficient priority"); } // Continuously rate-limit free (really, very-low-fee) transactions // This mitigates 'penny-flooding' -- sending thousands of free transactions just to // be annoying or make others' transactions take longer to confirm. if (fLimitFree && nModifiedFees < ::minRelayTxFee.GetFee(nSize)) { static CCriticalSection csFreeLimiter; static double dFreeCount; static int64_t nLastTime; int64_t nNow = GetTime(); LOCK(csFreeLimiter); // Use an exponentially decaying ~10-minute window: dFreeCount *= pow(1.0 - 1.0/600.0, (double)(nNow - nLastTime)); nLastTime = nNow; // -limitfreerelay unit is thousand-bytes-per-minute // At default rate it would take over a month to fill 1GB if (dFreeCount + nSize >= GetArg("-limitfreerelay", DEFAULT_LIMITFREERELAY) * 10 * 1000) return state.DoS(0, false, REJECT_INSUFFICIENTFEE, "rate limited free transaction"); LogPrint("mempool", "Rate limit dFreeCount: %g => %g\n", dFreeCount, dFreeCount+nSize); dFreeCount += nSize; } if (nAbsurdFee && nFees > nAbsurdFee) return state.Invalid(false, REJECT_HIGHFEE, "absurdly-high-fee", strprintf("%d > %d", nFees, nAbsurdFee)); // Calculate in-mempool ancestors, up to a limit. CTxMemPool::setEntries setAncestors; size_t nLimitAncestors = GetArg("-limitancestorcount", DEFAULT_ANCESTOR_LIMIT); size_t nLimitAncestorSize = GetArg("-limitancestorsize", DEFAULT_ANCESTOR_SIZE_LIMIT)*1000; size_t nLimitDescendants = GetArg("-limitdescendantcount", DEFAULT_DESCENDANT_LIMIT); size_t nLimitDescendantSize = GetArg("-limitdescendantsize", DEFAULT_DESCENDANT_SIZE_LIMIT)*1000; std::string errString; if (!pool.CalculateMemPoolAncestors(entry, setAncestors, nLimitAncestors, nLimitAncestorSize, nLimitDescendants, nLimitDescendantSize, errString)) { return state.DoS(0, false, REJECT_NONSTANDARD, "too-long-mempool-chain", false, errString); } // A transaction that spends outputs that would be replaced by it is invalid. Now // that we have the set of all ancestors we can detect this // pathological case by making sure setConflicts and setAncestors don't // intersect. BOOST_FOREACH(CTxMemPool::txiter ancestorIt, setAncestors) { const uint256 &hashAncestor = ancestorIt->GetTx().GetHash(); if (setConflicts.count(hashAncestor)) { return state.DoS(10, error("AcceptToMemoryPool: %s spends conflicting transaction %s", hash.ToString(), hashAncestor.ToString()), REJECT_INVALID, "bad-txns-spends-conflicting-tx"); } } // Check if it's economically rational to mine this transaction rather // than the ones it replaces. CAmount nConflictingFees = 0; size_t nConflictingSize = 0; uint64_t nConflictingCount = 0; CTxMemPool::setEntries allConflicting; // If we don't hold the lock allConflicting might be incomplete; the // subsequent RemoveStaged() and addUnchecked() calls don't guarantee // mempool consistency for us. LOCK(pool.cs); if (setConflicts.size()) { CFeeRate newFeeRate(nModifiedFees, nSize); set<uint256> setConflictsParents; const int maxDescendantsToVisit = 100; CTxMemPool::setEntries setIterConflicting; BOOST_FOREACH(const uint256 &hashConflicting, setConflicts) { CTxMemPool::txiter mi = pool.mapTx.find(hashConflicting); if (mi == pool.mapTx.end()) continue; // Save these to avoid repeated lookups setIterConflicting.insert(mi); // If this entry is "dirty", then we don't have descendant // state for this transaction, which means we probably have // lots of in-mempool descendants. // Don't allow replacements of dirty transactions, to ensure // that we don't spend too much time walking descendants. // This should be rare. if (mi->IsDirty()) { return state.DoS(0, error("AcceptToMemoryPool: rejecting replacement %s; cannot replace tx %s with untracked descendants", hash.ToString(), mi->GetTx().GetHash().ToString()), REJECT_NONSTANDARD, "too many potential replacements"); } // Don't allow the replacement to reduce the feerate of the // mempool. // // We usually don't want to accept replacements with lower // feerates than what they replaced as that would lower the // feerate of the next block. Requiring that the feerate always // be increased is also an easy-to-reason about way to prevent // DoS attacks via replacements. // // The mining code doesn't (currently) take children into // account (CPFP) so we only consider the feerates of // transactions being directly replaced, not their indirect // descendants. While that does mean high feerate children are // ignored when deciding whether or not to replace, we do // require the replacement to pay more overall fees too, // mitigating most cases. CFeeRate oldFeeRate(mi->GetModifiedFee(), mi->GetTxSize()); if (newFeeRate <= oldFeeRate) { return state.DoS(0, error("AcceptToMemoryPool: rejecting replacement %s; new feerate %s <= old feerate %s", hash.ToString(), newFeeRate.ToString(), oldFeeRate.ToString()), REJECT_INSUFFICIENTFEE, "insufficient fee"); } BOOST_FOREACH(const CTxIn &txin, mi->GetTx().vin) { setConflictsParents.insert(txin.prevout.hash); } nConflictingCount += mi->GetCountWithDescendants(); } // This potentially overestimates the number of actual descendants // but we just want to be conservative to avoid doing too much // work. if (nConflictingCount <= maxDescendantsToVisit) { // If not too many to replace, then calculate the set of // transactions that would have to be evicted BOOST_FOREACH(CTxMemPool::txiter it, setIterConflicting) { pool.CalculateDescendants(it, allConflicting); } BOOST_FOREACH(CTxMemPool::txiter it, allConflicting) { nConflictingFees += it->GetModifiedFee(); nConflictingSize += it->GetTxSize(); } } else { return state.DoS(0, error("AcceptToMemoryPool: rejecting replacement %s; too many potential replacements (%d > %d)\n", hash.ToString(), nConflictingCount, maxDescendantsToVisit), REJECT_NONSTANDARD, "too many potential replacements"); } for (unsigned int j = 0; j < tx.vin.size(); j++) { // We don't want to accept replacements that require low // feerate junk to be mined first. Ideally we'd keep track of // the ancestor feerates and make the decision based on that, // but for now requiring all new inputs to be confirmed works. if (!setConflictsParents.count(tx.vin[j].prevout.hash)) { // Rather than check the UTXO set - potentially expensive - // it's cheaper to just check if the new input refers to a // tx that's in the mempool. if (pool.mapTx.find(tx.vin[j].prevout.hash) != pool.mapTx.end()) return state.DoS(0, error("AcceptToMemoryPool: replacement %s adds unconfirmed input, idx %d", hash.ToString(), j), REJECT_NONSTANDARD, "replacement-adds-unconfirmed"); } } // The replacement must pay greater fees than the transactions it // replaces - if we did the bandwidth used by those conflicting // transactions would not be paid for. if (nModifiedFees < nConflictingFees) { return state.DoS(0, error("AcceptToMemoryPool: rejecting replacement %s, less fees than conflicting txs; %s < %s", hash.ToString(), FormatMoney(nModifiedFees), FormatMoney(nConflictingFees)), REJECT_INSUFFICIENTFEE, "insufficient fee"); } // Finally in addition to paying more fees than the conflicts the // new transaction must pay for its own bandwidth. CAmount nDeltaFees = nModifiedFees - nConflictingFees; if (nDeltaFees < ::minRelayTxFee.GetFee(nSize)) { return state.DoS(0, error("AcceptToMemoryPool: rejecting replacement %s, not enough additional fees to relay; %s < %s", hash.ToString(), FormatMoney(nDeltaFees), FormatMoney(::minRelayTxFee.GetFee(nSize))), REJECT_INSUFFICIENTFEE, "insufficient fee"); } } // Check against previous transactions // This is done last to help prevent CPU exhaustion denial-of-service attacks. if (!CheckInputs(tx, state, view, true, STANDARD_SCRIPT_VERIFY_FLAGS, true)) return error("%s: CheckInputs: %s, %s", __func__, hash.ToString(), FormatStateMessage(state)); // Check again against just the consensus-critical mandatory script // verification flags, in case of bugs in the standard flags that cause // transactions to pass as valid when they're actually invalid. For // instance the STRICTENC flag was incorrectly allowing certain // CHECKSIG NOT scripts to pass, even though they were invalid. // // There is a similar check in CreateNewBlock() to prevent creating // invalid blocks, however allowing such transactions into the mempool // can be exploited as a DoS attack. if (!CheckInputs(tx, state, view, true, MANDATORY_SCRIPT_VERIFY_FLAGS, true)) { return error("%s: BUG! PLEASE REPORT THIS! ConnectInputs failed against MANDATORY but not STANDARD flags %s, %s", __func__, hash.ToString(), FormatStateMessage(state)); } // Remove conflicting transactions from the mempool BOOST_FOREACH(const CTxMemPool::txiter it, allConflicting) { LogPrint("mempool", "replacing tx %s with %s for %s BTC additional fees, %d delta bytes\n", it->GetTx().GetHash().ToString(), hash.ToString(), FormatMoney(nModifiedFees - nConflictingFees), (int)nSize - (int)nConflictingSize); } pool.RemoveStaged(allConflicting); // Store transaction in memory pool.addUnchecked(hash, entry, setAncestors, !IsInitialBlockDownload()); // trim mempool and check if tx was trimmed if (!fOverrideMempoolLimit) { LimitMempoolSize(pool, GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000, GetArg("-mempoolexpiry", DEFAULT_MEMPOOL_EXPIRY) * 60 * 60); if (!pool.exists(hash)) return state.DoS(0, false, REJECT_INSUFFICIENTFEE, "mempool full"); } } SyncWithWallets(tx, NULL, NULL); return true; } bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransaction &tx, bool fLimitFree, bool* pfMissingInputs, bool fOverrideMempoolLimit, const CAmount nAbsurdFee) { std::vector<uint256> vHashTxToUncache; bool res = AcceptToMemoryPoolWorker(pool, state, tx, fLimitFree, pfMissingInputs, fOverrideMempoolLimit, nAbsurdFee, vHashTxToUncache); if (!res) { BOOST_FOREACH(const uint256& hashTx, vHashTxToUncache) pcoinsTip->Uncache(hashTx); } return res; } /** Return transaction in tx, and if it was found inside a block, its hash is placed in hashBlock */ bool GetTransaction(const uint256 &hash, CTransaction &txOut, const Consensus::Params& consensusParams, uint256 &hashBlock, bool fAllowSlow) { CBlockIndex *pindexSlow = NULL; LOCK(cs_main); if (mempool.lookup(hash, txOut)) { return true; } if (fTxIndex) { CDiskTxPos postx; if (pblocktree->ReadTxIndex(hash, postx)) { CAutoFile file(OpenBlockFile(postx, true), SER_DISK, CLIENT_VERSION); if (file.IsNull()) return error("%s: OpenBlockFile failed", __func__); CBlockHeader header; try { file >> header; fseek(file.Get(), postx.nTxOffset, SEEK_CUR); file >> txOut; } catch (const std::exception& e) { return error("%s: Deserialize or I/O error - %s", __func__, e.what()); } hashBlock = header.GetHash(); if (txOut.GetHash() != hash) return error("%s: txid mismatch", __func__); return true; } } if (fAllowSlow) { // use coin database to locate block that contains transaction, and scan it int nHeight = -1; { CCoinsViewCache &view = *pcoinsTip; const CCoins* coins = view.AccessCoins(hash); if (coins) nHeight = coins->nHeight; } if (nHeight > 0) pindexSlow = chainActive[nHeight]; } if (pindexSlow) { CBlock block; if (ReadBlockFromDisk(block, pindexSlow, consensusParams)) { BOOST_FOREACH(const CTransaction &tx, block.vtx) { if (tx.GetHash() == hash) { txOut = tx; hashBlock = pindexSlow->GetBlockHash(); return true; } } } } return false; } ////////////////////////////////////////////////////////////////////////////// // // CBlock and CBlockIndex // bool WriteBlockToDisk(const CBlock& block, CDiskBlockPos& pos, const CMessageHeader::MessageStartChars& messageStart) { // Open history file to append CAutoFile fileout(OpenBlockFile(pos), SER_DISK, CLIENT_VERSION); if (fileout.IsNull()) return error("WriteBlockToDisk: OpenBlockFile failed"); // Write index header unsigned int nSize = fileout.GetSerializeSize(block); fileout << FLATDATA(messageStart) << nSize; // Write block long fileOutPos = ftell(fileout.Get()); if (fileOutPos < 0) return error("WriteBlockToDisk: ftell failed"); pos.nPos = (unsigned int)fileOutPos; fileout << block; return true; } bool ReadBlockFromDisk(CBlock& block, const CDiskBlockPos& pos, const Consensus::Params& consensusParams) { block.SetNull(); // Open history file to read CAutoFile filein(OpenBlockFile(pos, true), SER_DISK, CLIENT_VERSION); if (filein.IsNull()) return error("ReadBlockFromDisk: OpenBlockFile failed for %s", pos.ToString()); // Read block try { filein >> block; } catch (const std::exception& e) { return error("%s: Deserialize or I/O error - %s at %s", __func__, e.what(), pos.ToString()); } // Check the header if (!CheckProofOfWork(block.GetHash(), block.nBits, consensusParams)) return error("ReadBlockFromDisk: Errors in block header at %s", pos.ToString()); return true; } bool ReadBlockFromDisk(CBlock& block, const CBlockIndex* pindex, const Consensus::Params& consensusParams) { if (!ReadBlockFromDisk(block, pindex->GetBlockPos(), consensusParams)) return false; if (block.GetHash() != pindex->GetBlockHash()) return error("ReadBlockFromDisk(CBlock&, CBlockIndex*): GetHash() doesn't match index for %s at %s", pindex->ToString(), pindex->GetBlockPos().ToString()); return true; } CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams) { int halvings = nHeight / consensusParams.nSubsidyHalvingInterval; // Force block reward to zero when right shift is undefined. if (halvings >= 64) return 0; CAmount nSubsidy = 50 * COIN; // Subsidy is cut in half every 210,000 blocks which will occur approximately every 4 years. nSubsidy >>= halvings; return nSubsidy; } bool IsInitialBlockDownload() { const CChainParams& chainParams = Params(); LOCK(cs_main); if (fImporting || fReindex) return true; if (fCheckpointsEnabled && chainActive.Height() < Checkpoints::GetTotalBlocksEstimate(chainParams.Checkpoints())) return true; static bool lockIBDState = false; if (lockIBDState) return false; bool state = (chainActive.Height() < pindexBestHeader->nHeight - 24 * 6 || pindexBestHeader->GetBlockTime() < GetTime() - nMaxTipAge); if (!state) lockIBDState = true; return state; } bool fLargeWorkForkFound = false; bool fLargeWorkInvalidChainFound = false; CBlockIndex *pindexBestForkTip = NULL, *pindexBestForkBase = NULL; void CheckForkWarningConditions() { AssertLockHeld(cs_main); // Before we get past initial download, we cannot reliably alert about forks // (we assume we don't get stuck on a fork before the last checkpoint) if (IsInitialBlockDownload()) return; // If our best fork is no longer within 72 blocks (+/- 12 hours if no one mines it) // of our head, drop it if (pindexBestForkTip && chainActive.Height() - pindexBestForkTip->nHeight >= 72) pindexBestForkTip = NULL; if (pindexBestForkTip || (pindexBestInvalid && pindexBestInvalid->nChainWork > chainActive.Tip()->nChainWork + (GetBlockProof(*chainActive.Tip()) * 6))) { if (!fLargeWorkForkFound && pindexBestForkBase) { std::string warning = std::string("'Warning: Large-work fork detected, forking after block ") + pindexBestForkBase->phashBlock->ToString() + std::string("'"); CAlert::Notify(warning, true); } if (pindexBestForkTip && pindexBestForkBase) { LogPrintf("%s: Warning: Large valid fork found\n forking the chain at height %d (%s)\n lasting to height %d (%s).\nChain state database corruption likely.\n", __func__, pindexBestForkBase->nHeight, pindexBestForkBase->phashBlock->ToString(), pindexBestForkTip->nHeight, pindexBestForkTip->phashBlock->ToString()); fLargeWorkForkFound = true; } else { LogPrintf("%s: Warning: Found invalid chain at least ~6 blocks longer than our best chain.\nChain state database corruption likely.\n", __func__); fLargeWorkInvalidChainFound = true; } } else { fLargeWorkForkFound = false; fLargeWorkInvalidChainFound = false; } } void CheckForkWarningConditionsOnNewFork(CBlockIndex* pindexNewForkTip) { AssertLockHeld(cs_main); // If we are on a fork that is sufficiently large, set a warning flag CBlockIndex* pfork = pindexNewForkTip; CBlockIndex* plonger = chainActive.Tip(); while (pfork && pfork != plonger) { while (plonger && plonger->nHeight > pfork->nHeight) plonger = plonger->pprev; if (pfork == plonger) break; pfork = pfork->pprev; } // We define a condition where we should warn the user about as a fork of at least 7 blocks // with a tip within 72 blocks (+/- 12 hours if no one mines it) of ours // We use 7 blocks rather arbitrarily as it represents just under 10% of sustained network // hash rate operating on the fork. // or a chain that is entirely longer than ours and invalid (note that this should be detected by both) // We define it this way because it allows us to only store the highest fork tip (+ base) which meets // the 7-block condition and from this always have the most-likely-to-cause-warning fork if (pfork && (!pindexBestForkTip || (pindexBestForkTip && pindexNewForkTip->nHeight > pindexBestForkTip->nHeight)) && pindexNewForkTip->nChainWork - pfork->nChainWork > (GetBlockProof(*pfork) * 7) && chainActive.Height() - pindexNewForkTip->nHeight < 72) { pindexBestForkTip = pindexNewForkTip; pindexBestForkBase = pfork; } CheckForkWarningConditions(); } // Requires cs_main. void Misbehaving(NodeId pnode, int howmuch) { if (howmuch == 0) return; CNodeState *state = State(pnode); if (state == NULL) return; state->nMisbehavior += howmuch; int banscore = GetArg("-banscore", DEFAULT_BANSCORE_THRESHOLD); if (state->nMisbehavior >= banscore && state->nMisbehavior - howmuch < banscore) { LogPrintf("%s: %s (%d -> %d) BAN THRESHOLD EXCEEDED\n", __func__, state->name, state->nMisbehavior-howmuch, state->nMisbehavior); state->fShouldBan = true; } else LogPrintf("%s: %s (%d -> %d)\n", __func__, state->name, state->nMisbehavior-howmuch, state->nMisbehavior); } void static InvalidChainFound(CBlockIndex* pindexNew) { if (!pindexBestInvalid || pindexNew->nChainWork > pindexBestInvalid->nChainWork) pindexBestInvalid = pindexNew; LogPrintf("%s: invalid block=%s height=%d log2_work=%.8g date=%s\n", __func__, pindexNew->GetBlockHash().ToString(), pindexNew->nHeight, log(pindexNew->nChainWork.getdouble())/log(2.0), DateTimeStrFormat("%Y-%m-%d %H:%M:%S", pindexNew->GetBlockTime())); CBlockIndex *tip = chainActive.Tip(); assert (tip); LogPrintf("%s: current best=%s height=%d log2_work=%.8g date=%s\n", __func__, tip->GetBlockHash().ToString(), chainActive.Height(), log(tip->nChainWork.getdouble())/log(2.0), DateTimeStrFormat("%Y-%m-%d %H:%M:%S", tip->GetBlockTime())); CheckForkWarningConditions(); } void static InvalidBlockFound(CBlockIndex *pindex, const CValidationState &state) { int nDoS = 0; if (state.IsInvalid(nDoS)) { std::map<uint256, NodeId>::iterator it = mapBlockSource.find(pindex->GetBlockHash()); if (it != mapBlockSource.end() && State(it->second)) { assert (state.GetRejectCode() < REJECT_INTERNAL); // Blocks are never rejected with internal reject codes CBlockReject reject = {(unsigned char)state.GetRejectCode(), state.GetRejectReason().substr(0, MAX_REJECT_MESSAGE_LENGTH), pindex->GetBlockHash()}; State(it->second)->rejects.push_back(reject); if (nDoS > 0) Misbehaving(it->second, nDoS); } } if (!state.CorruptionPossible()) { pindex->nStatus |= BLOCK_FAILED_VALID; setDirtyBlockIndex.insert(pindex); setBlockIndexCandidates.erase(pindex); InvalidChainFound(pindex); } } void UpdateCoins(const CTransaction& tx, CValidationState &state, CCoinsViewCache &inputs, CTxUndo &txundo, int nHeight) { // mark inputs spent if (!tx.IsCoinBase()) { txundo.vprevout.reserve(tx.vin.size()); BOOST_FOREACH(const CTxIn &txin, tx.vin) { CCoinsModifier coins = inputs.ModifyCoins(txin.prevout.hash); unsigned nPos = txin.prevout.n; if (nPos >= coins->vout.size() || coins->vout[nPos].IsNull()) assert(false); // mark an outpoint spent, and construct undo information txundo.vprevout.push_back(CTxInUndo(coins->vout[nPos])); coins->Spend(nPos); if (coins->vout.size() == 0) { CTxInUndo& undo = txundo.vprevout.back(); undo.nHeight = coins->nHeight; undo.fCoinBase = coins->fCoinBase; undo.nVersion = coins->nVersion; } } } // add outputs inputs.ModifyNewCoins(tx.GetHash(), tx.IsCoinBase())->FromTx(tx, nHeight); } void UpdateCoins(const CTransaction& tx, CValidationState &state, CCoinsViewCache &inputs, int nHeight) { CTxUndo txundo; UpdateCoins(tx, state, inputs, txundo, nHeight); } bool CScriptCheck::operator()() { const CScript &scriptSig = ptxTo->vin[nIn].scriptSig; if (!VerifyScript(scriptSig, scriptPubKey, nFlags, CachingTransactionSignatureChecker(ptxTo, nIn, cacheStore), &error)) { return false; } return true; } int GetSpendHeight(const CCoinsViewCache& inputs) { LOCK(cs_main); CBlockIndex* pindexPrev = mapBlockIndex.find(inputs.GetBestBlock())->second; return pindexPrev->nHeight + 1; } namespace Consensus { bool CheckTxInputs(const CTransaction& tx, CValidationState& state, const CCoinsViewCache& inputs, int nSpendHeight) { // This doesn't trigger the DoS code on purpose; if it did, it would make it easier // for an attacker to attempt to split the network. if (!inputs.HaveInputs(tx)) return state.Invalid(false, 0, "", "Inputs unavailable"); CAmount nValueIn = 0; CAmount nFees = 0; for (unsigned int i = 0; i < tx.vin.size(); i++) { const COutPoint &prevout = tx.vin[i].prevout; const CCoins *coins = inputs.AccessCoins(prevout.hash); assert(coins); // If prev is coinbase, check that it's matured if (coins->IsCoinBase()) { if (nSpendHeight - coins->nHeight < COINBASE_MATURITY) return state.Invalid(false, REJECT_INVALID, "bad-txns-premature-spend-of-coinbase", strprintf("tried to spend coinbase at depth %d", nSpendHeight - coins->nHeight)); } // Check for negative or overflow input values nValueIn += coins->vout[prevout.n].nValue; if (!MoneyRange(coins->vout[prevout.n].nValue) || !MoneyRange(nValueIn)) return state.DoS(100, false, REJECT_INVALID, "bad-txns-inputvalues-outofrange"); } if (nValueIn < tx.GetValueOut()) return state.DoS(100, false, REJECT_INVALID, "bad-txns-in-belowout", false, strprintf("value in (%s) < value out (%s)", FormatMoney(nValueIn), FormatMoney(tx.GetValueOut()))); // Tally transaction fees CAmount nTxFee = nValueIn - tx.GetValueOut(); if (nTxFee < 0) return state.DoS(100, false, REJECT_INVALID, "bad-txns-fee-negative"); nFees += nTxFee; if (!MoneyRange(nFees)) return state.DoS(100, false, REJECT_INVALID, "bad-txns-fee-outofrange"); return true; } }// namespace Consensus bool CheckInputs(const CTransaction& tx, CValidationState &state, const CCoinsViewCache &inputs, bool fScriptChecks, unsigned int flags, bool cacheStore, std::vector<CScriptCheck> *pvChecks) { if (!tx.IsCoinBase()) { if (!Consensus::CheckTxInputs(tx, state, inputs, GetSpendHeight(inputs))) return false; if (pvChecks) pvChecks->reserve(tx.vin.size()); // The first loop above does all the inexpensive checks. // Only if ALL inputs pass do we perform expensive ECDSA signature checks. // Helps prevent CPU exhaustion attacks. // Skip ECDSA signature verification when connecting blocks before the // last block chain checkpoint. Assuming the checkpoints are valid this // is safe because block merkle hashes are still computed and checked, // and any change will be caught at the next checkpoint. Of course, if // the checkpoint is for a chain that's invalid due to false scriptSigs // this optimisation would allow an invalid chain to be accepted. if (fScriptChecks) { for (unsigned int i = 0; i < tx.vin.size(); i++) { const COutPoint &prevout = tx.vin[i].prevout; const CCoins* coins = inputs.AccessCoins(prevout.hash); assert(coins); // Verify signature CScriptCheck check(*coins, tx, i, flags, cacheStore); if (pvChecks) { pvChecks->push_back(CScriptCheck()); check.swap(pvChecks->back()); } else if (!check()) { if (flags & STANDARD_NOT_MANDATORY_VERIFY_FLAGS) { // Check whether the failure was caused by a // non-mandatory script verification check, such as // non-standard DER encodings or non-null dummy // arguments; if so, don't trigger DoS protection to // avoid splitting the network between upgraded and // non-upgraded nodes. CScriptCheck check2(*coins, tx, i, flags & ~STANDARD_NOT_MANDATORY_VERIFY_FLAGS, cacheStore); if (check2()) return state.Invalid(false, REJECT_NONSTANDARD, strprintf("non-mandatory-script-verify-flag (%s)", ScriptErrorString(check.GetScriptError()))); } // Failures of other flags indicate a transaction that is // invalid in new blocks, e.g. a invalid P2SH. We DoS ban // such nodes as they are not following the protocol. That // said during an upgrade careful thought should be taken // as to the correct behavior - we may want to continue // peering with non-upgraded nodes even after a soft-fork // super-majority vote has passed. return state.DoS(100,false, REJECT_INVALID, strprintf("mandatory-script-verify-flag-failed (%s)", ScriptErrorString(check.GetScriptError()))); } } } } return true; } namespace { bool UndoWriteToDisk(const CBlockUndo& blockundo, CDiskBlockPos& pos, const uint256& hashBlock, const CMessageHeader::MessageStartChars& messageStart) { // Open history file to append CAutoFile fileout(OpenUndoFile(pos), SER_DISK, CLIENT_VERSION); if (fileout.IsNull()) return error("%s: OpenUndoFile failed", __func__); // Write index header unsigned int nSize = fileout.GetSerializeSize(blockundo); fileout << FLATDATA(messageStart) << nSize; // Write undo data long fileOutPos = ftell(fileout.Get()); if (fileOutPos < 0) return error("%s: ftell failed", __func__); pos.nPos = (unsigned int)fileOutPos; fileout << blockundo; // calculate & write checksum CHashWriter hasher(SER_GETHASH, PROTOCOL_VERSION); hasher << hashBlock; hasher << blockundo; fileout << hasher.GetHash(); return true; } bool UndoReadFromDisk(CBlockUndo& blockundo, const CDiskBlockPos& pos, const uint256& hashBlock) { // Open history file to read CAutoFile filein(OpenUndoFile(pos, true), SER_DISK, CLIENT_VERSION); if (filein.IsNull()) return error("%s: OpenBlockFile failed", __func__); // Read block uint256 hashChecksum; try { filein >> blockundo; filein >> hashChecksum; } catch (const std::exception& e) { return error("%s: Deserialize or I/O error - %s", __func__, e.what()); } // Verify checksum CHashWriter hasher(SER_GETHASH, PROTOCOL_VERSION); hasher << hashBlock; hasher << blockundo; if (hashChecksum != hasher.GetHash()) return error("%s: Checksum mismatch", __func__); return true; } /** Abort with a message */ bool AbortNode(const std::string& strMessage, const std::string& userMessage="") { strMiscWarning = strMessage; LogPrintf("*** %s\n", strMessage); uiInterface.ThreadSafeMessageBox( userMessage.empty() ? _("Error: A fatal internal error occurred, see debug.log for details") : userMessage, "", CClientUIInterface::MSG_ERROR); StartShutdown(); return false; } bool AbortNode(CValidationState& state, const std::string& strMessage, const std::string& userMessage="") { AbortNode(strMessage, userMessage); return state.Error(strMessage); } } // anon namespace /** * Apply the undo operation of a CTxInUndo to the given chain state. * @param undo The undo object. * @param view The coins view to which to apply the changes. * @param out The out point that corresponds to the tx input. * @return True on success. */ static bool ApplyTxInUndo(const CTxInUndo& undo, CCoinsViewCache& view, const COutPoint& out) { bool fClean = true; CCoinsModifier coins = view.ModifyCoins(out.hash); if (undo.nHeight != 0) { // undo data contains height: this is the last output of the prevout tx being spent if (!coins->IsPruned()) fClean = fClean && error("%s: undo data overwriting existing transaction", __func__); coins->Clear(); coins->fCoinBase = undo.fCoinBase; coins->nHeight = undo.nHeight; coins->nVersion = undo.nVersion; } else { if (coins->IsPruned()) fClean = fClean && error("%s: undo data adding output to missing transaction", __func__); } if (coins->IsAvailable(out.n)) fClean = fClean && error("%s: undo data overwriting existing output", __func__); if (coins->vout.size() < out.n+1) coins->vout.resize(out.n+1); coins->vout[out.n] = undo.txout; return fClean; } bool DisconnectBlock(const CBlock& block, CValidationState& state, const CBlockIndex* pindex, CCoinsViewCache& view, bool* pfClean) { assert(pindex->GetBlockHash() == view.GetBestBlock()); if (pfClean) *pfClean = false; bool fClean = true; CBlockUndo blockUndo; CDiskBlockPos pos = pindex->GetUndoPos(); if (pos.IsNull()) return error("DisconnectBlock(): no undo data available"); if (!UndoReadFromDisk(blockUndo, pos, pindex->pprev->GetBlockHash())) return error("DisconnectBlock(): failure reading undo data"); if (blockUndo.vtxundo.size() + 1 != block.vtx.size()) return error("DisconnectBlock(): block and undo data inconsistent"); // undo transactions in reverse order for (int i = block.vtx.size() - 1; i >= 0; i--) { const CTransaction &tx = block.vtx[i]; uint256 hash = tx.GetHash(); // Check that all outputs are available and match the outputs in the block itself // exactly. { CCoinsModifier outs = view.ModifyCoins(hash); outs->ClearUnspendable(); CCoins outsBlock(tx, pindex->nHeight); // The CCoins serialization does not serialize negative numbers. // No network rules currently depend on the version here, so an inconsistency is harmless // but it must be corrected before txout nversion ever influences a network rule. if (outsBlock.nVersion < 0) outs->nVersion = outsBlock.nVersion; if (*outs != outsBlock) fClean = fClean && error("DisconnectBlock(): added transaction mismatch? database corrupted"); // remove outputs outs->Clear(); } // restore inputs if (i > 0) { // not coinbases const CTxUndo &txundo = blockUndo.vtxundo[i-1]; if (txundo.vprevout.size() != tx.vin.size()) return error("DisconnectBlock(): transaction and undo data inconsistent"); for (unsigned int j = tx.vin.size(); j-- > 0;) { const COutPoint &out = tx.vin[j].prevout; const CTxInUndo &undo = txundo.vprevout[j]; if (!ApplyTxInUndo(undo, view, out)) fClean = false; } } } // move best block pointer to prevout block view.SetBestBlock(pindex->pprev->GetBlockHash()); if (pfClean) { *pfClean = fClean; return true; } return fClean; } void static FlushBlockFile(bool fFinalize = false) { LOCK(cs_LastBlockFile); CDiskBlockPos posOld(nLastBlockFile, 0); FILE *fileOld = OpenBlockFile(posOld); if (fileOld) { if (fFinalize) TruncateFile(fileOld, vinfoBlockFile[nLastBlockFile].nSize); FileCommit(fileOld); fclose(fileOld); } fileOld = OpenUndoFile(posOld); if (fileOld) { if (fFinalize) TruncateFile(fileOld, vinfoBlockFile[nLastBlockFile].nUndoSize); FileCommit(fileOld); fclose(fileOld); } } bool FindUndoPos(CValidationState &state, int nFile, CDiskBlockPos &pos, unsigned int nAddSize); static CCheckQueue<CScriptCheck> scriptcheckqueue(128); void ThreadScriptCheck() { RenameThread("bitcoin-scriptch"); scriptcheckqueue.Thread(); } // // Called periodically asynchronously; alerts if it smells like // we're being fed a bad chain (blocks being generated much // too slowly or too quickly). // void PartitionCheck(bool (*initialDownloadCheck)(), CCriticalSection& cs, const CBlockIndex *const &bestHeader, int64_t nPowTargetSpacing) { if (bestHeader == NULL || initialDownloadCheck()) return; static int64_t lastAlertTime = 0; int64_t now = GetAdjustedTime(); if (lastAlertTime > now-60*60*24) return; // Alert at most once per day const int SPAN_HOURS=4; const int SPAN_SECONDS=SPAN_HOURS*60*60; int BLOCKS_EXPECTED = SPAN_SECONDS / nPowTargetSpacing; boost::math::poisson_distribution<double> poisson(BLOCKS_EXPECTED); std::string strWarning; int64_t startTime = GetAdjustedTime()-SPAN_SECONDS; LOCK(cs); const CBlockIndex* i = bestHeader; int nBlocks = 0; while (i->GetBlockTime() >= startTime) { ++nBlocks; i = i->pprev; if (i == NULL) return; // Ran out of chain, we must not be fully sync'ed } // How likely is it to find that many by chance? double p = boost::math::pdf(poisson, nBlocks); LogPrint("partitioncheck", "%s: Found %d blocks in the last %d hours\n", __func__, nBlocks, SPAN_HOURS); LogPrint("partitioncheck", "%s: likelihood: %g\n", __func__, p); // Aim for one false-positive about every fifty years of normal running: const int FIFTY_YEARS = 50*365*24*60*60; double alertThreshold = 1.0 / (FIFTY_YEARS / SPAN_SECONDS); if (p <= alertThreshold && nBlocks < BLOCKS_EXPECTED) { // Many fewer blocks than expected: alert! strWarning = strprintf(_("WARNING: check your network connection, %d blocks received in the last %d hours (%d expected)"), nBlocks, SPAN_HOURS, BLOCKS_EXPECTED); } else if (p <= alertThreshold && nBlocks > BLOCKS_EXPECTED) { // Many more blocks than expected: alert! strWarning = strprintf(_("WARNING: abnormally high number of blocks generated, %d blocks received in the last %d hours (%d expected)"), nBlocks, SPAN_HOURS, BLOCKS_EXPECTED); } if (!strWarning.empty()) { strMiscWarning = strWarning; CAlert::Notify(strWarning, true); lastAlertTime = now; } } static int64_t nTimeCheck = 0; static int64_t nTimeForks = 0; static int64_t nTimeVerify = 0; static int64_t nTimeConnect = 0; static int64_t nTimeIndex = 0; static int64_t nTimeCallbacks = 0; static int64_t nTimeTotal = 0; bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pindex, CCoinsViewCache& view, bool fJustCheck) { const CChainParams& chainparams = Params(); AssertLockHeld(cs_main); int64_t nTimeStart = GetTimeMicros(); // Check it again in case a previous version let a bad block in if (!CheckBlock(block, state, !fJustCheck, !fJustCheck)) return error("%s: Consensus::CheckBlock: %s", __func__, FormatStateMessage(state)); // verify that the view's current state corresponds to the previous block uint256 hashPrevBlock = pindex->pprev == NULL ? uint256() : pindex->pprev->GetBlockHash(); assert(hashPrevBlock == view.GetBestBlock()); // Special case for the genesis block, skipping connection of its transactions // (its coinbase is unspendable) if (block.GetHash() == chainparams.GetConsensus().hashGenesisBlock) { if (!fJustCheck) view.SetBestBlock(pindex->GetBlockHash()); return true; } bool fScriptChecks = true; if (fCheckpointsEnabled) { CBlockIndex *pindexLastCheckpoint = Checkpoints::GetLastCheckpoint(chainparams.Checkpoints()); if (pindexLastCheckpoint && pindexLastCheckpoint->GetAncestor(pindex->nHeight) == pindex) { // This block is an ancestor of a checkpoint: disable script checks fScriptChecks = false; } } int64_t nTime1 = GetTimeMicros(); nTimeCheck += nTime1 - nTimeStart; LogPrint("bench", " - Sanity checks: %.2fms [%.2fs]\n", 0.001 * (nTime1 - nTimeStart), nTimeCheck * 0.000001); // Do not allow blocks that contain transactions which 'overwrite' older transactions, // unless those are already completely spent. // If such overwrites are allowed, coinbases and transactions depending upon those // can be duplicated to remove the ability to spend the first instance -- even after // being sent to another address. // See BIP30 and http://r6.ca/blog/20120206T005236Z.html for more information. // This logic is not necessary for memory pool transactions, as AcceptToMemoryPool // already refuses previously-known transaction ids entirely. // This rule was originally applied to all blocks with a timestamp after March 15, 2012, 0:00 UTC. // Now that the whole chain is irreversibly beyond that time it is applied to all blocks except the // two in the chain that violate it. This prevents exploiting the issue against nodes during their // initial block download. bool fEnforceBIP30 = (!pindex->phashBlock) || // Enforce on CreateNewBlock invocations which don't have a hash. !((pindex->nHeight==91842 && pindex->GetBlockHash() == uint256S("0x00000000000a4d0a398161ffc163c503763b1f4360639393e0e4c8e300e0caec")) || (pindex->nHeight==91880 && pindex->GetBlockHash() == uint256S("0x00000000000743f190a18c5577a3c2d2a1f610ae9601ac046a38084ccb7cd721"))); // Once BIP34 activated it was not possible to create new duplicate coinbases and thus other than starting // with the 2 existing duplicate coinbase pairs, not possible to create overwriting txs. But by the // time BIP34 activated, in each of the existing pairs the duplicate coinbase had overwritten the first // before the first had been spent. Since those coinbases are sufficiently buried its no longer possible to create further // duplicate transactions descending from the known pairs either. // If we're on the known chain at height greater than where BIP34 activated, we can save the db accesses needed for the BIP30 check. CBlockIndex *pindexBIP34height = pindex->pprev->GetAncestor(chainparams.GetConsensus().BIP34Height); //Only continue to enforce if we're below BIP34 activation height or the block hash at that height doesn't correspond. fEnforceBIP30 = fEnforceBIP30 && (!pindexBIP34height || !(pindexBIP34height->GetBlockHash() == chainparams.GetConsensus().BIP34Hash)); if (fEnforceBIP30) { BOOST_FOREACH(const CTransaction& tx, block.vtx) { const CCoins* coins = view.AccessCoins(tx.GetHash()); if (coins && !coins->IsPruned()) return state.DoS(100, error("ConnectBlock(): tried to overwrite transaction"), REJECT_INVALID, "bad-txns-BIP30"); } } // BIP16 didn't become active until Apr 1 2012 int64_t nBIP16SwitchTime = 1333238400; bool fStrictPayToScriptHash = (pindex->GetBlockTime() >= nBIP16SwitchTime); unsigned int flags = fStrictPayToScriptHash ? SCRIPT_VERIFY_P2SH : SCRIPT_VERIFY_NONE; // Start enforcing the DERSIG (BIP66) rules, for block.nVersion=3 blocks, // when 75% of the network has upgraded: if (block.nVersion >= 3 && IsSuperMajority(3, pindex->pprev, chainparams.GetConsensus().nMajorityEnforceBlockUpgrade, chainparams.GetConsensus())) { flags |= SCRIPT_VERIFY_DERSIG; } // Start enforcing CHECKLOCKTIMEVERIFY, (BIP65) for block.nVersion=4 // blocks, when 75% of the network has upgraded: if (block.nVersion >= 4 && IsSuperMajority(4, pindex->pprev, chainparams.GetConsensus().nMajorityEnforceBlockUpgrade, chainparams.GetConsensus())) { flags |= SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY; } int64_t nTime2 = GetTimeMicros(); nTimeForks += nTime2 - nTime1; LogPrint("bench", " - Fork checks: %.2fms [%.2fs]\n", 0.001 * (nTime2 - nTime1), nTimeForks * 0.000001); CBlockUndo blockundo; CCheckQueueControl<CScriptCheck> control(fScriptChecks && nScriptCheckThreads ? &scriptcheckqueue : NULL); CAmount nFees = 0; int nInputs = 0; unsigned int nSigOps = 0; CDiskTxPos pos(pindex->GetBlockPos(), GetSizeOfCompactSize(block.vtx.size())); std::vector<std::pair<uint256, CDiskTxPos> > vPos; vPos.reserve(block.vtx.size()); blockundo.vtxundo.reserve(block.vtx.size() - 1); for (unsigned int i = 0; i < block.vtx.size(); i++) { const CTransaction &tx = block.vtx[i]; nInputs += tx.vin.size(); nSigOps += GetLegacySigOpCount(tx); if (nSigOps > MAX_BLOCK_SIGOPS) return state.DoS(100, error("ConnectBlock(): too many sigops"), REJECT_INVALID, "bad-blk-sigops"); if (!tx.IsCoinBase()) { if (!view.HaveInputs(tx)) return state.DoS(100, error("ConnectBlock(): inputs missing/spent"), REJECT_INVALID, "bad-txns-inputs-missingorspent"); if (fStrictPayToScriptHash) { // Add in sigops done by pay-to-script-hash inputs; // this is to prevent a "rogue miner" from creating // an incredibly-expensive-to-validate block. nSigOps += GetP2SHSigOpCount(tx, view); if (nSigOps > MAX_BLOCK_SIGOPS) return state.DoS(100, error("ConnectBlock(): too many sigops"), REJECT_INVALID, "bad-blk-sigops"); } nFees += view.GetValueIn(tx)-tx.GetValueOut(); std::vector<CScriptCheck> vChecks; bool fCacheResults = fJustCheck; /* Don't cache results if we're actually connecting blocks (still consult the cache, though) */ if (!CheckInputs(tx, state, view, fScriptChecks, flags, fCacheResults, nScriptCheckThreads ? &vChecks : NULL)) return error("ConnectBlock(): CheckInputs on %s failed with %s", tx.GetHash().ToString(), FormatStateMessage(state)); control.Add(vChecks); } CTxUndo undoDummy; if (i > 0) { blockundo.vtxundo.push_back(CTxUndo()); } UpdateCoins(tx, state, view, i == 0 ? undoDummy : blockundo.vtxundo.back(), pindex->nHeight); vPos.push_back(std::make_pair(tx.GetHash(), pos)); pos.nTxOffset += ::GetSerializeSize(tx, SER_DISK, CLIENT_VERSION); } int64_t nTime3 = GetTimeMicros(); nTimeConnect += nTime3 - nTime2; LogPrint("bench", " - Connect %u transactions: %.2fms (%.3fms/tx, %.3fms/txin) [%.2fs]\n", (unsigned)block.vtx.size(), 0.001 * (nTime3 - nTime2), 0.001 * (nTime3 - nTime2) / block.vtx.size(), nInputs <= 1 ? 0 : 0.001 * (nTime3 - nTime2) / (nInputs-1), nTimeConnect * 0.000001); CAmount blockReward = nFees + GetBlockSubsidy(pindex->nHeight, chainparams.GetConsensus()); if (block.vtx[0].GetValueOut() > blockReward) return state.DoS(100, error("ConnectBlock(): coinbase pays too much (actual=%d vs limit=%d)", block.vtx[0].GetValueOut(), blockReward), REJECT_INVALID, "bad-cb-amount"); if (!control.Wait()) return state.DoS(100, false); int64_t nTime4 = GetTimeMicros(); nTimeVerify += nTime4 - nTime2; LogPrint("bench", " - Verify %u txins: %.2fms (%.3fms/txin) [%.2fs]\n", nInputs - 1, 0.001 * (nTime4 - nTime2), nInputs <= 1 ? 0 : 0.001 * (nTime4 - nTime2) / (nInputs-1), nTimeVerify * 0.000001); if (fJustCheck) return true; // Write undo information to disk if (pindex->GetUndoPos().IsNull() || !pindex->IsValid(BLOCK_VALID_SCRIPTS)) { if (pindex->GetUndoPos().IsNull()) { CDiskBlockPos pos; if (!FindUndoPos(state, pindex->nFile, pos, ::GetSerializeSize(blockundo, SER_DISK, CLIENT_VERSION) + 40)) return error("ConnectBlock(): FindUndoPos failed"); if (!UndoWriteToDisk(blockundo, pos, pindex->pprev->GetBlockHash(), chainparams.MessageStart())) return AbortNode(state, "Failed to write undo data"); // update nUndoPos in block index pindex->nUndoPos = pos.nPos; pindex->nStatus |= BLOCK_HAVE_UNDO; } pindex->RaiseValidity(BLOCK_VALID_SCRIPTS); setDirtyBlockIndex.insert(pindex); } if (fTxIndex) if (!pblocktree->WriteTxIndex(vPos)) return AbortNode(state, "Failed to write transaction index"); // add this block to the view's block chain view.SetBestBlock(pindex->GetBlockHash()); int64_t nTime5 = GetTimeMicros(); nTimeIndex += nTime5 - nTime4; LogPrint("bench", " - Index writing: %.2fms [%.2fs]\n", 0.001 * (nTime5 - nTime4), nTimeIndex * 0.000001); // Watch for changes to the previous coinbase transaction. static uint256 hashPrevBestCoinBase; GetMainSignals().UpdatedTransaction(hashPrevBestCoinBase); hashPrevBestCoinBase = block.vtx[0].GetHash(); int64_t nTime6 = GetTimeMicros(); nTimeCallbacks += nTime6 - nTime5; LogPrint("bench", " - Callbacks: %.2fms [%.2fs]\n", 0.001 * (nTime6 - nTime5), nTimeCallbacks * 0.000001); return true; } enum FlushStateMode { FLUSH_STATE_NONE, FLUSH_STATE_IF_NEEDED, FLUSH_STATE_PERIODIC, FLUSH_STATE_ALWAYS }; /** * Update the on-disk chain state. * The caches and indexes are flushed depending on the mode we're called with * if they're too large, if it's been a while since the last write, * or always and in all cases if we're in prune mode and are deleting files. */ bool static FlushStateToDisk(CValidationState &state, FlushStateMode mode) { const CChainParams& chainparams = Params(); LOCK2(cs_main, cs_LastBlockFile); static int64_t nLastWrite = 0; static int64_t nLastFlush = 0; static int64_t nLastSetChain = 0; std::set<int> setFilesToPrune; bool fFlushForPrune = false; try { if (fPruneMode && fCheckForPruning && !fReindex) { FindFilesToPrune(setFilesToPrune, chainparams.PruneAfterHeight()); fCheckForPruning = false; if (!setFilesToPrune.empty()) { fFlushForPrune = true; if (!fHavePruned) { pblocktree->WriteFlag("prunedblockfiles", true); fHavePruned = true; } } } int64_t nNow = GetTimeMicros(); // Avoid writing/flushing immediately after startup. if (nLastWrite == 0) { nLastWrite = nNow; } if (nLastFlush == 0) { nLastFlush = nNow; } if (nLastSetChain == 0) { nLastSetChain = nNow; } size_t cacheSize = pcoinsTip->DynamicMemoryUsage(); // The cache is large and close to the limit, but we have time now (not in the middle of a block processing). bool fCacheLarge = mode == FLUSH_STATE_PERIODIC && cacheSize * (10.0/9) > nCoinCacheUsage; // The cache is over the limit, we have to write now. bool fCacheCritical = mode == FLUSH_STATE_IF_NEEDED && cacheSize > nCoinCacheUsage; // It's been a while since we wrote the block index to disk. Do this frequently, so we don't need to redownload after a crash. bool fPeriodicWrite = mode == FLUSH_STATE_PERIODIC && nNow > nLastWrite + (int64_t)DATABASE_WRITE_INTERVAL * 1000000; // It's been very long since we flushed the cache. Do this infrequently, to optimize cache usage. bool fPeriodicFlush = mode == FLUSH_STATE_PERIODIC && nNow > nLastFlush + (int64_t)DATABASE_FLUSH_INTERVAL * 1000000; // Combine all conditions that result in a full cache flush. bool fDoFullFlush = (mode == FLUSH_STATE_ALWAYS) || fCacheLarge || fCacheCritical || fPeriodicFlush || fFlushForPrune; // Write blocks and block index to disk. if (fDoFullFlush || fPeriodicWrite) { // Depend on nMinDiskSpace to ensure we can write block index if (!CheckDiskSpace(0)) return state.Error("out of disk space"); // First make sure all block and undo data is flushed to disk. FlushBlockFile(); // Then update all block file information (which may refer to block and undo files). { std::vector<std::pair<int, const CBlockFileInfo*> > vFiles; vFiles.reserve(setDirtyFileInfo.size()); for (set<int>::iterator it = setDirtyFileInfo.begin(); it != setDirtyFileInfo.end(); ) { vFiles.push_back(make_pair(*it, &vinfoBlockFile[*it])); setDirtyFileInfo.erase(it++); } std::vector<const CBlockIndex*> vBlocks; vBlocks.reserve(setDirtyBlockIndex.size()); for (set<CBlockIndex*>::iterator it = setDirtyBlockIndex.begin(); it != setDirtyBlockIndex.end(); ) { vBlocks.push_back(*it); setDirtyBlockIndex.erase(it++); } if (!pblocktree->WriteBatchSync(vFiles, nLastBlockFile, vBlocks)) { return AbortNode(state, "Files to write to block index database"); } } // Finally remove any pruned files if (fFlushForPrune) UnlinkPrunedFiles(setFilesToPrune); nLastWrite = nNow; } // Flush best chain related state. This can only be done if the blocks / block index write was also done. if (fDoFullFlush) { // Typical CCoins structures on disk are around 128 bytes in size. // Pushing a new one to the database can cause it to be written // twice (once in the log, and once in the tables). This is already // an overestimation, as most will delete an existing entry or // overwrite one. Still, use a conservative safety factor of 2. if (!CheckDiskSpace(128 * 2 * 2 * pcoinsTip->GetCacheSize())) return state.Error("out of disk space"); // Flush the chainstate (which may refer to block index entries). if (!pcoinsTip->Flush()) return AbortNode(state, "Failed to write to coin database"); nLastFlush = nNow; } if (fDoFullFlush || ((mode == FLUSH_STATE_ALWAYS || mode == FLUSH_STATE_PERIODIC) && nNow > nLastSetChain + (int64_t)DATABASE_WRITE_INTERVAL * 1000000)) { // Update best block in wallet (so we can detect restored wallets). GetMainSignals().SetBestChain(chainActive.GetLocator()); nLastSetChain = nNow; } } catch (const std::runtime_error& e) { return AbortNode(state, std::string("System error while flushing: ") + e.what()); } return true; } void FlushStateToDisk() { CValidationState state; FlushStateToDisk(state, FLUSH_STATE_ALWAYS); } void PruneAndFlush() { CValidationState state; fCheckForPruning = true; FlushStateToDisk(state, FLUSH_STATE_NONE); } /** Update chainActive and related internal data structures. */ void static UpdateTip(CBlockIndex *pindexNew) { const CChainParams& chainParams = Params(); chainActive.SetTip(pindexNew); // New best block nTimeBestReceived = GetTime(); mempool.AddTransactionsUpdated(1); LogPrintf("%s: new best=%s height=%d bits=%d log2_work=%.8g tx=%lu date=%s progress=%f cache=%.1fMiB(%utx)\n", __func__, chainActive.Tip()->GetBlockHash().ToString(), chainActive.Height(), chainActive.Tip()->nBits, log(chainActive.Tip()->nChainWork.getdouble())/log(2.0), (unsigned long)chainActive.Tip()->nChainTx, DateTimeStrFormat("%Y-%m-%d %H:%M:%S", chainActive.Tip()->GetBlockTime()), Checkpoints::GuessVerificationProgress(chainParams.Checkpoints(), chainActive.Tip()), pcoinsTip->DynamicMemoryUsage() * (1.0 / (1<<20)), pcoinsTip->GetCacheSize()); cvBlockChange.notify_all(); // Check the version of the last 100 blocks to see if we need to upgrade: static bool fWarned = false; if (!IsInitialBlockDownload() && !fWarned) { int nUpgraded = 0; const CBlockIndex* pindex = chainActive.Tip(); for (int i = 0; i < 100 && pindex != NULL; i++) { if (pindex->nVersion > CBlock::CURRENT_VERSION) ++nUpgraded; pindex = pindex->pprev; } if (nUpgraded > 0) LogPrintf("%s: %d of last 100 blocks above version %d\n", __func__, nUpgraded, (int)CBlock::CURRENT_VERSION); if (nUpgraded > 100/2) { // strMiscWarning is read by GetWarnings(), called by Qt and the JSON-RPC code to warn the user: strMiscWarning = _("Warning: This version is obsolete; upgrade required!"); CAlert::Notify(strMiscWarning, true); fWarned = true; } } } /** Disconnect chainActive's tip. You probably want to call mempool.removeForReorg and manually re-limit mempool size after this, with cs_main held. */ bool static DisconnectTip(CValidationState& state, const Consensus::Params& consensusParams) { CBlockIndex *pindexDelete = chainActive.Tip(); assert(pindexDelete); // Read block from disk. CBlock block; if (!ReadBlockFromDisk(block, pindexDelete, consensusParams)) return AbortNode(state, "Failed to read block"); // Apply the block atomically to the chain state. int64_t nStart = GetTimeMicros(); { CCoinsViewCache view(pcoinsTip); if (!DisconnectBlock(block, state, pindexDelete, view)) return error("DisconnectTip(): DisconnectBlock %s failed", pindexDelete->GetBlockHash().ToString()); assert(view.Flush()); } LogPrint("bench", "- Disconnect block: %.2fms\n", (GetTimeMicros() - nStart) * 0.001); // Write the chain state to disk, if necessary. if (!FlushStateToDisk(state, FLUSH_STATE_IF_NEEDED)) return false; // Resurrect mempool transactions from the disconnected block. std::vector<uint256> vHashUpdate; BOOST_FOREACH(const CTransaction &tx, block.vtx) { // ignore validation errors in resurrected transactions list<CTransaction> removed; CValidationState stateDummy; if (tx.IsCoinBase() || !AcceptToMemoryPool(mempool, stateDummy, tx, false, NULL, true)) { mempool.remove(tx, removed, true); } else if (mempool.exists(tx.GetHash())) { vHashUpdate.push_back(tx.GetHash()); } } // AcceptToMemoryPool/addUnchecked all assume that new mempool entries have // no in-mempool children, which is generally not true when adding // previously-confirmed transactions back to the mempool. // UpdateTransactionsFromBlock finds descendants of any transactions in this // block that were added back and cleans up the mempool state. mempool.UpdateTransactionsFromBlock(vHashUpdate); // Update chainActive and related variables. UpdateTip(pindexDelete->pprev); // Let wallets know transactions went from 1-confirmed to // 0-confirmed or conflicted: BOOST_FOREACH(const CTransaction &tx, block.vtx) { SyncWithWallets(tx, pindexDelete->pprev, NULL); } return true; } static int64_t nTimeReadFromDisk = 0; static int64_t nTimeConnectTotal = 0; static int64_t nTimeFlush = 0; static int64_t nTimeChainState = 0; static int64_t nTimePostConnect = 0; /** * Connect a new block to chainActive. pblock is either NULL or a pointer to a CBlock * corresponding to pindexNew, to bypass loading it again from disk. */ bool static ConnectTip(CValidationState& state, const CChainParams& chainparams, CBlockIndex* pindexNew, const CBlock* pblock) { assert(pindexNew->pprev == chainActive.Tip()); // Read block from disk. int64_t nTime1 = GetTimeMicros(); CBlock block; if (!pblock) { if (!ReadBlockFromDisk(block, pindexNew, chainparams.GetConsensus())) return AbortNode(state, "Failed to read block"); pblock = &block; } // Apply the block atomically to the chain state. int64_t nTime2 = GetTimeMicros(); nTimeReadFromDisk += nTime2 - nTime1; int64_t nTime3; LogPrint("bench", " - Load block from disk: %.2fms [%.2fs]\n", (nTime2 - nTime1) * 0.001, nTimeReadFromDisk * 0.000001); { CCoinsViewCache view(pcoinsTip); bool rv = ConnectBlock(*pblock, state, pindexNew, view); GetMainSignals().BlockChecked(*pblock, state); if (!rv) { if (state.IsInvalid()) InvalidBlockFound(pindexNew, state); return error("ConnectTip(): ConnectBlock %s failed", pindexNew->GetBlockHash().ToString()); } mapBlockSource.erase(pindexNew->GetBlockHash()); nTime3 = GetTimeMicros(); nTimeConnectTotal += nTime3 - nTime2; LogPrint("bench", " - Connect total: %.2fms [%.2fs]\n", (nTime3 - nTime2) * 0.001, nTimeConnectTotal * 0.000001); assert(view.Flush()); } int64_t nTime4 = GetTimeMicros(); nTimeFlush += nTime4 - nTime3; LogPrint("bench", " - Flush: %.2fms [%.2fs]\n", (nTime4 - nTime3) * 0.001, nTimeFlush * 0.000001); // Write the chain state to disk, if necessary. if (!FlushStateToDisk(state, FLUSH_STATE_IF_NEEDED)) return false; int64_t nTime5 = GetTimeMicros(); nTimeChainState += nTime5 - nTime4; LogPrint("bench", " - Writing chainstate: %.2fms [%.2fs]\n", (nTime5 - nTime4) * 0.001, nTimeChainState * 0.000001); // Remove conflicting transactions from the mempool. list<CTransaction> txConflicted; mempool.removeForBlock(pblock->vtx, pindexNew->nHeight, txConflicted, !IsInitialBlockDownload()); // Update chainActive & related variables. UpdateTip(pindexNew); // Tell wallet about transactions that went from mempool // to conflicted: BOOST_FOREACH(const CTransaction &tx, txConflicted) { SyncWithWallets(tx, pindexNew, NULL); } // ... and about transactions that got confirmed: BOOST_FOREACH(const CTransaction &tx, pblock->vtx) { SyncWithWallets(tx, pindexNew, pblock); } int64_t nTime6 = GetTimeMicros(); nTimePostConnect += nTime6 - nTime5; nTimeTotal += nTime6 - nTime1; LogPrint("bench", " - Connect postprocess: %.2fms [%.2fs]\n", (nTime6 - nTime5) * 0.001, nTimePostConnect * 0.000001); LogPrint("bench", "- Connect block: %.2fms [%.2fs]\n", (nTime6 - nTime1) * 0.001, nTimeTotal * 0.000001); return true; } /** * Return the tip of the chain with the most work in it, that isn't * known to be invalid (it's however far from certain to be valid). */ static CBlockIndex* FindMostWorkChain() { do { CBlockIndex *pindexNew = NULL; // Find the best candidate header. { std::set<CBlockIndex*, CBlockIndexWorkComparator>::reverse_iterator it = setBlockIndexCandidates.rbegin(); if (it == setBlockIndexCandidates.rend()) return NULL; pindexNew = *it; } // Check whether all blocks on the path between the currently active chain and the candidate are valid. // Just going until the active chain is an optimization, as we know all blocks in it are valid already. CBlockIndex *pindexTest = pindexNew; bool fInvalidAncestor = false; while (pindexTest && !chainActive.Contains(pindexTest)) { assert(pindexTest->nChainTx || pindexTest->nHeight == 0); // Pruned nodes may have entries in setBlockIndexCandidates for // which block files have been deleted. Remove those as candidates // for the most work chain if we come across them; we can't switch // to a chain unless we have all the non-active-chain parent blocks. bool fFailedChain = pindexTest->nStatus & BLOCK_FAILED_MASK; bool fMissingData = !(pindexTest->nStatus & BLOCK_HAVE_DATA); if (fFailedChain || fMissingData) { // Candidate chain is not usable (either invalid or missing data) if (fFailedChain && (pindexBestInvalid == NULL || pindexNew->nChainWork > pindexBestInvalid->nChainWork)) pindexBestInvalid = pindexNew; CBlockIndex *pindexFailed = pindexNew; // Remove the entire chain from the set. while (pindexTest != pindexFailed) { if (fFailedChain) { pindexFailed->nStatus |= BLOCK_FAILED_CHILD; } else if (fMissingData) { // If we're missing data, then add back to mapBlocksUnlinked, // so that if the block arrives in the future we can try adding // to setBlockIndexCandidates again. mapBlocksUnlinked.insert(std::make_pair(pindexFailed->pprev, pindexFailed)); } setBlockIndexCandidates.erase(pindexFailed); pindexFailed = pindexFailed->pprev; } setBlockIndexCandidates.erase(pindexTest); fInvalidAncestor = true; break; } pindexTest = pindexTest->pprev; } if (!fInvalidAncestor) return pindexNew; } while(true); } /** Delete all entries in setBlockIndexCandidates that are worse than the current tip. */ static void PruneBlockIndexCandidates() { // Note that we can't delete the current block itself, as we may need to return to it later in case a // reorganization to a better block fails. std::set<CBlockIndex*, CBlockIndexWorkComparator>::iterator it = setBlockIndexCandidates.begin(); while (it != setBlockIndexCandidates.end() && setBlockIndexCandidates.value_comp()(*it, chainActive.Tip())) { setBlockIndexCandidates.erase(it++); } // Either the current tip or a successor of it we're working towards is left in setBlockIndexCandidates. assert(!setBlockIndexCandidates.empty()); } /** * Try to make some progress towards making pindexMostWork the active block. * pblock is either NULL or a pointer to a CBlock corresponding to pindexMostWork. */ static bool ActivateBestChainStep(CValidationState& state, const CChainParams& chainparams, CBlockIndex* pindexMostWork, const CBlock* pblock) { AssertLockHeld(cs_main); bool fInvalidFound = false; const CBlockIndex *pindexOldTip = chainActive.Tip(); const CBlockIndex *pindexFork = chainActive.FindFork(pindexMostWork); // Disconnect active blocks which are no longer in the best chain. bool fBlocksDisconnected = false; while (chainActive.Tip() && chainActive.Tip() != pindexFork) { if (!DisconnectTip(state, chainparams.GetConsensus())) return false; fBlocksDisconnected = true; } // Build list of new blocks to connect. std::vector<CBlockIndex*> vpindexToConnect; bool fContinue = true; int nHeight = pindexFork ? pindexFork->nHeight : -1; while (fContinue && nHeight != pindexMostWork->nHeight) { // Don't iterate the entire list of potential improvements toward the best tip, as we likely only need // a few blocks along the way. int nTargetHeight = std::min(nHeight + 32, pindexMostWork->nHeight); vpindexToConnect.clear(); vpindexToConnect.reserve(nTargetHeight - nHeight); CBlockIndex *pindexIter = pindexMostWork->GetAncestor(nTargetHeight); while (pindexIter && pindexIter->nHeight != nHeight) { vpindexToConnect.push_back(pindexIter); pindexIter = pindexIter->pprev; } nHeight = nTargetHeight; // Connect new blocks. BOOST_REVERSE_FOREACH(CBlockIndex *pindexConnect, vpindexToConnect) { if (!ConnectTip(state, chainparams, pindexConnect, pindexConnect == pindexMostWork ? pblock : NULL)) { if (state.IsInvalid()) { // The block violates a consensus rule. if (!state.CorruptionPossible()) InvalidChainFound(vpindexToConnect.back()); state = CValidationState(); fInvalidFound = true; fContinue = false; break; } else { // A system error occurred (disk space, database error, ...). return false; } } else { PruneBlockIndexCandidates(); if (!pindexOldTip || chainActive.Tip()->nChainWork > pindexOldTip->nChainWork) { // We're in a better position than we were. Return temporarily to release the lock. fContinue = false; break; } } } } if (fBlocksDisconnected) { mempool.removeForReorg(pcoinsTip, chainActive.Tip()->nHeight + 1, STANDARD_LOCKTIME_VERIFY_FLAGS); LimitMempoolSize(mempool, GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000, GetArg("-mempoolexpiry", DEFAULT_MEMPOOL_EXPIRY) * 60 * 60); } mempool.check(pcoinsTip); // Callbacks/notifications for a new best chain. if (fInvalidFound) CheckForkWarningConditionsOnNewFork(vpindexToConnect.back()); else CheckForkWarningConditions(); return true; } /** * Make the best chain active, in multiple steps. The result is either failure * or an activated best chain. pblock is either NULL or a pointer to a block * that is already loaded (to avoid loading it again from disk). */ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams, const CBlock *pblock) { CBlockIndex *pindexMostWork = NULL; do { boost::this_thread::interruption_point(); CBlockIndex *pindexNewTip = NULL; const CBlockIndex *pindexFork; bool fInitialDownload; { LOCK(cs_main); CBlockIndex *pindexOldTip = chainActive.Tip(); pindexMostWork = FindMostWorkChain(); // Whether we have anything to do at all. if (pindexMostWork == NULL || pindexMostWork == chainActive.Tip()) return true; if (!ActivateBestChainStep(state, chainparams, pindexMostWork, pblock && pblock->GetHash() == pindexMostWork->GetBlockHash() ? pblock : NULL)) return false; pindexNewTip = chainActive.Tip(); pindexFork = chainActive.FindFork(pindexOldTip); fInitialDownload = IsInitialBlockDownload(); } // When we reach this point, we switched to a new tip (stored in pindexNewTip). // Notifications/callbacks that can run without cs_main // Always notify the UI if a new block tip was connected if (pindexFork != pindexNewTip) { uiInterface.NotifyBlockTip(fInitialDownload, pindexNewTip); if (!fInitialDownload) { // Find the hashes of all blocks that weren't previously in the best chain. std::vector<uint256> vHashes; CBlockIndex *pindexToAnnounce = pindexNewTip; while (pindexToAnnounce != pindexFork) { vHashes.push_back(pindexToAnnounce->GetBlockHash()); pindexToAnnounce = pindexToAnnounce->pprev; if (vHashes.size() == MAX_BLOCKS_TO_ANNOUNCE) { // Limit announcements in case of a huge reorganization. // Rely on the peer's synchronization mechanism in that case. break; } } // Relay inventory, but don't relay old inventory during initial block download. int nBlockEstimate = 0; if (fCheckpointsEnabled) nBlockEstimate = Checkpoints::GetTotalBlocksEstimate(chainparams.Checkpoints()); { LOCK(cs_vNodes); BOOST_FOREACH(CNode* pnode, vNodes) { if (chainActive.Height() > (pnode->nStartingHeight != -1 ? pnode->nStartingHeight - 2000 : nBlockEstimate)) { BOOST_REVERSE_FOREACH(const uint256& hash, vHashes) { pnode->PushBlockHash(hash); } } } } // Notify external listeners about the new tip. if (!vHashes.empty()) { GetMainSignals().UpdatedBlockTip(pindexNewTip); } } } } while(pindexMostWork != chainActive.Tip()); CheckBlockIndex(chainparams.GetConsensus()); // Write changes periodically to disk, after relay. if (!FlushStateToDisk(state, FLUSH_STATE_PERIODIC)) { return false; } return true; } bool InvalidateBlock(CValidationState& state, const Consensus::Params& consensusParams, CBlockIndex *pindex) { AssertLockHeld(cs_main); // Mark the block itself as invalid. pindex->nStatus |= BLOCK_FAILED_VALID; setDirtyBlockIndex.insert(pindex); setBlockIndexCandidates.erase(pindex); while (chainActive.Contains(pindex)) { CBlockIndex *pindexWalk = chainActive.Tip(); pindexWalk->nStatus |= BLOCK_FAILED_CHILD; setDirtyBlockIndex.insert(pindexWalk); setBlockIndexCandidates.erase(pindexWalk); // ActivateBestChain considers blocks already in chainActive // unconditionally valid already, so force disconnect away from it. if (!DisconnectTip(state, consensusParams)) { mempool.removeForReorg(pcoinsTip, chainActive.Tip()->nHeight + 1, STANDARD_LOCKTIME_VERIFY_FLAGS); return false; } } LimitMempoolSize(mempool, GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000, GetArg("-mempoolexpiry", DEFAULT_MEMPOOL_EXPIRY) * 60 * 60); // The resulting new best tip may not be in setBlockIndexCandidates anymore, so // add it again. BlockMap::iterator it = mapBlockIndex.begin(); while (it != mapBlockIndex.end()) { if (it->second->IsValid(BLOCK_VALID_TRANSACTIONS) && it->second->nChainTx && !setBlockIndexCandidates.value_comp()(it->second, chainActive.Tip())) { setBlockIndexCandidates.insert(it->second); } it++; } InvalidChainFound(pindex); mempool.removeForReorg(pcoinsTip, chainActive.Tip()->nHeight + 1, STANDARD_LOCKTIME_VERIFY_FLAGS); return true; } bool ReconsiderBlock(CValidationState& state, CBlockIndex *pindex) { AssertLockHeld(cs_main); int nHeight = pindex->nHeight; // Remove the invalidity flag from this block and all its descendants. BlockMap::iterator it = mapBlockIndex.begin(); while (it != mapBlockIndex.end()) { if (!it->second->IsValid() && it->second->GetAncestor(nHeight) == pindex) { it->second->nStatus &= ~BLOCK_FAILED_MASK; setDirtyBlockIndex.insert(it->second); if (it->second->IsValid(BLOCK_VALID_TRANSACTIONS) && it->second->nChainTx && setBlockIndexCandidates.value_comp()(chainActive.Tip(), it->second)) { setBlockIndexCandidates.insert(it->second); } if (it->second == pindexBestInvalid) { // Reset invalid block marker if it was pointing to one of those. pindexBestInvalid = NULL; } } it++; } // Remove the invalidity flag from all ancestors too. while (pindex != NULL) { if (pindex->nStatus & BLOCK_FAILED_MASK) { pindex->nStatus &= ~BLOCK_FAILED_MASK; setDirtyBlockIndex.insert(pindex); } pindex = pindex->pprev; } return true; } CBlockIndex* AddToBlockIndex(const CBlockHeader& block) { // Check for duplicate uint256 hash = block.GetHash(); BlockMap::iterator it = mapBlockIndex.find(hash); if (it != mapBlockIndex.end()) return it->second; // Construct new block index object CBlockIndex* pindexNew = new CBlockIndex(block); assert(pindexNew); // We assign the sequence id to blocks only when the full data is available, // to avoid miners withholding blocks but broadcasting headers, to get a // competitive advantage. pindexNew->nSequenceId = 0; BlockMap::iterator mi = mapBlockIndex.insert(make_pair(hash, pindexNew)).first; pindexNew->phashBlock = &((*mi).first); BlockMap::iterator miPrev = mapBlockIndex.find(block.hashPrevBlock); if (miPrev != mapBlockIndex.end()) { pindexNew->pprev = (*miPrev).second; pindexNew->nHeight = pindexNew->pprev->nHeight + 1; pindexNew->BuildSkip(); } pindexNew->nChainWork = (pindexNew->pprev ? pindexNew->pprev->nChainWork : 0) + GetBlockProof(*pindexNew); pindexNew->RaiseValidity(BLOCK_VALID_TREE); if (pindexBestHeader == NULL || pindexBestHeader->nChainWork < pindexNew->nChainWork) pindexBestHeader = pindexNew; setDirtyBlockIndex.insert(pindexNew); return pindexNew; } /** Mark a block as having its data received and checked (up to BLOCK_VALID_TRANSACTIONS). */ bool ReceivedBlockTransactions(const CBlock &block, CValidationState& state, CBlockIndex *pindexNew, const CDiskBlockPos& pos) { pindexNew->nTx = block.vtx.size(); pindexNew->nChainTx = 0; pindexNew->nFile = pos.nFile; pindexNew->nDataPos = pos.nPos; pindexNew->nUndoPos = 0; pindexNew->nStatus |= BLOCK_HAVE_DATA; pindexNew->RaiseValidity(BLOCK_VALID_TRANSACTIONS); setDirtyBlockIndex.insert(pindexNew); if (pindexNew->pprev == NULL || pindexNew->pprev->nChainTx) { // If pindexNew is the genesis block or all parents are BLOCK_VALID_TRANSACTIONS. deque<CBlockIndex*> queue; queue.push_back(pindexNew); // Recursively process any descendant blocks that now may be eligible to be connected. while (!queue.empty()) { CBlockIndex *pindex = queue.front(); queue.pop_front(); pindex->nChainTx = (pindex->pprev ? pindex->pprev->nChainTx : 0) + pindex->nTx; { LOCK(cs_nBlockSequenceId); pindex->nSequenceId = nBlockSequenceId++; } if (chainActive.Tip() == NULL || !setBlockIndexCandidates.value_comp()(pindex, chainActive.Tip())) { setBlockIndexCandidates.insert(pindex); } std::pair<std::multimap<CBlockIndex*, CBlockIndex*>::iterator, std::multimap<CBlockIndex*, CBlockIndex*>::iterator> range = mapBlocksUnlinked.equal_range(pindex); while (range.first != range.second) { std::multimap<CBlockIndex*, CBlockIndex*>::iterator it = range.first; queue.push_back(it->second); range.first++; mapBlocksUnlinked.erase(it); } } } else { if (pindexNew->pprev && pindexNew->pprev->IsValid(BLOCK_VALID_TREE)) { mapBlocksUnlinked.insert(std::make_pair(pindexNew->pprev, pindexNew)); } } return true; } bool FindBlockPos(CValidationState &state, CDiskBlockPos &pos, unsigned int nAddSize, unsigned int nHeight, uint64_t nTime, bool fKnown = false) { LOCK(cs_LastBlockFile); unsigned int nFile = fKnown ? pos.nFile : nLastBlockFile; if (vinfoBlockFile.size() <= nFile) { vinfoBlockFile.resize(nFile + 1); } if (!fKnown) { while (vinfoBlockFile[nFile].nSize + nAddSize >= MAX_BLOCKFILE_SIZE) { nFile++; if (vinfoBlockFile.size() <= nFile) { vinfoBlockFile.resize(nFile + 1); } } pos.nFile = nFile; pos.nPos = vinfoBlockFile[nFile].nSize; } if ((int)nFile != nLastBlockFile) { if (!fKnown) { LogPrintf("Leaving block file %i: %s\n", nLastBlockFile, vinfoBlockFile[nLastBlockFile].ToString()); } FlushBlockFile(!fKnown); nLastBlockFile = nFile; } vinfoBlockFile[nFile].AddBlock(nHeight, nTime); if (fKnown) vinfoBlockFile[nFile].nSize = std::max(pos.nPos + nAddSize, vinfoBlockFile[nFile].nSize); else vinfoBlockFile[nFile].nSize += nAddSize; if (!fKnown) { unsigned int nOldChunks = (pos.nPos + BLOCKFILE_CHUNK_SIZE - 1) / BLOCKFILE_CHUNK_SIZE; unsigned int nNewChunks = (vinfoBlockFile[nFile].nSize + BLOCKFILE_CHUNK_SIZE - 1) / BLOCKFILE_CHUNK_SIZE; if (nNewChunks > nOldChunks) { if (fPruneMode) fCheckForPruning = true; if (CheckDiskSpace(nNewChunks * BLOCKFILE_CHUNK_SIZE - pos.nPos)) { FILE *file = OpenBlockFile(pos); if (file) { LogPrintf("Pre-allocating up to position 0x%x in blk%05u.dat\n", nNewChunks * BLOCKFILE_CHUNK_SIZE, pos.nFile); AllocateFileRange(file, pos.nPos, nNewChunks * BLOCKFILE_CHUNK_SIZE - pos.nPos); fclose(file); } } else return state.Error("out of disk space"); } } setDirtyFileInfo.insert(nFile); return true; } bool FindUndoPos(CValidationState &state, int nFile, CDiskBlockPos &pos, unsigned int nAddSize) { pos.nFile = nFile; LOCK(cs_LastBlockFile); unsigned int nNewSize; pos.nPos = vinfoBlockFile[nFile].nUndoSize; nNewSize = vinfoBlockFile[nFile].nUndoSize += nAddSize; setDirtyFileInfo.insert(nFile); unsigned int nOldChunks = (pos.nPos + UNDOFILE_CHUNK_SIZE - 1) / UNDOFILE_CHUNK_SIZE; unsigned int nNewChunks = (nNewSize + UNDOFILE_CHUNK_SIZE - 1) / UNDOFILE_CHUNK_SIZE; if (nNewChunks > nOldChunks) { if (fPruneMode) fCheckForPruning = true; if (CheckDiskSpace(nNewChunks * UNDOFILE_CHUNK_SIZE - pos.nPos)) { FILE *file = OpenUndoFile(pos); if (file) { LogPrintf("Pre-allocating up to position 0x%x in rev%05u.dat\n", nNewChunks * UNDOFILE_CHUNK_SIZE, pos.nFile); AllocateFileRange(file, pos.nPos, nNewChunks * UNDOFILE_CHUNK_SIZE - pos.nPos); fclose(file); } } else return state.Error("out of disk space"); } return true; } bool CheckBlockHeader(const CBlockHeader& block, CValidationState& state, bool fCheckPOW) { // Check proof of work matches claimed amount if (fCheckPOW && !CheckProofOfWork(block.GetHash(), block.nBits, Params().GetConsensus())) return state.DoS(50, false, REJECT_INVALID, "high-hash", false, "proof of work failed"); // Check timestamp if (block.GetBlockTime() > GetAdjustedTime() + 2 * 60 * 60) return state.Invalid(false, REJECT_INVALID, "time-too-new", "block timestamp too far in the future"); return true; } bool CheckBlock(const CBlock& block, CValidationState& state, bool fCheckPOW, bool fCheckMerkleRoot) { // These are checks that are independent of context. if (block.fChecked) return true; // Check that the header is valid (particularly PoW). This is mostly // redundant with the call in AcceptBlockHeader. if (!CheckBlockHeader(block, state, fCheckPOW)) return false; // Check the merkle root. if (fCheckMerkleRoot) { bool mutated; uint256 hashMerkleRoot2 = BlockMerkleRoot(block, &mutated); if (block.hashMerkleRoot != hashMerkleRoot2) return state.DoS(100, false, REJECT_INVALID, "bad-txnmrklroot", true, "hashMerkleRoot mismatch"); // Check for merkle tree malleability (CVE-2012-2459): repeating sequences // of transactions in a block without affecting the merkle root of a block, // while still invalidating it. if (mutated) return state.DoS(100, false, REJECT_INVALID, "bad-txns-duplicate", true, "duplicate transaction"); } // All potential-corruption validation must be done before we do any // transaction validation, as otherwise we may mark the header as invalid // because we receive the wrong transactions for it. // Size limits if (block.vtx.empty() || block.vtx.size() > MAX_BLOCK_SIZE || ::GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION) > MAX_BLOCK_SIZE) return state.DoS(100, false, REJECT_INVALID, "bad-blk-length", false, "size limits failed"); // First transaction must be coinbase, the rest must not be if (block.vtx.empty() || !block.vtx[0].IsCoinBase()) return state.DoS(100, false, REJECT_INVALID, "bad-cb-missing", false, "first tx is not coinbase"); for (unsigned int i = 1; i < block.vtx.size(); i++) if (block.vtx[i].IsCoinBase()) return state.DoS(100, false, REJECT_INVALID, "bad-cb-multiple", false, "more than one coinbase"); // Check transactions BOOST_FOREACH(const CTransaction& tx, block.vtx) if (!CheckTransaction(tx, state)) return state.Invalid(false, state.GetRejectCode(), state.GetRejectReason(), strprintf("Transaction check failed (tx hash %s) %s", tx.GetHash().ToString(), state.GetDebugMessage())); unsigned int nSigOps = 0; BOOST_FOREACH(const CTransaction& tx, block.vtx) { nSigOps += GetLegacySigOpCount(tx); } if (nSigOps > MAX_BLOCK_SIGOPS) return state.DoS(100, false, REJECT_INVALID, "bad-blk-sigops", false, "out-of-bounds SigOpCount"); if (fCheckPOW && fCheckMerkleRoot) block.fChecked = true; return true; } static bool CheckIndexAgainstCheckpoint(const CBlockIndex* pindexPrev, CValidationState& state, const CChainParams& chainparams, const uint256& hash) { if (*pindexPrev->phashBlock == chainparams.GetConsensus().hashGenesisBlock) return true; int nHeight = pindexPrev->nHeight+1; // Don't accept any forks from the main chain prior to last checkpoint CBlockIndex* pcheckpoint = Checkpoints::GetLastCheckpoint(chainparams.Checkpoints()); if (pcheckpoint && nHeight < pcheckpoint->nHeight) return state.DoS(100, error("%s: forked chain older than last checkpoint (height %d)", __func__, nHeight)); return true; } bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& state, CBlockIndex * const pindexPrev) { const Consensus::Params& consensusParams = Params().GetConsensus(); // Check proof of work if (block.nBits != GetNextWorkRequired(pindexPrev, &block, consensusParams)) return state.DoS(100, false, REJECT_INVALID, "bad-diffbits", false, "incorrect proof of work"); // Check timestamp against prev if (block.GetBlockTime() <= pindexPrev->GetMedianTimePast()) return state.Invalid(false, REJECT_INVALID, "time-too-old", "block's timestamp is too early"); // Reject outdated version blocks when 95% (75% on testnet) of the network has upgraded: for (int32_t version = 2; version < 5; ++version) // check for version 2, 3 and 4 upgrades if (block.nVersion < version && IsSuperMajority(version, pindexPrev, consensusParams.nMajorityRejectBlockOutdated, consensusParams)) return state.Invalid(false, REJECT_OBSOLETE, strprintf("bad-version(v%d)", version - 1), strprintf("rejected nVersion=%d block", version - 1)); return true; } bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIndex * const pindexPrev) { const int nHeight = pindexPrev == NULL ? 0 : pindexPrev->nHeight + 1; const Consensus::Params& consensusParams = Params().GetConsensus(); // Check that all transactions are finalized BOOST_FOREACH(const CTransaction& tx, block.vtx) { int nLockTimeFlags = 0; int64_t nLockTimeCutoff = (nLockTimeFlags & LOCKTIME_MEDIAN_TIME_PAST) ? pindexPrev->GetMedianTimePast() : block.GetBlockTime(); if (!IsFinalTx(tx, nHeight, nLockTimeCutoff)) { return state.DoS(10, false, REJECT_INVALID, "bad-txns-nonfinal", false, "non-final transaction"); } } // Enforce block.nVersion=2 rule that the coinbase starts with serialized block height // if 750 of the last 1,000 blocks are version 2 or greater (51/100 if testnet): if (block.nVersion >= 2 && IsSuperMajority(2, pindexPrev, consensusParams.nMajorityEnforceBlockUpgrade, consensusParams)) { CScript expect = CScript() << nHeight; if (block.vtx[0].vin[0].scriptSig.size() < expect.size() || !std::equal(expect.begin(), expect.end(), block.vtx[0].vin[0].scriptSig.begin())) { return state.DoS(100, false, REJECT_INVALID, "bad-cb-height", false, "block height mismatch in coinbase"); } } return true; } static bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state, const CChainParams& chainparams, CBlockIndex** ppindex=NULL) { AssertLockHeld(cs_main); // Check for duplicate uint256 hash = block.GetHash(); BlockMap::iterator miSelf = mapBlockIndex.find(hash); CBlockIndex *pindex = NULL; if (hash != chainparams.GetConsensus().hashGenesisBlock) { if (miSelf != mapBlockIndex.end()) { // Block header is already known. pindex = miSelf->second; if (ppindex) *ppindex = pindex; if (pindex->nStatus & BLOCK_FAILED_MASK) return state.Invalid(error("%s: block is marked invalid", __func__), 0, "duplicate"); return true; } if (!CheckBlockHeader(block, state)) return error("%s: Consensus::CheckBlockHeader: %s, %s", __func__, hash.ToString(), FormatStateMessage(state)); // Get prev block index CBlockIndex* pindexPrev = NULL; BlockMap::iterator mi = mapBlockIndex.find(block.hashPrevBlock); if (mi == mapBlockIndex.end()) return state.DoS(10, error("%s: prev block not found", __func__), 0, "bad-prevblk"); pindexPrev = (*mi).second; if (pindexPrev->nStatus & BLOCK_FAILED_MASK) return state.DoS(100, error("%s: prev block invalid", __func__), REJECT_INVALID, "bad-prevblk"); assert(pindexPrev); if (fCheckpointsEnabled && !CheckIndexAgainstCheckpoint(pindexPrev, state, chainparams, hash)) return error("%s: CheckIndexAgainstCheckpoint(): %s", __func__, state.GetRejectReason().c_str()); if (!ContextualCheckBlockHeader(block, state, pindexPrev)) return error("%s: Consensus::ContextualCheckBlockHeader: %s, %s", __func__, hash.ToString(), FormatStateMessage(state)); } if (pindex == NULL) pindex = AddToBlockIndex(block); if (ppindex) *ppindex = pindex; return true; } /** Store block on disk. If dbp is non-NULL, the file is known to already reside on disk */ static bool AcceptBlock(const CBlock& block, CValidationState& state, const CChainParams& chainparams, CBlockIndex** ppindex, bool fRequested, CDiskBlockPos* dbp) { AssertLockHeld(cs_main); CBlockIndex *&pindex = *ppindex; if (!AcceptBlockHeader(block, state, chainparams, &pindex)) return false; // Try to process all requested blocks that we don't have, but only // process an unrequested block if it's new and has enough work to // advance our tip, and isn't too many blocks ahead. bool fAlreadyHave = pindex->nStatus & BLOCK_HAVE_DATA; bool fHasMoreWork = (chainActive.Tip() ? pindex->nChainWork > chainActive.Tip()->nChainWork : true); // Blocks that are too out-of-order needlessly limit the effectiveness of // pruning, because pruning will not delete block files that contain any // blocks which are too close in height to the tip. Apply this test // regardless of whether pruning is enabled; it should generally be safe to // not process unrequested blocks. bool fTooFarAhead = (pindex->nHeight > int(chainActive.Height() + MIN_BLOCKS_TO_KEEP)); // TODO: deal better with return value and error conditions for duplicate // and unrequested blocks. if (fAlreadyHave) return true; if (!fRequested) { // If we didn't ask for it: if (pindex->nTx != 0) return true; // This is a previously-processed block that was pruned if (!fHasMoreWork) return true; // Don't process less-work chains if (fTooFarAhead) return true; // Block height is too high } if ((!CheckBlock(block, state)) || !ContextualCheckBlock(block, state, pindex->pprev)) { if (state.IsInvalid() && !state.CorruptionPossible()) { pindex->nStatus |= BLOCK_FAILED_VALID; setDirtyBlockIndex.insert(pindex); } return error("%s: %s", __func__, FormatStateMessage(state)); } int nHeight = pindex->nHeight; // Write block to history file try { unsigned int nBlockSize = ::GetSerializeSize(block, SER_DISK, CLIENT_VERSION); CDiskBlockPos blockPos; if (dbp != NULL) blockPos = *dbp; if (!FindBlockPos(state, blockPos, nBlockSize+8, nHeight, block.GetBlockTime(), dbp != NULL)) return error("AcceptBlock(): FindBlockPos failed"); if (dbp == NULL) if (!WriteBlockToDisk(block, blockPos, chainparams.MessageStart())) AbortNode(state, "Failed to write block"); if (!ReceivedBlockTransactions(block, state, pindex, blockPos)) return error("AcceptBlock(): ReceivedBlockTransactions failed"); } catch (const std::runtime_error& e) { return AbortNode(state, std::string("System error: ") + e.what()); } if (fCheckForPruning) FlushStateToDisk(state, FLUSH_STATE_NONE); // we just allocated more disk space for block files return true; } static bool IsSuperMajority(int minVersion, const CBlockIndex* pstart, unsigned nRequired, const Consensus::Params& consensusParams) { unsigned int nFound = 0; for (int i = 0; i < consensusParams.nMajorityWindow && nFound < nRequired && pstart != NULL; i++) { if (pstart->nVersion >= minVersion) ++nFound; pstart = pstart->pprev; } return (nFound >= nRequired); } bool ProcessNewBlock(CValidationState& state, const CChainParams& chainparams, const CNode* pfrom, const CBlock* pblock, bool fForceProcessing, CDiskBlockPos* dbp) { { LOCK(cs_main); bool fRequested = MarkBlockAsReceived(pblock->GetHash()); fRequested |= fForceProcessing; // Store to disk CBlockIndex *pindex = NULL; bool ret = AcceptBlock(*pblock, state, chainparams, &pindex, fRequested, dbp); if (pindex && pfrom) { mapBlockSource[pindex->GetBlockHash()] = pfrom->GetId(); } CheckBlockIndex(chainparams.GetConsensus()); if (!ret) return error("%s: AcceptBlock FAILED", __func__); } if (!ActivateBestChain(state, chainparams, pblock)) return error("%s: ActivateBestChain failed", __func__); return true; } bool TestBlockValidity(CValidationState& state, const CChainParams& chainparams, const CBlock& block, CBlockIndex* pindexPrev, bool fCheckPOW, bool fCheckMerkleRoot) { AssertLockHeld(cs_main); assert(pindexPrev && pindexPrev == chainActive.Tip()); if (fCheckpointsEnabled && !CheckIndexAgainstCheckpoint(pindexPrev, state, chainparams, block.GetHash())) return error("%s: CheckIndexAgainstCheckpoint(): %s", __func__, state.GetRejectReason().c_str()); CCoinsViewCache viewNew(pcoinsTip); CBlockIndex indexDummy(block); indexDummy.pprev = pindexPrev; indexDummy.nHeight = pindexPrev->nHeight + 1; // NOTE: CheckBlockHeader is called by CheckBlock if (!ContextualCheckBlockHeader(block, state, pindexPrev)) return error("%s: Consensus::ContextualCheckBlockHeader: %s", __func__, FormatStateMessage(state)); if (!CheckBlock(block, state, fCheckPOW, fCheckMerkleRoot)) return error("%s: Consensus::CheckBlock: %s", __func__, FormatStateMessage(state)); if (!ContextualCheckBlock(block, state, pindexPrev)) return error("%s: Consensus::ContextualCheckBlock: %s", __func__, FormatStateMessage(state)); if (!ConnectBlock(block, state, &indexDummy, viewNew, true)) return false; assert(state.IsValid()); return true; } /** * BLOCK PRUNING CODE */ /* Calculate the amount of disk space the block & undo files currently use */ uint64_t CalculateCurrentUsage() { uint64_t retval = 0; BOOST_FOREACH(const CBlockFileInfo &file, vinfoBlockFile) { retval += file.nSize + file.nUndoSize; } return retval; } /* Prune a block file (modify associated database entries)*/ void PruneOneBlockFile(const int fileNumber) { for (BlockMap::iterator it = mapBlockIndex.begin(); it != mapBlockIndex.end(); ++it) { CBlockIndex* pindex = it->second; if (pindex->nFile == fileNumber) { pindex->nStatus &= ~BLOCK_HAVE_DATA; pindex->nStatus &= ~BLOCK_HAVE_UNDO; pindex->nFile = 0; pindex->nDataPos = 0; pindex->nUndoPos = 0; setDirtyBlockIndex.insert(pindex); // Prune from mapBlocksUnlinked -- any block we prune would have // to be downloaded again in order to consider its chain, at which // point it would be considered as a candidate for // mapBlocksUnlinked or setBlockIndexCandidates. std::pair<std::multimap<CBlockIndex*, CBlockIndex*>::iterator, std::multimap<CBlockIndex*, CBlockIndex*>::iterator> range = mapBlocksUnlinked.equal_range(pindex->pprev); while (range.first != range.second) { std::multimap<CBlockIndex *, CBlockIndex *>::iterator it = range.first; range.first++; if (it->second == pindex) { mapBlocksUnlinked.erase(it); } } } } vinfoBlockFile[fileNumber].SetNull(); setDirtyFileInfo.insert(fileNumber); } void UnlinkPrunedFiles(std::set<int>& setFilesToPrune) { for (set<int>::iterator it = setFilesToPrune.begin(); it != setFilesToPrune.end(); ++it) { CDiskBlockPos pos(*it, 0); boost::filesystem::remove(GetBlockPosFilename(pos, "blk")); boost::filesystem::remove(GetBlockPosFilename(pos, "rev")); LogPrintf("Prune: %s deleted blk/rev (%05u)\n", __func__, *it); } } /* Calculate the block/rev files that should be deleted to remain under target*/ void FindFilesToPrune(std::set<int>& setFilesToPrune, uint64_t nPruneAfterHeight) { LOCK2(cs_main, cs_LastBlockFile); if (chainActive.Tip() == NULL || nPruneTarget == 0) { return; } if ((uint64_t)chainActive.Tip()->nHeight <= nPruneAfterHeight) { return; } unsigned int nLastBlockWeCanPrune = chainActive.Tip()->nHeight - MIN_BLOCKS_TO_KEEP; uint64_t nCurrentUsage = CalculateCurrentUsage(); // We don't check to prune until after we've allocated new space for files // So we should leave a buffer under our target to account for another allocation // before the next pruning. uint64_t nBuffer = BLOCKFILE_CHUNK_SIZE + UNDOFILE_CHUNK_SIZE; uint64_t nBytesToPrune; int count=0; if (nCurrentUsage + nBuffer >= nPruneTarget) { for (int fileNumber = 0; fileNumber < nLastBlockFile; fileNumber++) { nBytesToPrune = vinfoBlockFile[fileNumber].nSize + vinfoBlockFile[fileNumber].nUndoSize; if (vinfoBlockFile[fileNumber].nSize == 0) continue; if (nCurrentUsage + nBuffer < nPruneTarget) // are we below our target? break; // don't prune files that could have a block within MIN_BLOCKS_TO_KEEP of the main chain's tip but keep scanning if (vinfoBlockFile[fileNumber].nHeightLast > nLastBlockWeCanPrune) continue; PruneOneBlockFile(fileNumber); // Queue up the files for removal setFilesToPrune.insert(fileNumber); nCurrentUsage -= nBytesToPrune; count++; } } LogPrint("prune", "Prune: target=%dMiB actual=%dMiB diff=%dMiB max_prune_height=%d removed %d blk/rev pairs\n", nPruneTarget/1024/1024, nCurrentUsage/1024/1024, ((int64_t)nPruneTarget - (int64_t)nCurrentUsage)/1024/1024, nLastBlockWeCanPrune, count); } bool CheckDiskSpace(uint64_t nAdditionalBytes) { uint64_t nFreeBytesAvailable = boost::filesystem::space(GetDataDir()).available; // Check for nMinDiskSpace bytes (currently 50MB) if (nFreeBytesAvailable < nMinDiskSpace + nAdditionalBytes) return AbortNode("Disk space is low!", _("Error: Disk space is low!")); return true; } FILE* OpenDiskFile(const CDiskBlockPos &pos, const char *prefix, bool fReadOnly) { if (pos.IsNull()) return NULL; boost::filesystem::path path = GetBlockPosFilename(pos, prefix); boost::filesystem::create_directories(path.parent_path()); FILE* file = fopen(path.string().c_str(), "rb+"); if (!file && !fReadOnly) file = fopen(path.string().c_str(), "wb+"); if (!file) { LogPrintf("Unable to open file %s\n", path.string()); return NULL; } if (pos.nPos) { if (fseek(file, pos.nPos, SEEK_SET)) { LogPrintf("Unable to seek to position %u of %s\n", pos.nPos, path.string()); fclose(file); return NULL; } } return file; } FILE* OpenBlockFile(const CDiskBlockPos &pos, bool fReadOnly) { return OpenDiskFile(pos, "blk", fReadOnly); } FILE* OpenUndoFile(const CDiskBlockPos &pos, bool fReadOnly) { return OpenDiskFile(pos, "rev", fReadOnly); } boost::filesystem::path GetBlockPosFilename(const CDiskBlockPos &pos, const char *prefix) { return GetDataDir() / "blocks" / strprintf("%s%05u.dat", prefix, pos.nFile); } CBlockIndex * InsertBlockIndex(uint256 hash) { if (hash.IsNull()) return NULL; // Return existing BlockMap::iterator mi = mapBlockIndex.find(hash); if (mi != mapBlockIndex.end()) return (*mi).second; // Create new CBlockIndex* pindexNew = new CBlockIndex(); if (!pindexNew) throw runtime_error("LoadBlockIndex(): new CBlockIndex failed"); mi = mapBlockIndex.insert(make_pair(hash, pindexNew)).first; pindexNew->phashBlock = &((*mi).first); return pindexNew; } bool static LoadBlockIndexDB() { const CChainParams& chainparams = Params(); if (!pblocktree->LoadBlockIndexGuts()) return false; boost::this_thread::interruption_point(); // Calculate nChainWork vector<pair<int, CBlockIndex*> > vSortedByHeight; vSortedByHeight.reserve(mapBlockIndex.size()); BOOST_FOREACH(const PAIRTYPE(uint256, CBlockIndex*)& item, mapBlockIndex) { CBlockIndex* pindex = item.second; vSortedByHeight.push_back(make_pair(pindex->nHeight, pindex)); } sort(vSortedByHeight.begin(), vSortedByHeight.end()); BOOST_FOREACH(const PAIRTYPE(int, CBlockIndex*)& item, vSortedByHeight) { CBlockIndex* pindex = item.second; pindex->nChainWork = (pindex->pprev ? pindex->pprev->nChainWork : 0) + GetBlockProof(*pindex); // We can link the chain of blocks for which we've received transactions at some point. // Pruned nodes may have deleted the block. if (pindex->nTx > 0) { if (pindex->pprev) { if (pindex->pprev->nChainTx) { pindex->nChainTx = pindex->pprev->nChainTx + pindex->nTx; } else { pindex->nChainTx = 0; mapBlocksUnlinked.insert(std::make_pair(pindex->pprev, pindex)); } } else { pindex->nChainTx = pindex->nTx; } } if (pindex->IsValid(BLOCK_VALID_TRANSACTIONS) && (pindex->nChainTx || pindex->pprev == NULL)) setBlockIndexCandidates.insert(pindex); if (pindex->nStatus & BLOCK_FAILED_MASK && (!pindexBestInvalid || pindex->nChainWork > pindexBestInvalid->nChainWork)) pindexBestInvalid = pindex; if (pindex->pprev) pindex->BuildSkip(); if (pindex->IsValid(BLOCK_VALID_TREE) && (pindexBestHeader == NULL || CBlockIndexWorkComparator()(pindexBestHeader, pindex))) pindexBestHeader = pindex; } // Load block file info pblocktree->ReadLastBlockFile(nLastBlockFile); vinfoBlockFile.resize(nLastBlockFile + 1); LogPrintf("%s: last block file = %i\n", __func__, nLastBlockFile); for (int nFile = 0; nFile <= nLastBlockFile; nFile++) { pblocktree->ReadBlockFileInfo(nFile, vinfoBlockFile[nFile]); } LogPrintf("%s: last block file info: %s\n", __func__, vinfoBlockFile[nLastBlockFile].ToString()); for (int nFile = nLastBlockFile + 1; true; nFile++) { CBlockFileInfo info; if (pblocktree->ReadBlockFileInfo(nFile, info)) { vinfoBlockFile.push_back(info); } else { break; } } // Check presence of blk files LogPrintf("Checking all blk files are present...\n"); set<int> setBlkDataFiles; BOOST_FOREACH(const PAIRTYPE(uint256, CBlockIndex*)& item, mapBlockIndex) { CBlockIndex* pindex = item.second; if (pindex->nStatus & BLOCK_HAVE_DATA) { setBlkDataFiles.insert(pindex->nFile); } } for (std::set<int>::iterator it = setBlkDataFiles.begin(); it != setBlkDataFiles.end(); it++) { CDiskBlockPos pos(*it, 0); if (CAutoFile(OpenBlockFile(pos, true), SER_DISK, CLIENT_VERSION).IsNull()) { return false; } } // Check whether we have ever pruned block & undo files pblocktree->ReadFlag("prunedblockfiles", fHavePruned); if (fHavePruned) LogPrintf("LoadBlockIndexDB(): Block files have previously been pruned\n"); // Check whether we need to continue reindexing bool fReindexing = false; pblocktree->ReadReindexing(fReindexing); fReindex |= fReindexing; // Check whether we have a transaction index pblocktree->ReadFlag("txindex", fTxIndex); LogPrintf("%s: transaction index %s\n", __func__, fTxIndex ? "enabled" : "disabled"); // Load pointer to end of best chain BlockMap::iterator it = mapBlockIndex.find(pcoinsTip->GetBestBlock()); if (it == mapBlockIndex.end()) return true; chainActive.SetTip(it->second); PruneBlockIndexCandidates(); LogPrintf("%s: hashBestChain=%s height=%d date=%s progress=%f\n", __func__, chainActive.Tip()->GetBlockHash().ToString(), chainActive.Height(), DateTimeStrFormat("%Y-%m-%d %H:%M:%S", chainActive.Tip()->GetBlockTime()), Checkpoints::GuessVerificationProgress(chainparams.Checkpoints(), chainActive.Tip())); return true; } CVerifyDB::CVerifyDB() { uiInterface.ShowProgress(_("Verifying blocks..."), 0); } CVerifyDB::~CVerifyDB() { uiInterface.ShowProgress("", 100); } bool CVerifyDB::VerifyDB(const CChainParams& chainparams, CCoinsView *coinsview, int nCheckLevel, int nCheckDepth) { LOCK(cs_main); if (chainActive.Tip() == NULL || chainActive.Tip()->pprev == NULL) return true; // Verify blocks in the best chain if (nCheckDepth <= 0) nCheckDepth = 1000000000; // suffices until the year 19000 if (nCheckDepth > chainActive.Height()) nCheckDepth = chainActive.Height(); nCheckLevel = std::max(0, std::min(4, nCheckLevel)); LogPrintf("Verifying last %i blocks at level %i\n", nCheckDepth, nCheckLevel); CCoinsViewCache coins(coinsview); CBlockIndex* pindexState = chainActive.Tip(); CBlockIndex* pindexFailure = NULL; int nGoodTransactions = 0; CValidationState state; for (CBlockIndex* pindex = chainActive.Tip(); pindex && pindex->pprev; pindex = pindex->pprev) { boost::this_thread::interruption_point(); uiInterface.ShowProgress(_("Verifying blocks..."), std::max(1, std::min(99, (int)(((double)(chainActive.Height() - pindex->nHeight)) / (double)nCheckDepth * (nCheckLevel >= 4 ? 50 : 100))))); if (pindex->nHeight < chainActive.Height()-nCheckDepth) break; CBlock block; // check level 0: read from disk if (!ReadBlockFromDisk(block, pindex, chainparams.GetConsensus())) return error("VerifyDB(): *** ReadBlockFromDisk failed at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString()); // check level 1: verify block validity if (nCheckLevel >= 1 && !CheckBlock(block, state)) return error("%s: *** found bad block at %d, hash=%s (%s)\n", __func__, pindex->nHeight, pindex->GetBlockHash().ToString(), FormatStateMessage(state)); // check level 2: verify undo validity if (nCheckLevel >= 2 && pindex) { CBlockUndo undo; CDiskBlockPos pos = pindex->GetUndoPos(); if (!pos.IsNull()) { if (!UndoReadFromDisk(undo, pos, pindex->pprev->GetBlockHash())) return error("VerifyDB(): *** found bad undo data at %d, hash=%s\n", pindex->nHeight, pindex->GetBlockHash().ToString()); } } // check level 3: check for inconsistencies during memory-only disconnect of tip blocks if (nCheckLevel >= 3 && pindex == pindexState && (coins.DynamicMemoryUsage() + pcoinsTip->DynamicMemoryUsage()) <= nCoinCacheUsage) { bool fClean = true; if (!DisconnectBlock(block, state, pindex, coins, &fClean)) return error("VerifyDB(): *** irrecoverable inconsistency in block data at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString()); pindexState = pindex->pprev; if (!fClean) { nGoodTransactions = 0; pindexFailure = pindex; } else nGoodTransactions += block.vtx.size(); } if (ShutdownRequested()) return true; } if (pindexFailure) return error("VerifyDB(): *** coin database inconsistencies found (last %i blocks, %i good transactions before that)\n", chainActive.Height() - pindexFailure->nHeight + 1, nGoodTransactions); // check level 4: try reconnecting blocks if (nCheckLevel >= 4) { CBlockIndex *pindex = pindexState; while (pindex != chainActive.Tip()) { boost::this_thread::interruption_point(); uiInterface.ShowProgress(_("Verifying blocks..."), std::max(1, std::min(99, 100 - (int)(((double)(chainActive.Height() - pindex->nHeight)) / (double)nCheckDepth * 50)))); pindex = chainActive.Next(pindex); CBlock block; if (!ReadBlockFromDisk(block, pindex, chainparams.GetConsensus())) return error("VerifyDB(): *** ReadBlockFromDisk failed at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString()); if (!ConnectBlock(block, state, pindex, coins)) return error("VerifyDB(): *** found unconnectable block at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString()); } } LogPrintf("No coin database inconsistencies in last %i blocks (%i transactions)\n", chainActive.Height() - pindexState->nHeight, nGoodTransactions); return true; } void UnloadBlockIndex() { LOCK(cs_main); setBlockIndexCandidates.clear(); chainActive.SetTip(NULL); pindexBestInvalid = NULL; pindexBestHeader = NULL; mempool.clear(); mapOrphanTransactions.clear(); mapOrphanTransactionsByPrev.clear(); nSyncStarted = 0; mapBlocksUnlinked.clear(); vinfoBlockFile.clear(); nLastBlockFile = 0; nBlockSequenceId = 1; mapBlockSource.clear(); mapBlocksInFlight.clear(); nQueuedValidatedHeaders = 0; nPreferredDownload = 0; setDirtyBlockIndex.clear(); setDirtyFileInfo.clear(); mapNodeState.clear(); recentRejects.reset(NULL); BOOST_FOREACH(BlockMap::value_type& entry, mapBlockIndex) { delete entry.second; } mapBlockIndex.clear(); fHavePruned = false; } bool LoadBlockIndex() { // Load block index from databases if (!fReindex && !LoadBlockIndexDB()) return false; return true; } bool InitBlockIndex(const CChainParams& chainparams) { LOCK(cs_main); // Initialize global variables that cannot be constructed at startup. recentRejects.reset(new CRollingBloomFilter(120000, 0.000001)); // Check whether we're already initialized if (chainActive.Genesis() != NULL) return true; // Use the provided setting for -txindex in the new database fTxIndex = GetBoolArg("-txindex", DEFAULT_TXINDEX); pblocktree->WriteFlag("txindex", fTxIndex); LogPrintf("Initializing databases...\n"); // Only add the genesis block if not reindexing (in which case we reuse the one already on disk) if (!fReindex) { try { CBlock &block = const_cast<CBlock&>(chainparams.GenesisBlock()); // Start new block file unsigned int nBlockSize = ::GetSerializeSize(block, SER_DISK, CLIENT_VERSION); CDiskBlockPos blockPos; CValidationState state; if (!FindBlockPos(state, blockPos, nBlockSize+8, 0, block.GetBlockTime())) return error("LoadBlockIndex(): FindBlockPos failed"); if (!WriteBlockToDisk(block, blockPos, chainparams.MessageStart())) return error("LoadBlockIndex(): writing genesis block to disk failed"); CBlockIndex *pindex = AddToBlockIndex(block); if (!ReceivedBlockTransactions(block, state, pindex, blockPos)) return error("LoadBlockIndex(): genesis block not accepted"); if (!ActivateBestChain(state, chainparams, &block)) return error("LoadBlockIndex(): genesis block cannot be activated"); // Force a chainstate write so that when we VerifyDB in a moment, it doesn't check stale data return FlushStateToDisk(state, FLUSH_STATE_ALWAYS); } catch (const std::runtime_error& e) { return error("LoadBlockIndex(): failed to initialize block database: %s", e.what()); } } return true; } bool LoadExternalBlockFile(const CChainParams& chainparams, FILE* fileIn, CDiskBlockPos *dbp) { // Map of disk positions for blocks with unknown parent (only used for reindex) static std::multimap<uint256, CDiskBlockPos> mapBlocksUnknownParent; int64_t nStart = GetTimeMillis(); int nLoaded = 0; try { // This takes over fileIn and calls fclose() on it in the CBufferedFile destructor CBufferedFile blkdat(fileIn, 2*MAX_BLOCK_SIZE, MAX_BLOCK_SIZE+8, SER_DISK, CLIENT_VERSION); uint64_t nRewind = blkdat.GetPos(); while (!blkdat.eof()) { boost::this_thread::interruption_point(); blkdat.SetPos(nRewind); nRewind++; // start one byte further next time, in case of failure blkdat.SetLimit(); // remove former limit unsigned int nSize = 0; try { // locate a header unsigned char buf[MESSAGE_START_SIZE]; blkdat.FindByte(chainparams.MessageStart()[0]); nRewind = blkdat.GetPos()+1; blkdat >> FLATDATA(buf); if (memcmp(buf, chainparams.MessageStart(), MESSAGE_START_SIZE)) continue; // read size blkdat >> nSize; if (nSize < 80 || nSize > MAX_BLOCK_SIZE) continue; } catch (const std::exception&) { // no valid block header found; don't complain break; } try { // read block uint64_t nBlockPos = blkdat.GetPos(); if (dbp) dbp->nPos = nBlockPos; blkdat.SetLimit(nBlockPos + nSize); blkdat.SetPos(nBlockPos); CBlock block; blkdat >> block; nRewind = blkdat.GetPos(); // detect out of order blocks, and store them for later uint256 hash = block.GetHash(); if (hash != chainparams.GetConsensus().hashGenesisBlock && mapBlockIndex.find(block.hashPrevBlock) == mapBlockIndex.end()) { LogPrint("reindex", "%s: Out of order block %s, parent %s not known\n", __func__, hash.ToString(), block.hashPrevBlock.ToString()); if (dbp) mapBlocksUnknownParent.insert(std::make_pair(block.hashPrevBlock, *dbp)); continue; } // process in case the block isn't known yet if (mapBlockIndex.count(hash) == 0 || (mapBlockIndex[hash]->nStatus & BLOCK_HAVE_DATA) == 0) { CValidationState state; if (ProcessNewBlock(state, chainparams, NULL, &block, true, dbp)) nLoaded++; if (state.IsError()) break; } else if (hash != chainparams.GetConsensus().hashGenesisBlock && mapBlockIndex[hash]->nHeight % 1000 == 0) { LogPrintf("Block Import: already had block %s at height %d\n", hash.ToString(), mapBlockIndex[hash]->nHeight); } // Recursively process earlier encountered successors of this block deque<uint256> queue; queue.push_back(hash); while (!queue.empty()) { uint256 head = queue.front(); queue.pop_front(); std::pair<std::multimap<uint256, CDiskBlockPos>::iterator, std::multimap<uint256, CDiskBlockPos>::iterator> range = mapBlocksUnknownParent.equal_range(head); while (range.first != range.second) { std::multimap<uint256, CDiskBlockPos>::iterator it = range.first; if (ReadBlockFromDisk(block, it->second, chainparams.GetConsensus())) { LogPrintf("%s: Processing out of order child %s of %s\n", __func__, block.GetHash().ToString(), head.ToString()); CValidationState dummy; if (ProcessNewBlock(dummy, chainparams, NULL, &block, true, &it->second)) { nLoaded++; queue.push_back(block.GetHash()); } } range.first++; mapBlocksUnknownParent.erase(it); } } } catch (const std::exception& e) { LogPrintf("%s: Deserialize or I/O error - %s\n", __func__, e.what()); } } } catch (const std::runtime_error& e) { AbortNode(std::string("System error: ") + e.what()); } if (nLoaded > 0) LogPrintf("Loaded %i blocks from external file in %dms\n", nLoaded, GetTimeMillis() - nStart); return nLoaded > 0; } void static CheckBlockIndex(const Consensus::Params& consensusParams) { if (!fCheckBlockIndex) { return; } LOCK(cs_main); // During a reindex, we read the genesis block and call CheckBlockIndex before ActivateBestChain, // so we have the genesis block in mapBlockIndex but no active chain. (A few of the tests when // iterating the block tree require that chainActive has been initialized.) if (chainActive.Height() < 0) { assert(mapBlockIndex.size() <= 1); return; } // Build forward-pointing map of the entire block tree. std::multimap<CBlockIndex*,CBlockIndex*> forward; for (BlockMap::iterator it = mapBlockIndex.begin(); it != mapBlockIndex.end(); it++) { forward.insert(std::make_pair(it->second->pprev, it->second)); } assert(forward.size() == mapBlockIndex.size()); std::pair<std::multimap<CBlockIndex*,CBlockIndex*>::iterator,std::multimap<CBlockIndex*,CBlockIndex*>::iterator> rangeGenesis = forward.equal_range(NULL); CBlockIndex *pindex = rangeGenesis.first->second; rangeGenesis.first++; assert(rangeGenesis.first == rangeGenesis.second); // There is only one index entry with parent NULL. // Iterate over the entire block tree, using depth-first search. // Along the way, remember whether there are blocks on the path from genesis // block being explored which are the first to have certain properties. size_t nNodes = 0; int nHeight = 0; CBlockIndex* pindexFirstInvalid = NULL; // Oldest ancestor of pindex which is invalid. CBlockIndex* pindexFirstMissing = NULL; // Oldest ancestor of pindex which does not have BLOCK_HAVE_DATA. CBlockIndex* pindexFirstNeverProcessed = NULL; // Oldest ancestor of pindex for which nTx == 0. CBlockIndex* pindexFirstNotTreeValid = NULL; // Oldest ancestor of pindex which does not have BLOCK_VALID_TREE (regardless of being valid or not). CBlockIndex* pindexFirstNotTransactionsValid = NULL; // Oldest ancestor of pindex which does not have BLOCK_VALID_TRANSACTIONS (regardless of being valid or not). CBlockIndex* pindexFirstNotChainValid = NULL; // Oldest ancestor of pindex which does not have BLOCK_VALID_CHAIN (regardless of being valid or not). CBlockIndex* pindexFirstNotScriptsValid = NULL; // Oldest ancestor of pindex which does not have BLOCK_VALID_SCRIPTS (regardless of being valid or not). while (pindex != NULL) { nNodes++; if (pindexFirstInvalid == NULL && pindex->nStatus & BLOCK_FAILED_VALID) pindexFirstInvalid = pindex; if (pindexFirstMissing == NULL && !(pindex->nStatus & BLOCK_HAVE_DATA)) pindexFirstMissing = pindex; if (pindexFirstNeverProcessed == NULL && pindex->nTx == 0) pindexFirstNeverProcessed = pindex; if (pindex->pprev != NULL && pindexFirstNotTreeValid == NULL && (pindex->nStatus & BLOCK_VALID_MASK) < BLOCK_VALID_TREE) pindexFirstNotTreeValid = pindex; if (pindex->pprev != NULL && pindexFirstNotTransactionsValid == NULL && (pindex->nStatus & BLOCK_VALID_MASK) < BLOCK_VALID_TRANSACTIONS) pindexFirstNotTransactionsValid = pindex; if (pindex->pprev != NULL && pindexFirstNotChainValid == NULL && (pindex->nStatus & BLOCK_VALID_MASK) < BLOCK_VALID_CHAIN) pindexFirstNotChainValid = pindex; if (pindex->pprev != NULL && pindexFirstNotScriptsValid == NULL && (pindex->nStatus & BLOCK_VALID_MASK) < BLOCK_VALID_SCRIPTS) pindexFirstNotScriptsValid = pindex; // Begin: actual consistency checks. if (pindex->pprev == NULL) { // Genesis block checks. assert(pindex->GetBlockHash() == consensusParams.hashGenesisBlock); // Genesis block's hash must match. assert(pindex == chainActive.Genesis()); // The current active chain's genesis block must be this block. } if (pindex->nChainTx == 0) assert(pindex->nSequenceId == 0); // nSequenceId can't be set for blocks that aren't linked // VALID_TRANSACTIONS is equivalent to nTx > 0 for all nodes (whether or not pruning has occurred). // HAVE_DATA is only equivalent to nTx > 0 (or VALID_TRANSACTIONS) if no pruning has occurred. if (!fHavePruned) { // If we've never pruned, then HAVE_DATA should be equivalent to nTx > 0 assert(!(pindex->nStatus & BLOCK_HAVE_DATA) == (pindex->nTx == 0)); assert(pindexFirstMissing == pindexFirstNeverProcessed); } else { // If we have pruned, then we can only say that HAVE_DATA implies nTx > 0 if (pindex->nStatus & BLOCK_HAVE_DATA) assert(pindex->nTx > 0); } if (pindex->nStatus & BLOCK_HAVE_UNDO) assert(pindex->nStatus & BLOCK_HAVE_DATA); assert(((pindex->nStatus & BLOCK_VALID_MASK) >= BLOCK_VALID_TRANSACTIONS) == (pindex->nTx > 0)); // This is pruning-independent. // All parents having had data (at some point) is equivalent to all parents being VALID_TRANSACTIONS, which is equivalent to nChainTx being set. assert((pindexFirstNeverProcessed != NULL) == (pindex->nChainTx == 0)); // nChainTx != 0 is used to signal that all parent blocks have been processed (but may have been pruned). assert((pindexFirstNotTransactionsValid != NULL) == (pindex->nChainTx == 0)); assert(pindex->nHeight == nHeight); // nHeight must be consistent. assert(pindex->pprev == NULL || pindex->nChainWork >= pindex->pprev->nChainWork); // For every block except the genesis block, the chainwork must be larger than the parent's. assert(nHeight < 2 || (pindex->pskip && (pindex->pskip->nHeight < nHeight))); // The pskip pointer must point back for all but the first 2 blocks. assert(pindexFirstNotTreeValid == NULL); // All mapBlockIndex entries must at least be TREE valid if ((pindex->nStatus & BLOCK_VALID_MASK) >= BLOCK_VALID_TREE) assert(pindexFirstNotTreeValid == NULL); // TREE valid implies all parents are TREE valid if ((pindex->nStatus & BLOCK_VALID_MASK) >= BLOCK_VALID_CHAIN) assert(pindexFirstNotChainValid == NULL); // CHAIN valid implies all parents are CHAIN valid if ((pindex->nStatus & BLOCK_VALID_MASK) >= BLOCK_VALID_SCRIPTS) assert(pindexFirstNotScriptsValid == NULL); // SCRIPTS valid implies all parents are SCRIPTS valid if (pindexFirstInvalid == NULL) { // Checks for not-invalid blocks. assert((pindex->nStatus & BLOCK_FAILED_MASK) == 0); // The failed mask cannot be set for blocks without invalid parents. } if (!CBlockIndexWorkComparator()(pindex, chainActive.Tip()) && pindexFirstNeverProcessed == NULL) { if (pindexFirstInvalid == NULL) { // If this block sorts at least as good as the current tip and // is valid and we have all data for its parents, it must be in // setBlockIndexCandidates. chainActive.Tip() must also be there // even if some data has been pruned. if (pindexFirstMissing == NULL || pindex == chainActive.Tip()) { assert(setBlockIndexCandidates.count(pindex)); } // If some parent is missing, then it could be that this block was in // setBlockIndexCandidates but had to be removed because of the missing data. // In this case it must be in mapBlocksUnlinked -- see test below. } } else { // If this block sorts worse than the current tip or some ancestor's block has never been seen, it cannot be in setBlockIndexCandidates. assert(setBlockIndexCandidates.count(pindex) == 0); } // Check whether this block is in mapBlocksUnlinked. std::pair<std::multimap<CBlockIndex*,CBlockIndex*>::iterator,std::multimap<CBlockIndex*,CBlockIndex*>::iterator> rangeUnlinked = mapBlocksUnlinked.equal_range(pindex->pprev); bool foundInUnlinked = false; while (rangeUnlinked.first != rangeUnlinked.second) { assert(rangeUnlinked.first->first == pindex->pprev); if (rangeUnlinked.first->second == pindex) { foundInUnlinked = true; break; } rangeUnlinked.first++; } if (pindex->pprev && (pindex->nStatus & BLOCK_HAVE_DATA) && pindexFirstNeverProcessed != NULL && pindexFirstInvalid == NULL) { // If this block has block data available, some parent was never received, and has no invalid parents, it must be in mapBlocksUnlinked. assert(foundInUnlinked); } if (!(pindex->nStatus & BLOCK_HAVE_DATA)) assert(!foundInUnlinked); // Can't be in mapBlocksUnlinked if we don't HAVE_DATA if (pindexFirstMissing == NULL) assert(!foundInUnlinked); // We aren't missing data for any parent -- cannot be in mapBlocksUnlinked. if (pindex->pprev && (pindex->nStatus & BLOCK_HAVE_DATA) && pindexFirstNeverProcessed == NULL && pindexFirstMissing != NULL) { // We HAVE_DATA for this block, have received data for all parents at some point, but we're currently missing data for some parent. assert(fHavePruned); // We must have pruned. // This block may have entered mapBlocksUnlinked if: // - it has a descendant that at some point had more work than the // tip, and // - we tried switching to that descendant but were missing // data for some intermediate block between chainActive and the // tip. // So if this block is itself better than chainActive.Tip() and it wasn't in // setBlockIndexCandidates, then it must be in mapBlocksUnlinked. if (!CBlockIndexWorkComparator()(pindex, chainActive.Tip()) && setBlockIndexCandidates.count(pindex) == 0) { if (pindexFirstInvalid == NULL) { assert(foundInUnlinked); } } } // assert(pindex->GetBlockHash() == pindex->GetBlockHeader().GetHash()); // Perhaps too slow // End: actual consistency checks. // Try descending into the first subnode. std::pair<std::multimap<CBlockIndex*,CBlockIndex*>::iterator,std::multimap<CBlockIndex*,CBlockIndex*>::iterator> range = forward.equal_range(pindex); if (range.first != range.second) { // A subnode was found. pindex = range.first->second; nHeight++; continue; } // This is a leaf node. // Move upwards until we reach a node of which we have not yet visited the last child. while (pindex) { // We are going to either move to a parent or a sibling of pindex. // If pindex was the first with a certain property, unset the corresponding variable. if (pindex == pindexFirstInvalid) pindexFirstInvalid = NULL; if (pindex == pindexFirstMissing) pindexFirstMissing = NULL; if (pindex == pindexFirstNeverProcessed) pindexFirstNeverProcessed = NULL; if (pindex == pindexFirstNotTreeValid) pindexFirstNotTreeValid = NULL; if (pindex == pindexFirstNotTransactionsValid) pindexFirstNotTransactionsValid = NULL; if (pindex == pindexFirstNotChainValid) pindexFirstNotChainValid = NULL; if (pindex == pindexFirstNotScriptsValid) pindexFirstNotScriptsValid = NULL; // Find our parent. CBlockIndex* pindexPar = pindex->pprev; // Find which child we just visited. std::pair<std::multimap<CBlockIndex*,CBlockIndex*>::iterator,std::multimap<CBlockIndex*,CBlockIndex*>::iterator> rangePar = forward.equal_range(pindexPar); while (rangePar.first->second != pindex) { assert(rangePar.first != rangePar.second); // Our parent must have at least the node we're coming from as child. rangePar.first++; } // Proceed to the next one. rangePar.first++; if (rangePar.first != rangePar.second) { // Move to the sibling. pindex = rangePar.first->second; break; } else { // Move up further. pindex = pindexPar; nHeight--; continue; } } } // Check that we actually traversed the entire map. assert(nNodes == forward.size()); } ////////////////////////////////////////////////////////////////////////////// // // CAlert // std::string GetWarnings(const std::string& strFor) { int nPriority = 0; string strStatusBar; string strRPC; string strGUI; if (!CLIENT_VERSION_IS_RELEASE) { strStatusBar = "This is a pre-release test build - use at your own risk - do not use for mining or merchant applications"; strGUI = _("This is a pre-release test build - use at your own risk - do not use for mining or merchant applications"); } if (GetBoolArg("-testsafemode", DEFAULT_TESTSAFEMODE)) strStatusBar = strRPC = strGUI = "testsafemode enabled"; // Misc warnings like out of disk space and clock is wrong if (strMiscWarning != "") { nPriority = 1000; strStatusBar = strGUI = strMiscWarning; } if (fLargeWorkForkFound) { nPriority = 2000; strStatusBar = strRPC = "Warning: The network does not appear to fully agree! Some miners appear to be experiencing issues."; strGUI = _("Warning: The network does not appear to fully agree! Some miners appear to be experiencing issues."); } else if (fLargeWorkInvalidChainFound) { nPriority = 2000; strStatusBar = strRPC = "Warning: We do not appear to fully agree with our peers! You may need to upgrade, or other nodes may need to upgrade."; strGUI = _("Warning: We do not appear to fully agree with our peers! You may need to upgrade, or other nodes may need to upgrade."); } // Alerts { LOCK(cs_mapAlerts); BOOST_FOREACH(PAIRTYPE(const uint256, CAlert)& item, mapAlerts) { const CAlert& alert = item.second; if (alert.AppliesToMe() && alert.nPriority > nPriority) { nPriority = alert.nPriority; strStatusBar = strGUI = alert.strStatusBar; } } } if (strFor == "gui") return strGUI; else if (strFor == "statusbar") return strStatusBar; else if (strFor == "rpc") return strRPC; assert(!"GetWarnings(): invalid parameter"); return "error"; } ////////////////////////////////////////////////////////////////////////////// // // Messages // bool static AlreadyHave(const CInv& inv) EXCLUSIVE_LOCKS_REQUIRED(cs_main) { switch (inv.type) { case MSG_TX: { assert(recentRejects); if (chainActive.Tip()->GetBlockHash() != hashRecentRejectsChainTip) { // If the chain tip has changed previously rejected transactions // might be now valid, e.g. due to a nLockTime'd tx becoming valid, // or a double-spend. Reset the rejects filter and give those // txs a second chance. hashRecentRejectsChainTip = chainActive.Tip()->GetBlockHash(); recentRejects->reset(); } return recentRejects->contains(inv.hash) || mempool.exists(inv.hash) || mapOrphanTransactions.count(inv.hash) || pcoinsTip->HaveCoins(inv.hash); } case MSG_BLOCK: return mapBlockIndex.count(inv.hash); } // Don't know what it is, just say we already got one return true; } void static ProcessGetData(CNode* pfrom, const Consensus::Params& consensusParams) { std::deque<CInv>::iterator it = pfrom->vRecvGetData.begin(); vector<CInv> vNotFound; LOCK(cs_main); while (it != pfrom->vRecvGetData.end()) { // Don't bother if send buffer is too full to respond anyway if (pfrom->nSendSize >= SendBufferSize()) break; const CInv &inv = *it; { boost::this_thread::interruption_point(); it++; if (inv.type == MSG_BLOCK || inv.type == MSG_FILTERED_BLOCK) { bool send = false; BlockMap::iterator mi = mapBlockIndex.find(inv.hash); if (mi != mapBlockIndex.end()) { if (chainActive.Contains(mi->second)) { send = true; } else { static const int nOneMonth = 30 * 24 * 60 * 60; // To prevent fingerprinting attacks, only send blocks outside of the active // chain if they are valid, and no more than a month older (both in time, and in // best equivalent proof of work) than the best header chain we know about. send = mi->second->IsValid(BLOCK_VALID_SCRIPTS) && (pindexBestHeader != NULL) && (pindexBestHeader->GetBlockTime() - mi->second->GetBlockTime() < nOneMonth) && (GetBlockProofEquivalentTime(*pindexBestHeader, *mi->second, *pindexBestHeader, consensusParams) < nOneMonth); if (!send) { LogPrintf("%s: ignoring request from peer=%i for old block that isn't in the main chain\n", __func__, pfrom->GetId()); } } } // disconnect node in case we have reached the outbound limit for serving historical blocks // never disconnect whitelisted nodes static const int nOneWeek = 7 * 24 * 60 * 60; // assume > 1 week = historical if (send && CNode::OutboundTargetReached(true) && ( ((pindexBestHeader != NULL) && (pindexBestHeader->GetBlockTime() - mi->second->GetBlockTime() > nOneWeek)) || inv.type == MSG_FILTERED_BLOCK) && !pfrom->fWhitelisted) { LogPrint("net", "historical block serving limit reached, disconnect peer=%d\n", pfrom->GetId()); //disconnect node pfrom->fDisconnect = true; send = false; } // Pruned nodes may have deleted the block, so check whether // it's available before trying to send. if (send && (mi->second->nStatus & BLOCK_HAVE_DATA)) { // Send block from disk CBlock block; if (!ReadBlockFromDisk(block, (*mi).second, consensusParams)) assert(!"cannot load block from disk"); if (inv.type == MSG_BLOCK) pfrom->PushMessage(NetMsgType::BLOCK, block); else // MSG_FILTERED_BLOCK) { LOCK(pfrom->cs_filter); if (pfrom->pfilter) { CMerkleBlock merkleBlock(block, *pfrom->pfilter); pfrom->PushMessage(NetMsgType::MERKLEBLOCK, merkleBlock); // CMerkleBlock just contains hashes, so also push any transactions in the block the client did not see // This avoids hurting performance by pointlessly requiring a round-trip // Note that there is currently no way for a node to request any single transactions we didn't send here - // they must either disconnect and retry or request the full block. // Thus, the protocol spec specified allows for us to provide duplicate txn here, // however we MUST always provide at least what the remote peer needs typedef std::pair<unsigned int, uint256> PairType; BOOST_FOREACH(PairType& pair, merkleBlock.vMatchedTxn) pfrom->PushMessage(NetMsgType::TX, block.vtx[pair.first]); } // else // no response } // Trigger the peer node to send a getblocks request for the next batch of inventory if (inv.hash == pfrom->hashContinue) { // Bypass PushInventory, this must send even if redundant, // and we want it right after the last block so they don't // wait for other stuff first. vector<CInv> vInv; vInv.push_back(CInv(MSG_BLOCK, chainActive.Tip()->GetBlockHash())); pfrom->PushMessage(NetMsgType::INV, vInv); pfrom->hashContinue.SetNull(); } } } else if (inv.IsKnownType()) { // Send stream from relay memory bool pushed = false; { LOCK(cs_mapRelay); map<CInv, CDataStream>::iterator mi = mapRelay.find(inv); if (mi != mapRelay.end()) { pfrom->PushMessage(inv.GetCommand(), (*mi).second); pushed = true; } } if (!pushed && inv.type == MSG_TX) { CTransaction tx; if (mempool.lookup(inv.hash, tx)) { CDataStream ss(SER_NETWORK, PROTOCOL_VERSION); ss.reserve(1000); ss << tx; pfrom->PushMessage(NetMsgType::TX, ss); pushed = true; } } if (!pushed) { vNotFound.push_back(inv); } } // Track requests for our stuff. GetMainSignals().Inventory(inv.hash); if (inv.type == MSG_BLOCK || inv.type == MSG_FILTERED_BLOCK) break; } } pfrom->vRecvGetData.erase(pfrom->vRecvGetData.begin(), it); if (!vNotFound.empty()) { // Let the peer know that we didn't find what it asked for, so it doesn't // have to wait around forever. Currently only SPV clients actually care // about this message: it's needed when they are recursively walking the // dependencies of relevant unconfirmed transactions. SPV clients want to // do that because they want to know about (and store and rebroadcast and // risk analyze) the dependencies of transactions relevant to them, without // having to download the entire memory pool. pfrom->PushMessage(NetMsgType::NOTFOUND, vNotFound); } } bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, int64_t nTimeReceived) { const CChainParams& chainparams = Params(); RandAddSeedPerfmon(); LogPrint("net", "received: %s (%u bytes) peer=%d\n", SanitizeString(strCommand), vRecv.size(), pfrom->id); if (mapArgs.count("-dropmessagestest") && GetRand(atoi(mapArgs["-dropmessagestest"])) == 0) { LogPrintf("dropmessagestest DROPPING RECV MESSAGE\n"); return true; } if (!(nLocalServices & NODE_BLOOM) && (strCommand == NetMsgType::FILTERLOAD || strCommand == NetMsgType::FILTERADD || strCommand == NetMsgType::FILTERCLEAR)) { if (pfrom->nVersion >= NO_BLOOM_VERSION) { Misbehaving(pfrom->GetId(), 100); return false; } else if (GetBoolArg("-enforcenodebloom", false)) { pfrom->fDisconnect = true; return false; } } if (strCommand == NetMsgType::VERSION) { // Each connection can only send one version message if (pfrom->nVersion != 0) { pfrom->PushMessage(NetMsgType::REJECT, strCommand, REJECT_DUPLICATE, string("Duplicate version message")); Misbehaving(pfrom->GetId(), 1); return false; } int64_t nTime; CAddress addrMe; CAddress addrFrom; uint64_t nNonce = 1; vRecv >> pfrom->nVersion >> pfrom->nServices >> nTime >> addrMe; if (pfrom->nVersion < MIN_PEER_PROTO_VERSION) { // disconnect from peers older than this proto version LogPrintf("peer=%d using obsolete version %i; disconnecting\n", pfrom->id, pfrom->nVersion); pfrom->PushMessage(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE, strprintf("Version must be %d or greater", MIN_PEER_PROTO_VERSION)); pfrom->fDisconnect = true; return false; } if (pfrom->nVersion == 10300) pfrom->nVersion = 300; if (!vRecv.empty()) vRecv >> addrFrom >> nNonce; if (!vRecv.empty()) { vRecv >> LIMITED_STRING(pfrom->strSubVer, MAX_SUBVERSION_LENGTH); pfrom->cleanSubVer = SanitizeString(pfrom->strSubVer); } if (!vRecv.empty()) vRecv >> pfrom->nStartingHeight; if (!vRecv.empty()) vRecv >> pfrom->fRelayTxes; // set to true after we get the first filter* message else pfrom->fRelayTxes = true; // Disconnect if we connected to ourself if (nNonce == nLocalHostNonce && nNonce > 1) { LogPrintf("connected to self at %s, disconnecting\n", pfrom->addr.ToString()); pfrom->fDisconnect = true; return true; } pfrom->addrLocal = addrMe; if (pfrom->fInbound && addrMe.IsRoutable()) { SeenLocal(addrMe); } // Be shy and don't send version until we hear if (pfrom->fInbound) pfrom->PushVersion(); pfrom->fClient = !(pfrom->nServices & NODE_NETWORK); // Potentially mark this peer as a preferred download peer. UpdatePreferredDownload(pfrom, State(pfrom->GetId())); // Change version pfrom->PushMessage(NetMsgType::VERACK); pfrom->ssSend.SetVersion(min(pfrom->nVersion, PROTOCOL_VERSION)); if (!pfrom->fInbound) { // Advertise our address if (fListen && !IsInitialBlockDownload()) { CAddress addr = GetLocalAddress(&pfrom->addr); if (addr.IsRoutable()) { LogPrintf("ProcessMessages: advertizing address %s\n", addr.ToString()); pfrom->PushAddress(addr); } else if (IsPeerAddrLocalGood(pfrom)) { addr.SetIP(pfrom->addrLocal); LogPrintf("ProcessMessages: advertizing address %s\n", addr.ToString()); pfrom->PushAddress(addr); } } // Get recent addresses if (pfrom->fOneShot || pfrom->nVersion >= CADDR_TIME_VERSION || addrman.size() < 1000) { pfrom->PushMessage(NetMsgType::GETADDR); pfrom->fGetAddr = true; } addrman.Good(pfrom->addr); } else { if (((CNetAddr)pfrom->addr) == (CNetAddr)addrFrom) { addrman.Add(addrFrom, addrFrom); addrman.Good(addrFrom); } } // Relay alerts { LOCK(cs_mapAlerts); BOOST_FOREACH(PAIRTYPE(const uint256, CAlert)& item, mapAlerts) item.second.RelayTo(pfrom); } pfrom->fSuccessfullyConnected = true; string remoteAddr; if (fLogIPs) remoteAddr = ", peeraddr=" + pfrom->addr.ToString(); LogPrintf("receive version message: %s: version %d, blocks=%d, us=%s, peer=%d%s\n", pfrom->cleanSubVer, pfrom->nVersion, pfrom->nStartingHeight, addrMe.ToString(), pfrom->id, remoteAddr); int64_t nTimeOffset = nTime - GetTime(); pfrom->nTimeOffset = nTimeOffset; AddTimeData(pfrom->addr, nTimeOffset); } else if (pfrom->nVersion == 0) { // Must have a version message before anything else Misbehaving(pfrom->GetId(), 1); return false; } else if (strCommand == NetMsgType::VERACK) { pfrom->SetRecvVersion(min(pfrom->nVersion, PROTOCOL_VERSION)); // Mark this node as currently connected, so we update its timestamp later. if (pfrom->fNetworkNode) { LOCK(cs_main); State(pfrom->GetId())->fCurrentlyConnected = true; } if (pfrom->nVersion >= SENDHEADERS_VERSION) { // Tell our peer we prefer to receive headers rather than inv's // We send this to non-NODE NETWORK peers as well, because even // non-NODE NETWORK peers can announce blocks (such as pruning // nodes) pfrom->PushMessage(NetMsgType::SENDHEADERS); } } else if (strCommand == NetMsgType::ADDR) { vector<CAddress> vAddr; vRecv >> vAddr; // Don't want addr from older versions unless seeding if (pfrom->nVersion < CADDR_TIME_VERSION && addrman.size() > 1000) return true; if (vAddr.size() > 1000) { Misbehaving(pfrom->GetId(), 20); return error("message addr size() = %u", vAddr.size()); } // Store the new addresses vector<CAddress> vAddrOk; int64_t nNow = GetAdjustedTime(); int64_t nSince = nNow - 10 * 60; BOOST_FOREACH(CAddress& addr, vAddr) { boost::this_thread::interruption_point(); if (addr.nTime <= 100000000 || addr.nTime > nNow + 10 * 60) addr.nTime = nNow - 5 * 24 * 60 * 60; pfrom->AddAddressKnown(addr); bool fReachable = IsReachable(addr); if (addr.nTime > nSince && !pfrom->fGetAddr && vAddr.size() <= 10 && addr.IsRoutable()) { // Relay to a limited number of other nodes { LOCK(cs_vNodes); // Use deterministic randomness to send to the same nodes for 24 hours // at a time so the addrKnowns of the chosen nodes prevent repeats static uint256 hashSalt; if (hashSalt.IsNull()) hashSalt = GetRandHash(); uint64_t hashAddr = addr.GetHash(); uint256 hashRand = ArithToUint256(UintToArith256(hashSalt) ^ (hashAddr<<32) ^ ((GetTime()+hashAddr)/(24*60*60))); hashRand = Hash(BEGIN(hashRand), END(hashRand)); multimap<uint256, CNode*> mapMix; BOOST_FOREACH(CNode* pnode, vNodes) { if (pnode->nVersion < CADDR_TIME_VERSION) continue; unsigned int nPointer; memcpy(&nPointer, &pnode, sizeof(nPointer)); uint256 hashKey = ArithToUint256(UintToArith256(hashRand) ^ nPointer); hashKey = Hash(BEGIN(hashKey), END(hashKey)); mapMix.insert(make_pair(hashKey, pnode)); } int nRelayNodes = fReachable ? 2 : 1; // limited relaying of addresses outside our network(s) for (multimap<uint256, CNode*>::iterator mi = mapMix.begin(); mi != mapMix.end() && nRelayNodes-- > 0; ++mi) ((*mi).second)->PushAddress(addr); } } // Do not store addresses outside our network if (fReachable) vAddrOk.push_back(addr); } addrman.Add(vAddrOk, pfrom->addr, 2 * 60 * 60); if (vAddr.size() < 1000) pfrom->fGetAddr = false; if (pfrom->fOneShot) pfrom->fDisconnect = true; } else if (strCommand == NetMsgType::SENDHEADERS) { LOCK(cs_main); State(pfrom->GetId())->fPreferHeaders = true; } else if (strCommand == NetMsgType::INV) { vector<CInv> vInv; vRecv >> vInv; if (vInv.size() > MAX_INV_SZ) { Misbehaving(pfrom->GetId(), 20); return error("message inv size() = %u", vInv.size()); } bool fBlocksOnly = GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY); // Allow whitelisted peers to send data other than blocks in blocks only mode if whitelistrelay is true if (pfrom->fWhitelisted && GetBoolArg("-whitelistrelay", DEFAULT_WHITELISTRELAY)) fBlocksOnly = false; LOCK(cs_main); std::vector<CInv> vToFetch; for (unsigned int nInv = 0; nInv < vInv.size(); nInv++) { const CInv &inv = vInv[nInv]; boost::this_thread::interruption_point(); pfrom->AddInventoryKnown(inv); bool fAlreadyHave = AlreadyHave(inv); LogPrint("net", "got inv: %s %s peer=%d\n", inv.ToString(), fAlreadyHave ? "have" : "new", pfrom->id); if (inv.type == MSG_BLOCK) { UpdateBlockAvailability(pfrom->GetId(), inv.hash); if (!fAlreadyHave && !fImporting && !fReindex && !mapBlocksInFlight.count(inv.hash)) { // First request the headers preceding the announced block. In the normal fully-synced // case where a new block is announced that succeeds the current tip (no reorganization), // there are no such headers. // Secondly, and only when we are close to being synced, we request the announced block directly, // to avoid an extra round-trip. Note that we must *first* ask for the headers, so by the // time the block arrives, the header chain leading up to it is already validated. Not // doing this will result in the received block being rejected as an orphan in case it is // not a direct successor. pfrom->PushMessage(NetMsgType::GETHEADERS, chainActive.GetLocator(pindexBestHeader), inv.hash); CNodeState *nodestate = State(pfrom->GetId()); if (CanDirectFetch(chainparams.GetConsensus()) && nodestate->nBlocksInFlight < MAX_BLOCKS_IN_TRANSIT_PER_PEER) { vToFetch.push_back(inv); // Mark block as in flight already, even though the actual "getdata" message only goes out // later (within the same cs_main lock, though). MarkBlockAsInFlight(pfrom->GetId(), inv.hash, chainparams.GetConsensus()); } LogPrint("net", "getheaders (%d) %s to peer=%d\n", pindexBestHeader->nHeight, inv.hash.ToString(), pfrom->id); } } else { if (fBlocksOnly) LogPrint("net", "transaction (%s) inv sent in violation of protocol peer=%d\n", inv.hash.ToString(), pfrom->id); else if (!fAlreadyHave && !fImporting && !fReindex && !IsInitialBlockDownload()) pfrom->AskFor(inv); } // Track requests for our stuff GetMainSignals().Inventory(inv.hash); if (pfrom->nSendSize > (SendBufferSize() * 2)) { Misbehaving(pfrom->GetId(), 50); return error("send buffer size() = %u", pfrom->nSendSize); } } if (!vToFetch.empty()) pfrom->PushMessage(NetMsgType::GETDATA, vToFetch); } else if (strCommand == NetMsgType::GETDATA) { vector<CInv> vInv; vRecv >> vInv; if (vInv.size() > MAX_INV_SZ) { Misbehaving(pfrom->GetId(), 20); return error("message getdata size() = %u", vInv.size()); } if (fDebug || (vInv.size() != 1)) LogPrint("net", "received getdata (%u invsz) peer=%d\n", vInv.size(), pfrom->id); if ((fDebug && vInv.size() > 0) || (vInv.size() == 1)) LogPrint("net", "received getdata for: %s peer=%d\n", vInv[0].ToString(), pfrom->id); pfrom->vRecvGetData.insert(pfrom->vRecvGetData.end(), vInv.begin(), vInv.end()); ProcessGetData(pfrom, chainparams.GetConsensus()); } else if (strCommand == NetMsgType::GETBLOCKS) { CBlockLocator locator; uint256 hashStop; vRecv >> locator >> hashStop; LOCK(cs_main); // Find the last block the caller has in the main chain CBlockIndex* pindex = FindForkInGlobalIndex(chainActive, locator); // Send the rest of the chain if (pindex) pindex = chainActive.Next(pindex); int nLimit = 500; LogPrint("net", "getblocks %d to %s limit %d from peer=%d\n", (pindex ? pindex->nHeight : -1), hashStop.IsNull() ? "end" : hashStop.ToString(), nLimit, pfrom->id); for (; pindex; pindex = chainActive.Next(pindex)) { if (pindex->GetBlockHash() == hashStop) { LogPrint("net", " getblocks stopping at %d %s\n", pindex->nHeight, pindex->GetBlockHash().ToString()); break; } // If pruning, don't inv blocks unless we have on disk and are likely to still have // for some reasonable time window (1 hour) that block relay might require. const int nPrunedBlocksLikelyToHave = MIN_BLOCKS_TO_KEEP - 3600 / chainparams.GetConsensus().nPowTargetSpacing; if (fPruneMode && (!(pindex->nStatus & BLOCK_HAVE_DATA) || pindex->nHeight <= chainActive.Tip()->nHeight - nPrunedBlocksLikelyToHave)) { LogPrint("net", " getblocks stopping, pruned or too old block at %d %s\n", pindex->nHeight, pindex->GetBlockHash().ToString()); break; } pfrom->PushInventory(CInv(MSG_BLOCK, pindex->GetBlockHash())); if (--nLimit <= 0) { // When this block is requested, we'll send an inv that'll // trigger the peer to getblocks the next batch of inventory. LogPrint("net", " getblocks stopping at limit %d %s\n", pindex->nHeight, pindex->GetBlockHash().ToString()); pfrom->hashContinue = pindex->GetBlockHash(); break; } } } else if (strCommand == NetMsgType::GETHEADERS) { CBlockLocator locator; uint256 hashStop; vRecv >> locator >> hashStop; LOCK(cs_main); if (IsInitialBlockDownload() && !pfrom->fWhitelisted) { LogPrint("net", "Ignoring getheaders from peer=%d because node is in initial block download\n", pfrom->id); return true; } CNodeState *nodestate = State(pfrom->GetId()); CBlockIndex* pindex = NULL; if (locator.IsNull()) { // If locator is null, return the hashStop block BlockMap::iterator mi = mapBlockIndex.find(hashStop); if (mi == mapBlockIndex.end()) return true; pindex = (*mi).second; } else { // Find the last block the caller has in the main chain pindex = FindForkInGlobalIndex(chainActive, locator); if (pindex) pindex = chainActive.Next(pindex); } // we must use CBlocks, as CBlockHeaders won't include the 0x00 nTx count at the end vector<CBlock> vHeaders; int nLimit = MAX_HEADERS_RESULTS; LogPrint("net", "getheaders %d to %s from peer=%d\n", (pindex ? pindex->nHeight : -1), hashStop.ToString(), pfrom->id); for (; pindex; pindex = chainActive.Next(pindex)) { vHeaders.push_back(pindex->GetBlockHeader()); if (--nLimit <= 0 || pindex->GetBlockHash() == hashStop) break; } // pindex can be NULL either if we sent chainActive.Tip() OR // if our peer has chainActive.Tip() (and thus we are sending an empty // headers message). In both cases it's safe to update // pindexBestHeaderSent to be our tip. nodestate->pindexBestHeaderSent = pindex ? pindex : chainActive.Tip(); pfrom->PushMessage(NetMsgType::HEADERS, vHeaders); } else if (strCommand == NetMsgType::TX) { // Stop processing the transaction early if // We are in blocks only mode and peer is either not whitelisted or whitelistrelay is off if (GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY) && (!pfrom->fWhitelisted || !GetBoolArg("-whitelistrelay", DEFAULT_WHITELISTRELAY))) { LogPrint("net", "transaction sent in violation of protocol peer=%d\n", pfrom->id); return true; } vector<uint256> vWorkQueue; vector<uint256> vEraseQueue; CTransaction tx; vRecv >> tx; CInv inv(MSG_TX, tx.GetHash()); pfrom->AddInventoryKnown(inv); LOCK(cs_main); bool fMissingInputs = false; CValidationState state; pfrom->setAskFor.erase(inv.hash); mapAlreadyAskedFor.erase(inv); if (!AlreadyHave(inv) && AcceptToMemoryPool(mempool, state, tx, true, &fMissingInputs)) { mempool.check(pcoinsTip); RelayTransaction(tx); vWorkQueue.push_back(inv.hash); LogPrint("mempool", "AcceptToMemoryPool: peer=%d: accepted %s (poolsz %u txn, %u kB)\n", pfrom->id, tx.GetHash().ToString(), mempool.size(), mempool.DynamicMemoryUsage() / 1000); // Recursively process any orphan transactions that depended on this one set<NodeId> setMisbehaving; for (unsigned int i = 0; i < vWorkQueue.size(); i++) { map<uint256, set<uint256> >::iterator itByPrev = mapOrphanTransactionsByPrev.find(vWorkQueue[i]); if (itByPrev == mapOrphanTransactionsByPrev.end()) continue; for (set<uint256>::iterator mi = itByPrev->second.begin(); mi != itByPrev->second.end(); ++mi) { const uint256& orphanHash = *mi; const CTransaction& orphanTx = mapOrphanTransactions[orphanHash].tx; NodeId fromPeer = mapOrphanTransactions[orphanHash].fromPeer; bool fMissingInputs2 = false; // Use a dummy CValidationState so someone can't setup nodes to counter-DoS based on orphan // resolution (that is, feeding people an invalid transaction based on LegitTxX in order to get // anyone relaying LegitTxX banned) CValidationState stateDummy; if (setMisbehaving.count(fromPeer)) continue; if (AcceptToMemoryPool(mempool, stateDummy, orphanTx, true, &fMissingInputs2)) { LogPrint("mempool", " accepted orphan tx %s\n", orphanHash.ToString()); RelayTransaction(orphanTx); vWorkQueue.push_back(orphanHash); vEraseQueue.push_back(orphanHash); } else if (!fMissingInputs2) { int nDos = 0; if (stateDummy.IsInvalid(nDos) && nDos > 0) { // Punish peer that gave us an invalid orphan tx Misbehaving(fromPeer, nDos); setMisbehaving.insert(fromPeer); LogPrint("mempool", " invalid orphan tx %s\n", orphanHash.ToString()); } // Has inputs but not accepted to mempool // Probably non-standard or insufficient fee/priority LogPrint("mempool", " removed orphan tx %s\n", orphanHash.ToString()); vEraseQueue.push_back(orphanHash); assert(recentRejects); recentRejects->insert(orphanHash); } mempool.check(pcoinsTip); } } BOOST_FOREACH(uint256 hash, vEraseQueue) EraseOrphanTx(hash); } else if (fMissingInputs) { AddOrphanTx(tx, pfrom->GetId()); // DoS prevention: do not allow mapOrphanTransactions to grow unbounded unsigned int nMaxOrphanTx = (unsigned int)std::max((int64_t)0, GetArg("-maxorphantx", DEFAULT_MAX_ORPHAN_TRANSACTIONS)); unsigned int nEvicted = LimitOrphanTxSize(nMaxOrphanTx); if (nEvicted > 0) LogPrint("mempool", "mapOrphan overflow, removed %u tx\n", nEvicted); } else { assert(recentRejects); recentRejects->insert(tx.GetHash()); if (pfrom->fWhitelisted && GetBoolArg("-whitelistforcerelay", DEFAULT_WHITELISTFORCERELAY)) { // Always relay transactions received from whitelisted peers, even // if they were already in the mempool or rejected from it due // to policy, allowing the node to function as a gateway for // nodes hidden behind it. // // Never relay transactions that we would assign a non-zero DoS // score for, as we expect peers to do the same with us in that // case. int nDoS = 0; if (!state.IsInvalid(nDoS) || nDoS == 0) { LogPrintf("Force relaying tx %s from whitelisted peer=%d\n", tx.GetHash().ToString(), pfrom->id); RelayTransaction(tx); } else { LogPrintf("Not relaying invalid transaction %s from whitelisted peer=%d (%s)\n", tx.GetHash().ToString(), pfrom->id, FormatStateMessage(state)); } } } int nDoS = 0; if (state.IsInvalid(nDoS)) { LogPrint("mempoolrej", "%s from peer=%d was not accepted: %s\n", tx.GetHash().ToString(), pfrom->id, FormatStateMessage(state)); if (state.GetRejectCode() < REJECT_INTERNAL) // Never send AcceptToMemoryPool's internal codes over P2P pfrom->PushMessage(NetMsgType::REJECT, strCommand, (unsigned char)state.GetRejectCode(), state.GetRejectReason().substr(0, MAX_REJECT_MESSAGE_LENGTH), inv.hash); if (nDoS > 0) Misbehaving(pfrom->GetId(), nDoS); } FlushStateToDisk(state, FLUSH_STATE_PERIODIC); } else if (strCommand == NetMsgType::HEADERS && !fImporting && !fReindex) // Ignore headers received while importing { std::vector<CBlockHeader> headers; // Bypass the normal CBlock deserialization, as we don't want to risk deserializing 2000 full blocks. unsigned int nCount = ReadCompactSize(vRecv); if (nCount > MAX_HEADERS_RESULTS) { Misbehaving(pfrom->GetId(), 20); return error("headers message size = %u", nCount); } headers.resize(nCount); for (unsigned int n = 0; n < nCount; n++) { vRecv >> headers[n]; ReadCompactSize(vRecv); // ignore tx count; assume it is 0. } LOCK(cs_main); if (nCount == 0) { // Nothing interesting. Stop asking this peers for more headers. return true; } CBlockIndex *pindexLast = NULL; BOOST_FOREACH(const CBlockHeader& header, headers) { CValidationState state; if (pindexLast != NULL && header.hashPrevBlock != pindexLast->GetBlockHash()) { Misbehaving(pfrom->GetId(), 20); return error("non-continuous headers sequence"); } if (!AcceptBlockHeader(header, state, chainparams, &pindexLast)) { int nDoS; if (state.IsInvalid(nDoS)) { if (nDoS > 0) Misbehaving(pfrom->GetId(), nDoS); return error("invalid header received"); } } } if (pindexLast) UpdateBlockAvailability(pfrom->GetId(), pindexLast->GetBlockHash()); if (nCount == MAX_HEADERS_RESULTS && pindexLast) { // Headers message had its maximum size; the peer may have more headers. // TODO: optimize: if pindexLast is an ancestor of chainActive.Tip or pindexBestHeader, continue // from there instead. LogPrint("net", "more getheaders (%d) to end to peer=%d (startheight:%d)\n", pindexLast->nHeight, pfrom->id, pfrom->nStartingHeight); pfrom->PushMessage(NetMsgType::GETHEADERS, chainActive.GetLocator(pindexLast), uint256()); } bool fCanDirectFetch = CanDirectFetch(chainparams.GetConsensus()); CNodeState *nodestate = State(pfrom->GetId()); // If this set of headers is valid and ends in a block with at least as // much work as our tip, download as much as possible. if (fCanDirectFetch && pindexLast->IsValid(BLOCK_VALID_TREE) && chainActive.Tip()->nChainWork <= pindexLast->nChainWork) { vector<CBlockIndex *> vToFetch; CBlockIndex *pindexWalk = pindexLast; // Calculate all the blocks we'd need to switch to pindexLast, up to a limit. while (pindexWalk && !chainActive.Contains(pindexWalk) && vToFetch.size() <= MAX_BLOCKS_IN_TRANSIT_PER_PEER) { if (!(pindexWalk->nStatus & BLOCK_HAVE_DATA) && !mapBlocksInFlight.count(pindexWalk->GetBlockHash())) { // We don't have this block, and it's not yet in flight. vToFetch.push_back(pindexWalk); } pindexWalk = pindexWalk->pprev; } // If pindexWalk still isn't on our main chain, we're looking at a // very large reorg at a time we think we're close to caught up to // the main chain -- this shouldn't really happen. Bail out on the // direct fetch and rely on parallel download instead. if (!chainActive.Contains(pindexWalk)) { LogPrint("net", "Large reorg, won't direct fetch to %s (%d)\n", pindexLast->GetBlockHash().ToString(), pindexLast->nHeight); } else { vector<CInv> vGetData; // Download as much as possible, from earliest to latest. BOOST_REVERSE_FOREACH(CBlockIndex *pindex, vToFetch) { if (nodestate->nBlocksInFlight >= MAX_BLOCKS_IN_TRANSIT_PER_PEER) { // Can't download any more from this peer break; } vGetData.push_back(CInv(MSG_BLOCK, pindex->GetBlockHash())); MarkBlockAsInFlight(pfrom->GetId(), pindex->GetBlockHash(), chainparams.GetConsensus(), pindex); LogPrint("net", "Requesting block %s from peer=%d\n", pindex->GetBlockHash().ToString(), pfrom->id); } if (vGetData.size() > 1) { LogPrint("net", "Downloading blocks toward %s (%d) via headers direct fetch\n", pindexLast->GetBlockHash().ToString(), pindexLast->nHeight); } if (vGetData.size() > 0) { pfrom->PushMessage(NetMsgType::GETDATA, vGetData); } } } CheckBlockIndex(chainparams.GetConsensus()); } else if (strCommand == NetMsgType::BLOCK && !fImporting && !fReindex) // Ignore blocks received while importing { CBlock block; vRecv >> block; CInv inv(MSG_BLOCK, block.GetHash()); LogPrint("net", "received block %s peer=%d\n", inv.hash.ToString(), pfrom->id); pfrom->AddInventoryKnown(inv); CValidationState state; // Process all blocks from whitelisted peers, even if not requested, // unless we're still syncing with the network. // Such an unrequested block may still be processed, subject to the // conditions in AcceptBlock(). bool forceProcessing = pfrom->fWhitelisted && !IsInitialBlockDownload(); ProcessNewBlock(state, chainparams, pfrom, &block, forceProcessing, NULL); int nDoS; if (state.IsInvalid(nDoS)) { assert (state.GetRejectCode() < REJECT_INTERNAL); // Blocks are never rejected with internal reject codes pfrom->PushMessage(NetMsgType::REJECT, strCommand, (unsigned char)state.GetRejectCode(), state.GetRejectReason().substr(0, MAX_REJECT_MESSAGE_LENGTH), inv.hash); if (nDoS > 0) { LOCK(cs_main); Misbehaving(pfrom->GetId(), nDoS); } } } // This asymmetric behavior for inbound and outbound connections was introduced // to prevent a fingerprinting attack: an attacker can send specific fake addresses // to users' AddrMan and later request them by sending getaddr messages. // Making nodes which are behind NAT and can only make outgoing connections ignore // the getaddr message mitigates the attack. else if ((strCommand == NetMsgType::GETADDR) && (pfrom->fInbound)) { pfrom->vAddrToSend.clear(); vector<CAddress> vAddr = addrman.GetAddr(); BOOST_FOREACH(const CAddress &addr, vAddr) pfrom->PushAddress(addr); } else if (strCommand == NetMsgType::MEMPOOL) { if (CNode::OutboundTargetReached(false) && !pfrom->fWhitelisted) { LogPrint("net", "mempool request with bandwidth limit reached, disconnect peer=%d\n", pfrom->GetId()); pfrom->fDisconnect = true; return true; } LOCK2(cs_main, pfrom->cs_filter); std::vector<uint256> vtxid; mempool.queryHashes(vtxid); vector<CInv> vInv; BOOST_FOREACH(uint256& hash, vtxid) { CInv inv(MSG_TX, hash); if (pfrom->pfilter) { CTransaction tx; bool fInMemPool = mempool.lookup(hash, tx); if (!fInMemPool) continue; // another thread removed since queryHashes, maybe... if (!pfrom->pfilter->IsRelevantAndUpdate(tx)) continue; } vInv.push_back(inv); if (vInv.size() == MAX_INV_SZ) { pfrom->PushMessage(NetMsgType::INV, vInv); vInv.clear(); } } if (vInv.size() > 0) pfrom->PushMessage(NetMsgType::INV, vInv); } else if (strCommand == NetMsgType::PING) { if (pfrom->nVersion > BIP0031_VERSION) { uint64_t nonce = 0; vRecv >> nonce; // Echo the message back with the nonce. This allows for two useful features: // // 1) A remote node can quickly check if the connection is operational // 2) Remote nodes can measure the latency of the network thread. If this node // is overloaded it won't respond to pings quickly and the remote node can // avoid sending us more work, like chain download requests. // // The nonce stops the remote getting confused between different pings: without // it, if the remote node sends a ping once per second and this node takes 5 // seconds to respond to each, the 5th ping the remote sends would appear to // return very quickly. pfrom->PushMessage(NetMsgType::PONG, nonce); } } else if (strCommand == NetMsgType::PONG) { int64_t pingUsecEnd = nTimeReceived; uint64_t nonce = 0; size_t nAvail = vRecv.in_avail(); bool bPingFinished = false; std::string sProblem; if (nAvail >= sizeof(nonce)) { vRecv >> nonce; // Only process pong message if there is an outstanding ping (old ping without nonce should never pong) if (pfrom->nPingNonceSent != 0) { if (nonce == pfrom->nPingNonceSent) { // Matching pong received, this ping is no longer outstanding bPingFinished = true; int64_t pingUsecTime = pingUsecEnd - pfrom->nPingUsecStart; if (pingUsecTime > 0) { // Successful ping time measurement, replace previous pfrom->nPingUsecTime = pingUsecTime; pfrom->nMinPingUsecTime = std::min(pfrom->nMinPingUsecTime, pingUsecTime); } else { // This should never happen sProblem = "Timing mishap"; } } else { // Nonce mismatches are normal when pings are overlapping sProblem = "Nonce mismatch"; if (nonce == 0) { // This is most likely a bug in another implementation somewhere; cancel this ping bPingFinished = true; sProblem = "Nonce zero"; } } } else { sProblem = "Unsolicited pong without ping"; } } else { // This is most likely a bug in another implementation somewhere; cancel this ping bPingFinished = true; sProblem = "Short payload"; } if (!(sProblem.empty())) { LogPrint("net", "pong peer=%d: %s, %x expected, %x received, %u bytes\n", pfrom->id, sProblem, pfrom->nPingNonceSent, nonce, nAvail); } if (bPingFinished) { pfrom->nPingNonceSent = 0; } } else if (fAlerts && strCommand == NetMsgType::ALERT) { CAlert alert; vRecv >> alert; uint256 alertHash = alert.GetHash(); if (pfrom->setKnown.count(alertHash) == 0) { if (alert.ProcessAlert(chainparams.AlertKey())) { // Relay pfrom->setKnown.insert(alertHash); { LOCK(cs_vNodes); BOOST_FOREACH(CNode* pnode, vNodes) alert.RelayTo(pnode); } } else { // Small DoS penalty so peers that send us lots of // duplicate/expired/invalid-signature/whatever alerts // eventually get banned. // This isn't a Misbehaving(100) (immediate ban) because the // peer might be an older or different implementation with // a different signature key, etc. Misbehaving(pfrom->GetId(), 10); } } } else if (strCommand == NetMsgType::FILTERLOAD) { CBloomFilter filter; vRecv >> filter; if (!filter.IsWithinSizeConstraints()) // There is no excuse for sending a too-large filter Misbehaving(pfrom->GetId(), 100); else { LOCK(pfrom->cs_filter); delete pfrom->pfilter; pfrom->pfilter = new CBloomFilter(filter); pfrom->pfilter->UpdateEmptyFull(); } pfrom->fRelayTxes = true; } else if (strCommand == NetMsgType::FILTERADD) { vector<unsigned char> vData; vRecv >> vData; // Nodes must NEVER send a data item > 520 bytes (the max size for a script data object, // and thus, the maximum size any matched object can have) in a filteradd message if (vData.size() > MAX_SCRIPT_ELEMENT_SIZE) { Misbehaving(pfrom->GetId(), 100); } else { LOCK(pfrom->cs_filter); if (pfrom->pfilter) pfrom->pfilter->insert(vData); else Misbehaving(pfrom->GetId(), 100); } } else if (strCommand == NetMsgType::FILTERCLEAR) { LOCK(pfrom->cs_filter); delete pfrom->pfilter; pfrom->pfilter = new CBloomFilter(); pfrom->fRelayTxes = true; } else if (strCommand == NetMsgType::REJECT) { if (fDebug) { try { string strMsg; unsigned char ccode; string strReason; vRecv >> LIMITED_STRING(strMsg, CMessageHeader::COMMAND_SIZE) >> ccode >> LIMITED_STRING(strReason, MAX_REJECT_MESSAGE_LENGTH); ostringstream ss; ss << strMsg << " code " << itostr(ccode) << ": " << strReason; if (strMsg == NetMsgType::BLOCK || strMsg == NetMsgType::TX) { uint256 hash; vRecv >> hash; ss << ": hash " << hash.ToString(); } LogPrint("net", "Reject %s\n", SanitizeString(ss.str())); } catch (const std::ios_base::failure&) { // Avoid feedback loops by preventing reject messages from triggering a new reject message. LogPrint("net", "Unparseable reject message received\n"); } } } else { // Ignore unknown commands for extensibility LogPrint("net", "Unknown command \"%s\" from peer=%d\n", SanitizeString(strCommand), pfrom->id); } return true; } // requires LOCK(cs_vRecvMsg) bool ProcessMessages(CNode* pfrom) { const CChainParams& chainparams = Params(); //if (fDebug) // LogPrintf("%s(%u messages)\n", __func__, pfrom->vRecvMsg.size()); // // Message format // (4) message start // (12) command // (4) size // (4) checksum // (x) data // bool fOk = true; if (!pfrom->vRecvGetData.empty()) ProcessGetData(pfrom, chainparams.GetConsensus()); // this maintains the order of responses if (!pfrom->vRecvGetData.empty()) return fOk; std::deque<CNetMessage>::iterator it = pfrom->vRecvMsg.begin(); while (!pfrom->fDisconnect && it != pfrom->vRecvMsg.end()) { // Don't bother if send buffer is too full to respond anyway if (pfrom->nSendSize >= SendBufferSize()) break; // get next message CNetMessage& msg = *it; //if (fDebug) // LogPrintf("%s(message %u msgsz, %u bytes, complete:%s)\n", __func__, // msg.hdr.nMessageSize, msg.vRecv.size(), // msg.complete() ? "Y" : "N"); // end, if an incomplete message is found if (!msg.complete()) break; // at this point, any failure means we can delete the current message it++; // Scan for message start if (memcmp(msg.hdr.pchMessageStart, chainparams.MessageStart(), MESSAGE_START_SIZE) != 0) { LogPrintf("PROCESSMESSAGE: INVALID MESSAGESTART %s peer=%d\n", SanitizeString(msg.hdr.GetCommand()), pfrom->id); fOk = false; break; } // Read header CMessageHeader& hdr = msg.hdr; if (!hdr.IsValid(chainparams.MessageStart())) { LogPrintf("PROCESSMESSAGE: ERRORS IN HEADER %s peer=%d\n", SanitizeString(hdr.GetCommand()), pfrom->id); continue; } string strCommand = hdr.GetCommand(); // Message size unsigned int nMessageSize = hdr.nMessageSize; // Checksum CDataStream& vRecv = msg.vRecv; uint256 hash = Hash(vRecv.begin(), vRecv.begin() + nMessageSize); unsigned int nChecksum = ReadLE32((unsigned char*)&hash); if (nChecksum != hdr.nChecksum) { LogPrintf("%s(%s, %u bytes): CHECKSUM ERROR nChecksum=%08x hdr.nChecksum=%08x\n", __func__, SanitizeString(strCommand), nMessageSize, nChecksum, hdr.nChecksum); continue; } // Process message bool fRet = false; try { fRet = ProcessMessage(pfrom, strCommand, vRecv, msg.nTime); boost::this_thread::interruption_point(); } catch (const std::ios_base::failure& e) { pfrom->PushMessage(NetMsgType::REJECT, strCommand, REJECT_MALFORMED, string("error parsing message")); if (strstr(e.what(), "end of data")) { // Allow exceptions from under-length message on vRecv LogPrintf("%s(%s, %u bytes): Exception '%s' caught, normally caused by a message being shorter than its stated length\n", __func__, SanitizeString(strCommand), nMessageSize, e.what()); } else if (strstr(e.what(), "size too large")) { // Allow exceptions from over-long size LogPrintf("%s(%s, %u bytes): Exception '%s' caught\n", __func__, SanitizeString(strCommand), nMessageSize, e.what()); } else { PrintExceptionContinue(&e, "ProcessMessages()"); } } catch (const boost::thread_interrupted&) { throw; } catch (const std::exception& e) { PrintExceptionContinue(&e, "ProcessMessages()"); } catch (...) { PrintExceptionContinue(NULL, "ProcessMessages()"); } if (!fRet) LogPrintf("%s(%s, %u bytes) FAILED peer=%d\n", __func__, SanitizeString(strCommand), nMessageSize, pfrom->id); break; } // In case the connection got shut down, its receive buffer was wiped if (!pfrom->fDisconnect) pfrom->vRecvMsg.erase(pfrom->vRecvMsg.begin(), it); return fOk; } bool SendMessages(CNode* pto) { const Consensus::Params& consensusParams = Params().GetConsensus(); { // Don't send anything until we get its version message if (pto->nVersion == 0) return true; // // Message: ping // bool pingSend = false; if (pto->fPingQueued) { // RPC ping request by user pingSend = true; } if (pto->nPingNonceSent == 0 && pto->nPingUsecStart + PING_INTERVAL * 1000000 < GetTimeMicros()) { // Ping automatically sent as a latency probe & keepalive. pingSend = true; } if (pingSend) { uint64_t nonce = 0; while (nonce == 0) { GetRandBytes((unsigned char*)&nonce, sizeof(nonce)); } pto->fPingQueued = false; pto->nPingUsecStart = GetTimeMicros(); if (pto->nVersion > BIP0031_VERSION) { pto->nPingNonceSent = nonce; pto->PushMessage(NetMsgType::PING, nonce); } else { // Peer is too old to support ping command with nonce, pong will never arrive. pto->nPingNonceSent = 0; pto->PushMessage(NetMsgType::PING); } } TRY_LOCK(cs_main, lockMain); // Acquire cs_main for IsInitialBlockDownload() and CNodeState() if (!lockMain) return true; // Address refresh broadcast int64_t nNow = GetTimeMicros(); if (!IsInitialBlockDownload() && pto->nNextLocalAddrSend < nNow) { AdvertizeLocal(pto); pto->nNextLocalAddrSend = PoissonNextSend(nNow, AVG_LOCAL_ADDRESS_BROADCAST_INTERVAL); } // // Message: addr // if (pto->nNextAddrSend < nNow) { pto->nNextAddrSend = PoissonNextSend(nNow, AVG_ADDRESS_BROADCAST_INTERVAL); vector<CAddress> vAddr; vAddr.reserve(pto->vAddrToSend.size()); BOOST_FOREACH(const CAddress& addr, pto->vAddrToSend) { if (!pto->addrKnown.contains(addr.GetKey())) { pto->addrKnown.insert(addr.GetKey()); vAddr.push_back(addr); // receiver rejects addr messages larger than 1000 if (vAddr.size() >= 1000) { pto->PushMessage(NetMsgType::ADDR, vAddr); vAddr.clear(); } } } pto->vAddrToSend.clear(); if (!vAddr.empty()) pto->PushMessage(NetMsgType::ADDR, vAddr); } CNodeState &state = *State(pto->GetId()); if (state.fShouldBan) { if (pto->fWhitelisted) LogPrintf("Warning: not punishing whitelisted peer %s!\n", pto->addr.ToString()); else { pto->fDisconnect = true; if (pto->addr.IsLocal()) LogPrintf("Warning: not banning local peer %s!\n", pto->addr.ToString()); else { CNode::Ban(pto->addr, BanReasonNodeMisbehaving); } } state.fShouldBan = false; } BOOST_FOREACH(const CBlockReject& reject, state.rejects) pto->PushMessage(NetMsgType::REJECT, (string)NetMsgType::BLOCK, reject.chRejectCode, reject.strRejectReason, reject.hashBlock); state.rejects.clear(); // Start block sync if (pindexBestHeader == NULL) pindexBestHeader = chainActive.Tip(); bool fFetch = state.fPreferredDownload || (nPreferredDownload == 0 && !pto->fClient && !pto->fOneShot); // Download if this is a nice peer, or we have no nice peers and this one might do. if (!state.fSyncStarted && !pto->fClient && !fImporting && !fReindex) { // Only actively request headers from a single peer, unless we're close to today. if ((nSyncStarted == 0 && fFetch) || pindexBestHeader->GetBlockTime() > GetAdjustedTime() - 24 * 60 * 60) { state.fSyncStarted = true; nSyncStarted++; const CBlockIndex *pindexStart = pindexBestHeader; /* If possible, start at the block preceding the currently best known header. This ensures that we always get a non-empty list of headers back as long as the peer is up-to-date. With a non-empty response, we can initialise the peer's known best block. This wouldn't be possible if we requested starting at pindexBestHeader and got back an empty response. */ if (pindexStart->pprev) pindexStart = pindexStart->pprev; LogPrint("net", "initial getheaders (%d) to peer=%d (startheight:%d)\n", pindexStart->nHeight, pto->id, pto->nStartingHeight); pto->PushMessage(NetMsgType::GETHEADERS, chainActive.GetLocator(pindexStart), uint256()); } } // Resend wallet transactions that haven't gotten in a block yet // Except during reindex, importing and IBD, when old wallet // transactions become unconfirmed and spams other nodes. if (!fReindex && !fImporting && !IsInitialBlockDownload()) { GetMainSignals().Broadcast(nTimeBestReceived); } // // Try sending block announcements via headers // { // If we have less than MAX_BLOCKS_TO_ANNOUNCE in our // list of block hashes we're relaying, and our peer wants // headers announcements, then find the first header // not yet known to our peer but would connect, and send. // If no header would connect, or if we have too many // blocks, or if the peer doesn't want headers, just // add all to the inv queue. LOCK(pto->cs_inventory); vector<CBlock> vHeaders; bool fRevertToInv = (!state.fPreferHeaders || pto->vBlockHashesToAnnounce.size() > MAX_BLOCKS_TO_ANNOUNCE); CBlockIndex *pBestIndex = NULL; // last header queued for delivery ProcessBlockAvailability(pto->id); // ensure pindexBestKnownBlock is up-to-date if (!fRevertToInv) { bool fFoundStartingHeader = false; // Try to find first header that our peer doesn't have, and // then send all headers past that one. If we come across any // headers that aren't on chainActive, give up. BOOST_FOREACH(const uint256 &hash, pto->vBlockHashesToAnnounce) { BlockMap::iterator mi = mapBlockIndex.find(hash); assert(mi != mapBlockIndex.end()); CBlockIndex *pindex = mi->second; if (chainActive[pindex->nHeight] != pindex) { // Bail out if we reorged away from this block fRevertToInv = true; break; } assert(pBestIndex == NULL || pindex->pprev == pBestIndex); pBestIndex = pindex; if (fFoundStartingHeader) { // add this to the headers message vHeaders.push_back(pindex->GetBlockHeader()); } else if (PeerHasHeader(&state, pindex)) { continue; // keep looking for the first new block } else if (pindex->pprev == NULL || PeerHasHeader(&state, pindex->pprev)) { // Peer doesn't have this header but they do have the prior one. // Start sending headers. fFoundStartingHeader = true; vHeaders.push_back(pindex->GetBlockHeader()); } else { // Peer doesn't have this header or the prior one -- nothing will // connect, so bail out. fRevertToInv = true; break; } } } if (fRevertToInv) { // If falling back to using an inv, just try to inv the tip. // The last entry in vBlockHashesToAnnounce was our tip at some point // in the past. if (!pto->vBlockHashesToAnnounce.empty()) { const uint256 &hashToAnnounce = pto->vBlockHashesToAnnounce.back(); BlockMap::iterator mi = mapBlockIndex.find(hashToAnnounce); assert(mi != mapBlockIndex.end()); CBlockIndex *pindex = mi->second; // Warn if we're announcing a block that is not on the main chain. // This should be very rare and could be optimized out. // Just log for now. if (chainActive[pindex->nHeight] != pindex) { LogPrint("net", "Announcing block %s not on main chain (tip=%s)\n", hashToAnnounce.ToString(), chainActive.Tip()->GetBlockHash().ToString()); } // If the peer announced this block to us, don't inv it back. // (Since block announcements may not be via inv's, we can't solely rely on // setInventoryKnown to track this.) if (!PeerHasHeader(&state, pindex)) { pto->PushInventory(CInv(MSG_BLOCK, hashToAnnounce)); LogPrint("net", "%s: sending inv peer=%d hash=%s\n", __func__, pto->id, hashToAnnounce.ToString()); } } } else if (!vHeaders.empty()) { if (vHeaders.size() > 1) { LogPrint("net", "%s: %u headers, range (%s, %s), to peer=%d\n", __func__, vHeaders.size(), vHeaders.front().GetHash().ToString(), vHeaders.back().GetHash().ToString(), pto->id); } else { LogPrint("net", "%s: sending header %s to peer=%d\n", __func__, vHeaders.front().GetHash().ToString(), pto->id); } pto->PushMessage(NetMsgType::HEADERS, vHeaders); state.pindexBestHeaderSent = pBestIndex; } pto->vBlockHashesToAnnounce.clear(); } // // Message: inventory // vector<CInv> vInv; vector<CInv> vInvWait; { bool fSendTrickle = pto->fWhitelisted; if (pto->nNextInvSend < nNow) { fSendTrickle = true; pto->nNextInvSend = PoissonNextSend(nNow, AVG_INVENTORY_BROADCAST_INTERVAL); } LOCK(pto->cs_inventory); vInv.reserve(std::min<size_t>(1000, pto->vInventoryToSend.size())); vInvWait.reserve(pto->vInventoryToSend.size()); BOOST_FOREACH(const CInv& inv, pto->vInventoryToSend) { if (inv.type == MSG_TX && pto->filterInventoryKnown.contains(inv.hash)) continue; // trickle out tx inv to protect privacy if (inv.type == MSG_TX && !fSendTrickle) { // 1/4 of tx invs blast to all immediately static uint256 hashSalt; if (hashSalt.IsNull()) hashSalt = GetRandHash(); uint256 hashRand = ArithToUint256(UintToArith256(inv.hash) ^ UintToArith256(hashSalt)); hashRand = Hash(BEGIN(hashRand), END(hashRand)); bool fTrickleWait = ((UintToArith256(hashRand) & 3) != 0); if (fTrickleWait) { vInvWait.push_back(inv); continue; } } pto->filterInventoryKnown.insert(inv.hash); vInv.push_back(inv); if (vInv.size() >= 1000) { pto->PushMessage(NetMsgType::INV, vInv); vInv.clear(); } } pto->vInventoryToSend = vInvWait; } if (!vInv.empty()) pto->PushMessage(NetMsgType::INV, vInv); // Detect whether we're stalling nNow = GetTimeMicros(); if (!pto->fDisconnect && state.nStallingSince && state.nStallingSince < nNow - 1000000 * BLOCK_STALLING_TIMEOUT) { // Stalling only triggers when the block download window cannot move. During normal steady state, // the download window should be much larger than the to-be-downloaded set of blocks, so disconnection // should only happen during initial block download. LogPrintf("Peer=%d is stalling block download, disconnecting\n", pto->id); pto->fDisconnect = true; } // In case there is a block that has been in flight from this peer for (2 + 0.5 * N) times the block interval // (with N the number of validated blocks that were in flight at the time it was requested), disconnect due to // timeout. We compensate for in-flight blocks to prevent killing off peers due to our own downstream link // being saturated. We only count validated in-flight blocks so peers can't advertise non-existing block hashes // to unreasonably increase our timeout. // We also compare the block download timeout originally calculated against the time at which we'd disconnect // if we assumed the block were being requested now (ignoring blocks we've requested from this peer, since we're // only looking at this peer's oldest request). This way a large queue in the past doesn't result in a // permanently large window for this block to be delivered (ie if the number of blocks in flight is decreasing // more quickly than once every 5 minutes, then we'll shorten the download window for this block). if (!pto->fDisconnect && state.vBlocksInFlight.size() > 0) { QueuedBlock &queuedBlock = state.vBlocksInFlight.front(); int64_t nTimeoutIfRequestedNow = GetBlockTimeout(nNow, nQueuedValidatedHeaders - state.nBlocksInFlightValidHeaders, consensusParams); if (queuedBlock.nTimeDisconnect > nTimeoutIfRequestedNow) { LogPrint("net", "Reducing block download timeout for peer=%d block=%s, orig=%d new=%d\n", pto->id, queuedBlock.hash.ToString(), queuedBlock.nTimeDisconnect, nTimeoutIfRequestedNow); queuedBlock.nTimeDisconnect = nTimeoutIfRequestedNow; } if (queuedBlock.nTimeDisconnect < nNow) { LogPrintf("Timeout downloading block %s from peer=%d, disconnecting\n", queuedBlock.hash.ToString(), pto->id); pto->fDisconnect = true; } } // // Message: getdata (blocks) // vector<CInv> vGetData; if (!pto->fDisconnect && !pto->fClient && (fFetch || !IsInitialBlockDownload()) && state.nBlocksInFlight < MAX_BLOCKS_IN_TRANSIT_PER_PEER) { vector<CBlockIndex*> vToDownload; NodeId staller = -1; FindNextBlocksToDownload(pto->GetId(), MAX_BLOCKS_IN_TRANSIT_PER_PEER - state.nBlocksInFlight, vToDownload, staller); BOOST_FOREACH(CBlockIndex *pindex, vToDownload) { vGetData.push_back(CInv(MSG_BLOCK, pindex->GetBlockHash())); MarkBlockAsInFlight(pto->GetId(), pindex->GetBlockHash(), consensusParams, pindex); LogPrint("net", "Requesting block %s (%d) peer=%d\n", pindex->GetBlockHash().ToString(), pindex->nHeight, pto->id); } if (state.nBlocksInFlight == 0 && staller != -1) { if (State(staller)->nStallingSince == 0) { State(staller)->nStallingSince = nNow; LogPrint("net", "Stall started peer=%d\n", staller); } } } // // Message: getdata (non-blocks) // while (!pto->fDisconnect && !pto->mapAskFor.empty() && (*pto->mapAskFor.begin()).first <= nNow) { const CInv& inv = (*pto->mapAskFor.begin()).second; if (!AlreadyHave(inv)) { if (fDebug) LogPrint("net", "Requesting %s peer=%d\n", inv.ToString(), pto->id); vGetData.push_back(inv); if (vGetData.size() >= 1000) { pto->PushMessage(NetMsgType::GETDATA, vGetData); vGetData.clear(); } } else { //If we're not going to ask, don't expect a response. pto->setAskFor.erase(inv.hash); } pto->mapAskFor.erase(pto->mapAskFor.begin()); } if (!vGetData.empty()) pto->PushMessage(NetMsgType::GETDATA, vGetData); } return true; } std::string CBlockFileInfo::ToString() const { return strprintf("CBlockFileInfo(blocks=%u, size=%u, heights=%u...%u, time=%s...%s)", nBlocks, nSize, nHeightFirst, nHeightLast, DateTimeStrFormat("%Y-%m-%d", nTimeFirst), DateTimeStrFormat("%Y-%m-%d", nTimeLast)); } class CMainCleanup { public: CMainCleanup() {} ~CMainCleanup() { // block headers BlockMap::iterator it1 = mapBlockIndex.begin(); for (; it1 != mapBlockIndex.end(); it1++) delete (*it1).second; mapBlockIndex.clear(); // orphan transactions mapOrphanTransactions.clear(); mapOrphanTransactionsByPrev.clear(); } } instance_of_cmaincleanup;
jameshilliard/bitcoin
src/main.cpp
C++
mit
243,548
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Client_snapshot_model extends Smartlab_model { /** * Enable soft delete */ protected $soft_delete = TRUE; /** * Protected columns */ public $protected_attributes = array( 'id' ); /** * Prototype for row creation */ private $prototype = array( 'active' => 1, 'client_id' => NULL, 'name' => NULL, 'commence' => NULL, 'expire' => NULL, ); /** * Cache container for row storage */ private $cache = array(); /** * Model validation rules * Model validation rules */ public $validate = array( array( 'field' => 'client_id', 'label' => 'client id', 'rules' => 'required|trim|integer' ), array( 'field' => 'name', 'label' => 'snapshot name', 'rules' => 'required|trim|max_length[60]|is_client_unique[client_snapshots.name]' ), array( 'field' => 'commence', 'label' => 'snapshot commencement', 'rules' => 'trim|max_length[12]' ), array( 'field' => 'expire', 'label' => 'snapshot expiry', 'rules' => 'trim|max_length[12]' ), ); /** * Model observers */ public $before_create = array('purge_cache', 'set_created_time', 'set_modified_time', 'modify_post_data'); public $before_update = array('purge_cache', 'set_modified_time', 'modify_post_data'); public $before_delete = array('purge_cache', 'delete_dependencies'); public $after_get = array('purge_cache', 'add_default_properties'); /** * Constructor */ public function __construct() { parent::__construct(); } /** * Get a client's snapshots * * @param int * @return array */ public function get_client_snapshot($client_id) { if ( ! isset($this->cache[$client_id]) ) { $this->order_by('sort_order', 'ASC'); $snapshots_data = $this->get_many_by('client_id', $client_id); $this->cache[$client_id] = $snapshots_data; } return $this->cache[$client_id]; } /** * Purge the cached rows * * @param mixed * @return mixed */ public function purge_cache($data = NULL) { $this->cache = array(); return $data; } /** * Return the model prototype * * @param int * @return object */ public function create_prototype($client_id = NULL) { date_default_timezone_set('UTC'); $this->prototype['client_id'] = $client_id; $this->prototype['commence'] = strtotime('today 0:00'); $this->prototype['expire'] = strtotime('+1 week 0:00'); return (object) $this->prototype; } /** * Define extra snapshot row properties * * @param object * @return object */ protected function add_default_properties($row) { // add the snapshot applications if (is_object($row) && ! property_exists($row, 'applications')) { $this->load->model('client_application_model'); $row->applications = $this->client_application_model->get_snapshot_applications($row->id); } // add the snapshot sessions if(is_object($row) && !property_exists($row, 'snapshots')) { $this->load->model('client_snapshots_session_model'); $row->sessions = $this->client_snapshots_session_model->get_snapshot_sessions($row->id); } return $row; } /** * Set or modify post data on create * * @param array * @return array */ protected function modify_post_data($data) { // unset the unique_id if set if ( isset($data['unique_id']) ) { unset($data['unique_id']); } // set the sort order if ( isset($data['client_id']) ) { $data['sort_order'] = $this->count_by('client_id', $data['client_id']) + 1; } // check if expire time is smaller than the commence time, set $correct_time = false; $correct_time = TRUE; if ( isset($data['commence']) && isset($data['expire']) && $data['commence'] > $data['expire'] ) { $correct_time = FALSE; } // set the expire date/time if ( ! isset($data['expire']) ) { $data['expire'] = strtotime('tomorrow +10 years') - 1; } else { date_default_timezone_set('UTC'); if ( ! $correct_time ) { //make the expire time 1 hour greater than the commence time $data['expire'] = date("U",strtotime($data['commence']) + 3600); } else { $data['expire'] = date("U",strtotime($data['expire'])); } } // set the commence date/time if ( ! isset($data['commence']) ) { $data['commence'] = strtotime('today') + 1; } else { date_default_timezone_set('UTC'); $data['commence'] = date("U",strtotime($data['commence'])); } return $data; } /** * Set or modify post data on create * * @param int * @param string * @return void */ public function update_sort_order($client_id, $snapshot_ids) { $snapshot_ids = explode('-', $snapshot_ids); $sort_order = 1; foreach ($snapshot_ids as $snapshot_id) { $this->_database->where('client_id', $client_id); $this->update($snapshot_id, array('sort_order' => $sort_order), TRUE); $sort_order++; } } /** * Delete dependent data in other tables * * @param int * @return int */ protected function delete_dependencies($id) { // delete the snapshot's applications $this->load->model('client_application_model'); $this->client_application_model->delete_by('snapshot_id', $id); return $id; } }
mger3339/smart_lab
application/models/Client_snapshot_model.php
PHP
mit
5,317
(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?module.exports=factory():typeof define==="function"&&define.amd?define(factory):global.ShuffleText=factory()})(this,function(){"use strict";var ShuffleText=function(){function ShuffleText(element){this.sourceRandomCharacter="ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";this.emptyCharacter="-";this.duration=600;this._isRunning=false;this._originalStr="";this._originalLength=0;this._timeCurrent=0;this._timeStart=0;this._randomIndex=[];this._element=null;this._requestAnimationFrameId=0;this._element=element;this.setText(element.innerHTML)}ShuffleText.prototype.setText=function(text){this._originalStr=text;this._originalLength=text.length};Object.defineProperty(ShuffleText.prototype,"isRunning",{get:function(){return this.isRunning},enumerable:true,configurable:true});ShuffleText.prototype.start=function(){var _this=this;this.stop();this._randomIndex=[];var str="";for(var i=0;i<this._originalLength;i++){var rate=i/this._originalLength;this._randomIndex[i]=Math.random()*(1-rate)+rate;str+=this.emptyCharacter}this._timeStart=(new Date).getTime();this._isRunning=true;this._requestAnimationFrameId=requestAnimationFrame(function(){_this._onInterval()});this._element.innerHTML=str};ShuffleText.prototype.stop=function(){this._isRunning=false;cancelAnimationFrame(this._requestAnimationFrameId)};ShuffleText.prototype.dispose=function(){cancelAnimationFrame(this._requestAnimationFrameId);this.sourceRandomCharacter=null;this.emptyCharacter=null;this._isRunning=false;this.duration=0;this._originalStr=null;this._originalLength=0;this._timeCurrent=0;this._timeStart=0;this._randomIndex=null;this._element=null;this._requestAnimationFrameId=0};ShuffleText.prototype._onInterval=function(){var _this=this;this._timeCurrent=(new Date).getTime()-this._timeStart;var percent=this._timeCurrent/this.duration;var str="";for(var i=0;i<this._originalLength;i++){if(percent>=this._randomIndex[i]){str+=this._originalStr.charAt(i)}else if(percent<this._randomIndex[i]/3){str+=this.emptyCharacter}else{str+=this.sourceRandomCharacter.charAt(Math.floor(Math.random()*this.sourceRandomCharacter.length))}}if(percent>1){str=this._originalStr;this._isRunning=false}this._element.innerHTML=str;if(this._isRunning===true){this._requestAnimationFrameId=requestAnimationFrame(function(){_this._onInterval()})}};return ShuffleText}();return ShuffleText});
conan-equal-newone/yenten
docs/shuffle-text.min.js
JavaScript
mit
2,416
package org.factcenter.pathORam.ops.dummy; import org.factcenter.inchworm.ops.VMProtocolPartyInfo; import org.factcenter.pathORam.Block; import org.factcenter.pathORam.Bucket; import org.factcenter.pathORam.PositionMap; import org.factcenter.pathORam.TreeHelper; import org.factcenter.pathORam.ops.InchwormStash; import java.io.IOException; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; public class DummyStash extends VMProtocolPartyInfo implements InchwormStash { private int stashBlockSize; private int pathORamBlocksCount; private int stashSize; private TreeHelper treeHelper; private Block[] stash; public DummyStash(int blockSize, int stashSize, int pathORamSize) { this.stashBlockSize = blockSize; this.pathORamBlocksCount = pathORamSize; this.stashSize = stashSize; this.treeHelper = new TreeHelper(pathORamBlocksCount); stash = new Block[stashSize]; } private int toRealValueExchange(int valueShare) { try { getRunner().getChannel().writeInt(valueShare); getRunner().getChannel().flush(); int realIndex = getRunner().getChannel().readInt() ^ valueShare; return realIndex; } catch (IOException e) { throw new RuntimeException(); } } public Bucket popBucket(int oldPosition, int level, PositionMap positionMap, int bucketSize) { List<Block> legalToStoreBlocks = new LinkedList<Block>(); for (int i=0 ; i < stash.length; i++) { if (stash[i] == null){ continue; } Block currentBlock = stash[i]; int entryPositionShare = positionMap.get(currentBlock.getId()); int entryPosition = toRealValueExchange(entryPositionShare); logger.debug("in popBucket on index {}. oldPosition={} entryPosition={} level={}", i, oldPosition, entryPosition, level); if (treeHelper.isSameBucket(oldPosition, entryPosition, level)) { legalToStoreBlocks.add(currentBlock); stash[i] = null; if (legalToStoreBlocks.size() >= bucketSize) { break; } } } Bucket bucket = new Bucket(bucketSize, legalToStoreBlocks); bucket.fillDummies(stashBlockSize); return bucket; } @Override public int getBlockSizeBits() { return stashBlockSize; } @Override public int getBlockCount() { return stashSize; } @Override public void storeBlock(Block block) { int blockIndexShare = block.getId(); int index = toRealValueExchange(blockIndexShare); if (0 == toRealValueExchange(block.getValidBit() == true ? 1 : 0)){ return; } for (int i = 0; i < stash.length; i++) { if (stash[i]==null || toRealValueExchange(stash[i].getId()) == index){ stash[i] = block; logger.debug("added on index {}", i); return; } } throw new RuntimeException("stash size overflow size,capacity=" + stash.length + " ," + stash.length ); } @Override public Block fetchBlock(int blockIndexShare) { int index = toRealValueExchange(blockIndexShare); for (int i = 0; i < stash.length; i++) { if (stash[i] != null && toRealValueExchange(stash[i].getId()) == index){ return stash[i]; } } return null; } @Override public Map<Integer, Bucket> popBucket(int oldPosition, PositionMap positionMap, int bucketSize) { Map<Integer,Bucket> path = new HashMap<Integer, Bucket>(); for (int level = treeHelper.getTreeHeight(); level >= 0; level--) { Bucket bucket = popBucket(oldPosition, level, positionMap, bucketSize); path.put(level, bucket); } return path; } }
factcenter/inchworm
src/main/java/org/factcenter/pathORam/ops/dummy/DummyStash.java
Java
mit
3,468
//Check on the download status of a file from the Sia network var http = require('http'); var path = require('path'); var db = require('diskdb'); db = db.connect(path.join(__dirname, '../JDB/'), ['Settings']); var settings = db.Settings.find({ SettingsFlag: 1 }); var portval = settings[0].APIPortNumber; SiaRenDnlds = function(callback) { var RenDnlArr = []; http.get({ url: 'localhost', port: portval, path: '/renter/downloads', headers: { 'User-Agent': 'Sia-Agent', } }, function(response) { // Continuously update stream with data response.on('data', function(d) { RenDnlArr.push(d); }); response.on('end', function() { var DnArr = []; DnArr.push(JSON.parse(RenDnlArr)); return callback(DnArr); }); }); }; //Export the module for the rest of the app exports.SiaRenDnlds = SiaRenDnlds; // SiaRenDnlds(function(value){ // for(var i = 0; i<value[0].downloads.length;i++){ // if(value[0].downloads[i].siapath==){ // if(value[0].downloads[i].received!=value[0].downloads[i].filesize){ // console.log('return out '+parseFloat(Math.round((value[0].downloads[i].received/value[0].downloads[i].filesize) * 100) / 100).toFixed(2)*100); // } // } // }; // });
PeerAcc34/SiaStone
PeerJSModules/SiaRenterDownloads.js
JavaScript
mit
1,274
using System; using System.Collections.Generic; using System.Text; using System.Diagnostics; using System.Runtime.Serialization; using System.Linq; namespace HTLib2 { public static partial class LinAlg { static bool Eye_SelfTest = HDebug.IsDebuggerAttached; public static MatrixByArr Eye(int size, double diagval=1) { if(Eye_SelfTest) { Eye_SelfTest = false; MatrixByArr tT0 = new double[3, 3] { { 2, 0, 0 }, { 0, 2, 0 }, { 0, 0, 2 }, }; MatrixByArr tT1 = Eye(3, 2); HDebug.AssertTolerance(double.Epsilon, tT0 - tT1); } MatrixByArr mat = new MatrixByArr(size,size); for(int i=0; i<size; i++) mat[i, i] = diagval; return mat; } static bool Tr_SelfTest = HDebug.IsDebuggerAttached; public static Matrix Tr(this Matrix M) { if(Tr_SelfTest) { Tr_SelfTest = false; Matrix tM0 = new double[2, 3] { { 1, 2, 3 }, { 4, 5, 6 } }; Matrix tT0 = new double[3, 2] { { 1, 4 }, { 2, 5 }, { 3, 6 } }; Matrix tT1 = Tr(tM0); HDebug.AssertToleranceMatrix(double.Epsilon, tT0 - tT1); } Matrix tr = Matrix.Zeros(M.RowSize, M.ColSize); for(int c=0; c<tr.ColSize; c++) for(int r=0; r<tr.RowSize; r++) tr[c, r] = M[r, c]; return tr; } static bool Diagd_SelfTest = HDebug.IsDebuggerAttached; public static MatrixByArr Diag(this Vector d) { if(Diagd_SelfTest) { Diagd_SelfTest = false; MatrixByArr tD1 = new double[3, 3] { { 1, 0, 0 }, { 0, 2, 0 }, { 0, 0, 3 } }; Vector td1 = new double[3] { 1, 2, 3 }; MatrixByArr tD = Diag(td1); HDebug.AssertTolerance(double.Epsilon, tD - tD1); } int size = d.Size; MatrixByArr D = new MatrixByArr(size, size); for(int i=0; i < size; i++) D[i, i] = d[i]; return D; } static bool DiagD_SelfTest = HDebug.IsDebuggerAttached; public static Vector Diag(this Matrix D) { if(DiagD_SelfTest) { DiagD_SelfTest = false; MatrixByArr tD1 = new double[3, 3] { { 1, 0, 0 }, { 0, 2, 0 }, { 0, 0, 3 } }; Vector td1 = new double[3] { 1, 2, 3 }; Vector td = Diag(tD1); HDebug.AssertTolerance(double.Epsilon, td - td1); } HDebug.Assert(D.ColSize == D.RowSize); int size = D.ColSize; Vector d = new double[size]; for(int i=0; i<size; i++) d[i] = D[i,i]; return d; } static bool DV_SelfTest1 = HDebug.IsDebuggerAttached; public static Vector DV(Matrix D, Vector V, bool assertDiag = true) { if(DV_SelfTest1) { DV_SelfTest1 = false; MatrixByArr tD = new double[3, 3] { { 1, 0, 0 }, { 0, 2, 0 }, { 0, 0, 3 } }; Vector tV = new double[3] { 1, 2, 3 }; Vector tDV = new double[3] { 1, 4, 9 }; // [1 0 0] [1] [1] // [0 2 0] * [2] = [4] // [0 0 3] [3] [9] HDebug.AssertTolerance(double.Epsilon, DV(tD, tV) - tDV); } // D is the diagonal matrix HDebug.Assert(D.ColSize == D.RowSize); if(assertDiag) // check diagonal matrix HDebug.AssertToleranceMatrix(double.Epsilon, D - Diag(Diag(D))); HDebug.Assert(D.ColSize == V.Size); Vector diagD = Diag(D); Vector diagDV = DV(diagD, V); return diagDV; } static bool DV_SelfTest2 = HDebug.IsDebuggerAttached; public static Vector DV(Vector D, Vector V, bool assertDiag = true) { if(DV_SelfTest2) { DV_SelfTest2 = false; Vector tD = new double[3] { 1, 2, 3 }; Vector tV = new double[3] { 1, 2, 3 }; Vector tDV = new double[3] { 1, 4, 9 }; // [1 0 0] [1] [1] // [0 2 0] * [2] = [4] // [0 0 3] [3] [9] HDebug.AssertTolerance(double.Epsilon, DV(tD, tV) - tDV); } // D is the diagonal matrix HDebug.Assert(D.Size == V.Size); int size = V.Size; Vector dv = new double[size]; for(int i=0; i < size; i++) dv[i] = D[i] * V[i]; return dv; } static bool MD_SelfTest = HDebug.IsDebuggerAttached; public static MatrixByArr MD(MatrixByArr M, Vector D) { // M * Diag(D) if(MD_SelfTest) { MD_SelfTest = false; MatrixByArr tM = new double[3, 3] { { 1, 2, 3 } , { 4, 5, 6 } , { 7, 8, 9 } }; Vector tD = new double[3] { 1, 2, 3 }; MatrixByArr tMD0 = new double[3, 3] { { 1, 4, 9 } , { 4, 10, 18 } , { 7, 16, 27 } }; MatrixByArr tMD1 = MD(tM, tD); MatrixByArr dtMD = tMD0 - tMD1; double maxAbsDtMD = dtMD.ToArray().HAbs().HMax(); Debug.Assert(maxAbsDtMD == 0); } HDebug.Assert(M.RowSize == D.Size); MatrixByArr lMD = new double[M.ColSize, M.RowSize]; for(int c=0; c<lMD.ColSize; c++) for(int r=0; r<lMD.RowSize; r++) lMD[c, r] = M[c, r] * D[r]; return lMD; } static bool MV_SelfTest = HDebug.IsDebuggerAttached; static bool MV_SelfTest_lmat_rvec = HDebug.IsDebuggerAttached; public static Vector MV<MATRIX>(MATRIX lmat, Vector rvec, string options="") where MATRIX : IMatrix<double> { Vector result = new Vector(lmat.ColSize); MV(lmat, rvec, result, options); if(MV_SelfTest_lmat_rvec) { MV_SelfTest_lmat_rvec = false; HDebug.Assert(lmat.RowSize == rvec.Size); Vector lresult = new Vector(lmat.ColSize); for(int c=0; c<lmat.ColSize; c++) for(int r=0; r<lmat.RowSize; r++) lresult[c] += lmat[c, r] * rvec[r]; HDebug.AssertTolerance(double.Epsilon, lresult-result); } return result; } public static void MV<MATRIX>(MATRIX lmat, Vector rvec, Vector result, string options="") where MATRIX : IMatrix<double> { if(MV_SelfTest) { MV_SelfTest = false; MatrixByArr tM = new double[4, 3] { { 1, 2, 3 } , { 4, 5, 6 } , { 7, 8, 9 } , { 10, 11, 12 } }; Vector tV = new double[3] { 1, 2, 3 }; Vector tMV0 = new double[4] { 14, 32, 50, 68 }; Vector tMV1 = MV(tM, tV); double err = (tMV0 - tMV1).ToArray().HAbs().Max(); HDebug.Assert(err == 0); } HDebug.Assert(lmat.RowSize == rvec.Size); HDebug.Assert(lmat.ColSize == result.Size); if(options.Split(';').Contains("parallel") == false) { for(int c=0; c<lmat.ColSize; c++) for(int r=0; r<lmat.RowSize; r++) result[c] += lmat[c, r] * rvec[r]; } else { System.Threading.Tasks.Parallel.For(0, lmat.ColSize, delegate(int c) { for(int r=0; r<lmat.RowSize; r++) result[c] += lmat[c, r] * rvec[r]; }); } } //static bool MtM_SelfTest = HDebug.IsDebuggerAttached; public static Matrix MtM(Matrix lmat, Matrix rmat) { bool MtM_SelfTest = false;//HDebug.IsDebuggerAttached; if(MtM_SelfTest) { MtM_SelfTest = false; /// >> A=[ 1,5 ; 2,6 ; 3,7 ; 4,8 ]; /// >> B=[ 1,2,3 ; 3,4,5 ; 5,6,7 ; 7,8,9 ]; /// >> A'*B /// ans = /// 50 60 70 /// 114 140 166 Matrix _A = new double[4, 2] {{ 1,5 },{ 2,6 },{ 3,7 },{ 4,8 }}; Matrix _B = new double[4, 3] {{ 1,2,3 },{ 3,4,5 },{ 5,6,7 },{ 7,8,9 }}; Matrix _AtB = MtM(_A, _B); Matrix _AtB_sol = new double[2,3] { { 50, 60, 70 } , { 114, 140, 166 } }; double err = (_AtB - _AtB_sol).HAbsMax(); HDebug.Assert(err == 0); } HDebug.Assert(lmat.ColSize == rmat.ColSize); int size1 = lmat.RowSize; int size2 = rmat.ColSize; int size3 = rmat.RowSize; Matrix result = Matrix.Zeros(size1, size3); for(int c=0; c<size1; c++) for(int r=0; r<size3; r++) { double sum = 0; for(int i=0; i<size2; i++) // tr(lmat[c,i]) * rmat[i,r] => lmat[i,c] * rmat[i,r] sum += lmat[i,c] * rmat[i,r]; result[c, r] = sum; } return result; } //static bool MMt_SelfTest = HDebug.IsDebuggerAttached; public static Matrix MMt(Matrix lmat, Matrix rmat) { bool MMt_SelfTest = false;//HDebug.IsDebuggerAttached; if(MMt_SelfTest) { MMt_SelfTest = false; /// >> A=[ 1,2,3,4 ; 5,6,7,8 ]; /// >> B=[ 1,3,5,7 ; 2,4,6,8 ; 3,5,7,9 ]; /// >> A*B' /// ans = /// 50 60 70 /// 114 140 166 Matrix _A = new double[2, 4] { { 1, 2, 3, 4 } , { 5, 6, 7, 8 } }; Matrix _B = new double[3, 4] { { 1, 3, 5, 7 } , { 2, 4, 6, 8 } , { 3, 5, 7, 9 } }; Matrix _AtB = MMt(_A, _B); Matrix _AtB_sol = new double[2,3] { { 50, 60, 70 } , { 114, 140, 166 } }; double err = (_AtB - _AtB_sol).HAbsMax(); HDebug.Assert(err == 0); } HDebug.Assert(lmat.RowSize == rmat.RowSize); int size1 = lmat.ColSize; int size2 = lmat.RowSize; int size3 = rmat.ColSize; Matrix result = Matrix.Zeros(size1, size3); for(int c=0; c<size1; c++) for(int r=0; r<size3; r++) { double sum = 0; for(int i=0; i<size2; i++) // lmat[c,i] * tr(rmat[i,r]) => lmat[c,i] * rmat[r,i] sum += lmat[c,i] * rmat[r,i]; result[c, r] = sum; } return result; } static bool MtV_SelfTest = HDebug.IsDebuggerAttached; public static Vector MtV(Matrix lmat, Vector rvec) { if(MtV_SelfTest) { MtV_SelfTest = false; /// >> A = [ 1,2,3 ; 4,5,6 ; 7,8,9 ; 10,11,12 ]; /// >> B = [ 1; 2; 3; 4 ]; /// >> A'*B /// ans = /// 70 /// 80 /// 90 MatrixByArr tM = new double[4, 3] { { 1, 2, 3 } , { 4, 5, 6 } , { 7, 8, 9 } , { 10, 11, 12 } }; Vector tV = new double[4] { 1, 2, 3, 4 }; Vector tMtV0 = new double[3] { 70, 80, 90 }; Vector tMtV1 = MtV(tM, tV); double err = (tMtV0 - tMtV1).ToArray().HAbs().Max(); HDebug.Assert(err == 0); } HDebug.Assert(lmat.ColSize == rvec.Size); Vector result = new Vector(lmat.RowSize); for(int c=0; c<lmat.ColSize; c++) for(int r=0; r<lmat.RowSize; r++) result[r] += lmat[c, r] * rvec[c]; return result; } public static bool V1tD2V3_SelfTest = HDebug.IsDebuggerAttached; public static double V1tD2V3(Vector V1, Matrix D2, Vector V3, bool assertDiag=true) { if(V1tD2V3_SelfTest) { V1tD2V3_SelfTest = false; Vector tV1 = new double[3] { 1, 2, 3 }; MatrixByArr tD2 = new double[3, 3] { { 2, 0, 0 }, { 0, 3, 0 }, { 0, 0, 4 } }; Vector tV3 = new double[3] { 3, 4, 5 }; // [2 ] [3] [ 6] // [1 2 3] * [ 3 ] * [4] = [1 2 3] * [12] = 6+24+60 = 90 // [ 4] [5] [20] double tV1tD2V3 = 90; HDebug.AssertTolerance(double.Epsilon, tV1tD2V3 - V1tD2V3(tV1, tD2, tV3)); } if(assertDiag) // check diagonal matrix HDebug.AssertToleranceMatrix(double.Epsilon, D2 - Diag(Diag(D2))); HDebug.Assert(V1.Size == D2.ColSize); HDebug.Assert(D2.RowSize == V3.Size ); Vector lD2V3 = DV(D2, V3, assertDiag); double lV1tD2V3 = VtV(V1, lD2V3); return lV1tD2V3; } public static MatrixByArr VVt(Vector lvec, Vector rvec) { MatrixByArr outmat = new MatrixByArr(lvec.Size, rvec.Size); VVt(lvec, rvec, outmat); return outmat; } public static void VVt(Vector lvec, Vector rvec, MatrixByArr outmat) { HDebug.Exception(outmat.ColSize == lvec.Size); HDebug.Exception(outmat.RowSize == rvec.Size); //MatrixByArr mat = new MatrixByArr(lvec.Size, rvec.Size); for(int c = 0; c < lvec.Size; c++) for(int r = 0; r < rvec.Size; r++) outmat[c, r] = lvec[c] * rvec[r]; } public static void VVt_AddTo(Vector lvec, Vector rvec, MatrixByArr mat) { HDebug.Exception(mat.ColSize == lvec.Size); HDebug.Exception(mat.RowSize == rvec.Size); for(int c = 0; c < lvec.Size; c++) for(int r = 0; r < rvec.Size; r++) mat[c, r] += lvec[c] * rvec[r]; } public static void sVVt_AddTo(double scale, Vector lvec, Vector rvec, MatrixByArr mat) { HDebug.Exception(mat.ColSize == lvec.Size); HDebug.Exception(mat.RowSize == rvec.Size); for(int c = 0; c < lvec.Size; c++) for(int r = 0; r < rvec.Size; r++) mat[c, r] += lvec[c] * rvec[r] * scale; } public static bool DMD_selftest = HDebug.IsDebuggerAttached; public static MATRIX DMD<MATRIX>(Vector diagmat1, MATRIX mat,Vector diagmat2, Func<int,int,MATRIX> Zeros) where MATRIX : IMatrix<double> { if(DMD_selftest) #region selftest { HDebug.ToDo("check"); DMD_selftest = false; Vector td1 = new double[] { 1, 2, 3 }; Vector td2 = new double[] { 4, 5, 6 }; Matrix tm = new double[,] { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } }; Matrix dmd0 = LinAlg.Diag(td1) * tm * LinAlg.Diag(td2); Matrix dmd1 = LinAlg.DMD(td1, tm, td2, Matrix.Zeros); double err = (dmd0 - dmd1).HAbsMax(); HDebug.Assert(err == 0); } #endregion MATRIX DMD = Zeros(mat.ColSize, mat.RowSize); for(int c=0; c<mat.ColSize; c++) for(int r=0; r<mat.RowSize; r++) { double v0 = mat[c, r]; double v1 = diagmat1[c] * v0 * diagmat2[r]; if(v0 == v1) continue; DMD[c, r] = v1; } return DMD; } //public static bool VtMV_selftest = HDebug.IsDebuggerAttached; public static double VtMV(Vector lvec, IMatrix<double> mat, Vector rvec) //, string options="") { if(HDebug.Selftest()) { Vector _lvec = new double[3] { 1, 2, 3 }; Matrix _mat = new double[3,4] { { 4, 5, 6, 7 } , { 8, 9, 10, 11 } , { 12, 13, 14, 15 } }; Vector _rvec = new double[4] { 16, 17, 18, 19 }; double _v0 = VtMV(_lvec,_mat,_rvec); double _v1 = 4580; HDebug.Assert(_v0 == _v1); } HDebug.Assert(lvec.Size == mat.ColSize); HDebug.Assert(mat.RowSize == rvec.Size); double ret = 0; for(int c=0; c<lvec.Size; c++) for(int r=0; r<rvec.Size; r++) ret += lvec[c] * mat[c,r] * rvec[r]; return ret; // Vector MV = LinAlg.MV(mat, rvec, options); // double VMV = LinAlg.VtV(lvec, MV); // //Debug.AssertToleranceIf(lvec.Size<100, 0.00000001, Vector.VtV(lvec, Vector.MV(mat, rvec)) - VMV); // return VMV; } public static MatrixByArr M_Mt(MatrixByArr lmat, MatrixByArr rmat) { // M + Mt HDebug.Assert(lmat.ColSize == rmat.RowSize); HDebug.Assert(lmat.RowSize == rmat.ColSize); MatrixByArr MMt = lmat.CloneT(); for(int c = 0; c < MMt.ColSize; c++) for(int r = 0; r < MMt.RowSize; r++) MMt[c, r] += rmat[r, c]; return MMt; } public static double VtV(Vector l, Vector r) { HDebug.Assert(l.Size == r.Size); int size = l.Size; double result = 0; for(int i=0; i < size; i++) result += l[i] * r[i]; return result; } public static double[] ListVtV(Vector l, IList<Vector> rs) { double[] listvtv = new double[rs.Count]; for(int i=0; i<rs.Count; i++) listvtv[i] = VtV(l, rs[i]); return listvtv; } public static double VtV(Vector l, Vector r, IList<int> idxsele) { HDebug.Assert(l.Size == r.Size); Vector ls = l.ToArray().HSelectByIndex(idxsele); Vector rs = r.ToArray().HSelectByIndex(idxsele); return VtV(ls, rs); } public static Vector VtMM(Vector v1, Matrix m2, Matrix m3) { Vector v12 = VtM(v1, m2); return VtM(v12, m3); } public static class AddToM { public static void VVt(Matrix M, Vector V) { HDebug.Assert(M.ColSize == V.Size); HDebug.Assert(M.RowSize == V.Size); int size = V.Size; for(int c=0; c<size; c++) for(int r=0; r<size; r++) M[c, r] += V[c] * V[r]; } } public static Vector VtM<MATRIX>(Vector lvec, MATRIX rmat) where MATRIX : IMatrix<double> { HDebug.Assert(lvec.Size == rmat.ColSize); Vector result = new Vector(rmat.RowSize); for(int c=0; c<rmat.ColSize; c++) for(int r=0; r<rmat.RowSize; r++) result[r] += lvec[c] * rmat[c, r]; return result; } } }
htna/HCsbLib
HCsbLib/HCsbLib/HTLib2/HMath.Numerics.LinAlg/LinAlg/LinAlg.Matrix.cs
C#
mit
20,887
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; //[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.xml", Watch = true)] // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Tests")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Tests")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("560958c4-0e26-41ab-ba0d-6b36e97013e2")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
sfederella/simurails-project
Desarrollo/Tests/Properties/AssemblyInfo.cs
C#
mit
1,474
class PivotaltrackerService < Service include HTTParty API_ENDPOINT = 'https://www.pivotaltracker.com/services/v5/source_commits'.freeze prop_accessor :token, :restrict_to_branch validates :token, presence: true, if: :activated? def title 'PivotalTracker' end def description '项目管理软件 (代码提交终端)' end def self.to_param 'pivotaltracker' end def fields [ { type: 'text', name: 'token', placeholder: 'Pivotal Tracker API token.' }, { type: 'text', name: 'restrict_to_branch', placeholder: 'Comma-separated list of branches which will be ' \ 'automatically inspected. Leave blank to include all branches.' } ] end def self.supported_events %w(push) end def execute(data) return unless supported_events.include?(data[:object_kind]) return unless allowed_branch?(data[:ref]) data[:commits].each do |commit| message = { 'source_commit' => { 'commit_id' => commit[:id], 'author' => commit[:author][:name], 'url' => commit[:url], 'message' => commit[:message] } } PivotaltrackerService.post( API_ENDPOINT, body: message.to_json, headers: { 'Content-Type' => 'application/json', 'X-TrackerToken' => token } ) end end private def allowed_branch?(ref) return true unless ref.present? && restrict_to_branch.present? branch = Gitlab::Git.ref_name(ref) allowed_branches = restrict_to_branch.split(',').map(&:strip) branch.present? && allowed_branches.include?(branch) end end
htve/GitlabForChinese
app/models/project_services/pivotaltracker_service.rb
Ruby
mit
1,703
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Practice Integer Numbers")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Practice Integer Numbers")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("1f0e5981-373b-4979-a1db-6755bea3ce96")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
VelizarMitrev/Programmming_Fundamentals
Data types and variables/Practice Integer Numbers/Properties/AssemblyInfo.cs
C#
mit
1,424
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <title>aktion - mulus.science</title> <meta name="description" content="" /> <meta name="HandheldFriendly" content="True" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link rel="shortcut icon" href="http://www.mulus.science/favicon.ico"> <link rel="stylesheet" type="text/css" href="//www.mulus.science/themes/casper/assets/css/screen.css?v=1507567413605" /> <link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Merriweather:300,700,700italic,300italic|Open+Sans:700,400" /> <link rel="canonical" href="http://www.mulus.science/http://www.mulus.science/tag/aktion/" /> <meta name="referrer" content="origin" /> <meta property="og:site_name" content="mulus.science" /> <meta property="og:type" content="website" /> <meta property="og:title" content="aktion - mulus.science" /> <meta property="og:url" content="http://www.mulus.science/http://www.mulus.science/tag/aktion/" /> <meta name="twitter:card" content="summary" /> <meta name="twitter:title" content="aktion - mulus.science" /> <meta name="twitter:url" content="http://www.mulus.science/http://www.mulus.science/tag/aktion/" /> <script type="application/ld+json"> null </script> <meta name="generator" content="HubPress" /> <link rel="alternate" type="application/rss+xml" title="mulus.science" href="http://www.mulus.science/rss/" /> </head> <body class="tag-template tag-aktion nav-closed"> <div class="site-wrapper"> <header class="main-header tag-head " style="background-image: url(/images/mulusg.jpg)"> <nav class="main-nav overlay clearfix"> <a class="blog-logo" href="http://www.mulus.science"><img src="/images/pfeil.png" alt="mulus.science" /></a> </nav> <div class="vertical"> <div class="main-header-content inner"> <h1 class="page-title">aktion</h1> <h2 class="page-description"> A 1-post collection </h2> </div> </div> </header> <main class="content" role="main"> <div class="extra-pagination inner"> <nav class="pagination" role="navigation"> <span class="page-number">Page 1 of 1</span> </nav> </div> <article class="post tag-adresse tag-aktion tag-berlin tag-oganisation tag-kollektiv tag-konzession tag-rolle tag-selbstorganisation tag-volksbuhne"> <header class="post-header"> <h2 class="post-title"><a href="http://www.mulus.science/2017/10/09/Probleme-selbstorganisierter-Kollektiver-vb6112.html">Probleme selbstorganisierter Kollektiver #vb6112</a></h2> </header> <section class="post-excerpt"> <p>Ein Theoriepapier als Reflexionsbeitrag zum Was-auch-immer in der Volksbühne am Rosa-Luxemburg-Platz (Unter Mitarbeit von Th. K.) Ein organisiertes Kollektiv (1) kennt (1) bestimmba <a class="read-more" href="http://www.mulus.science/2017/10/09/Probleme-selbstorganisierter-Kollektiver-vb6112.html">&raquo;</a></p> </section> <footer class="post-meta"> <img class="author-thumb" src="https://avatars3.githubusercontent.com/u/20268961?v&#x3D;4" alt="bertrandterrier" nopin="nopin" /> <a href="http://www.mulus.science/author/backemulus/">bertrandterrier</a> on <a href="http://www.mulus.science/tag/adresse/">adresse</a>, <a href="http://www.mulus.science/tag/aktion/"> aktion</a>, <a href="http://www.mulus.science/tag/berlin/"> berlin</a>, <a href="http://www.mulus.science/tag/oganisation/"> oganisation</a>, <a href="http://www.mulus.science/tag/kollektiv/"> kollektiv</a>, <a href="http://www.mulus.science/tag/konzession/"> konzession</a>, <a href="http://www.mulus.science/tag/rolle/"> rolle</a>, <a href="http://www.mulus.science/tag/selbstorganisation/"> selbstorganisation</a>, <a href="http://www.mulus.science/tag/volksbuhne/"> volksbühne</a> <time class="post-date" datetime="2017-10-09">09 October 2017</time> </footer> </article> <nav class="pagination" role="navigation"> <span class="page-number">Page 1 of 1</span> </nav> </main> <footer class="site-footer clearfix"> <section class="copyright"><a href="http://www.mulus.science">mulus.science</a> &copy; 2017</section> <section class="poweredby">Proudly published with <a href="http://hubpress.io">HubPress</a></section> </footer> </div> <script type="text/javascript" src="https://code.jquery.com/jquery-1.12.0.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js?v="></script> <script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment-with-locales.min.js?v="></script> <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/highlight.min.js?v="></script> <script type="text/javascript"> jQuery( document ).ready(function() { // change date with ago jQuery('ago.ago').each(function(){ var element = jQuery(this).parent(); element.html( moment(element.text()).fromNow()); }); }); hljs.initHighlightingOnLoad(); </script> <script type="text/javascript" src="//www.mulus.science/themes/casper/assets/js/jquery.fitvids.js?v=1507567413605"></script> <script type="text/javascript" src="//www.mulus.science/themes/casper/assets/js/index.js?v=1507567413605"></script> </body> </html>
backemulus/backemulus.github.io
tag/aktion/index.html
HTML
mit
5,625
<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Docs For Class Swift_IoException</title> <link rel="stylesheet" href="../media/stylesheet.css" /> <script src="../media/lib/classTree.js"></script> <link id="webfx-tab-style-sheet" type="text/css" rel="stylesheet" href="../media/lib/tab.webfx.css" /> <script type="text/javascript" src="../media/lib/tabpane.js"></script> <script language="javascript" type="text/javascript" src="../media/lib/ua.js"></script> <script language="javascript" type="text/javascript"> var imgPlus = new Image(); var imgMinus = new Image(); imgPlus.src = "../media/images/plus.gif"; imgMinus.src = "../media/images/minus.gif"; function showNode(Node){ switch(navigator.family){ case 'nn4': // Nav 4.x code fork... var oTable = document.layers["span" + Node]; var oImg = document.layers["img" + Node]; break; case 'ie4': // IE 4/5 code fork... var oTable = document.all["span" + Node]; var oImg = document.all["img" + Node]; break; case 'gecko': // Standards Compliant code fork... var oTable = document.getElementById("span" + Node); var oImg = document.getElementById("img" + Node); break; } oImg.src = imgMinus.src; oTable.style.display = "block"; } function hideNode(Node){ switch(navigator.family){ case 'nn4': // Nav 4.x code fork... var oTable = document.layers["span" + Node]; var oImg = document.layers["img" + Node]; break; case 'ie4': // IE 4/5 code fork... var oTable = document.all["span" + Node]; var oImg = document.all["img" + Node]; break; case 'gecko': // Standards Compliant code fork... var oTable = document.getElementById("span" + Node); var oImg = document.getElementById("img" + Node); break; } oImg.src = imgPlus.src; oTable.style.display = "none"; } function nodeIsVisible(Node){ switch(navigator.family){ case 'nn4': // Nav 4.x code fork... var oTable = document.layers["span" + Node]; break; case 'ie4': // IE 4/5 code fork... var oTable = document.all["span" + Node]; break; case 'gecko': // Standards Compliant code fork... var oTable = document.getElementById("span" + Node); break; } return (oTable && oTable.style.display == "block"); } function toggleNodeVisibility(Node){ if (nodeIsVisible(Node)){ hideNode(Node); }else{ showNode(Node); } } </script> <!-- template designed by Julien Damon based on PHPEdit's generated templates, and tweaked by Greg Beaver --> <body bgcolor="#ffffff" > <!-- Start of Class Data --> <h2> Class Swift_IoException </h2> (line <span class="linenumber">18</span>) <div class="tab-pane" id="tabPane1"> <script type="text/javascript"> tp1 = new WebFXTabPane( document.getElementById( "tabPane1" )); </script> <div class="tab-page" id="Description"> <h2 class="tab">Description</h2> <pre> Exception | --<a href="Swift_SwiftException.html">Swift_SwiftException</a> | --Swift_IoException</pre> <p> <b><i>Located in File: <a href="_vendors---swiftMailer---classes---Swift---IoException.php.html">/vendors/swiftMailer/classes/Swift/IoException.php</a></i></b><br> </p> <!-- ========== Info from phpDoc block ========= --> <h5>I/O Exception class.</h5> <ul> <li><strong>author:</strong> - Chris Corbyn</li> </ul> <br /><hr /> <span class="type">Classes extended from Swift_IoException:</span> <dl> <dt><a href="Transport/Swift_Plugins_Pop_Pop3Exception.html">Swift_Plugins_Pop_Pop3Exception</a></dt> <dd>Pop3Exception thrown when an error occurs connecting to a POP3 host.</dd> </dl> <dl> <dt><a href="Transport/Swift_TransportException.html">Swift_TransportException</a></dt> <dd>TransportException thrown when an error occurs in the Transport subsystem.</dd> </dl> </p> </div> <script type="text/javascript">tp1.addTabPage( document.getElementById( "Description" ) );</script> <div class="tab-page" id="tabPage1"> <h2 class="tab">Class Variables</h2> <!-- ============ VARIABLE DETAIL =========== --> <strong>Summary:</strong><br /> <hr /> <script type="text/javascript">tp1.addTabPage( document.getElementById( "tabPage1" ) );</script> </div> <div class="tab-page" id="constantsTabpage"> <h2 class="tab">Class Constants</h2> <!-- ============ VARIABLE DETAIL =========== --> <strong>Summary:</strong><br /> <hr /> <script type="text/javascript">tp1.addTabPage( document.getElementById( "constantsTabpage" ) );</script> </div> <div class="tab-page" id="tabPage2"> <h2 class="tab">Method Detail</h2> <!-- ============ METHOD DETAIL =========== --> <strong>Summary:</strong><br /> <div class="method-summary"> <div class="method-definition"> <span class="method-result">Swift_IoException</span> <a href="#method__construct" title="details" class="method-name">__construct</a> (<span class="var-type">string</span>&nbsp;<span class="var-name">$message</span>) </div> </div> <hr /> <A NAME='method_detail'></A> <a name="method__construct" id="method__construct"><!-- --></a> <div style="background='#eeeeee'"><h4> <img src="../media/images/Constructor.gif" border="0" /> <strong class="method">Constructor __construct</strong> (line <span class="linenumber">25</span>) </h4> <h4><i>Swift_IoException</i> <strong>__construct( string $message)</strong></h4> <p>Overridden in child classes as:<br /> <dl> <dt><a href="Transport/Swift_Plugins_Pop_Pop3Exception.html#method__construct">Swift_Plugins_Pop_Pop3Exception::__construct()</a></dt> <dd>Create a new Pop3Exception with $message.</dd> </dl> <dl> <dt><a href="Transport/Swift_TransportException.html#method__construct">Swift_TransportException::__construct()</a></dt> <dd>Create a new TransportException with $message.</dd> </dl> </p> <p><strong>Overrides :</strong> <a href="Swift_SwiftException.html#method__construct">Swift_SwiftException::__construct()</a> Create a new SwiftException with $message.</p> <!-- ========== Info from phpDoc block ========= --> <h5>Create a new IoException with $message.</h5> <h4>Parameters</h4> <ul> <li><strong>string $message</strong>: </li> </ul> <h4>Info</h4> <ul> <li><strong>access</strong> - public</li> </ul> </div> <script type="text/javascript">tp1.addTabPage( document.getElementById( "tabPage2" ) );</script> </div> <div class="tab-page" id="iVars"> <h2 class="tab">Inherited Variables</h2> <script type="text/javascript">tp1.addTabPage( document.getElementById( "iVars" ) );</script> <!-- =========== VAR INHERITED SUMMARY =========== --> <A NAME='var_inherited_summary'><!-- --></A> <h3>Inherited Class Variable Summary</h3> </div> <div class="tab-page" id="iMethods"> <h2 class="tab">Inherited Methods</h2> <script type="text/javascript">tp1.addTabPage( document.getElementById( "iMethods" ) );</script> <!-- =========== INHERITED METHOD SUMMARY =========== --> <A NAME='functions_inherited'><!-- --></A> <h3>Inherited Method Summary</h3> <!-- =========== Summary =========== --> <h4>Inherited From Class <a href="Swift_SwiftException.html">Swift_SwiftException</a></h4> <h4> <img src="../media/images/Constructor.gif" border="0" /><strong class="method"> <a href="Swift_SwiftException.html#method__construct">Swift_SwiftException::__construct()</a></strong> - Create a new SwiftException with $message. </h4> <br /> </div> </div> <script type="text/javascript"> //<![CDATA[ setupAllTabs(); //]]> </script> <div id="credit"> <hr /> Documentation generated on Fri, 12 Nov 2010 20:45:23 +0000 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.4.3</a> </div> </body> </html>
kmchugh/YiiPlinth
protected/extensions/Email/Mail/doc/Swift/Swift_IoException.html
HTML
mit
8,257
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>lambek: 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.7.1+1 / lambek - 8.9.0</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> lambek <small> 8.9.0 <span class="label label-info">Not compatible 👼</span> </small> </h1> <p>📅 <em><script>document.write(moment("2021-10-13 17:49:56 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2021-10-13 17:49:56 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-threads base base-unix base camlp5 7.14 Preprocessor-pretty-printer of OCaml conf-findutils 1 Virtual package relying on findutils conf-perl 1 Virtual package relying on perl coq 8.7.1+1 Formal proof management system num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic ocaml 4.08.1 The OCaml compiler (virtual package) ocaml-base-compiler 4.08.1 Official release 4.08.1 ocaml-config 1 OCaml Switch Configuration ocamlfind 1.9.1 A library manager for OCaml # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;Hugo.Herbelin@inria.fr&quot; homepage: &quot;https://github.com/coq-contribs/lambek&quot; license: &quot;LGPL 2.1&quot; build: [make &quot;-j%{jobs}%&quot;] install: [make &quot;install&quot;] remove: [&quot;rm&quot; &quot;-R&quot; &quot;%{lib}%/coq/user-contrib/Lambek&quot;] depends: [ &quot;ocaml&quot; &quot;coq&quot; {&gt;= &quot;8.9&quot; &amp; &lt; &quot;8.10~&quot;} ] tags: [ &quot;keyword: Computational linguistic&quot; &quot;keyword: categorial grammar&quot; &quot;keyword: Lambek calculus...&quot; &quot;category: Computer Science/Formal Languages Theory and Automata&quot; &quot;date: March-July 2003&quot; ] authors: [ &quot;Houda Anoun &lt;anoun@labri.fr&gt;&quot; &quot;Pierre Castéran &lt;casteran@labri.fr&gt;&quot; ] bug-reports: &quot;https://github.com/coq-contribs/lambek/issues&quot; dev-repo: &quot;git+https://github.com/coq-contribs/lambek.git&quot; synopsis: &quot;A Coq Toolkit for Lambek Calculus&quot; description: &quot;&quot;&quot; This library contains some definitions concerning Lambek calculus. Three formalisations of this calculus are proposed, and also some certified functions which translate derivations from one formalism to another. Several derived properties are proved and also some meta-theorems. Users can define their own lexicons and use the defined tactics to prove the derivation of sentences in a particular system (L, NL, LP, NLP ...)&quot;&quot;&quot; flags: light-uninstall url { src: &quot;https://github.com/coq-contribs/lambek/archive/v8.9.0.tar.gz&quot; checksum: &quot;md5=c0298db3f22861ec36ab72de93f2f7eb&quot; } </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-lambek.8.9.0 coq.8.7.1+1</code></dd> <dt>Return code</dt> <dd>5120</dd> <dt>Output</dt> <dd><pre>[NOTE] Package coq is already installed (current version is 8.7.1+1). The following dependencies couldn&#39;t be met: - coq-lambek -&gt; coq &gt;= 8.9 Your request can&#39;t be satisfied: - No available version of coq satisfies the constraints 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-lambek.8.9.0</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"> Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣 </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.08.1-2.0.5/released/8.7.1+1/lambek/8.9.0.html
HTML
mit
7,335
exports.findById = function(req, res) { var id = req.params.id; console.log("Retrieving user: " + id); db.collection('users', function(err, collection) { collection.findOne({'_id':new BSON.ObjectID(id)}, function(err, item) { res.send(item); }); }) } exports.findAll = function(req, res) { db.collection('users', function(err, collection) { collection.find().toArray(function(err, items) { res.send(items); }); }); } exports.addUser = function(req, res) { var user = req.body; console.log('Adding user: ' + JSON.stringify(user)); db.collection('users', function(err, collection) { collection.insert(user, {safe:true}, function(err, result) { if (err) { res.send({'error':'An error has occurred'}); } else { console.log('Success: ' + JSON.stringify(result[0])); res.send(result[0]); } }); }); } exports.updateUser = function(req, res) { var id = req.params.id; var user = req.body; console.log('Updating user: ' + id); console.log(JSON.stringify(user)); db.collection('users', function(err, collection) { collection.update({'_id':new BSON.ObjectID(id)}, user, {safe:true}, function(err, result) { if (err) { console.log('Error updating user: ' + err); res.send({'error':'An error has occurred'}); } else { console.log('' + result + ' document(s) updated'); res.send(user); } }); }); } exports.deleteUser = function(req, res) { var id = req.params.id; console.log('Deleting user: ' + id); db.collection('users', function(err, collection) { collection.remove({'_id':new BSON.ObjectID(id)}, {safe:true}, function(err, result) { if (err) { res.send({'error':'An error has occurred - ' + err}); } else { console.log('' + result + ' document(s) deleted'); res.send(req.body); } }); }); } //curl -i -X PUT -H 'Content-Type: application/json' -d '{"first": "Cassandra", "Last": "Jens", "email" : "jens.cass@gmail.com", "password" : "password", "wgs" : [], "status" :"ACTIVE"}' http://localhost:3000/users/5222562de5fee97b66000001
CassyJens/EcoDataWarehouse-Node
routes/users.js
JavaScript
mit
2,376
# This file is part of curious. # # curious 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 3 of the License, or # (at your option) any later version. # # curious 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 curious. If not, see <http://www.gnu.org/licenses/>. """ Wrappers for Search objects. .. currentmodule:: curious.dataclasses.search """ import collections import functools import typing from typing import Iterator from curious.dataclasses import channel as dt_channel, guild as dt_guild, member as dt_member, \ message as dt_message, user as dt_user class MessageGroup: """ A small class that returns messages from a message group. """ __slots__ = "msgs", def __init__(self, msgs: 'typing.List[dt_message.Message]'): self.msgs = msgs # generic magic methods def __getitem__(self, item) -> 'dt_message.Message': return self.msgs[item] def __iter__(self) -> 'Iterator[dt_message.Message]': return iter(self.msgs) def __repr__(self) -> str: return "<MessageGroup msgs='{}'>".format(self.msgs) @property def before(self) -> 'typing.Tuple[dt_message.Message, dt_message.Message]': """ :return: The two :class:`.Message` objects that happen before the requested message. """ return self.msgs[0], self.msgs[1] @property def message(self) -> 'dt_message.Message': """ :return: The :class:`.Message` that matched this search query. """ return self.msgs[2] @property def after(self) -> 'typing.Tuple[dt_message.Message, dt_message.Message]': """ :return: The two :class:`.Message` objects that happen after the requested message. """ return self.msgs[3], self.msgs[4] class SearchResults(collections.AsyncIterator): """ An async iterator that can be used to iterate over the results of a search. This will automatically fill results, and return messages as appropriate. The return type of iterating over this is a :class:`.MessageGroup`, which contains the messages around the message that matched the search result. .. code-block:: python3 async for i in sr: print(i.before) # 2 messages from before print(i.message) # the message that matched print(i.after) # 2 messages from after """ def __init__(self, sq: 'SearchQuery') -> None: self.sq = sq # state vars self.page = 0 self.groups = collections.deque() self._limit = -1 self._total_count = 0 def __repr__(self) -> str: return "<SearchResults page='{}' messages='{}'>".format(self.page, len(self.groups)) # builder methods def limit(self, limit: int=-1) -> 'SearchResults': """ Sets the maximum messages to fetch from this search result. .. code-block:: python3 async for group in sr.limit(25): ... :param limit: The limit to set. :return: This :class:`.SearchResults`. """ self._limit = limit return self async def fetch_next_page(self) -> None: """ Fetches the next page of results from the SearchQuery. """ if self._limit != -1 and self._total_count >= self._limit: return results = await self.sq.execute(page=self.page) # add a new messagegroup to the end for r in results: self.groups.append(MessageGroup(r)) self.page += 1 def get_next(self) -> 'MessageGroup': """ Gets the next page of results. If no results were found, this will raise an IndexError, and you must fetch the next page with :meth:`.SearchResults.fetch_next_page`. :return: A :class:`.MessageGroup` for the next page of results, if applicable. """ # prevent more fetching if self._limit != -1 and self._total_count >= self._limit: raise IndexError popped = self.groups.popleft() self._total_count += len(popped.msgs) return popped async def __anext__(self) -> 'MessageGroup': try: return self.get_next() except IndexError: await self.fetch_next_page() # try and pop left again # if it fails no messages were returned try: return self.get_next() except IndexError: raise StopAsyncIteration class SearchQuery(object): """ Represents a search query to be sent to Discord. This is a simple wrapper over the HTTP API. For example, to search a channel called ``general`` for messages with the content ``heck``: .. code-block:: python3 with ctx.guild.search as sq: sq.content = "heck" sq.channel = next(filter(lambda c: c.name == "general", ctx.guild.channels), None) async for result in sq.results: ... # do whatever with the messages returned. You can get results out of the query in two ways: .. code-block:: python3 sq = SearchQuery(ctx.guild) sq.content = "heck" # form 1 async for item in sq.results: ... # form 2 results = await sq.get_messages() for result in results: ... It is recommended to use the ``async for`` form, as this will automatically page the results and return the next page of results as soon as the current one is exhausted. """ def __init__(self, guild: 'dt_guild.Guild' = None, channel: 'dt_channel.Channel' = None) -> None: """ :param guild: The :class:`.Guild` to search the messages for. :param channel: The :class:`.Channel` to search messages for. Only used for DMs. """ self._guild = guild # internal vars used for the search self._channel = channel self._query = None # type: str self._author = None # type: typing.Union[dt_user.User, dt_member.Member] def make_params(self) -> typing.Dict[str, str]: """ :return: The dict of parameters to send for this request. """ params = {} if self.guild is not None and self.channel is not None: params["channel_id"] = self.channel.id if self._query is not None: params["content"] = self._query if self._author is not None: params["author_id"] = self._author.id # TODO: Datetimes and `has:` return params # magic methods def __enter__(self) -> 'SearchQuery': return self def __exit__(self, exc_type, exc_val, exc_tb) -> bool: return False def __repr__(self) -> str: return "<SearchQuery guild='{}' channel='{}'>".format(self.guild, self.channel) # internal properties @property def _http_meth(self) -> typing.Callable[[], dict]: """ :return: The built URL to execute this search query on. """ if self.guild is not None: return functools.partial(self._bot.http.search_guild, self.guild.id) return functools.partial(self._bot.http.search_channel, self.channel.id) @property def _bot(self): if self._guild is not None: return self._guild._bot return self._channel._bot # public properties @property def guild(self) -> 'typing.Union[dt_guild.Guild, None]': """ :return: The :class:`.Guild` this search query is searching. """ return self._guild @property def channel(self) -> 'typing.Union[dt_channel.Channel, None]': """ The :class:`.Channel` that is being searched. .. note:: If this a DM, this will not be added in the params. :getter: Gets the :class:`.Channel` to be searched. :setter: Sets the :class:`.Channel` to be searched. """ return self._channel @channel.setter def channel(self, value): if not isinstance(value, dt_channel.Channel): raise TypeError("Must provide a Channel object") if value.type is dt_channel.ChannelType.VOICE: raise ValueError("Cannot search a voice channel") if self._guild is not None and value.guild is None: raise ValueError("Channel must not be a private channel for searching a guild") if self._guild is not None and value.guild != self._guild: raise ValueError("Channel to search must be in the same guild") self._channel = value @property def content(self) -> str: """ The str content that is being searched. :getter: Gets the ``str`` content to be searched. :setter: Sets the ``str`` content to be searched. """ return self._query @content.setter def content(self, value): self._query = value @property def results(self) -> 'SearchResults': """ A simple way of accessing the search results for a search query. :return: A :class:`.SearchResults` representing the results of this query. """ return SearchResults(self) # workhouse methods async def execute(self, page: int = 0) -> 'typing.List[typing.List[dt_message.Message]]': """ Executes the search query. .. warning:: This is an internal method, used by the library. Use :meth:`.get_messages` instead of this. :param page: The page of results to return. :return: A list of :class:`.Message` which returns the results of the search query. """ func = self._http_meth params = self.make_params() # get the offset page params["offset"] = page * 25 # make the http request res = await func(params) message_blocks = [] # parse all of the message objects for group in res.get("messages", []): message_blocks.append([self._bot.state.make_message(m) for m in group]) return message_blocks async def get_messages(self, page: int = 0) -> 'SearchResults': """ Executes the search query and gets the messages for the specified page. :param page: The page of results to return. :return: A :class:`.SearchResult` that can be used to search the results. """ res = SearchResults(self) res.page = page await res.fetch_next_page() return res
SunDwarf/curious
curious/dataclasses/search.py
Python
mit
11,178
using System.Web; using System.Web.Optimization; namespace CattoEmptyWebApplication { public class BundleConfig { // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862 public static void RegisterBundles(BundleCollection bundles) { bundles.Add(new ScriptBundle("~/bundles/jquery").Include( "~/Scripts/jquery-{version}.js")); bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include( "~/Scripts/jquery.validate*")); // Use the development version of Modernizr to develop with and learn from. Then, when you're // ready for production, use the build tool at http://modernizr.com to pick only the tests you need. bundles.Add(new ScriptBundle("~/bundles/modernizr").Include( "~/Scripts/modernizr-*")); bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include( "~/Scripts/bootstrap.js", "~/Scripts/respond.js")); bundles.Add(new StyleBundle("~/Content/css").Include( "~/Content/bootstrap.css", "~/Content/site.css")); } } }
ccatto/VisualStudio2015WebMVCEmptyTemplate
CattoEmptyWebApplication/CattoEmptyWebApplication/App_Start/BundleConfig.cs
C#
mit
1,255
const { THREE } = global; /** * @author renej * NURBS surface object * * Implementation is based on (x, y [, z=0 [, w=1]]) control points with w=weight. * **/ /************************************************************** * NURBS surface **************************************************************/ THREE.NURBSSurface = function ( degree1, degree2, knots1, knots2 /* arrays of reals */, controlPoints /* array^2 of Vector(2|3|4) */ ) { this.degree1 = degree1; this.degree2 = degree2; this.knots1 = knots1; this.knots2 = knots2; this.controlPoints = []; var len1 = knots1.length - degree1 - 1; var len2 = knots2.length - degree2 - 1; // ensure Vector4 for control points for ( var i = 0; i < len1; ++ i ) { this.controlPoints[ i ] = []; for ( var j = 0; j < len2; ++ j ) { var point = controlPoints[ i ][ j ]; this.controlPoints[ i ][ j ] = new THREE.Vector4( point.x, point.y, point.z, point.w ); } } }; THREE.NURBSSurface.prototype = { constructor: THREE.NURBSSurface, getPoint: function ( t1, t2 ) { var u = this.knots1[ 0 ] + t1 * ( this.knots1[ this.knots1.length - 1 ] - this.knots1[ 0 ] ); // linear mapping t1->u var v = this.knots2[ 0 ] + t2 * ( this.knots2[ this.knots2.length - 1 ] - this.knots2[ 0 ] ); // linear mapping t2->u return THREE.NURBSUtils.calcSurfacePoint( this.degree1, this.degree2, this.knots1, this.knots2, this.controlPoints, u, v ); } };
Zetoff/zetoff-three
src/extras/geometry/curves/NURBSSurface.js
JavaScript
mit
1,429
// Domain Public by Eric Wendelin http://www.eriwen.com/ (2008) // Luke Smith http://lucassmith.name/ (2008) // Loic Dachary <loic@dachary.org> (2008) // Johan Euphrosine <proppy@aminche.com> (2008) // Oyvind Sean Kinsey http://kinsey.no/blog (2010) // Victor Homyakov <victor-homyakov@users.sourceforge.net> (2010) /*global module, exports, define, ActiveXObject*/ (function(global, factory) { if (typeof exports === 'object') { // Node module.exports = factory(); } else if (typeof define === 'function' && define.amd) { // AMD define(factory); } else { // Browser globals global.printStackTrace = factory(); } }(this, function() { /** * Main function giving a function stack trace with a forced or passed in Error * * @cfg {Error} e The error to create a stacktrace from (optional) * @cfg {Boolean} guess If we should try to resolve the names of anonymous functions * @return {Array} of Strings with functions, lines, files, and arguments where possible */ function printStackTrace(options) { options = options || {guess: true}; var ex = options.e || null, guess = !!options.guess, mode = options.mode || null; var p = new printStackTrace.implementation(), result = p.run(ex, mode); return (guess) ? p.guessAnonymousFunctions(result) : result; } printStackTrace.implementation = function() { }; printStackTrace.implementation.prototype = { /** * @param {Error} [ex] The error to create a stacktrace from (optional) * @param {String} [mode] Forced mode (optional, mostly for unit tests) */ run: function(ex, mode) { ex = ex || this.createException(); mode = mode || this.mode(ex); if (mode === 'other') { return this.other(arguments.callee); } else { return this[mode](ex); } }, createException: function() { try { this.undef(); } catch (e) { return e; } }, /** * Mode could differ for different exception, e.g. * exceptions in Chrome may or may not have arguments or stack. * * @return {String} mode of operation for the exception */ mode: function(e) { if (typeof window !== 'undefined' && window.navigator.userAgent.indexOf('PhantomJS') > -1) { return 'phantomjs'; } if (e['arguments'] && e.stack) { return 'chrome'; } if (e.stack && e.sourceURL) { return 'safari'; } if (e.stack && e.number) { return 'ie'; } if (e.stack && e.fileName) { return 'firefox'; } if (e.message && e['opera#sourceloc']) { // e.message.indexOf("Backtrace:") > -1 -> opera9 // 'opera#sourceloc' in e -> opera9, opera10a // !e.stacktrace -> opera9 if (!e.stacktrace) { return 'opera9'; // use e.message } if (e.message.indexOf('\n') > -1 && e.message.split('\n').length > e.stacktrace.split('\n').length) { // e.message may have more stack entries than e.stacktrace return 'opera9'; // use e.message } return 'opera10a'; // use e.stacktrace } if (e.message && e.stack && e.stacktrace) { // e.stacktrace && e.stack -> opera10b if (e.stacktrace.indexOf("called from line") < 0) { return 'opera10b'; // use e.stacktrace, format differs from 'opera10a' } // e.stacktrace && e.stack -> opera11 return 'opera11'; // use e.stacktrace, format differs from 'opera10a', 'opera10b' } if (e.stack && !e.fileName) { // Chrome 27 does not have e.arguments as earlier versions, // but still does not have e.fileName as Firefox return 'chrome'; } return 'other'; }, /** * Given a context, function name, and callback function, overwrite it so that it calls * printStackTrace() first with a callback and then runs the rest of the body. * * @param {Object} context of execution (e.g. window) * @param {String} functionName to instrument * @param {Function} callback function to call with a stack trace on invocation */ instrumentFunction: function(context, functionName, callback) { context = context || window; var original = context[functionName]; context[functionName] = function instrumented() { callback.call(this, printStackTrace().slice(4)); return context[functionName]._instrumented.apply(this, arguments); }; context[functionName]._instrumented = original; }, /** * Given a context and function name of a function that has been * instrumented, revert the function to it's original (non-instrumented) * state. * * @param {Object} context of execution (e.g. window) * @param {String} functionName to de-instrument */ deinstrumentFunction: function(context, functionName) { if (context[functionName].constructor === Function && context[functionName]._instrumented && context[functionName]._instrumented.constructor === Function) { context[functionName] = context[functionName]._instrumented; } }, /** * Given an Error object, return a formatted Array based on Chrome's stack string. * * @param e - Error object to inspect * @return Array<String> of function calls, files and line numbers */ chrome: function(e) { return (e.stack + '\n') .replace(/^[\s\S]+?\s+at\s+/, ' at ') // remove message .replace(/^\s+(at eval )?at\s+/gm, '') // remove 'at' and indentation .replace(/^([^\(]+?)([\n$])/gm, '{anonymous}() ($1)$2') .replace(/^Object.<anonymous>\s*\(([^\)]+)\)/gm, '{anonymous}() ($1)') .replace(/^(.+) \((.+)\)$/gm, '$1@$2') .split('\n') .slice(0, -1); }, /** * Given an Error object, return a formatted Array based on Safari's stack string. * * @param e - Error object to inspect * @return Array<String> of function calls, files and line numbers */ safari: function(e) { return e.stack.replace(/\[native code\]\n/m, '') .replace(/^(?=\w+Error\:).*$\n/m, '') .replace(/^@/gm, '{anonymous}()@') .split('\n'); }, /** * Given an Error object, return a formatted Array based on IE's stack string. * * @param e - Error object to inspect * @return Array<String> of function calls, files and line numbers */ ie: function(e) { return e.stack .replace(/^\s*at\s+(.*)$/gm, '$1') .replace(/^Anonymous function\s+/gm, '{anonymous}() ') .replace(/^(.+)\s+\((.+)\)$/gm, '$1@$2') .split('\n') .slice(1); }, /** * Given an Error object, return a formatted Array based on Firefox's stack string. * * @param e - Error object to inspect * @return Array<String> of function calls, files and line numbers */ firefox: function(e) { return e.stack.replace(/(?:\n@:0)?\s+$/m, '') .replace(/^(?:\((\S*)\))?@/gm, '{anonymous}($1)@') .split('\n'); }, opera11: function(e) { var ANON = '{anonymous}', lineRE = /^.*line (\d+), column (\d+)(?: in (.+))? in (\S+):$/; var lines = e.stacktrace.split('\n'), result = []; for (var i = 0, len = lines.length; i < len; i += 2) { var match = lineRE.exec(lines[i]); if (match) { var location = match[4] + ':' + match[1] + ':' + match[2]; var fnName = match[3] || "global code"; fnName = fnName.replace(/<anonymous function: (\S+)>/, "$1").replace(/<anonymous function>/, ANON); result.push(fnName + '@' + location + ' -- ' + lines[i + 1].replace(/^\s+/, '')); } } return result; }, opera10b: function(e) { // "<anonymous function: run>([arguments not available])@file://localhost/G:/js/stacktrace.js:27\n" + // "printStackTrace([arguments not available])@file://localhost/G:/js/stacktrace.js:18\n" + // "@file://localhost/G:/js/test/functional/testcase1.html:15" var lineRE = /^(.*)@(.+):(\d+)$/; var lines = e.stacktrace.split('\n'), result = []; for (var i = 0, len = lines.length; i < len; i++) { var match = lineRE.exec(lines[i]); if (match) { var fnName = match[1] ? (match[1] + '()') : "global code"; result.push(fnName + '@' + match[2] + ':' + match[3]); } } return result; }, /** * Given an Error object, return a formatted Array based on Opera 10's stacktrace string. * * @param e - Error object to inspect * @return Array<String> of function calls, files and line numbers */ opera10a: function(e) { // " Line 27 of linked script file://localhost/G:/js/stacktrace.js\n" // " Line 11 of inline#1 script in file://localhost/G:/js/test/functional/testcase1.html: In function foo\n" var ANON = '{anonymous}', lineRE = /Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i; var lines = e.stacktrace.split('\n'), result = []; for (var i = 0, len = lines.length; i < len; i += 2) { var match = lineRE.exec(lines[i]); if (match) { var fnName = match[3] || ANON; result.push(fnName + '()@' + match[2] + ':' + match[1] + ' -- ' + lines[i + 1].replace(/^\s+/, '')); } } return result; }, // Opera 7.x-9.2x only! opera9: function(e) { // " Line 43 of linked script file://localhost/G:/js/stacktrace.js\n" // " Line 7 of inline#1 script in file://localhost/G:/js/test/functional/testcase1.html\n" var ANON = '{anonymous}', lineRE = /Line (\d+).*script (?:in )?(\S+)/i; var lines = e.message.split('\n'), result = []; for (var i = 2, len = lines.length; i < len; i += 2) { var match = lineRE.exec(lines[i]); if (match) { result.push(ANON + '()@' + match[2] + ':' + match[1] + ' -- ' + lines[i + 1].replace(/^\s+/, '')); } } return result; }, phantomjs: function(e) { var ANON = '{anonymous}', lineRE = /(\S+) \((\S+)\)/i; var lines = e.stack.split('\n'), result = []; for (var i = 1, len = lines.length; i < len; i++) { lines[i] = lines[i].replace(/^\s+at\s+/gm, ''); var match = lineRE.exec(lines[i]); if (match) { result.push(match[1] + '()@' + match[2]); } else { result.push(ANON + '()@' + lines[i]); } } return result; }, // Safari 5-, IE 9-, and others other: function(curr) { var ANON = '{anonymous}', fnRE = /function(?:\s+([\w$]+))?\s*\(/, stack = [], fn, args, maxStackSize = 10; var slice = Array.prototype.slice; while (curr && stack.length < maxStackSize) { fn = fnRE.test(curr.toString()) ? RegExp.$1 || ANON : ANON; try { args = slice.call(curr['arguments'] || []); } catch (e) { args = ['Cannot access arguments: ' + e]; } stack[stack.length] = fn + '(' + this.stringifyArguments(args) + ')'; try { curr = curr.caller; } catch (e) { stack[stack.length] = 'Cannot access caller: ' + e; break; } } return stack; }, /** * Given arguments array as a String, substituting type names for non-string types. * * @param {Arguments,Array} args * @return {String} stringified arguments */ stringifyArguments: function(args) { var result = []; var slice = Array.prototype.slice; for (var i = 0; i < args.length; ++i) { var arg = args[i]; if (arg === undefined) { result[i] = 'undefined'; } else if (arg === null) { result[i] = 'null'; } else if (arg.constructor) { // TODO constructor comparison does not work for iframes if (arg.constructor === Array) { if (arg.length < 3) { result[i] = '[' + this.stringifyArguments(arg) + ']'; } else { result[i] = '[' + this.stringifyArguments(slice.call(arg, 0, 1)) + '...' + this.stringifyArguments(slice.call(arg, -1)) + ']'; } } else if (arg.constructor === Object) { result[i] = '#object'; } else if (arg.constructor === Function) { result[i] = '#function'; } else if (arg.constructor === String) { result[i] = '"' + arg + '"'; } else if (arg.constructor === Number) { result[i] = arg; } else { result[i] = '?'; } } } return result.join(','); }, sourceCache: {}, /** * @return {String} the text from a given URL */ ajax: function(url) { var req = this.createXMLHTTPObject(); if (req) { try { req.open('GET', url, false); //req.overrideMimeType('text/plain'); //req.overrideMimeType('text/javascript'); req.send(null); //return req.status == 200 ? req.responseText : ''; return req.responseText; } catch (e) { } } return ''; }, /** * Try XHR methods in order and store XHR factory. * * @return {XMLHttpRequest} XHR function or equivalent */ createXMLHTTPObject: function() { var xmlhttp, XMLHttpFactories = [ function() { return new XMLHttpRequest(); }, function() { return new ActiveXObject('Msxml2.XMLHTTP'); }, function() { return new ActiveXObject('Msxml3.XMLHTTP'); }, function() { return new ActiveXObject('Microsoft.XMLHTTP'); } ]; for (var i = 0; i < XMLHttpFactories.length; i++) { try { xmlhttp = XMLHttpFactories[i](); // Use memoization to cache the factory this.createXMLHTTPObject = XMLHttpFactories[i]; return xmlhttp; } catch (e) { } } }, /** * Given a URL, check if it is in the same domain (so we can get the source * via Ajax). * * @param url {String} source url * @return {Boolean} False if we need a cross-domain request */ isSameDomain: function(url) { return typeof location !== "undefined" && url.indexOf(location.hostname) !== -1; // location may not be defined, e.g. when running from nodejs. }, /** * Get source code from given URL if in the same domain. * * @param url {String} JS source URL * @return {Array} Array of source code lines */ getSource: function(url) { // TODO reuse source from script tags? if (!(url in this.sourceCache)) { this.sourceCache[url] = this.ajax(url).split('\n'); } return this.sourceCache[url]; }, guessAnonymousFunctions: function(stack) { for (var i = 0; i < stack.length; ++i) { var reStack = /\{anonymous\}\(.*\)@(.*)/, reRef = /^(.*?)(?::(\d+))(?::(\d+))?(?: -- .+)?$/, frame = stack[i], ref = reStack.exec(frame); if (ref) { var m = reRef.exec(ref[1]); if (m) { // If falsey, we did not get any file/line information var file = m[1], lineno = m[2], charno = m[3] || 0; if (file && this.isSameDomain(file) && lineno) { var functionName = this.guessAnonymousFunction(file, lineno, charno); stack[i] = frame.replace('{anonymous}', functionName); } } } } return stack; }, guessAnonymousFunction: function(url, lineNo, charNo) { var ret; try { ret = this.findFunctionName(this.getSource(url), lineNo); } catch (e) { ret = 'getSource failed with url: ' + url + ', exception: ' + e.toString(); } return ret; }, findFunctionName: function(source, lineNo) { // FIXME findFunctionName fails for compressed source // (more than one function on the same line) // function {name}({args}) m[1]=name m[2]=args var reFunctionDeclaration = /function\s+([^(]*?)\s*\(([^)]*)\)/; // {name} = function ({args}) TODO args capture // /['"]?([0-9A-Za-z_]+)['"]?\s*[:=]\s*function(?:[^(]*)/ var reFunctionExpression = /['"]?([$_A-Za-z][$_A-Za-z0-9]*)['"]?\s*[:=]\s*function\b/; // {name} = eval() var reFunctionEvaluation = /['"]?([$_A-Za-z][$_A-Za-z0-9]*)['"]?\s*[:=]\s*(?:eval|new Function)\b/; // Walk backwards in the source lines until we find // the line which matches one of the patterns above var code = "", line, maxLines = Math.min(lineNo, 20), m, commentPos; for (var i = 0; i < maxLines; ++i) { // lineNo is 1-based, source[] is 0-based line = source[lineNo - i - 1]; commentPos = line.indexOf('//'); if (commentPos >= 0) { line = line.substr(0, commentPos); } // TODO check other types of comments? Commented code may lead to false positive if (line) { code = line + code; m = reFunctionExpression.exec(code); if (m && m[1]) { return m[1]; } m = reFunctionDeclaration.exec(code); if (m && m[1]) { //return m[1] + "(" + (m[2] || "") + ")"; return m[1]; } m = reFunctionEvaluation.exec(code); if (m && m[1]) { return m[1]; } } } return '(?)'; } }; return printStackTrace; }));
mfpiccolo/kindred
app/assets/javascripts/utilities/stack_trace.js
JavaScript
mit
20,666
<h2 class="headline-bold grey-secondary float-center"> FLÄCHE 64 </h2> <h2 class="headline-light grey-secondary float-center">ERDGESCHOSS</h2> <img src="assets/img/eg.jpg" alt="" width="100%" class="gap-top-60"> <div class="gap-top-60 grey-secondary text" id="ugheader" style="font-size: 12px"> <p></p> </div> <!-- <div class="row gap-top-60"> <div class="col-md-4" > <a href="assets/pdf/012.pdf" download="Expose" style="float:right;"><img src="./assets/img/pdf.svg" ></a> </div> <div class="col-md-4"> <p class="text grey-secondary">FLÄCHENPLAN</p> </div> </div> --> <link href="../css/bootstrap.css" rel="stylesheet"> <link href="../css/one-page-wonder.css" rel="stylesheet"> <link href="https://fonts.googleapis.com/css?family=Lato:300,400,700" rel="stylesheet"> <script> $.getJSON('json_mieter.json', function(data) { //HIER WIRD DIE MIETERNUMMER EINGETRAGEN id=64; var contentarea = "<p>"; contentarea += '<h4>' + 'MIETER:' + '<span class="grey-primary" style="margin-left:20px;">' + data.mieter[id - 1].name + '</span>' + '</h4>' + '<h4>' + 'QUADRATMETER:' + '<span class="grey-primary" style="margin-left:20px;">' + data.mieter[id - 1].qm + '</span>' + '</h4>' + '</p>'; $('#ugheader p').append(contentarea); }); </script>
kplusgithub/interactivemap2
content/area64.html
HTML
mit
1,322
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/leaflet.css"> <link rel="stylesheet" type="text/css" href="style/landing-page.css"> <link rel="stylesheet" type="text/css" href="style/app.css"> <title>物資捐贈地圖</title> </head> <body> <div> <div id="bifrost"></div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> <script src="https://use.fontawesome.com/9e37312b2a.js"></script> </body> </html>
bifrostio/bifrost
client/index.html
HTML
mit
1,024
// Copyright (c) 2022 Uber Technologies, Inc. // // 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. package tchannel import ( "bytes" "io/ioutil" "sync" "testing" "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/uber/tchannel-go" "github.com/uber/tchannel-go/testutils" "go.uber.org/yarpc/api/transport" "go.uber.org/yarpc/encoding/raw" "go.uber.org/yarpc/internal/testtime" "go.uber.org/yarpc/yarpcerrors" "golang.org/x/net/context" ) func TestTransportNamer(t *testing.T) { trans, err := NewTransport() require.NoError(t, err) assert.Equal(t, TransportName, trans.NewOutbound(nil).TransportName()) } func TestOutboundHeaders(t *testing.T) { tests := []struct { name string originalHeaders bool giveHeaders map[string]string wantHeaders map[string]string }{ { name: "exactCaseHeader options on", giveHeaders: map[string]string{ "foo-BAR-BaZ": "PiE", "foo-bar": "LEMON", "BAR-BAZ": "orange", }, wantHeaders: map[string]string{ "foo-BAR-BaZ": "PiE", "foo-bar": "LEMON", "BAR-BAZ": "orange", }, originalHeaders: true, }, { name: "exactCaseHeader options off", giveHeaders: map[string]string{ "foo-BAR-BaZ": "PiE", "foo-bar": "LEMON", "BAR-BAZ": "orange", }, wantHeaders: map[string]string{ "foo-bar-baz": "PiE", "foo-bar": "LEMON", "bar-baz": "orange", }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { var handlerInvoked bool server := testutils.NewServer(t, nil) defer server.Close() serverHostPort := server.PeerInfo().HostPort server.GetSubChannel("service").SetHandler(tchannel.HandlerFunc( func(ctx context.Context, call *tchannel.InboundCall) { handlerInvoked = true headers, err := readHeaders(tchannel.Raw, call.Arg2Reader) if !assert.NoError(t, err, "failed to read request") { return } deleteReservedHeaders(headers) assert.Equal(t, tt.wantHeaders, headers.OriginalItems(), "headers did not match") // write a response err = writeArgs(call.Response(), []byte{0x00, 0x00}, []byte("")) assert.NoError(t, err, "failed to write response") })) opts := []TransportOption{ServiceName("caller")} if tt.originalHeaders { opts = append(opts, OriginalHeaders()) } trans, err := NewTransport(opts...) require.NoError(t, err) require.NoError(t, trans.Start(), "failed to start transport") out := trans.NewSingleOutbound(serverHostPort) require.NoError(t, out.Start(), "failed to start outbound") defer out.Stop() ctx, cancel := context.WithTimeout(context.Background(), 200*testtime.Millisecond) defer cancel() _, err = out.Call( ctx, &transport.Request{ Caller: "caller", Service: "service", Encoding: raw.Encoding, Procedure: "hello", Headers: transport.HeadersFromMap(tt.giveHeaders), Body: bytes.NewBufferString("body"), }, ) require.NoError(t, err, "failed to make call") assert.True(t, handlerInvoked, "handler was never called by client") }) } } func TestCallSuccess(t *testing.T) { var handlerInvoked bool server := testutils.NewServer(t, nil) defer server.Close() serverHostPort := server.PeerInfo().HostPort server.GetSubChannel("service").SetHandler(tchannel.HandlerFunc( func(ctx context.Context, call *tchannel.InboundCall) { handlerInvoked = true assert.Equal(t, "caller", call.CallerName()) assert.Equal(t, "service", call.ServiceName()) assert.Equal(t, tchannel.Raw, call.Format()) assert.Equal(t, "hello", call.MethodString()) _, body, err := readArgs(call) if assert.NoError(t, err, "failed to read request") { assert.Equal(t, []byte("world"), body) } dl, ok := ctx.Deadline() assert.True(t, ok, "deadline expected") assert.WithinDuration(t, time.Now(), dl, 200*testtime.Millisecond) err = writeArgs(call.Response(), []byte{ 0x00, 0x01, 0x00, 0x03, 'f', 'o', 'o', 0x00, 0x03, 'b', 'a', 'r', }, []byte("great success")) assert.NoError(t, err, "failed to write response") })) out := newSingleOutbound(t, serverHostPort) require.NoError(t, out.Start(), "failed to start outbound") defer out.Stop() ctx, cancel := context.WithTimeout(context.Background(), 200*testtime.Millisecond) defer cancel() res, err := out.Call( ctx, &transport.Request{ Caller: "caller", Service: "service", Encoding: raw.Encoding, Procedure: "hello", Body: bytes.NewBufferString("world"), }, ) require.NoError(t, err, "failed to make call") require.False(t, res.ApplicationError, "unexpected application error") foo, ok := res.Headers.Get("foo") assert.True(t, ok, "value for foo expected") assert.Equal(t, "bar", foo, "foo value mismatch") body, err := ioutil.ReadAll(res.Body) if assert.NoError(t, err, "failed to read response body") { assert.Equal(t, []byte("great success"), body) } assert.NoError(t, res.Body.Close(), "failed to close response body") assert.True(t, handlerInvoked, "handler was never called by client") } func TestCallWithModifiedCallerName(t *testing.T) { const ( destService = "server" alternateCallerName = "alternate-caller" ) server := testutils.NewServer(t, nil) defer server.Close() server.GetSubChannel(destService).SetHandler(tchannel.HandlerFunc( func(ctx context.Context, call *tchannel.InboundCall) { assert.Equal(t, alternateCallerName, call.CallerName()) _, _, err := readArgs(call) assert.NoError(t, err, "failed to read request") err = writeArgs(call.Response(), []byte{0x00, 0x00} /*headers*/, nil /*body*/) assert.NoError(t, err, "failed to write response") })) out := newSingleOutbound(t, server.PeerInfo().HostPort) require.NoError(t, out.Start(), "failed to start outbound") defer out.Stop() ctx, cancel := context.WithTimeout(context.Background(), time.Second) defer cancel() res, err := out.Call( ctx, &transport.Request{ Caller: alternateCallerName, // newSingleOutbound uses "caller", this should override it Service: destService, Encoding: "bar", Procedure: "baz", Body: bytes.NewBuffer(nil), }, ) require.NoError(t, err, "failed to make call") assert.NoError(t, res.Body.Close(), "failed to close response body") } func TestCallFailures(t *testing.T) { const ( unexpectedMethod = "unexpected" unknownMethod = "unknown" ) server := testutils.NewServer(t, nil) defer server.Close() serverHostPort := server.PeerInfo().HostPort server.GetSubChannel("service").SetHandler(tchannel.HandlerFunc( func(ctx context.Context, call *tchannel.InboundCall) { var err error if call.MethodString() == unexpectedMethod { err = tchannel.NewSystemError( tchannel.ErrCodeUnexpected, "great sadness") call.Response().SendSystemError(err) } else if call.MethodString() == unknownMethod { err = tchannel.NewSystemError( tchannel.ErrCodeBadRequest, "unknown method") call.Response().SendSystemError(err) } else { err = writeArgs(call.Response(), []byte{ 0x00, 0x01, 0x00, 0x0d, '$', 'r', 'p', 'c', '$', '-', 's', 'e', 'r', 'v', 'i', 'c', 'e', 0x00, 0x05, 'w', 'r', 'o', 'n', 'g', }, []byte("bad sadness")) assert.NoError(t, err, "o write response") } })) type testCase struct { desc string procedure string message string } tests := []testCase{ { desc: "unexpected error", procedure: unexpectedMethod, message: "great sadness", }, { desc: "missing procedure error", procedure: unknownMethod, message: "unknown method", }, { desc: "service name mismatch error", procedure: "wrong service name", message: "does not match", }, } for _, tt := range tests { t.Run(tt.desc, func(t *testing.T) { out := newSingleOutbound(t, serverHostPort) require.NoError(t, out.Start(), "failed to start outbound") defer out.Stop() ctx, cancel := context.WithTimeout(context.Background(), 200*testtime.Millisecond) defer cancel() _, err := out.Call( ctx, &transport.Request{ Caller: "caller", Service: "service", Encoding: raw.Encoding, Procedure: tt.procedure, Body: bytes.NewReader([]byte("sup")), }, ) require.Error(t, err, "expected failure") assert.Contains(t, err.Error(), tt.message) }) } } func TestApplicationError(t *testing.T) { server := testutils.NewServer(t, nil) defer server.Close() serverHostPort := server.PeerInfo().HostPort server.GetSubChannel("service").SetHandler(tchannel.HandlerFunc( func(ctx context.Context, call *tchannel.InboundCall) { call.Response().SetApplicationError() err := writeArgs( call.Response(), []byte{ 0x00, 0x03, 0x00, 0x1c, '$', 'r', 'p', 'c', '$', '-', 'a', 'p', 'p', 'l', 'i', 'c', 'a', 't', 'i', 'o', 'n', '-', 'e', 'r', 'r', 'o', 'r', '-', 'c', 'o', 'd', 'e', 0x00, 0x02, '1', '0', 0x00, 0x1c, '$', 'r', 'p', 'c', '$', '-', 'a', 'p', 'p', 'l', 'i', 'c', 'a', 't', 'i', 'o', 'n', '-', 'e', 'r', 'r', 'o', 'r', '-', 'n', 'a', 'm', 'e', 0x00, 0x03, 'b', 'A', 'z', 0x00, 0x1f, '$', 'r', 'p', 'c', '$', '-', 'a', 'p', 'p', 'l', 'i', 'c', 'a', 't', 'i', 'o', 'n', '-', 'e', 'r', 'r', 'o', 'r', '-', 'd', 'e', 't', 'a', 'i', 'l', 's', 0x00, 0x03, 'F', 'o', 'O', }, []byte("foo"), ) assert.NoError(t, err, "failed to write response") })) out := newSingleOutbound(t, serverHostPort) require.NoError(t, out.Start(), "failed to start outbound") defer out.Stop() ctx, cancel := context.WithTimeout(context.Background(), 200*testtime.Millisecond) defer cancel() res, err := out.Call( ctx, &transport.Request{ Caller: "caller", Service: "service", Encoding: raw.Encoding, Procedure: "hello", Body: &bytes.Buffer{}, }, ) require.NoError(t, err, "failed to make call") require.True(t, res.ApplicationError, "application error was not set") require.NotNil(t, res.ApplicationErrorMeta.Code, "application error code was not set") assert.Equal(t, "FoO", res.ApplicationErrorMeta.Details, "unexpected error message") assert.Equal( t, yarpcerrors.CodeAborted, *res.ApplicationErrorMeta.Code, "application error code does not match the expected one", ) assert.Equal( t, "bAz", res.ApplicationErrorMeta.Name, "application error name does not match the expected one", ) } func TestStartMultiple(t *testing.T) { out := newSingleOutbound(t, "localhost:4040") var wg sync.WaitGroup signal := make(chan struct{}) for i := 0; i < 10; i++ { wg.Add(1) go func() { defer wg.Done() <-signal err := out.Start() assert.NoError(t, err) }() } close(signal) wg.Wait() } func TestStopMultiple(t *testing.T) { out := newSingleOutbound(t, "localhost:4040") require.NoError(t, out.Start()) var wg sync.WaitGroup signal := make(chan struct{}) for i := 0; i < 10; i++ { wg.Add(1) go func() { defer wg.Done() <-signal err := out.Stop() assert.NoError(t, err) }() } close(signal) wg.Wait() } func TestCallWithoutStarting(t *testing.T) { out := newSingleOutbound(t, "localhost:4040") ctx, cancel := context.WithTimeout(context.Background(), 200*testtime.Millisecond) defer cancel() _, err := out.Call( ctx, &transport.Request{ Caller: "caller", Service: "service", Encoding: raw.Encoding, Procedure: "foo", Body: bytes.NewReader([]byte("sup")), }, ) wantErr := yarpcerrors.FailedPreconditionErrorf("error waiting for tchannel outbound to start for service: service: context finished while waiting for instance to start: context deadline exceeded") assert.EqualError(t, err, wantErr.Error()) } func TestOutboundNoRequest(t *testing.T) { out := newSingleOutbound(t, "localhost:4040") _, err := out.Call(context.Background(), nil) wantErr := yarpcerrors.InvalidArgumentErrorf("request for tchannel outbound was nil") assert.EqualError(t, err, wantErr.Error()) } func newSingleOutbound(t *testing.T, serverAddr string) transport.UnaryOutbound { trans, err := NewTransport(ServiceName("caller")) require.NoError(t, err) require.NoError(t, trans.Start()) return trans.NewSingleOutbound(serverAddr) }
yarpc/yarpc-go
transport/tchannel/outbound_test.go
GO
mit
13,386
using System.Collections; using System.Collections.Generic; using Lockstep.Data; using UnityEngine; namespace Lockstep { public static class InputCodeManager { private static Dictionary<string,InputDataItem> InputDataMap = new Dictionary<string, InputDataItem>(); private static BiDictionary<string,ushort> InputMap = new BiDictionary<string, ushort>(); private static bool Setted {get; set;} public static void Setup () { IInputDataProvider provider; if (LSDatabaseManager.TryGetDatabase<IInputDataProvider> (out provider)) { InputDataItem[] inputData = provider.InputData; for (int i = inputData.Length - 1; i >= 0; i--) { InputDataItem item = inputData[i]; ushort id = (ushort)(i + 1); string code = inputData[i].Name; InputMap.Add(code,id); InputDataMap.Add (code,item); } Setted = true; } } public static InputDataItem GetInputData (string code) { InputDataItem item; if (InputDataMap.TryGetValue(code, out item)) { return item; } else { Debug.Log ("No InputData of " + code + " found. Ignoring."); } return null; } public static ushort GetCodeID (string code) { if (!Setted) throw NotSetupException; if (string.IsNullOrEmpty(code)) return 0; try { return InputMap[code]; } catch { throw new System.Exception(string.Format("Code '{0}' does not exist in the current database", code)); } } public static string GetIDCode (ushort id) { if (!Setted) throw NotSetupException; if (id == 0) return ""; return InputMap.GetReversed(id); } static System.Exception NotSetupException { get { return new System.Exception("InputCodeManager has not yet been setup."); } } } }
erebuswolf/LockstepFramework
Core/Game/Managers/Input/InputCodeManager.cs
C#
mit
2,251
<?php namespace AppBundle\Admin; use Sonata\AdminBundle\Admin\Admin; use Sonata\AdminBundle\Datagrid\ListMapper; use Sonata\AdminBundle\Datagrid\DatagridMapper; use Sonata\AdminBundle\Form\FormMapper; use Sonata\AdminBundle\Show\ShowMapper; class UserAdmin extends Admin { /** * Fields to be shown on create/edit forms * * {@inheritdoc} */ protected function configureFormFields(FormMapper $formMapper) { $formMapper ->add('name') ->add('birthday') ->add('picture') ; } /** * Fields to be shown on filter forms * * {@inheritdoc} */ protected function configureDatagridFilters(DatagridMapper $datagridMapper) { $datagridMapper ->add('name') ->add('picture') ; } /** * Fields to be shown on lists * * {@inheritdoc} */ protected function configureListFields(ListMapper $listMapper) { $listMapper ->addIdentifier('id') ->add('name') ->add('birthday') ->add('picture') ; } /** * Fields to be shown on show action * * {@inheritdoc} */ protected function configureShowFields(ShowMapper $showMapper) { $showMapper ->add('id') ->add('name') ->add('birthday') ->add('picture') ; } }
YogiSama/IIM_A2_Blog_Symfony2_Louis_Fourel
src/AppBundle/Admin/UserAdmin.php
PHP
mit
1,438
/* vi: set sw=4 ts=4: */ /* * Stripped down version of net-tools for busybox. * * Author: Ignacio Garcia Perez (iggarpe at gmail dot com) * * License: GPLv2 or later, see LICENSE file in this tarball. * * There are some differences from the standard net-tools slattach: * * - The -l option is not supported. * * - The -F options allows disabling of RTS/CTS flow control. */ #include "libbb.h" #include "libiproute/utils.h" /* invarg() */ struct globals { int handle; int saved_disc; struct termios saved_state; }; #define G (*(struct globals*)&bb_common_bufsiz1) #define handle (G.handle ) #define saved_disc (G.saved_disc ) #define saved_state (G.saved_state ) #define INIT_G() do {} while (0) /* * Save tty state and line discipline * * It is fine here to bail out on errors, since we haven modified anything yet */ static void save_state(void) { /* Save line status */ if (tcgetattr(handle, &saved_state) < 0) bb_perror_msg_and_die("get state"); /* Save line discipline */ xioctl(handle, TIOCGETD, &saved_disc); } static int set_termios_state_and_warn(struct termios *state) { int ret; ret = tcsetattr(handle, TCSANOW, state); if (ret < 0) { bb_perror_msg("set state"); return 1; /* used as exitcode */ } return 0; } /* * Restore state and line discipline for ALL managed ttys * * Restoring ALL managed ttys is the only way to have a single * hangup delay. * * Go on after errors: we want to restore as many controlled ttys * as possible. */ static void restore_state_and_exit(int exitcode) ATTRIBUTE_NORETURN; static void restore_state_and_exit(int exitcode) { struct termios state; /* Restore line discipline */ if (ioctl_or_warn(handle, TIOCSETD, &saved_disc) < 0) { exitcode = 1; } /* Hangup */ memcpy(&state, &saved_state, sizeof(state)); cfsetispeed(&state, B0); cfsetospeed(&state, B0); if (set_termios_state_and_warn(&state)) exitcode = 1; sleep(1); /* Restore line status */ if (set_termios_state_and_warn(&saved_state)) exit(EXIT_FAILURE); if (ENABLE_FEATURE_CLEAN_UP) close(handle); exit(exitcode); } /* * Set tty state, line discipline and encapsulation */ static void set_state(struct termios *state, int encap) { int disc; /* Set line status */ if (set_termios_state_and_warn(state)) goto bad; /* Set line discliple (N_SLIP always) */ disc = N_SLIP; if (ioctl_or_warn(handle, TIOCSETD, &disc) < 0) { goto bad; } /* Set encapsulation (SLIP, CSLIP, etc) */ if (ioctl_or_warn(handle, SIOCSIFENCAP, &encap) < 0) { bad: restore_state_and_exit(1); } } static void sig_handler(int signo) { restore_state_and_exit(0); } int slattach_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; int slattach_main(int argc, char **argv) { /* Line discipline code table */ static const char proto_names[] ALIGN1 = "slip\0" /* 0 */ "cslip\0" /* 1 */ "slip6\0" /* 2 */ "cslip6\0" /* 3 */ "adaptive\0" /* 8 */ ; int i, encap, opt; struct termios state; const char *proto = "cslip"; const char *extcmd; /* Command to execute after hangup */ const char *baud_str; int baud_code = -1; /* Line baud rate (system code) */ enum { OPT_p_proto = 1 << 0, OPT_s_baud = 1 << 1, OPT_c_extcmd = 1 << 2, OPT_e_quit = 1 << 3, OPT_h_watch = 1 << 4, OPT_m_nonraw = 1 << 5, OPT_L_local = 1 << 6, OPT_F_noflow = 1 << 7 }; INIT_G(); /* Parse command line options */ opt = getopt32(argv, "p:s:c:ehmLF", &proto, &baud_str, &extcmd); /*argc -= optind;*/ argv += optind; if (!*argv) bb_show_usage(); encap = index_in_strings(proto_names, proto); if (encap < 0) invarg(proto, "protocol"); if (encap > 3) encap = 8; /* We want to know if the baud rate is valid before we start touching the ttys */ if (opt & OPT_s_baud) { baud_code = tty_value_to_baud(xatoi(baud_str)); if (baud_code < 0) invarg(baud_str, "baud rate"); } /* Trap signals in order to restore tty states upon exit */ if (!(opt & OPT_e_quit)) { signal(SIGHUP, sig_handler); signal(SIGINT, sig_handler); signal(SIGQUIT, sig_handler); signal(SIGTERM, sig_handler); } /* Open tty */ handle = open(*argv, O_RDWR | O_NDELAY); if (handle < 0) { char *buf = concat_path_file("/dev", *argv); handle = xopen(buf, O_RDWR | O_NDELAY); /* maybe if (ENABLE_FEATURE_CLEAN_UP) ?? */ free(buf); } /* Save current tty state */ save_state(); /* Configure tty */ memcpy(&state, &saved_state, sizeof(state)); if (!(opt & OPT_m_nonraw)) { /* raw not suppressed */ memset(&state.c_cc, 0, sizeof(state.c_cc)); state.c_cc[VMIN] = 1; state.c_iflag = IGNBRK | IGNPAR; state.c_oflag = 0; state.c_lflag = 0; state.c_cflag = CS8 | HUPCL | CREAD | ((opt & OPT_L_local) ? CLOCAL : 0) | ((opt & OPT_F_noflow) ? 0 : CRTSCTS); } if (opt & OPT_s_baud) { cfsetispeed(&state, baud_code); cfsetospeed(&state, baud_code); } set_state(&state, encap); /* Exit now if option -e was passed */ if (opt & OPT_e_quit) return 0; /* If we're not requested to watch, just keep descriptor open * until we are killed */ if (!(opt & OPT_h_watch)) while (1) sleep(24*60*60); /* Watch line for hangup */ while (1) { if (ioctl(handle, TIOCMGET, &i) < 0 || !(i & TIOCM_CAR)) goto no_carrier; sleep(15); } no_carrier: /* Execute command on hangup */ if (opt & OPT_c_extcmd) system(extcmd); /* Restore states and exit */ restore_state_and_exit(0); }
impedimentToProgress/UCI-BlueChip
snapgear_linux/user/busybox/busybox-1.8.2/networking/slattach.c
C
mit
5,474
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>W30493_text</title> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body> <div style="margin-left: auto; margin-right: auto; width: 800px; overflow: hidden;"> <div style="float: left;"> <a href="page28.html">&laquo;</a> </div> <div style="float: right;"> </div> </div> <hr/> <div style="position: absolute; margin-left: 137px; margin-top: 192px;"> <p class="styleSans567.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">HORIZONTAL SECTION PLAT CONTINENTAL RESOURCES INC. <br/>SECTION 35, TISSN, R93W MOUNTRAIL COUNTY, NORTH DAKOTA MCKENZIE COUNTY, NORTH DAKOTA <br/>COMPUTED _09 <br/>' "f— _ _ _ _090' 7€'__ _ COMPUTED 7527.2’ D F 7327.2’ 7327.2' (WATER) _ R“ \ ~ i <br/>:3 \\ 107’ I <br/>. 090' 74 ' <br/> <br/> <br/> <br/>SCALE <br/> <br/> <br/>COMPUTED - - . . ’ COMPUTED <br/>ALL CORNERS SHOWN ON THIS PLAT WERE FOUND IN THE FIELD DISTANCES TO ALL OTHERS ARE CALCULATED. <br/>£80.57 F/Vfll/VEERIA’C' m: <br/>BOX 557 BOWMAN, ND. 58623 4. P’Z-SIIEA?’33§33§2§0 " ,.:...__- , _ _ m m mom No. 14-10 <br/> </p> </div> </body> </html>
datamade/elpc_bakken
ocr_extracted/W30493_text/page29.html
HTML
mit
1,381
<?php namespace FdjBundle\Repository; use Doctrine\ORM\EntityRepository; /** * MatchFiniRepository * * This class was generated by the Doctrine ORM. Add your own custom * repository methods below. */ class MatchFiniRepository extends EntityRepository { public function findByTennisResult($data) { $qb = $this->createQueryBuilder('m'); $qb->where('m.minCote BETWEEN :minCote AND :maxCote') ->setParameter('minCote', $data['coteMin']) ->setParameter('maxCote', $data['coteMax']) ->andWhere('m.nbSetGagnant = :nbSetGagnant') ->setParameter('nbSetGagnant', $data['nbSetGagnant']); // $qb->where('t.minCote <= :minCote') // ->setParameter('minCote', $data['cote']) // ->andWhere('t.nbSetGagnant = :nbSetGagnant') // ->setParameter('nbSetGagnant', $data['nbSetGagnant']); ; return $qb->getQuery()->getResult(); } public function findByMatchFini() { $qb = $this->createQueryBuilder('m'); $qb->where('m.matchFini = 1') ->andWhere('m.sportId = 1') // $qb->where('t.minCote <= :minCote') // ->setParameter('minCote', $data['cote']) // ->andWhere('t.nbSetGagnant = :nbSetGagnant') // ->setParameter('nbSetGagnant', $data['nbSetGagnant']); ; return $qb->getQuery()->getResult(); } }
Jpilosel/cote
src/FdjBundle/Repository/MatchFiniRepository.php
PHP
mit
1,416
#!/usr/bin/env python # -*- coding: utf-8 -*- """ The MIT License (MIT) Copyright (c) 2014 sinfonier-project 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. """ import basesinfonierbolt class CrackItWithAbusix(basesinfonierbolt.BaseSinfonierBolt): def __init__(self): basesinfonierbolt.BaseSinfonierBolt().__init__() def userprepare(self): pass def userprocess(self): hhash = self.getField("hash") self.removeField("hash") url = "http://api.leakdb.abusix.com/?j=%s" % (hhash) response = urllib2.urlopen(url) html = response.read() js= json.loads(html) if js["type"] == "plaintext": self.addField("error","The hash could not be cracked.") else: self.addField("value",js["hashes"][0]["plaintext"]) self.emit()   CrackItWithAbusix().run()
JulGor/Sinfonier_Modules
CrackItWithAbusix.py
Python
mit
1,937
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>ruler-compass-geometry: 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.7.1 / ruler-compass-geometry - 8.6.0</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> ruler-compass-geometry <small> 8.6.0 <span class="label label-info">Not compatible 👼</span> </small> </h1> <p>📅 <em><script>document.write(moment("2021-12-05 19:37:45 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2021-12-05 19:37:45 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-num base Num library distributed with the OCaml compiler base-threads base base-unix base camlp5 7.14 Preprocessor-pretty-printer of OCaml conf-findutils 1 Virtual package relying on findutils conf-perl 1 Virtual package relying on perl coq 8.7.1 Formal proof management system num 0 The Num library for arbitrary-precision integer and rational arithmetic ocaml 4.03.0 The OCaml compiler (virtual package) ocaml-base-compiler 4.03.0 Official 4.03.0 release ocaml-config 1 OCaml Switch Configuration ocamlfind 1.9.1 A library manager for OCaml # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;Hugo.Herbelin@inria.fr&quot; homepage: &quot;https://github.com/coq-contribs/ruler-compass-geometry&quot; license: &quot;GNU Lesser Public License&quot; build: [make &quot;-j%{jobs}%&quot;] install: [make &quot;install&quot;] remove: [&quot;rm&quot; &quot;-R&quot; &quot;%{lib}%/coq/user-contrib/RulerCompassGeometry&quot;] depends: [ &quot;ocaml&quot; &quot;coq&quot; {&gt;= &quot;8.6&quot; &amp; &lt; &quot;8.7~&quot;} ] tags: [ &quot;keyword: geometry&quot; &quot;keyword: plane geometry&quot; &quot;keyword: ruler and compass geometry&quot; &quot;keyword: Euclidian geometry&quot; &quot;keyword: Hilbert&#39;s axioms&quot; &quot;category: Mathematics/Geometry/General&quot; &quot;date: 2007-11&quot; ] authors: [ &quot;Jean Duprat &lt;Jean.Duprat@ens-lyon.fr&gt;&quot; ] bug-reports: &quot;https://github.com/coq-contribs/ruler-compass-geometry/issues&quot; dev-repo: &quot;git+https://github.com/coq-contribs/ruler-compass-geometry.git&quot; synopsis: &quot;Ruler and compass geometry axiomatization&quot; description: &quot;&quot;&quot; This library contains an axiomatization of the ruler and compass euclidian geometry. Files A1 to A6 contain the axioms and the basic constructions. The other files build the proof that this axiomatization induces the whole plane geometry except the continuity axiom. For that the proofs of the Hilbert&#39;s axioms conclude this work in the files E1 to E5.&quot;&quot;&quot; flags: light-uninstall url { src: &quot;https://github.com/coq-contribs/ruler-compass-geometry/archive/v8.6.0.tar.gz&quot; checksum: &quot;md5=3d7693bf8b1a555ee357d327de90e416&quot; } </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-ruler-compass-geometry.8.6.0 coq.8.7.1</code></dd> <dt>Return code</dt> <dd>5120</dd> <dt>Output</dt> <dd><pre>[NOTE] Package coq is already installed (current version is 8.7.1). The following dependencies couldn&#39;t be met: - coq-ruler-compass-geometry -&gt; coq &lt; 8.7~ -&gt; ocaml &lt; 4.03.0 base of this switch (use `--unlock-base&#39; to force) Your request can&#39;t be satisfied: - No available version of coq satisfies the constraints 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-ruler-compass-geometry.8.6.0</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"> Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣 </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.03.0-2.0.5/released/8.7.1/ruler-compass-geometry/8.6.0.html
HTML
mit
7,599
using System; class SortingArray { //Sorting an array means to arrange its elements in //increasing order. Write a program to sort an array. //Use the "selection sort" algorithm: Find the smallest //element, move it at the first position, find the smallest //from the rest, move it at the second position, etc. static void Main() { //variables int[] array = new int[10]; Random rand = new Random(); int max; //expressions //fill the array with random values for (int i = 0; i < array.Length; i++) { array[i] = rand.Next(9); } //sort the array from smallest to biggest //I variant for (int i = array.Length - 1; i > 0; i--) { max = i; for (int m = i - 1; m >= 0; m--) { if (array[m] > array[max]) { max = m; } } //swap current element with smallest element if (i != max) { array[i] = array[i] ^ array[max]; array[max] = array[max] ^ array[i]; array[i] = array[i] ^ array[max]; } } //II variant //Array.Sort(array); #region print result //print array Console.Write("{"); for (int i = 0; i < array.Length; i++) { Console.Write(array[i] + " "); if (i != array.Length - 1) { Console.Write(','); } } Console.WriteLine("}"); #endregion } }
niki-funky/Telerik_Academy
Programming/02.Csharp/02. Arrays/07.SortingArray/07.SortingArray .cs
C#
mit
1,655
# Copyright © 2016-2017 Exosite LLC. All Rights Reserved # License: PROPRIETARY. See LICENSE.txt. # frozen_string_literal: true # vim:tw=0:ts=2:sw=2:et:ai # Unauthorized copying of this file is strictly prohibited. require 'MrMurano/verbosing' require 'MrMurano/Account' require 'MrMurano/ReCommander' require 'MrMurano/SubCmdGroupContext' require 'MrMurano/commands/business' require 'MrMurano/commands/solution_picker' command :solution do |c| c.syntax = %(murano solution) c.summary = %(About solution) c.description = %( Commands for working with Application and Product solutions. ).strip c.project_not_required = true c.subcmdgrouphelp = true c.action do |_args, _options| ::Commander::UI.enable_paging unless $cfg['tool.no-page'] say MrMurano::SubCmdGroupHelp.new(c).get_help end end # *** Create solution. # -------------------- command 'solution create' do |c| c.syntax = %(murano solution create [--options] <solution-name>) c.summary = %(Create a new solution) c.description = %( Create a new solution in the current business. ).strip c.project_not_required = true # Add flag: --type [application|product]. cmd_add_solntype_pickers(c, exclude_all: true) c.option('--save', %(Save new solution ID to config)) c.action do |args, options| c.verify_arg_count!(args, 1) cmd_defaults_solntype_pickers(options, :application) biz = MrMurano::Business.new biz.must_business_id! if args.count.zero? sol = biz.solution_from_type!(options.type) name = solution_ask_for_name(sol) names = [name] else names = args end # MAYBE: Support making multiple solutions. if names.length > 1 MrMurano::Verbose.error('Can only make one solution at a time') exit 2 end sol = biz.new_solution!(names.first, options.type) if options.save section = options.type.to_s $cfg.set("#{section}.id", sol.api_id) $cfg.set("#{section}.name", sol.name) end biz.outf(sol.api_id) end end alias_command 'create application', 'solution create', '--type', 'application' alias_command 'create product', 'solution create', '--type', 'product' alias_command 'application create', 'solution create', '--type', 'application' alias_command 'product create', 'solution create', '--type', 'product' # *** Delete solution(s). # ----------------------- command 'solution delete' do |c| c.syntax = %(murano solution delete [--options] [<name-or-ID,...>]) c.summary = %(Delete a solution) c.description = %( Delete a solution from the business. ).strip c.project_not_required = true # Add flag: --type [application|product|all]. cmd_add_solntype_pickers(c) # Add --id and --name options. cmd_options_add_id_and_name(c) # Add soln pickers: --application* and --product* cmd_option_application_pickers(c) cmd_option_product_pickers(c) c.option('--recursive', %(If a solution is not specified, find all solutions and prompt before deleting.)) c.option('-y', '--[no-]yes', %(Answer "yes" to all prompts and run non-interactively)) c.action do |args, options| # SKIP: c.verify_arg_count!(args) cmd_defaults_solntype_pickers(options) cmd_defaults_id_and_name(options) # Set all: true, so that cmd_solution_del_get_names_and_ids finds 'em all. options.default(all: true) biz = MrMurano::Business.new biz.must_business_id! nmorids = cmd_solution_del_get_names_and_ids!(biz, args, options) n_deleted = 0 n_faulted = 0 nmorids.each do |name_or_id| next unless biz.cmd_confirm_delete!( name_or_id[0], options.yes, "Skipping #{name_or_id[0]}!" ) do |confirmed| confirmed end m_deleted, m_faulted = solution_delete( name_or_id[0], use_sol: name_or_id[2], type: options.type, yes: options.yes ) n_deleted += m_deleted n_faulted += m_faulted end # Print results if something happened and was recursive (otherwise # behave like, say, /bin/rm, and just be silent on success). solution_delete_report(n_deleted, n_faulted) if options.recursive end end alias_command 'delete application', 'solution delete', '--type', 'application' alias_command 'delete product', 'solution delete', '--type', 'product' alias_command 'application delete', 'solution delete', '--type', 'application' alias_command 'product delete', 'solution delete', '--type', 'product' def cmd_solution_del_get_names_and_ids!(biz, args, options) nmorids = [] if args.count.zero? if any_solution_pickers!(options) exit_cmd_not_recursive!(options) elsif !options.recursive MrMurano::Verbose.error( 'Please specify the name or ID of the solution to delete, or use --recursive.' ) exit 1 end else exit_cmd_not_recursive!(options) end solz = must_fetch_solutions!(options, args, biz) solz.each do |sol| nmorids += [ [sol.api_id, "#{MrMurano::Verbose.fancy_ticks(sol.name)} <#{sol.api_id}>", sol], ] end nmorids end def exit_cmd_not_recursive!(options) return unless options.recursive MrMurano::Verbose.error( 'The --recursive option does not apply when specifing solution IDs or names.' ) exit 1 end # The `murano solutions expunge -y` command simplifies what be done # craftily other ways, e.g.,: # # $ for pid in $(murano product list --idonly) ; do murano product delete $pid ; done command 'solutions expunge' do |c| c.syntax = %(murano solution expunge) c.summary = %(Delete all solutions) c.description = %( Delete all solutions in business. ).strip c.project_not_required = true c.option('--[no-]all', 'Delete all Solutions in Business, not just Project') c.option('-y', '--[no-]yes', %(Answer "yes" to all prompts and run non-interactively)) c.action do |args, options| c.verify_arg_count!(args) name_or_id = '*' n_deleted, n_faulted = solution_delete(name_or_id, yes: options.yes) solution_delete_report(n_deleted, n_faulted) end end def solution_delete(name_or_id, use_sol: nil, type: :all, yes: false) biz = MrMurano::Business.new biz.must_business_id! if name_or_id == '*' return unless biz.cmd_confirm_delete!( 'all solutions', yes, 'abort!' ) do |confirmed| confirmed end name_or_id = '' end if !use_sol.nil? solz = [use_sol] else MrMurano::Verbose.whirly_start('Looking for solutions...') solz = biz.solutions(type: type) # This used to use Hash.value? to see if the name exactly matches # any key's value. But we should be able to stick to using name. # (E.g., it used to call sol.meta.value?(name_or_id), but this # would return true if, say, sol.meta[:any_key] equaled name_or_id.) unless name_or_id.empty? solz.select! do |sol| sol.api_id == name_or_id \ || sol.name == name_or_id \ || sol.domain =~ /#{Regexp.escape(name_or_id)}\./i end end MrMurano::Verbose.whirly_stop if $cfg['tool.debug'] say 'Matches found:' biz.outf(solz) end end n_deleted = 0 n_faulted = 0 if solz.empty? if !name_or_id.empty? name_or_id_q = MrMurano::Verbose.fancy_ticks(name_or_id) MrMurano::Verbose.error("No solution matching #{name_or_id_q} found") else MrMurano::Verbose.error(MSG_SOLUTIONS_NONE_FOUND) end exit 1 else # Solutions of different types can have the same name, so warning that # more than one solution was found when searching by name is not valid. #unless name_or_id.empty? or solz.length == 1 # MrMurano::Verbose.warning( # "Unexpected number of solutions: found #{solz.length} for #{name_or_id} but expected 1" # ) #end MrMurano::Verbose.whirly_start('Deleting solutions...') solz.each do |sol| ret = biz.delete_solution(sol.sid) if !ret.is_a?(Hash) && !ret.empty? MrMurano::Verbose.error("Delete failed: #{ret}") n_faulted += 1 else n_deleted += 1 # Clear the ID from the config. MrMurano::Config::CFG_SOLUTION_ID_KEYS.each do |keyn| $cfg.set(keyn, nil) if $cfg[keyn] == sol.api_id end end end MrMurano::Verbose.whirly_stop end [n_deleted, n_faulted] end def solution_delete_report(n_deleted, n_faulted) unless n_deleted.nil? || n_deleted.zero? # FIXME: Should this use 'say' or 'outf'? inflection = MrMurano::Verbose.pluralize?('solution', n_deleted) say "Deleted #{n_deleted} #{inflection}" end return if n_faulted.nil? || n_faulted.zero? inflection = MrMurano::Verbose.pluralize?('solution', n_faulted) MrMurano::Verbose.error("Failed to delete #{n_faulted} #{inflection}") end # *** List and Find solutions. # ---------------------------- def cmd_solution_find_add_options(c) c.option '--idonly', 'Only return the ids' c.option '--[no-]brief', 'Show fewer fields: only Solution ID and domain' c.option '--[no-]all', 'Find all Solutions in Business, not just Project' c.option '-o', '--output FILE', %(Download to file instead of STDOUT) end command 'solution list' do |c| c.syntax = %(murano solution list [--options]) c.summary = %(List solutions) c.description = %( List solutions in the current business. ).strip c.project_not_required = true cmd_solution_find_add_options(c) # Add flag: --type [application|product|all]. cmd_add_solntype_pickers(c) c.action do |args, options| c.verify_arg_count!(args) # Set all: true, so that must_fetch_solutions! finds 'em all. options.default(all: true) cmd_defaults_solntype_pickers(options) cmd_solution_find_and_output(args, options) end end alias_command 'list application', 'solution list', '--type', 'application', '--brief' alias_command 'list product', 'solution list', '--type', 'product', '--brief' alias_command 'application list', 'solution list', '--type', 'application', '--brief' alias_command 'product list', 'solution list', '--type', 'product', '--brief' # alias_command 'list solutions', 'solution list' alias_command 'list applications', 'application list' alias_command 'list products', 'product list' alias_command 'solutions list', 'solution list' alias_command 'applications list', 'application list' alias_command 'products list', 'product list' command 'solution find' do |c| c.syntax = %(murano solution find [--options] [<name-or-ID,...>]) c.summary = %(Find solution by name or ID) c.description = %( Find solution by name or ID. ).strip c.project_not_required = true c.example %( Find any solution named "mysolution" ).strip, 'murano solution find mysolution --name' c.example %( Find product with ID "abcdef123456" ).strip, 'murano product find abcdef123456 --id' c.example %( Find application with name or ID matching "1234" ).strip, 'murano application find 1234' cmd_solution_find_add_options(c) cmd_add_solntype_pickers(c) # Add --id and --name options. cmd_options_add_id_and_name(c) # Add soln pickers: --application* and --product* cmd_option_application_pickers(c) cmd_option_product_pickers(c) c.action do |args, options| # SKIP: c.verify_arg_count!(args) cmd_defaults_solntype_pickers(options) cmd_defaults_id_and_name(options) # Set all: true, so that must_fetch_solutions! finds 'em all. options.default(all: true) if args.none? && !any_solution_pickers!(options) MrMurano::Verbose.error('What would you like to find?') exit 1 end cmd_solution_find_and_output(args, options) end end alias_command 'find application', 'solution find', '--type', 'application', '--brief' alias_command 'find product', 'solution find', '--type', 'product', '--brief' alias_command 'application find', 'solution find', '--type', 'application', '--brief' alias_command 'product find', 'solution find', '--type', 'product', '--brief' def cmd_solution_find_and_output(args, options) cmd_verify_args_and_id_or_name!(args, options) biz = MrMurano::Business.new biz.must_business_id! solz = cmd_solution_find_solutions(biz, args, options) if solz.empty? && !options.idonly MrMurano::Verbose.error(MSG_SOLUTIONS_NONE_FOUND) exit 0 end cmd_solution_output_solutions(biz, solz, options) end def cmd_solution_find_solutions(biz, args, options) must_fetch_solutions!(options, args, biz) end def cmd_solution_output_solutions(biz, solz, options) if options.idonly headers = %i[api_id] solz = solz.map { |row| [row.api_id] } elsif options.brief #headers = %i[api_id domain] #solz = solz.map { |row| [row.api_id, row.domain] } headers = %i[api_id sid domain name] solz = solz.map { |row| [row.api_id, row.sid, row.domain, row.name] } else headers = (solz.first && solz.first.meta || {}).keys #headers.delete(:sid) if headers.include?(:api_id) && headers.include?(:sid) headers.sort_by! do |hdr| case hdr when :bizid 0 when :type 1 when :api_id 2 when :sid 3 when :domain 4 when :name 5 else 6 end end solz = solz.map { |row| headers.map { |hdr| row.meta[hdr] } } end io = File.open(options.output, 'w') if options.output biz.outf(solz, io) do |dd, ios| if options.idonly ios.puts(dd.join(' ')) else biz.tabularize( { headers: headers.map(&:to_s), rows: dd, }, ios, ) end end io.close unless io.nil? end
exosite/MrMurano
lib/MrMurano/commands/solution.rb
Ruby
mit
13,524
package com.mwiti.collins.inspector; import android.content.Context; import android.content.Intent; import android.graphics.Color; import android.os.Build; import android.os.Bundle; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import android.text.Html; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.view.WindowManager; import android.widget.Button; import android.widget.LinearLayout; import android.widget.TextView; public class WelcomeActivity extends AppCompatActivity { private ViewPager viewPager; private MyViewPagerAdapter myViewPagerAdapter; private LinearLayout dotsLayout; private TextView[] dots; private int[] layouts; private Button btnSkip, btnNext; private PrefManager prefManager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Checking for first time launch - before calling setContentView() prefManager = new PrefManager(this); if (prefManager.isFirstTimeLaunch()) { launchHomeScreen(); finish(); } // Making notification bar transparent if (Build.VERSION.SDK_INT >= 21) { getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); } setContentView(R.layout.activity_welcome); viewPager = (ViewPager) findViewById(R.id.view_pager); dotsLayout = (LinearLayout) findViewById(R.id.layoutDots); btnSkip = (Button) findViewById(R.id.btn_skip); btnNext = (Button) findViewById(R.id.btn_next); // layouts of all welcome sliders // add few more layouts if you want layouts = new int[]{ R.layout.welcome_slide1, R.layout.welcome_slide2, R.layout.welcome_slide3, R.layout.welcome_slide4}; // adding bottom dots addBottomDots(0); // making notification bar transparent changeStatusBarColor(); myViewPagerAdapter = new MyViewPagerAdapter(); viewPager.setAdapter(myViewPagerAdapter); viewPager.addOnPageChangeListener(viewPagerPageChangeListener); btnSkip.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { launchHomeScreen(); } }); btnNext.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // checking for last page // if last page home screen will be launched int current = getItem(+1); if (current < layouts.length) { // move to next screen viewPager.setCurrentItem(current); } else { launchHomeScreen(); } } }); } private void addBottomDots(int currentPage) { dots = new TextView[layouts.length]; int[] colorsActive = getResources().getIntArray(R.array.array_dot_active); int[] colorsInactive = getResources().getIntArray(R.array.array_dot_inactive); dotsLayout.removeAllViews(); for (int i = 0; i < dots.length; i++) { dots[i] = new TextView(this); dots[i].setText(Html.fromHtml("&#8226;")); dots[i].setTextSize(35); dots[i].setTextColor(colorsInactive[currentPage]); dotsLayout.addView(dots[i]); } if (dots.length > 0) dots[currentPage].setTextColor(colorsActive[currentPage]); } private int getItem(int i) { return viewPager.getCurrentItem() + i; } private void launchHomeScreen() { prefManager.setFirstTimeLaunch(false); startActivity(new Intent(WelcomeActivity.this, MainActivity.class)); finish(); } // viewpager change listener ViewPager.OnPageChangeListener viewPagerPageChangeListener = new ViewPager.OnPageChangeListener() { @Override public void onPageSelected(int position) { addBottomDots(position); // changing the next button text 'NEXT' / 'GOT IT' if (position == layouts.length - 1) { // last page. make button text to GOT IT btnNext.setText(getString(R.string.start)); btnSkip.setVisibility(View.GONE); } else { // still pages are left btnNext.setText(getString(R.string.next)); btnSkip.setVisibility(View.VISIBLE); } } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { } @Override public void onPageScrollStateChanged(int arg0) { } }; /** * Making notification bar transparent */ private void changeStatusBarColor() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window window = getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.setStatusBarColor(Color.TRANSPARENT); } } /** * View pager adapter */ public class MyViewPagerAdapter extends PagerAdapter { private LayoutInflater layoutInflater; public MyViewPagerAdapter() { } @Override public Object instantiateItem(ViewGroup container, int position) { layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = layoutInflater.inflate(layouts[position], container, false); container.addView(view); return view; } @Override public int getCount() { return layouts.length; } @Override public boolean isViewFromObject(View view, Object obj) { return view == obj; } @Override public void destroyItem(ViewGroup container, int position, Object object) { View view = (View) object; container.removeView(view); } } }
collinsmwiti/inspector
app/src/main/java/com/mwiti/collins/inspector/WelcomeActivity.java
Java
mit
6,361
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>mi-cho-coq: 4 m 4 s 🏆</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.10.0 / mi-cho-coq - 0.1</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> mi-cho-coq <small> 0.1 <span class="label label-success">4 m 4 s 🏆</span> </small> </h1> <p>📅 <em><script>document.write(moment("2021-11-03 02:25:39 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2021-11-03 02:25:39 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 coq 8.10.0 Formal proof management system num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic ocaml 4.08.1 The OCaml compiler (virtual package) ocaml-base-compiler 4.08.1 Official release 4.08.1 ocaml-config 1 OCaml Switch Configuration ocamlfind 1.9.1 A library manager for OCaml # opam file: opam-version: &quot;2.0&quot; synopsis: &quot;A specification of Michelson in Coq to prove properties about smart contracts in Tezos&quot; maintainer: &quot;raphael.cauderlier@nomadic-labs.com&quot; authors: [ &quot;Raphaël Cauderlier&quot; &quot;Bruno Bernardo&quot; &quot;Julien Tesson&quot; &quot;Arvid Jakobsson&quot; ] homepage: &quot;https://gitlab.com/nomadic-labs/mi-cho-coq/&quot; dev-repo: &quot;git+https://gitlab.com/nomadic-labs/mi-cho-coq/&quot; bug-reports: &quot;https://gitlab.com/nomadic-labs/mi-cho-coq/issues&quot; license: &quot;MIT&quot; build: [ [&quot;./configure&quot;] [make &quot;-j%{jobs}%&quot;] ] install: [ make &quot;install&quot; ] depends: [ &quot;coq&quot; {&gt;= &quot;8.8&quot;} &quot;coq-menhirlib&quot; {&gt;= &quot;20190626&quot;} &quot;coq-ott&quot; {&gt;= &quot;0.29&quot;} &quot;menhir&quot; &quot;ocaml&quot; {&gt;= &quot;4.07.1&quot;} &quot;ocamlbuild&quot; &quot;ott&quot; {build &amp; &gt;= &quot;0.29&quot;} &quot;zarith&quot; ] description: &quot;&quot;&quot; Michelson is a language for writing smart contracts on the Tezos blockchain. This package provides a Coq encoding of the syntax and semantics of Michelson, automatically generated by the Ott tool. Also included is a framework called Mi-Cho-Coq for reasoning about Michelson programs in Coq using a weakest precondition calculus.&quot;&quot;&quot; tags: [ &quot;category:Computer Science/Programming Languages/Formal Definitions and Theory&quot; &quot;date:2021-06-15&quot; &quot;keyword:cryptocurrency&quot; &quot;keyword:michelson&quot; &quot;keyword:semantics&quot; &quot;keyword:smart-contract&quot; &quot;keyword:tezos&quot; &quot;logpath:Michocoq&quot; &quot;logpath:Michocott&quot; ] url { http: &quot;https://gitlab.com/nomadic-labs/mi-cho-coq/-/archive/version-0.1/mi-cho-coq-version-0.1.tar.gz&quot; checksum: &quot;521927e391d5529f652056d97fcdd261&quot; } </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-mi-cho-coq.0.1 coq.8.10.0</code></dd> <dt>Return code</dt> <dd>0</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>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam list; echo; ulimit -Sv 4000000; timeout 4h opam install -y --deps-only coq-mi-cho-coq.0.1 coq.8.10.0</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>3 m 41 s</dd> </dl> <h2>Install 🚀</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam list; echo; ulimit -Sv 16000000; timeout 4h opam install -y -v coq-mi-cho-coq.0.1 coq.8.10.0</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>4 m 4 s</dd> </dl> <h2>Installation size</h2> <p>Total: 22 M</p> <ul> <li>9 M <code>../ocaml-base-compiler.4.08.1/bin/michocoq</code></li> <li>4 M <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/micheline2michelson.vo</code></li> <li>2 M <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/micheline_parser.vo</code></li> <li>1 M <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/micheline_lexer.vo</code></li> <li>963 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/untyper.vo</code></li> <li>843 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/main.vo</code></li> <li>759 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/typer.vo</code></li> <li>563 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/syntax_type.vo</code></li> <li>533 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/semantics.vo</code></li> <li>313 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocott/michelson.glob</code></li> <li>226 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/semantics.glob</code></li> <li>214 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/micheline2michelson.glob</code></li> <li>210 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocott/michelson_tests.vo</code></li> <li>188 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/syntax.vo</code></li> <li>182 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/micheline_parser.glob</code></li> <li>180 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocott/michelson.vo</code></li> <li>152 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocott/michelson_extract.vo</code></li> <li>128 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/map.vo</code></li> <li>123 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/syntax.glob</code></li> <li>122 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/typer.glob</code></li> <li>113 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/macros.vo</code></li> <li>96 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/untyper.glob</code></li> <li>89 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/set.vo</code></li> <li>89 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocott/michelson_aexp.vo</code></li> <li>75 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/comparable.vo</code></li> <li>63 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/michelson2micheline.vo</code></li> <li>60 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/map.glob</code></li> <li>59 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocott/michelson.v</code></li> <li>55 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/micheline_pp.vo</code></li> <li>49 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/error_pp.vo</code></li> <li>47 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/untyped_syntax.vo</code></li> <li>46 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/error.vo</code></li> <li>45 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/micheline_lexer.glob</code></li> <li>45 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/util.vo</code></li> <li>45 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/micheline_tokens.vo</code></li> <li>45 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/micheline_parser.v</code></li> <li>44 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/semantics.v</code></li> <li>39 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/michelson2micheline.glob</code></li> <li>39 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/macros.glob</code></li> <li>38 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/comparable.glob</code></li> <li>35 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/tez.vo</code></li> <li>33 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/int64bv.vo</code></li> <li>32 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/syntax.v</code></li> <li>31 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/micheline2michelson.v</code></li> <li>30 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/set.glob</code></li> <li>29 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/typer.v</code></li> <li>29 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/untyper.v</code></li> <li>28 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/dummy_contract_context.vo</code></li> <li>27 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/micheline_syntax.vo</code></li> <li>25 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/location.vo</code></li> <li>22 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/map.v</code></li> <li>19 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/util.glob</code></li> <li>16 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/error.glob</code></li> <li>14 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/set.v</code></li> <li>14 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/comparable.v</code></li> <li>13 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/micheline_pp.glob</code></li> <li>13 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/untyped_syntax.glob</code></li> <li>13 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocott/michelson_tests.glob</code></li> <li>12 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/micheline_lexer.v</code></li> <li>9 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/michelson2micheline.v</code></li> <li>8 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/macros.v</code></li> <li>8 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/syntax_type.glob</code></li> <li>6 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/main.glob</code></li> <li>6 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/tez.glob</code></li> <li>6 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/micheline_tokens.glob</code></li> <li>6 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/error.v</code></li> <li>5 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/util.v</code></li> <li>5 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocott/michelson_aexp.glob</code></li> <li>4 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocott/michelson_tests.v</code></li> <li>4 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/int64bv.glob</code></li> <li>3 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocott/michelson_extract.glob</code></li> <li>3 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/untyped_syntax.v</code></li> <li>3 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/tez.v</code></li> <li>3 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/micheline_pp.v</code></li> <li>2 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocott/michelson_extract.v</code></li> <li>2 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/error_pp.glob</code></li> <li>2 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/location.glob</code></li> <li>2 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/int64bv.v</code></li> <li>2 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/main.v</code></li> <li>2 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/micheline_tokens.v</code></li> <li>2 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/syntax_type.v</code></li> <li>2 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocott/michelson_aexp.v</code></li> <li>2 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/micheline_syntax.glob</code></li> <li>1 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/error_pp.v</code></li> <li>1 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/location.v</code></li> <li>1 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/dummy_contract_context.glob</code></li> <li>1 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/micheline_syntax.v</code></li> <li>1 K <code>../ocaml-base-compiler.4.08.1/lib/coq/user-contrib/Michocoq/dummy_contract_context.v</code></li> </ul> <h2>Uninstall 🧹</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq-mi-cho-coq.0.1</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"> Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣 </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.08.1-2.0.5/released/8.10.0/mi-cho-coq/0.1.html
HTML
mit
17,461
<?php declare(strict_types=1); namespace Doctrine\DBAL\Portability; use Doctrine\DBAL\Driver\ResultStatement; use Doctrine\DBAL\Driver\Statement as DriverStatement; use Doctrine\DBAL\Driver\StatementIterator; use Doctrine\DBAL\FetchMode; use Doctrine\DBAL\ParameterType; use IteratorAggregate; use function array_change_key_case; use function assert; use function is_string; use function rtrim; /** * Portability wrapper for a Statement. */ class Statement implements IteratorAggregate, DriverStatement { /** @var int */ private $portability; /** @var DriverStatement|ResultStatement */ private $stmt; /** @var int */ private $case; /** @var int */ private $defaultFetchMode = FetchMode::MIXED; /** * Wraps <tt>Statement</tt> and applies portability measures. * * @param DriverStatement|ResultStatement $stmt */ public function __construct($stmt, Connection $conn) { $this->stmt = $stmt; $this->portability = $conn->getPortability(); $this->case = $conn->getFetchCase(); } /** * {@inheritdoc} */ public function bindParam($param, &$variable, int $type = ParameterType::STRING, ?int $length = null) : void { assert($this->stmt instanceof DriverStatement); $this->stmt->bindParam($param, $variable, $type, $length); } /** * {@inheritdoc} */ public function bindValue($param, $value, int $type = ParameterType::STRING) : void { assert($this->stmt instanceof DriverStatement); $this->stmt->bindValue($param, $value, $type); } /** * {@inheritdoc} */ public function closeCursor() : void { $this->stmt->closeCursor(); } /** * {@inheritdoc} */ public function columnCount() : int { return $this->stmt->columnCount(); } /** * {@inheritdoc} */ public function execute(?array $params = null) : void { assert($this->stmt instanceof DriverStatement); $this->stmt->execute($params); } /** * {@inheritdoc} */ public function setFetchMode(int $fetchMode, ...$args) : void { $this->defaultFetchMode = $fetchMode; $this->stmt->setFetchMode($fetchMode, ...$args); } /** * {@inheritdoc} */ public function getIterator() { return new StatementIterator($this); } /** * {@inheritdoc} */ public function fetch(?int $fetchMode = null, ...$args) { $fetchMode = $fetchMode ?: $this->defaultFetchMode; $row = $this->stmt->fetch($fetchMode, ...$args); $iterateRow = ($this->portability & (Connection::PORTABILITY_EMPTY_TO_NULL|Connection::PORTABILITY_RTRIM)) !== 0; $fixCase = $this->case !== null && ($fetchMode === FetchMode::ASSOCIATIVE || $fetchMode === FetchMode::MIXED) && ($this->portability & Connection::PORTABILITY_FIX_CASE); $row = $this->fixRow($row, $iterateRow, $fixCase); return $row; } /** * {@inheritdoc} */ public function fetchAll(?int $fetchMode = null, ...$args) : array { $fetchMode = $fetchMode ?: $this->defaultFetchMode; $rows = $this->stmt->fetchAll($fetchMode, ...$args); $iterateRow = ($this->portability & (Connection::PORTABILITY_EMPTY_TO_NULL|Connection::PORTABILITY_RTRIM)) !== 0; $fixCase = $this->case !== null && ($fetchMode === FetchMode::ASSOCIATIVE || $fetchMode === FetchMode::MIXED) && ($this->portability & Connection::PORTABILITY_FIX_CASE); if (! $iterateRow && ! $fixCase) { return $rows; } if ($fetchMode === FetchMode::COLUMN) { foreach ($rows as $num => $row) { $rows[$num] = [$row]; } } foreach ($rows as $num => $row) { $rows[$num] = $this->fixRow($row, $iterateRow, $fixCase); } if ($fetchMode === FetchMode::COLUMN) { foreach ($rows as $num => $row) { $rows[$num] = $row[0]; } } return $rows; } /** * @param mixed $row * * @return mixed */ protected function fixRow($row, bool $iterateRow, bool $fixCase) { if (! $row) { return $row; } if ($fixCase) { $row = array_change_key_case($row, $this->case); } if ($iterateRow) { foreach ($row as $k => $v) { if (($this->portability & Connection::PORTABILITY_EMPTY_TO_NULL) && $v === '') { $row[$k] = null; } elseif (($this->portability & Connection::PORTABILITY_RTRIM) && is_string($v)) { $row[$k] = rtrim($v); } } } return $row; } /** * {@inheritdoc} */ public function fetchColumn(int $columnIndex = 0) { $value = $this->stmt->fetchColumn($columnIndex); if ($this->portability & (Connection::PORTABILITY_EMPTY_TO_NULL|Connection::PORTABILITY_RTRIM)) { if (($this->portability & Connection::PORTABILITY_EMPTY_TO_NULL) && $value === '') { $value = null; } elseif (($this->portability & Connection::PORTABILITY_RTRIM) && is_string($value)) { $value = rtrim($value); } } return $value; } /** * {@inheritdoc} */ public function rowCount() : int { assert($this->stmt instanceof DriverStatement); return $this->stmt->rowCount(); } }
drieschel/dbal
lib/Doctrine/DBAL/Portability/Statement.php
PHP
mit
5,670
{ "posts": [ { "url": "/chat/gossiping/2018/01/02/GossipingM.1514877841.A.13C.html", "title": "黃國昌 請問高雄銀行:慶富的呆帳誰買單?", "image": "https://scontent.ftpe8-2.fna.fbcdn.net/v/t1.0-1/p200x200/18446706_2040396506187525_8125506725031872370_n.jpg?oh=0accc7a3eb20e227bdf87d437c2ed4c2&oe=5AF044FF", "push": "57", "boo": "2", "date": "2018-01-02 15:23:58 +0800", "boardName": "八卦", "boardLink": "/category/gossiping" } , { "url": "/life/japan_travel/2018/01/02/Japan_TravelM.1514855375.A.653.html", "title": "20180102匯率", "image": "https://i0.wp.com/moneydj-blog.s3.amazonaws.com/wp-content/uploads/sites/3/2016/01/10085306/20160110-china-rmb.jpg?fit=580%2C330", "push": "46", "boo": "0", "date": "2018-01-02 09:09:32 +0800", "boardName": "日本旅遊", "boardLink": "/category/japan-travel" } ] }
sunnyKiwi/JustCopy
tag/銀行/json/index.html
HTML
mit
1,152
const test = require('tape') const spacetime = require('spacetime') const nlp = require('./_lib') test('day-start edge-cases', function (t) { let doc = nlp('in june') let date = doc.dates({ dayStart: '8:00am', dayEnd: '6:00pm', timezone: 'Asia/Shanghai' }).get(0) t.equal(date.start, '2021-06-01T08:00:00.000+08:00', 'start') t.equal(date.end, '2021-06-30T18:00:00.000+08:00', 'end') t.end() }) let arr = [ 'next tuesday', 'june 5th', 'in 2020', 'in august', 'tomorrow', 'q2 1999', 'between june and july', 'between tuesday and wednesday', 'june 2nd to 5th 2020', 'the 5th of august', 'the 5th to 7th of august', ] test('day start', function (t) { const startTime = '5:30am' arr.forEach((str) => { let doc = nlp(str) let date = doc.dates({ dayStart: startTime }).get(0) let have = spacetime(date.start).time() t.equal(have, startTime, '[start] ' + str) }) t.end() }) test('day end', function (t) { const endTime = '8:30pm' arr.forEach((str) => { let doc = nlp(str) let date = doc.dates({ dayEnd: endTime }).get(0) let have = spacetime(date.end).time() t.equal(have, endTime, '[end] ' + str) }) t.end() })
nlp-compromise/nlp_compromise
plugins/dates/tests/day-start.test.js
JavaScript
mit
1,189
// // GridOverlayView.m // TLGLDrawDemo // // Created by Ruben Nine on 21/06/14. // Copyright (c) 2014 Ruben Nine. All rights reserved. // #import "GridOverlayView.h" @implementation GridOverlayView - (void)drawRect:(NSRect)dirtyRect { [super drawRect:dirtyRect]; // Drawing code here. NSRect rect = self.bounds; rect.size.width /= 2.0; rect.size.height /= 2.0; rect.origin.x = rect.size.width * 0.5; rect.origin.y = rect.size.height * 0.5; [[[NSColor redColor] colorWithAlphaComponent:0.5] setStroke]; NSBezierPath *linePath = [NSBezierPath bezierPath]; [linePath moveToPoint:NSMakePoint(NSMidX(self.bounds), NSMinY(self.bounds))]; [linePath lineToPoint:NSMakePoint(NSMidX(self.bounds), NSMaxY(self.bounds))]; [linePath moveToPoint:NSMakePoint(NSMinX(self.bounds), NSMidY(self.bounds))]; [linePath lineToPoint:NSMakePoint(NSMaxX(self.bounds), NSMidY(self.bounds))]; [linePath setLineWidth:1]; [linePath stroke]; NSBezierPath *linePath2 = [NSBezierPath bezierPath]; [linePath2 moveToPoint:NSMakePoint(NSMidX(self.bounds) * 0.5, NSMinY(self.bounds))]; [linePath2 lineToPoint:NSMakePoint(NSMidX(self.bounds) * 0.5, NSMaxY(self.bounds))]; [linePath2 setLineWidth:1]; [linePath2 stroke]; NSBezierPath *linePath3 = [NSBezierPath bezierPath]; [linePath3 moveToPoint:NSMakePoint(NSMidX(self.bounds) * 1.5, NSMinY(self.bounds))]; [linePath3 lineToPoint:NSMakePoint(NSMidX(self.bounds) * 1.5, NSMaxY(self.bounds))]; [linePath3 setLineWidth:1]; [linePath3 stroke]; } @end
rnine/TLGLDraw
TLGLDrawDemo/GridOverlayView.m
Matlab
mit
1,897
/* * Copyright 2017 David Martínez Rodríguez * * 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. */ package es.davidmr.apps.teca.utils; import android.util.Log; import es.davidmr.teca.BuildConfig; /** * Created by necavit on 8/09/17. */ public class Logger { private static final String DEFAULT_TAG = "Logger.DEFAULT_TAG"; private static Logger instance = null; private enum AppState { DEVELOPMENT, PRODUCTION } private static AppState state = AppState.DEVELOPMENT; private Logger() { if (!BuildConfig.DEBUG) { state = AppState.PRODUCTION; } } public static Logger getInstance() { if (instance == null) { instance = new Logger(); } return instance; } /** * Provide a default tag for the log if the provided tag is empty or null * @param tag the provided tag * @return */ private String getTagIfEmpty(String tag) { if (tag == null || tag.isEmpty()) { tag = DEFAULT_TAG; } return tag; } public void debug(String tag, String message) { tag = getTagIfEmpty(tag); if (state == AppState.DEVELOPMENT) { Log.d(tag, message); } } public void info(String tag, String message) { tag = getTagIfEmpty(tag); if (state == AppState.DEVELOPMENT) { Log.i(tag, message); } } public void warn(String tag, String message) { tag = getTagIfEmpty(tag); Log.w(tag, message); } public void error(String tag, String message) { tag = getTagIfEmpty(tag); Log.e(tag, message); } }
necavit/yummpy-android
app/src/main/java/es/davidmr/apps/teca/utils/Logger.java
Java
mit
2,700
module.exports = Boostrap; function Boostrap(commandMap) { var baseDir = '../commands/server/'; // Configuration commandMap.mapEvent('STARTUP_COMPLETE', require(baseDir + 'LoadConfiguration')); commandMap.mapEvent('LOAD_CONFIGURATION_COMPLETE', require(baseDir + 'SetupExceptionMailer')); // Database commandMap.mapEvent('LOAD_CONFIGURATION_COMPLETE', require(baseDir + 'ConnectDatabase')); commandMap.mapEvent('CONNECT_DATABASE_COMPLETE', require(baseDir + 'PrepareModels')); commandMap.mapEvent('PREPARE_MODELS_COMPLETE', require(baseDir + 'PopulateModels')); // Express commandMap.mapEvent('POPULATE_MODELS_COMPLETE', require(baseDir + 'CreateExpressApplication')); commandMap.mapEvent('CREATE_EXPRESS_APPLICATION_COMPLETE', require(baseDir + 'SetupExpressEnvironment')); commandMap.mapEvent('SETUP_EXPRESS_ENVIRONMENT_COMPLETE', require(baseDir + 'ConfigureExpressRoutes')); commandMap.mapEvent('CONFIGURE_EXPRESS_ROUTES_COMPLETE', require(baseDir + 'CreateExpressHttpServer')); // Socket commandMap.mapEvent('CREATE_EXPRESS_HTTP_SERVER_COMPLETE', require(baseDir + 'SetupSocketServer')); commandMap.mapEvent('SOCKET_CONNECTION_COMPLETE', require(baseDir + 'SetupClientBootstrap')); }
dougkulak/nodelegs-prototype
app/bootstraps/ServerBootstrap.js
JavaScript
mit
1,255
package com.dd.sample; import android.app.ListActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.ArrayAdapter; import android.widget.ListView; public class MainActivity extends ListActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); String[] items = getResources().getStringArray(R.array.sample_list); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, items); setListAdapter(adapter); } @Override protected void onListItemClick(ListView l, View v, int position, long id) { switch (position) { case 0: startSignInActivity(false); break; case 1: startSignInActivity(true); break; case 2: startMessageActivity(); break; case 3: startUploadActivity(); break; } } private void startUploadActivity() { Intent intent = new Intent(this, UploadActivity.class); startActivity(intent); } private void startSignInActivity(boolean isEndlessMode) { Intent intent = new Intent(this, SignInActivity.class); intent.putExtra(SignInActivity.EXTRAS_ENDLESS_MODE, isEndlessMode); startActivity(intent); } private void startMessageActivity() { Intent intent = new Intent(this, MessageActivity.class); startActivity(intent); } }
0359xiaodong/android-process-buton
sample/src/main/java/com/dd/sample/MainActivity.java
Java
mit
1,630
define(["VSS/Controls/Notifications","VSS/Controls","VSS/Service","TFS/WorkItemTracking/RestClient","TFS/Core/RestClient","VSS/Controls/Menus","VSS/Controls/TreeView","VSS/Controls/Dialogs"],function(e,t,r,n,o,a,i,s){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r=window.webpackJsonp;window.webpackJsonp=function(t,n,a){for(var i,s,c=0,u=[];c<t.length;c++)s=t[c],o[s]&&u.push(o[s][0]),o[s]=0;for(i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);for(r&&r(t,n,a);u.length;)u.shift()()};var n={},o={1:0,6:0,7:0,8:0,10:0,11:0};return t.e=function(e){function r(){s.onerror=s.onload=null,clearTimeout(c);var t=o[e];0!==t&&(t&&t[1](new Error("Loading chunk "+e+" failed.")),o[e]=void 0)}var n=o[e];if(0===n)return new Promise(function(e){e()});if(n)return n[2];var a=new Promise(function(t,r){n=o[e]=[t,r]});n[2]=a;var i=document.getElementsByTagName("head")[0],s=document.createElement("script");s.type="text/javascript",s.charset="utf-8",s.async=!0,s.timeout=12e4,t.nc&&s.setAttribute("nonce",t.nc),s.src=t.p+""+e+".js";var c=setTimeout(r,12e4);return s.onerror=s.onload=r,i.appendChild(s),a},t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t.oe=function(e){throw console.error(e),e},t(t.s=20)}([function(t,r){t.exports=e},function(e,t,r){var n,o;n=[r,t,r(2),r(0),r(5),r(3)],void 0!==(o=function(e,t,r,n,o,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(){}return e.prototype.displayMessage=function(e,t){$("#message").html("");var o=r.create(n.MessageAreaControl,$("#message"),null);o.setMessage(e,t),this.messenger=o},e.prototype.closeMessage=function(){this.messenger.hideElement()},e}();t.MessageService=i;var s=function(){function e(){}return e.prototype.getWorkItems=function(e,t){var r=new Array,n=a.getCollectionClient(o.WorkItemTrackingHttpClient),i={query:e};return n.queryByWiql(i).then(function(e){if(!e.workItems)throw new Error("The query supplied does not produce any work item results.");return e.workItems.forEach(function(e){r.push(e.id)}),n.getWorkItems(r,t)})},e.prototype.getWorkItemHierarchy=function(e,t,r){var n=new Array,i=new Array,s=a.getCollectionClient(o.WorkItemTrackingHttpClient),c={query:e};return s.queryByWiql(c).then(function(e){if(!e.workItemRelations)throw new Error("The query supplied does not produce any work item relations.");return e.workItemRelations.forEach(function(e){var t={data:{id:e.target.id,name:"",parent:e.source?e.source.id:r,link:e.target.url}};n.push(t),i.push(e.target.id)}),s.getWorkItems(i,t).then(function(e){return e.forEach(function(e,t){n.forEach(function(t,r){if(t.data.id===e.id)return t.data.name=e.fields["System.Title"],void(t.data.workItemType=e.fields["System.WorkItemType"])})}),n})})},e.prototype.getWorkItemTypes=function(){return a.getCollectionClient(o.WorkItemTrackingHttpClient).getWorkItemTypes(VSS.getWebContext().project.name)},e}();t.QueryService=s}.apply(t,n))&&(e.exports=o)},function(e,r){e.exports=t},function(e,t){e.exports=r},function(e,t,r){var n,o;n=[r,t,r(1),r(0),r(7),r(3)],void 0!==(o=function(e,t,n,o,a,i){"use strict";function s(e){try{e()}catch(e){l.displayMessage(e,o.MessageAreaType.Error)}}function c(e){return i.getCollectionClient(a.CoreHttpClient).getProject(e,!0)}function u(e,t){var n={},o=new Array,a=JSON.parse(e);o[0]=["RequirementId","Title","Description","MappedItems"],a.forEach(function(e,t){o[t+1]=[e.RequirementId,e.Title,e.Description,e.MappedItems]});var i={s:{c:1e7,r:1e7},e:{c:0,r:0}};r.e(0).then(function(){var e=[r(12)];(function(e){for(var r=0;r!==o.length;++r)for(var a=0;a!==o[r].toString().length;++a){i.s.r>r&&(i.s.r=r),i.s.c>a&&(i.s.c=a),i.e.r<r&&(i.e.r=r),i.e.c<a&&(i.e.c=a);var s={v:o[r][a],t:"s"};if(null!=s.v){var c=XLSX.utils.encode_cell({c:a,r:r});"number"==typeof s.v?s.t="n":"boolean"==typeof s.v?s.t="b":s.v instanceof Date?(s.t="n",s.z=XLSX.SSF._table[14],s.v=p(s.v)):s.t="s",n[c]=s}}i.s.c<1e7&&(n["!ref"]=XLSX.utils.encode_range(i));var u={SheetNames:[],Sheets:{}};u.SheetNames.push("Requirements"),u.Sheets.Requirements=n;var l=XLSX.write(u,t);return e(new Blob([function(e){for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),n=0;n!==e.length;++n)r[n]=255&e.charCodeAt(n);return t}(l)],{type:"application/octet-stream"}),VSS.getWebContext().project.name+".xlsx")}).apply(null,e)}).catch(r.oe)}Object.defineProperty(t,"__esModule",{value:!0});var p,l=new n.MessageService;t.executeBoundary=s,t.getProcessTemplate=c,t.exportToExcel=u}.apply(t,n))&&(e.exports=o)},function(e,t){e.exports=n},function(e,t,r){var n,o;n=[r,t,r(1),r(4),r(0)],void 0!==(o=function(e,t,r,n,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(){this.messenger=new r.MessageService}return e.prototype.getCollection=function(e,t){var r=localStorage.getItem(e);return r.length<1&&this.messenger.displayMessage("Item '"+e+"' could not be located or has no value.",o.MessageAreaType.Warning),t?(t(r),null):r},e.prototype.setCollection=function(e,t){localStorage.setItem(e,t),this.messenger.displayMessage("Item '${id}' added/updated.",o.MessageAreaType.Info)},e.prototype.clear=function(){localStorage.clear(),this.messenger.displayMessage("Local storage has been cleared.",o.MessageAreaType.Info)},e.prototype.remove=function(e){localStorage.removeItem(e),this.messenger.displayMessage("Item '${id}' removed.",o.MessageAreaType.Info)},e}();t.LocalStorageAdapter=a;var i=function(){function e(e){this.scope=e||"ProjectCollection",this.messenger=new r.MessageService,this.dataService=VSS.getService(VSS.ServiceIds.ExtensionData)}return e.prototype.getCollection=function(e,t){var r=this;if(void 0===t)throw new Error("This method requires a callback function.");r.dataService.then(function(n){n.getDocument("RequirementsManagement",e).then(function(e){t(e.json)},function(e){r.messenger.displayMessage("It appears you do not have any requirements. Please use the Import button to add requirements.",o.MessageAreaType.Info)})})},e.prototype.setCollection=function(e,t){var r=this,n={id:e,json:t};r.dataService.then(function(e){e.setDocument("RequirementsManagement",n).then(function(e){return e},function(e){r.messenger.displayMessage(e.message,o.MessageAreaType.Error)})})},e.prototype.clear=function(){var e=this;e.dataService.then(function(t){t.getDocuments("RequirementsManagement").then(function(r){r.forEach(function(e,r,n){t.deleteDocument("RequirementsManagement",e.id).then(function(e){})}),e.messenger.displayMessage("All documents successfully removed.",o.MessageAreaType.Info)})})},e.prototype.remove=function(e){var t=this;t.dataService.then(function(r){r.deleteDocument("RequirementsManagement",e).then(function(){},function(e){var r=JSON.parse(e.responseText);t.messenger.displayMessage(r.message,o.MessageAreaType.Error)})})},e}();t.VsoDocumentServiceAdapter=i;var s=function(){function e(e){this.scope=e,this.messenger=new r.MessageService,this.dataService=VSS.getService(VSS.ServiceIds.ExtensionData)}return e.prototype.getCollection=function(e,t){var r=this;if(void 0===t)throw new Error("This method requires a callback function.");n.executeBoundary(function(){r.dataService.then(function(r){r.getValue(e).then(function(e){t(e)})})})},e.prototype.setCollection=function(e,t){var r=this;n.executeBoundary(function(){r.dataService.then(function(r){r.setValue(e,t).then(function(e){return!0})})})},e.prototype.clear=function(){n.executeBoundary(function(){throw Error("Method not implemented.")})},e.prototype.remove=function(e){var t=this;n.executeBoundary(function(){t.setCollection(e,null)})},e}();t.VsoSettingsServiceAdapter=s}.apply(t,n))&&(e.exports=o)},function(e,t){e.exports=o},function(e,t,r){var n,o;n=[r,t,r(4),r(1),r(0),r(2),r(10),r(9)],void 0!==(o=function(e,t,r,n,o,a,i,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var c=function(){function e(e){this.list=JSON.parse(e)}return e.prototype.add=function(e){this.list.push(e)},e.prototype.remove=function(e){this.list.splice(this.list.indexOf(e),1)},e.prototype.update=function(e){this.list.forEach(function(t,r){if(t.RequirementId===e.RequirementId)return t.Description=e.Description,t.Title=e.Title,void(t.MappedItems=e.MappedItems)})},e.prototype.toString=function(){return JSON.stringify(this.list)},e.prototype.getItem=function(e){var t;return this.list.forEach(function(r,n){if(r.RequirementId===e)return void(t=r)}),t},e}();t.RequirementCollection=c;var u=function(){function e(){this.projectId=VSS.getWebContext().project.id,this.messenger=new n.MessageService;var e=this;e.nodes=new Array;var t=new i.TreeNode("Requirements");t.link="index.html";var c=new i.TreeNode("Iteration Path View");c.link="sprintView.html";var u=new i.TreeNode("Gap Analysis");u.link="gapAnalysis.html",e.nodes.push(t),e.nodes.push(c),e.nodes.push(u),e.tree=a.create(i.TreeView,$("#treeMenu"),{nodes:e.nodes});a.create(s.MenuBar,$("#navToolbar"),{items:[{id:"getTemplate",text:"Get Latest Template",icon:"icon-download-package",title:"Downloads the template for importing requirements via Excel"}],executeAction:function(e){switch(e.get_commandName()){case"getTemplate":window.open(VSS.getExtensionContext().baseUri+"/data/SampleRequirements.xlsx")}}});r.getProcessTemplate(e.projectId).then(function(t){e.processTemplate=t.capabilities.processTemplate.templateName},function(t){e.messenger.displayMessage(t.message,o.MessageAreaType.Error)})}return e.prototype.setActiveNode=function(e){var t=this;t.nodes.forEach(function(r,n){if(r.text===e)return void t.tree.setSelectedNode(r)})},e.prototype.validateTemplate=function(e){var t=this;setTimeout(function(){null!=t.processTemplate.match("CMMI")?($("#reqtMenu").hide(),$("#content").show().append("<span>The CMMI process template allows you to manage requirements natively. Import, export and reporting functionality has been disabled at this time.</span>"),t.messenger.displayMessage("Warning: CMMI process template detected.",o.MessageAreaType.Warning)):e()},500)},e}();t.ViewModelBase=u}.apply(t,n))&&(e.exports=o)},function(e,t){e.exports=a},function(e,t){e.exports=i},function(e,t,r){var n,o;n=[r,t,r(1),r(6),r(0),r(8)],void 0!==(o=function(e,t,r,n,o,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e){this.store=null==e?new n.LocalStorageAdapter:e,this.msg=new r.MessageService,this.projectId=VSS.getWebContext().project.id}return e.prototype.process=function(e,t){var r,n=this,i=e.files;r=i[0];var s=new FileReader;r.name;s.onload=function(e){var r=e.target.result;try{var i=XLSX.read(r,{type:"binary"});i.SheetNames.forEach(function(e){var r=i.Sheets[e],o=XLSX.utils.sheet_to_json(r),s=new a.RequirementCollection(JSON.stringify(o));n.store.setCollection(n.projectId+"-requirements",s.toString()),t&&t()})}catch(e){n.msg.displayMessage(e.message,o.MessageAreaType.Error)}},s.readAsBinaryString(r)},e}();t.FlatFileAdapter=i;var s=function(){function e(){}return e.prototype.process=function(e){},e}();t.RepositoryAdapter=s}.apply(t,n))&&(e.exports=o)},,function(e,t){e.exports=s},,,,,,,function(e,t,r){var n,o,a=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();n=[r,t,r(6),r(1),r(0),r(13),r(11)],void 0!==(o=function(e,t,r,n,o,i,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var c=[],u=[],p=function(e){function t(t,o){var a=e.call(this)||this,i=a;return i.cytoscape=o,i.context=t,i.messenger=new n.MessageService,i.adapter=new s.FlatFileAdapter(new r.VsoDocumentServiceAdapter("ProjectCollection")),a}return a(t,e),t.prototype.start=function(e){var t=this;if(null===e.MappedItems||""===e.MappedItems)return t.messenger.displayMessage("There are no work items mapped to this requirement.",o.MessageAreaType.Error),!1;t.mappedItems=e.MappedItems.split(","),(new n.QueryService).getWorkItemHierarchy("select [System.Id], [System.WorkItemType], [System.Title], [System.State], [System.AreaPath], [System.IterationPath], [System.Tags] from WorkItemLinks where (Source.[System.TeamProject] = '"+VSS.getWebContext().project.name+"' and (Source.[System.Id] in ("+e.MappedItems+") or Source.[System.WorkItemType] = 'Feature' or Source.[System.WorkItemType] = 'Epic')) and ([System.Links.LinkType] = 'System.LinkTypes.Hierarchy-Forward') and (Target.[System.TeamProject] = '"+VSS.getWebContext().project.name+"' and Target.[System.WorkItemType] <> '') order by [System.ChangedDate] desc mode (Recursive)",["System.WorkItemType","System.Title","System.State","System.WorkItemType"],e.RequirementId).then(function(r){var n=[],o={data:{id:e.RequirementId,name:e.Title,bkcolor:"darkgreen"}};n.push(o),r.forEach(function(e,t){switch(e.data.workItemType){case"Product Backlog Item":e.data.bkcolor="lightblue";break;case"Feature":e.data.bkcolor="purple";break;case"Task":e.data.bkcolor="goldenrod";break;default:e.data.bkcolor="lightgray"}n.push(e)}),t.createHierarchy(n),t.visualize()})},t.prototype.visualize=function(){var e=this;e.cytoscape({container:$("#cy")[0],style:e.cytoscape.stylesheet().selector("node").css({shape:"rectangle",width:"200px",height:"75px",content:"data(name)","text-valign":"center",color:"white","text-outline-color":"white","background-color":"data(bkcolor)","border-color":"data(bordercolor)","border-width":"data(borderwidth)","text-wrap":"wrap","text-max-width":"185px","border-radius":"6px","line-color":"black"}).selector(":selected").css({"line-color":"blue","target-arrow-color":"black","source-arrow-color":"black","text-outline-color":"black","border-width":"2px"}),elements:{nodes:c,edges:u},layout:{name:"dagre",padding:10}}).on("tap","node",function(){try{window.open(this.data("link"))}catch(e){window.location.href=this.data("link")}})},t.prototype.createHierarchy=function(e){var t=this,r=e.reduce(function(e,t){return e[t.data.id]=t,e},{}),n=VSS.getWebContext().collection.uri+"/"+VSS.getWebContext().project.name;e.forEach(function(e){var o={data:{id:e.data.id,name:e.data.name,description:e.data.Description,link:n+"/_workitems#_a=edit&id="+e.data.id+"&fullScreen=true",bkcolor:e.data.bkcolor,bordercolor:t.mappedItems.indexOf(e.data.id.toString())<0?"black":"darkgreen",borderwidth:t.mappedItems.indexOf(e.data.id.toString())<0?"1px":"8px"}};c.push(o);var a=r[e.data.parent];if(a){var i={data:{source:a.data.id,target:e.data.id}};u.push(i)}})},t}(i.ModalDialog);t.VisualizerDialog=p}.apply(t,n))&&(e.exports=o)}])});
jgarverick/RequirementsIntegrator
dist/visualizer.js
JavaScript
mit
14,915
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>W28539_text</title> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body> <div style="margin-left: auto; margin-right: auto; width: 800px; overflow: hidden;"> <div style="float: left;"> <a href="page46.html">&laquo;</a> </div> <div style="float: right;"> </div> </div> <hr/> <div style="position: absolute; margin-left: 164px; margin-top: 109px;"> <p class="styleSans725.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">HORIZONTAL SECTION PLAT <br/>Kodiak Oil & Gas Corp. 1625 Broadway, Surte 250 Denver, Colorado 80202 <br/>P Dam State 155—99—4—16—21—13H3 <br/>860 feet from the north line and 1285 feet from the west line (surface location) Section.16, T. 155 N., R. 99 W., 5th P.M. . 250 feet from the south line and 550 feet from the west line (bottom location) Section 21, T. 155 N., R. 99 W., 5th P.M. Surface owner @ well Site - State of North Dakota Williams County North Dakota (Nad 83 Datum) Latitude 48°15'12.129" North; Lon itude 103°25'35.708" West (surface location) (Med 83 Datum) Latitude 48.253369"J North; Longitude 1 3.426586° West (decimal degrees surface location) (Nad 83 Datum) Latitude 48°13‘38.944" North; Lon itude 103°25'46.714" West (bottom location) (Nad 83 Datum) Latitude 48.227484“ North; Longitude 1 3.429643“ West (desimal degrees bottom location) (Med 27 Datum) Latitude 48°15'12.048" North; Lon itude 103°25‘34.025" West (surface location) (Nad 27 Datum) Latitude 48.253347° North; Longitude 1 3.426118D West (decimal degrees surface location) (Nad 27 Datum) Latitude 48°13'38.862" North; Lon itude 103°25'45.029“ West (bottom location) (Nad 27 Datum) Latitude 48227462" North; Longitude 1 3.429175° West (dec1mal degrees bottom location) [Derived from OPUS Solution MAD-83(COR896H <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/>Ire: Hagar Iron Rebat 8: LS La,=,8.,‘:“5".20_598. 089°55'23" 089°55'23" 089 050'19" 089°50'19" L lzgsvfsczrgugge . — _ ~ - — '— — — — _ . a = ° ‘ . “ Lung: 1323:3458!) 1319,34' Sang: “"5 1319.34' Origin Stone 1318.01' 1318.01 Long=103°24'36.748" - (NAD 33! 9° 1‘ Lat=48fiflr130630' = m '\. Long=103 5'15.697' = :0 1° [K 00 m A 83) 5 N j a) N 3V1“. 0 m E . E0 2 " NI". 0° °’ 8 '" 9 g 9: co co m Surface Location 8 06 8 5 9 8'2 0 860' FNL & E, a 0 O 1285' FWL 8 ‘— 089°51'32" ,, 089°54'04" 089°54'04" meune M 089°51'32" 1318.82' ' 1318.82' ' 1318;45' 1318.45' g so _ l a _ f— _ z» FIB ' mm 0 (D E“ N 5'10" EV “E 5*)" in ., N. m '\. N F. oolcn I 900 c,0 .5 co co 00 9'0) '— - \— i F r- O \— 8 2 is 852 8 — e 8 e 0 <2 0 2 O O O 0 Original Stone 'V‘ 089°52'44" Original Stone 8. LS Found 089°52'44" 0" 1M Line 089°52'44" 089°52'44" 1241 YPC Found <br/>Latz48”14'54.564" Long =103”25‘54.714" lNAD B3) <br/> <br/> <br/> <br/>Lat :48°14'54.662' Long=103°24'36.793' (NAD 83) <br/>1318.31' 1318.31' 1318.88' 1318.88' <br/> <br/> <br/> <br/> <br/> <br/> <br/>: =03 : : : <br/>co. m - o. i\. m. v-m 'pro Get (‘00) r-v enlv *5“) in“. 50“. elm. 00$ °°5°°° on Or\ Oco Olr "-:°og 0— cot— colt— 00‘) "O 00) m m 8" 1 0" 8" 8" 8“ <br/> <br/> <br/>089°50'31" I <br/>1116 Line <br/> <br/> <br/> <br/> <br/> <br/>089°50‘31" 089°51'18" 089°51'18" <br/> <br/> <br/>Section Line <br/> <br/>1317.98' ' 1317.98' 1319.41' 1319.41' 20 - 1 a»- a _ a _ a, _ 7| 10 l .00 53 st S” CD Tl st to <1. st '9 LO "_ m P, N ‘0, o m l 000 o r\ O l\ O to o Ir a; 2, r a F slr O 00 (V) m o :3 l o \— o .— o .- o t— O O O O 0 Original Stone Found ‘ L t=48°14'28.525" . . l n 0' V 315‘ Loig=103,25.54,,541 089°48'1 081°4§J 7' 08g149§3 ' Section Line 01304353 “firms” (“AD 83’ 1317.66" 1317.66' Wm, 5m 1 319.95' 1319.95' tiiéiigagfifig} & Bolt Found (NAD 83) ' Lat=48°14'28.610' Confidentiality Notice: The information contained on this plat is legally “[19:1(32023315‘326 privileged and confidential information intended only for the use of scale 1I_1W are, recipients. It you are not the intended recipients, you are hereby I M _ t W hk P f 3| L' 'd s N D N 8346 d h h .f h tth notified that any use, dissemination. distribution or copying of this ’ argare as 0' '0 assume an “New” ' ' o" . ' a are Y can. V t a 6 <br/>information is strictly prohibited. survey plat shown hereon was made by me. or <br/> <br/> <br/>NOTE: All corners shown on this plat were found in the field during Kodiak Oil & Gas Corp. P Dam State 155-99-4—16-21—13H3 oil well survey on August 20, 2013. Distances to all others are calculated. The azimuths shown on this plat are grid, based upon Geodetic North derived from GPS measurements at the center of the project origin located at GPS 9-155-99, Latitude 48°15'25.462" North; Longitude 103°25'55.767“ West. <br/>Azimuths represent the calculated value from the central meridian using the forward hearing. The well location shown hereon is not an as—built location. <br/>Surveyed By Field Book M. Krebs Computed & Drawn By Proiect No. J.D.lB.C./Z.B. 3713185 <br/>See 13. 2013 ~ 10:25 AM 7 J:\oilfield\Kodiak\3713185\CADD\3713185ba501.dwg KLl 2013 <br/> <br/> <br/>Revised: 9/3/2013 </p> </div> </body> </html>
datamade/elpc_bakken
ocr_extracted/W28539_text/page47.html
HTML
mit
5,925
// The Harness for a Revel program. // // It has a couple responsibilities: // 1. Parse the user program, generating a main.go file that registers // controller classes and starts the user's server. // 2. Build and run the user program. Show compile errors. // 3. Monitor the user source and re-build / restart the program when necessary. // // Source files are generated in the app/tmp directory. package harness import ( "crypto/tls" "fmt" "github.com/nubleer/revel" "go/build" "io" "net" "net/http" "net/http/httputil" "net/url" "os" "os/signal" "path" "path/filepath" "strings" "sync/atomic" ) var ( watcher *revel.Watcher doNotWatch = []string{"tmp", "views", "routes"} lastRequestHadError int32 ) // Harness reverse proxies requests to the application server. // It builds / runs / rebuilds / restarts the server when code is changed. type Harness struct { app *App serverHost string port int proxy *httputil.ReverseProxy } func renderError(w http.ResponseWriter, r *http.Request, err error) { req, resp := revel.NewRequest(r), revel.NewResponse(w) c := revel.NewController(req, resp) c.RenderError(err).Apply(req, resp) } // ServeHTTP handles all requests. // It checks for changes to app, rebuilds if necessary, and forwards the request. func (hp *Harness) ServeHTTP(w http.ResponseWriter, r *http.Request) { // Don't rebuild the app for favicon requests. if lastRequestHadError > 0 && r.URL.Path == "/favicon.ico" { return } // Flush any change events and rebuild app if necessary. // Render an error page if the rebuild / restart failed. err := watcher.Notify() if err != nil { atomic.CompareAndSwapInt32(&lastRequestHadError, 0, 1) renderError(w, r, err) return } atomic.CompareAndSwapInt32(&lastRequestHadError, 1, 0) // Reverse proxy the request. // (Need special code for websockets, courtesy of bradfitz) if strings.EqualFold(r.Header.Get("Upgrade"), "websocket") { proxyWebsocket(w, r, hp.serverHost) } else { hp.proxy.ServeHTTP(w, r) } } // Return a reverse proxy that forwards requests to the given port. func NewHarness() *Harness { // Get a template loader to render errors. // Prefer the app's views/errors directory, and fall back to the stock error pages. revel.MainTemplateLoader = revel.NewTemplateLoader( []string{path.Join(revel.RevelPath, "templates")}) revel.MainTemplateLoader.Refresh() addr := revel.HttpAddr port := revel.Config.IntDefault("harness.port", 0) scheme := "http" if revel.HttpSsl { scheme = "https" } // If the server is running on the wildcard address, use "localhost" if addr == "" { addr = "localhost" } if port == 0 { port = getFreePort() } serverUrl, _ := url.ParseRequestURI(fmt.Sprintf(scheme+"://%s:%d", addr, port)) harness := &Harness{ port: port, serverHost: serverUrl.String()[len(scheme+"://"):], proxy: httputil.NewSingleHostReverseProxy(serverUrl), } if revel.HttpSsl { harness.proxy.Transport = &http.Transport{ TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, } } return harness } // Rebuild the Revel application and run it on the given port. func (h *Harness) Refresh() (err *revel.Error) { if h.app != nil { h.app.Kill() } revel.TRACE.Println("Rebuild") h.app, err = Build() if err != nil { return } h.app.Port = h.port if err2 := h.app.Cmd().Start(); err2 != nil { return &revel.Error{ Title: "App failed to start up", Description: err2.Error(), } } return } func (h *Harness) WatchDir(info os.FileInfo) bool { return !revel.ContainsString(doNotWatch, info.Name()) } func (h *Harness) WatchFile(filename string) bool { return strings.HasSuffix(filename, ".go") } // Run the harness, which listens for requests and proxies them to the app // server, which it runs and rebuilds as necessary. func (h *Harness) Run() { var paths []string if revel.Config.BoolDefault("watch.gopath", false) { gopaths := filepath.SplitList(build.Default.GOPATH) paths = append(paths, gopaths...) } paths = append(paths, revel.CodePaths...) watcher = revel.NewWatcher() watcher.Listen(h, paths...) go func() { addr := fmt.Sprintf("%s:%d", revel.HttpAddr, revel.HttpPort) revel.INFO.Printf("Listening on %s", addr) var err error if revel.HttpSsl { err = http.ListenAndServeTLS(addr, revel.HttpSslCert, revel.HttpSslKey, h) } else { err = http.ListenAndServe(addr, h) } if err != nil { revel.ERROR.Fatalln("Failed to start reverse proxy:", err) } }() // Kill the app on signal. ch := make(chan os.Signal) signal.Notify(ch, os.Interrupt, os.Kill) <-ch if h.app != nil { h.app.Kill() } os.Exit(1) } // Find an unused port func getFreePort() (port int) { conn, err := net.Listen("tcp", ":0") if err != nil { revel.ERROR.Fatal(err) } port = conn.Addr().(*net.TCPAddr).Port err = conn.Close() if err != nil { revel.ERROR.Fatal(err) } return port } // proxyWebsocket copies data between websocket client and server until one side // closes the connection. (ReverseProxy doesn't work with websocket requests.) func proxyWebsocket(w http.ResponseWriter, r *http.Request, host string) { d, err := net.Dial("tcp", host) if err != nil { http.Error(w, "Error contacting backend server.", 500) revel.ERROR.Printf("Error dialing websocket backend %s: %v", host, err) return } hj, ok := w.(http.Hijacker) if !ok { http.Error(w, "Not a hijacker?", 500) return } nc, _, err := hj.Hijack() if err != nil { revel.ERROR.Printf("Hijack error: %v", err) return } defer nc.Close() defer d.Close() err = r.Write(d) if err != nil { revel.ERROR.Printf("Error copying request to target: %v", err) return } errc := make(chan error, 2) cp := func(dst io.Writer, src io.Reader) { _, err := io.Copy(dst, src) errc <- err } go cp(d, nc) go cp(nc, d) <-errc }
nubleer/revel
harness/harness.go
GO
mit
5,871
import Ember from 'ember'; import emberFlexberryTranslations from 'ember-flexberry/locales/en/translations'; import emberFlexberryDummySuggestionModel from './models/ember-flexberry-dummy-suggestion'; import emberFlexberryDummySuggestionTypeModel from './models/ember-flexberry-dummy-suggestion-type'; import emberFlexberryDummyApplicationUserModel from './models/ember-flexberry-dummy-application-user'; import emberFlexberryDummyLocalizationModel from './models/ember-flexberry-dummy-localization'; import emberFlexberryDummyCommentModel from './models/ember-flexberry-dummy-comment'; import emberFlexberryDummySuggestionFileModel from './models/ember-flexberry-dummy-suggestion-file'; import componentsExampleGroupeditDetailModel from './models/components-examples/flexberry-groupedit/shared/detail'; import componentsExampleEditFormReadonlyModeDetailModel from './models/components-examples/edit-form/readonly-mode/detail'; import integrationExampleEditFormReadonlyModeDetailModel from './models/integration-examples/edit-form/readonly-mode/detail'; import integrationExampleEditFormValidationBaseModel from './models/integration-examples/edit-form/validation/base'; import emberFlexberryDummyDepartamentModel from './models/ember-flexberry-dummy-departament'; import emberFlexberryDummySotrudnikModel from './models/ember-flexberry-dummy-sotrudnik'; import emberFlexberryDummyVidDepartamentaModel from './models/ember-flexberry-dummy-vid-departamenta'; const translations = {}; Ember.$.extend(true, translations, emberFlexberryTranslations); Ember.$.extend(true, translations, { // eslint-disable-next-line ember/avoid-leaking-state-in-ember-objects models: { 'ember-flexberry-dummy-suggestion': emberFlexberryDummySuggestionModel, 'ember-flexberry-dummy-suggestion-type': emberFlexberryDummySuggestionTypeModel, 'components-examples/flexberry-groupedit/shared/detail': componentsExampleGroupeditDetailModel, 'components-examples/edit-form/readonly-mode/detail': componentsExampleEditFormReadonlyModeDetailModel, 'integration-examples/edit-form/readonly-mode/detail': integrationExampleEditFormReadonlyModeDetailModel, 'integration-examples/edit-form/validation/base': integrationExampleEditFormValidationBaseModel, 'ember-flexberry-dummy-application-user': emberFlexberryDummyApplicationUserModel, 'ember-flexberry-dummy-localization': emberFlexberryDummyLocalizationModel, 'ember-flexberry-dummy-comment': emberFlexberryDummyCommentModel, 'ember-flexberry-dummy-suggestion-file': emberFlexberryDummySuggestionFileModel, 'ember-flexberry-dummy-departament': emberFlexberryDummyDepartamentModel, 'ember-flexberry-dummy-sotrudnik': emberFlexberryDummySotrudnikModel, 'ember-flexberry-dummy-vid-departamenta': emberFlexberryDummyVidDepartamentaModel }, 'application-name': 'Test stand for ember-flexberry', // eslint-disable-next-line ember/avoid-leaking-state-in-ember-objects 'forms': { 'loading': { 'spinner-caption': 'Loading stuff, please have a cold beer...' }, 'index': { 'greeting': 'Welcome to ember-flexberry test stand!' }, 'application': { 'header': { 'menu': { 'sitemap-button': { 'title': 'Menu' }, 'user-settings-service-checkbox': { 'caption': 'Use service to save user settings' }, 'show-menu': { 'caption': 'Show menu' }, 'hide-menu': { 'caption': 'Hide menu' }, 'language-dropdown': { 'caption': 'Application language', 'placeholder': 'Choose language' }, }, 'login': { 'caption': 'Login' }, 'logout': { 'caption': 'Logout' } }, 'delete-rows-modal-dialog': { 'confirm-button-caption': 'Delete', 'cancel-button-caption': 'Cancel', 'delete-row-caption': 'Delete row ?', 'delete-rows-caption': 'Delete selected rows ?', }, 'footer': { 'application-name': 'Test stand for ember-flexberry', 'application-version': { 'caption': 'Addon version {{version}}', 'title': 'It is version of ember-flexberry addon, which uses in this dummy application ' + '(npm version + commit sha). ' + 'Click to open commit on GitHub.' } }, 'sitemap': { 'application-name': { 'caption': 'Test stand for ember-flexberry', 'title': '' }, 'application-version': { 'caption': 'Addon version {{version}}', 'title': 'It is version of ember-flexberry addon, which uses in this dummy application ' + '(npm version + commit sha). ' + 'Click to open commit on GitHub.' }, 'index': { 'caption': 'Home', 'title': '' }, 'application': { 'caption': 'Application', 'title': '', 'application-users': { 'caption': 'Application users', 'title': '' }, 'localizations': { 'caption': 'Localizations', 'title': '' }, 'suggestion-types': { 'caption': 'Suggestion types', 'title': '' }, 'suggestions': { 'caption': 'Suggestions', 'title': '' }, 'multi': { 'caption': 'Multi list', 'title': '' }, 'suggestion-file': { 'caption': 'Suggestion file', 'title': '' } }, 'log-service-examples': { 'caption': 'Log service', 'title': '', 'application-log': { 'caption': 'Application log', 'title': '' }, 'settings-example': { 'caption': 'Settings example', 'title': '' }, 'clear-log-form': { 'caption': 'Clear log', 'title': '' } }, 'lock': { 'caption': 'Blocking', 'title': 'Block list', }, 'components-examples': { 'caption': 'Components examples', 'title': '', 'flexberry-button': { 'caption': 'flexberry-button', 'title': '', 'settings-example': { 'caption': 'Settings example', 'title': '' } }, 'flexberry-checkbox': { 'caption': 'flexberry-checkbox', 'title': '', 'settings-example': { 'caption': 'Settings example', 'title': '' }, 'three-state-example': { 'caption': 'Three-state example', 'title': '' } }, 'flexberry-ddau-checkbox': { 'caption': 'flexberry-ddau-checkbox', 'title': '', 'settings-example': { 'caption': 'Settings example', 'title': '' } }, 'flexberry-dropdown': { 'caption': 'flexberry-dropdown', 'title': '', 'settings-example': { 'caption': 'Settings example', 'title': '' }, 'conditional-render-example': { 'caption': 'Conditional render example', 'title': '' }, 'empty-value-example': { 'caption': 'Example dropdown with empty value', 'title': '' }, 'items-example': { 'caption': 'Example values of the items', 'title': '' } }, 'flexberry-field': { 'caption': 'flexberry-field', 'title': '', 'settings-example': { 'caption': 'Settings example', 'title': '' } }, 'flexberry-file': { 'caption': 'flexberry-file', 'title': '', 'settings-example': { 'caption': 'Settings example', 'title': '' }, 'flexberry-file-in-modal': { 'caption': 'Flexberry file in modal window', 'title': '' }, }, 'flexberry-groupedit': { 'caption': 'flexberry-groupedit', 'title': '', 'settings-example': { 'caption': 'Settings example', 'title': '' }, 'model-update-example': { 'caption': 'Model update example', 'title': '' }, 'custom-buttons-example': { 'caption': 'Custom user buttons example', 'title': '' }, 'configurate-row-example': { 'caption': 'Configurate rows', 'title': '' }, 'groupedit-with-lookup-with-computed-atribute': { 'caption': 'Computed attributes LookUp in GroupEdit', 'title': '' }, 'readonly-columns-by-configurate-row-example': { 'caption': 'GrouptEdit readonly columns by configurateRow', 'title': '' } }, 'flexberry-lookup': { 'caption': 'flexberry-lookup', 'title': '', 'settings-example': { 'caption': 'Settings example', 'title': '' }, 'customizing-window-example': { 'caption': 'Window customization', 'title': '' }, 'compute-autocomplete': { 'caption': 'Example lookup with compute autocomplete', 'title': '' }, 'numeric-autocomplete': { 'caption': 'Example lookup with autocomplete and dropdwon with numeric displayAttributeName', 'title': '' }, 'hierarchy-olv-in-lookup-example': { 'caption': 'Example hierarchical OLV in lookup', 'title': '' }, 'limit-function-example': { 'caption': 'Limit function example', 'title': '' }, 'autofill-by-limit-example': { 'caption': 'Example autofillByLimit', 'title': '' }, 'limit-function-through-dynamic-properties-example': { 'caption': 'Limit function with dinamic properties example', 'title': '' }, 'lookup-block-form-example': { 'caption': 'Lookup block form example', 'title': '' }, 'lookup-in-modal': { 'caption': 'Lookup in modal window', 'title': '' }, 'dropdown-mode-example': { 'caption': 'Dropdown mode example', 'title': '' }, 'default-ordering-example': { 'caption': 'Default ordering example', 'title': '' }, 'autocomplete-order-example': { 'caption': 'Example for autocomplete with order', 'title': '' }, 'user-settings-example': { 'caption': 'Example for modal dialog olv user settiings', 'title': '' } }, 'flexberry-menu': { 'caption': 'flexberry-menu', 'title': '', 'settings-example': { 'caption': 'Settings example', 'title': '' } }, 'flexberry-objectlistview': { 'caption': 'flexberry-objectlistview', 'title': '', 'limit-function-example': { 'caption': 'Limit function example', 'title': '' }, 'inheritance-models': { 'caption': 'Inheritance models', 'title': '' }, 'settings-example': { 'caption': 'Settings example', 'title': '' }, 'toolbar-custom-buttons-example': { 'caption': 'Custom buttons on toolbar', 'title': '' }, 'on-edit-form': { 'caption': 'Placement on edit form', 'title': '' }, 'list-on-editform': { 'caption': 'Placement of the list of detail of the master on the editing form', 'title': '' }, 'custom-filter': { 'caption': 'Custom filter', 'title': '' }, 'edit-form-with-detail-list': { 'caption': 'List example', 'title': '' }, 'hierarchy-example': { 'caption': 'Hierarchy example', 'title': '' }, 'hierarchy-paging-example': { 'caption': 'Hierarchy with paginig example', 'title': '' }, 'configurate-rows': { 'caption': 'Configurate rows', 'title': '' }, 'selected-rows': { 'caption': 'Selected rows', 'title': '' }, 'downloading-files-from-olv-list': { 'caption': 'Downloading files from the list', 'title': '' }, 'object-list-view-resize': { 'caption': 'Columns markup', 'title': '' }, 'return-from-ediform': { 'title': 'Return from edit-form to list-form with queryParameter', 'return-button': 'Return' }, 'lock-services-editor-view-list': { 'caption': 'Example displaying username which the object was locked', 'title': '' }, 'limited-text-size-example': { 'caption': 'Limited text size example', 'title': '' }, }, 'flexberry-simpledatetime': { 'caption': 'flexberry-simpledatetime', 'title': '', 'settings-example': { 'caption': 'Settings example', 'title': '' } }, 'flexberry-text-cell': { 'caption': 'flexberry-text-cell', 'title': '', 'settings-example': { 'caption': 'Settings example', 'title': '' } }, 'flexberry-textarea': { 'caption': 'flexberry-textarea', 'title': '', 'settings-example': { 'caption': 'Settings example', 'title': '' } }, 'flexberry-textbox': { 'caption': 'flexberry-textbox', 'title': '', 'settings-example': { 'caption': 'Settings example', 'title': '' } }, 'flexberry-toggler': { 'caption': 'flexberry-toggler', 'title': '', 'settings-example': { 'caption': 'Settings example', 'title': '' }, 'settings-example-inner': { 'caption': 'Settings example (toggler in a toggler)', 'title': '' }, 'ge-into-toggler-example': { 'caption': 'GroupEdit into toggler example', } }, 'flexberry-tree': { 'caption': 'flexberry-tree', 'title': '', 'settings-example': { 'caption': 'Settings example', 'title': '' } }, 'ui-message': { 'caption': 'ui-message', 'title': '', 'settings-example': { 'caption': 'Settings example', 'title': '' } } }, 'integration-examples': { 'caption': 'Integration examples', 'title': '', 'edit-form': { 'caption': 'Edit form', 'title': '', 'readonly-mode': { 'caption': 'Readonly mode', 'title': '' }, 'validation': { 'caption': 'Validation', 'title': '' } }, 'odata-examples': { 'caption': 'Work with OData', 'title': '', 'get-masters': { 'caption': 'Get master from oData function', 'title': '', 'sotrudnik': { 'caption': 'Sotrudnik', 'title': '' }, 'departament': { 'caption': 'Departament', 'title': '' }, 'vid-departamenta': { 'caption': 'Vid departamenta', 'title': '' } }, }, }, 'user-setting-forms': { 'caption': 'User settings', 'title': '', 'user-setting-delete': { 'caption': 'Settings deletion', 'title': '' } }, 'components-acceptance-tests': { 'caption': 'Acceptance tests', 'title': '', }, } }, 'edit-form': { 'save-success-message-caption': 'Save operation succeed', 'save-success-message': 'Object saved', 'save-error-message-caption': 'Save operation failed', 'delete-success-message-caption': 'Delete operation succeed', 'delete-success-message': 'Object deleted', 'delete-error-message-caption': 'Delete operation failed' }, 'list-form': { 'delete-success-message-caption': 'Delete operation succeed', 'delete-success-message': 'Object deleted', 'delete-error-message-caption': 'Delete operation failed', 'load-success-message-caption': 'Load operation succeed', 'load-success-message': 'Object loaded', 'load-error-message-caption': 'Load operation failed' }, 'ember-flexberry-dummy-application-user-edit': { 'caption': 'Application user', 'name-caption': 'Name', 'eMail-caption': 'E-Mail', 'phone1-caption': 'Phone1', 'phone2-caption': 'Phone2', 'phone3-caption': 'Phone3', 'activated-caption': 'Activated', 'vK-caption': 'VK', 'facebook-caption': 'Facebook', 'twitter-caption': 'Twitter', 'birthday-caption': 'Birthday', 'gender-caption': 'Gender', 'vip-caption': 'VIP', 'karma-caption': 'Karma', 'name-validation-message-caption': 'Name is required', 'eMail-validation-message-caption': 'E-Mail is required', 'phone1-required-caption': 'Require filling in the "Phone1" field', }, 'ember-flexberry-dummy-comment-edit': { 'caption': 'Comment', 'text-caption': 'Text', 'votes-caption': 'Votes', 'moderated-caption': 'Moderated', 'author-caption': 'Author', 'userVotes-caption': 'User votes', 'date-caption': 'Date', 'author-validation-message-caption': 'Author is required' }, 'ember-flexberry-dummy-comment-vote-edit': { 'caption': 'User Vote', 'voteType-caption': 'Vote type', 'applicationUser-caption': 'Application user', }, 'ember-flexberry-dummy-localization-edit': { 'caption': 'Localization', 'name-caption': 'Name', 'name-validation-message-caption': 'Name is required' }, 'ember-flexberry-dummy-suggestion-edit': { 'caption': 'Suggestion', 'address-caption': 'Address', 'text-caption': 'Text', 'date-caption': 'Date', 'votes-caption': 'Votes', 'moderated-caption': 'Moderated', 'type-caption': 'Type', 'author-caption': 'Author', 'editor1-caption': 'Editor', 'files-caption': 'Files', 'userVotes-caption': 'User votes', 'comments-caption': 'Comments', 'type-validation-message-caption': 'Type is required', 'author-validation-message-caption': 'Author is required', 'editor-validation-message-caption': 'Editor is required', 'readonly-groupedit-with-lookup-with-computed-atribute-field': 'Readonly for LookUp "Application User" in GroupEdit "User votes"', 'limit-function-groupedit-with-lookup-with-computed-atribute-field': 'Limitations for LookUp "Application User" in GroupEdit "User votes"' }, 'ember-flexberry-dummy-suggestion-file-list': { 'header': 'Suggestion files', }, 'ember-flexberry-dummy-suggestion-file-edit': { 'header': 'Suggestion file', 'suggestion': 'Suggestion', 'order': 'Order', 'file': 'File', }, 'ember-flexberry-dummy-toggler-example-master-e': { 'caption': 'Master', 'toggler-example-master-property-caption': 'Master property', 'toggler-example-deteil-property-caption': 'Deteil' }, 'ember-flexberry-dummy-suggestion-type-edit': { 'caption': 'Suggestion type', 'name-caption': 'Name', 'moderated-caption': 'Moderated', 'parent-caption': 'Parent', 'localized-types-caption': 'Localized types', 'name-validation-message-caption': 'Name is required' }, 'ember-flexberry-dummy-application-user-list': { 'caption': 'Application users' }, 'ember-flexberry-dummy-localization-list': { 'caption': 'Localizations' }, 'ember-flexberry-dummy-suggestion-list': { 'caption': 'Suggestions' }, 'ember-flexberry-dummy-suggestion-type-list': { 'caption': 'Suggestion types' }, 'ember-flexberry-dummy-multi-list': { 'caption': 'Multi list form', 'multi-edit-form': 'Multi list edit form' }, 'log-service-examples': { 'settings-example': { 'caption': 'Log service. Settings example', 'setting-column-header-caption': 'Log service setting', 'settings-value-column-header-caption': 'Setting current value', 'throw-exception-button-caption': 'Throw exception', 'reject-rsvp-promise-button-caption': 'Reject promise', 'ember-assert-button-caption': 'assert', 'ember-logger-error-button-caption': 'Error', 'ember-logger-warn-button-caption': 'Warn', 'ember-deprecate-button-caption': 'Deprecate', 'ember-logger-log-button-caption': 'Log', 'ember-logger-info-button-caption': 'Info', 'ember-logger-debug-button-caption': 'Debug', 'throw-exception-button-message': 'Exception thrown', 'reject-rsvp-promise-button-message': 'Promise rejected', 'ember-assert-button-message': 'Ember.assert called', 'ember-logger-error-button-message': 'Ember.Logger.error called', 'ember-logger-warn-button-message': 'Ember.warn called', 'ember-deprecate-button-message': 'Ember.deprecate called', 'ember-logger-log-button-message': 'Ember.Logger.log called', 'ember-logger-info-button-message': 'Ember.Logger.info called', 'ember-logger-debug-button-message': 'Ember.debug called' } }, 'new-platform-flexberry-services-lock-list': { 'change-user-name': 'Change user name', 'open-read-only': 'Open read only', 'unlock-object': 'Unlock object', 'enter-new-user-name': 'Enter new user name:', }, 'components-examples': { 'flexberry-button': { 'settings-example': { 'caption': 'Settings example for flexberry-button' } }, 'flexberry-checkbox': { 'settings-example': { 'caption': 'Flexberry-checkbox. Settings example' }, 'three-state-example': { 'caption': 'Three-state example', 'indeterminate-button': 'Set blank' } }, 'flexberry-ddau-checkbox': { 'settings-example': { 'caption': 'Settings example for flexberry-ddau-checkbox' } }, 'flexberry-dropdown': { 'settings-example': { 'caption': 'Flexberry-dropdown. Settings example' }, 'conditional-render-example': { 'caption': 'Flexberry-dropdown. Conditional render example', 'info-caption': 'Use case description', 'info-message': 'The page template looks like following:' + '{{pageTemplate}}' + 'So, once the value is selected, the component will be rendered as &lt;span&gt;selected value&lt;/span&gt;,<br>' + 'after that check browser\'s console, it must be free from \'Semantic-UI\' and other errors.' }, 'empty-value-example': { 'caption': 'Flexberry-dropdown. Example dropdown with empty value', 'message': 'When you open the form in the Dropdown should not be empty. Should be: Enum value №2.', 'enumeration-caption': 'Dropdown with empty value', }, 'items-example': { 'caption': 'Flexberry-dropdown. Example values of the items', 'checkbox-caption': 'use the itemsObject' } }, 'flexberry-field': { 'settings-example': { 'caption': 'Flexberry-field. Settings example' } }, 'flexberry-file': { 'settings-example': { 'caption': 'Flexberry-file. Settings example' } }, 'flexberry-groupedit': { 'settings-example': { 'caption': 'Flexberry-groupedit. Settings example' }, 'custom-buttons-example': { 'caption': 'Flexberry-groupedit. Custom buttons example', 'custom-message': 'Hello!', 'custom-button-name': 'Send hello', 'disable-button-name': 'Disable adjacent button', 'enable-button-name': 'Enable adjacent button', }, 'configurate-row-example': { 'caption': 'Flexberry-groupedit. Configurate rows', 'confirm': 'Are you sure ?' }, 'model-update-example': { 'caption': 'Flexberry-groupedit. Model update example', 'addDetailButton': 'Add detail', 'removeDetailButton': 'Remove detail', } }, 'flexberry-lookup': { 'settings-example': { 'caption': 'Flexberry-lookup. Settings example' }, 'customizing-window-example': { 'caption': 'Flexberry-lookup. Window customization', 'titleLookup': 'Master' }, 'compute-autocomplete': { 'caption': 'Example lookup with compute autocomplete', 'title': '' }, 'numeric-autocomplete': { 'caption': 'Example lookup with autocomplete and dropdwon with numeric displayAttributeName', 'title': '' }, 'hierarchy-olv-in-lookup-example': { 'caption': 'Flexberry-lookup. Example hierarchical OLV in lookup', 'titleLookup': 'Master' }, 'limit-function-example': { 'caption': 'Flexberry-lookup. Limit function example', 'titleLookup': 'Master' }, 'limit-function-through-dynamic-properties-example': { 'caption': 'Flexberry-lookup. Limit function through dynamic properties example', 'titleLookup': 'Master', 'captionFirstLimitFunction': 'Limit function №1', 'captionSecondLimitFunction': 'Limit function №2', 'captionClearLimitFunction': 'Clear limit function' }, 'autofill-by-limit-example': { 'caption': 'Flexberry-lookup. Example autofillByLimit in lookup', 'titleLookup': 'Master' }, 'lookup-block-form-example': { 'caption': 'Flexberry-lookup. Lookup block form example' }, 'lookup-in-modal': { 'caption': 'Flexberry-lookup. Lookup in modal window', 'captionModal': 'Custom modal window №1', 'captionModalDouble': 'Custom modal window №2', 'buttonModal': 'Modal window №1', 'buttonModalDouble': 'Modal window №2', 'buttonClose': 'Close' }, 'dropdown-mode-example': { 'caption': 'Flexberry-lookup. Dropdown mode example' }, 'default-ordering-example': { 'caption': 'Flexberry-lookup. Default ordering example', 'titleLookup': 'Master' }, 'autocomplete-order-example': { 'caption': 'Flexberry-lookup. Example for autocomplete with order', 'titleLookup': 'Master' }, }, 'flexberry-menu': { 'settings-example': { 'caption': 'Flexberry-menu. Settings example', 'titleIcon1': 'Left side aligned icon', 'titleIcon2': 'Right side aligned icon', 'titleIcon3': 'Submenu', 'titleIcon4': 'Row buttons' } }, 'flexberry-objectlistview': { 'limit-function-example': { 'caption': 'Flexberry-objectlistview. Limit function example', 'captionFirstLimitFunction': 'Limit function №1', 'captionSecondLimitFunction': 'Limit function №2', 'captionClearLimitFunction': 'Clear limit function' }, 'inheritance-models': { 'caption': 'Flexberry-objectlistview. Inheritance models example', 'message': 'Сheck projection in OLV. (ProjectionE=ProjectionL)', 'projectionBase': 'Projection \'Base\': Name, E-mail, Birthday', 'projectionSuccessorPhone': 'Projection \'Successor phone\': Name, Phone1, Phone2, Phone3', 'projectionSuccessorSoc': 'Projection \'Successor social network\': Name, VK, Facebook, Twitter', 'buttonRoot': 'Base', 'buttonSuccessorPhone': 'Successor phone', 'buttonSuccessorSoc': 'Successor social network', 'name-caption': 'Name', 'eMail-caption': 'E-Mail', 'phone1-caption': 'Phone1', 'phone2-caption': 'Phone2', 'phone3-caption': 'Phone3', 'vK-caption': 'VK', 'facebook-caption': 'Facebook', 'twitter-caption': 'Twitter', 'birthday-caption': 'Birthday' }, 'settings-example': { 'caption': 'Flexberry-objectlistview. Settings example' }, 'limited-text-size-example': { 'caption': 'Flexberry-objectlistview. Limited text size example' }, 'toolbar-custom-buttons-example': { 'caption': 'Flexberry-objectlistview. Custom buttons on toolbar', 'custom-message': 'Hello!', 'custom-button-name': 'Send hello', 'disable-button-name': 'Disable adjacent button', 'enable-button-name': 'Enable adjacent button', 'custom-row-button-name': 'Custom button in row', }, 'on-edit-form': { 'caption': 'Flexberry-objectlistview. FlexberryObjectlistview on edit form', 'add-button-name': 'Добавить' }, 'list-on-editform': { 'caption': 'List of children Type' }, 'custom-filter': { 'caption': 'Flexberry-objectlistview. Custom filter' }, 'hierarchy-example': { 'caption': 'Flexberry-objectlistview. Hierarchy example' }, 'hierarchy-paging-example': { 'caption': 'Flexberry-objectlistview. Hierarchy paging example' }, 'configurate-rows': { 'caption': 'Flexberry-objectlistview. Configurate rows' }, 'selected-rows': { 'caption': 'Flexberry-objectlistview. Setected rows' }, 'downloading-files-from-olv-list': { 'caption': 'Flexberry-objectlistview. Downloading files from the list' }, 'object-list-view-resize': { 'caption': 'Flexberry-objectlistview. Columns markup', 'button-сaption': 'Add', 'title': '' }, 'lock-services-editor-view': { 'blocked-by': 'Blocked by user', }, }, 'flexberry-simpleolv': { 'limit-function-example': { 'caption': 'Flexberry-simpleolv. Limit function example', 'captionFirstLimitFunction': 'Limit function №1', 'captionSecondLimitFunction': 'Limit function №2', 'captionClearLimitFunction': 'Clear limit function' }, 'settings-example': { 'caption': 'Flexberry-simpleolv. Settings example' }, 'toolbar-custom-buttons-example': { 'caption': 'Flexberry-simpleolv. Custom buttons on toolbar', 'custom-message': 'Hello!', 'custom-button-name': 'Send hello' }, 'on-edit-form': { 'caption': 'Flexberry-simpleolv. FlexberryObjectlistview custom data sample' }, 'custom-filter': { 'caption': 'Flexberry-simpleolv. Custom filter', 'addObjects-button': 'Add objects' }, 'configurate-rows': { 'caption': 'Flexberry-simpleolv. Configurate rows' }, 'selected-rows': { 'caption': 'Flexberry-simpleolv. Setected rows' } }, 'flexberry-simpledatetime': { 'settings-example': { 'caption': 'Flexberry-simpledatetime. Settings example' } }, 'flexberry-text-cell': { 'settings-example': { 'caption': 'Flexberry-text-cell. Settings example' } }, 'flexberry-textarea': { 'settings-example': { 'caption': 'Flexberry-textarea. Settings example' } }, 'flexberry-textbox': { 'settings-example': { 'caption': 'Flexberry-textbox. Settings example' } }, 'flexberry-toggler': { 'settings-example': { 'caption': 'Flexberry-toggler. Settings example', 'togglerContent': 'Some expandable/collapsable content' }, 'settings-example-inner': { 'caption': 'Flexberry-toggler. Settings example', 'togglerContent': 'Some expandable/collapsable content', 'innerTogglerContent': 'Some expandable/collapsable content in an inner toggler' }, 'ge-into-toggler-example': { 'caption': 'Flexberry-toggler. GroupEdit into toggler example' } }, 'flexberry-tree': { 'settings-example': { 'caption': 'Settings example for flexberry-tree', 'json-tree-tab-caption': 'JSON-object-defined tree', 'json-tree-latest-clicked-node-caption': 'Latest clicked tree node settings', 'json-tree-latest-clicked-node-placeholder': 'Click on any tree node to display it\'s settings' } }, 'ui-message': { 'settings-example': { 'caption': 'Ui-message. Settings example', 'captionMessage': 'Result of checking', 'messageError': 'Operation is failed', 'messageSuccess': 'Operation is success', 'messageWarning': 'Partially implemented', 'messageInfo': 'Note!' } } }, 'integration-examples': { 'edit-form': { 'readonly-mode': { 'caption': 'Integration examples. Readonly mode', 'readonly-flag-management-segment-caption': 'Form\'s readonly-mode management', 'readonly-flag-value-segment-caption': 'Controller\'s \'readonly\' property value', 'readonly-flag-caption': 'Form is in readonly mode', 'flag-caption': 'Flag', 'number-caption': 'Number', 'text-caption': 'Text', 'long-text-caption': 'Long text', 'date-caption': 'Date', 'time-caption': 'Date + Time', 'enumeration-caption': 'Enumeration', 'file-caption': 'File', 'master-caption': 'Master', 'master-dropdown-caption': 'Master in dropdown mode' }, 'validation': { 'caption': 'Integration examples. Validation', 'summary-caption': 'Validation errors:', 'flag-caption': 'Flag', 'number-caption': 'Number', 'text-caption': 'Text', 'long-text-caption': 'Long text', 'date-caption': 'Date', 'enumeration-caption': 'Enumeration', 'file-caption': 'File', 'master-caption': 'Master', 'details-caption': 'Details' } }, 'odata-examples': { 'get-masters': { 'ember-flexberry-dummy-departament-e': { caption: 'EmberFlexberryDummyDepartamentE', 'name-caption': 'name', 'vid-caption': 'vid' }, 'ember-flexberry-dummy-departament-l': { caption: 'EmberFlexberryDummyDepartamentL' }, 'ember-flexberry-dummy-sotrudnik-e': { caption: 'EmberFlexberryDummySotrudnikE', 'familiia-caption': 'familiia', 'name-caption': 'name', 'dataRozhdeniia-caption': 'dataRozhdeniia', 'departament-caption': 'departament' }, 'ember-flexberry-dummy-sotrudnik-l': { caption: 'EmberFlexberryDummySotrudnikL', 'doOdataFunction': 'Do Odata function', 'dataReceived': 'Objects loaded', 'receivedMasters': 'Masters loaded', 'receivedMastersError': 'Error loading masters', 'receivedMasterMasters': 'Master masters loaded', 'receivedMasterMastersError': 'Error loading masters from masters' }, 'ember-flexberry-dummy-vid-departamenta-e': { caption: 'EmberFlexberryDummyVidDepartamentaE', 'name-caption': 'name' }, 'ember-flexberry-dummy-vid-departamenta-l': { caption: 'EmberFlexberryDummyVidDepartamentaL' }, } } }, 'user-setting-forms': { 'user-setting-delete': { 'caption': 'User settings', 'all-del-button-name': 'Delete all!', 'message': 'Settings were removed' } } }, // eslint-disable-next-line ember/avoid-leaking-state-in-ember-objects 'components': { 'settings-example': { 'component-template-caption': 'Component template', 'controller-properties-caption': 'Controller properties', 'component-current-settings-caption': 'Component current settings values', 'component-default-settings-caption': 'Component default settings values', 'component-with-applied-settings-caption': 'Component with it\'s current settings applied' } } }); export default translations;
Flexberry/ember-flexberry
tests/dummy/app/locales/en/translations.js
JavaScript
mit
38,553
<!DOCTYPE html><html><head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>Re: [問卦] 有228事件本省人和外省人各死多少八卦麼 - 看板 Gossiping - 批踢踢實業坊</title> <meta name="robots" content="all"> <meta name="keywords" content="Ptt BBS 批踢踢"> <meta name="description" content=" 我覺得很好笑,難道說日本人有幹這些事 國民黨幹的事就一筆勾消?? 一堆國民黨支持者拿馬英九優於陳水扁的數據證明國民黨優於民進黨 但陳水扁優於馬英九的也故意不去看 "> <meta property="og:site_name" content="Ptt 批踢踢實業坊"> <meta property="og:title" content="Re: [問卦] 有228事件本省人和外省人各死多少八卦麼"> <meta property="og:description" content=" 我覺得很好笑,難道說日本人有幹這些事 國民黨幹的事就一筆勾消?? 一堆國民黨支持者拿馬英九優於陳水扁的數據證明國民黨優於民進黨 但陳水扁優於馬英九的也故意不去看 "> <link rel="stylesheet" type="text/css" href="//images.ptt.cc/v2.10/bbs-common.css"> <link rel="stylesheet" type="text/css" href="//images.ptt.cc/v2.10/bbs.css" media="screen"> <link rel="stylesheet" type="text/css" href="//images.ptt.cc/v2.10/pushstream.css" media="screen"> <link rel="stylesheet" type="text/css" href="//images.ptt.cc/v2.10/bbs-print.css" media="print"> <script src="https://apis.google.com/_/scs/apps-static/_/js/k=oz.gapi.zh_TW.qtxilauKU-U.O/m=auth/exm=plusone/rt=j/sv=1/d=1/ed=1/am=AQ/rs=AGLTcCOdL1GO6qGs1J-GVcOrDJYEFOs1nA/t=zcms/cb=gapi.loaded_1" async=""></script><script src="https://apis.google.com/_/scs/apps-static/_/js/k=oz.gapi.zh_TW.qtxilauKU-U.O/m=plusone/rt=j/sv=1/d=1/ed=1/am=AQ/rs=AGLTcCOdL1GO6qGs1J-GVcOrDJYEFOs1nA/t=zcms/cb=gapi.loaded_0" async=""></script><script type="text/javascript" async="" src="https://apis.google.com/js/plusone.js" gapi_processed="true"></script><script id="facebook-jssdk" src="//connect.facebook.net/en_US/all.js#xfbml=1"></script><script type="text/javascript" async="" src="https://ssl.google-analytics.com/ga.js"></script><script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="//images.ptt.cc/v2.10/bbs.js"></script> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-32365737-1']); _gaq.push(['_setDomainName', 'ptt.cc']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> <style type="text/css">.fb_hidden{position:absolute;top:-10000px;z-index:10001}.fb_invisible{display:none}.fb_reset{background:none;border:0;border-spacing:0;color:#000;cursor:auto;direction:ltr;font-family:"lucida grande", tahoma, verdana, arial, sans-serif;font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:1;margin:0;overflow:visible;padding:0;text-align:left;text-decoration:none;text-indent:0;text-shadow:none;text-transform:none;visibility:visible;white-space:normal;word-spacing:normal}.fb_reset>div{overflow:hidden}.fb_link img{border:none} .fb_dialog{background:rgba(82, 82, 82, .7);position:absolute;top:-10000px;z-index:10001}.fb_reset .fb_dialog_legacy{overflow:visible}.fb_dialog_advanced{padding:10px;-moz-border-radius:8px;-webkit-border-radius:8px;border-radius:8px}.fb_dialog_content{background:#fff;color:#333}.fb_dialog_close_icon{background:url(https://fbstatic-a.akamaihd.net/rsrc.php/v2/yq/r/IE9JII6Z1Ys.png) no-repeat scroll 0 0 transparent;_background-image:url(https://fbstatic-a.akamaihd.net/rsrc.php/v2/yL/r/s816eWC-2sl.gif);cursor:pointer;display:block;height:15px;position:absolute;right:18px;top:17px;width:15px}.fb_dialog_mobile .fb_dialog_close_icon{top:5px;left:5px;right:auto}.fb_dialog_padding{background-color:transparent;position:absolute;width:1px;z-index:-1}.fb_dialog_close_icon:hover{background:url(https://fbstatic-a.akamaihd.net/rsrc.php/v2/yq/r/IE9JII6Z1Ys.png) no-repeat scroll 0 -15px transparent;_background-image:url(https://fbstatic-a.akamaihd.net/rsrc.php/v2/yL/r/s816eWC-2sl.gif)}.fb_dialog_close_icon:active{background:url(https://fbstatic-a.akamaihd.net/rsrc.php/v2/yq/r/IE9JII6Z1Ys.png) no-repeat scroll 0 -30px transparent;_background-image:url(https://fbstatic-a.akamaihd.net/rsrc.php/v2/yL/r/s816eWC-2sl.gif)}.fb_dialog_loader{background-color:#f6f7f8;border:1px solid #606060;font-size:24px;padding:20px}.fb_dialog_top_left,.fb_dialog_top_right,.fb_dialog_bottom_left,.fb_dialog_bottom_right{height:10px;width:10px;overflow:hidden;position:absolute}.fb_dialog_top_left{background:url(https://fbstatic-a.akamaihd.net/rsrc.php/v2/ye/r/8YeTNIlTZjm.png) no-repeat 0 0;left:-10px;top:-10px}.fb_dialog_top_right{background:url(https://fbstatic-a.akamaihd.net/rsrc.php/v2/ye/r/8YeTNIlTZjm.png) no-repeat 0 -10px;right:-10px;top:-10px}.fb_dialog_bottom_left{background:url(https://fbstatic-a.akamaihd.net/rsrc.php/v2/ye/r/8YeTNIlTZjm.png) no-repeat 0 -20px;bottom:-10px;left:-10px}.fb_dialog_bottom_right{background:url(https://fbstatic-a.akamaihd.net/rsrc.php/v2/ye/r/8YeTNIlTZjm.png) no-repeat 0 -30px;right:-10px;bottom:-10px}.fb_dialog_vert_left,.fb_dialog_vert_right,.fb_dialog_horiz_top,.fb_dialog_horiz_bottom{position:absolute;background:#525252;filter:alpha(opacity=70);opacity:.7}.fb_dialog_vert_left,.fb_dialog_vert_right{width:10px;height:100%}.fb_dialog_vert_left{margin-left:-10px}.fb_dialog_vert_right{right:0;margin-right:-10px}.fb_dialog_horiz_top,.fb_dialog_horiz_bottom{width:100%;height:10px}.fb_dialog_horiz_top{margin-top:-10px}.fb_dialog_horiz_bottom{bottom:0;margin-bottom:-10px}.fb_dialog_iframe{line-height:0}.fb_dialog_content .dialog_title{background:#6d84b4;border:1px solid #3a5795;color:#fff;font-size:14px;font-weight:bold;margin:0}.fb_dialog_content .dialog_title>span{background:url(https://fbstatic-a.akamaihd.net/rsrc.php/v2/yd/r/Cou7n-nqK52.gif) no-repeat 5px 50%;float:left;padding:5px 0 7px 26px}body.fb_hidden{-webkit-transform:none;height:100%;margin:0;overflow:visible;position:absolute;top:-10000px;left:0;width:100%}.fb_dialog.fb_dialog_mobile.loading{background:url(https://fbstatic-a.akamaihd.net/rsrc.php/v2/ya/r/3rhSv5V8j3o.gif) white no-repeat 50% 50%;min-height:100%;min-width:100%;overflow:hidden;position:absolute;top:0;z-index:10001}.fb_dialog.fb_dialog_mobile.loading.centered{max-height:590px;min-height:590px;max-width:500px;min-width:500px}#fb-root #fb_dialog_ipad_overlay{background:rgba(0, 0, 0, .45);position:absolute;left:0;top:0;width:100%;min-height:100%;z-index:10000}#fb-root #fb_dialog_ipad_overlay.hidden{display:none}.fb_dialog.fb_dialog_mobile.loading iframe{visibility:hidden}.fb_dialog_content .dialog_header{-webkit-box-shadow:white 0 1px 1px -1px inset;background:-webkit-gradient(linear, 0% 0%, 0% 100%, from(#738ABA), to(#2C4987));border-bottom:1px solid;border-color:#1d4088;color:#fff;font:14px Helvetica, sans-serif;font-weight:bold;text-overflow:ellipsis;text-shadow:rgba(0, 30, 84, .296875) 0 -1px 0;vertical-align:middle;white-space:nowrap}.fb_dialog_content .dialog_header table{-webkit-font-smoothing:subpixel-antialiased;height:43px;width:100%}.fb_dialog_content .dialog_header td.header_left{font-size:12px;padding-left:5px;vertical-align:middle;width:60px}.fb_dialog_content .dialog_header td.header_right{font-size:12px;padding-right:5px;vertical-align:middle;width:60px}.fb_dialog_content .touchable_button{background:-webkit-gradient(linear, 0% 0%, 0% 100%, from(#4966A6), color-stop(.5, #355492), to(#2A4887));border:1px solid #2f477a;-webkit-background-clip:padding-box;-webkit-border-radius:3px;-webkit-box-shadow:rgba(0, 0, 0, .117188) 0 1px 1px inset, rgba(255, 255, 255, .167969) 0 1px 0;display:inline-block;margin-top:3px;max-width:85px;line-height:18px;padding:4px 12px;position:relative}.fb_dialog_content .dialog_header .touchable_button input{border:none;background:none;color:#fff;font:12px Helvetica, sans-serif;font-weight:bold;margin:2px -12px;padding:2px 6px 3px 6px;text-shadow:rgba(0, 30, 84, .296875) 0 -1px 0}.fb_dialog_content .dialog_header .header_center{color:#fff;font-size:16px;font-weight:bold;line-height:18px;text-align:center;vertical-align:middle}.fb_dialog_content .dialog_content{background:url(https://fbstatic-a.akamaihd.net/rsrc.php/v2/y9/r/jKEcVPZFk-2.gif) no-repeat 50% 50%;border:1px solid #555;border-bottom:0;border-top:0;height:150px}.fb_dialog_content .dialog_footer{background:#f6f7f8;border:1px solid #555;border-top-color:#ccc;height:40px}#fb_dialog_loader_close{float:left}.fb_dialog.fb_dialog_mobile .fb_dialog_close_button{text-shadow:rgba(0, 30, 84, .296875) 0 -1px 0}.fb_dialog.fb_dialog_mobile .fb_dialog_close_icon{visibility:hidden} .fb_iframe_widget{display:inline-block;position:relative}.fb_iframe_widget span{display:inline-block;position:relative;text-align:justify}.fb_iframe_widget iframe{position:absolute}.fb_iframe_widget_lift{z-index:1}.fb_hide_iframes iframe{position:relative;left:-10000px}.fb_iframe_widget_loader{position:relative;display:inline-block}.fb_iframe_widget_fluid{display:inline}.fb_iframe_widget_fluid span{width:100%}.fb_iframe_widget_loader iframe{min-height:32px;z-index:2;zoom:1}.fb_iframe_widget_loader .FB_Loader{background:url(https://fbstatic-a.akamaihd.net/rsrc.php/v2/y9/r/jKEcVPZFk-2.gif) no-repeat;height:32px;width:32px;margin-left:-16px;position:absolute;left:50%;z-index:4}</style></head> <body> <div id="fb-root" class=" fb_reset"><div style="position: absolute; top: -10000px; height: 0px; width: 0px; "><div><iframe name="fb_xdm_frame_https" frameborder="0" allowtransparency="true" scrolling="no" id="fb_xdm_frame_https" aria-hidden="true" title="Facebook Cross Domain Communication Frame" tabindex="-1" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " src="https://s-static.ak.facebook.com/connect/xd_arbiter/7r8gQb8MIqE.js?version=41#channel=fada30eac&amp;origin=https%3A%2F%2Fwww.ptt.cc"></iframe></div></div><div style="position: absolute; top: -10000px; height: 0px; width: 0px; "><div></div></div></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/all.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> <div id="topbar-container"> <div id="topbar" class="bbs-content"> <a id="logo" href="/">批踢踢實業坊</a> <span>›</span> <a class="board" href="/bbs/Gossiping/index.html"><span class="board-label">看板 </span>Gossiping</a> <a class="right small" href="/about.html">關於我們</a> <a class="right small" href="/contact.html">聯絡資訊</a> </div> </div> <div id="navigation-container"> <div id="navigation" class="bbs-content"> <a class="board" href="/bbs/Gossiping/index.html">返回看板</a> <div class="bar"></div> <div class="share"> <span>分享</span> <div class="fb-like fb_iframe_widget" data-send="false" data-layout="button_count" data-width="90" data-show-faces="false" data-href="http://www.ptt.cc/bbs/Gossiping/M.1419177776.A.144.html" fb-xfbml-state="parsed" fb-iframe-plugin-query="app_id=&amp;href=http%3A%2F%2Fwww.ptt.cc%2Fbbs%2FGossiping%2FM.1419177776.A.144.html&amp;layout=button_count&amp;locale=en_US&amp;sdk=joey&amp;send=false&amp;show_faces=false&amp;width=90"><span style="vertical-align: top; width: 0px; height: 0px; overflow-x: hidden; overflow-y: hidden; "><iframe name="f16afb57ec" width="90px" height="1000px" frameborder="0" allowtransparency="true" scrolling="no" title="fb:like Facebook Social Plugin" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; visibility: hidden; " src="https://www.facebook.com/plugins/like.php?app_id=&amp;channel=https%3A%2F%2Fs-static.ak.facebook.com%2Fconnect%2Fxd_arbiter%2F7r8gQb8MIqE.js%3Fversion%3D41%23cb%3Df2e3a0d844%26domain%3Dwww.ptt.cc%26origin%3Dhttps%253A%252F%252Fwww.ptt.cc%252Ffada30eac%26relation%3Dparent.parent&amp;href=http%3A%2F%2Fwww.ptt.cc%2Fbbs%2FGossiping%2FM.1419177776.A.144.html&amp;layout=button_count&amp;locale=en_US&amp;sdk=joey&amp;send=false&amp;show_faces=false&amp;width=90"></iframe></span></div> <div style="text-indent: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; float: none; line-height: normal; font-size: 1px; vertical-align: baseline; display: inline-block; width: 90px; height: 20px; background-position: initial initial; background-repeat: initial initial; " id="___plusone_0"><iframe frameborder="0" hspace="0" marginheight="0" marginwidth="0" scrolling="no" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; position: static; left: 0px; top: 0px; visibility: visible; width: 90px; height: 20px; " tabindex="0" vspace="0" width="100%" id="I0_1419228410640" name="I0_1419228410640" src="https://apis.google.com/se/0/_/+1/fastbutton?usegapi=1&amp;size=medium&amp;hl=zh-TW&amp;origin=https%3A%2F%2Fwww.ptt.cc&amp;url=https%3A%2F%2Fwww.ptt.cc%2Fbbs%2FGossiping%2FM.1419177776.A.144.html&amp;gsrc=3p&amp;ic=1&amp;jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.zh_TW.qtxilauKU-U.O%2Fm%3D__features__%2Fam%3DAQ%2Frt%3Dj%2Fd%3D1%2Ft%3Dzcms%2Frs%3DAGLTcCOdL1GO6qGs1J-GVcOrDJYEFOs1nA#_methods=onPlusOne%2C_ready%2C_close%2C_open%2C_resizeMe%2C_renderstart%2Concircled%2Cdrefresh%2Cerefresh%2Conload&amp;id=I0_1419228410640&amp;parent=https%3A%2F%2Fwww.ptt.cc&amp;pfname=&amp;rpctoken=23749525" data-gapiattached="true" title="+1"></iframe></div> <script type="text/javascript"> window.___gcfg = {lang: 'zh-TW'}; (function() { var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.google.com/js/plusone.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); })(); </script> </div> </div> </div> <div id="main-container"> <div id="main-content" class="bbs-screen bbs-content"><div class="article-metaline"><span class="article-meta-tag">作者</span><span class="article-meta-value">krousxchen (城府很深)</span></div><div class="article-metaline-right"><span class="article-meta-tag">看板</span><span class="article-meta-value">Gossiping</span></div><div class="article-metaline"><span class="article-meta-tag">標題</span><span class="article-meta-value">Re: [問卦] 有228事件本省人和外省人各死多少八卦麼</span></div><div class="article-metaline"><span class="article-meta-tag">時間</span><span class="article-meta-value">Mon Dec 22 00:02:54 2014</span></div> 我覺得很好笑,難道說日本人有幹這些事 國民黨幹的事就一筆勾消?? 一堆國民黨支持者拿馬英九優於陳水扁的數據證明國民黨優於民進黨 但陳水扁優於馬英九的也故意不去看 我們看國民黨跟日本人,當然就是都有錯 但問題是,你國民黨跟日本人一樣,都死不認錯 當然你怪別人把錯都怪到國民黨頭上,但別人也覺得你都把錯怪到日本人跟本省人頭上 跟彭孟緝的子孫享受榮華富貴,還想要幫彭孟緝翻案一樣 別人罵國民黨是罵他們不認罪 不要說啥馬英九每年都在二二八道歉 跟國民黨最愛說日本人不學德國人道歉一樣啦,國民黨自已怎麼不學德國道歉?? 然後現在還在把責任推給日本人,笑死人啦 <span class="f2">※ 引述《exeexe (千江水 千江月 萬里路)》之銘言: </span><span class="f6">: 你根本沒看內容也可以邊腦補邊回 真佩服 </span><span class="f6">: 乾脆貼給你看吧 或者 你想說曾擔任臺灣總督府主計課長的鹽見俊二也在唬爛? </span><span class="f6">: <a href="http://ppt.cc/YMNU" target="_blank" rel="nofollow">http://ppt.cc/YMNU</a> 228的前因 </span><span class="f6">: Chen-Wei Wu: "「人人都是自己的史學家」,這句話是正確的,但是歷史不能是修理業也 </span><span class="f6">: 不能是製造業,不能隨自己喜歡就切割。 </span><span class="f6">: 以二二八為例,很多人熱愛引用「臺灣事變內幕記」記述的國府軍如何慘烈屠殺臺灣人、 </span><span class="f6">: 如何軍紀敗壞,陳儀施政如何失敗之類云云,但是對該書所寫臺灣人如何在街頭開日文檢 </span><span class="f6">: 定生死鬥,攔路殺外省人等卻一字不提,好像這本書裡面從來沒有這內容一樣。 </span><span class="f6">: 結果他們就製造一種幻覺,二二八是臺灣人都溫良恭儉讓在家安居樂業,突然國府就派人 </span><span class="f6">: 殺過來把臺灣人殺了一遍,這完全就牛頭不對馬嘴,這就是所謂「歷史謠言」。" </span><span class="f6">: 另外,也看到有朋友提到關於228的看法是[不釐清前因] 自然無法 [理解後果]。 </span><span class="f6">: 所以今天試著找些關於228前因的補充資料如下: </span><span class="f6">: 二戰末期日本本土與台灣均陷於物資與糧食嚴重缺乏的狀態,故1941年時日台均已實施米 </span><span class="f6">: 穀配給制度。在台灣,1942年時甚至連肉、青果、鮮魚、油、鹽等民生必用物資也實施配 </span><span class="f6">: 給。 </span><span class="f6">: 1945年春夏,一切副食品幾乎都從市場銷聲匿跡。停戰當時,台灣已到了商店幾乎看不到 </span><span class="f6">: 商品的經濟破產窘境。在美軍的大轟炸下,有關米糧的生產,台灣總督府的農業主管機關 </span><span class="f6">: 官員,瞭若指掌,並預測1945年將大大減收。 </span><span class="f6">: 1945年夏,日本殖民當局已辦妥當年八月份繳納米穀的分配,完全已經知道米穀收成的悲 </span><span class="f6">: 慘情況。 </span><span class="f6">: 1945年的台灣糙米實際產量約僅63.8萬公噸,僅及上(1944)年產量的59.8%。也就是說 </span><span class="f6">: ,即使仍實施日據末期配給嚴重不足的米糧配給制度,1946年春時台灣仍缺糧約三分之一 </span><span class="f6">: 。如果米糧是在市場自由買賣,則台灣缺糧約超過一半。當時日本本土也是處於糧食嚴重 </span><span class="f6">: 不足的狀態,日人形容當時是糧食的地獄。 </span><span class="f6">: 但就在要將台灣歸還我國前的九月上旬,日人在日本本土仍續實施嚴厲的米糧配給制度 </span><span class="f6">: 但在台灣卻發動蓄意放棄對糧食與各項物資一切管制的經濟戰。就個別(Micro)百姓而 </span><span class="f6">: 言,使得各地的餐廳如雨後春筍市場頓時供應充沛;就台灣整體(Macro)社會而言,此 </span><span class="f6">: 時一、二個月間所大肆浪費的糧食可維持台灣半年份的食用。故到了明(1946)年的二、 </span><span class="f6">: 三月,台灣社會乃將進入饑餓狀態。 </span><span class="f6">: 由於戰爭接二連三失利、資源短缺匱乏、對外交通受阻,導致經濟活動無法互動交流,加 </span><span class="f6">: 上各項設備又頻遭美軍空襲破壞,在上述種種不利因素交相衝擊,又遭逢政情不穩以致台 </span><span class="f6">: 灣物價急遽飆漲,形成嚴重的通貨膨脹。 </span><span class="f6">: 此時正飽受內外交逼的總督府可說已無暇他顧,對於台灣島內之政、經情勢再也無法像昔 </span><span class="f6">: 日能做嚴苛有效的全面掌控,於是只好採濫發鈔票的惡質手段來挹注與因應日本殖民政權 </span><span class="f6">: 在台灣所面臨的金融經濟問題及財務窘境。 </span><span class="f6">: 日據時代在本地流通之臺灣銀行券,一向是由日政府所屬的印刷局在日本當地印製完成後 </span><span class="f6">: 再運來台灣。後因台、日間的海、空交通運輸受到同盟國軍隊強力反撲之影響,以致制海 </span><span class="f6">: 權、制空權盡皆落入對方手中,使其聯外交通受阻。 </span><span class="f6">: 因此原由日本國內印製之「臺灣銀行券」此時只好採取分地印製、就近供應的措施,改為 </span><span class="f6">: 先在日本製版,再交付給總督府由台灣自行印製。 </span><span class="f6">: 此種在大戰末期由島內印製的臺灣銀行券謂之「現地刷」。據曾任臺灣銀行副頭取的日人 </span><span class="f6">: 「本橋兵太郎」於1964年編纂發行的《臺灣銀行史》一書所述得知:為躲避盟軍空襲,印 </span><span class="f6">: 鈔機係藏在台北金瓜石 廢舊坑道內暗中作業。這些鈔券因紙張差印刷粗劣,又為了提高 </span><span class="f6">: 印製效率盼能在短時間內迅速增加發行量,和想迴避與掩飾濫發貨幣所須承擔的政治責任 </span><span class="f6">: ,所以在印製過程中故意將可管控總發行量的鈔券號碼都省略不印。 </span><span class="f6">: 由於物價不斷上漲,民間對貨幣的需求更甚以往,而先前所印製之各版鈔券面額均較小, </span><span class="f6">: 最大面值也僅壹百圓,雖加上「現地刷」龐大的印製量但還是不敷使用。 </span><span class="f6">: 故在裕仁天皇正式宣布投降前,其實台灣總督府就曾向日本當局提出緊急供應大面額千圓 </span><span class="f6">: 鈔券以因應島內迫切需要的請求。 </span><span class="f6">: 大戰末期蠻橫的日本軍方原還高唱「本土決戰」、「一億玉碎」的主戰口號,仍癡心妄想 </span><span class="f6">: 覺得局勢還可有所作為,尚想繼續負嵎頑抗。 </span><span class="f6">: 但因德國投降導致歐戰結束,接著美國先後在廣島、長崎兩地投下原子彈,另蘇聯也把握 </span><span class="f6">: 時機落井下石立刻對日宣戰,受到上述種種不利的國際局勢因素內外交相衝擊,原本仍持 </span><span class="f6">: 好戰態度的日本軍方,至此才深知大勢已去再也無法獨力挽回,所以才在1945年8月15日 </span><span class="f6">: 由天皇親自宣布無條件投降。 </span><span class="f6">: 現若自投降當天算起至國府正式接收台灣止,在這兩個多月的過渡期間,日政府為因應復 </span><span class="f6">: 員需要,並為了發放為數巨大的資遣及補償經費,故將其原擬在本土使用的部分武尊千圓 </span><span class="f6">: 券大量空運來台,這批鈔券緊急運送到台灣後,隨即趕工加蓋「株式會社臺灣銀行」及代 </span><span class="f6">: 表董事長或總裁之義的「頭取之印」等紅色戳章,由台銀背書立刻發行 (參見袁穎生著《 </span><span class="f6">: 臺灣光復前貨幣史述》一書第411頁)。 </span><span class="f6">: 根據當時擔任臺灣總督府主計課長鹽見俊二,於1979年公開出版《秘錄‧終戰前後的台灣 </span><span class="f6">: 》這本書的部分內容所述得知:在二次大戰結束後不久,大藏省 (財政部)及日本銀行, </span><span class="f6">: 曾指派鹽見俊二在1945年9月9日當天,將為數甚多原計畫在日本國內流通的大面額紙幣, </span><span class="f6">: 在得到美國麥克阿瑟司令部核可下,派遣一架專程運載此批紙鈔的水上飛機,於上午六時 </span><span class="f6">: 自橫濱起飛,因飛行速度不快竟歷經10小時航程,才在下午4時安全降落台灣北部的淡水 </span><span class="f6">: 水上機場。 </span><span class="f6">: 依書上記載,當時機艙內滿載著高面額紙幣,數量多到竟連隨行的鹽見俊二也只能坐臥爬 </span><span class="f6">: 行於裝滿鈔幣之大木箱上,幾乎毫無轉身空間 (該書中文譯本於2001年11月由文英堂出版 </span><span class="f6">: 社發行)。 </span><span class="f6">: 親自監運該批大鈔順利抵台的鹽見俊二,首先就「預付」在台日本公務員、官員至翌年3 </span><span class="f6">: 月合計共半年的薪餉及退職金;另又再支付給戰爭末期建造島內各項要塞的工事人員津貼 </span><span class="f6">: 。此外其他一切必要之相關經費也皆藉此全數付清。由於這一大筆不須負擔政治責任及經 </span><span class="f6">: 濟風險且有意「濫發」的貨幣,盡皆落入日本軍人、官吏、公務員的口袋,使他們一夕之 </span><span class="f6">: 間人人都成「暴富」。但由於日僑 (在台日人)、日俘 (在台日軍)遣返作業實施在即,日 </span><span class="f6">: 本當局也深怕過多的貨幣若循此返鄉回國的管道又回流到日本國內,恐會擴大引發日本本 </span><span class="f6">: 土連續性的通貨膨脹。 </span><span class="f6">: 故當時遭遣返的日人在歸國時規定每人皆只限帶一千元。反正這些憑空得來的貨幣不花白 </span><span class="f6">: 不花,否則一旦時過境遷成為廢紙,那就白白蹧蹋對不起自己。 </span><span class="f6">: 因此手中擁有甚多餘錢的日人開始在台瘋狂採購消費,但因戰後台灣物資匱乏,不久即形 </span><span class="f6">: 成嚴重的通貨膨脹並導致各地物價飆漲。因此一場影響台灣甚巨的金融災難已風雨飄搖悄 </span><span class="f6">: 然掩至,一年半後釀成社會巨變的二二八事件其遠因之一也於此刻暗自埋下。 </span><span class="f6">: 今若從8月15日,裕仁天皇宣布無條件投降算起,到10月25日中、日雙方在台北舉行受降 </span><span class="f6">: 典禮止,在這兩個多月幾近無政府狀態的空窗期內,日本駐台當局假復員需要濫發高額鈔 </span><span class="f6">: 票所造成的通貨膨脹,使承受戰亂破壞,本質早已不良的台灣金融體系更有如雪上加霜, </span><span class="f6">: 整體經濟在短期間內急速變壞,也間接導致36年2月底二二八事件的發生 (根據1945年10 </span><span class="f6">: 月底的官方統計,當時臺灣銀行券發行總額已高達二十八億九千七百八十七萬餘元,數目 </span><span class="f6">: 已是同年2月底的3.15倍)。 </span><span class="f6">: 這位參與光復後日人在台發動經濟戰的鹽見俊二早在1946年1月17日,即陳儀抵台才二個 </span><span class="f6">: 月就預言「糧食不足狀態可決定台灣今後數年之命運 也可能發生將決定在台日本人命運 </span><span class="f6">: 的重大事態。治安混亂乃起因於糧食不足」 </span><span class="f6">: 「今後的治安混亂將是非常可怕的」也就是說,鹽見俊二精準地預見台灣未來將會發生類 </span><span class="f6">: 似二二八影響往後台灣命運的社會事件。 </span><span class="f6">: 陳儀抵台時,面對的是工業癱瘓、大地殘破、民生物資極度匱乏的台灣。當時的台灣沒有 </span><span class="f6">: 大量民生物資可供陳儀政府「不斷搬往大陸」。 </span> -- <span class="f2">※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 1.165.126.53 </span><span class="f2">※ 文章網址: <a href="http://www.ptt.cc/bbs/Gossiping/M.1419177776.A.144.html" target="_blank" rel="nofollow">http://www.ptt.cc/bbs/Gossiping/M.1419177776.A.144.html</a> </span><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">ange09</span><span class="f3 push-content">: XD我有聽過一個自稱淺藍的小朋友說,為什麼綠的都要提228</span><span class="push-ipdatetime"> 12/22 00:07 </span></div><div class="push"><span class="f1 hl push-tag">→ </span><span class="f3 hl push-userid">ange09</span><span class="f3 push-content">: 傷害被害者家屬,人家國民黨每次都只有低調哀悼而已他們是</span><span class="push-ipdatetime"> 12/22 00:07 </span></div><div class="push"><span class="f1 hl push-tag">→ </span><span class="f3 hl push-userid">ange09</span><span class="f3 push-content">: 無法溝通的</span><span class="push-ipdatetime"> 12/22 00:07 </span></div><div class="push"><span class="f1 hl push-tag">→ </span><span class="f3 hl push-userid">ange09</span><span class="f3 push-content">: 啊無法溝通是指國民黨支持者</span><span class="push-ipdatetime"> 12/22 00:08 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">sk100</span><span class="f3 push-content">: 228都能放假 不是嗎</span><span class="push-ipdatetime"> 12/22 00:08 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">alladult</span><span class="f3 push-content">: 請審判228,才是真道歉</span><span class="push-ipdatetime"> 12/22 00:19 </span></div><div class="push"><span class="f1 hl push-tag">→ </span><span class="f3 hl push-userid">krousxchen</span><span class="f3 push-content">: 每個人都會自認為自已是好人啦</span><span class="push-ipdatetime"> 12/22 00:31 </span></div><div class="push"><span class="hl push-tag">推 </span><span class="f3 hl push-userid">HuangJC</span><span class="f3 push-content">: 馬有道歉啊,都露出胸部那麼久了..</span><span class="push-ipdatetime"> 12/22 00:34 </span></div><div class="push"><span class="f1 hl push-tag">→ </span><span class="f3 hl push-userid">HuangJC</span><span class="f3 push-content">: 樓下貼恐怖圖片</span><span class="push-ipdatetime"> 12/22 00:34 </span></div><div class="push"><span class="f1 hl push-tag">→ </span><span class="f3 hl push-userid">dctzeng</span><span class="f3 push-content">: 馬有道歉 但侵佔日本接收的黨產卻沒歸國庫 退回法案</span><span class="push-ipdatetime"> 12/22 00:50 </span></div><div class="push"><span class="f1 hl push-tag">→ </span><span class="f3 hl push-userid">bndan</span><span class="f3 push-content">: 審判228 父債子償的話 有些___後代就要永久移民了 很不方便</span><span class="push-ipdatetime"> 12/22 10:14 </span></div></div> <div id="article-polling" data-pollurl="/poll/Gossiping/M.1419177776.A.144.html?cacheKey=2052-1305883696&amp;offset=8340&amp;offset-sig=724bed814898d887471f5e01d96e2d71a8f15d27" data-longpollurl="/v1/longpoll?id=a9f66cf868ece420a6a761aa734b8a5c5e2608e1" data-offset="8340">推文自動更新已關閉</div> <div class="bbs-screen bbs-footer-message">本網站已依台灣網站內容分級規定處理。此區域為限制級,未滿十八歲者不得瀏覽。</div> </div> <iframe name="oauth2relay427067518" id="oauth2relay427067518" src="https://accounts.google.com/o/oauth2/postmessageRelay?parent=https%3A%2F%2Fwww.ptt.cc#rpctoken=661152297&amp;forcesecure=1" style="width: 1px; height: 1px; position: absolute; top: -100px; " tabindex="-1"></iframe></body></html>
iultimatez/PTTScraper
result/M.1419177776.A.144.html
HTML
mit
31,763
import Foundation import RxSwift /// Subclass of MoyaProvider that returns Observable instances when requests are made. Much better than using completion closures. public class RxMoyaProvider<T where T: MoyaTarget>: MoyaProvider<T> { /// Current requests that have not completed or errored yet. /// Note: Do not access this directly. It is public only for unit-testing purposes (sigh). public var inflightRequests = Dictionary<Endpoint<T>, Observable<MoyaResponse>>() /// Initializes a reactive provider. override public init(endpointClosure: MoyaEndpointsClosure = MoyaProvider.DefaultEndpointMapping, endpointResolver: MoyaEndpointResolution = MoyaProvider.DefaultEnpointResolution, stubBehavior: MoyaStubbedBehavior = MoyaProvider.NoStubbingBehavior, networkActivityClosure: Moya.NetworkActivityClosure? = nil) { super.init(endpointClosure: endpointClosure, endpointResolver: endpointResolver, stubBehavior: stubBehavior, networkActivityClosure: networkActivityClosure) } /// Designated request-making method. public func request(token: T) -> Observable<MoyaResponse> { let endpoint = self.endpoint(token) return defer { [weak self] () -> Observable<MoyaResponse> in if let weakSelf = self { objc_sync_enter(weakSelf) let inFlight = weakSelf.inflightRequests[endpoint] objc_sync_exit(weakSelf) if let existingObservable = inFlight { return existingObservable } } let observable: Observable<MoyaResponse> = create { observer in let cancellableToken = self?.request(token) { (data, statusCode, response, error) -> () in if let error = error { if let statusCode = statusCode { sendError(observer, NSError(domain: error.domain, code: statusCode, userInfo: error.userInfo)) } else { sendError(observer, error) } } else { if let data = data { sendNext(observer, MoyaResponse(statusCode: statusCode!, data: data, response: response)) } sendCompleted(observer) } } return AnonymousDisposable { if let weakSelf = self { objc_sync_enter(weakSelf) weakSelf.inflightRequests[endpoint] = nil cancellableToken?.cancel() objc_sync_exit(weakSelf) } } } >- variable if let weakSelf = self { objc_sync_enter(weakSelf) weakSelf.inflightRequests[endpoint] = observable objc_sync_exit(weakSelf) } return observable } } }
Ezimetzhan/Moya
Moya/RxSwift/Moya+RxSwift.swift
Swift
mit
3,000
<?php namespace Model\Repository; use Model\Entity\Unit; use Model\Entity\User; use Exception; class SolutionRepository extends Repository { public function findSolutionToReview(Unit $unit, User $reviewer, $userLimit = TRUE, $unitLimit = TRUE) { $unitSolutionIds = $this->findIdsByUnit($unit); if (!count($unitSolutionIds)) { throw new SolutionToReviewNotFoundException(); return FALSE; } $reviewedByMeIds = $this->findReviewedByMe($reviewer, $unit); if ($userLimit && count($reviewedByMeIds) >= $unit->course->reviewCount) { throw new ReviewLimitReachedException(); return FALSE; } $groupedByReviewCount = $this->groupSolutionIdsByReviewCount( $unitSolutionIds, $reviewedByMeIds, $reviewer->id ); if (count($groupedByReviewCount) === 0) { throw new SolutionToReviewNotFoundException(); return FALSE; } $lowestReviewCount = min(array_keys($groupedByReviewCount)); if ($unitLimit && $lowestReviewCount >= $unit->course->reviewCount) { throw new SolutionToReviewNotFoundException(); return FALSE; } $randomId = array_rand($groupedByReviewCount[$lowestReviewCount]); return $this->find($randomId); } public function groupSolutionIdsByReviewCount($unitSolutionIds, $reviewedByMeIds, $reviewerId) { return $this->connection->query( 'SELECT solution.id, count(review.id) as reviewCount FROM solution LEFT JOIN review ON review.solution_id = solution.id WHERE solution.id IN %in', $unitSolutionIds, 'AND solution.id NOT IN %in', $reviewedByMeIds, 'AND solution.user_id != %i', $reviewerId, 'GROUP BY solution.id')->fetchAssoc('reviewCount,id'); } public function findReviewedByMe(User $reviewer, Unit $unit = null) { $ids = $this->connection->query( 'SELECT solution.id AS id FROM solution LEFT JOIN review ON solution.id = review.solution_id WHERE solution.unit_id = %i', $unit->id, 'AND reviewed_by_id = %i', $reviewer->id) ->fetchAssoc('id'); return count($ids) ? array_keys($ids) : array(0); } public function findIdsByUnit(Unit $unit) { $allSolutionIds = $this->connection->query( 'SELECT id FROM solution WHERE unit_id = %i', $unit->id)->fetchAssoc('id'); return array_keys($allSolutionIds); } /** * @param array */ public function findFavoriteByUnits($units) { $unitIds = array(); foreach ($units as $unit) { $unitIds[] = $unit->id; } $solutions = $this->connection->query('SELECT solution.id as solution_id, solution.*, unit_id, count(favorite.id) as favorites FROM solution LEFT JOIN favorite ON (favorite.entity = "Solution" AND favorite.entity_id = solution.id) WHERE unit_id IN %in', $unitIds, ' GROUP BY favorite.id, solution.id HAVING favorites > 0 ORDER BY favorites')->fetchAssoc('unit_id,solution_id'); foreach ($solutions as $unitKey => $unit) { foreach ($unit as $solutionKey => $solution) { $solutions[$unitKey][$solutionKey] = $this->createEntity($solution); } } return $solutions; } public function findFavoriteByUnit(Unit $unit) { $solutions = $this->connection->query('SELECT solution.*, count(favorite.id) as favorites FROM solution LEFT JOIN favorite ON (favorite.entity = "Solution" AND favorite.entity_id = solution.id) WHERE unit_id = %i', $unit->id, ' GROUP BY favorite.id, solution.id HAVING favorites > 0 ORDER BY favorites LIMIT 0, 5')->fetchAll(); return count($solutions) ? $this->createEntities($solutions) : array(); } } class SolutionToReviewNotFoundException extends Exception { } class ReviewLimitReachedException extends Exception { }
jan-martinek/peer-blender
app/model/Repository/SolutionRepository.php
PHP
mit
4,398
"use strict"; const expect = require('expect.js'); const formatArgs = require('../process/formatArgs'); const parseArgs = require('../process/parseArgs'); const splitArgs = require('../process/splitArgs'); const trim = require('mout/string/trim'); describe("Process functions", function() { it("Should test formatArgs", function() { expect(formatArgs({foo : 'foo', bar : 'bar'})).to.eql(["--foo=foo", "--bar=bar"]); expect(formatArgs({foo : 'foo', bar : 'bar'}, true)).to.eql(["--foo", "foo", "--bar", "bar"]); expect(formatArgs({foo : true, bar : 'bar'})).to.eql(["--foo", "--bar=bar"]); expect(formatArgs({foo : null})).to.eql([]); expect(formatArgs()).to.eql([]); expect(formatArgs({foo : [1, 2, 3]})).to.eql(["--foo=1", "--foo=2", "--foo=3"]); }); it("should test splitArgs on void", function() { //argv0 must be a string... expect(splitArgs()).to.eql([]); expect(splitArgs(false)).to.eql([]); expect(splitArgs(0)).to.eql([]); expect(splitArgs(null)).to.eql([]); expect(splitArgs("")).to.eql([]); expect(splitArgs(" ")).to.eql([]); expect(splitArgs(" 0")).to.eql([0]); expect(splitArgs(" 0 ")).to.eql([0]); expect(splitArgs(' "0" ')).to.eql(["0"]); }); it("should test splitArgs", function() { expect(splitArgs("--foo=42 bar -- --this --is --unparsed")).to.eql(["--foo=42", "bar", "--", "--this --is --unparsed"]); expect(splitArgs("--foo=42 bar -- --this --is --u'nparsed")).to.eql(["--foo=42", "bar", "--", "--this --is --u'nparsed"]); expect(splitArgs(" a b c d")).to.eql(["a", "b", "c", "d"]); expect(splitArgs("a 127.0.0.1 d")).to.eql(["a", "127.0.0.1", "d"]); expect(splitArgs("a 12 d")).to.eql(["a", 12, "d"]); expect(splitArgs("a 'b' c d")).to.eql(["a", "b", "c", "d"]); expect(splitArgs("a \"b\" c d")).to.eql(["a", "b", "c", "d"]); expect(splitArgs("a \"'b'\" c d")).to.eql(["a", "'b'", "c", "d"]); expect(splitArgs("a \"'b c'\" c d")).to.eql(["a", "'b c'", "c", "d"]); expect(splitArgs("a 'b c' c d 8")).to.eql(["a", "b c", "c", "d", 8]); expect(splitArgs("")).to.eql([]); expect(splitArgs('""')).to.eql(['']); expect(splitArgs('"0.124"')).to.eql([0.124]); expect(typeof splitArgs('"0.124"')[0]).to.eql("string"); expect(typeof splitArgs("12")[0]).to.eql("number"); expect(typeof splitArgs("0")[0]).to.eql("number"); }); it("should test splitArgs - multibloc", function() { expect(splitArgs("'foo''foobar'")).to.eql(["foofoobar"]); expect(splitArgs("'foo'kfdokf'fooo'")).to.eql(["fookfdokffooo"]); expect(splitArgs("'foo'kfd-- okf'fooo'")).to.eql(["fookfd--", "okffooo"]); var test = '"C:\\FOO Client\\app\\node-webkit\\nw.exe" --mixed-context --explicitly-allowed-ports=6000 --remote-debugging-port=0 --user-data-dir=./Data/.nwjscache --user-data-dir="C:\\FOO Client\\Data\\.nwjscache" --no-sandbox --no-zygote --flag-switches-begin --flag-switches-end --nwapp="App\\app" --original-process-start-time=13200767136475118 "App\\app" "Client\\nw.exe --autoload=demo"'; expect(splitArgs(test)).to.eql(['C:\\FOO Client\\app\\node-webkit\\nw.exe', '--mixed-context', '--explicitly-allowed-ports=6000', '--remote-debugging-port=0', '--user-data-dir=./Data/.nwjscache', '--user-data-dir=C:\\FOO Client\\Data\\.nwjscache', '--no-sandbox', '--no-zygote', '--flag-switches-begin', '--flag-switches-end', '--nwapp=App\\app', '--original-process-start-time=13200767136475118', 'App\\app', 'Client\\nw.exe --autoload=demo']); }); it("testing parseArgs", function() { expect(parseArgs(["--foo"])).to.eql({args : [], dict : {foo : true}, rest : undefined}); expect(parseArgs(["--foo="])).to.eql({args : [], dict : {foo : ''}, rest : undefined}); expect(parseArgs(['--foo=false'])).to.eql({args : [], dict : {foo : 'false'}, rest : undefined}); expect(parseArgs(["--foo", "bar"])).to.eql({args : ["bar"], dict : {foo : true}, rest : undefined}); expect(parseArgs(["bar", "--foo"])).to.eql({args : ["bar"], dict : {foo : true}, rest : undefined}); expect(parseArgs(["bar", "--foo", "baz"])).to.eql({args : ["bar", "baz"], dict : {foo : true}, rest : undefined}); expect(parseArgs(["--foo=42", "--foo=55"])).to.eql({args : [], dict : {foo : [42, 55]}, rest : undefined}); expect(parseArgs(["--foo=42", "--foo=55", "--foo"])).to.eql({args : [], dict : {foo : [42, 55, true]}, rest : undefined}); expect(parseArgs(["--foo=355f82ab-a1d0-4df3-94ab-f55a1b51bd14"])).to.eql({args : [], dict : {foo : '355f82ab-a1d0-4df3-94ab-f55a1b51bd14'}, rest : undefined}); expect(parseArgs(["--foo=127.10.10.1"])).to.eql({args : [], dict : {foo : '127.10.10.1'}, rest : undefined}); expect(parseArgs(splitArgs("--foo=42 bar -- --this --is --unparsed"))).to.eql({args : ["bar"], dict : {foo : 42}, rest : "--this --is --unparsed"}); }); it("testing parseArgs / json", function() { var foo = {"this" : "is", "a" : ["complex", null, 45, "object"]}; expect(parseArgs(["--foo::json=" + JSON.stringify(foo)])).to.eql({args : [], dict : {foo}, rest : undefined}); }); it("testing parseArgs / base64", function() { var foo = {"this" : "is", "a" : ["complex", null, 45, "object"]}; let input = trim(Buffer.from(JSON.stringify(foo)).toString('base64'), "="); expect(parseArgs(["--foo::json::base64=" + input])).to.eql({args : [], dict : {foo}, rest : undefined}); }); //invalid argument description are dropped it("should drop invalid args", function() { expect(parseArgs(["-=foo", "bar"])).to.eql({args : ["bar"], dict : {}, rest : undefined}); }); });
131/nyks
test/process.js
JavaScript
mit
5,691
/** * Pan.js v0.3 * https://github.com/arielsaldana/pan * * Released under the MIT license * https://github.com/arielsaldana/pan/blob/dev/LICENSE.txt * * Date: Tue Jan 05 2016 10:24:26 GMT-0500 (Eastern Standard Time) */ ( function( window, document, undefined ) { 'use strict'; /* * classList.js: Cross-browser full element.classList implementation. * 2014-07-23 * * By Eli Grey, http://eligrey.com * Public Domain. * NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. */ /*global self, document, DOMException */ /*! @source http://purl.eligrey.com/github/classList.js/blob/master/classList.js*/ if ("document" in self) { // Full polyfill for browsers with no classList support if (!("classList" in document.createElement("_"))) { (function (view) { "use strict"; if (!('Element' in view)) return; var classListProp = "classList" , protoProp = "prototype" , elemCtrProto = view.Element[protoProp] , objCtr = Object , strTrim = String[protoProp].trim || function () { return this.replace(/^\s+|\s+$/g, ""); } , arrIndexOf = Array[protoProp].indexOf || function (item) { var i = 0 , len = this.length ; for (; i < len; i++) { if (i in this && this[i] === item) { return i; } } return -1; } // Vendors: please allow content code to instantiate DOMExceptions , DOMEx = function (type, message) { this.name = type; this.code = DOMException[type]; this.message = message; } , checkTokenAndGetIndex = function (classList, token) { if (token === "") { throw new DOMEx( "SYNTAX_ERR" , "An invalid or illegal string was specified" ); } if (/\s/.test(token)) { throw new DOMEx( "INVALID_CHARACTER_ERR" , "String contains an invalid character" ); } return arrIndexOf.call(classList, token); } , ClassList = function (elem) { var trimmedClasses = strTrim.call(elem.getAttribute("class") || "") , classes = trimmedClasses ? trimmedClasses.split(/\s+/) : [] , i = 0 , len = classes.length ; for (; i < len; i++) { this.push(classes[i]); } this._updateClassName = function () { elem.setAttribute("class", this.toString()); }; } , classListProto = ClassList[protoProp] = [] , classListGetter = function () { return new ClassList(this); } ; // Most DOMException implementations don't allow calling DOMException's toString() // on non-DOMExceptions. Error's toString() is sufficient here. DOMEx[protoProp] = Error[protoProp]; classListProto.item = function (i) { return this[i] || null; }; classListProto.contains = function (token) { token += ""; return checkTokenAndGetIndex(this, token) !== -1; }; classListProto.add = function () { var tokens = arguments , i = 0 , l = tokens.length , token , updated = false ; do { token = tokens[i] + ""; if (checkTokenAndGetIndex(this, token) === -1) { this.push(token); updated = true; } } while (++i < l); if (updated) { this._updateClassName(); } }; classListProto.remove = function () { var tokens = arguments , i = 0 , l = tokens.length , token , updated = false , index ; do { token = tokens[i] + ""; index = checkTokenAndGetIndex(this, token); while (index !== -1) { this.splice(index, 1); updated = true; index = checkTokenAndGetIndex(this, token); } } while (++i < l); if (updated) { this._updateClassName(); } }; classListProto.toggle = function (token, force) { token += ""; var result = this.contains(token) , method = result ? force !== true && "remove" : force !== false && "add" ; if (method) { this[method](token); } if (force === true || force === false) { return force; } else { return !result; } }; classListProto.toString = function () { return this.join(" "); }; if (objCtr.defineProperty) { var classListPropDesc = { get: classListGetter , enumerable: true , configurable: true }; try { objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc); } catch (ex) { // IE 8 doesn't support enumerable:true if (ex.number === -0x7FF5EC54) { classListPropDesc.enumerable = false; objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc); } } } else if (objCtr[protoProp].__defineGetter__) { elemCtrProto.__defineGetter__(classListProp, classListGetter); } }(self)); } else { // There is full or partial native classList support, so just check if we need // to normalize the add/remove and toggle APIs. (function () { "use strict"; var testElement = document.createElement("_"); testElement.classList.add("c1", "c2"); // Polyfill for IE 10/11 and Firefox <26, where classList.add and // classList.remove exist but support only one argument at a time. if (!testElement.classList.contains("c2")) { var createMethod = function(method) { var original = DOMTokenList.prototype[method]; DOMTokenList.prototype[method] = function(token) { var i, len = arguments.length; for (i = 0; i < len; i++) { token = arguments[i]; original.call(this, token); } }; }; createMethod('add'); createMethod('remove'); } testElement.classList.toggle("c3", false); // Polyfill for IE 10 and Firefox <24, where classList.toggle does not // support the second argument. if (testElement.classList.contains("c3")) { var _toggle = DOMTokenList.prototype.toggle; DOMTokenList.prototype.toggle = function(token, force) { if (1 in arguments && !this.contains(token) === !force) { return force; } else { return _toggle.call(this, token); } }; } testElement = null; }()); } } // ECMA-262, Edition 5, 15.4.4.18 // Référence: http://es5.github.io/#x15.4.4.18 if (!Array.prototype.forEach) { Array.prototype.forEach = function(callback, thisArg) { var T, k; if (this == null) { throw new TypeError(' this vaut null ou n est pas défini'); } // 1. Soit O le résultat de l'appel à ToObject // auquel on a passé |this| en argument. var O = Object(this); // 2. Soit lenValue le résultat de l'appel de la méthode // interne Get sur O avec l'argument "length". // 3. Soit len la valeur ToUint32(lenValue). var len = O.length >>> 0; // 4. Si IsCallable(callback) est false, on lève une TypeError. // Voir : http://es5.github.com/#x9.11 if (typeof callback !== "function") { throw new TypeError(callback + ' n est pas une fonction'); } // 5. Si thisArg a été fourni, soit T ce thisArg ; // sinon soit T égal à undefined. if (arguments.length > 1) { T = thisArg; } // 6. Soit k égal à 0 k = 0; // 7. On répète tant que k < len while (k < len) { var kValue; // a. Soit Pk égal ToString(k). // (implicite pour l'opérande gauche de in) // b. Soit kPresent le résultat de l'appel de la // méthode interne HasProperty de O avec l'argument Pk. // Cette étape peut être combinée avec c // c. Si kPresent vaut true, alors if (k in O) { // i. Soit kValue le résultat de l'appel de la // méthode interne Get de O avec l'argument Pk. kValue = O[k]; // ii. On appelle la méthode interne Call de callback // avec T comme valeur this et la liste des arguments // qui contient kValue, k, et O. callback.call(T, kValue, k, O); } // d. On augmente k de 1. k++; } // 8. on renvoie undefined }; } if (!window.getComputedStyle) { window.getComputedStyle = function(el, pseudo) { this.el = el; this.getPropertyValue = function(prop) { var re = /(\-([a-z]){1})/g; if (prop == 'float') prop = 'styleFloat'; if (re.test(prop)) { prop = prop.replace(re, function () { return arguments[2].toUpperCase(); }); } return el.currentStyle[prop] ? el.currentStyle[prop] : null; } return this; } } if( !window.HTMLElement ) window.HTMLElement = window.Element; // Production steps of ECMA-262, Edition 5, 15.4.4.14 // Reference: http://es5.github.io/#x15.4.4.14 if (!Array.prototype.indexOf) { Array.prototype.indexOf = function(searchElement, fromIndex) { var k; // 1. Let O be the result of calling ToObject passing // the this value as the argument. if (this == null) { throw new TypeError('"this" is null or not defined'); } var O = Object(this); // 2. Let lenValue be the result of calling the Get // internal method of O with the argument "length". // 3. Let len be ToUint32(lenValue). var len = O.length >>> 0; // 4. If len is 0, return -1. if (len === 0) { return -1; } // 5. If argument fromIndex was passed let n be // ToInteger(fromIndex); else let n be 0. var n = +fromIndex || 0; if (Math.abs(n) === Infinity) { n = 0; } // 6. If n >= len, return -1. if (n >= len) { return -1; } // 7. If n >= 0, then Let k be n. // 8. Else, n<0, Let k be len - abs(n). // If k is less than 0, then let k be 0. k = Math.max(n >= 0 ? n : len - Math.abs(n), 0); // 9. Repeat, while k < len while (k < len) { // a. Let Pk be ToString(k). // This is implicit for LHS operands of the in operator // b. Let kPresent be the result of calling the // HasProperty internal method of O with argument Pk. // This step can be combined with c // c. If kPresent is true, then // i. Let elementK be the result of calling the Get // internal method of O with the argument ToString(k). // ii. Let same be the result of applying the // Strict Equality Comparison Algorithm to // searchElement and elementK. // iii. If same is true, return k. if (k in O && O[k] === searchElement) { return k; } k++; } return -1; }; } // From MDN - https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux/Object/create if (typeof Object.create != 'function') { Object.create = (function() { var Temp = function() {}; return function (prototype) { if (arguments.length > 1) { throw Error('Cette prothèse ne supporte pas le second argument'); } if (typeof prototype != 'object') { throw TypeError('L\'argument doit être un objet'); } Temp.prototype = prototype; var result = new Temp(); Temp.prototype = null; return result; }; })(); } // From MDN - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys if (!Object.keys) { Object.keys = (function () { 'use strict'; var hasOwnProperty = Object.prototype.hasOwnProperty, hasDontEnumBug = !({toString: null}).propertyIsEnumerable('toString'), dontEnums = [ 'toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'constructor' ], dontEnumsLength = dontEnums.length; return function (obj) { if (typeof obj !== 'object' && (typeof obj !== 'function' || obj === null)) { throw new TypeError('Object.keys called on non-object'); } var result = [], prop, i; for (prop in obj) { if (hasOwnProperty.call(obj, prop)) { result.push(prop); } } if (hasDontEnumBug) { for (i = 0; i < dontEnumsLength; i++) { if (hasOwnProperty.call(obj, dontEnums[i])) { result.push(dontEnums[i]); } } } return result; }; }()); } // http://paulirish.com/2011/requestanimationframe-for-smart-animating/ // http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating // requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel // MIT license (function() { var lastTime = 0; var vendors = ['ms', 'moz', 'webkit', 'o']; for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame']; window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame'] || window[vendors[x]+'CancelRequestAnimationFrame']; } if (!window.requestAnimationFrame) window.requestAnimationFrame = function(callback, element) { var currTime = new Date().getTime(); var timeToCall = Math.max(0, 16 - (currTime - lastTime)); var id = window.setTimeout(function() { callback(currTime + timeToCall); }, timeToCall); lastTime = currTime + timeToCall; return id; }; if (!window.cancelAnimationFrame) window.cancelAnimationFrame = function(id) { clearTimeout(id); }; }()); // Simple structure var P = { Core : {}, Tools : {}, Components : {} }; /** * Simple JavaScript Inheritance * By John Resig http://ejohn.org/blog/simple-javascript-inheritance/ * MIT Licensed. * Inspired by base2 and Prototype */ P.copy = function( object ) { var c = null; // Simple object (exclude jQuery object, HTML Element, THREE js, ...) if( typeof object === 'undefined' || ( object && object.constructor === Object ) ) { c = {}; for( var key in object ) c[ key ] = P.copy( object[ key ] ); return c; } // Array else if( object instanceof Array ) { c = []; for( var i = 0, l = object.length; i < l; i++ ) c[ i ] = P.copy( object[ i ] ); return c; } // Other else { return object; } }; P.merge = function( original, extended ) { for( var key in extended ) { var ext = extended[ key ]; if( ext.constructor === Object ) { if( !original[ key ] ) original[ key ] = {}; // ext = Object.create( ext ); original[ key ] = P.merge( original[ key ], ext ); } else { original[ key ] = ext; } } return original; }; var initializing = false, fnTest = /xyz/.test( function() { xyz; } ) ? /\b_super\b/ : /.*/; P.Class = function(){}; var inject = function( prop ) { var proto = this.prototype, _super = {}; for( var name in prop ) { if( typeof prop[ name ] === 'function' && typeof proto[ name ] === 'function' && fnTest.test( prop[ name ] ) ) { _super[ name ] = proto[ name ]; proto[ name ] = ( function( name, fn ) { return function() { var tmp = this._super; this._super = _super[ name ]; var ret = fn.apply( this, arguments ); this._super = tmp; return ret; }; } )( name, prop[ name ] ); } else { proto[ name ] = prop[ name ]; } } }; P.Class.extend = function( prop ) { var _super = this.prototype; initializing = true; var prototype = new this(); initializing = false; for( var name in prop ) { if( typeof prop[ name ] === 'function' && typeof _super[ name ] === 'function' && fnTest.test( prop[ name ] ) ) { prototype[ name ] = ( function( name, fn ) { return function() { var tmp = this._super; this._super = _super[ name ]; var ret = fn.apply( this, arguments ); this._super = tmp; return ret; }; } )( name, prop[ name ] ); } else { if( name === 'options' ) { if( typeof prototype[ name ] === 'undefined' ) prototype[ name ] = {}; var prototype_copy = P.copy( prototype[ name ] ), prop_copy = P.copy( prop[ name ] ); prototype[ name ] = P.merge( prototype_copy, prop_copy ); } else { prototype[ name ] = prop[ name ]; } } } function Class() { if( !initializing ) { if( this.static_instantiate ) { var obj = this.static_instantiate.apply( this, arguments ); if( obj ) return obj; } for( var p in this ) { if( typeof this[ p ] === 'object' ) { this[ p ] = P.copy( this[ p ] ); } } if( this.construct ) { this.construct.apply( this, arguments ); } else if( this.init ) { this.init.apply( this, arguments ); } } return this; } Class.prototype = prototype; Class.prototype.constructor = Class; Class.extend = P.Class.extend; Class.inject = inject; return Class; }; /** * @class Abstract * @author Ariel Saldana / http://ahhriel.com */ P.Core.Abstract = P.Class.extend( { options : {}, static : false, /** * Initialise and merge options * @constructor * @param {object} options Properties to merge with defaults */ construct : function( options ) { if( typeof options === 'undefined' ) options = {}; P.merge( this.options, options ); this.$ = {}; // Create statics container if( typeof P.Statics !== 'object' ) P.Statics = {}; // Register if( options.register && typeof options.register === 'string' ) { var registry = new P.Tools.Registry(); registry.set( options.register, this ); } // Static if( this.static && typeof this.static === 'string' ) { // Add instance to statics P.Statics[ this.static ] = this; } }, /** * True constructur used first to return class if static * @return {class|null} Return class if static or null if default */ static_instantiate : function() { if( P.Statics && P.Statics[ this.static ] ) return P.Statics[ this.static ]; else return null; }, /** * Destroy */ destroy : function() { } } ); /** * @class Event Emmiter * @author Ariel Saldana / http://ahhriel.com */ P.Core.EventEmitter = P.Core.Event_Emitter = P.Core.Abstract.extend( { static : false, options : {}, /** * Initialise and merge options * @constructor * @param {object} options Properties to merge with defaults */ construct : function( options ) { this._super( options ); this.callbacks = {}; this.callbacks.base = {}; }, /** * Start listening specified events * @param {string} names Events names (can contain namespace) * @param {function} callback Function to apply if events are triggered * @return {object} Context * @example * * on( 'event-1.namespace event-2.namespace event-3', function( value ) * { * console.log( 'fire !', value ); * } ); */ on : function( names, callback ) { var that = this; // Errors if( typeof names === 'undefined' || names === '' ) { console.warn( 'wrong names' ); return false; } if( typeof callback === 'undefined' ) { console.warn( 'wrong callback' ); return false; } // Resolve names names = this.resolve_names( names ); // Each name names.forEach( function( name ) { // Resolve name name = that.resolve_name( name ); // Create namespace if not exist if( !( that.callbacks[ name.namespace ] instanceof Object ) ) that.callbacks[ name.namespace ] = {}; // Create callback if not exist if( !( that.callbacks[ name.namespace ][ name.value ] instanceof Array ) ) that.callbacks[ name.namespace ][ name.value ] = []; // Add callback that.callbacks[ name.namespace ][ name.value ].push( callback ); }); return this; }, /** * Stop listening specified events * @param {string} names Events names (can contain namespace or be the namespace only) * @return {object} Context * @example * * off( 'event-1 event-2' ); * * off( 'event-3.namespace' ); * * off( '.namespace' ); * */ off : function( names ) { var that = this; // Errors if( typeof names === 'undefined' || names === '' ) { console.warn( 'wrong name' ); return false; } // Resolve names names = this.resolve_names( names ); // Each name names.forEach( function( name ) { // Resolve name name = that.resolve_name( name ); // Remove namespace if( name.namespace !== 'base' && name.value === '' ) { delete that.callbacks[ name.namespace ]; } // Remove specific callback in namespace else { // Default if( name.namespace === 'base' ) { // Try to remove from each namespace for( var namespace in that.callbacks ) { if( that.callbacks[ namespace ] instanceof Object && that.callbacks[ namespace ][ name.value ] instanceof Array ) { delete that.callbacks[ namespace ][ name.value ]; // Remove namespace if empty if( Object.keys(that.callbacks[ namespace ] ).length === 0 ) delete that.callbacks[ namespace ]; } } } // Specified namespace else if( that.callbacks[ name.namespace ] instanceof Object && that.callbacks[ name.namespace ][ name.value ] instanceof Array ) { delete that.callbacks[ name.namespace ][ name.value ]; // Remove namespace if empty if( Object.keys( that.callbacks[ name.namespace ] ).length === 0 ) delete that.callbacks[ name.namespace ]; } } }); return this; }, /** * Fires event * @param {string} name Event name (single) * @param {array} args Arguments to send to callbacks * @return {boolean} First value sent by the callbacks applieds */ trigger : function( name, args ) { // Errors if( typeof name === 'undefined' || name === '' ) { console.warn( 'wrong name' ); return false; } var that = this, final_result, result; // Default args if( !( args instanceof Array ) ) args = []; // Resolve names (should on have one event) name = this.resolve_names( name ); // Resolve name name = that.resolve_name( name[ 0 ] ); // Default namespace if( name.namespace === 'base' ) { // Try to find callback in each namespace for( var namespace in that.callbacks ) { if( that.callbacks[ namespace ] instanceof Object && that.callbacks[ namespace ][ name.value ] instanceof Array ) { that.callbacks[ namespace ][ name.value ].forEach( function( callback ) { result = callback.apply( that,args ); if( typeof final_result === 'undefined' ) final_result = result; } ); } } } // Specified namespace else if( this.callbacks[ name.namespace ] instanceof Object ) { if( name.value === '' ) { console.warn( 'wrong name' ); return this; } that.callbacks[ name.namespace ][ name.value ].forEach( function( callback ) { result = callback.apply( that, args ); if( typeof final_result === 'undefined' ) final_result = result; }); } return final_result; }, /** * Trigga wut say wut */ trigga : function( name, args ) { return this.trigger( name, args ); }, /** * Dispatch */ dispatch : function( name, args ) { return this.trigger( name, args ); }, /** * Fire everything ! * https://www.youtube.com/watch?v=1Io0OQ2zPS4 */ fire : function( name, args ) { return this.trigger( name, args ); }, /** * Resolve events names * @param {string} names Events names * @return {array} Array of names (with namespace included in name) */ resolve_names : function( names ) { names = names.replace( /[^a-zA-Z0-9 ,\/.]/g, '' ); names = names.replace( /[,\/]+/g, ' ' ); names = names.split( ' ' ); return names; }, /** * Resolve event name * @param {string} name Event name * @return {object} Event object containing original name, real event name and namespace */ resolve_name : function( name ) { var new_name = {}, parts = name.split( '.' ); new_name.original = name; new_name.value = parts[ 0 ]; new_name.namespace = 'base'; // Base namespace // Specified namespace if( parts.length > 1 && parts[ 1 ] !== '' ) new_name.namespace = parts[ 1 ]; return new_name; } } ); /** * @class Breakpoints * @author Ariel Saldana / http://ahhriel.com * @fires update * @fires change * @requires P.Tools.Viewport */ P.Tools.Breakpoints = P.Core.Event_Emitter.extend( { static : 'breakpoints', options : { breakpoints : [] }, /** * Initialise and merge options * @constructor * @param {object} options Properties to merge with defaults */ construct : function( options ) { this._super( options ); // Set up this.viewport = new P.Tools.Viewport(); this.all = {}; this.actives = {}; this.first_test = true; // Initial breakpoints this.add( this.options.breakpoints ); // Init this.init_events(); }, /** * Listen to events * @return {object} Context */ init_events : function() { var that = this; // Viewport resize event this.viewport.on( 'resize', function() { // Test breakpoints that.test(); } ); return this; }, /** * Add one breakpoint * @param {object} breakpoint Breakpoint informations * @return {object} Context * @example * add( { * name : 'large', * width : * { * value : 960, * extreme : 'min', * included : false * } * } ) * @example * add_breakpoints( [ * { * name : 'large', * width : * { * value : 960, * extreme : 'min', * included : false * } * }, * { * name : 'medium', * width : * { * value : 960, * extreme : 'max', * included : true * } * }, * { * name : 'small', * width : * { * value : 500, * extreme : 'max', * included : true * }, * height : * { * value : 500, * extreme : 'max', * included : true * } * } * ] ) * */ add : function( breakpoints, silent ) { // Default silent = typeof silent === 'undefined' ? true : false; // Force array if( !( breakpoints instanceof Array ) ) breakpoints = [ breakpoints ]; // Add each one to breakpoints for( var i = 0; i < breakpoints.length; i++ ) { var breakpoint = breakpoints[ i ]; this.all[ breakpoint.name ] = breakpoint; } // Test breakpoints if( !silent ) this.test(); return this; }, /** * Remove one breakpoint * @param {string} breakpoint Breakpoint name (can be the breakpoint object itself) * @return {object} Context */ remove : function( breakpoints, silent ) { // Force array if( !( breakpoints instanceof Array ) ) breakpoints = [ breakpoints ]; // Object breakpoint if( typeof breakpoint === 'object' && typeof breakpoint.name === 'string' ) breakpoint = breakpoint.name; // Default silent = typeof silent === 'undefined' ? false : true; // Add each one to breakpoints for( var i = 0; i < breakpoints.length; i++ ) { delete this.all[ breakpoints[ i ] ]; } // Test breakpoints if( !silent ) this.test(); return this; }, /** * Test every breakpoint and trigger 'update' event if current breakpoint changed * @return {object} Context */ test : function() { // Set up var current_breakpoints = {}, all_names = Object.keys( this.all ); // Each breakpoint for( var i = 0, len = all_names.length; i < len; i++ ) { // Set up var breakpoint = this.all[ all_names[ i ] ], width = !breakpoint.width, height = !breakpoint.height; // Width must be tested if( !width ) { // Min if( breakpoint.width.extreme === 'min' ) { if( // Included ( breakpoint.width.included && this.viewport.width >= breakpoint.width.value ) || // Not included ( !breakpoint.width.included && this.viewport.width > breakpoint.width.value ) ) width = true; } // Max else { if( // Included ( breakpoint.width.included && this.viewport.width <= breakpoint.width.value ) || // Not included ( !breakpoint.width.included && this.viewport.width < breakpoint.width.value ) ) width = true; } } // Height must be tested if( !height ) { // Min if( breakpoint.height.extreme === 'min' ) { if( // Included ( breakpoint.height.included && this.viewport.height >= breakpoint.height.value ) || // Not included ( !breakpoint.height.included && this.viewport.height > breakpoint.height.value ) ) height = true; } // Max else { if( // Included ( breakpoint.height.included && this.viewport.height <= breakpoint.height.value ) || // Not included ( !breakpoint.height.included && this.viewport.height < breakpoint.height.value ) ) height = true; } } if( width && height ) { current_breakpoints[ breakpoint.name ] = breakpoint; } } // Set up var current_names = Object.keys( current_breakpoints ), old_names = Object.keys( this.actives ), difference = this.get_arrays_differences( current_names, old_names ); if( difference.length || this.first_test ) { // Set actives this.actives = current_breakpoints; this.first_test = false; // Trigger this.trigger( 'update change', [ this.actives ] ); } return this; }, /** * Test if breakpoint is active * @param {string} breakpoint Breakpoint name (can be the breakpoint object itself) * @return {boolean} True or false depending on if the breakpoint is active */ is_active : function( breakpoint ) { // Object breakpoint if( typeof breakpoint === 'object' && typeof breakpoint.name === 'string' ) breakpoint = breakpoint.name; return typeof this.actives[ breakpoint ] !== 'undefined'; }, /** * Get differences between two arrays * @param {array} a First array * @param {array} b Second array * @return {array} Items in one but not in the other */ get_arrays_differences : function( a, b ) { var a_new = [], diff = []; for( var i = 0; i < a.length; i++ ) a_new[ a[ i ] ] = true; for( i = 0; i < b.length; i++ ) { if( a_new[ b[ i ] ] ) delete a_new[ b[ i ] ]; else a_new[ b[ i ] ] = true; } for( var k in a_new ) diff.push( k ); return diff; } } ); /** * @class Colors * @author Ariel Saldana / http://ahhriel.com */ P.Tools.Colors = P.Core.Abstract.extend( { static : 'colors', options : { gradients : { parse : true, target : document.body, classes : { to_convert : 'b-gradient-text', converted : 'b-gradient-text-converted', } } }, names : { 'aliceblue' : 'F0F8FF', 'antiquewhite' : 'FAEBD7', 'aqua' : '00FFFF', 'aquamarine' : '7FFFD4', 'azure' : 'F0FFFF', 'beige' : 'F5F5DC', 'bisque' : 'FFE4C4', 'black' : '000000', 'blanchedalmond' : 'FFEBCD', 'blue' : '0000FF', 'blueviolet' : '8A2BE2', 'brown' : 'A52A2A', 'burlywood' : 'DEB887', 'cadetblue' : '5F9EA0', 'chartreuse' : '7FFF00', 'chocolate' : 'D2691E', 'coral' : 'FF7F50', 'cornflowerblue' : '6495ED', 'cornsilk' : 'FFF8DC', 'crimson' : 'DC143C', 'cyan' : '00FFFF', 'darkblue' : '00008B', 'darkcyan' : '008B8B', 'darkgoldenrod' : 'B8860B', 'darkgray' : 'A9A9A9', 'darkgreen' : '006400', 'darkkhaki' : 'BDB76B', 'darkmagenta' : '8B008B', 'darkolivegreen' : '556B2F', 'darkorange' : 'FF8C00', 'darkorchid' : '9932CC', 'darkred' : '8B0000', 'darksalmon' : 'E9967A', 'darkseagreen' : '8FBC8F', 'darkslateblue' : '483D8B', 'darkslategray' : '2F4F4F', 'darkturquoise' : '00CED1', 'darkviolet' : '9400D3', 'deeppink' : 'FF1493', 'deepskyblue' : '00BFFF', 'dimgray' : '696969', 'dodgerblue' : '1E90FF', 'firebrick' : 'B22222', 'floralwhite' : 'FFFAF0', 'forestgreen' : '228B22', 'fuchsia' : 'FF00FF', 'gainsboro' : 'DCDCDC', 'ghostwhite' : 'F8F8FF', 'gold' : 'FFD700', 'goldenrod' : 'DAA520', 'gray' : '808080', 'green' : '008000', 'greenyellow' : 'ADFF2F', 'honeydew' : 'F0FFF0', 'hotpink' : 'FF69B4', 'indianred' : 'CD5C5C', 'indigo' : '4B0082', 'ivory' : 'FFFFF0', 'khaki' : 'F0E68C', 'lavender' : 'E6E6FA', 'lavenderblush' : 'FFF0F5', 'lawngreen' : '7CFC00', 'lemonchiffon' : 'FFFACD', 'lightblue' : 'ADD8E6', 'lightcoral' : 'F08080', 'lightcyan' : 'E0FFFF', 'lightgoldenrodyellow' : 'FAFAD2', 'lightgray' : 'D3D3D3', 'lightgreen' : '90EE90', 'lightpink' : 'FFB6C1', 'lightsalmon' : 'FFA07A', 'lightseagreen' : '20B2AA', 'lightskyblue' : '87CEFA', 'lightslategray' : '778899', 'lightsteelblue' : 'B0C4DE', 'lightyellow' : 'FFFFE0', 'lime' : '00FF00', 'limegreen' : '32CD32', 'linen' : 'FAF0E6', 'magenta' : 'FF00FF', 'maroon' : '800000', 'mediumaquamarine' : '66CDAA', 'mediumblue' : '0000CD', 'mediumorchid' : 'BA55D3', 'mediumpurple' : '9370DB', 'mediumseagreen' : '3CB371', 'mediumslateblue' : '7B68EE', 'mediumspringgreen' : '00FA9A', 'mediumturquoise' : '48D1CC', 'mediumvioletred' : 'C71585', 'midnightblue' : '191970', 'mintcream' : 'F5FFFA', 'mistyrose' : 'FFE4E1', 'moccasin' : 'FFE4B5', 'navajowhite' : 'FFDEAD', 'navy' : '000080', 'oldlace' : 'FDF5E6', 'olive' : '808000', 'olivedrab' : '6B8E23', 'orange' : 'FFA500', 'orangered' : 'FF4500', 'orchid' : 'DA70D6', 'palegoldenrod' : 'EEE8AA', 'palegreen' : '#98FB98', 'paleturquoise' : '#AFEEEE', 'palevioletred' : '#DB7093', 'papayawhip' : '#FFEFD5', 'peachpuff' : '#FFDAB9', 'peru' : '#CD853F', 'pink' : '#FFC0CB', 'plum' : '#DDA0DD', 'powderblue' : '#B0E0E6', 'purple' : '#800080', 'rebeccapurple' : '#663399', 'red' : '#FF0000', 'rosybrown' : '#BC8F8F', 'royalblue' : '#4169E1', 'saddlebrown' : '#8B4513', 'salmon' : '#FA8072', 'sandybrown' : '#F4A460', 'seagreen' : '#2E8B57', 'seashell' : '#FFF5EE', 'sienna' : '#A0522D', 'silver' : '#C0C0C0', 'skyblue' : '#87CEEB', 'slateblue' : '#6A5ACD', 'slategray' : '#708090', 'snow' : '#FFFAFA', 'springgreen' : '#00FF7F', 'steelblue' : '#4682B4', 'tan' : '#D2B48C', 'teal' : '#008080', 'thistle' : '#D8BFD8', 'tomato' : '#FF6347', 'turquoise' : '#40E0D0', 'violet' : '#EE82EE', 'wheat' : '#F5DEB3', 'white' : '#FFFFFF', 'whitesmoke' : '#F5F5F5', 'yellow' : '#FFFF00', 'yellowgreen' : '#9ACD32' }, /** * Initialise and merge options * @constructor * @param {object} options Properties to merge with defaults */ construct : function( options ) { this._super( options ); if( this.options.gradients.parse ) this.parse(); }, /** * Try to convert any data to RGB object * @param {any} Any color format * @return {object} RGB object */ any_to_rgb : function( input ) { input = '' + input; // String input = input.toLowerCase(); // Lower case input = input.replace(/[\s-]/g,''); // No spaces // Name if( typeof this.names[ input ] !== 'undefined' ) { return this.hexa_to_rgb( this.names[ input ] ); } // '0x' Hexa type if( input.indexOf( '0x' ) === 0 ) { return this.hexa_to_rgb( input.replace( '0x', '' ) ); } // '#' Hexa type if( input.indexOf( '#' ) === 0 ) { input = input.replace( '#', '' ); } // XXXXXX hexa type if( input.length === 6 ) { return this.hexa_to_rgb( input ); } // XXX hexa type if( input.length === 3 ) { var new_input = ''; for( var i = 0; i < input.length; i++ ) new_input += input[ i ] + input[ i ]; return this.hexa_to_rgb( new_input ); } // Objects try { input = JSON.parse( input ); if( typeof input.r !== 'undefined' && typeof input.g !== 'undefined' && typeof input.b !== 'undefined' ) { return input; } else if( typeof input.h !== 'undefined' && typeof input.s !== 'undefined' && typeof input.l !== 'undefined' ) { return this.hsl_to_rgb( input ); } } catch( e ){} // No type found console.warn( 'Wrong color value : ' + input ); return { r : 0, g : 0, b : 0 }; }, /** * Parse the target looking for text to convert to gradients * @param {HTMLElement} target HTML target (default body) * @param {string} selector Query selector * @return {object} Context */ parse : function( target, selector ) { // Defaults target = target || this.options.gradients.target; selector = selector || this.options.gradients.classes.to_convert; var that = this, elements = target.querySelectorAll( '.' + selector ); // Each element for( var i = 0, i_len = elements.length; i < i_len; i++ ) { var element = elements[ i ]; if( !element.classList.contains( this.options.gradients.classes.converted ) ) { var beautified = '', text = element.innerText, start = element.getAttribute( 'data-gradient-start' ), end = element.getAttribute( 'data-gradient-end' ), steps = null; if( !start ) start = '#47add9'; if( !end ) end = '#3554e9'; steps = that.get_steps_colors( start, end, text.length, 'rgb' ); for( var j = 0, j_len = text.length; j < j_len; j++ ) { beautified += '<span style="color:rgb(' + steps[ j ].r + ',' + steps[ j ].g + ',' + steps[ j ].b + ')">' + text[ j ] + '</span>'; } element.innerHTML = beautified; } } // $texts.each( function() // { // var $text = $( this ), // new_text = '', // text = $text.text(), // start = $text.data( 'gradient-start' ), // end = $text.data( 'gradient-end' ), // steps = null; // if( !start ) // start = '#47add9'; // if( !end ) // end = '#3554e9'; // steps = that.get_steps_colors( start, end, text.length, 'rgb' ); // for( var i = 0; i < text.length; i++ ) // { // new_text += '<span style="color:rgb(' + steps[ i ].r + ',' + steps[ i ].g + ',' + steps[ i ].b + ')">' + text[ i ] + '</span>'; // } // $text.html( new_text ); // } ); return this; }, /** * Retrieve every step color between the start and end color * @param {any} start Any color format * @param {any} end Any color format * @param {integer} count Number of steps * @param {string} format 'rgb' or 'hsl' * @return {array} Array of HSL or RGB objects */ get_steps_colors : function( start, end, count, format ) { if( typeof count !== 'number' || count < 2 ) count = 2; start = this.rgb_to_hsl( this.any_to_rgb( start ) ); end = this.rgb_to_hsl( this.any_to_rgb( end ) ); var steps = [], ratio = 0, step = {}; for( var i = 0; i < count + 1; i++ ) { ratio = i / count; step.h = start.h + ( end.h - start.h ) * ratio; step.s = start.s + ( end.s - start.s ) * ratio; step.l = start.l + ( end.l - start.l ) * ratio; if( format === 'rgb' ) step = this.hsl_to_rgb( step ); steps.push( step ); } return steps; }, /** * Convert from hexa to RGB * @param {string} input Hexa code in 6 char length format * @return {object} RGB object */ hexa_to_rgb : function( input ) { var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec( input ); return { r : parseInt( result[ 1 ], 16 ), g : parseInt( result[ 2 ], 16 ), b : parseInt( result[ 3 ], 16 ) }; }, /** * Convert from RGB to HSL * @param {object} input RGB object * @return {object} HSL object */ rgb_to_hsl : function( input ) { input.r /= 255; input.g /= 255; input.b /= 255; var max = Math.max( input.r, input.g, input.b ), min = Math.min( input.r, input.g, input.b ), color_hsl = {}; color_hsl.h = ( max + min ) / 2; color_hsl.s = ( max + min ) / 2; color_hsl.l = ( max + min ) / 2; if( max === min ) { color_hsl.h = 0; color_hsl.s = 0; } else { var d = max - min; color_hsl.s = color_hsl.l > 0.5 ? d / ( 2 - max - min ) : d / ( max + min ); switch( max ) { case input.r : color_hsl.h = ( input.g - input.b ) / d + ( input.g < input.b ? 6 : 0 ); break; case input.g : color_hsl.h = ( input.b - input.r ) / d + 2; break; case input.b : color_hsl.h = ( input.r - input.g ) / d + 4; break; } color_hsl.h /= 6; } return color_hsl; }, /** * Convert from HSL to RGB * @param {object} input HSL object * @return {object} RGB object */ hsl_to_rgb : function( input ) { var color_rgb = {}; if( input.s === 0 ) { color_rgb.r = input.l; color_rgb.g = input.l; color_rgb.b = input.l; } else { var hue2rgb = function hue2rgb( p, q, t ) { if( t < 0 ) t += 1; if( t > 1 ) t -= 1; if( t < 1 / 6 ) return p + ( q - p ) * 6 * t; if( t < 1 / 2 ) return q; if( t < 2 / 3 ) return p + ( q - p ) * ( 2 / 3 - t ) * 6; return p; }; var q = input.l < 0.5 ? input.l * (1 + input.s) : input.l + input.s - input.l * input.s; var p = 2 * input.l - q; color_rgb.r = hue2rgb( p, q, input.h + 1 / 3 ); color_rgb.g = hue2rgb( p, q, input.h ); color_rgb.b = hue2rgb( p, q, input.h - 1 / 3 ); } color_rgb.r = Math.round( color_rgb.r * 255 ); color_rgb.g = Math.round( color_rgb.g * 255 ); color_rgb.b = Math.round( color_rgb.b * 255 ); return color_rgb; } } ); /** * @class Css * @author Ariel Saldana / http://ahhriel.com * @requires P.Tools.Detector */ P.Tools.Css = P.Core.Abstract.extend( { static : 'css', options : { prefixes : [ 'webkit', 'moz', 'o', 'ms', '' ] }, /** * Initialise and merge options * @constructor * @param {object} options Properties to merge with defaults */ construct : function( options ) { this._super( options ); this.detector = new P.Tools.Detector(); this.strings = new P.Tools.Strings(); }, /** * Apply css on target and add every prefixes * @param {HTMLElement} target HTML element that need to be applied * @param {object} style CSS style * @param {array} prefixes Array of prefixes (default from options) * @param {boolean} clean Should clean the style * @return {HTMLElement} Modified element */ apply : function( target, style, prefixes, clean ) { // jQuery handling if( typeof jQuery !== 'undefined' && target instanceof jQuery) target = target.toArray(); // Force array if( typeof target.length === 'undefined' ) target = [ target ]; // Prefixes if( typeof prefixes === 'undefined' ) prefixes = false; if( prefixes === true ) prefixes = this.options.prefixes; // Clean if( typeof clean === 'undefined' || clean ) style = this.clean_style( style ); // Add prefix if( prefixes instanceof Array ) { var new_style = {}; for( var property in style ) { for( var prefix in prefixes ) { var new_property = null; if( prefixes[ prefix ] ) new_property = prefixes[ prefix ] + ( property.charAt( 0 ).toUpperCase() + property.slice( 1 ) ); else new_property = property; new_style[ new_property ] = style[ property ]; } } style = new_style; } // Apply style on each element for( var element in target ) { element = target[ element ]; if( element instanceof HTMLElement ) { for( var _property in style ) { element.style[ _property ] = style[ _property ]; } } } return target; }, /** * Clean style * @param {object} value Style to clean * @return {object} Cleaned style */ clean_style : function( style ) { var new_style = {}; // Each property for( var property in style ) { var value = style[ property ]; // Clean property and value new_style[ this.clean_property( property ) ] = this.clean_value( value ); } return new_style; }, /** * Clean property by removing prefixes and converting to camelCase * @param {string} value Property to clean */ clean_property : function( value ) { // Remove prefixes value = value.replace( /(webkit|moz|o|ms)?/i, '' ); value = this.strings.convert_case( value, 'camel' ); return value; }, /** * Clean value * @param {string} value Property to fix */ clean_value : function( value ) { // IE 9 if( this.detector.browser.ie === 9 ) { // Remove translateZ if( /translateZ/.test( value ) ) value = value.replace( /translateZ\([^)]*\)/g, '' ); // Replace translate3d by translateX and translateY if( / /.test( value ) ) value = value.replace( /translate3d\(([^,]*),([^,]*),([^)])*\)/g, 'translateX($1) translateY($2)' ); } return value; } } ); /** * @class Detector * @author Ariel Saldana / http://ahhriel.com */ P.Tools.Detector = P.Core.Event_Emitter.extend( { static : 'detector', options : { targets : [ 'html' ] }, /** * Initialise and merge options * @constructor * @param {object} options Properties to merge with defaults */ construct : function( options ) { this._super( options ); // Init this.init_detection(); this.init_classes(); }, /** * Detect engine, browser, system and feature in a specified list and store in 'detect' property * @return {object} Context */ init_detection : function() { // Prepare var engine = { ie : 0, gecko : 0, webkit : 0, khtml : 0, opera : 0, version : 0, }; var browser = { ie : 0, firefox : 0, safari : 0, konq : 0, opera : 0, chrome : 0, version : 0, }; var system = { windows : false, mac : false, osx : false, iphone : false, ipod : false, ipad : false, ios : false, blackberry : false, android : false, opera_mini : false, windows_mobile : false, wii : false, ps : false, }; var features = { touch : false, media_query : false }; // Detect var user_agent = navigator.userAgent; if( window.opera ) { engine.version = browser.version = window.opera.version(); engine.opera = browser.opera = parseInt( engine.version ); } else if( /AppleWebKit\/(\S+)/.test( user_agent ) || /AppleWebkit\/(\S+)/.test( user_agent ) ) { engine.version = RegExp.$1; engine.webkit = parseInt( engine.version ); // figure out if it's Chrome or Safari if( /Chrome\/(\S+)/.test( user_agent ) ) { browser.version = RegExp.$1; browser.chrome = parseInt( browser.version ); } else if( /Version\/(\S+)/.test( user_agent ) ) { browser.version = RegExp.$1; browser.safari = parseInt( browser.version ); } else { // Approximate version var safariVersion = 1; if( engine.webkit < 100 ) safariVersion = 1; else if( engine.webkit < 312 ) safariVersion = 1.2; else if( engine.webkit < 412 ) safariVersion = 1.3; else safariVersion = 2; browser.safari = browser.version = safariVersion; } } else if( /KHTML\/(\S+)/.test( user_agent ) || /Konqueror\/([^;]+)/.test( user_agent ) ) { engine.version = browser.version = RegExp.$1; engine.khtml = browser.konq = parseInt( engine.version ); } else if( /rv:([^\)]+)\) Gecko\/\d{8}/.test( user_agent ) ) { engine.version = RegExp.$1; engine.gecko = parseInt( engine.version ); // Determine if it's Firefox if ( /Firefox\/(\S+)/.test( user_agent ) ) { browser.version = RegExp.$1; browser.firefox = parseInt( browser.version ); } } else if( /MSIE ([^;]+)/.test( user_agent ) ) { engine.version = browser.version = RegExp.$1; engine.ie = browser.ie = parseInt( engine.version ); } else if( /Trident.*rv[ :]*(11[\.\d]+)/.test( user_agent ) ) { engine.version = browser.version = RegExp.$1; engine.ie = browser.ie = parseInt( engine.version ); } // Detect browsers browser.ie = engine.ie; browser.opera = engine.opera; // Detect platform (using navigator.plateform) var plateform = navigator.platform; // system.windows = plateform.indexOf( 'Win' ) === 0; // system.mac = plateform.indexOf( 'Mac' ) === 0; // system.x11 = ( plateform === 'X11' ) || ( plateform.indexOf( 'Linux' ) === 0); // Detect platform (using navigator.userAgent) system.windows = !!user_agent.match( /Win/ ); system.mac = !!user_agent.match( /Mac/ ); // system.x11 = ( plateform === 'X11' ) || ( plateform.indexOf( 'Linux' ) === 0); // Detect windows operating systems if( system.windows ) { if( /Win(?:dows )?([^do]{2})\s?(\d+\.\d+)?/.test( user_agent ) ) { if( RegExp.$1 === 'NT' ) { switch( RegExp.$2 ) { case '5.0': system.windows = '2000'; break; case '5.1': system.windows = 'XP'; break; case '6.0': system.windows = 'Vista'; break; default: system.windows = 'NT'; break; } } else if( RegExp.$1 === '9x' ) { system.windows = 'ME'; } else { system.windows = RegExp.$1; } } } // Detect mobile (mix between OS and device) system.nokia = !!user_agent.match( /Nokia/i ); system.kindle_fire = !!user_agent.match( /Silk/ ); system.iphone = !!user_agent.match( /iPhone/ ); system.ipod = !!user_agent.match( /iPod/ ); system.ipad = !!user_agent.match( /iPad/ ); system.blackberry = !!user_agent.match( /BlackBerry/ ) || !!user_agent.match( /BB[0-9]+/ ) || !!user_agent.match( /PlayBook/ ); system.android = !!user_agent.match( /Android/ ); system.opera_mini = !!user_agent.match( /Opera Mini/i ); system.windows_mobile = !!user_agent.match( /IEMobile/i ); // iOS / OS X exception system.ios = system.iphone || system.ipod || system.ipad; system.osx = !system.ios && !!user_agent.match( /OS X/ ); // Detect gaming systems system.wii = user_agent.indexOf( 'Wii' ) > -1; system.playstation = /playstation/i.test( user_agent ); //Detect features (Not as reliable as Modernizr) features.touch = !!( ( 'ontouchstart' in window ) || window.DocumentTouch && document instanceof DocumentTouch ); features.media_query = !!( window.matchMedia || window.msMatchMedia ); // Set up this.user_agent = user_agent; this.plateform = plateform; this.browser = browser; this.engine = engine; this.system = system; this.features = features; this.categories = [ 'engine', 'browser', 'system', 'features' ]; }, /** * Add detected informations to the DOM (on <html> by default) * @return {object} Context */ init_classes : function() { // Don't add if( !this.options.targets || this.options.targets.length === 0 ) return false; // Set up var targets = [], target = null; // Each element that need to add classes for( var i = 0, len = this.options.targets.length; i < len; i++ ) { // Target target = this.options.targets[ i ]; // String if( typeof target === 'string' ) { // Target switch( target ) { case 'html' : targets.push( document.documentElement ); break; case 'body' : targets.push( document.body ); break; default : var temp_targets = document.querySelectorAll( target ); for( var j = 0; j < temp_targets.length; j++ ) targets.push( temp_targets[ j ] ); break; } } // DOM Element else if( target instanceof Element ) { targets.push( target ); } // Targets found if( targets.length ) { this.classes = []; // Each category for( var category in this ) { // Allowed if( this.categories.indexOf( category ) !== -1 ) { // Each property in category for( var property in this[ category ] ) { var value = this[ category ][ property ]; // Ignore version if( property !== 'version' ) { // Feature if( category === 'features' ) { this.classes.push( category + '-' + ( value ? '' : 'no-' ) + property ); } // Not feature else { if( value ) { this.classes.push( category + '-' + property ); if( category === 'browser' ) this.classes.push( category + '-' + property + '-' + value ); } } } } } } // Add classes for( var j = 0; j < targets.length; j++ ) targets[ j ].classList.add.apply( targets[ j ].classList, this.classes ); } } return this; } } ); /** * @class GA_Tags * @author Ariel Saldana / http://ahhriel.com * @fires send */ P.Tools.GATags = P.Tools.GA_Tags = P.Core.Event_Emitter.extend( { static : 'ga_tags', options : { testing : false, send : true, parse : true, true_link_duration : 300, target : document.body, classes : { to_tag : 'pan-tag', tagged : 'pan-tagged' }, logs : { warnings : false, send : false } }, /** * Initialise and merge options * @constructor * @param {object} options Properties to merge with defaults */ construct : function( options ) { this._super( options ); this.unique_sent = []; if( this.options.parse ) this.parse(); }, /** * Parse the target looking for tags * @param {HTMLElement} target HTML target (default body) * @param {string} selector Query selector * @return {object} Context */ parse : function( target, selector ) { target = target || this.options.target; selector = selector || this.options.classes.to_tag; var that = this, elements = target.querySelectorAll( '.' + selector ); function click_handle( e ) { e = e || window.event; // Set variables var element = this, true_link = element.getAttribute( 'data-tag-true-link' ), datas = {}; // True link interpretation if( !true_link || [ '0', 'false', 'nop', 'no' ].indexOf( true_link.toLowerCase() ) !== -1 ) true_link = false; else true_link = true; // Set options that will be sent datas.category = element.getAttribute( 'data-tag-category' ); datas.action = element.getAttribute( 'data-tag-action' ); datas.label = element.getAttribute( 'data-tag-label' ); datas.value = element.getAttribute( 'data-tag-value' ); datas.unique = element.getAttribute( 'data-tag-unique' ); // Send that.send( datas ); // True link that should act as a normal click if( true_link ) { // Set variables var href = element.getAttribute( 'href' ), target = element.getAttribute( 'target' ); // Default target if( !target ) target = '_self'; // Other than _blank, need to wait if( target !== '_blank' ) { // Wait window.setTimeout( function() { window.open( href , target ); }, that.options.true_link_duration ); // Prevent default if( e.preventDefault ) e.preventDefault(); else e.returnValue = false; } } } // Each element for( var i = 0, len = elements.length; i < len; i++ ) { var element = elements[ i ]; if( !element.classList.contains( this.options.classes.tagged ) ) { // Listen element.onclick = click_handle; // Set tagged class element.classList.add( this.options.classes.tagged ); } } return this; }, /** * Send to Analytics * @param {object} datas Datas to send * @return {object} Context * @example * * send( { * category : 'foo', * action : 'bar', * label : 'lorem', * value : 'ipsum' * } ) * */ send : function( datas ) { var send = [], sent = false; // Error if( typeof datas !== 'object' ) { // Logs if( this.options.logs.warnings ) console.warn( 'tag wrong datas' ); return false; } // Unique if( datas.unique && this.unique_sent.indexOf( datas.unique ) !== -1 ) { // Logs if( this.options.logs.warnings ) console.warn( 'tag prevent : ' + datas.unique ); return false; } // Send if( this.options.send ) { // Category if( typeof datas.category !== 'undefined' ) { send.push( datas.category ); // Action if( typeof datas.action !== 'undefined' ) { send.push( datas.action ); // Label if( typeof datas.label !== 'undefined' ) { send.push( datas.label ); // Value if( typeof datas.value !== 'undefined' ) { send.push( datas.value ); } } // Send only if category and action set // _gaq if( typeof _gaq !== 'undefined' ) { _gaq.push( [ '_trackEvent' ].concat( send ) ); sent = true; } // ga else if( typeof ga !== 'undefined' ) { ga.apply( ga, [ 'send', 'event' ].concat( send ) ); sent = true; } // Testing else if( this.options.testing ) { sent = true; } else { // Logs if( this.options.logs.warnings ) console.warn( 'tag _gaq not defined' ); } // Logs if( this.options.logs.send ) console.log( 'tag', send ); } else { // Logs if( this.options.logs.warnings ) console.warn( 'tag missing action' ); } } else { // Logs if( this.options.logs.warnings ) console.warn( 'tag missing category' ); } } // Well sent if( sent ) { // Save in unique_sent array if( datas.unique ) this.unique_sent.push( datas.unique ); this.trigger( 'send', [ send ] ); } return this; } } ); /** * @class Keyboard * @author Ariel Saldana / http://ahhriel.com * @fires down * @fires up */ P.Tools.Keyboard = P.Core.Event_Emitter.extend( { static : 'keyboard', options : {}, keycode_names : { 91 : 'cmd', 17 : 'ctrl', 32 : 'space', 16 : 'shift', 18 : 'alt', 20 : 'caps', 9 : 'tab', 13 : 'enter', 8 : 'backspace', 38 : 'up', 39 : 'right', 40 : 'down', 37 : 'left', 27 : 'esc' }, /** * Initialise and merge options * @constructor * @param {object} options Properties to merge with defaults */ construct : function( options ) { this._super( options ); // Set up this.downs = []; // Init this.listen_to_events(); }, /** * Listen to events * @return {object} Context */ listen_to_events : function() { var that = this; // Down function keydown_handle( e ) { var character = that.keycode_to_character( e.keyCode ); if( that.downs.indexOf( character ) === -1 ) that.downs.push( character ); // Trigger and prevend default if asked by return false on callback if( that.trigger( 'down', [ e.keyCode, character ] ) === false ) { e = e || window.event; if( e.preventDefault ) e.preventDefault(); else e.returnValue = false; } } // Up function keyup_handle( e ) { var character = that.keycode_to_character( e.keyCode ); if( that.downs.indexOf( character ) !== -1 ) that.downs.splice( that.downs.indexOf( character ), 1 ); that.trigger( 'up', [ e.keyCode, character ] ); } // Listen if (document.addEventListener) { document.addEventListener( 'keydown', keydown_handle, false ); document.addEventListener( 'keyup', keyup_handle, false ); } else { document.attachEvent( 'onkeydown', keydown_handle, false ); document.attachEvent( 'onkeyup', keyup_handle, false ); } return this; }, /** * Convert a keycode to a char * @param {integer} input Original keycode * @return {string} Output */ keycode_to_character : function( input ) { var output = this.keycode_names[ input ]; if( !output ) output = String.fromCharCode( input ).toLowerCase(); return output; }, /** * Test if keys are down * @param {array} inputs Array of char to test as strings * @return {boolean} True if every keys are down */ are_down : function( inputs ) { var down = true; for( var i = 0; i < inputs.length; i++ ) { var key = inputs[ i ]; if( typeof key === 'number' ) key = this.keycode_to_character( key ); if( this.downs.indexOf( key ) === -1 ) down = false; } return down; }, /** * Test if key is down * @param {string} input Char as string * @return {boolean} True if key is down */ is_down : function( input ) { return this.are_down( [ input ] ); } } ); /** * @class Strings * @author Ariel Saldana / http://ahhriel.com */ P.Tools.KonamiCode = P.Tools.Konami_Code = P.Core.Event_Emitter.extend( { static : 'konami_code', options : { reset_duration : 1000, sequence : [ 'up', 'up', 'down', 'down', 'left', 'right', 'left', 'right', 'b', 'a' ] }, /** * Initialise and merge options * @constructor * @param {object} options Properties to merge with defaults */ construct : function( options ) { this._super( options ); // Set up this.index = 0; this.timeout = null; this.keyboard = new P.Tools.Keyboard(); // Init this.listen_to_events(); }, /** * Listen to events * @return {object} Context */ listen_to_events : function() { var that = this; // Listen keyboard down this.keyboard.on( 'down', function( keycode, character ) { // Reset timeout if( that.timeout ) window.clearTimeout( that.timeout ); // Test char if( character === that.options.sequence[ that.index ] ) { // Progress that.index++; // Timeout that.timeout = window.setTimeout( function() { // Trigger that.trigger( 'timeout', [ that.index ] ); // Reset that.index = 0; }, that.options.reset_duration ); } else { // Trigger if( that.index ) that.trigger( 'wrong', [ that.index ] ); // Reset that.index = 0; } // Complete if( that.index >= that.options.sequence.length ) { // Trigger that.trigger( 'used' ); // Reset that.index = 0; // Reset timeout window.clearTimeout( that.timeout ); } } ); } } ); /** * @class Mouse * @author Ariel Saldana / http://ahhriel.com * @fires down * @fires up * @fires move * @fires wheel * @requires P.Tools.Viewport */ P.Tools.Mouse = P.Core.Event_Emitter.extend( { static : 'mouse', options : {}, /** * Initialise and merge options * @constructor * @param {object} options Properties to merge with defaults */ construct : function( options ) { this._super( options ); this.viewport = new P.Tools.Viewport(); this.down = false; this.position = {}; this.position.x = 0; this.position.y = 0; this.position.ratio = {}; this.position.ratio.x = 0; this.position.ratio.y = 0; this.wheel = {}; this.wheel.delta = 0; this.listen_to_events(); }, /** * Listen to events * @return {object} Context */ listen_to_events : function() { var that = this; // Down function mouse_down_handle( e ) { that.down = true; if( that.trigger( 'down', [ that.position, e.target ] ) === false ) { e.preventDefault(); } } // Up function mouse_up_handle( e ) { that.down = false; that.trigger( 'up', [ that.position, e.target ] ); } // Move function mouse_move_handle( e ) { that.position.x = e.clientX; that.position.y = e.clientY; that.position.ratio.x = that.position.x / that.viewport.width; that.position.ratio.y = that.position.y / that.viewport.height; that.trigger( 'move', [ that.position, e.target ] ); } // Wheel function mouse_wheel_handle( e ) { that.wheel.delta = e.wheelDeltaY || e.wheelDelta || - e.detail; if( that.trigger( 'wheel', [ that.wheel ] ) === false ) { e.preventDefault(); return false; } } // Listen if (document.addEventListener) { document.addEventListener( 'mousedown', mouse_down_handle, false ); document.addEventListener( 'mouseup', mouse_up_handle, false ); document.addEventListener( 'mousemove', mouse_move_handle, false ); document.addEventListener( 'mousewheel', mouse_wheel_handle, false ); document.addEventListener( 'DOMMouseScroll', mouse_wheel_handle, false ); } else { document.attachEvent( 'onmousedown', mouse_down_handle, false ); document.attachEvent( 'onmouseup', mouse_up_handle, false ); document.attachEvent( 'onmousemove', mouse_move_handle, false ); document.attachEvent( 'onmousewheel', mouse_wheel_handle, false ); } return this; } } ); /** * @class Offline * @author Ariel Saldana / http://ahhriel.com * @fires online * @fires offline * @fires change */ P.Tools.Offline = P.Core.Event_Emitter.extend( { static : 'offline', options : { classes : { active : true, target : document.body, offline : 'offline', online : 'online' } }, /** * Initialise and merge options * @constructor * @param {object} options Properties to merge with defaults */ construct : function( options ) { this._super( options ); this.status = null; this.listen_to_events(); }, /** * Listen to events * @return {object} Context */ listen_to_events : function() { var that = this; function change() { // Online if( navigator.onLine ) { // Update classes if( that.options.classes.active ) { that.options.classes.target.classList.remove( that.options.classes.offline ); that.options.classes.target.classList.add( that.options.classes.online ); } // Update status that.status = 'online'; // Trigger that.trigger( 'online' ); that.trigger( 'change', [ that.status ] ); } // Offline else { // Update classes if( that.options.classes.active ) { that.options.classes.target.classList.remove( that.options.classes.online ); that.options.classes.target.classList.add( that.options.classes.offline ); } // Update status that.status = 'online'; // Trigger that.trigger( 'offline' ); that.trigger( 'change', [ that.status ] ); } } // Listen if( window.addEventListener ) { window.addEventListener( 'online', change, false ); window.addEventListener( 'offline', change, false ); } else { document.body.ononline = change; document.body.onoffline = change; } change(); return this; } } ); /** * @class Registry * @author Ariel Saldana / http://ahhriel.com */ P.Tools.Registry = P.Core.Event_Emitter.extend( { static : 'registry', options : {}, /** * Initialise and merge options * @constructor * @param {object} options Properties to merge with defaults */ construct : function( options ) { this._super( options ); this.items = {}; }, /** * Try to retrieve stored value for specified key * @param {string} key Key for the value * @return {any} Stored value (undefined if not found) */ get : function( key, callback ) { // Found if( typeof this.items[ key ] !== 'undefined' ) return this.items[ key ]; // Not found but callback provided if( typeof callback === 'function' ) return callback.apply( this ); // Otherwise return undefined; }, /** * Set value width specified key (will override previous value) * @param {string} key Key for the value * @param {any} value Anything to store */ set : function( key, value ) { // Set this.items[ key ] = value; // Trigger this.trigger( 'update', [ key, value ] ); return value; } } ); /** * @class Resizer * @author Ariel Saldana / http://ahhriel.com * @requires P.Tools.Browser */ P.Tools.Resizer = P.Core.Abstract.extend( { static : 'resizer', options : { force_style : true, parse : true, target : document.body, auto_resize : true, classes : { to_resize : 'b-resize', content : 'b-content' } }, /** * Initialise and merge options * @constructor * @param {object} options Properties to merge with defaults */ construct : function( options ) { this._super( options ); // Set up this.elements = []; // Parse if( this.options.parse ) this.parse(); // Auto resize if( this.options.auto_resize ) this.init_auto_resize(); }, /** * Initialise auto resize * @return {object} Context */ init_auto_resize : function() { var that = this; // Set up this.viewport = new P.Tools.Viewport(); // Viewport resize event this.viewport.on( 'resize', function() { that.resize_all(); } ); return this; }, /** * Parse the target looking for elements to resize * @param {HTMLElement} target HTML target (default body) * @param {string} selector Query selector * @return {object} Context */ parse : function( target, selector ) { // Default target = target || this.options.target; selector = selector || this.options.classes.to_resize; // Elements this.elements = []; var containers = target.querySelectorAll( '.' + selector ); // Each element for( var i = 0, len = containers.length; i < len; i++ ) { var container = containers[ i ], content = container.querySelector( '.' + this.options.classes.content ); // Content found if( content ) { // Add to elements this.elements.push( { container : container, content : content } ); } } return this; }, /** * Apply resize on each element * @return {object} Context */ resize_all : function() { for( var i = 0, len = this.elements.length; i < len; i++ ) { var element = this.elements[ i ]; this.resize( element.container, element.content ); } return this; }, /** * Apply resize on HTML target * @param {HTMLElement} container HTML element outside * @param {HTMLElement} content HTML element inside * @param {boolean} force_style Force minimum CSS to make the resize work (position and overflow) * @return {object} Context */ resize : function( container, content, force_style ) { // Errors var errors = []; if( !( container instanceof HTMLElement) ) errors.push( 'wrong container parameter' ); if( !( content instanceof HTMLElement) ) errors.push( 'wrong content parameter' ); if( errors.length ) { for( var i = 0; i < errors.length; i++ ) console.warn( errors[ i ] ); return false; } // Parameters var parameters = {}; parameters.container_width = container.getAttribute( 'data-width' ) || container.getAttribute( 'width' ) || container.offsetWidth; parameters.container_height = container.getAttribute( 'data-height' ) || container.getAttribute( 'height' ) || container.offsetHeight; parameters.content_width = content.getAttribute( 'data-width' ) || content.getAttribute( 'width' ) || content.offsetWidth; parameters.content_height = content.getAttribute( 'data-height' ) || content.getAttribute( 'height' ) || content.offsetHeight; parameters.fit_type = content.getAttribute( 'data-fit-type' ); parameters.align_x = content.getAttribute( 'data-align-x' ); parameters.align_y = content.getAttribute( 'data-align-y' ); parameters.rounding = content.getAttribute( 'data-rounding' ); // Get sizes var sizes = this.get_sizes( parameters ); // Error if( !sizes ) return false; // Default force style force_style = typeof force_style === 'undefined' ? this.options.force_style : force_style; // Force style if( force_style ) { // Test current style var container_style = window.getComputedStyle( container ), content_style = window.getComputedStyle( content ); // Force positioning if( container_style.position !== 'fixed' && container_style.position !== 'relative' && container_style.position !== 'absolute' ) container.style.position = 'relative'; if( content_style.position !== 'fixed' && content_style.position !== 'relative' && content_style.position !== 'absolute' ) content.style.position = 'absolute'; // Force overflow if( container_style.overflow !== 'hidden' ) container.style.overflow = 'hidden'; } // Apply style content.style.top = sizes.css.top; content.style.left = sizes.css.left; content.style.width = sizes.css.width; content.style.height = sizes.css.height; return this; }, /** * Retrieve the sizes for a content to fit inside a container * @param {object} parameters Parameters * @return {object} Sizes * @example * * get_sizes( { * content_width : 200.4, * content_height : 300.5, * container_width : 600.6, * container_height : 400.7, * fit_type : 'fit', * alignment_x : 'center', * alignment_y : 'center', * rounding : 'floor' * } ) * */ get_sizes : function( parameters, format ) { // Errors var errors = []; if( typeof parameters.content_width === 'undefined' || parseInt( parameters.content_width, 10 ) === 0 ) errors.push('content width must be specified'); if( typeof parameters.content_height === 'undefined' || parseInt( parameters.content_height, 10 ) === 0 ) errors.push('content height must be specified'); if( typeof parameters.container_width === 'undefined' || parseInt( parameters.container_width, 10 ) === 0 ) errors.push('container width must be specified'); if( typeof parameters.container_height === 'undefined' || parseInt( parameters.container_height, 10 ) === 0 ) errors.push('container height must be specified'); if( errors.length ) return false; // Default format if( typeof format === 'undefined' ) format = 'both'; // Defaults parameters parameters.fit_type = parameters.fit_type || 'fill'; parameters.align_x = parameters.align_x || 'center'; parameters.align_y = parameters.align_y || 'center'; parameters.rounding = parameters.rounding || 'ceil'; var content_ratio = parameters.content_width / parameters.content_height, container_ratio = parameters.container_width / parameters.container_height, width = 0, height = 0, x = 0, y = 0, fit_in = null; // To lower case parameters.fit_type = parameters.fit_type.toLowerCase(); parameters.align_x = parameters.align_x.toLowerCase(); parameters.align_y = parameters.align_y.toLowerCase(); parameters.rounding = parameters.rounding.toLowerCase(); // align if( typeof parameters.align_x === 'undefined' || [ 'left', 'center', 'middle', 'right' ].indexOf( parameters.align_x ) === -1 ) parameters.align_x = 'center'; if( typeof parameters.align_y === 'undefined' || [ 'top', 'center', 'middle', 'bottom' ].indexOf( parameters.align_y ) === -1 ) parameters.align_y = 'center'; // Functions var set_full_width = function() { width = parameters.container_width; height = ( parameters.container_width / parameters.content_width ) * parameters.content_height; x = 0; fit_in = 'width'; switch( parameters.align_y ) { case 'top': y = 0; break; case 'middle': case 'center': y = ( parameters.container_height - height ) / 2; break; case 'bottom': y = parameters.container_height - height; break; } }; var set_full_height = function() { height = parameters.container_height; width = ( parameters.container_height / parameters.content_height ) * parameters.content_width; y = 0; fit_in = 'height'; switch( parameters.align_x ) { case 'left': x = 0; break; case 'middle': case 'center': x = ( parameters.container_width - width ) / 2; break; case 'right': x = parameters.container_width - width; break; } }; // Content should fill the container if( [ 'fill', 'full', 'cover' ].indexOf( parameters.fit_type ) !== -1 ) { if( content_ratio < container_ratio ) set_full_width(); else set_full_height(); } // Content should fit in the container else if( [ 'fit', 'i sits', 'contain' ].indexOf( parameters.fit_type ) !== -1 ) { if( content_ratio < container_ratio ) set_full_height(); else set_full_width(); } // Rounding if( [ 'ceil', 'floor', 'round' ].indexOf( parameters.rounding ) !== -1 ) { width = Math[ parameters.rounding ].call( this,width ); height = Math[ parameters.rounding ].call( this,height ); x = Math[ parameters.rounding ].call( this,x ); y = Math[ parameters.rounding ].call( this,y ); } // Returned sizes var sizes = {}; // Cartesian sizes.cartesian = {}; sizes.cartesian.width = width; sizes.cartesian.height = height; sizes.cartesian.x = x; sizes.cartesian.y = y; // CSS sizes.css = {}; sizes.css.width = width + 'px'; sizes.css.height = height + 'px'; sizes.css.left = x + 'px'; sizes.css.top = y + 'px'; // Fit in sizes.fit_in = fit_in; if( format === 'both' ) return sizes; else if( format === 'cartesian' ) return sizes.cartesian; else if( format === 'css' ) return sizes.css; } } ); /** * @class Strings * @author Ariel Saldana / http://ahhriel.com */ P.Tools.Strings = P.Core.Abstract.extend( { static : 'strings', options : {}, cases : { camel : [ 'camel', 'camelback', 'compoundnames' ], pascal : [ 'pascal', 'uppercamelcase', 'bumpycaps', 'camelcaps', 'capitalizedwords', 'capwords' ], snake : [ 'snake', 'underscore', 'plissken' ], titlesnake : [ 'titlesnake', 'capitalsnake' ], screamingsnake : [ 'screamingsnake', 'uppersnake' ], dash : [ 'dash', 'dashed', 'hyphen', 'kebab', 'spinal' ], train : [ 'train' ], space : [ 'space' ], title : [ 'title' ], dot : [ 'dot' ], slash : [ 'slash', 'forwardslash', 'path' ], backslash : [ 'backslash', 'hack', 'whack', 'escape', 'reverseslash', 'slosh', 'backslant', 'downhill', 'backwhack' ], lower : [ 'lower' ], upper : [ 'upper' ], studlycaps : [ 'studlycaps' ], burno : [ 'burno', 'lol', 'yolo' ], }, negatives : [ '0', 'false', 'nop', ':(', 'nee', 'jo', 'naï', 'laa', 'votch', 'xeyir', 'ez', 'hе nie', 'nie', 'na', 'aïlle', 'ne', 'nann', 'né', 'ma hoke phu', 'hmar te', 'no', 'tla', 'hla', 'pù shi', 'nò', 'nej', 'ei', 'nei', 'non', 'nanni', 'ara', 'nein', 'ohi', 'nahániri', 'ʻaole', 'aole', 'lo', 'nahin', 'nem', 'mba', 'tidak', 'iié', 'ala', 'thay', 'oya', 'ahneo', 'na', 'bo', 'minime', 'nē', 'te', 'neen', 'не', 'he', 'tsia', 'le', 'kaore', 'ugui', 'yгvй', 'nennin', 'nenn', 'нæй', 'kheyr', 'nie', 'não', 'nu', 'нет', 'niet', 'ag', 'aiwa', 'nae', 'aï', 'siyo', 'hapana', 'hindi', 'po', 'aita', 'lla', 'illaï', 'yuk', 'kadhu', 'ไม่', 'maï', 'hayir', 'oevoel', 'ug', 'ні', 'ni', 'نهين', 'neni', 'nage', 'awa', 'déedéet', 'rara', 'cha' ], /** * Convert a value to any case listed above * Return base value if case not found * @param {string} value Any string value * @param {string} format Any case listed above (allow 'case' at the end and other chars than letters like camEl-CasE) * @return {string} Covnerted value */ convert_case : function( value, format ) { // Clean value value = this.trim( value ); // Clean format format = format.toLowerCase(); // To lower format = format.replace( /[^[a-z]]*/g, '' ); // normalize format = format.replace( /case/g, '' ); // Remove 'case' // Find format var true_format = null; for( var original_name in this.cases ) { for( var synonym_name_key in this.cases[ original_name ] ) { var synonym_name = this.cases[ original_name ][ synonym_name_key ]; if( synonym_name === format ) true_format = synonym_name; } } // Format not found if( !true_format ) return value; // Convert case variation to dashes value = value.replace( /([a-z])([A-Z])/g, "$1-$2" ); value = value.toLowerCase(); // Get parts var parts = value.split( /[-_ .\/\\]/g ); // Convert var new_value = null, i = null, len = null; switch( true_format ) { case 'camel' : for( i = 0, len = parts.length; i < len; i++ ) { if( i !== 0 ) parts[ i ] = parts[ i ].charAt( 0 ).toUpperCase() + parts[ i ].slice( 1 ); } new_value = parts.join( '' ); break; case 'pascal' : for( i = 0, len = parts.length; i < len; i++ ) parts[ i ] = parts[ i ].charAt( 0 ).toUpperCase() + parts[ i ].slice( 1 ); new_value = parts.join( '' ); break; case 'snake' : new_value = parts.join( '_' ); break; case 'titlesnake' : for( i = 0, len = parts.length; i < len; i++ ) parts[ i ] = parts[ i ].charAt( 0 ).toUpperCase() + parts[ i ].slice( 1 ); new_value = parts.join( '_' ); break; case 'screamingsnake' : new_value = parts.join( '_' ); new_value = new_value.toUpperCase(); break; case 'dash' : new_value = parts.join( '-' ); break; case 'train' : for( i = 0, len = parts.length; i < len; i++ ) parts[ i ] = parts[ i ].charAt( 0 ).toUpperCase() + parts[ i ].slice( 1 ); new_value = parts.join( '-' ); break; case 'space' : new_value = parts.join( ' ' ); break; case 'title' : for( i = 0, len = parts.length; i < len; i++ ) parts[ i ] = parts[ i ].charAt( 0 ).toUpperCase() + parts[ i ].slice( 1 ); new_value = parts.join( ' ' ); break; case 'dot' : new_value = parts.join( '.' ); break; case 'slash' : new_value = parts.join( '/' ); break; case 'backslash' : new_value = parts.join( '\\' ); break; case 'lower' : new_value = parts.join( '' ); break; case 'upper' : new_value = parts.join( '' ); new_value = new_value.toUpperCase(); break; case 'studlycaps' : new_value = parts.join( '' ); for( i = 0, len = new_value.length; i < len; i++ ) { if( Math.random() > 0.5 ) new_value = new_value.substr( 0, i ) + new_value[ i ].toUpperCase() + new_value.substr( i + 1 ); } break; case 'burno' : for( i = 0, len = parts.length; i < len; i++ ) parts[ i ] = 'burno'; new_value = parts.join( ' ' ); break; } return new_value; }, /** * Smartly convert to boolean * @return {[type]} [description] */ to_boolean : function( value ) { // Undefined or null if( typeof value === 'undefined' || value === null ) return false; // Clean value = '' + value; // To string value = this.trim( value ); // Trim value = value.toLowerCase(); // To lower case return this.negatives.indexOf( value ) === -1; }, /** * Remove start and trailing white spaces * @param {string} value Value to trim * @param {string} characters Characters to trim * @return {string} Trimed value */ trim : function( value, characters ) { if( typeof characters === 'undefined' ) { return value.replace( /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '' ); } else { value = value.replace( new RegExp( '^[' + characters + ']+' ), '' ); value = value.replace( new RegExp( '[' + characters + ']+$' ), '' ); return value; } }, /** * Convert to slug * @param {string} value Value to convert * @return {string} Converted value */ to_slug : function( value ) { // Clean value = this.trim( value ); // Trim value = value.toLowerCase(); // To lower case // Remove accents and special letters var from = 'ãàáäâẽèéëêìíïîõòóöôùúüûñç·/,:;', to = 'aaaaaeeeeeiiiiooooouuuunc-----'; for( var i = 0, len = from.length; i < len; i++ ) value = value.replace( new RegExp( from.charAt( i ), 'g' ), to.charAt( i ) ); value = value.replace( /[^a-z0-9 _-]/g, '' ); // Remove invalid resting chars value = value.replace( /\s+/g, '-' ); // Collapse whitespace and replace by - value = value.replace( /-+/g, '-' ); // Collapse dashes value = this.trim( value, '-' ); // Final trim return value; }, /** * Convert to slug ('to_slug' alias) * @param {string} value Value to convert * @return {string} Converted value */ slugify : function( value ) { return this.to_slug( value ); } } ); /** * @class Resizer * @author Ariel Saldana / http://ahhriel.com */ P.Tools.Ticker = P.Core.Event_Emitter.extend( { static : 'ticker', options : { auto_run : true }, /** * Initialise and merge options * @constructor * @param {object} options Properties to merge with defaults */ construct : function( options ) { this._super( options ); this.reseted = false; this.running = false; this.time = {}; this.time.start = 0; this.time.elapsed = 0; this.time.delta = 0; this.time.current = 0; this.waits = {}; this.waits.before = []; this.waits.after = []; this.intervals = {}; if( this.options.auto_run ) this.run(); }, /** * Reset the ticker by setting time infos to 0 * @param {boolean} run Start the ticker * @param {ticker} reset a ticker completely, by default reseting keeps the next interval date. * @return {object} Context */ reset : function( run , interval ) { var that = this; this.reseted = true; this.time.start = + ( new Date() ); this.time.current = this.time.start; this.time.elapsed = 0; this.time.delta = 0; if( run ) this.run(); if (interval) { that.destroy_interval(interval); that.create_interval(interval); } return this; }, /** * Run the ticker * @return {object} Context */ run : function() { var that = this; // Already running if( this.running ) return; this.running = true; var loop = function() { if(that.running) window.requestAnimationFrame( loop ); that.tick(); }; loop(); return this; }, /** * Stop ticking * @return {object} Context */ stop : function() { this.running = false; return this; }, /** * Tick (or is it tack ?) * @return {object} Context */ tick : function() { // Reset if needed if( !this.reseted ) this.reset(); // Set time infos this.time.current = + ( new Date() ); this.time.delta = this.time.current - this.time.start - this.time.elapsed; this.time.elapsed = this.time.current - this.time.start; var i = 0, len = this.waits.before.length, wait = null; // Do next (before trigger) for( ; i < len; i++ ) { // Set up wait = this.waits.before[ i ]; // Frame count down to 0 if( --wait.frames_count === 0 ) { // Apply action wait.action.apply( this, [ this.time ] ); // Remove from actions this.waits.before.splice( i, 1 ); // Update loop indexes i--; len--; } } // Trigger this.trigger( 'tick', [ this.time ] ); // Trigger intervals this.trigger_intervals(); // Do next (after trigger) i = 0; len = this.waits.after.length; for( ; i < len; i++ ) { // Set up wait = this.waits.after[ i ]; // Frame count down to 0 if( --wait.frames_count === 0 ) { // Apply action wait.action.apply( this, [ this.time ] ); // Remove from actions this.waits.after.splice( i, 1 ); // Update loop indexes i--; len--; } } return this; }, /** * Apply function on X frames * @param {number} frames_count How many frames before applying the function * @param {function} action Function to apply * @param {boolean} after Should apply the function after the 'tick' event is triggered * @return {object} Context */ wait : function( frames_count, action, after ) { // Errors if( typeof action !== 'function' ) return false; if( typeof frames_count !== 'number' ) return false; this.waits[ after ? 'after' : 'before' ].push( { frames_count : frames_count, action : action } ); return this; }, /** * Create interval * @param {integer} interval Milliseconds between each tick * @return {object} Context */ create_interval : function( interval ) { this.intervals[ interval ] = { interval : interval, next_trigger : interval, start : this.time.elapsed, last_trigger : this.time.elapsed, }; return this; }, /** * Destroy interval * @param {integer} interval Milliseconds between each tick * @return {object} Context */ destroy_interval : function( interval ) { delete this.intervals[ interval ]; return this; }, /** * Trigger intervals * @return {object} Context */ trigger_intervals : function() { // Each interval for( var _key in this.intervals ) { var interval = this.intervals[ _key ]; // Test if interval should trigger if( this.time.elapsed - interval.last_trigger > interval.next_trigger ) { // Update next trigger to stay as close as possible to the interval interval.next_trigger = interval.interval - ( this.time.elapsed - interval.start ) % interval.interval; interval.last_trigger = this.time.elapsed; this.trigger( 'tick-' + interval.interval, [ this.time, interval ] ); } } return this; }, /** * Start listening specified events * @param {string} names Events names (can contain namespace) * @param {function} callback Function to apply if events are triggered * @return {object} Context */ on : function( names, callback ) { // Set up var that = this, resolved_names = this.resolve_names( names ); // Each resolved name resolved_names.forEach( function( name ) { // Has interval interval if( name.match( /^tick([0-9]+)$/) ) { // Extract interval interval var interval = parseInt( name.replace( /^tick([0-9]+)$/, '$1' ) ); // Create interval if( interval ) that.create_interval( interval ); } } ); return this._super( names, callback ); }, /** * Stop listening specified events * @param {string} names Events names (can contain namespace or be the namespace only) * @return {object} Context */ off : function( names ) { // Set up var that = this, resolved_names = this.resolve_names( names ); // Each resolved name resolved_names.forEach( function( name ) { // Has interval interval if( name.match( /^tick([0-9]+)$/) ) { // Extract interval interval var interval = parseInt( name.replace( /^tick([0-9]+)$/, '$1' ) ); // Create interval if( interval ) that.destroy_interval( interval ); } } ); return this._super( names ); }, } ); /** * @class Viewport * @author Ariel Saldana / http://ahhriel.com * @fires resize * @fires scroll * @requires P.Tools.Ticker */ P.Tools.Viewport = P.Core.Event_Emitter.extend( { static : 'viewport', options : { disable_hover_on_scroll : false, initial_triggers : [ 'resize', 'scroll' ] }, /** * Initialise and merge options * @constructor * @param {object} options Properties to merge with defaults */ construct : function( options ) { this._super( options ); // Set up this.ticker = new P.Tools.Ticker(); this.detector = new P.Tools.Detector(); this.top = 0; this.left = 0; this.y = 0; this.x = 0; this.scroll = {}; this.scroll.delta = {}; this.scroll.delta.top = 0; this.scroll.delta.left = 0; this.scroll.delta.y = 0; this.scroll.delta.x = 0; this.scroll.direction = {}; this.scroll.direction.x = null; this.scroll.direction.y = null; this.width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; this.height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; this.pixel_ratio = window.devicePixelRatio || 1; // Init this.init_disabling_hover_on_scroll(); this.init_events(); }, /** * Init events * @return {object} Context */ init_events : function() { var that = this; // Callbacks function resize_callback() { that.resize_handler(); } function scroll_callback() { that.scroll_handler(); } // Listeing to events if( window.addEventListener ) { window.addEventListener( 'resize', resize_callback ); window.addEventListener( 'scroll', scroll_callback ); } else { window.attachEvent( 'onresize', resize_callback ); window.attachEvent( 'onscroll', scroll_callback ); } // Initial trigger if( this.options.initial_triggers.length ) { // Do next frame this.ticker.wait( 1, function() { // Each initial trigger for( var i = 0; i < that.options.initial_triggers.length; i++ ) { // Set up var action = that.options.initial_triggers[ i ], method = that[ action + '_handler' ]; // Method exist if( typeof method === 'function' ) { // Trigger method.apply( that ); } } } ); } return this; }, /** * Handle the resize event * @return {object} Context */ resize_handler : function() { // Set up this.width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; this.height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; // Trigger this.trigger( 'resize', [ this.width, this.height ] ); return this; }, /** * Handle the scroll event * @return {object} Context */ scroll_handler : function() { // Set up var top = typeof window.pageYOffset !== 'undefined' ? window.pageYOffset : window.document.documentElement.scrollTop, left = typeof window.pageXOffset !== 'undefined' ? window.pageXOffset : window.document.documentElement.scrollLeft; this.scroll.direction.y = top > this.top ? 'down' : 'up'; this.scroll.direction.x = left > this.left ? 'right' : 'left'; this.scroll.delta.top = top - this.top; this.scroll.delta.left = left - this.left; this.top = top; this.left = left; // Alias this.y = this.top; this.x = this.left; this.scroll.delta.y = this.scroll.delta.top; this.scroll.delta.x = this.scroll.delta.left; // Trigger this.trigger( 'scroll', [ this.top, this.left, this.scroll ] ); return this; }, /** * Disable pointer events on body when scrolling for performance * @return {object} Context */ init_disabling_hover_on_scroll : function() { // Set up var that = this, timeout = null, active = false; // Scroll event this.on( 'scroll', function() { if( !that.options.disable_hover_on_scroll ) return; // Clear timeout if exist if( timeout ) window.clearTimeout( timeout ); // Not active if( !active ) { // Activate active = true; document.body.style.pointerEvents = 'none'; } timeout = window.setTimeout( function() { // Deactivate active = false; document.body.style.pointerEvents = 'auto'; }, 60 ); } ); return this; }, /** * Test media and return false if not compatible * @param {string} condition Condition to test * @return {boolean} Match */ match_media : function( condition ) { if( !this.detector.features.media_query || typeof condition !== 'string' || condition === '' ) return false; return !!window.matchMedia( condition ).matches; } } ); /** * @class queue * @author Ariel Saldana / http://ahhriel.com */ P.Tools.Queue = P.Core.Event_Emitter.extend({ static: 'queue', slice: [].slice, options : { }, /** * Initialise and merge options * @constructor * @param {object} options Properties to merge with defaults */ construct: function(options) { this._super(options); }, queue: function(parallelism) { var q, tasks = [], started = 0, active = 0, remaining = 0, popping, error, wait = this.noop, all; var that = this; if (!parallelism) parallelism = Infinity; this.pop = function() { while (popping = started < tasks.length && active < parallelism) { var i = started++, t = tasks[i], a = that.slice.call(t, 1); a.push(that.callback(i)); ++active; t[0].apply(null, a); } } this.callback = function(i) { return function(e, r) { --active; if (error != null) return; if (e != null) { error = e; // ignore new tasks and squelch active callbacks started = remaining = NaN; // stop queued tasks from starting notify(); } else { tasks[i] = r; if (--remaining) popping || pop(); else notify(); } }; } this.notify = function() { if (error != null) wait (error); else if (all) wait (error, tasks); else wait.apply(null, [error].concat(tasks)); } return q = { defer: function() { if (!error) { tasks.push(arguments); ++remaining; that.pop(); } return q; }, wait: function(f) { wait = f; all = false; if (!remaining) notify(); return q; }, awaitAll: function(f) { wait = f; all = true; if (!remaining) notify(); return q; } }; }, /** * simple queue that uses arrays but avoids expensive shift operations * @return {object} Context * @function .enqueue() adds item to the queue * @function .dequeue() removes an item from the queue, and returns that item. returns undefined is queue is empty * @function .peek() returns the item at the index of the queue without dequeueing it. returns undefined if queue is empty * @function .getLength() returns the length of the queue * @function .isEmpty() returns true of false - if queue is empty. */ simpleQueue: function() { var queue = [], offset = 0; this.getLenth = function() { return (queue.length - offset); } this.isEmpty = function() { return (queue.length == 0); } this.enqueue = function(item) { queue.push(item); } this.dequeue = function() { // if the queue is empty, return immediately if (queue.length == 0) return undefined; // store the item at the front of the queue var item = queue[offset]; // increment the offset and remove the free space if necessary if (++offset * 2 >= queue.length) { queue = queue.slice(offset); offset = 0; } // return the dequeued item return item; } this.peek = function() { return (queue.length > 0 ? queue[offset] : undefined); } return this; }, noop: function() {}, loop: function(qInstance, interval) { }, stopLoop: function() { } }); // UMD support if( typeof define === 'function' && define.amd ) define( function() { return P; } ); else if( typeof module === 'object' && module.exports ) module.exports = P; else window.Pan = window.P = P; } )( window, document );
ArielSaldana/obvious
js/lib/pan-0.3.js
JavaScript
mit
124,924
<?php //require __DIR__.'/config_with_app.php'; require __DIR__.'/config.php'; // Create services and inject into the app. $di = new \Anax\DI\CDIFactoryDefault(); $di->set('CommentController', function() use ($di) { $controller = new \Phpmvc\Comment\CommentController(); $controller->setDI($di); return $controller; }); $app = new \Anax\Kernel\CAnax($di); $app->theme->setVariable("htmlClassesStrTwo", "html--index"); //dump($app); //navbar is added in argument file $app->theme->configure(ANAX_APP_PATH . 'config/theme-grid.php'); $app->navbar->configure(ANAX_APP_PATH . 'config/navbar_grid.php');//set navbar to other than defaul $app->url->setUrlType(\Anax\Url\CUrl::URL_CLEAN); /* $app->router->add('', function() use ($app) { $app->theme->setTitle("Jag"); $content = $app->fileContent->get('me.md'); $content = $app->textFilter->doFilter($content, 'shortcode, markdown'); $byline = $app->fileContent->get('byline.md'); $byline = $app->textFilter->doFilter($byline, 'shortcode, markdown'); $app->views->add('me/index', [ 'content' => $content, 'byline' => $byline, ]); }); */ $app->router->add('', function() use ($app) { $app->theme->setTitle("Rikard Karlsson"); $app->theme->addClassAttributeFor("body", "me"); $app->theme->addClassAttributeFor("html", "html--circle"); $content = $app->fileContent->get('me.md'); $content = $app->textFilter->doFilter($content, 'shortcode, markdown'); $aside = $app->fileContent->get('me_aside.md'); $aside = $app->textFilter->doFilter($aside, 'shortcode, markdown'); $byline = $app->fileContent->get('byline.md'); $byline = $app->textFilter->doFilter($byline, 'shortcode, markdown'); $app->views->add('grid/typography-me', [ 'content' => $content, 'byline' => $byline, ]); $app->views->add('grid/typography-me', [ 'content' => $aside, ], 'sidebar--left'); $app->views->add('grid/typography-me', [ 'content' => $aside, ], 'sidebar--right'); $app->dispatcher->forward([ 'controller' => 'comment', 'action' => 'view', 'params' =>[''], ]); });$app->router->add('me', function() use ($app) { $app->theme->setTitle("Rikard Karlsson"); $app->theme->addClassAttributeFor("body", "me"); $app->theme->addClassAttributeFor("html", "html--circle"); $content = $app->fileContent->get('me.md'); $content = $app->textFilter->doFilter($content, 'shortcode, markdown'); $aside = $app->fileContent->get('me_aside.md'); $aside = $app->textFilter->doFilter($aside, 'shortcode, markdown'); $byline = $app->fileContent->get('byline.md'); $byline = $app->textFilter->doFilter($byline, 'shortcode, markdown'); $app->views->add('grid/typography-me', [ 'content' => $content, 'byline' => $byline, ]); $app->views->add('grid/typography-me', [ 'content' => $aside, ], 'sidebar--left'); $app->views->add('grid/typography-me', [ 'content' => $aside, ], 'sidebar--right'); $app->dispatcher->forward([ 'controller' => 'comment', 'action' => 'view', 'params' =>[''], ]); }); //content from file $app->router->add('redovisning', function() use ($app) { $app->theme->setTitle("Redovisning"); $content = $app->fileContent->get('redovisning.md'); $content = $app->textFilter->doFilter($content, 'shortcode, markdown'); $byline = $app->fileContent->get('byline.md'); $byline = $app->textFilter->doFilter($byline, 'shortcode, markdown'); $menu = $app->fileContent->get('menu-report.md'); $menu = $app->textFilter->doFilter($menu, 'shortcode, markdown'); $app->views->add('grid/report', [ 'content' => $content, 'byline' => $byline, ]); $app->views->add('grid/report-menu', [ 'content' => $menu, ], 'sidebar--right'); //$app->views->add('comment/index'); //dump($_POST); $app->dispatcher->forward([ 'controller' => 'comment', 'action' => 'view', 'params' =>['redovisning'], ]); }); /* $app->router->add('kasta-tarning', function() use ($app) { $app->session();//start session $app->theme->setTitle("Kasta tärning"); include('incl/dice.php'); $app->views->add('me/calendar', [ 'content' => $content, ]); }); $app->router->add('tarningsspel', function() use ($app) { $app->theme->setTitle("Tärningsspelet 100"); include('incl/dice100.php'); //sets $content $app->views->add('me/calendar', [ 'content' => $content, ]); }); $app->router->add('kalender', function() use ($app) { $app->theme->setTitle("Kalender"); $byline = $app->fileContent->get('byline.md'); $byline = $app->textFilter->doFilter($byline, 'shortcode, markdown'); include('incl/calendar.php'); $content = $lark['main']; $app->views->add('me/calendar', [ 'content' => $content, 'byline' => $byline, ]); }); */ $app->router->add('comment', function() use ($app) { $app->theme->setTitle("Guestbook"); //$app->views->add('comment/index'); //dump($_POST); $app->dispatcher->forward([ 'controller' => 'comment', 'action' => 'view', 'params' =>['comment'], ]); //empty comment /* $comment = array( 'content' => null, 'name' => null, 'web' => null, 'mail' => null ); $saveAction = 'doCreate'; $id = null; if ( isset($_GET['id']) ) { is_numeric($_GET['id']) or die ("id is not a number"); $id = $_GET['id']; //dump($_SESSION); if ( $app->session->has('comments') ) {//TODO replace 'comments', instead read it from where it is stored $comments = $app->session->get('comments'); $comment = $comments[$id]; } $saveAction = 'doEdit'; } $app->views->add('comment/form', [ 'mail' => $comment['mail'], //TODO check that mail exists in $comment 'web' => $comment['web'], 'name' => $comment['name'], 'content' => $comment['content'], 'output' => null, 'saveAction' => $saveAction, 'id' => $id, ]);*/ }); $app->router->add('regioner', function() use ($app) { //$app->theme->addStylesheet('css/anax-grid/regions_demo.css'); $app->theme->setTitle("Regioner"); $app->views->addString('flash', 'flash') ->addString('featured-1', 'featured-1') ->addString('featured-2', 'featured-2') ->addString('featured-3', 'featured-3') ->addString('sidebar--left', 'sidebar--left') ->addString('main', 'main') ->addString('sidebar--right', 'sidebar--right') ->addString('triptych-1', 'triptych-1') ->addString('triptych-2', 'triptych-2') ->addString('triptych-3', 'triptych-3') ->addString('footer-col-1', 'footer-col-1') ->addString('footer-col-2', 'footer-col-2') ->addString('footer-col-3', 'footer-col-3') ->addString('footer-col-4', 'footer-col-4'); }); $app->router->add('regioner-left-main', function() use ($app) { //$app->theme->addStylesheet('css/anax-grid/regions_demo.css'); $app->theme->setTitle("Regioner left+main"); $app->views->addString('flash', 'flash') ->addString('featured-1', 'featured-1') ->addString('featured-2', 'featured-2') ->addString('featured-3', 'featured-3') ->addString('sidebar--left', 'sidebar--left') ->addString('main', 'main') ->addString('triptych-1', 'triptych-1') ->addString('triptych-2', 'triptych-2') ->addString('triptych-3', 'triptych-3') ->addString('footer-col-1', 'footer-col-1') ->addString('footer-col-2', 'footer-col-2') ->addString('footer-col-3', 'footer-col-3') ->addString('footer-col-4', 'footer-col-4'); }); $app->router->add('regioner-main-right', function() use ($app) { //$app->theme->addStylesheet('css/anax-grid/regions_demo.css'); $app->theme->setTitle("Regioner main-right"); $app->views->addString('flash', 'flash') ->addString('featured-1', 'featured-1') ->addString('featured-2', 'featured-2') ->addString('featured-3', 'featured-3') ->addString('main', 'main') ->addString('sidebar--right', 'sidebar--right') ->addString('triptych-1', 'triptych-1') ->addString('triptych-2', 'triptych-2') ->addString('triptych-3', 'triptych-3') ->addString('footer-col-1', 'footer-col-1') ->addString('footer-col-2', 'footer-col-2') ->addString('footer-col-3', 'footer-col-3') ->addString('footer-col-4', 'footer-col-4'); }); $app->router->add('typografi', function() use ($app) { $app->theme->setTitle("Typografi"); $content = $app->fileContent->get('typography.html'); //$content = $app->textFilter->doFilter($content, 'shortcode, markdown'); $app->views->add('grid/typografi', [ 'content' => $content, ]); $app->views->add('grid/typografi', [ 'content' => $content, ], 'sidebar--right'); }); $app->router->add('font-awesome', function() use ($app) { $app->theme->setTitle("Font Awesome"); //$app->theme->setVariable("bodyClassesStr", "font-awesome more"); $app->theme->addClassAttributeFor("body", "font-awesome"); $content = $app->fileContent->get('font-awesome.md'); $contentAside = $app->fileContent->get('font-awesome-aside.md'); $content = $app->textFilter->doFilter($content, 'shortcode, markdown'); $contentAside = $app->textFilter->doFilter($contentAside, 'shortcode, markdown'); $app->views->add('grid/typografi', [ 'content' => $content, ]); $app->views->add('grid/typografi', [ 'content' => $contentAside, ], 'sidebar--left'); }); $app->router->add('source', function() use ($app) { $app->theme->addStylesheet('css/source.css');//TODO use less $app->theme->setTitle("Källkod"); $source = new \Mos\Source\CSource([ 'secure_dir' => '..', 'base_dir' => '..', 'add_ignore' => ['.htaccess'], ]); $app->views->add('me/source', [ 'content' => $source->View(), ]); }); //echo $app->getBaseUrl(); $app->router->handle(); $app->theme->render();
RikardKarlsson/Anax-MVC
webroot/index.php
PHP
mit
10,717
8.0-alpha2:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.0-alpha3:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.0-alpha4:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.0-alpha5:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.0-alpha6:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.0-alpha7:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.0-alpha8:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.0-alpha9:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.0-alpha10:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.0-alpha11:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.0-alpha12:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.0-alpha13:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.0.0-alpha14:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.0.0-alpha15:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.0.0-beta1:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.0.0-beta2:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.0.0-beta3:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.0.0-beta4:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.0.0-beta6:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.0.0-beta7:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.0.0-beta9:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.0.0-beta10:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.0.0-beta11:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.0.0-beta12:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.0.0-beta13:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.0.0-beta14:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.0.0-beta15:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.0.0-beta16:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.0.0-rc1:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.0.0-rc2:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.0.0-rc3:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.0.0-rc4:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.0.1:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.0.2:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.0.3:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.0.4:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.0.5:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.0.6:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.1.0-beta1:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.1.0-beta2:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.1.0-rc1:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.1.1:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.1.2:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.1.3:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.1.4:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.1.5:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.1.6:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.1.7:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.1.8:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.1.9:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.1.10:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.2.0-beta1:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.2.0-beta2:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.2.0-beta3:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.2.0-rc1:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.2.0-rc2:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.2.1:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.2.2:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.2.3:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.2.4:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.2.5:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.2.6:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.3.0-alpha1:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.3.0-beta1:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.3.0-rc1:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.2.7:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.3.0-rc2:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.0.0:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.1.0:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.2.0:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31 8.3.0:0b8728cfbe3b9f6852c4d788b10d7311e68648224a3e0b0b755c0cb1d7a8da31
GoZOo/Drupaloscopy
hashs-database/hashs/core___modules___system___tests___css___system.module.css
CSS
mit
5,292
#include "vendor/unity.h" #include <stddef.h> #include <stdint.h> #include "../src/all_your_base.h" #include <stdio.h> #define LENGTH(A) (sizeof(A)/sizeof(A[0])) void setUp(void) { } void tearDown(void) { } void copy_array(int8_t src[], int8_t dest[DIGITS_ARRAY_SIZE], size_t n) { if (n > DIGITS_ARRAY_SIZE) return; for (size_t i = 0; i < n; ++i) dest[i] = src[i]; } void test_rebase(int16_t input_base, int8_t input_digits[], size_t input_length, int16_t output_base, int8_t expected_digits[], size_t expected_length) { int8_t digits[DIGITS_ARRAY_SIZE] = { 0 }; int8_t ex_digits[DIGITS_ARRAY_SIZE] = { 0 }; copy_array(input_digits, digits, input_length); copy_array(expected_digits, ex_digits, expected_length); size_t actual_length = rebase(digits, input_base, output_base, input_length); TEST_ASSERT_EQUAL_INT32(expected_length, actual_length); if (expected_length > 0) TEST_ASSERT_EQUAL_INT8_ARRAY(ex_digits, digits, expected_length); } void test_single_bit_to_decimal(void) { int8_t input[] = { 1 }; int8_t expected[] = { 1 }; test_rebase(2, input, LENGTH(input), 10, expected, LENGTH(expected)); } void test_binary_to_single_decimal(void) { TEST_IGNORE(); // delete this line to run test int8_t input[] = { 1, 0, 1 }; int8_t expected[] = { 5 }; test_rebase(2, input, LENGTH(input), 10, expected, LENGTH(expected)); } void test_single_decimal_to_binary(void) { TEST_IGNORE(); int8_t input[] = { 5 }; int8_t expected[] = { 1, 0, 1 }; test_rebase(10, input, LENGTH(input), 2, expected, LENGTH(expected)); } void test_binary_to_multiple_decimal(void) { TEST_IGNORE(); int8_t input[] = { 1, 0, 1, 0, 1, 0 }; int8_t expected[] = { 4, 2 }; test_rebase(2, input, LENGTH(input), 10, expected, LENGTH(expected)); } void test_decimal_to_binary(void) { TEST_IGNORE(); int8_t input[] = { 4, 2 }; int8_t expected[] = { 1, 0, 1, 0, 1, 0 }; test_rebase(10, input, LENGTH(input), 2, expected, LENGTH(expected)); } void test_trinary_to_hex(void) { TEST_IGNORE(); int8_t input[] = { 1, 1, 2, 0 }; int8_t expected[] = { 2, 10 }; test_rebase(3, input, LENGTH(input), 16, expected, LENGTH(expected)); } void test_hex_to_trinary(void) { TEST_IGNORE(); int8_t input[] = { 2, 10 }; int8_t expected[] = { 1, 1, 2, 0 }; test_rebase(16, input, LENGTH(input), 3, expected, LENGTH(expected)); } void test_15_bit_integer(void) { TEST_IGNORE(); int8_t input[] = { 3, 46, 60 }; int8_t expected[] = { 6, 10, 45 }; test_rebase(97, input, LENGTH(input), 73, expected, LENGTH(expected)); } void test_single_zero(void) { TEST_IGNORE(); int8_t input[] = { 0 }; int8_t expected[] = { 0 }; test_rebase(2, input, LENGTH(input), 10, expected, 0); } void test_multiple_zeros(void) { TEST_IGNORE(); int8_t input[] = { 0, 0, 0 }; int8_t expected[] = { 0 }; test_rebase(10, input, LENGTH(input), 2, expected, 0); } void test_leading_zeros(void) { TEST_IGNORE(); int8_t input[] = { 0, 6, 0 }; int8_t expected[] = { 0 }; test_rebase(7, input, LENGTH(input), 10, expected, 0); } void test_first_base_is_one(void) { TEST_IGNORE(); int8_t input[] = { 0 }; int8_t expected[] = { 0 }; test_rebase(1, input, LENGTH(input), 10, expected, 0); } void test_first_base_is_zero(void) { TEST_IGNORE(); int8_t input[] = { 0 }; int8_t expected[] = { 0 }; test_rebase(0, input, LENGTH(input), 10, expected, 0); } void test_first_base_is_negative(void) { TEST_IGNORE(); int8_t input[] = { 1 }; int8_t expected[] = { 0 }; test_rebase(-2, input, LENGTH(input), 10, expected, 0); } void test_negative_digit(void) { TEST_IGNORE(); int8_t input[] = { 1, -1, 1, 0, 1, 0 }; int8_t expected[] = { 0 }; test_rebase(2, input, LENGTH(input), 10, expected, 0); } void test_invalid_positive_digit(void) { TEST_IGNORE(); int8_t input[] = { 1, 2, 1, 0, 1, 0 }; int8_t expected[] = { 0 }; test_rebase(2, input, LENGTH(input), 10, expected, 0); } void test_second_base_is_one(void) { TEST_IGNORE(); int8_t input[] = { 1, 0, 1, 0, 1, 0 }; int8_t expected[] = { 0 }; test_rebase(2, input, LENGTH(input), 1, expected, 0); } void test_second_base_is_zero(void) { TEST_IGNORE(); int8_t input[] = { 7 }; int8_t expected[] = { 0 }; test_rebase(10, input, LENGTH(input), 0, expected, 0); } void test_second_base_is_negative(void) { TEST_IGNORE(); int8_t input[] = { 1 }; int8_t expected[] = { 0 }; test_rebase(2, input, LENGTH(input), -7, expected, 0); } void test_both_bases_are_negative(void) { TEST_IGNORE(); int8_t input[] = { 1 }; int8_t expected[] = { 0 }; test_rebase(-2, input, LENGTH(input), -7, expected, 0); } int main(void) { UnityBegin("test/test_all_your_base.c"); RUN_TEST(test_single_bit_to_decimal); RUN_TEST(test_binary_to_single_decimal); RUN_TEST(test_single_decimal_to_binary); RUN_TEST(test_binary_to_multiple_decimal); RUN_TEST(test_trinary_to_hex); RUN_TEST(test_hex_to_trinary); RUN_TEST(test_15_bit_integer); RUN_TEST(test_single_zero); RUN_TEST(test_multiple_zeros); RUN_TEST(test_leading_zeros); RUN_TEST(test_first_base_is_one); RUN_TEST(test_first_base_is_zero); RUN_TEST(test_first_base_is_negative); RUN_TEST(test_negative_digit); RUN_TEST(test_invalid_positive_digit); RUN_TEST(test_second_base_is_one); RUN_TEST(test_second_base_is_zero); RUN_TEST(test_second_base_is_negative); RUN_TEST(test_both_bases_are_negative); UnityEnd(); return 0; }
RealBarrettBrown/xc
exercises/all-your-base/test/test_all_your_base.c
C
mit
5,621
/**************************************************************************** * configs/mikroe_stm32f4/src/up_pm.c * arch/arm/src/board/up_pm.c * * Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. * Authors: Gregory Nutt <gnutt@nuttx.org> * Diego Sanchez <dsanchez@nx-engineering.com> * * 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. * 3. Neither the name NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * * 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. * ****************************************************************************/ /**************************************************************************** * Included Files ****************************************************************************/ #include <nuttx/config.h> #include <nuttx/power/pm.h> #include "up_internal.h" #include "stm32_pm.h" #include "mikroe-stm32f4-internal.h" #ifdef CONFIG_PM /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ /**************************************************************************** * Private Data ****************************************************************************/ /**************************************************************************** * Public Data ****************************************************************************/ /**************************************************************************** * Private Functions ****************************************************************************/ /**************************************************************************** * Public Functions ****************************************************************************/ /**************************************************************************** * Name: up_pminitialize * * Description: * This function is called by MCU-specific logic at power-on reset in * order to provide one-time initialization the power management subystem. * This function must be called *very* early in the initializeation sequence * *before* any other device drivers are initialized (since they may * attempt to register with the power management subsystem). * * Input parameters: * None. * * Returned value: * None. * ****************************************************************************/ void up_pminitialize(void) { /* Then initialize the NuttX power management subsystem proper */ pm_initialize(); #if defined(CONFIG_ARCH_IDLE_CUSTOM) && defined(CONFIG_PM_BUTTONS) /* Initialize the buttons to wake up the system from low power modes */ up_pmbuttons(); #endif /* Initialize the LED PM */ up_ledpminitialize(); } #endif /* CONFIG_PM */
Paregov/hexadiv
edno/software/nuttx/configs/mikroe-stm32f4/src/up_pm.c
C
mit
4,132
`use strict`; var gulp = require('gulp'); var browserify = require('browserify'); var ghPages = require('gulp-gh-pages'); var jade = require('gulp-jade'); var tap = require('gulp-tap'); var buffer = require('gulp-buffer'); var gutil = require('gulp-util'); var uglify = require('gulp-uglify'); var rename = require('gulp-rename'); var sass = require('gulp-sass'); var es = require('event-stream'); var maps = require('gulp-sourcemaps'); gulp.task('foo', function() { gutil.log(gutil.env.prod === true); }); gulp.task('browserifyMinify', function() { return gulp.src(['js/fabric.js', 'js/app.js'], {base: './'}) .pipe(tap(function(file) { gutil.log('bundling ' + file.path); file.contents = browserify(file.path).bundle(); })) .pipe(buffer()) .pipe(uglify()) .pipe(rename({ suffix: '.min' })) .pipe(gulp.dest('dist')); }); gulp.task('jade', function() { return gulp.src('index.jade') .pipe(jade({ pretty: true })) .pipe(gulp.dest('./')); }); gulp.task('sass', function() { var task = gutil.env.prod ? gulp.src('scss/style.scss') .pipe(sass({ outputStyle: 'compressed' }).on('error', sass.logError)) .pipe(rename({ suffix: '.min' })) .pipe(gulp.dest('dist/css')) : gulp.src('scss/style.scss') .pipe(maps.init()) .pipe(sass({ outputStyle: 'expanded' }).on('error', sass.logError)) .pipe(maps.write('.')) .pipe(gulp.dest('css')); if (!gutil.env.prod) { var min = gulp.src('scss/style.scss') .pipe(maps.init()) .pipe(sass({ outputStyle: 'compressed' }).on('error', sass.logError)) .pipe(rename({ suffix: '.min' })) .pipe(maps.write('./')) .pipe(gulp.dest('css')); } return gutil.env.prod ? task : es.concat(task, min); }); gulp.task('watchFiles', function() { gulp.watch('js/*.js', ['browserifyMinify']); gulp.watch('scss/style.scss', ['sass']); gulp.watch('index.jade', ['jade']); }); gulp.task('deploy', function() { return gulp.src(['./assets/2.jpg', './dist/**/*', './index.html'], {base: './'}) .pipe(ghPages()); });
alexlitel/mirrored-image-generator
gulpfile.js
JavaScript
mit
2,272
package com.vighneshiyer.datafetcher; import org.apache.commons.io.FileUtils; import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.time.*; import java.time.temporal.ChronoField; import java.util.ArrayList; import java.util.List; import java.util.concurrent.Future; import java.util.function.Consumer; /** * Fetches historical data from dukascopy.com/datafeed * Some caveats: tick data is only available going back to 2007 or so, before that only minute data is available * This class will make a best attempt to get the tick data as far back as possible. * The resolution can be specified, but if it is too low for the fetcher, then a higher resolution will be used. */ public class DukascopyDataFetcher implements DataFetcher { // This is an initial attempt to download and decompress tick data from Dukascopy // This is a implementation using parallel streams (w/ global FPJ), which will be modified later to use Akka public Future<Void> preloadHistoricalTicksForSymbol(final String symbol, final ZonedDateTime startTime, final ZonedDateTime endTime) { // Create the directory that all the downloaded files will be stored in final String homeDirectoryPath = System.getProperty("user.home"); final File dataFetcherDirectory = new File(homeDirectoryPath + File.separator + "HistoricalPriceDataFetcher" + File.separator + "DukascopyDataFetcher" ); if (!dataFetcherDirectory.exists()) { dataFetcherDirectory.mkdirs(); } final ZonedDateTime startTimeUTC = roundToNearestHourDown(startTime.withZoneSameInstant(ZoneOffset.UTC)); final ZonedDateTime endTimeUTC = roundToNearestHourUp(endTime.withZoneSameInstant(ZoneOffset.UTC)); // Generate the range of dates for which to fetch tick data final List<ZonedDateTime> datesToFetch = new ArrayList<>(); ZonedDateTime fetchTime = startTimeUTC; while (fetchTime.isBefore(endTimeUTC) || fetchTime.equals(endTimeUTC)) { datesToFetch.add(fetchTime); fetchTime = fetchTime.plusHours(1); } datesToFetch.parallelStream().forEach(new Consumer<ZonedDateTime>() { @Override public void accept(ZonedDateTime fetchDateTime) { // Create the directory for this tick file final File tickDataDirectory = new File(dataFetcherDirectory.getAbsolutePath() + File.separator + symbol + File.separator + fetchDateTime.getYear() + File.separator + fetchDateTime.getMonthValue() + File.separator + fetchDateTime.getDayOfMonth()); tickDataDirectory.mkdirs(); final File tickFile = new File(tickDataDirectory.getAbsolutePath() + File.separator + String.format("%02d", fetchDateTime.getHour()) + "h_ticks.bi5"); if (tickFile.exists()) { return; // Don't redownload files that already exist } // Generate the URL and copy the tick data to the FS URL tickURL = generateTickAPIURL(symbol, Year.of(fetchDateTime.getYear()), MonthDay.of(fetchDateTime.getMonth(), fetchDateTime.getDayOfMonth()), fetchDateTime.getHour()); if (tickURL == null) { // Log some error here, add log4j handler // This is really a significant error that indicates a bug in the code return; } try { System.out.println(tickURL); FileUtils.copyURLToFile(tickURL, tickFile, 3000, 3000); } catch (IOException e) { // Catch specifically the FileNotFoundException (404) and implement a missing data flag e.printStackTrace(); } } }); return null; } private URL generateTickAPIURL(String symbol, Year year, MonthDay monthDay, int hour) { final String tickAPITemplateURL = "https://www.dukascopy.com/datafeed/%s/%d/%02d/%02d/%02dh_ticks.bi5"; try { return new URL( String.format(tickAPITemplateURL, symbol, year.getValue(), monthDay.getMonth().getValue() - 1, monthDay.getDayOfMonth(), hour)); } catch (MalformedURLException e) { e.printStackTrace(); return null; } } private ZonedDateTime roundToNearestHourDown(ZonedDateTime time) { return time.withNano(0).withSecond(0).withMinute(0); } private ZonedDateTime roundToNearestHourUp(ZonedDateTime time) { ZonedDateTime stripSecondPrecision = time.withNano(0).withSecond(0); if (stripSecondPrecision.getMinute() > 0) { // If minute is greater than 0, move up one hour if (stripSecondPrecision.getHour() == 23) { // Move up one day if at last hour of day return stripSecondPrecision.withMinute(0).withHour(0).withDayOfMonth(stripSecondPrecision.getDayOfMonth() + 1); } return stripSecondPrecision.withMinute(0).withHour(stripSecondPrecision.getHour() + 1); } return stripSecondPrecision.withMinute(0).withHour(stripSecondPrecision.getHour()); } /** * * @param bi5CompressedFile */ private void decompressDukascopyBi5(File bi5CompressedFile) { } //private TickSeries parseBinaryTickData(File binaryTickFile) { // //} }
vighneshiyer/Historical-Price-Data-Fetcher
src/main/java/com/vighneshiyer/datafetcher/DukascopyDataFetcher.java
Java
mit
5,655
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml2/DTD/xhtml1-strict.dtd"><html><head> <script type="text/javascript">window.NREUM||(NREUM={});NREUM.info={"beacon":"bam.nr-data.net","errorBeacon":"bam.nr-data.net","licenseKey":"c2c60fdc71","applicationID":"2706765","transactionName":"IAteQktYXghcQhYAUxcFWVpKGEYFWw==","queueTime":0,"applicationTime":751,"agent":""}</script> <script type="text/javascript">window.NREUM||(NREUM={}),__nr_require=function(e,t,n){function r(n){if(!t[n]){var o=t[n]={exports:{}};e[n][0].call(o.exports,function(t){var o=e[n][1][t];return r(o||t)},o,o.exports)}return t[n].exports}if("function"==typeof __nr_require)return __nr_require;for(var o=0;o<n.length;o++)r(n[o]);return r}({1:[function(e,t,n){function r(){}function o(e,t,n){return function(){return i(e,[(new Date).getTime()].concat(u(arguments)),t?null:this,n),t?void 0:this}}var i=e("handle"),a=e(2),u=e(3),c=e("ee").get("tracer"),f=NREUM;"undefined"==typeof window.newrelic&&(newrelic=f);var s=["setPageViewName","setCustomAttribute","setErrorHandler","finished","addToTrace","inlineHit"],l="api-",p=l+"ixn-";a(s,function(e,t){f[t]=o(l+t,!0,"api")}),f.addPageAction=o(l+"addPageAction",!0),f.setCurrentRouteName=o(l+"routeName",!0),t.exports=newrelic,f.interaction=function(){return(new r).get()};var d=r.prototype={createTracer:function(e,t){var n={},r=this,o="function"==typeof t;return i(p+"tracer",[Date.now(),e,n],r),function(){if(c.emit((o?"":"no-")+"fn-start",[Date.now(),r,o],n),o)try{return t.apply(this,arguments)}finally{c.emit("fn-end",[Date.now()],n)}}}};a("setName,setAttribute,save,ignore,onEnd,getContext,end,get".split(","),function(e,t){d[t]=o(p+t)}),newrelic.noticeError=function(e){"string"==typeof e&&(e=new Error(e)),i("err",[e,(new Date).getTime()])}},{}],2:[function(e,t,n){function r(e,t){var n=[],r="",i=0;for(r in e)o.call(e,r)&&(n[i]=t(r,e[r]),i+=1);return n}var o=Object.prototype.hasOwnProperty;t.exports=r},{}],3:[function(e,t,n){function r(e,t,n){t||(t=0),"undefined"==typeof n&&(n=e?e.length:0);for(var r=-1,o=n-t||0,i=Array(o<0?0:o);++r<o;)i[r]=e[t+r];return i}t.exports=r},{}],ee:[function(e,t,n){function r(){}function o(e){function t(e){return e&&e instanceof r?e:e?u(e,a,i):i()}function n(n,r,o){e&&e(n,r,o);for(var i=t(o),a=p(n),u=a.length,c=0;c<u;c++)a[c].apply(i,r);var s=f[m[n]];return s&&s.push([w,n,r,i]),i}function l(e,t){g[e]=p(e).concat(t)}function p(e){return g[e]||[]}function d(e){return s[e]=s[e]||o(n)}function v(e,t){c(e,function(e,n){t=t||"feature",m[n]=t,t in f||(f[t]=[])})}var g={},m={},w={on:l,emit:n,get:d,listeners:p,context:t,buffer:v};return w}function i(){return new r}var a="nr@context",u=e("gos"),c=e(2),f={},s={},l=t.exports=o();l.backlog=f},{}],gos:[function(e,t,n){function r(e,t,n){if(o.call(e,t))return e[t];var r=n();if(Object.defineProperty&&Object.keys)try{return Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!1}),r}catch(i){}return e[t]=r,r}var o=Object.prototype.hasOwnProperty;t.exports=r},{}],handle:[function(e,t,n){function r(e,t,n,r){o.buffer([e],r),o.emit(e,t,n)}var o=e("ee").get("handle");t.exports=r,r.ee=o},{}],id:[function(e,t,n){function r(e){var t=typeof e;return!e||"object"!==t&&"function"!==t?-1:e===window?0:a(e,i,function(){return o++})}var o=1,i="nr@id",a=e("gos");t.exports=r},{}],loader:[function(e,t,n){function r(){if(!h++){var e=y.info=NREUM.info,t=s.getElementsByTagName("script")[0];if(e&&e.licenseKey&&e.applicationID&&t){c(m,function(t,n){e[t]||(e[t]=n)}),u("mark",["onload",a()],null,"api");var n=s.createElement("script");n.src="https://"+e.agent,t.parentNode.insertBefore(n,t)}}}function o(){"complete"===s.readyState&&i()}function i(){u("mark",["domContent",a()],null,"api")}function a(){return(new Date).getTime()}var u=e("handle"),c=e(2),f=window,s=f.document,l="addEventListener",p="attachEvent",d=f.XMLHttpRequest,v=d&&d.prototype;NREUM.o={ST:setTimeout,CT:clearTimeout,XHR:d,REQ:f.Request,EV:f.Event,PR:f.Promise,MO:f.MutationObserver},e(1);var g=""+location,m={beacon:"bam.nr-data.net",errorBeacon:"bam.nr-data.net",agent:"js-agent.newrelic.com/nr-984.min.js"},w=d&&v&&v[l]&&!/CriOS/.test(navigator.userAgent),y=t.exports={offset:a(),origin:g,features:{},xhrWrappable:w};s[l]?(s[l]("DOMContentLoaded",i,!1),f[l]("load",r,!1)):(s[p]("onreadystatechange",o),f[p]("onload",r)),u("mark",["firstbyte",a()],null,"api");var h=0},{}]},{},["loader"]);</script><title>Oxybelis wilsoni</title><link href="/assets/application-f65a405f045fcebfda85208cbf70d429.css" media="screen" rel="stylesheet" type="text/css" /> <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/blitzer/jquery-ui.css" media="screen" rel="stylesheet" type="text/css" /><script src="/assets/application-1e01fb0ed608da816b06d533596beaa7.js" type="text/javascript"></script><script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script><script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script><script type="text/javascript">jQuery.noConflict()</script><script src="/mousetrap.min.js"></script><script src="/jquery.cookie.js"></script><script src="/jquery.colorize-1.7.0.js"></script><script src="/modernizr.js"></script><script src="/jquery.easytabs.min.js"></script><script src="/jquery.hashchange.min.js"></script><script src="//cdnjs.cloudflare.com/ajax/libs/jquery.cycle/3.03/jquery.cycle.all.min.js"></script><script src="//cdnjs.cloudflare.com/ajax/libs/qtip2/3.0.3/jquery.qtip.min.js"></script><script src="/jqueryapp.js"></script><title>Oxybelis wilsoni</title><link href="http://fonts.googleapis.com/css?family=Titillium+Web" rel="stylesheet" type="text/css" /><link href="http://fonts.googleapis.com/css?family=PT+Sans+Caption" rel="stylesheet" type="text/css" /><link href="//cdnjs.cloudflare.com/ajax/libs/qtip2/3.0.3/jquery.qtip.min.css" rel="stylesheet" type="text/css" /><link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" /><link href="//cdnjs.cloudflare.com/ajax/libs/jquery-jgrowl/1.4.1/jquery.jgrowl.min.css" media="screen" rel="stylesheet" type="text/css" /><script src="//cdnjs.cloudflare.com/ajax/libs/jquery-jgrowl/1.4.1/jquery.jgrowl.min.js" type="text/javascript"></script><script type="text/javascript">(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-11380791-1', 'auto'); ga('send', 'pageview');</script></head><body><div class="headfoot" id="header"><div class="box"><div class="logo"><a href="/"><img alt="Home Page" border="0" src="/images/common/redlist50.png" /></a></div><div class="bannercontainer"><table border="0" cellmargin="0" cellpadding="0" width="100%"><tbody><tr><td align="left"><img alt="The IUCN Red List of Threatened Species(tm)" src="/images/common/iucnredlistbanner.gif" title="The IUCN Red List of Threatened Species(tm)" /></td><td align="right" valign="middle"><span id="dataVersion">2016-2</span></td><td align="right"><div id="help"><div class="rc-head"><div class="rc-head_top"><div>&nbsp;</div></div><div class="rc-head_content"><a href="/search/list">Login</a> | <a href="/info/faq">FAQ</a> | <a href="/about/contact-info">Contact</a> | <a href="/info/terms-of-use">Terms of use</a> | <a href="http://www.iucn.org">IUCN.org</a><div class="dialog" id="splash"><div class="popup-landing overlay-splash"><div style="text-align: center;margin-left: 40%;"><div class="support-iucn" style="padding-top: 10%;padding-bottom: 10%;font-size: 10px;"><h1>Support the</h1><h1><strong>IUCN Red List</strong></h1><button class="button pledge" data-choice="support" href="http://support.iucnredlist.org" onclick="window.location.href=&#39;http://support.iucnredlist.org&#39;" style="color:white;"> Learn More</button></div><div><button class="button continue" data-choice="return" href="#" id="btnContinue" style="color:white;border: none;padding: 8px;">Continue to The IUCN Red List<span></span></button><div style="margin-left: 50%;color:white"><input id="remember_selection" name="remember_selection" style="float:left" type="checkbox" /><div class="popup-footer label" style="float:left;font-family:arial;font-size:11px;padding:3px;"> Remember my Selection</div></div><div class="popup-logo" style="height: 300px;"></div></div></div></div></div><script type="text/javascript">jQuery.noConflict(); jQuery(document).ready(function($){ // only fire on the home page if(window.location.pathname != '/'){ return } $('#btnContinue').click(function(e){ // alert('close me'); $('#splash').dialog('close'); }); $('#splash').dialog({ modal: true, autoOpen: false, width: window.innerWidth - 15, dialogClass: "no-close", show: { effect: 'fade', duration: 500 } }).dialog("widget") .next(".ui-widget-overlay") .css("background", "#66CCFF"); $('#splash').dialog("moveToTop"); $(".ui-dialog-titlebar").hide(); $(".ui-widget-overlay").css({background: "#000", opacity: 0.9}); // reading cookie user_choice = $.cookie('user_choice2'); if (user_choice == 'return' || user_choice == 'support') { $button = $(".button[data-choice='"+user_choice+"']"); if($button.length > 0){ if($button.is('.close')){} else window.location.href = $button.attr('href'); } else $('#splash').dialog('open'); } else // if no cookie $('#splash').dialog('open'); $button = $(".button").on('click',function(){ if($("#remember_selection").is(':checked')){ // writting cookie $.cookie('user_choice2', $(this).attr('data-choice'), {expires: 14}); } }); });</script><div id="feedback"><span id="feedback_button"><img src="/images/feedback.png" /></span></div><!--Feedback form (hidden initially)--><form action="/feedback" class="form-horizontal" id="feedbackForm" method="post" name="feedbackForm" style="display: none;text-align: left;"><div class="form-group" style="padding-left: 15px;padding-right: 15px;padding-bottom:15px;font-size: 13px;">Thank you for taking the time to provide feedback on the IUCN Red List of Threatened Species website, we are grateful for your input. </div><div class="form-group" style="padding-left: 15px;padding-right: 15px;padding-bottom:15px;font-size: 13px;"><label class="col-xs-3 control-label">Email address *</label><div class="col-xs-7"><input class="form-control" name="email" type="text" /></div></div><div class="form-group" style="padding-left: 15px;padding-right: 15px;padding-bottom:15px;font-size: 13px;"><label class="col-xs-3 control-label">Message *</label><div class="col-xs-9"><textarea class="form-control" name="message" rows="5" style="width: 90%;"></textarea></div></div><div class="form-group" style="padding-left: 15px;padding-right: 15px;padding-bottom:15px;font-size: 13px;"><script src="https://www.google.com/recaptcha/api.js" async defer></script> <div class="g-recaptcha" data-sitekey="6LcFeiYTAAAAAPMBDw0jyZELqfuSrV_-nq0VZZyc"></div> <noscript> <div style="width: 302px; height: 352px;"> <div style="width: 302px; height: 352px; position: relative;"> <div style="width: 302px; height: 352px; position: absolute;"> <iframe src="https://www.google.com/recaptcha/api/fallback?k=6LcFeiYTAAAAAPMBDw0jyZELqfuSrV_-nq0VZZyc" frameborder="0" scrolling="no" style="width: 302px; height:352px; border-style: none;"> </iframe> </div> <div style="width: 250px; height: 80px; position: absolute; border-style: none; bottom: 21px; left: 25px; margin: 0px; padding: 0px; right: 25px;"> <textarea id="g-recaptcha-response" name="g-recaptcha-response" class="g-recaptcha-response" style="width: 250px; height: 80px; border: 1px solid #c1c1c1; margin: 0px; padding: 0px; resize: none;" value=""> </textarea> </div> </div> </div> </noscript> </div><div class="form-group" style="padding-left: 15px;padding-right: 15px;font-size: 13px;text-align:right"><div class="col-xs-5 col-xs-offset-3"><button id="feedback-form-submit" type="submit"><i class="fa fa-envelope-o"></i> Send</button></div></div></form></div><div class="rc-head_bottom"><div>&nbsp;</div></div></div></div></td></tr></tbody></table></div><div class="navcontainer"><div id="topnav_container"><ul id="topnav_menu"><li class="top"><a href="/about" class="top_link" id="about"><span>About</span></a><ul class="sub"><li><a href="/about/introduction">Introduction</a></li><li><a href="/about/overview">Overview of The IUCN Red List</a></li><li><a href="/about/supportredlist">Support The IUCN Redlist</a></li><li><a href="/about/publication">Publications</a></li><li><a href="/about/summary-statistics">Summary Statistics</a></li><li><a href="/about/links">External Links</a></li><li><a href="/about/citing">Citing The IUCN Red List</a></li><li><a href="/about/contact-info">Contact Details</a></li></ul></li><li class="top"><a href="/initiatives" class="top_link" id="initiatives"><span>Initiatives</span></a><ul class="sub"><li><a href="/initiatives/amphibians">Amphibians</a></li><li><a href="/initiatives/mammals">Mammals</a></li><li><a href="/initiatives/europe">Europe</a></li><li><a href="/initiatives/mediterranean">Mediterranean</a></li><li><a href="/initiatives/freshwater">Freshwater</a></li><li><a href="/initiatives/marine">Marine</a></li></ul></li><li class="top"><a href="/news" class="top_link" id="news"><span>News</span></a><ul class="sub"><li><a href="/current-news">Current</a></li><li><a href="/archives">Archives</a></li></ul></li><li class="top"><a href="/photos" class="top_link" id="photos"><span>Photos</span></a><ul class="sub"><li><a href="/photos/2016">2016</a></li><li><a href="/photos/2015">2015</a></li><li><a href="/photos/2014">2014</a></li><li><a href="/photos/2013">2013</a></li><li><a href="/photos/2012">2012</a></li><li><a href="/photos/2011">2011</a></li><li><a href="/photos/2010">2010</a></li><li><a href="/photos/2009">2009</a></li><li><a href="/photos/2008">2008</a></li><li><a href="/photos/2007">2007</a></li><li><a href="/photos/2006">2006</a></li><li><a href="/photos/2004">2004</a></li><li><a href="/photos/2003">2003</a></li><li><a href="/photos/2002">2002</a></li><li><a href="/photos/2000">2000</a></li></ul></li><li class="top"><a href="/partners" class="top_link" id="partners"><span>Partners</span></a><ul class="sub"><li><a href="/partners/partners">IUCN Red List Partnership</a></li><li><a href="/partners/technical">Technical Support</a></li></ul></li><li class="top"><a href="/sponsors" class="top_link" id="sponsors"><span>Sponsors</span></a></li><li class="top"><a href="/technical-documents" class="top_link" id="technical-documents"><span>Resources</span></a><ul class="sub"><li><a href="/technical-documents/red-list-documents">Key Documents</a></li><li><a href="/technical-documents/categories-and-criteria">Categories and Criteria</a></li><li><a href="/technical-documents/publications">Publications</a></li><li><a href="/technical-documents/classification-schemes">Classification Schemes</a></li><li><a href="/technical-documents/data-organization">Data Organization</a></li><li><a href="/technical-documents/red-list-api">Red List API</a></li><li><a href="/technical-documents/spatial-data">Spatial Data Download</a></li><li><a href="/technical-documents/information-sources-and-quality">Information Sources and Quality</a></li><li><a href="/technical-documents/assessment-process">Assessment Process</a></li><li><a href="/technical-documents/red-list-training">Red List Training</a></li><li><a href="/technical-documents/references">References</a></li><li><a href="/technical-documents/acknowledgements">Acknowledgements</a></li><li><a href="/technical-documents/sisupdate">SIS News and Updates</a></li></ul></li><li class="top"><a href="http://support.iucnredlist.org" class="top_link" id="ttp://support.iucnredlist.org" target="_blank"><span>Take Action</span></a></li></ul></div><div class="helpsave"><a href="https://support.iucnredlist.org/donate" target="_blank"><img alt="" border="0" src="http://wiki_docs.s3.amazonaws.com/images/donate_now_red_list_green.png" /></a></div><div id="search"><div class="rc-head"><div class="rc-head_top"><div>&nbsp;</div></div><div class="rc-head_content"><form action="/search/external" method="POST" onSubmit="return checkQuickSearch()"><input class="text" data-qtip="Enter a search term (taxonomic name to species level or common name)" id="quickSearchText" name="text" onBlur="resetOnBlur(this)" onFocus="clearOnFocus(this)" type="text" value="Enter Red List search term(s)" /><input id="rlsearchboxmodeflag" name="mode" type="hidden" value="" />&nbsp;<input alt="Enter a search term (taxonomic name to species level or common name) in the box and click here to see the results." height="23" src="/images/common/icons/search.gif" title="Enter a search term (taxonomic name to species level or common name) in the box and click here to see the results." type="image" width="22" />&nbsp;<img alt="Click here to view more detailed search options such as taxonomy, location, habitat, assessment." data-qtip="Click here to view more detailed search options such as taxonomy, location, habitat, assessment." id="searchOpen" onclick="showAdvanced(window.searchmode); return true;" src="/images/common/icons/search_open.gif" style="margin:0; padding:0;" />&nbsp; &nbsp;<span style="font-size: smaller;"><a href="http://discover.iucnredlist.org" id="discoverlink" target="_blank">Discover more</a></span><div class="error" id="quickSearchError">&nbsp;</div></form></div></div></div></div></div></div><div id="breadcrumb"><a href="/">Home</a> &raquo; Oxybelis wilsoni</div><div id="container"><div id="inner"><div class="details"><div id="container"><div id="inner"><div id="leftcol"><div><div></div></div><a href="http://maps.iucnredlist.org/map.html?id=203305"><img alt="Map_thumbnail_large_font" border="0" src="/images/map_thumbnail_large_FONT.jpg" /></a><br /><br /><div id="div-gpt-ad-1419251533750-0" style="height:176; width:245;"></div><script type="text/javascript">googletag.cmd.push(function() { googletag.display("div-gpt-ad-1419251533750-0"); });</script></div><div id="content_factsheet"><div id="top"><table border="0" cellpadding="0" width="770"><tr><td width="65%"><h1><span class="sciname">Oxybelis wilsoni</span>&nbsp;</h1><span class="doi_link top" data-assessment-id="2763612"><a></a></span></td><td width="2%"></td><td class="regional" width="30%">Scope: <em>Global</em><div class="download-link"><span class="pdf_link" data-assessment-id="2763612"><a style="text-decoration: none;"><span style="text-decoration: underline;">Download assessment</span> <i class="fa fa-file-pdf-o"></i></a></span></div><div class="download-link"></div></td></tr></table></div><div id="scale_factsheet"><img alt="Status_ne_off" class="off" src="/assets/details/status_ne_off-8575e0210a637cf0bae858fc9c46071f.gif" /><img alt="Status_dd_off" class="off" src="/assets/details/status_dd_off-9b16e00307749bac5c5ff15fe94ea2a0.gif" /><img alt="Status_lc_off" class="off" src="/assets/details/status_lc_off-f2c32dd576f5b067d64467badf7bd69c.gif" /><img alt="Status_nt_off" class="off" src="/assets/details/status_nt_off-021e286b60d56c8b7ec20f7994542ffc.gif" /><img alt="Status_vu_off" class="off" src="/assets/details/status_vu_off-fa0f4d871ba412a735d3d5423cae02d2.gif" /><img alt="Status_en_on" class="on" src="/assets/details/status_en_on-aad71debe11cc26331a3beeda34865ee.gif" /><img alt="Status_cr_off" class="off" src="/assets/details/status_cr_off-6f21b005ec167ae9737812b9dc906b03.gif" /><img alt="Status_ew_off" class="off" src="/assets/details/status_ew_off-a876aa504cadde967d16d6691d0d913e.gif" /><img alt="Status_ex_off" class="off" src="/assets/details/status_ex_off-140059c1efdc2088a3d8437d7b4751e6.gif" /></div><div id="detailsPage"><div id="topnav_factsheet"> <ul id="tabs"> <li > <a href="/details/summary/203305/0">Summary</a></li> <li > <a href="/details/classify/203305/0">Classification Schemes</a></li> <li > <a href="/details/links/203305/0">Images &amp; External Links</a></li> <li > <a href="/details/biblio/203305/0">Bibliography</a></li> <li class=&quot;active&quot;> <a href="/details/full/203305/0" class="current">Full Account</a></li> </ul> </div> <!-- Right --> <div id="rightnav_factsheet"> <div> <a href="#sectionTaxonomy" onClick="new Effect.ScrollTo('sectionTaxonomy'); return false;" class="dynamic">Taxonomy</a> </div> <div> <a href="#sectionAssessment" onClick="new Effect.ScrollTo('sectionAssessment'); return false;" class="dynamic">Assessment Information</a> </div> <div> <a href="#sectionRange" onClick="new Effect.ScrollTo('sectionRange'); return false;" class="dynamic">Geographic Range</a> </div> <div> <a href="#sectionPopulation" onClick="new Effect.ScrollTo('sectionPopulation'); return false;" class="dynamic">Population</a> </div> <div> <a href="#sectionHabitat" onClick="new Effect.ScrollTo('sectionHabitat'); return false;" class="dynamic">Habitat and Ecology</a> </div> <div> <a href="#sectionUsetrade" onClick="new Effect.ScrollTo('sectionUsetrade'); return false;" class="dynamic">Use and Trade</a> </div> <div> <a href="#sectionThreats" onClick="new Effect.ScrollTo('sectionThreats'); return false;" class="dynamic">Threats</a> </div> <div> <a href="#sectionMeasures" onClick="new Effect.ScrollTo('sectionMeasures'); return false;" class="dynamic">Conservation Actions</a> </div> <div> <a href="#sectionClassify" onClick="new Effect.ScrollTo('sectionClassify'); return false;" class="dynamic">Classifications</a> </div> <div> <a href="#sectionSources" onClick="new Effect.ScrollTo('sectionSources'); return false;" class="dynamic">Bibliography</a> </div> <p> <!-- <img src="/images/printer.png"/> <a href="/details/full/203305/0/print">View Printer Friendly</a> --> </p> <!-- GOOGLE TRANSLATE WIDGET --> <div style="border-top: solid 1px #d81e05;margin-top: 10px;margin-bottom: 10px;"></div> <div style=""> <p style="padding-bottom:10px"> <i class="fa fa-lg fa-info-circle" style="color:#d81e05;" data-qtip="&lt;strong&gt;Terms of Use:&lt;/strong&gt; The Google Translate service is a means by which the IUCN Red List of Threatened Species (IUCN Red List) offers translations of content and is meant solely for the convenience of non-English speaking users of the website. The translated content is provided directly and dynamically by Google; The IUCN Red List has no direct control over the translated content as it appears using this tool. Therefore, in all contexts, the English content, as directly provided by the IUCN Red List is to be held authoritative."></i> <span style="font-weight:normal"> Translate page into:</span></p> <div id="google_translate_element" style="padding-bottom:10px"></div> <script type="text/javascript">function googleTranslateElementInit() { new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, 'google_translate_element'); } </script><script src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit" type="text/javascript"></script> </div> </div> <!-- Factsheet data --> <div id="data_factsheet"> <div id="detailsTabSpinner"> </div> <h2 id="sectionTaxonomy" class=&quot;first&quot;> Taxonomy <a class="up dynamic" href="#top" onClick="new Effect.ScrollTo('top'); return false;">[top]</a> </h2> <table class="tab_data" cellpadding="0" cellspacing="0"> <tr> <th>Kingdom</th> <th>Phylum</th> <th>Class</th> <th>Order</th> <th>Family</th> </tr> <tr> <td>Animalia</td> <td>Chordata</td> <td>Reptilia</td> <td>Squamata</td> <td>Colubridae</td> </tr> </table> <br /> <table class="tab_data" cellpadding="0" cellspacing="0"> <tr> <td class="label"><strong>Scientific Name:</strong></td> <td class="sciName"><span class="sciname">Oxybelis wilsoni</span></td> </tr> <tr> <td class="label"><strong>Species Authority:</strong></td> <td>Villa &amp; McCranie, 1995</td> </tr> </table> <h2 id="sectionAssessment" > Assessment Information <a class="up dynamic" href="#top" onClick="new Effect.ScrollTo('top'); return false;">[top]</a> </h2> <table class="tab_data" cellpadding="0" cellspacing="0"> <tr> <td class="label"><strong>Red List Category &amp; Criteria:</strong></td> <td> Endangered B1ab(iii) <a href="/static/categories_criteria_3_1">ver 3.1</a> </td> </tr> <tr> <td class="label"><strong>Year Published:</strong></td> <td>2013</td> </tr> <tr> <td class="label"><strong>Date Assessed:</strong></td> <td>2012-05-09</td> </tr> <tr> <td class="label"><strong>Assessor(s):</strong></td> <td>Townsend, J.H.</td> </tr> <tr> <td class="label"><strong>Reviewer(s):</strong></td> <td>Bowles, P.</td> </tr> <tr> <td colspan="2"> <strong>Justification:</strong><br /> Listed as Endangered because this species has an extent of occurrence is 130 km<sup>2</sup> (the area of Roatan Island), the island is treated as a single location at risk from infrastructure development, and it is experiencing an ongoing decline in the quality and extent of suitable habitat as a result of land clearance. </td> </tr> </table> <h2 id="sectionRange" > Geographic Range <a class="up dynamic" href="#top" onClick="new Effect.ScrollTo('top'); return false;">[top]</a> </h2> <table class="tab_data" cellpadding="0" cellspacing="0"> <tr><td class="label"><strong>Range Description:</strong></td><td><span style="font-style: italic;">Oxybelis wilsoni</span> is endemic to Roatan Island in Honduras, where it occurs from sea level to 95 m asl.</td></tr><tr><td class="label"><strong>Countries occurrence:</strong></td><td class="rangeList"><div class='group'><div class='title'>Native:</div>Honduras (Honduran Caribbean Is.)</div></td></tr><tr><th>Additional data:</th><td><table class="tab-data"><tr></tr><tr></tr><tr></tr><tr><td>&#9830; <em>Number of Locations:</em></td><td>1</td></tr><tr></tr><tr><td>&#9830; <em>Upper elevation limit (metres):</em></td><td>95</td></tr><tr></tr></table></td></tr><tr><td class="label"><strong>Range Map:</strong></td><td><a href="http://maps.iucnredlist.org/map.html?id=203305">Click here to open the map viewer and explore range.</a></td></tr> </table> <h2 id="sectionPopulation" > Population <a class="up dynamic" href="#top" onClick="new Effect.ScrollTo('top'); return false;">[top]</a> </h2> <table class="tab_data" cellpadding="0" cellspacing="0"> <tr><td class="label"><strong>Population:</strong></td><td>This is an uncommon species, and is likely to be declining.</td></tr><tr><td class="label"><strong>Current Population Trend:</strong></td><td id="popTrend"><img alt="" src="/assets/trends/down-0c22590efab2a6079af97d463e1b9178.png" /><span>Decreasing</span></td></tr><tr><th>Additional data:</th><td><table class="tab-data"><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr></table></td></tr> </table> <h2 id="sectionHabitat" > Habitat and Ecology <a class="up dynamic" href="#top" onClick="new Effect.ScrollTo('top'); return false;">[top]</a> </h2> <table class="tab_data" cellpadding="0" cellspacing="0"> <tr><td class="label"><strong>Habitat and Ecology:</strong></td><td>This snake has a limited distribution in Tropical Wet Forest, Tropical Moist Forest, and coastal scrub, including disturbed forested areas. The species is arboreal, and largely diurnal.</td></tr><tr><td class="label"><strong>Systems:</strong></td><td>Terrestrial</td></tr> </table> <h2 id="sectionUsetrade" > Use and Trade <a class="up dynamic" href="#top" onClick="new Effect.ScrollTo('top'); return false;">[top]</a> </h2> <table class="tab_data" cellpadding="0" cellspacing="0"> <tr> <td class="label"><strong>Use and Trade:</strong></td> <td> There is no known use or trade in this species. </td> </tr> </table> <h2 id="sectionThreats" > Threats <a class="up dynamic" href="#top" onClick="new Effect.ScrollTo('top'); return false;">[top]</a> </h2> <table class="tab_data" cellpadding="0" cellspacing="0"> <tr> <td class="label"><strong>Major Threat(s):</strong></td> <td> Threats include loss of forested habitat as a result of residential and tourist development, as while this arboreal species can persist in disturbed forest it will not survive in cleared land. </td> </tr> </table> <h2 id="sectionMeasures" > Conservation Actions <a class="up dynamic" href="#top" onClick="new Effect.ScrollTo('top'); return false;">[top]</a> </h2> <table class="tab_data" cellpadding="0" cellspacing="0"> <tr> <td class="label"><strong>Conservation Actions:</strong></td> <td> This species' forest habitat is not protected. </td> </tr> </table> <h2 id="sectionClassify" > Classifications <a class="up dynamic" href="#top" onClick="new Effect.ScrollTo('top'); return false;">[top]</a> </h2> <table class="tab_data" cellpadding="0" cellspacing="0"> <div class="tab-container" id="tab-container"><ul class="etabs"><li class="tab2"><a href="#habitat">Habitats</a></li><li class="tab2"><a href="#threats">Threats</a></li><li class="tab2"><a href="#conservation_in_place">Actions In Place</a></li><li class="tab2"><a href="#conservation_actions">Actions Needed</a></li><li class="tab2"><a href="#research_needed">Research Needed</a></li><li class="tab2"><a href="#end_uses">Uses</a></li></ul><div id="habitat"><fieldset class="accordion-data">1. Forest -&gt; 1.6. Forest - Subtropical/Tropical Moist Lowland<br /><strong>suitability:</strong>Suitable&emsp;<strong>season:</strong>resident&emsp;<strong>major importance:</strong>Yes<hr color="#E8E8E8" />3. Shrubland -&gt; 3.6. Shrubland - Subtropical/Tropical Moist<br /><strong>suitability:</strong>Suitable&emsp;<strong>season:</strong>resident&emsp;<strong>major importance:</strong>Yes<hr color="#E8E8E8" /></fieldset><style type="text/css">.accordion-data{ / font-family: 'Titillium Web', sans-serif; / font-family: 'PT Sans Caption', sans-serif; font-size:75%; }</style><!--content--></div><div id="conservation_actions"><fieldset class="accordion-data"><style type="text/css">.accordion-data{ / font-family: 'Titillium Web', sans-serif; / font-family: 'PT Sans Caption', sans-serif; font-size:75%; }</style></fieldset></div><div id="conservation_in_place"><fieldset class="accordion-data"><br /><strong>In-Place Research, Monitoring and Planning</strong><hr color="#E8E8E8" /><strong>In-Place Land/Water Protection and Management</strong><hr color="#E8E8E8" /><strong>In-Place Species Management</strong><hr color="#E8E8E8" /><strong>In-Place Education</strong><hr color="#E8E8E8" /></fieldset><style type="text/css">.accordion-data{ / font-family: 'Titillium Web', sans-serif; / font-family: 'PT Sans Caption', sans-serif; font-size:75%; }</style></div><div id="threats"><fieldset class="accordion-data">1. Residential &amp; commercial development -&gt; 1.1. Housing &amp; urban areas<br /><em><strong>&diams; timing:</strong></em>Ongoing&emsp;<em><strong>&diams; scope:</strong></em>Majority (50-90%)&emsp;<em><strong>&diams; severity:</strong></em>Unknown&emsp;<em><strong>&rArr; Impact score:</strong></em>Unknown&emsp;<br /><strong> &#8594; Stresses</strong><ul style="list-style-type:square"><li>1. Ecosystem stresses -&gt; 1.1. Ecosystem conversion</li><li>1. Ecosystem stresses -&gt; 1.2. Ecosystem degradation</li></ul><hr color="#E8E8E8" />1. Residential &amp; commercial development -&gt; 1.2. Commercial &amp; industrial areas<br /><em><strong>&diams; timing:</strong></em>Ongoing&emsp;<em><strong>&diams; scope:</strong></em>Majority (50-90%)&emsp;<em><strong>&diams; severity:</strong></em>Unknown&emsp;<em><strong>&rArr; Impact score:</strong></em>Unknown&emsp;<br /><strong> &#8594; Stresses</strong><ul style="list-style-type:square"><li>1. Ecosystem stresses -&gt; 1.1. Ecosystem conversion</li><li>1. Ecosystem stresses -&gt; 1.2. Ecosystem degradation</li></ul><hr color="#E8E8E8" />1. Residential &amp; commercial development -&gt; 1.3. Tourism &amp; recreation areas<br /><em><strong>&diams; timing:</strong></em>Ongoing&emsp;<em><strong>&diams; scope:</strong></em>Majority (50-90%)&emsp;<em><strong>&diams; severity:</strong></em>Unknown&emsp;<em><strong>&rArr; Impact score:</strong></em>Unknown&emsp;<br /><strong> &#8594; Stresses</strong><ul style="list-style-type:square"><li>1. Ecosystem stresses -&gt; 1.1. Ecosystem conversion</li><li>1. Ecosystem stresses -&gt; 1.2. Ecosystem degradation</li></ul><hr color="#E8E8E8" /></fieldset></div><div id="research_needed"><fieldset class="accordion-data"></fieldset><style type="text/css">.accordion-data{ / font-family: 'Titillium Web', sans-serif; / font-family: 'PT Sans Caption', sans-serif; font-size:75%; }</style></div><div id="end_uses"><fieldset class="accordion-data"></fieldset><style type="text/css">.accordion-data{ / font-family: 'Titillium Web', sans-serif; / font-family: 'PT Sans Caption', sans-serif; font-size:75%; }</style><!--content--></div></div><script type="text/javascript">jQuery(document).ready(function($){ $('#tab-container').easytabs(); });</script><style type="text/css">#accordion { font-family: "Trebuchet MS", "Helvetica", "Arial", "Verdana", "sans-serif"; font-size: 90.5%; } .light .accordion-data{ # font-family: 'Titillium Web', sans-serif; font-family: 'PT Sans Caption', sans-serif; font-size:65%; } .etabs { margin: 0; padding: 0; } .tab2 { display: inline-block; zoom:1; *display:inline; background: #eee; border: solid 1px #999; border-bottom: none; -moz-border-radius: 4px 4px 0 0; -webkit-border-radius: 4px 4px 0 0; } .tab2 a { font-size: 13px; line-height: 2em; display: block; padding: 0 10px; outline: none; } .tab2 a:hover { text-decoration: underline; } .tab2.active { background: #fff; padding-top: 6px; position: relative; top: 1px; border-color: #666; } .tab2 a.active { font-weight: bold; } .tab-container .panel-container { background: #fff; border: solid #666 2px; padding: 10px; -moz-border-radius: 0 4px 4px 4px; -webkit-border-radius: 0 4px 4px 4px; }</style> </table> <h2 id="sectionSources" > Bibliography <a class="up dynamic" href="#top" onClick="new Effect.ScrollTo('top'); return false;">[top]</a> </h2> <table class="tab_data" cellpadding="0" cellspacing="0"> <tr> <td class="label"></td> <td> <p>IUCN. 2013. IUCN Red List of Threatened Species (ver. 2013.2). Available at: <a href="http://www.iucnredlist.org">http://www.iucnredlist.org</a>. (Accessed: 13 November 2013).</p> <p>Köhler, G. 2003. <i>Reptiles of Central America</i>. Herpeton, Germany.</p> <p>McCranie, J.R. 2011. <i>The Snakes of Honduras: Systematics, Distribution, and Conservation</i>. Society for the Study of Amphibians and Reptiles.</p> <p>Wilson, L.D. and Johnson, J.D. 2010. Distributional patterns of the herpetofauna of Mesoamerica, a biodiversity hotspot. In: L.D. Wilson, J.H. Townsend, J.H. and J.D. Johnson (eds), <i>Conservation of Mesoamerican amphibians and reptiles</i>, pp. 30-235. Eagle Mountain Publishing, Eagle Mountain, Utah, USA.</p> <p>Wilson, L.D., Townsend, J.H. and Johnson, J.D. (eds). 2010. <i>Conservation of Mesoamerican amphibians and reptiles</i>. pp. 816. Eagle Mountain Publishing, Eagle Mountain, Utah.</p> </td> </tr> </table> </div> </div><table id="detailsFooter"><tbody> <tr><hr style="color: #FFF4F4;background-color: #FFF4F4;height: 1px;" noshade></tr> <tr> <td><strong>Citation:</strong></td> <td>Townsend, J.H. 2013. <i>Oxybelis wilsoni</i>. The IUCN Red List of Threatened Species 2013: e.T203305A2763612. <span class="doi_link" data-assessment-id="2763612"><a></a>. </span>Downloaded on <b>01 October 2016</b>.</td> <!-- <td>Townsend, J.H. 2013. <i>Oxybelis wilsoni</i>. The IUCN Red List of Threatened Species. Version 2016-2. &lt;<a href="http://www.iucnredlist.org">www.iucnredlist.org</a>&gt;. Downloaded on <b>01 October 2016</b>.</td> --> </tr> <tr> <td><strong>Disclaimer:</strong></td> <td>To make use of this information, please check the &lt;<a href="/info/terms-of-use">Terms of Use</a>&gt;.</td> </tr> <tr> <td><strong>Feedback:</strong></td> <td>If you see any errors or have any questions or suggestions on what is shown on this page, please provide us with <a href="#" id="feedbackLink"> feedback</a> so that we can correct or extend the information provided</td> </tr> </tbody> </table><div class="clear"></div></div></div></div></div></div></div><div class="clear"></div><div id="ieBugTest"></div><div id="mask"></div><div id="searchContainer">&nbsp;</div><div class="headfoot" id="footer"><div class="container"><div class="links"><div style="float:left; padding:10px; padding-top:6px;"><a href="http://www.facebook.com/iucn.red.list"><img alt="" border="0" src="/images/common/iucn_facebook.png" /></a><a href="http://twitter.com/#!/IUCNRedList/"><img alt="" border="0" src="/images/common/iucn_twitter.png" /></a><span style="font-weight: bold; font-family: Arial;color: #A60000">&nbsp; ISSN 2307-8235</span></div><a href="/">Home</a> | <a href="/about/contact-info">Contact</a> | <a href="/info/faq">FAQ</a> | <a href="mailto:redlist@iucn.org?Subject=IUCN Red List website" target="_top">Feedback</a> | <a href="/info/site-map">Site Map</a> | <a href="https://support.iucnredlist.org/donate">Donate Now</a> | <a href="/info/privacy-policy">Privacy &amp; Security</a> | <a href="/info/terms-of-use">Terms of Use</a><br />&copy; International Union for Conservation of Nature and Natural Resources.</div><div style="float:left; padding:100px;padding-bottom:6px; padding-top:6px;"><a href="http://www.iucn.org"><img alt="IUCN" border="0" height="35" src="/images/common/iucn_logo.gif" width="36" /></a><a href="http://www.iucn.org/about/work/programmes/species/"><img alt="Species Survival Commission" border="0" height="35" src="/images/common/ssc_logo.gif" width="66" /></a><a href="http://www.birdlife.org"><img alt="Birdlife International" border="0" height="35" src="/images/common/plogos/Birdlife.gif" width="44" /></a><a href="http://www.bgci.org"><img alt="BGCI" border="0" height="39" src="/images/common/plogos/BGCI-2.jpg" width="32" /></a>&nbsp;<a href="http://www.conservation.org"><img alt="Conservation International" border="0" height="35" src="/images/common/plogos/ci-2.png" width="109" /></a><a href="http://www.microsoft.org"><img alt="Microsoft" border="0" height="35" src="/images/common/plogos/microsoft-logo-new2-2.png" width="141" /></a><a href="http://www.natureserve.org"><img alt="NatureServe" border="0" height="35" src="/images/common/plogos/NatureServe_small-2.jpg" width="59" /></a><a href="http://www.kew.org"><img alt="Kew Botanical Gardens" border="0" height="30" src="/images/common/plogos/kew_logo_2015_k.jpg" width="73" /></a><br /><a href="http://www.unirome1.it"><img alt="Sapienza University" border="0" height="35" src="/images/common/plogos/SAPU_small-2.jpg" width="93" /></a><a href="http://www.tamu.edu"><img alt="Texas A&amp;amp;M University" border="0" height="35" src="/images/common/plogos/TAMUsmall.jpg" width="144" /></a><a href="http://www.wildscreen.org"><img alt="Wildscreen" border="0" height="40" src="/images/common/plogos/WILDSCREEN_logo_black_refined.png" width="48" /></a><a href="http://www.zsl.org"><img alt="ZSL" border="0" height="35" src="/images/common/plogos/ZSL_refined.png" width="50" /></a>&nbsp; &nbsp;</div></div></div></body></html>
andrewedstrom/cs638project
raw_data/redlist-endangered-html/203305.html
HTML
mit
40,648
namespace Knoledge_Monitor { partial class FormNodes { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label(); this.textBoxVersion = new System.Windows.Forms.TextBox(); this.textBoxHeight = new System.Windows.Forms.TextBox(); this.textBoxPerf = new System.Windows.Forms.TextBox(); this.textBoxLatency = new System.Windows.Forms.TextBox(); this.textBoxAt = new System.Windows.Forms.TextBox(); this.textBoxSeen = new System.Windows.Forms.TextBox(); this.buttonClose = new System.Windows.Forms.Button(); this.listView = new System.Windows.Forms.ListView(); this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.SuspendLayout(); // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(403, 15); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(67, 20); this.label1.TabIndex = 1; this.label1.Text = "Version:"; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(403, 49); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(99, 20); this.label2.TabIndex = 2; this.label2.Text = "Start Height:"; // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(403, 81); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(104, 20); this.label3.TabIndex = 3; this.label3.Text = "Performance:"; // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(403, 113); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(104, 20); this.label4.TabIndex = 4; this.label4.Text = "Latency (ms):"; // // label5 // this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(403, 145); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(109, 20); this.label5.TabIndex = 5; this.label5.Text = "Connected at:"; // // label6 // this.label6.AutoSize = true; this.label6.Location = new System.Drawing.Point(403, 177); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(83, 20); this.label6.TabIndex = 6; this.label6.Text = "Last seen:"; // // textBoxVersion // this.textBoxVersion.Location = new System.Drawing.Point(528, 12); this.textBoxVersion.Name = "textBoxVersion"; this.textBoxVersion.ReadOnly = true; this.textBoxVersion.Size = new System.Drawing.Size(387, 26); this.textBoxVersion.TabIndex = 7; // // textBoxHeight // this.textBoxHeight.Location = new System.Drawing.Point(528, 46); this.textBoxHeight.Name = "textBoxHeight"; this.textBoxHeight.ReadOnly = true; this.textBoxHeight.Size = new System.Drawing.Size(387, 26); this.textBoxHeight.TabIndex = 8; // // textBoxPerf // this.textBoxPerf.Location = new System.Drawing.Point(528, 78); this.textBoxPerf.Name = "textBoxPerf"; this.textBoxPerf.ReadOnly = true; this.textBoxPerf.Size = new System.Drawing.Size(387, 26); this.textBoxPerf.TabIndex = 9; // // textBoxLatency // this.textBoxLatency.Location = new System.Drawing.Point(528, 110); this.textBoxLatency.Name = "textBoxLatency"; this.textBoxLatency.ReadOnly = true; this.textBoxLatency.Size = new System.Drawing.Size(387, 26); this.textBoxLatency.TabIndex = 10; // // textBoxAt // this.textBoxAt.Location = new System.Drawing.Point(528, 142); this.textBoxAt.Name = "textBoxAt"; this.textBoxAt.ReadOnly = true; this.textBoxAt.Size = new System.Drawing.Size(387, 26); this.textBoxAt.TabIndex = 11; // // textBoxSeen // this.textBoxSeen.Location = new System.Drawing.Point(528, 174); this.textBoxSeen.Name = "textBoxSeen"; this.textBoxSeen.ReadOnly = true; this.textBoxSeen.Size = new System.Drawing.Size(387, 26); this.textBoxSeen.TabIndex = 12; // // buttonClose // this.buttonClose.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.buttonClose.Location = new System.Drawing.Point(840, 384); this.buttonClose.Name = "buttonClose"; this.buttonClose.Size = new System.Drawing.Size(75, 34); this.buttonClose.TabIndex = 13; this.buttonClose.Text = "Close"; this.buttonClose.UseVisualStyleBackColor = true; this.buttonClose.Click += new System.EventHandler(this.buttonClose_Click); // // listView // this.listView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.columnHeader1}); this.listView.FullRowSelect = true; this.listView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; this.listView.HideSelection = false; this.listView.Location = new System.Drawing.Point(12, 15); this.listView.Name = "listView"; this.listView.Size = new System.Drawing.Size(365, 403); this.listView.TabIndex = 14; this.listView.UseCompatibleStateImageBehavior = false; this.listView.View = System.Windows.Forms.View.Details; this.listView.SelectedIndexChanged += new System.EventHandler(this.listView_SelectedIndexChanged); // // columnHeader1 // this.columnHeader1.Text = "Address"; this.columnHeader1.Width = 300; // // FormNodes // this.AcceptButton = this.buttonClose; this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.buttonClose; this.ClientSize = new System.Drawing.Size(947, 430); this.Controls.Add(this.listView); this.Controls.Add(this.buttonClose); this.Controls.Add(this.textBoxSeen); this.Controls.Add(this.textBoxAt); this.Controls.Add(this.textBoxLatency); this.Controls.Add(this.textBoxPerf); this.Controls.Add(this.textBoxHeight); this.Controls.Add(this.textBoxVersion); this.Controls.Add(this.label6); this.Controls.Add(this.label5); this.Controls.Add(this.label4); this.Controls.Add(this.label3); this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "FormNodes"; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Connected Nodes"; this.Load += new System.EventHandler(this.FormNodes_Load); this.Shown += new System.EventHandler(this.FormNodes_Shown); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label5; private System.Windows.Forms.Label label6; private System.Windows.Forms.TextBox textBoxVersion; private System.Windows.Forms.TextBox textBoxHeight; private System.Windows.Forms.TextBox textBoxPerf; private System.Windows.Forms.TextBox textBoxLatency; private System.Windows.Forms.TextBox textBoxAt; private System.Windows.Forms.TextBox textBoxSeen; private System.Windows.Forms.Button buttonClose; private System.Windows.Forms.ListView listView; private System.Windows.Forms.ColumnHeader columnHeader1; } }
petebryant/knoledge-monitor
Knoledge-Monitor/FormNodes.Designer.cs
C#
mit
10,270
<?php /** * This class adds structure of 'courselitterature' table to 'propel' DatabaseMap object. * * * This class was autogenerated by Propel 1.3.0-dev on: * * 05/19/09 16:14:38 * * * These statically-built map classes are used by Propel to do runtime db structure discovery. * For example, the createSelectSql() method checks the type of a given column used in an * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive * (i.e. if it's a text column type). * * @package lib.model.map */ class CourselitteratureMapBuilder implements MapBuilder { /** * The (dot-path) name of this class */ const CLASS_NAME = 'lib.model.map.CourselitteratureMapBuilder'; /** * The database map. */ private $dbMap; /** * Tells us if this DatabaseMapBuilder is built so that we * don't have to re-build it every time. * * @return boolean true if this DatabaseMapBuilder is built, false otherwise. */ public function isBuilt() { return ($this->dbMap !== null); } /** * Gets the databasemap this map builder built. * * @return the databasemap */ public function getDatabaseMap() { return $this->dbMap; } /** * The doBuild() method builds the DatabaseMap * * @return void * @throws PropelException */ public function doBuild() { $this->dbMap = Propel::getDatabaseMap(CourselitteraturePeer::DATABASE_NAME); $tMap = $this->dbMap->addTable(CourselitteraturePeer::TABLE_NAME); $tMap->setPhpName('Courselitterature'); $tMap->setClassname('Courselitterature'); $tMap->setUseIdGenerator(true); $tMap->addForeignKey('ISBN10', 'Isbn10', 'VARCHAR', 'book', 'ISBN10', false, 10); $tMap->addForeignKey('COURSE_CODE', 'CourseCode', 'VARCHAR', 'courses', 'ID', false, 255); $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); } // doBuild() } // CourselitteratureMapBuilder
tolu/liu-bookbox
lib/model/map/CourselitteratureMapBuilder.php
PHP
mit
1,902
package usagestore import ( "errors" "time" ) var ErrPutLimitExceeded = errors.New("Put limit exceeded.") // UsageStore stores the state about the tokens that Gatekeeper has issued and // how many times a certain process has requested a key. UsageStore // implementations are expected to support access by multiple goroutines. type UsageStore interface { // Should return true if the store has information about this process. Has(string, string) (bool, error) // Log information about the issue of a token and how long the store should // remember this information. Acquire should only succeed if the usage count // is less than the max provided. The duration should be longer than the // time window for valid token requests. Ex. if the configuration dictates // that Gatekeeper will only issue tokens to tasks in the first 2 minutes // of their lifetime, then this paramter should be 2m30s. // Acquire should panic if max is less than 1. Acquire(string, string, int, time.Duration) error // How many times a process requested a token. UsageCount(string, string) (int, error) // Destroy this usage store, close any connectinos and release any // resources. Destroy() error }
ChannelMeter/vault-gatekeeper-mesos
usagestore/usagestore.go
GO
mit
1,199
import numpy as np from numpy.fft import rfftn, irfftn from numpy.fft import fftn, ifftn def fftconvolve(in1, in2, mode="full", fft_in1=None, fft_in2=None): """Convolve two N-dimensional arrays using FFT. Convolve `in1` and `in2` using the fast Fourier transform method, with the output size determined by the `mode` argument. This is generally much faster than `convolve` for large arrays (n > ~500), but can be slower when only a few output values are needed, and can only output float arrays (int or object array inputs will be cast to float). Parameters ---------- in1 : array_like First input. in2 : array_like Second input. Should have the same number of dimensions as `in1`; if sizes of `in1` and `in2` are not equal then `in1` has to be the larger array. mode : str {'full', 'valid', 'same'}, optional A string indicating the size of the output: ``full`` The output is the full discrete linear convolution of the inputs. (Default) ``valid`` The output consists only of those elements that do not rely on the zero-padding. ``same`` The output is the same size as `in1`, centered with respect to the 'full' output. Returns ------- out : array An N-dimensional array containing a subset of the discrete linear convolution of `in1` with `in2`. This code has been modified from scipy.signal.filter.py under the following license: Copyright (c) 2001, 2002 Enthought, Inc. All rights reserved. Copyright (c) 2003-2012 SciPy Developers. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: a. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. b. 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. c. Neither the name of Enthought nor the names of the SciPy Developers may be used to endorse or promote products derived from this software without specific prior written permission. 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 HOLDERS 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. """ in1 = np.asarray(in1) in2 = np.asarray(in2) if np.rank(in1) == np.rank(in2) == 0: # scalar inputs return in1 * in2 elif not in1.ndim == in2.ndim: raise ValueError("in1 and in2 should have the same rank") elif in1.size == 0 or in2.size == 0: # empty arrays return np.array([]) s1 = np.array(in1.shape) s2 = np.array(in2.shape) complex_result = (np.issubdtype(in1.dtype, np.complex) or np.issubdtype(in2.dtype, np.complex)) size = s1 + s2 - 1 # Always use 2**n-sized FFT fsize = 2 ** np.ceil(np.log2(size)).astype(int) fslice = tuple([slice(0, int(sz)) for sz in size]) fft1_given = not (fft_in1 is None) fft2_given = not (fft_in2 is None) if not complex_result: if not fft1_given: fft_in1 = rfftn(in1, fsize) if not fft2_given: fft_in2 = rfftn(in2, fsize) ret = irfftn(fft_in1 * fft_in2, fsize)[fslice].copy() ret = ret.real else: if not fft1_given: fft_in1 = fftn(in1, fsize) if not fft2_given: fft_in2 = fftn(in2, fsize) ret = ifftn(fft_in1 * fft_in2)[fslice].copy() if mode == "full": pass elif mode == "same": ret = _centered(ret, s1) elif mode == "valid": ret = _centered(ret, s1 - s2 + 1) else: raise ValueError("Acceptable mode flags are 'valid'," " 'same', or 'full'.") ret = [ret] if not fft1_given: ret.append(fft_in1) if not fft2_given: ret.append(fft_in2) ret = tuple(ret) if len(ret) == 1: ret = ret[0] return ret def _centered(arr, newsize): # Return the center newsize portion of the array. newsize = np.asarray(newsize) currsize = np.array(arr.shape) startind = (currsize - newsize) // 2 endind = startind + newsize myslice = [slice(startind[k], endind[k]) for k in range(len(endind))] return arr[tuple(myslice)]
slinderman/theano_pyglm
pyglm/utils/fftconv.py
Python
mit
5,251
import logging logg = logging.getLogger(__name__) import sys import time t = time.time() import OpenGL from OpenGL.GL import * logg.info("import duration: %.2f seconds (PyOpenGL)", time.time() - t) #OpenGL.FULL_LOGGING = True logg.info("PyOpenGL version %s", OpenGL.__version__) t = time.time() from sdl2 import * logg.info("import duration: %.2f seconds (sdl2)", time.time() - t) t = time.time() import ctypes logg.info("import duration: %.2f seconds (ctypes)", time.time() - t) t = time.time() #from modules.copenglconstants import * #from modules.copengl import * #logg.info("import duration: %.2f seconds (copengl)", time.time() - t) t = time.time() import modules.gltext as gltext logg.info("import duration: %.2f seconds (gltext)", time.time() - t) t = time.time() import gimbal1 logg.info("import duration: %.2f seconds (gimbal)", time.time() - t) t = time.time() import vector import coordinate_system import axial_frame import camera import cube2 import fps_counter import vbo logg.info("import duration: %.2f seconds (other)", time.time() - t) #from pyglet.gl import * #import pyglet.gl # Define a simple function to create ctypes arrays of floats: #def vec(*args): # return (GLfloat * len(args))(*args) # #def vecl(lst): # return (GLfloat * len(lst))(*lst) def int16_to_float(int16): return int16 / 32768. class GimbalWindow: # active object and active mode MODE_HELICOPTER = 1 MODE_GIMBAL_RELATIVE = 2 MODE_GIMBAL_ABSOLUTE = 3 def __init__(self, conf): #*args, **kwds): #super(CrabWindow, self).__init__() # TODO: is this better than this?: #window.Window.__init__(self, *args, **kwds) self.conf = conf self.joystick = None def init(self): self.mode = self.MODE_GIMBAL_ABSOLUTE #self._mode = self.MODE_GIMBAL_ABSOLUTE # self.keys = pyglet.window.key.KeyStateHandler() # self.push_handlers(self.keys) # self.exclusive_mouse = False # self.w, self.h = 0, 0 self.camera = camera.Camera() # init camera ocs o = self.camera.ocs; a = o.a_frame o.pos.set([1.3386966254250741, 3.2763409412621058, 1.9619633593798795]) a.x_axis.set([-0.80351677958418577, -2.4980018054066027e-16, 0.59528210533045522]) a.y_axis.set([-0.37248195158463354, 0.78004500411750555, -0.50277926299224318]) a.z_axis.set([-0.46434683230357221, -0.62572341457813496, -0.62677924963923115]) self.fps_counter = fps_counter.FpsCounter() self.selected_obj = self.camera self.gimbal = gimbal1.Gimbal1() self.gimbal.ocs.pos.set((0., 2., 0.)) self.suncube = cube2.Cube() dist = 100. self.suncube.ocs.pos.set((2.*dist, 5.*dist, 2.*dist)) self.suncube.size = 0.1 self.suncube.color = (1., 1., 0., 1.) # current orientation directly from joystick (or mouse or keyboard if no joystick is present). # converted to desired orientation and sent to gimbal. self.out_yaw = 0. self.out_pitch = 0. self.out_roll = 0. # for remembering what we wanted from the gimbal self.abs_yaw = self.abs_pitch = self.abs_roll = 0. self.rel_yaw = self.rel_pitch = self.rel_roll = 0. self.hel_yaw = self.hel_pitch = self.hel_roll = 0. self.gl_init() self.gltext = gltext.GLText("data/font_proggy_opti_small.txt") self.gltext.init() # under macosx snow leopard, a joystick object is returned even if no joystick is connected. # and that screws up rotations with the mouse/trackpad. # self.joystick = self.open_first_joystick() #self.joystick = None # take a screenshot every minute. but start at 10 seconds self._screenshot_call_counter = -1 # if not hasattr(sys, "frozen"): # pyglet.clock.schedule_interval(self.save_autoscreenshot, 10.) def run(self): if SDL_Init(SDL_INIT_VIDEO|SDL_INIT_JOYSTICK) != 0: logg.error(SDL_GetError()) return -1 n = SDL_NumJoysticks() logg.info("num joysticks: %u" % (n)) for i in range(n): logg.info(" %s%s" % (SDL_JoystickNameForIndex(i), " (gamecontroller)"*SDL_IsGameController(i))) joy = None if n: #j = SDL_GameControllerOpen(self.conf.joystick_index) #if not j: # print("Could not open gamecontroller %i: %s" % (i, SDL_GetError())); joy = SDL_JoystickOpen(self.conf.joystick_index); if joy: logg.info("") logg.info("opened joystick %i (%s)" % (self.conf.joystick_index, SDL_JoystickName(joy))) logg.info(" num axes : %d" % SDL_JoystickNumAxes(joy)) logg.info(" num buttons: %d" % SDL_JoystickNumButtons(joy)) logg.info(" num balls : %d" % SDL_JoystickNumBalls(joy)) logg.info("") else: logg.info("Could not open Joystick %i: %s" % (i, SDL_GetError())) self.joystick = joy SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4); self.w = 800 self.h = 600 window = SDL_CreateWindow(b"OpenGL demo", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, self.w, self.h, SDL_WINDOW_OPENGL) if not window: logg.error(SDL_GetError()) return -1 context = SDL_GL_CreateContext(window) if SDL_GL_SetSwapInterval(-1): logg.error(SDL_GetError()) if SDL_GL_SetSwapInterval(1): logg.error("SDL_GL_SetSwapInterval: %s", SDL_GetError()) logg.error("vsync failed completely. will munch cpu for lunch.") self.keys = SDL_GetKeyboardState(None) self.init() #SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, # "Missing file", # "File is missing. Please reinstall the program.", # None); # get initial values if joy: roll_axis = int16_to_float(SDL_JoystickGetAxis(joy, self.conf.joystick_roll_axis)) pitch_axis = int16_to_float(SDL_JoystickGetAxis(joy, self.conf.joystick_pitch_axis)) else: roll_axis = 0. pitch_axis = 0. joy_axis_changed = True t = time.time() event = SDL_Event() running = True while running: while SDL_PollEvent(ctypes.byref(event)) != 0: if event.type == SDL_QUIT: running = False if event.type == SDL_JOYAXISMOTION: if event.jaxis.axis == self.conf.joystick_roll_axis: joy_axis_changed = True roll_axis = int16_to_float(event.jaxis.value) elif event.jaxis.axis == self.conf.joystick_pitch_axis: joy_axis_changed = True pitch_axis = int16_to_float(event.jaxis.value) if event.type == SDL_JOYBUTTONDOWN: logg.info("joy button %i pressed", event.jbutton.button) if event.type == SDL_KEYDOWN: if event.key.keysym.scancode == SDL_SCANCODE_ESCAPE: running = False if joy_axis_changed: logg.info("pitch %5.2f roll %5.2f" % (pitch_axis, roll_axis)) joy_axis_changed = False self.out_yaw = 0. # -self.joystick.x * 180. self.out_pitch = pitch_axis * 90. self.out_roll = roll_axis * 90. self.gimbal.set_raw_orientation_angles(self.out_yaw, self.out_roll, self.out_pitch) self.rel_yaw, self.rel_pitch, self.rel_roll = self.out_yaw, self.out_pitch, self.out_roll last_t = t t = time.time() self.tick(t - last_t) #glFinish() SDL_GL_SwapWindow(window) #SDL_Delay(10) #if joy: # if SDL_JoystickGetAttached(joy): # SDL_JoystickClose(joy) SDL_GL_DeleteContext(context) SDL_DestroyWindow(window) SDL_Quit() logg.info("quit ok") return 0 def close(self): pass # def _set_mode(self, mode): # self._mode = mode # self.out_yaw = self.out_pitch = self.out_roll = 0. # def _get_mode(self): return self._mode # mode = property(_get_mode, _set_mode) def open_first_joystick(self): joys = pyglet.input.get_joysticks() print "num joysticks: %i" % len(joys) for i, joy in enumerate(joys): print "trying joystick", i joy.open() if joy.buttons and len(joy.buttons) < 33: print "returning joystick.." return joy #joy.close() # Carbon error :S print "no suitable joysticks found" return None # find a joystick that says nothing to the stdout #old_write = sys.stdout.write #numchars = [0] #def new_write(t): # numchars[0] += len(t) # old_write("teehee: " + t) #for joy in pyglet.input.get_joysticks(): # try: # print "trying joystick.." # numchars[0] = 0 # sys.stdout.write = new_write # joy.open() # sys.stdout.write = old_write # if numchars[0] == 0 and joy.buttons and len(joy.buttons) < 33: # print "returning joystick.." # return joy # #joy.close() # Carbon error :S # except: # sys.stdout.write = old_write # traceback.print_exc() #print "no joysticks found" #return None def gl_init(self): glShadeModel(GL_SMOOTH) glEnable(GL_POINT_SMOOTH) glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); glEnable(GL_FOG) # glFogi(GL_FOG_MODE, GL_EXP2) # GL_EXP, GL_EXP2, GL_LINEAR # glFogfv(GL_FOG_COLOR, (.1, .1, .1, 1.)) #glFogf(GL_FOG_DENSITY, .00008) # glFogf(GL_FOG_DENSITY, .000009) # glHint(GL_FOG_HINT, GL_DONT_CARE) #glEnable(GL_RESCALE_NORMAL) glDisable(GL_TEXTURE_2D) glDisable(GL_DEPTH_TEST) glDisable(GL_FOG) glDisable(GL_DITHER) glDisable(GL_LIGHTING) #glShadeModel(GL_FLAT) glEnable(GL_BLEND) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) glEnable(GL_LINE_SMOOTH) glDisable(GL_LINE_STIPPLE) glDisable(GL_LIGHT1) glFrontFace(GL_CW) glEnable(GL_CULL_FACE) glLightModelfv(GL_LIGHT_MODEL_AMBIENT, (0., 0., 0., 1.)) glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1) #glDisable(GL_COLOR_MATERIAL) def tick(self, dt): self.handle_controls(dt) self.gimbal.tick(dt) glClearColor(0.8, 0.8, 1.8, 1.0) glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) glEnable(GL_DEPTH_TEST) glViewport(0, 0, self.w, self.h) self.camera.set_window_size(self.w, self.h) self.camera.set_z(.1, 1000.) self.camera.update_fovy() self.camera.set_opengl_projection() glMatrixMode(GL_MODELVIEW) glLoadIdentity() glScalef(1.,1.,-1.) camocs = self.camera.ocs ### project the world into camera space ##ocs = camera.ocs.proj_in( coordinate_system.CoordinateSystem() ) ##glMultMatrixf(ocs.get_opengl_matrix2()) glMultMatrixf(camocs.a_frame.get_opengl_matrix()) glTranslated(-camocs.pos[0], -camocs.pos[1], -camocs.pos[2]) glDisable(GL_TEXTURE_2D) # setup lighting lp = self.suncube.ocs.pos glLightfv(GL_LIGHT0, GL_POSITION, (lp[0], lp[1], lp[2], 1.)) glLightfv(GL_LIGHT0, GL_AMBIENT, (1., 1., 1., 1.)) glLightfv(GL_LIGHT0, GL_DIFFUSE, (1., 1., 1., 1.)) glLightfv(GL_LIGHT0, GL_SPECULAR, (1., 1., 1., 1.)) glEnable(GL_LIGHT0) # what the color value in vertex should be #glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE) glColorMaterial(GL_FRONT, GL_DIFFUSE) #glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE) glEnable(GL_COLOR_MATERIAL) self.render_world() self.render_floor() self.camera.set_opengl_pixel_projection() glMatrixMode(GL_MODELVIEW) glLoadIdentity() glScalef(1.,1.,-1.) glDisable(GL_DEPTH_TEST) glEnable(GL_TEXTURE_2D) self.fps_counter.tick(dt) self.render_hud_text() # self.flip() def render_hud_text(self): y = 5. x = self.w - 6. t = self.gltext #t.drawtr(" manual offsets:", x, y, bgcolor=(1.0,1.0,1.0,.9), fgcolor=(0.,0.,0.,1.), z=100.); y+=t.height # if self.gimbal.mode != self.gimbal.MODE_TRACK: # if self.gimbal.mode == self.gimbal.MODE_RELATIVE: # s = "relative" # yaw, pitch, roll = self.rel_yaw, self.rel_pitch, self.rel_roll # if self.gimbal.mode == self.gimbal.MODE_ABSOLUTE: # s = "absolute" # yaw, pitch, roll = self.abs_yaw, self.abs_pitch, self.abs_roll # t.drawtr(" desired (%s) camera orientation:" % s, x, y, fgcolor=(0.,0.,0.,1.), bgcolor=(1.0,1.0,1.0,.9), z=100.); y+=t.height # t.drawtr(" yaw : %6.1f " % (yaw), x, y, bgcolor=(.9,.9,.9,.9)); y+=t.height # t.drawtr(" pitch: %6.1f " % (pitch), x, y); y+=t.height # t.drawtr(" roll : %6.1f " % (roll), x, y); y+=t.height y += t.height t.drawtr(" gimbal motor angles:", x, y, bgcolor=(1.0,1.0,1.0,.9), fgcolor=(0.,0.,0.,1.), z=100.); y+=t.height t.drawtr(" yaw : %6.1f " % (self.gimbal.yaw), x, y, bgcolor=(.9,.9,.9,.9)); y+=t.height t.drawtr(" roll : %6.1f " % (self.gimbal.roll), x, y); y+=t.height t.drawtr(" pitch: %6.1f " % (self.gimbal.pitch), x, y); y+=t.height #y += t.height #t.drawtr(" mode : %s " % s, x, y); y+=t.height fgcolor = (0.4,0.4,0.4,1.0); bgcolor = (1.,1.,1.,.8) hifgcolor = (0.0,0.0,0.0,1.0); hibgcolor = (.65,.85,1.,.9) headfgcolor = (0.0,0.0,0.0,1.0); headbgcolor = (1.,1.,1.,.95) fgcolors = [fgcolor]*3; bgcolors = [bgcolor]*3 i = [self.MODE_GIMBAL_RELATIVE, self.MODE_GIMBAL_ABSOLUTE, self.MODE_HELICOPTER].index(self.mode) fgcolors[i] = hifgcolor; bgcolors[i] = hibgcolor x, y = 5., 5. #t.drawtl(" select mode: ", x, y, headfgcolor, headbgcolor, z=100.); y+=t.height #t.drawtl(" 1, jb5 - change desired relative camera orientation", x, y, fgcolors[0], bgcolors[0]); y+=t.height #t.drawtl(" 2, jb7 - change desired absolute camera orientation", x, y, fgcolors[1], bgcolors[1]); y+=t.height #t.drawtl(" 3, jb6 - change helicopter (imu) orientation ", x, y, fgcolors[2], bgcolors[2]); y+=t.height t.drawtl(" change gimbal orientation: ", x, y, headfgcolor, headbgcolor); y+=t.height t.drawtl(" joystick, mouse, mousewheel ", x, y, fgcolor, bgcolor); y+=t.height t.drawtl(" (mouse: remove joystick and hold down 1,2,3) ", x, y); y+=t.height t.drawtl(" spectator movement ", x, y, headfgcolor, headbgcolor); y+=t.height t.drawtl(" wsad, arrows ", x, y, fgcolor, bgcolor); y+=t.height t.drawbr("fps: %.0f" % (self.fps_counter.fps), self.w, self.h, fgcolor = (0., 0., 0., 1.), bgcolor = (0.7, 0.7, 0.7, .9), z = 100.) def render_world(self): glEnable(GL_LIGHTING) self.gimbal.render() glDisable(GL_LIGHTING) self.suncube.render_normal() def render_floor(self): # build the floor tile_size = 1. ntiles = 20 w2 = ntiles * tile_size / 2. if "_floor_vertex_list" not in self.__dict__: v = []; ts = tile_size for i in range(ntiles + 1): v.extend([i*ts-w2,0.,w2, i*ts-w2,0.,-w2, -w2,0.,i*ts-w2, w2,0.,i*ts-w2]) #self._floor_vertex_list = pyglet.graphics.vertex_list((ntiles+1) * 4, ('v3f/static', v)) self._floor_vertex_list = vbo.VBO(v) glLineWidth(2.) glColor4f(0.7, 0.7, 0.7, 1.0) self._floor_vertex_list.draw(GL_LINES) #self._floor_vertex_list.draw(GL_TRIANGLES) #self._floor_vertex_list.draw(pyglet.gl.GL_LINES) if 1: glBegin(GL_QUADS) glColor4f(0.5, 0.5, 0.5, 0.6) glVertex3f(-w2, 0., w2) glVertex3f( w2, 0., w2) glVertex3f( w2, 0., -w2) glVertex3f(-w2, 0., -w2) glEnd() def _create_euler_ocs(self, yaw, pitch, roll): ocs = coordinate_system.CoordinateSystem() a_frame = ocs.a_frame a_frame.rotate(a_frame.y_axis, yaw) a_frame.rotate(a_frame.x_axis, pitch) a_frame.rotate(a_frame.z_axis, roll) return ocs def handle_controls(self, dt): if 0 and self.joystick: #print "joy: %.2f %.2f %.2f : %s" % (self.joystick.x, self.joystick.y, self.joystick.z, self.joystick.buttons) self.out_yaw = -self.joystick.x * 180. self.out_pitch = self.joystick.y * 90. self.out_roll = self.joystick.z * 90. if len(self.joystick.buttons) > 6: if self.joystick.buttons[4]: self.mode = self.MODE_GIMBAL_ABSOLUTE elif self.joystick.buttons[6]: self.mode = self.MODE_GIMBAL_RELATIVE elif self.joystick.buttons[5]: self.mode = self.MODE_HELICOPTER # ocs = self._create_euler_ocs(self.out_yaw, self.out_pitch, self.out_roll) # if self.mode == self.MODE_GIMBAL_ABSOLUTE: # # set gimbal absolute desired orientation # self.gimbal.set_abs_desired_camera_orientation(ocs.a_frame) # self.abs_yaw, self.abs_pitch, self.abs_roll = self.out_yaw, self.out_pitch, self.out_roll # elif self.mode == self.MODE_GIMBAL_RELATIVE: # # set gimbal relative desired orientation # self.gimbal.set_rel_desired_camera_orientation(ocs.a_frame) # self.rel_yaw, self.rel_pitch, self.rel_roll = self.out_yaw, self.out_pitch, self.out_roll # elif self.mode == self.MODE_HELICOPTER: # # set imu orientation # ocs = self._create_euler_ocs(self.out_yaw, self.out_pitch, self.out_roll) # ocs.pos.set(self.gimbal.ocs.pos) # self.gimbal.set_imu_ocs(ocs) # self.hel_yaw, self.hel_pitch, self.hel_roll = self.out_yaw, self.out_pitch, self.out_roll keys = self.keys #k = key speed = 5. rotspeed = 120. cp = self.selected_obj.ocs.pos ca = self.selected_obj.ocs.a_frame if keys[SDL_SCANCODE_A]: cp.add(-ca.x_axis * speed * dt) if keys[SDL_SCANCODE_D]: cp.add( ca.x_axis * speed * dt) if keys[SDL_SCANCODE_E]: cp[1] += speed * dt if keys[SDL_SCANCODE_Q]: cp[1] -= speed * dt if keys[SDL_SCANCODE_W]: cp.add( ca.z_axis * speed * dt) if keys[SDL_SCANCODE_S]: cp.add(-ca.z_axis * speed * dt) up = vector.Vector((0., 1., 0.)) if keys[SDL_SCANCODE_LEFT]: ca.rotate(up, rotspeed * dt) if keys[SDL_SCANCODE_RIGHT]: ca.rotate(up, -rotspeed * dt) if keys[SDL_SCANCODE_UP]: ca.rotate(ca.x_axis, -rotspeed * dt) if keys[SDL_SCANCODE_DOWN]: ca.rotate(ca.x_axis, rotspeed * dt) # if keys[k.MOTION_NEXT_PAGE]: ca.rotate(ca.z_axis, rotspeed * dt) # if keys[k.MOTION_DELETE]: ca.rotate(ca.z_axis, -rotspeed * dt) #if keys[SDL_SCANCODE_ESCAPE]: self.has_exit = True if self.joystick: if SDL_JoystickGetButton(self.joystick, self.conf.joystick_b_strafe_left): cp.add(-ca.x_axis * speed * dt) if SDL_JoystickGetButton(self.joystick, self.conf.joystick_b_strafe_right): cp.add( ca.x_axis * speed * dt) if SDL_JoystickGetButton(self.joystick, self.conf.joystick_b_move_forward): cp.add( ca.z_axis * speed * dt) if SDL_JoystickGetButton(self.joystick, self.conf.joystick_b_move_backward): cp.add(-ca.z_axis * speed * dt) def save_autoscreenshot(self, dt): self._screenshot_call_counter += 1 if self._screenshot_call_counter % 6 == 0: self.save_screenshot("autoscreenshot_") def save_screenshot(self, filename_prefix="screenshot_"): """saves screenshots/filename_prefix20090404_120211_utc.png""" utc = time.gmtime(time.time()) filename = filename_prefix + "%04i%02i%02i_%02i%02i%02i_utc.png" % \ (utc.tm_year, utc.tm_mon, utc.tm_mday, \ utc.tm_hour, utc.tm_min, utc.tm_sec) print "saving screenshot '%s'" % filename pyglet.image.get_buffer_manager().get_color_buffer().save("screenshots/" + filename) def on_resize(self, width, height): self.w, self.h = width, height #def on_mouse_press(self, x, y, button, modifiers): pass def on_mouse_scroll(self, x, y, scroll_x, scroll_y): if self.joystick: return keys = self.keys; k = key if keys[k._1] or keys[k._2] or keys[k._3]: self._add_angles(0., 0., scroll_y * 3.) def on_mouse_release(self, x, y, button, modifiers): if self.exclusive_mouse and (button & mouse.LEFT): self.exclusive_mouse = False self.set_exclusive_mouse(False) def _limit_angles(self): self.out_yaw %= 360. self.out_pitch %= 360. self.out_roll %= 360. if self.out_yaw > 180.: self.out_yaw -= 360. if self.out_pitch > 180.: self.out_pitch -= 360. if self.out_roll > 180.: self.out_roll -= 360. if self.out_pitch > 90.: self.out_pitch = 90. if self.out_pitch < -90.: self.out_pitch = -90. if self.out_roll > 90.: self.out_roll = 90. if self.out_roll < -90.: self.out_roll = -90. def on_mouse_motion(self, x, y, dx, dy): if self.joystick: return keys = self.keys; k = key if keys[k._1] or keys[k._2] or keys[k._3]: self._add_angles(-dx, -dy, 0.) def _add_angles(self, yaw, pitch, roll): self.out_yaw += yaw self.out_pitch += pitch self.out_roll += roll self._limit_angles() def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers): if buttons & mouse.LEFT: #if not self.exclusive_mouse: # self.exclusive_mouse = True # self.set_exclusive_mouse(True) ocs = self.camera.ocs camera_turn_speed = 0.5 # degrees per mouseixel up = vector.Vector((0., 1., 0.)) ocs.a_frame.rotate(ocs.a_frame.x_axis, camera_turn_speed * dy) ocs.a_frame.rotate(up, -camera_turn_speed * dx) def on_key_press(self, symbol, modifiers): if symbol == key.F12: self.save_screenshot() if symbol == key.C: print "camera ocs (pos, x_axis, y_axis, z_axis)" print self.camera.ocs.pos print self.camera.ocs.a_frame.x_axis print self.camera.ocs.a_frame.y_axis print self.camera.ocs.a_frame.z_axis if symbol == key._1: self.mode = self.MODE_GIMBAL_RELATIVE elif symbol == key._2: self.mode = self.MODE_GIMBAL_ABSOLUTE elif symbol == key._3: self.mode = self.MODE_HELICOPTER if symbol == key._7: self.selected_obj = self.camera print "camera selected" if symbol == key._8: self.selected_obj = self.gimbal print "gimbal selected", self.selected_obj, self.gimbal if symbol == key._9: self.selected_obj = self.suncube print "suncube selected", self.selected_obj, self.suncube
fdkz/flybyrift
system/gimbal_window.py
Python
mit
24,447
/*! isosceles.js v1.0.0 | (c) 2013, Samuel Bamgboye*/ /** * isosceles v1.0.1 - Cleaner JavaScript Dependency Injection Factory * * Copyright 2013 Samuel Bamgboye * Released under the MIT license. */ (function (wind) { var isoscelesCon$ole = function (o) { }; isoscelesCon$ole.defineConsole = function (f) { console = typeof f==="function"?f:console; }; console || isoscelesCon$ole.defineConsole(function () { }); isoscelesCon$ole.log = function (o) { console.log(o); }; isoscelesCon$ole.warn = function (o) { console.warn(o); }; isoscelesCon$ole.error = function (o) { console.error(o); }; isoscelesCon$ole.doc = function (name, doc) { if (name) { if (doc) { isoscelesCon$ole.doc.list = isoscelesCon$ole.doc.list || {}; isoscelesCon$ole.doc.list[name] = doc; console.log(name + ":" + doc); } else { return isoscelesCon$ole.doc.list[name]||"No documentation exist for '"+name+"' at the moment"; } } else { return isoscelesCon$ole.doc.list; } }; var _allPlugins_ = {}; var _modulesList = {}; wind.isosceles = function (namespace, coreDependencyFactory) { isoscelesCon$ole.doc("isosceles", " isosceles is a JAVASCRIPT DEPENDENCY INJECTION FACTORY, you can define namespaces which contain modules, which contain plugins and modules from one namespace are forever separated from modules of another namespace"); if (namespace) { _modulesList[namespace] = _modulesList[namespace] || {}; _allPlugins_[namespace] = []; var $allPlugins_ = _allPlugins_[namespace]; wind.isosceles.namespaces = wind.isosceles.namespaces|| {}; if (typeof coreDependencyFactory !== "function") { coreDependencyFactory = function () { return []; }; }; var module = function () { }; module.prototype.module = function (moduleNameReference,otherModules) { isoscelesCon$ole.doc("isosceles.module", " isosceles.module is used to define a module off of a namespace. so after you have defined a namespace, you can use its module method to create modules for it"); var moduleNameRef = moduleNameReference; var namespaceReference = namespace.toString(); //if (moduleNameRef && _modulesList[namespaceReference] && _modulesList[namespaceReference][moduleNameRef]) { // return _modulesList[namespaceReference][moduleNameRef]; // } otherModules = otherModules || []; var _fakeObjects =_fakeObjects|| {}; _fakeObjects.namespaces = _fakeObjects.namespaces || {}; _fakeObjects.namespaces[namespaceReference] = _fakeObjects.namespaces[namespaceReference] || {}; _fakeObjects.namespaces[namespaceReference][moduleNameRef] = _fakeObjects.namespaces[namespaceReference][moduleNameRef] || {}; var _expectations =_expectations|| {}; _expectations.namespaces = _expectations.namespaces || {}; _expectations.namespaces[namespaceReference] = _expectations.namespaces[namespaceReference] || {}; _expectations.namespaces[namespaceReference][moduleNameRef] = _expectations.namespaces[namespaceReference][moduleNameRef] || {}; var _implementations = _implementations || {}; _implementations.namespaces = _implementations.namespaces || {}; _implementations.namespaces[namespaceReference] = _implementations.namespaces[namespaceReference] || {}; _implementations.namespaces[namespaceReference][moduleNameRef] = _implementations.namespaces[namespaceReference][moduleNameRef] || {}; var mockFactory = function (str,obj) { var mod = wind.isosceles("_$mockObj$_").module("_$mockObj$_"); mod.plugin(str, function () { return function () { return obj; }; }); return mod.using(str); }; var setMockObject = function (mockObject) { isoscelesCon$ole.doc("isosceles.setMockObject", " isosceles.setMockObject is used to mosk dependencies with supplied object containing 'dependency_name - mock' pairs . it can be used for specifying mock ina single location"); if (mockObject) { for (var _mock in mockObject) { if (mockObject.hasOwnProperty(_mock)) { this.mock(_mock, mockObject[_mock]); } } } return this; }; var testSetUp = function (testStr, expMet, mObject) { this.setMockObject(mObject) if (testStr && (expMet !== undefined)) { this.expect(testStr, expMet); } return this; }; var getExpectation=function (str) { return _expectations.namespaces[namespaceReference][moduleNameRef][str]; }; var test=function (testStr,Arg, callBack) { callBack = callBack || Arg; if (testStr&&typeof callBack === "function") { // this.testSetUp(testStr || undefined, expMet || undefined, mObject || undefined); var testResult = false; var note = ""; isoscelesCon$ole.warn("Testing " + testStr+"***********"); var actual = (this.using(testStr))(Arg || undefined); var testHandle = _expectations.namespaces[namespaceReference][moduleNameRef][testStr]; if (typeof testHandle === "function" ) { var expected = testHandle && testHandle(); testResult = actual === expected; note = (testHandle && testHandle["note"]) || ""; callBack(testResult, note, actual, expected); } else { isoscelesCon$ole.error("Testing " + testStr+" was unsuccessfull!"); callBack(); } } return this; }; var expect = function (expStr, expMet, note) { if (expStr) { _expectations.namespaces[namespaceReference][moduleNameRef][expStr] = function () { return expMet; }; _expectations.namespaces[namespaceReference][moduleNameRef][expStr]["note"] = note || ""; } return this; }; var specify = function () { }; var getMockObject = function (str) { var mockry = _fakeObjects.namespaces[namespaceReference][moduleNameRef][str]; var mkObj = typeof mockry === "function" ? mockry : undefined; return mkObj; }; var isMocked = function (str) { return this.getMockObject(str) ? true : false; }; var mock = function (fakeStr, fakeMet) { if (fakeStr && fakeMet !== undefined) { _fakeObjects.namespaces[namespaceReference][moduleNameRef][fakeStr] = function () { return mockFactory(fakeStr, fakeMet); }; } return this; }; var using = function (o, selectedImplimentationArray) { selectedImplimentationArray || []; if (o) { //check if there are any implementations // o =( _implementations.namespaces[namespaceReference][o] && _implementations.namespaces[namespaceReference][o]["imp"] )|| o; var _pluginsLength = $allPlugins_.length; //find and return plugin isoscelesCon$ole.log("searching for plugin " + o + " in pile ......"); for (var i = 0; i < _pluginsLength; i++) { var pluginToExecute = $allPlugins_[i]; if (pluginToExecute.name === o) { var that = this; isoscelesCon$ole.log("found plugin " + o + "! now returning ... "); var WithArgumentsMethod = function (param, completed, startOptions) { return WithArgumentsMethod.WithArguments(param, completed).execute(startOptions || undefined); }; WithArgumentsMethod.WithArguments = function (param, completed) { var Inject = function (f) { var injection = Inject[f]; if (f && injection) { return injection; } else { throw ("unable to inject dependency '" + (f || "") + "' into '" + $allPlugins_[i].name + "' Plugin in module '" + $allPlugins_[i].module + "'"); } }; var execute = function (startOptions) { //find and inject plugin //look in every member of the array requested dependencies var MockFun = that.enableMocking && that.getMockObject(pluginToExecute.name); MockFun || that.dependencyInjectorFactory(pluginToExecute, Inject, startOptions, param, selectedImplimentationArray); var ended = typeof completed === "function" ? completed : function () { }; var returnFunction = MockFun ? MockFun() : (pluginToExecute.plugin(Inject)); if (typeof returnFunction === "function") { try { var pluginExecutionResult = returnFunction(param, ended); return pluginExecutionResult; } catch (ex) { isoscelesCon$ole.error(pluginToExecute.name + " Plugin in module " + pluginToExecute.module + " threw an exception ..." + ex + " " + pluginToExecute.plugin); } } else { isoscelesCon$ole.error(pluginToExecute.name + " Plugin in module " + pluginToExecute.module + " did not return a function"); isoscelesCon$ole.error(pluginToExecute.plugin); } }; return { // using start() to delay execution and DI of method //delay di to allow for free DI within modules execute: execute }; }; return WithArgumentsMethod; } } //if it doesnt find the plugin then throw exception isoscelesCon$ole.error("ERROR: MISSING PLUGIN (" + o + ") DEFINITION NOT FOUND"); } }; var dependencyFactoryInterceptor= function (eachDepend, coreDependencyMapping) { var m = undefined; if (coreDependencyMapping) { for (var k = 0; k < coreDependencyMapping.length; k++) { if (coreDependencyMapping[k].name === eachDepend) { m = coreDependencyMapping[k].dependency; } } } return m; }; var dependencyInjectorFactory = function (pluginToExecute, Inject, startOptions, param, selectedImplimentationArray) { isoscelesCon$ole.log(" invoking plugin.... " + pluginToExecute.name); // dependency resolution start var depTmp = pluginToExecute.dependency; var depLengthTmp = depTmp.length; var selectedImpLength = (selectedImplimentationArray && selectedImplimentationArray.length) || 0; var dep = []; if (selectedImpLength) { if (depTmp && depLengthTmp) { for (var eachDependencyInjected = 0; eachDependencyInjected < depLengthTmp; eachDependencyInjected++) { for (var eachSelImp = 0; eachSelImp < selectedImpLength; eachSelImp++) { var interfaceSpecified = depTmp[eachDependencyInjected]; var concreteSelected=selectedImplimentationArray[eachSelImp]; var interfaceByConcreteImp = _implementations.namespaces[namespaceReference][moduleNameRef][concreteSelected]; if (interfaceByConcreteImp === interfaceSpecified) { dep.push({ conc: concreteSelected, face: interfaceByConcreteImp }); } } } } } else { for (var eachDependencyInjected = 0; eachDependencyInjected < depLengthTmp; eachDependencyInjected++) { dep.push({ conc: depTmp[eachDependencyInjected], face: depTmp[eachDependencyInjected] }); } } var depLength = dep.length; isoscelesCon$ole.log("injecting dependencies.... "); isoscelesCon$ole.log((pluginToExecute.dependency.toString() || " ***Oh! No available dependency")); //dependency resolution ends isoscelesCon$ole.log("finally executing " + pluginToExecute.name + " ....."); var coreDependencyMapping = coreDependencyFactory(startOptions, param); Inject = Inject || {}; var _pluginsLength = $allPlugins_.length; //find and inject plugin //look in every member of the array requested dependencies for (var t = 0; t < depLength; t++) { var eachDepend = dep[t].conc; var eachDependNametoUse = dep[t].face; var Interceptor = this.dependencyFactoryInterceptor(eachDepend, coreDependencyMapping); if (Interceptor === undefined) { //look in every registered / available dependency for (var j = 0; j < _pluginsLength; j++) { var eachPointedPlugin = $allPlugins_[j]; var intNameforInjection= _implementations.namespaces[namespaceReference][moduleNameRef][eachPointedPlugin.name]; var otherModuleDepencies = this.getModuleDependencies(otherModules); var MockFun =this.getMockObject(eachDepend); var plug = {}; if (this.enableMocking && typeof MockFun === "function") { plug = MockFun(); Inject[eachDepend] = plug } else { plug = eachPointedPlugin.that.using(eachPointedPlugin.name); var injectionCondition = (eachPointedPlugin.name === eachDepend && eachPointedPlugin.module === moduleNameRef) || (otherModuleDepencies && otherModuleDepencies.length && otherModuleDepencies.indexOf(eachPointedPlugin.name)); if (injectionCondition ) { Inject[intNameforInjection||eachPointedPlugin.name] = eachPointedPlugin.autoExecute ? plug.WithArguments(param).execute() : plug } } } } else { Inject[eachDependNametoUse] = Interceptor; } } return Inject; }; var getModuleDependencies=function (stringSpecifiedModules) { if (stringSpecifiedModules &&( stringSpecifiedModules.length!==0)) { for (var om = 0; om < stringSpecifiedModules.length; om++) { var moduleName = stringSpecifiedModules[om]; var eahcOther = wind.isosceles.namespaces[namespaceReference]; if (eahcOther) { var depStrAr = eahcOther.module(moduleName).myDependencies(); if (depStrAr && depStrAr.length==0) { isoscelesCon$ole.error("Dependency '" + stringSpecifiedModules + "' has NOT been added to the namespace '" + namespaceReference + "' and cannot be injected into '" + moduleNameRef+"'"); } return depStrAr; } } } }; var myDependency=function (dependencyQuery) { for (var i=0;i<$allPlugins_.length;i++) { if ($allPlugins_[i].name === dependencyQuery && $allPlugins_[i].module === moduleNameRef && $allPlugins_[i].namespace === namespaceReference) { return $allPlugins_[i].plugin; } } }; var myDependencies= function () { //var depends = []; var dependsStrings = []; for (var i = 0; i < $allPlugins_.length; i++) { if ( $allPlugins_[i].module === moduleNameRef && $allPlugins_[i].namespace === namespaceReference) { // depends.push($allPlugins_[i].plugin); dependsStrings.push($allPlugins_[i].name); } } return dependsStrings; }; var plugin = function (name, f_or_dependency, fun, autoExecute, nature) { if (name.indexOf(":") !== -1) { nameObj = name.split(":"); name = nameObj[0]; interfaceName = nameObj[1]; if (name && interfaceName) { this.implement(interfaceName).withPlugin(name); } } var dnature = nature || "NONE provider"; isoscelesCon$ole.log("--->Registering a " + dnature + " " + name + " ...."); var f = typeof f_or_dependency === "function" ? f_or_dependency : (fun || function () { }); var dependencies = Object.prototype.toString.call(f_or_dependency) === '[object Array]' ? f_or_dependency : []; // dependencies.push(name); if (typeof f === "function" && name) { $allPlugins_.push({ namespace: namespaceReference, module:moduleNameRef, name: name, plugin: f, dependency: dependencies, that: this, nature: dnature, autoExecute: autoExecute }); } }; var implement = function (pluginInterface, concreteImplementation) { if (pluginInterface) { if (concreteImplementation) { _implementations.namespaces[namespaceReference][moduleNameRef][concreteImplementation] = pluginInterface; } else { return { withPlugin: function (concreteImplementation) { _implementations.namespaces[namespaceReference][moduleNameRef][concreteImplementation] = pluginInterface; return this; } } } } return this; }; var provider=function (name, f_or_dependency, fun) { this.plugin(name, f_or_dependency, fun, "PROVIDER"); }; _modulesList[namespace][moduleNameRef] = { setMockObject: setMockObject, testSetUp: testSetUp, getExpectation: getExpectation, test: test, expect:expect, specify: specify, getMockObject:getMockObject , isMocked: isMocked, enableMocking: true, mock:mock, using: using, dependencyFactoryInterceptor: dependencyFactoryInterceptor, dependencyInjectorFactory: dependencyInjectorFactory, getModuleDependencies: getModuleDependencies, myDependency: myDependency, myDependencies: myDependencies, plugin: plugin, provider: provider, implement:implement }; return _modulesList[namespace][moduleNameRef]; }; wind.isosceles.namespaces[namespace] = new module(); return wind.isosceles.namespaces[namespace]; } }; wind.isosceles.api = isoscelesCon$ole || function () { }; var $n = isosceles("_$n_"); wind.isosceles.module = $n.module; var $m = $n.module("_$m_"); for (var m_prop in $m) { if ($m.hasOwnProperty(m_prop)) { wind.isosceles[m_prop] = $m[m_prop]; } } wind.iso = wind.isosceles; })(window, undefined);
contactsamie/isosceles
debuging/isosceles.js
JavaScript
mit
24,389
import {BaseContext} from "@tsed/di"; export const PLATFORM_VIEWS_EXTENSIONS = { atpl: "atpl", bracket: "bracket", dot: "dot", dust: "dust", ect: "ect", ejs: "ejs", haml: "haml", "haml-coffee": "haml-coffee", hamlet: "hamlet", hbs: "handlebars", handlebars: "handlebars", hogan: "hogan", htmling: "htmling", jazz: "jazz", jqtpl: "jqtpl", just: "just", kernel: "kernel", liquid: "liquid", liquor: "liquor", lodash: "lodash", mote: "mote", mustache: "mustache", nunjucks: "nunjucks", plates: "plates", pug: "pug", qejs: "qejs", ractive: "ractive", razor: "razor", jsx: "react", slm: "slm", squirelly: "squirelly", swig: "swig", teacup: "teacup", templayed: "templayed", toffee: "toffee", twig: "twig", underscore: "underscore", vash: "vash", velocityjs: "velocityjs", walrus: "walrus", whiskers: "whiskers" }; export type PlatformViewsExtensionsTypes = Record<string, string>; export interface PlatformViewsEngineOptions extends Record<string, unknown> { requires?: any; } export interface PlatformRenderOptions extends Record<string, unknown> { $ctx: BaseContext; } export interface PlatformViewEngine { options: PlatformViewsEngineOptions; render(path: string, options: PlatformRenderOptions): Promise<string>; } export interface PlatformViewsSettings { disabled?: boolean; /** * Views directory. */ root?: string; /** * Enable cache. Ts.ED enable cache in PRODUCTION profile by default. */ cache?: boolean; /** * Provide extensions mapping to match the expected engines. */ extensions?: Partial<PlatformViewsExtensionsTypes>; /** * Default view engine extension. * Allow omitting extension when using View decorator or render method. */ viewEngine?: string; /** * Options mapping for each engine. */ options?: Record<string, PlatformViewsEngineOptions>; } declare global { namespace TsED { interface Configuration { /** * Object to configure Views engines with Consolidate. See more on [View engine](/docs/template-engine.md). */ views: PlatformViewsSettings; } } }
Romakita/ts-express-decorators
packages/platform/platform-views/src/domain/PlatformViewsSettings.ts
TypeScript
mit
2,158
/*! * DevExpress Gantt (dx-gantt.min) * Version: 3.1.14 * Build date: Wed Aug 25 2021 * * Copyright (c) 2012 - 2021 Developer Express Inc. ALL RIGHTS RESERVED * Read about DevExpress licensing here: https://www.devexpress.com/Support/EULAs */.dx-gantt-tsac{overflow:hidden;background-color:#fff;z-index:6}.dx-gantt-tsa,.dx-gantt-tsac{position:relative}.dx-gantt-hb{position:absolute;left:0;height:0;z-index:6}.dx-gantt-vb{width:0}.dx-gantt-tc,.dx-gantt-ti,.dx-gantt-tm,.dx-gantt-vb{position:absolute;top:0;z-index:6}.dx-gantt-tc:before,.dx-gantt-ti:before,.dx-gantt-tm:before{content:"";position:absolute;top:0;width:6px;margin-left:-3px;z-index:6;height:100%}.dx-gantt-si{position:absolute;top:0;white-space:nowrap;box-sizing:border-box}.dx-gantt-milestoneWrapper,.dx-gantt-taskResWrapper,.dx-gantt-taskWrapper{position:absolute;z-index:10;vertical-align:top;white-space:nowrap}.dx-gantt-taskWrapper>div{vertical-align:top}.dx-gantt-taskResWrapper{pointer-events:none}.dx-gantt-task{position:relative;display:inline-block;white-space:nowrap;vertical-align:top}.dx-gantt-tPrg{position:absolute;top:0;height:100%;z-index:0}.dx-gantt-taskRes,.dx-gantt-taskTitle{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.dx-gantt-titleIn{position:relative;width:100%;z-index:1}.dx-gantt-titleOut{display:inline-block;width:500px;margin-left:-500px;text-align:right;text-overflow:ellipsis}.dx-gantt-taskRes{display:inline-block;overflow:hidden}.dx-gantt-task,.dx-gantt-taskRes,.dx-gantt-taskTitle,.dx-gantt-titleOut{box-sizing:border-box}.dx-gantt-sel{position:absolute;z-index:5}.dx-gantt-task.dx-gantt-milestone{transform:rotate(45deg);border-radius:0!important;padding:0}.dx-gantt-task.dx-gantt-smallTask{text-align:center}.dx-gantt-task.dx-gantt-smallTask .dx-gantt-titleIn{padding:0;visibility:hidden}.dx-gantt-arrow,.dx-gantt-conn-h,.dx-gantt-conn-v{position:absolute;z-index:9}.dx-gantt-conn-v{top:0;width:4px;cursor:pointer;border-left-width:1px;border-left-style:solid}.dx-gantt-conn-v.active{border-left-width:2px!important}.dx-gantt-conn-h{left:0;height:4px;cursor:pointer;border-top-width:1px;border-top-style:solid}.dx-gantt-conn-h.active{border-top-width:2px!important}.dx-gantt-arrow{width:0;height:0}.dx-gantt-arrow.dx-gantt-TA{border-left-color:transparent!important}.dx-gantt-arrow.dx-gantt-RA,.dx-gantt-arrow.dx-gantt-TA{border-right-color:transparent!important;border-top-color:transparent!important}.dx-gantt-arrow.dx-gantt-RA{border-bottom-color:transparent!important}.dx-gantt-arrow.dx-gantt-BA{border-right-color:transparent!important}.dx-gantt-arrow.dx-gantt-BA,.dx-gantt-arrow.dx-gantt-LA{border-left-color:transparent!important;border-bottom-color:transparent!important}.dx-gantt-arrow.dx-gantt-LA{border-top-color:transparent!important}.dx-gantt-nwi{position:absolute;z-index:3}.dx-gantt-altRow{position:absolute;z-index:2}.dx-gantt-task-edit-wrapper{padding-left:1px}.dx-gantt-task-edit-wrapper,.dx-gantt-task-edit-wrapper-successor{position:absolute;z-index:11}.dx-gantt-task-edit-wrapper-custom{background-color:rgba(90,84,84,.3)}.dx-gantt-task-edit-wrapper-custom.hide-updating{background-color:transparent;pointer-events:none}.dx-gantt-task-edit-wrapper.hide-updating .dx-gantt-task-edit-frame,.dx-gantt-task-edit-wrapper.milestone .dx-gantt-task-edit-frame{border:none!important}#dx-gantt-ta.ms-pointer-active,#dx-gantt-ta.ms-pointer-active .dx-gantt-task-edit-frame,#dx-gantt-ta.ms-pointer-active .dx-gantt-task-edit-frame div{-webkit-appearance:none;-ms-touch-action:none;touch-action:none;-ms-user-select:none;-webkit-user-select:none;user-select:none;-moz-user-select:none}.dx-gantt-task-edit-wrapper.hide-dependency .dx-gantt-task-edit-dependency-l,.dx-gantt-task-edit-wrapper.hide-dependency .dx-gantt-task-edit-dependency-r,.dx-gantt-task-edit-wrapper.hide-updating .dx-gantt-task-edit-end,.dx-gantt-task-edit-wrapper.hide-updating .dx-gantt-task-edit-progress,.dx-gantt-task-edit-wrapper.hide-updating .dx-gantt-task-edit-start,.dx-gantt-task-edit-wrapper.milestone .dx-gantt-task-edit-end,.dx-gantt-task-edit-wrapper.milestone .dx-gantt-task-edit-progress,.dx-gantt-task-edit-wrapper.milestone .dx-gantt-task-edit-start,.dx-gantt-task-edit-wrapper.move .dx-gantt-task-edit-dependency-l,.dx-gantt-task-edit-wrapper.move .dx-gantt-task-edit-dependency-r,.dx-gantt-task-edit-wrapper.move .dx-gantt-task-edit-progress{display:none}.dx-gantt-task-edit-frame,.dx-gantt-task-edit-frame-successor{box-sizing:border-box;height:100%;width:100%;position:absolute;z-index:9}.dx-gantt-task-edit-frame{border:1px solid #269aff}.dx-gantt-task-edit-progress{position:absolute;width:0;height:0;bottom:0;cursor:pointer;border-color:transparent transparent #269aff;border-style:solid;border-width:0 6px 9px;z-index:10}.dx-gantt-task-edit-progress:before{content:"";width:10px;height:4px;background-color:#fff;position:absolute;bottom:-14px;left:-6px;border:1px solid #269aff;border-top:none}.dx-gantt-task-edit-progress div{position:absolute;bottom:0;cursor:pointer;border-color:transparent transparent #fff;border-style:solid;border-width:0 5px 7px;z-index:9;top:2px;left:-5px;pointer-events:none}.dx-gantt-task-edit-tooltip{position:absolute;font-family:sans-serif;width:max-content;line-height:16px;font-size:12px;border-radius:2px;display:none;z-index:12}.dx-gantt-task-edit-tooltip-default{padding:6px;color:#fff;background-color:rgba(0,0,0,.64)}.dx-gantt-task-edit-tooltip-after:after{border-bottom:6px solid rgba(0,0,0,.64);top:-6px}.dx-gantt-task-edit-tooltip-after:after,.dx-gantt-task-edit-tooltip-before:before{content:"";width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;position:absolute}.dx-gantt-task-edit-tooltip-before:before{border-top:6px solid rgba(0,0,0,.64);bottom:-6px}.dx-gantt-task-edit-tooltip .dx-gantt-task-title{padding-bottom:3px}.dx-gantt-task-edit-tooltip .dx-gantt-status-time tr td:first-child{padding-right:3px}.dx-gantt-task-edit-tooltip .dx-gantt-status-time span:first-child,.dx-gantt-task-edit-tooltip .dx-gantt-status-time tr td:first-child,.dx-gantt-task-edit-tooltip .dx-gantt-task-title{font-weight:600}.dx-gantt-task-edit-dependency-l,.dx-gantt-task-edit-dependency-r,.dx-gantt-task-edit-successor-dependency-l,.dx-gantt-task-edit-successor-dependency-r{position:absolute;border-radius:50%;top:5px;width:8px;height:8px;background:#fff;border:1px solid #269aff;cursor:pointer}.dx-gantt-task-edit-dependency-r,.dx-gantt-task-edit-successor-dependency-r{left:-10px}.dx-gantt-task-edit-dependency-l,.dx-gantt-task-edit-successor-dependency-l{right:-10px}.dx-gantt-task-edit-dependency-l.dx-gantt-edit-touch,.dx-gantt-task-edit-dependency-r.dx-gantt-edit-touch,.dx-gantt-task-edit-successor-dependency-l.dx-gantt-edit-touch,.dx-gantt-task-edit-successor-dependency-r.dx-gantt-edit-touch{top:3px;width:11px;height:11px}.dx-gantt-task-edit-dependency-r.dx-gantt-edit-touch,.dx-gantt-task-edit-successor-dependency-r.dx-gantt-edit-touch{left:-15px}.dx-gantt-task-edit-dependency-l.dx-gantt-edit-touch,.dx-gantt-task-edit-successor-dependency-l.dx-gantt-edit-touch{right:-15px}.dx-gantt-task-edit-end,.dx-gantt-task-edit-start{position:absolute;height:100%;width:5px;top:0;cursor:col-resize}.dx-gantt-task-edit-end{right:0}.dx-gantt-task-edit-dependency-line{height:2px;background-color:#269aff;position:absolute;transform-origin:0 0;z-index:9}
cdnjs/cdnjs
ajax/libs/devexpress-gantt/3.1.14/dx-gantt.min.css
CSS
mit
7,344
@import url(https://fonts.googleapis.com/css?family=Raleway:300,400,600); /*! * Bootstrap v3.3.7 (http://getbootstrap.com) * Copyright 2011-2016 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */ /*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */ html { font-family: sans-serif; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100% } body { margin: 0 } article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, nav, section, summary { display: block } audio, canvas, progress, video { display: inline-block; vertical-align: baseline } audio:not([controls]) { display: none; height: 0 } [hidden], template { display: none } a { background-color: transparent } a:active, a:hover { outline: 0 } abbr[title] { border-bottom: 1px dotted } b, strong { font-weight: 700 } dfn { font-style: italic } h1 { font-size: 2em; margin: .67em 0 } mark { background: #ff0; color: #000 } small { font-size: 80% } sub, sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline } sup { top: -.5em } sub { bottom: -.25em } img { border: 0 } svg:not(:root) { overflow: hidden } figure { margin: 1em 40px } hr { box-sizing: content-box; height: 0 } pre { overflow: auto } code, kbd, pre, samp { font-family: monospace, monospace; font-size: 1em } button, input, optgroup, select, textarea { color: inherit; font: inherit; margin: 0 } button { overflow: visible } button, select { text-transform: none } button, html input[type=button], input[type=reset], input[type=submit] { -webkit-appearance: button; cursor: pointer } button[disabled], html input[disabled] { cursor: default } button::-moz-focus-inner, input::-moz-focus-inner { border: 0; padding: 0 } input { line-height: normal } input[type=checkbox], input[type=radio] { box-sizing: border-box; padding: 0 } input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { height: auto } input[type=search] { -webkit-appearance: textfield; box-sizing: content-box } input[type=search]::-webkit-search-cancel-button, input[type=search]::-webkit-search-decoration { -webkit-appearance: none } fieldset { border: 1px solid silver; margin: 0 2px; padding: .35em .625em .75em } legend { border: 0; padding: 0 } textarea { overflow: auto } optgroup { font-weight: 700 } table { border-collapse: collapse; border-spacing: 0 } td, th { padding: 0 } /*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */ @media print { *, :after, :before { background: transparent !important; color: #000 !important; box-shadow: none !important; text-shadow: none !important } a, a:visited { text-decoration: underline } a[href]:after { content: " (" attr(href) ")" } abbr[title]:after { content: " (" attr(title) ")" } a[href^="#"]:after, a[href^="javascript:"]:after { content: "" } blockquote, pre { border: 1px solid #999; page-break-inside: avoid } thead { display: table-header-group } img, tr { page-break-inside: avoid } img { max-width: 100% !important } h2, h3, p { orphans: 3; widows: 3 } h2, h3 { page-break-after: avoid } .navbar { display: none } .btn > .caret, .dropup > .btn > .caret { border-top-color: #000 !important } .label { border: 1px solid #000 } .table { border-collapse: collapse !important } .table td, .table th { background-color: #fff !important } .table-bordered td, .table-bordered th { border: 1px solid #ddd !important } } @font-face { font-family: Glyphicons Halflings; src: url(.//fonts/glyphicons-halflings-regular.eot?f4769f9bdb7466be65088239c12046d1); src: url(.//fonts/glyphicons-halflings-regular.eot?f4769f9bdb7466be65088239c12046d1) format("embedded-opentype"), url(.//fonts/glyphicons-halflings-regular.woff2?448c34a56d699c29117adc64c43affeb) format("woff2"), url(.//fonts/glyphicons-halflings-regular.woff?fa2772327f55d8198301fdb8bcfc8158) format("woff"), url(.//fonts/glyphicons-halflings-regular.ttf?e18bbf611f2a2e43afc071aa2f4e1512) format("truetype"), url(.//fonts/glyphicons-halflings-regular.svg?89889688147bd7575d6327160d64e760) format("svg") } .glyphicon { position: relative; top: 1px; display: inline-block; font-family: Glyphicons Halflings; font-style: normal; font-weight: 400; line-height: 1; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale } .glyphicon-asterisk:before { content: "*" } .glyphicon-plus:before { content: "+" } .glyphicon-eur:before, .glyphicon-euro:before { content: "\20AC" } .glyphicon-minus:before { content: "\2212" } .glyphicon-cloud:before { content: "\2601" } .glyphicon-envelope:before { content: "\2709" } .glyphicon-pencil:before { content: "\270F" } .glyphicon-glass:before { content: "\E001" } .glyphicon-music:before { content: "\E002" } .glyphicon-search:before { content: "\E003" } .glyphicon-heart:before { content: "\E005" } .glyphicon-star:before { content: "\E006" } .glyphicon-star-empty:before { content: "\E007" } .glyphicon-user:before { content: "\E008" } .glyphicon-film:before { content: "\E009" } .glyphicon-th-large:before { content: "\E010" } .glyphicon-th:before { content: "\E011" } .glyphicon-th-list:before { content: "\E012" } .glyphicon-ok:before { content: "\E013" } .glyphicon-remove:before { content: "\E014" } .glyphicon-zoom-in:before { content: "\E015" } .glyphicon-zoom-out:before { content: "\E016" } .glyphicon-off:before { content: "\E017" } .glyphicon-signal:before { content: "\E018" } .glyphicon-cog:before { content: "\E019" } .glyphicon-trash:before { content: "\E020" } .glyphicon-home:before { content: "\E021" } .glyphicon-file:before { content: "\E022" } .glyphicon-time:before { content: "\E023" } .glyphicon-road:before { content: "\E024" } .glyphicon-download-alt:before { content: "\E025" } .glyphicon-download:before { content: "\E026" } .glyphicon-upload:before { content: "\E027" } .glyphicon-inbox:before { content: "\E028" } .glyphicon-play-circle:before { content: "\E029" } .glyphicon-repeat:before { content: "\E030" } .glyphicon-refresh:before { content: "\E031" } .glyphicon-list-alt:before { content: "\E032" } .glyphicon-lock:before { content: "\E033" } .glyphicon-flag:before { content: "\E034" } .glyphicon-headphones:before { content: "\E035" } .glyphicon-volume-off:before { content: "\E036" } .glyphicon-volume-down:before { content: "\E037" } .glyphicon-volume-up:before { content: "\E038" } .glyphicon-qrcode:before { content: "\E039" } .glyphicon-barcode:before { content: "\E040" } .glyphicon-tag:before { content: "\E041" } .glyphicon-tags:before { content: "\E042" } .glyphicon-book:before { content: "\E043" } .glyphicon-bookmark:before { content: "\E044" } .glyphicon-print:before { content: "\E045" } .glyphicon-camera:before { content: "\E046" } .glyphicon-font:before { content: "\E047" } .glyphicon-bold:before { content: "\E048" } .glyphicon-italic:before { content: "\E049" } .glyphicon-text-height:before { content: "\E050" } .glyphicon-text-width:before { content: "\E051" } .glyphicon-align-left:before { content: "\E052" } .glyphicon-align-center:before { content: "\E053" } .glyphicon-align-right:before { content: "\E054" } .glyphicon-align-justify:before { content: "\E055" } .glyphicon-list:before { content: "\E056" } .glyphicon-indent-left:before { content: "\E057" } .glyphicon-indent-right:before { content: "\E058" } .glyphicon-facetime-video:before { content: "\E059" } .glyphicon-picture:before { content: "\E060" } .glyphicon-map-marker:before { content: "\E062" } .glyphicon-adjust:before { content: "\E063" } .glyphicon-tint:before { content: "\E064" } .glyphicon-edit:before { content: "\E065" } .glyphicon-share:before { content: "\E066" } .glyphicon-check:before { content: "\E067" } .glyphicon-move:before { content: "\E068" } .glyphicon-step-backward:before { content: "\E069" } .glyphicon-fast-backward:before { content: "\E070" } .glyphicon-backward:before { content: "\E071" } .glyphicon-play:before { content: "\E072" } .glyphicon-pause:before { content: "\E073" } .glyphicon-stop:before { content: "\E074" } .glyphicon-forward:before { content: "\E075" } .glyphicon-fast-forward:before { content: "\E076" } .glyphicon-step-forward:before { content: "\E077" } .glyphicon-eject:before { content: "\E078" } .glyphicon-chevron-left:before { content: "\E079" } .glyphicon-chevron-right:before { content: "\E080" } .glyphicon-plus-sign:before { content: "\E081" } .glyphicon-minus-sign:before { content: "\E082" } .glyphicon-remove-sign:before { content: "\E083" } .glyphicon-ok-sign:before { content: "\E084" } .glyphicon-question-sign:before { content: "\E085" } .glyphicon-info-sign:before { content: "\E086" } .glyphicon-screenshot:before { content: "\E087" } .glyphicon-remove-circle:before { content: "\E088" } .glyphicon-ok-circle:before { content: "\E089" } .glyphicon-ban-circle:before { content: "\E090" } .glyphicon-arrow-left:before { content: "\E091" } .glyphicon-arrow-right:before { content: "\E092" } .glyphicon-arrow-up:before { content: "\E093" } .glyphicon-arrow-down:before { content: "\E094" } .glyphicon-share-alt:before { content: "\E095" } .glyphicon-resize-full:before { content: "\E096" } .glyphicon-resize-small:before { content: "\E097" } .glyphicon-exclamation-sign:before { content: "\E101" } .glyphicon-gift:before { content: "\E102" } .glyphicon-leaf:before { content: "\E103" } .glyphicon-fire:before { content: "\E104" } .glyphicon-eye-open:before { content: "\E105" } .glyphicon-eye-close:before { content: "\E106" } .glyphicon-warning-sign:before { content: "\E107" } .glyphicon-plane:before { content: "\E108" } .glyphicon-calendar:before { content: "\E109" } .glyphicon-random:before { content: "\E110" } .glyphicon-comment:before { content: "\E111" } .glyphicon-magnet:before { content: "\E112" } .glyphicon-chevron-up:before { content: "\E113" } .glyphicon-chevron-down:before { content: "\E114" } .glyphicon-retweet:before { content: "\E115" } .glyphicon-shopping-cart:before { content: "\E116" } .glyphicon-folder-close:before { content: "\E117" } .glyphicon-folder-open:before { content: "\E118" } .glyphicon-resize-vertical:before { content: "\E119" } .glyphicon-resize-horizontal:before { content: "\E120" } .glyphicon-hdd:before { content: "\E121" } .glyphicon-bullhorn:before { content: "\E122" } .glyphicon-bell:before { content: "\E123" } .glyphicon-certificate:before { content: "\E124" } .glyphicon-thumbs-up:before { content: "\E125" } .glyphicon-thumbs-down:before { content: "\E126" } .glyphicon-hand-right:before { content: "\E127" } .glyphicon-hand-left:before { content: "\E128" } .glyphicon-hand-up:before { content: "\E129" } .glyphicon-hand-down:before { content: "\E130" } .glyphicon-circle-arrow-right:before { content: "\E131" } .glyphicon-circle-arrow-left:before { content: "\E132" } .glyphicon-circle-arrow-up:before { content: "\E133" } .glyphicon-circle-arrow-down:before { content: "\E134" } .glyphicon-globe:before { content: "\E135" } .glyphicon-wrench:before { content: "\E136" } .glyphicon-tasks:before { content: "\E137" } .glyphicon-filter:before { content: "\E138" } .glyphicon-briefcase:before { content: "\E139" } .glyphicon-fullscreen:before { content: "\E140" } .glyphicon-dashboard:before { content: "\E141" } .glyphicon-paperclip:before { content: "\E142" } .glyphicon-heart-empty:before { content: "\E143" } .glyphicon-link:before { content: "\E144" } .glyphicon-phone:before { content: "\E145" } .glyphicon-pushpin:before { content: "\E146" } .glyphicon-usd:before { content: "\E148" } .glyphicon-gbp:before { content: "\E149" } .glyphicon-sort:before { content: "\E150" } .glyphicon-sort-by-alphabet:before { content: "\E151" } .glyphicon-sort-by-alphabet-alt:before { content: "\E152" } .glyphicon-sort-by-order:before { content: "\E153" } .glyphicon-sort-by-order-alt:before { content: "\E154" } .glyphicon-sort-by-attributes:before { content: "\E155" } .glyphicon-sort-by-attributes-alt:before { content: "\E156" } .glyphicon-unchecked:before { content: "\E157" } .glyphicon-expand:before { content: "\E158" } .glyphicon-collapse-down:before { content: "\E159" } .glyphicon-collapse-up:before { content: "\E160" } .glyphicon-log-in:before { content: "\E161" } .glyphicon-flash:before { content: "\E162" } .glyphicon-log-out:before { content: "\E163" } .glyphicon-new-window:before { content: "\E164" } .glyphicon-record:before { content: "\E165" } .glyphicon-save:before { content: "\E166" } .glyphicon-open:before { content: "\E167" } .glyphicon-saved:before { content: "\E168" } .glyphicon-import:before { content: "\E169" } .glyphicon-export:before { content: "\E170" } .glyphicon-send:before { content: "\E171" } .glyphicon-floppy-disk:before { content: "\E172" } .glyphicon-floppy-saved:before { content: "\E173" } .glyphicon-floppy-remove:before { content: "\E174" } .glyphicon-floppy-save:before { content: "\E175" } .glyphicon-floppy-open:before { content: "\E176" } .glyphicon-credit-card:before { content: "\E177" } .glyphicon-transfer:before { content: "\E178" } .glyphicon-cutlery:before { content: "\E179" } .glyphicon-header:before { content: "\E180" } .glyphicon-compressed:before { content: "\E181" } .glyphicon-earphone:before { content: "\E182" } .glyphicon-phone-alt:before { content: "\E183" } .glyphicon-tower:before { content: "\E184" } .glyphicon-stats:before { content: "\E185" } .glyphicon-sd-video:before { content: "\E186" } .glyphicon-hd-video:before { content: "\E187" } .glyphicon-subtitles:before { content: "\E188" } .glyphicon-sound-stereo:before { content: "\E189" } .glyphicon-sound-dolby:before { content: "\E190" } .glyphicon-sound-5-1:before { content: "\E191" } .glyphicon-sound-6-1:before { content: "\E192" } .glyphicon-sound-7-1:before { content: "\E193" } .glyphicon-copyright-mark:before { content: "\E194" } .glyphicon-registration-mark:before { content: "\E195" } .glyphicon-cloud-download:before { content: "\E197" } .glyphicon-cloud-upload:before { content: "\E198" } .glyphicon-tree-conifer:before { content: "\E199" } .glyphicon-tree-deciduous:before { content: "\E200" } .glyphicon-cd:before { content: "\E201" } .glyphicon-save-file:before { content: "\E202" } .glyphicon-open-file:before { content: "\E203" } .glyphicon-level-up:before { content: "\E204" } .glyphicon-copy:before { content: "\E205" } .glyphicon-paste:before { content: "\E206" } .glyphicon-alert:before { content: "\E209" } .glyphicon-equalizer:before { content: "\E210" } .glyphicon-king:before { content: "\E211" } .glyphicon-queen:before { content: "\E212" } .glyphicon-pawn:before { content: "\E213" } .glyphicon-bishop:before { content: "\E214" } .glyphicon-knight:before { content: "\E215" } .glyphicon-baby-formula:before { content: "\E216" } .glyphicon-tent:before { content: "\26FA" } .glyphicon-blackboard:before { content: "\E218" } .glyphicon-bed:before { content: "\E219" } .glyphicon-apple:before { content: "\F8FF" } .glyphicon-erase:before { content: "\E221" } .glyphicon-hourglass:before { content: "\231B" } .glyphicon-lamp:before { content: "\E223" } .glyphicon-duplicate:before { content: "\E224" } .glyphicon-piggy-bank:before { content: "\E225" } .glyphicon-scissors:before { content: "\E226" } .glyphicon-bitcoin:before, .glyphicon-btc:before, .glyphicon-xbt:before { content: "\E227" } .glyphicon-jpy:before, .glyphicon-yen:before { content: "\A5" } .glyphicon-rub:before, .glyphicon-ruble:before { content: "\20BD" } .glyphicon-scale:before { content: "\E230" } .glyphicon-ice-lolly:before { content: "\E231" } .glyphicon-ice-lolly-tasted:before { content: "\E232" } .glyphicon-education:before { content: "\E233" } .glyphicon-option-horizontal:before { content: "\E234" } .glyphicon-option-vertical:before { content: "\E235" } .glyphicon-menu-hamburger:before { content: "\E236" } .glyphicon-modal-window:before { content: "\E237" } .glyphicon-oil:before { content: "\E238" } .glyphicon-grain:before { content: "\E239" } .glyphicon-sunglasses:before { content: "\E240" } .glyphicon-text-size:before { content: "\E241" } .glyphicon-text-color:before { content: "\E242" } .glyphicon-text-background:before { content: "\E243" } .glyphicon-object-align-top:before { content: "\E244" } .glyphicon-object-align-bottom:before { content: "\E245" } .glyphicon-object-align-horizontal:before { content: "\E246" } .glyphicon-object-align-left:before { content: "\E247" } .glyphicon-object-align-vertical:before { content: "\E248" } .glyphicon-object-align-right:before { content: "\E249" } .glyphicon-triangle-right:before { content: "\E250" } .glyphicon-triangle-left:before { content: "\E251" } .glyphicon-triangle-bottom:before { content: "\E252" } .glyphicon-triangle-top:before { content: "\E253" } .glyphicon-console:before { content: "\E254" } .glyphicon-superscript:before { content: "\E255" } .glyphicon-subscript:before { content: "\E256" } .glyphicon-menu-left:before { content: "\E257" } .glyphicon-menu-right:before { content: "\E258" } .glyphicon-menu-down:before { content: "\E259" } .glyphicon-menu-up:before { content: "\E260" } *, :after, :before { box-sizing: border-box } html { font-size: 10px; -webkit-tap-highlight-color: transparent } body { font-family: Raleway, sans-serif; font-size: 14px; line-height: 1.6; color: #636b6f; background-color: #f5f8fa } button, input, select, textarea { font-family: inherit; font-size: inherit; line-height: inherit } a { color: #3097d1; text-decoration: none } a:focus, a:hover { color: #216a94; text-decoration: underline } a:focus { outline: 5px auto -webkit-focus-ring-color; outline-offset: -2px } figure { margin: 0 } img { vertical-align: middle } .img-responsive { display: block; max-width: 100%; height: auto } .img-rounded { border-radius: 6px } .img-thumbnail { padding: 4px; line-height: 1.6; background-color: #f5f8fa; border: 1px solid #ddd; border-radius: 4px; -webkit-transition: all .2s ease-in-out; transition: all .2s ease-in-out; display: inline-block; max-width: 100%; height: auto } .img-circle { border-radius: 50% } hr { margin-top: 22px; margin-bottom: 22px; border: 0; border-top: 1px solid #eee } .sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0 } .sr-only-focusable:active, .sr-only-focusable:focus { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto } [role=button] { cursor: pointer } .h1, .h2, .h3, .h4, .h5, .h6, h1, h2, h3, h4, h5, h6 { font-family: inherit; font-weight: 500; line-height: 1.1; color: inherit } .h1 .small, .h1 small, .h2 .small, .h2 small, .h3 .small, .h3 small, .h4 .small, .h4 small, .h5 .small, .h5 small, .h6 .small, .h6 small, h1 .small, h1 small, h2 .small, h2 small, h3 .small, h3 small, h4 .small, h4 small, h5 .small, h5 small, h6 .small, h6 small { font-weight: 400; line-height: 1; color: #777 } .h1, .h2, .h3, h1, h2, h3 { margin-top: 22px; margin-bottom: 11px } .h1 .small, .h1 small, .h2 .small, .h2 small, .h3 .small, .h3 small, h1 .small, h1 small, h2 .small, h2 small, h3 .small, h3 small { font-size: 65% } .h4, .h5, .h6, h4, h5, h6 { margin-top: 11px; margin-bottom: 11px } .h4 .small, .h4 small, .h5 .small, .h5 small, .h6 .small, .h6 small, h4 .small, h4 small, h5 .small, h5 small, h6 .small, h6 small { font-size: 75% } .h1, h1 { font-size: 36px } .h2, h2 { font-size: 30px } .h3, h3 { font-size: 24px } .h4, h4 { font-size: 18px } .h5, h5 { font-size: 14px } .h6, h6 { font-size: 12px } p { margin: 0 0 11px } .lead { margin-bottom: 22px; font-size: 16px; font-weight: 300; line-height: 1.4 } @media (min-width: 768px) { .lead { font-size: 21px } } .small, small { font-size: 85% } .mark, mark { background-color: #fcf8e3; padding: .2em } .text-left { text-align: left } .text-right { text-align: right } .text-center { text-align: center } .text-justify { text-align: justify } .text-nowrap { white-space: nowrap } .text-lowercase { text-transform: lowercase } .initialism, .text-uppercase { text-transform: uppercase } .text-capitalize { text-transform: capitalize } .text-muted { color: #777 } .text-primary { color: #3097d1 } a.text-primary:focus, a.text-primary:hover { color: #2579a9 } .text-success { color: #3c763d } a.text-success:focus, a.text-success:hover { color: #2b542c } .text-info { color: #31708f } a.text-info:focus, a.text-info:hover { color: #245269 } .text-warning { color: #8a6d3b } a.text-warning:focus, a.text-warning:hover { color: #66512c } .text-danger { color: #a94442 } a.text-danger:focus, a.text-danger:hover { color: #843534 } .bg-primary { color: #fff; background-color: #3097d1 } a.bg-primary:focus, a.bg-primary:hover { background-color: #2579a9 } .bg-success { background-color: #dff0d8 } a.bg-success:focus, a.bg-success:hover { background-color: #c1e2b3 } .bg-info { background-color: #d9edf7 } a.bg-info:focus, a.bg-info:hover { background-color: #afd9ee } .bg-warning { background-color: #fcf8e3 } a.bg-warning:focus, a.bg-warning:hover { background-color: #f7ecb5 } .bg-danger { background-color: #f2dede } a.bg-danger:focus, a.bg-danger:hover { background-color: #e4b9b9 } .page-header { padding-bottom: 10px; margin: 44px 0 22px; border-bottom: 1px solid #eee } ol, ul { margin-top: 0; margin-bottom: 11px } ol ol, ol ul, ul ol, ul ul { margin-bottom: 0 } .list-inline, .list-unstyled { padding-left: 0; list-style: none } .list-inline { margin-left: -5px } .list-inline > li { display: inline-block; padding-left: 5px; padding-right: 5px } dl { margin-top: 0; margin-bottom: 22px } dd, dt { line-height: 1.6 } dt { font-weight: 700 } dd { margin-left: 0 } .dl-horizontal dd:after, .dl-horizontal dd:before { content: " "; display: table } .dl-horizontal dd:after { clear: both } @media (min-width: 768px) { .dl-horizontal dt { float: left; width: 160px; clear: left; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap } .dl-horizontal dd { margin-left: 180px } } abbr[data-original-title], abbr[title] { cursor: help; border-bottom: 1px dotted #777 } .initialism { font-size: 90% } blockquote { padding: 11px 22px; margin: 0 0 22px; font-size: 17.5px; border-left: 5px solid #eee } blockquote ol:last-child, blockquote p:last-child, blockquote ul:last-child { margin-bottom: 0 } blockquote .small, blockquote footer, blockquote small { display: block; font-size: 80%; line-height: 1.6; color: #777 } blockquote .small:before, blockquote footer:before, blockquote small:before { content: "\2014 \A0" } .blockquote-reverse, blockquote.pull-right { padding-right: 15px; padding-left: 0; border-right: 5px solid #eee; border-left: 0; text-align: right } .blockquote-reverse .small:before, .blockquote-reverse footer:before, .blockquote-reverse small:before, blockquote.pull-right .small:before, blockquote.pull-right footer:before, blockquote.pull-right small:before { content: "" } .blockquote-reverse .small:after, .blockquote-reverse footer:after, .blockquote-reverse small:after, blockquote.pull-right .small:after, blockquote.pull-right footer:after, blockquote.pull-right small:after { content: "\A0 \2014" } address { margin-bottom: 22px; font-style: normal; line-height: 1.6 } code, kbd, pre, samp { font-family: Menlo, Monaco, Consolas, Courier New, monospace } code { color: #c7254e; background-color: #f9f2f4; border-radius: 4px } code, kbd { padding: 2px 4px; font-size: 90% } kbd { color: #fff; background-color: #333; border-radius: 3px; box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .25) } kbd kbd { padding: 0; font-size: 100%; font-weight: 700; box-shadow: none } pre { display: block; padding: 10.5px; margin: 0 0 11px; font-size: 13px; line-height: 1.6; word-break: break-all; word-wrap: break-word; color: #333; background-color: #f5f5f5; border: 1px solid #ccc; border-radius: 4px } pre code { padding: 0; font-size: inherit; color: inherit; white-space: pre-wrap; background-color: transparent; border-radius: 0 } .pre-scrollable { max-height: 340px; overflow-y: scroll } .container { margin-right: auto; margin-left: auto; padding-left: 15px; padding-right: 15px } .container:after, .container:before { content: " "; display: table } .container:after { clear: both } @media (min-width: 768px) { .container { width: 750px } } @media (min-width: 992px) { .container { width: 970px } } @media (min-width: 1200px) { .container { width: 1170px } } .container-fluid { margin-right: auto; margin-left: auto; padding-left: 15px; padding-right: 15px } .container-fluid:after, .container-fluid:before { content: " "; display: table } .container-fluid:after { clear: both } .row { margin-left: -15px; margin-right: -15px } .row:after, .row:before { content: " "; display: table } .row:after { clear: both } .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12, .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12, .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12, .col-xs-1, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9, .col-xs-10, .col-xs-11, .col-xs-12 { position: relative; min-height: 1px; padding-left: 15px; padding-right: 15px } .col-xs-1, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9, .col-xs-10, .col-xs-11, .col-xs-12 { float: left } .col-xs-1 { width: 8.33333% } .col-xs-2 { width: 16.66667% } .col-xs-3 { width: 25% } .col-xs-4 { width: 33.33333% } .col-xs-5 { width: 41.66667% } .col-xs-6 { width: 50% } .col-xs-7 { width: 58.33333% } .col-xs-8 { width: 66.66667% } .col-xs-9 { width: 75% } .col-xs-10 { width: 83.33333% } .col-xs-11 { width: 91.66667% } .col-xs-12 { width: 100% } .col-xs-pull-0 { right: auto } .col-xs-pull-1 { right: 8.33333% } .col-xs-pull-2 { right: 16.66667% } .col-xs-pull-3 { right: 25% } .col-xs-pull-4 { right: 33.33333% } .col-xs-pull-5 { right: 41.66667% } .col-xs-pull-6 { right: 50% } .col-xs-pull-7 { right: 58.33333% } .col-xs-pull-8 { right: 66.66667% } .col-xs-pull-9 { right: 75% } .col-xs-pull-10 { right: 83.33333% } .col-xs-pull-11 { right: 91.66667% } .col-xs-pull-12 { right: 100% } .col-xs-push-0 { left: auto } .col-xs-push-1 { left: 8.33333% } .col-xs-push-2 { left: 16.66667% } .col-xs-push-3 { left: 25% } .col-xs-push-4 { left: 33.33333% } .col-xs-push-5 { left: 41.66667% } .col-xs-push-6 { left: 50% } .col-xs-push-7 { left: 58.33333% } .col-xs-push-8 { left: 66.66667% } .col-xs-push-9 { left: 75% } .col-xs-push-10 { left: 83.33333% } .col-xs-push-11 { left: 91.66667% } .col-xs-push-12 { left: 100% } .col-xs-offset-0 { margin-left: 0 } .col-xs-offset-1 { margin-left: 8.33333% } .col-xs-offset-2 { margin-left: 16.66667% } .col-xs-offset-3 { margin-left: 25% } .col-xs-offset-4 { margin-left: 33.33333% } .col-xs-offset-5 { margin-left: 41.66667% } .col-xs-offset-6 { margin-left: 50% } .col-xs-offset-7 { margin-left: 58.33333% } .col-xs-offset-8 { margin-left: 66.66667% } .col-xs-offset-9 { margin-left: 75% } .col-xs-offset-10 { margin-left: 83.33333% } .col-xs-offset-11 { margin-left: 91.66667% } .col-xs-offset-12 { margin-left: 100% } @media (min-width: 768px) { .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 { float: left } .col-sm-1 { width: 8.33333% } .col-sm-2 { width: 16.66667% } .col-sm-3 { width: 25% } .col-sm-4 { width: 33.33333% } .col-sm-5 { width: 41.66667% } .col-sm-6 { width: 50% } .col-sm-7 { width: 58.33333% } .col-sm-8 { width: 66.66667% } .col-sm-9 { width: 75% } .col-sm-10 { width: 83.33333% } .col-sm-11 { width: 91.66667% } .col-sm-12 { width: 100% } .col-sm-pull-0 { right: auto } .col-sm-pull-1 { right: 8.33333% } .col-sm-pull-2 { right: 16.66667% } .col-sm-pull-3 { right: 25% } .col-sm-pull-4 { right: 33.33333% } .col-sm-pull-5 { right: 41.66667% } .col-sm-pull-6 { right: 50% } .col-sm-pull-7 { right: 58.33333% } .col-sm-pull-8 { right: 66.66667% } .col-sm-pull-9 { right: 75% } .col-sm-pull-10 { right: 83.33333% } .col-sm-pull-11 { right: 91.66667% } .col-sm-pull-12 { right: 100% } .col-sm-push-0 { left: auto } .col-sm-push-1 { left: 8.33333% } .col-sm-push-2 { left: 16.66667% } .col-sm-push-3 { left: 25% } .col-sm-push-4 { left: 33.33333% } .col-sm-push-5 { left: 41.66667% } .col-sm-push-6 { left: 50% } .col-sm-push-7 { left: 58.33333% } .col-sm-push-8 { left: 66.66667% } .col-sm-push-9 { left: 75% } .col-sm-push-10 { left: 83.33333% } .col-sm-push-11 { left: 91.66667% } .col-sm-push-12 { left: 100% } .col-sm-offset-0 { margin-left: 0 } .col-sm-offset-1 { margin-left: 8.33333% } .col-sm-offset-2 { margin-left: 16.66667% } .col-sm-offset-3 { margin-left: 25% } .col-sm-offset-4 { margin-left: 33.33333% } .col-sm-offset-5 { margin-left: 41.66667% } .col-sm-offset-6 { margin-left: 50% } .col-sm-offset-7 { margin-left: 58.33333% } .col-sm-offset-8 { margin-left: 66.66667% } .col-sm-offset-9 { margin-left: 75% } .col-sm-offset-10 { margin-left: 83.33333% } .col-sm-offset-11 { margin-left: 91.66667% } .col-sm-offset-12 { margin-left: 100% } } @media (min-width: 992px) { .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12 { float: left } .col-md-1 { width: 8.33333% } .col-md-2 { width: 16.66667% } .col-md-3 { width: 25% } .col-md-4 { width: 33.33333% } .col-md-5 { width: 41.66667% } .col-md-6 { width: 50% } .col-md-7 { width: 58.33333% } .col-md-8 { width: 66.66667% } .col-md-9 { width: 75% } .col-md-10 { width: 83.33333% } .col-md-11 { width: 91.66667% } .col-md-12 { width: 100% } .col-md-pull-0 { right: auto } .col-md-pull-1 { right: 8.33333% } .col-md-pull-2 { right: 16.66667% } .col-md-pull-3 { right: 25% } .col-md-pull-4 { right: 33.33333% } .col-md-pull-5 { right: 41.66667% } .col-md-pull-6 { right: 50% } .col-md-pull-7 { right: 58.33333% } .col-md-pull-8 { right: 66.66667% } .col-md-pull-9 { right: 75% } .col-md-pull-10 { right: 83.33333% } .col-md-pull-11 { right: 91.66667% } .col-md-pull-12 { right: 100% } .col-md-push-0 { left: auto } .col-md-push-1 { left: 8.33333% } .col-md-push-2 { left: 16.66667% } .col-md-push-3 { left: 25% } .col-md-push-4 { left: 33.33333% } .col-md-push-5 { left: 41.66667% } .col-md-push-6 { left: 50% } .col-md-push-7 { left: 58.33333% } .col-md-push-8 { left: 66.66667% } .col-md-push-9 { left: 75% } .col-md-push-10 { left: 83.33333% } .col-md-push-11 { left: 91.66667% } .col-md-push-12 { left: 100% } .col-md-offset-0 { margin-left: 0 } .col-md-offset-1 { margin-left: 8.33333% } .col-md-offset-2 { margin-left: 16.66667% } .col-md-offset-3 { margin-left: 25% } .col-md-offset-4 { margin-left: 33.33333% } .col-md-offset-5 { margin-left: 41.66667% } .col-md-offset-6 { margin-left: 50% } .col-md-offset-7 { margin-left: 58.33333% } .col-md-offset-8 { margin-left: 66.66667% } .col-md-offset-9 { margin-left: 75% } .col-md-offset-10 { margin-left: 83.33333% } .col-md-offset-11 { margin-left: 91.66667% } .col-md-offset-12 { margin-left: 100% } } @media (min-width: 1200px) { .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12 { float: left } .col-lg-1 { width: 8.33333% } .col-lg-2 { width: 16.66667% } .col-lg-3 { width: 25% } .col-lg-4 { width: 33.33333% } .col-lg-5 { width: 41.66667% } .col-lg-6 { width: 50% } .col-lg-7 { width: 58.33333% } .col-lg-8 { width: 66.66667% } .col-lg-9 { width: 75% } .col-lg-10 { width: 83.33333% } .col-lg-11 { width: 91.66667% } .col-lg-12 { width: 100% } .col-lg-pull-0 { right: auto } .col-lg-pull-1 { right: 8.33333% } .col-lg-pull-2 { right: 16.66667% } .col-lg-pull-3 { right: 25% } .col-lg-pull-4 { right: 33.33333% } .col-lg-pull-5 { right: 41.66667% } .col-lg-pull-6 { right: 50% } .col-lg-pull-7 { right: 58.33333% } .col-lg-pull-8 { right: 66.66667% } .col-lg-pull-9 { right: 75% } .col-lg-pull-10 { right: 83.33333% } .col-lg-pull-11 { right: 91.66667% } .col-lg-pull-12 { right: 100% } .col-lg-push-0 { left: auto } .col-lg-push-1 { left: 8.33333% } .col-lg-push-2 { left: 16.66667% } .col-lg-push-3 { left: 25% } .col-lg-push-4 { left: 33.33333% } .col-lg-push-5 { left: 41.66667% } .col-lg-push-6 { left: 50% } .col-lg-push-7 { left: 58.33333% } .col-lg-push-8 { left: 66.66667% } .col-lg-push-9 { left: 75% } .col-lg-push-10 { left: 83.33333% } .col-lg-push-11 { left: 91.66667% } .col-lg-push-12 { left: 100% } .col-lg-offset-0 { margin-left: 0 } .col-lg-offset-1 { margin-left: 8.33333% } .col-lg-offset-2 { margin-left: 16.66667% } .col-lg-offset-3 { margin-left: 25% } .col-lg-offset-4 { margin-left: 33.33333% } .col-lg-offset-5 { margin-left: 41.66667% } .col-lg-offset-6 { margin-left: 50% } .col-lg-offset-7 { margin-left: 58.33333% } .col-lg-offset-8 { margin-left: 66.66667% } .col-lg-offset-9 { margin-left: 75% } .col-lg-offset-10 { margin-left: 83.33333% } .col-lg-offset-11 { margin-left: 91.66667% } .col-lg-offset-12 { margin-left: 100% } } table { background-color: transparent } caption { padding-top: 8px; padding-bottom: 8px; color: #777 } caption, th { text-align: left } .table { width: 100%; max-width: 100%; margin-bottom: 22px } .table > tbody > tr > td, .table > tbody > tr > th, .table > tfoot > tr > td, .table > tfoot > tr > th, .table > thead > tr > td, .table > thead > tr > th { padding: 8px; line-height: 1.6; vertical-align: top; border-top: 1px solid #ddd } .table > thead > tr > th { vertical-align: bottom; border-bottom: 2px solid #ddd } .table > caption + thead > tr:first-child > td, .table > caption + thead > tr:first-child > th, .table > colgroup + thead > tr:first-child > td, .table > colgroup + thead > tr:first-child > th, .table > thead:first-child > tr:first-child > td, .table > thead:first-child > tr:first-child > th { border-top: 0 } .table > tbody + tbody { border-top: 2px solid #ddd } .table .table { background-color: #f5f8fa } .table-condensed > tbody > tr > td, .table-condensed > tbody > tr > th, .table-condensed > tfoot > tr > td, .table-condensed > tfoot > tr > th, .table-condensed > thead > tr > td, .table-condensed > thead > tr > th { padding: 5px } .table-bordered, .table-bordered > tbody > tr > td, .table-bordered > tbody > tr > th, .table-bordered > tfoot > tr > td, .table-bordered > tfoot > tr > th, .table-bordered > thead > tr > td, .table-bordered > thead > tr > th { border: 1px solid #ddd } .table-bordered > thead > tr > td, .table-bordered > thead > tr > th { border-bottom-width: 2px } .table-striped > tbody > tr:nth-of-type(odd) { background-color: #f9f9f9 } .table-hover > tbody > tr:hover { background-color: #f5f5f5 } table col[class*=col-] { position: static; float: none; display: table-column } table td[class*=col-], table th[class*=col-] { position: static; float: none; display: table-cell } .table > tbody > tr.active > td, .table > tbody > tr.active > th, .table > tbody > tr > td.active, .table > tbody > tr > th.active, .table > tfoot > tr.active > td, .table > tfoot > tr.active > th, .table > tfoot > tr > td.active, .table > tfoot > tr > th.active, .table > thead > tr.active > td, .table > thead > tr.active > th, .table > thead > tr > td.active, .table > thead > tr > th.active { background-color: #f5f5f5 } .table-hover > tbody > tr.active:hover > td, .table-hover > tbody > tr.active:hover > th, .table-hover > tbody > tr:hover > .active, .table-hover > tbody > tr > td.active:hover, .table-hover > tbody > tr > th.active:hover { background-color: #e8e8e8 } .table > tbody > tr.success > td, .table > tbody > tr.success > th, .table > tbody > tr > td.success, .table > tbody > tr > th.success, .table > tfoot > tr.success > td, .table > tfoot > tr.success > th, .table > tfoot > tr > td.success, .table > tfoot > tr > th.success, .table > thead > tr.success > td, .table > thead > tr.success > th, .table > thead > tr > td.success, .table > thead > tr > th.success { background-color: #dff0d8 } .table-hover > tbody > tr.success:hover > td, .table-hover > tbody > tr.success:hover > th, .table-hover > tbody > tr:hover > .success, .table-hover > tbody > tr > td.success:hover, .table-hover > tbody > tr > th.success:hover { background-color: #d0e9c6 } .table > tbody > tr.info > td, .table > tbody > tr.info > th, .table > tbody > tr > td.info, .table > tbody > tr > th.info, .table > tfoot > tr.info > td, .table > tfoot > tr.info > th, .table > tfoot > tr > td.info, .table > tfoot > tr > th.info, .table > thead > tr.info > td, .table > thead > tr.info > th, .table > thead > tr > td.info, .table > thead > tr > th.info { background-color: #d9edf7 } .table-hover > tbody > tr.info:hover > td, .table-hover > tbody > tr.info:hover > th, .table-hover > tbody > tr:hover > .info, .table-hover > tbody > tr > td.info:hover, .table-hover > tbody > tr > th.info:hover { background-color: #c4e3f3 } .table > tbody > tr.warning > td, .table > tbody > tr.warning > th, .table > tbody > tr > td.warning, .table > tbody > tr > th.warning, .table > tfoot > tr.warning > td, .table > tfoot > tr.warning > th, .table > tfoot > tr > td.warning, .table > tfoot > tr > th.warning, .table > thead > tr.warning > td, .table > thead > tr.warning > th, .table > thead > tr > td.warning, .table > thead > tr > th.warning { background-color: #fcf8e3 } .table-hover > tbody > tr.warning:hover > td, .table-hover > tbody > tr.warning:hover > th, .table-hover > tbody > tr:hover > .warning, .table-hover > tbody > tr > td.warning:hover, .table-hover > tbody > tr > th.warning:hover { background-color: #faf2cc } .table > tbody > tr.danger > td, .table > tbody > tr.danger > th, .table > tbody > tr > td.danger, .table > tbody > tr > th.danger, .table > tfoot > tr.danger > td, .table > tfoot > tr.danger > th, .table > tfoot > tr > td.danger, .table > tfoot > tr > th.danger, .table > thead > tr.danger > td, .table > thead > tr.danger > th, .table > thead > tr > td.danger, .table > thead > tr > th.danger { background-color: #f2dede } .table-hover > tbody > tr.danger:hover > td, .table-hover > tbody > tr.danger:hover > th, .table-hover > tbody > tr:hover > .danger, .table-hover > tbody > tr > td.danger:hover, .table-hover > tbody > tr > th.danger:hover { background-color: #ebcccc } .table-responsive { overflow-x: auto; min-height: .01% } @media screen and (max-width: 767px) { .table-responsive { width: 100%; margin-bottom: 16.5px; overflow-y: hidden; -ms-overflow-style: -ms-autohiding-scrollbar; border: 1px solid #ddd } .table-responsive > .table { margin-bottom: 0 } .table-responsive > .table > tbody > tr > td, .table-responsive > .table > tbody > tr > th, .table-responsive > .table > tfoot > tr > td, .table-responsive > .table > tfoot > tr > th, .table-responsive > .table > thead > tr > td, .table-responsive > .table > thead > tr > th { white-space: nowrap } .table-responsive > .table-bordered { border: 0 } .table-responsive > .table-bordered > tbody > tr > td:first-child, .table-responsive > .table-bordered > tbody > tr > th:first-child, .table-responsive > .table-bordered > tfoot > tr > td:first-child, .table-responsive > .table-bordered > tfoot > tr > th:first-child, .table-responsive > .table-bordered > thead > tr > td:first-child, .table-responsive > .table-bordered > thead > tr > th:first-child { border-left: 0 } .table-responsive > .table-bordered > tbody > tr > td:last-child, .table-responsive > .table-bordered > tbody > tr > th:last-child, .table-responsive > .table-bordered > tfoot > tr > td:last-child, .table-responsive > .table-bordered > tfoot > tr > th:last-child, .table-responsive > .table-bordered > thead > tr > td:last-child, .table-responsive > .table-bordered > thead > tr > th:last-child { border-right: 0 } .table-responsive > .table-bordered > tbody > tr:last-child > td, .table-responsive > .table-bordered > tbody > tr:last-child > th, .table-responsive > .table-bordered > tfoot > tr:last-child > td, .table-responsive > .table-bordered > tfoot > tr:last-child > th { border-bottom: 0 } } fieldset { margin: 0; min-width: 0 } fieldset, legend { padding: 0; border: 0 } legend { display: block; width: 100%; margin-bottom: 22px; font-size: 21px; line-height: inherit; color: #333; border-bottom: 1px solid #e5e5e5 } label { display: inline-block; max-width: 100%; margin-bottom: 5px; font-weight: 700 } input[type=search] { box-sizing: border-box } input[type=checkbox], input[type=radio] { margin: 4px 0 0; margin-top: 1px \9; line-height: normal } input[type=file] { display: block } input[type=range] { display: block; width: 100% } select[multiple], select[size] { height: auto } input[type=checkbox]:focus, input[type=file]:focus, input[type=radio]:focus { outline: 5px auto -webkit-focus-ring-color; outline-offset: -2px } output { padding-top: 7px } .form-control, output { display: block; font-size: 14px; line-height: 1.6; color: #555 } .form-control { width: 100%; height: 36px; padding: 6px 12px; background-color: #fff; background-image: none; border: 1px solid #ccd0d2; border-radius: 4px; box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); -webkit-transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out; transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out } .form-control:focus { border-color: #98cbe8; outline: 0; box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(152, 203, 232, .6) } .form-control::-moz-placeholder { color: #b1b7ba; opacity: 1 } .form-control:-ms-input-placeholder { color: #b1b7ba } .form-control::-webkit-input-placeholder { color: #b1b7ba } .form-control::-ms-expand { border: 0; background-color: transparent } .form-control[disabled], .form-control[readonly], fieldset[disabled] .form-control { background-color: #eee; opacity: 1 } .form-control[disabled], fieldset[disabled] .form-control { cursor: not-allowed } textarea.form-control { height: auto } input[type=search] { -webkit-appearance: none } @media screen and (-webkit-min-device-pixel-ratio: 0) { input[type=date].form-control, input[type=datetime-local].form-control, input[type=month].form-control, input[type=time].form-control { line-height: 36px } .input-group-sm > .input-group-btn > input[type=date].btn, .input-group-sm > .input-group-btn > input[type=datetime-local].btn, .input-group-sm > .input-group-btn > input[type=month].btn, .input-group-sm > .input-group-btn > input[type=time].btn, .input-group-sm > input[type=date].form-control, .input-group-sm > input[type=date].input-group-addon, .input-group-sm > input[type=datetime-local].form-control, .input-group-sm > input[type=datetime-local].input-group-addon, .input-group-sm > input[type=month].form-control, .input-group-sm > input[type=month].input-group-addon, .input-group-sm > input[type=time].form-control, .input-group-sm > input[type=time].input-group-addon, .input-group-sm input[type=date], .input-group-sm input[type=datetime-local], .input-group-sm input[type=month], .input-group-sm input[type=time], input[type=date].input-sm, input[type=datetime-local].input-sm, input[type=month].input-sm, input[type=time].input-sm { line-height: 30px } .input-group-lg > .input-group-btn > input[type=date].btn, .input-group-lg > .input-group-btn > input[type=datetime-local].btn, .input-group-lg > .input-group-btn > input[type=month].btn, .input-group-lg > .input-group-btn > input[type=time].btn, .input-group-lg > input[type=date].form-control, .input-group-lg > input[type=date].input-group-addon, .input-group-lg > input[type=datetime-local].form-control, .input-group-lg > input[type=datetime-local].input-group-addon, .input-group-lg > input[type=month].form-control, .input-group-lg > input[type=month].input-group-addon, .input-group-lg > input[type=time].form-control, .input-group-lg > input[type=time].input-group-addon, .input-group-lg input[type=date], .input-group-lg input[type=datetime-local], .input-group-lg input[type=month], .input-group-lg input[type=time], input[type=date].input-lg, input[type=datetime-local].input-lg, input[type=month].input-lg, input[type=time].input-lg { line-height: 46px } } .form-group { margin-bottom: 15px } .checkbox, .radio { position: relative; display: block; margin-top: 10px; margin-bottom: 10px } .checkbox label, .radio label { min-height: 22px; padding-left: 20px; margin-bottom: 0; font-weight: 400; cursor: pointer } .checkbox-inline input[type=checkbox], .checkbox input[type=checkbox], .radio-inline input[type=radio], .radio input[type=radio] { position: absolute; margin-left: -20px; margin-top: 4px \9 } .checkbox + .checkbox, .radio + .radio { margin-top: -5px } .checkbox-inline, .radio-inline { position: relative; display: inline-block; padding-left: 20px; margin-bottom: 0; vertical-align: middle; font-weight: 400; cursor: pointer } .checkbox-inline + .checkbox-inline, .radio-inline + .radio-inline { margin-top: 0; margin-left: 10px } .checkbox-inline.disabled, .checkbox.disabled label, .radio-inline.disabled, .radio.disabled label, fieldset[disabled] .checkbox-inline, fieldset[disabled] .checkbox label, fieldset[disabled] .radio-inline, fieldset[disabled] .radio label, fieldset[disabled] input[type=checkbox], fieldset[disabled] input[type=radio], input[type=checkbox].disabled, input[type=checkbox][disabled], input[type=radio].disabled, input[type=radio][disabled] { cursor: not-allowed } .form-control-static { padding-top: 7px; padding-bottom: 7px; margin-bottom: 0; min-height: 36px } .form-control-static.input-lg, .form-control-static.input-sm, .input-group-lg > .form-control-static.form-control, .input-group-lg > .form-control-static.input-group-addon, .input-group-lg > .input-group-btn > .form-control-static.btn, .input-group-sm > .form-control-static.form-control, .input-group-sm > .form-control-static.input-group-addon, .input-group-sm > .input-group-btn > .form-control-static.btn { padding-left: 0; padding-right: 0 } .input-group-sm > .form-control, .input-group-sm > .input-group-addon, .input-group-sm > .input-group-btn > .btn, .input-sm { height: 30px; padding: 5px 10px; font-size: 12px; line-height: 1.5; border-radius: 3px } .input-group-sm > .input-group-btn > select.btn, .input-group-sm > select.form-control, .input-group-sm > select.input-group-addon, select.input-sm { height: 30px; line-height: 30px } .input-group-sm > .input-group-btn > select[multiple].btn, .input-group-sm > .input-group-btn > textarea.btn, .input-group-sm > select[multiple].form-control, .input-group-sm > select[multiple].input-group-addon, .input-group-sm > textarea.form-control, .input-group-sm > textarea.input-group-addon, select[multiple].input-sm, textarea.input-sm { height: auto } .form-group-sm .form-control { height: 30px; padding: 5px 10px; font-size: 12px; line-height: 1.5; border-radius: 3px } .form-group-sm select.form-control { height: 30px; line-height: 30px } .form-group-sm select[multiple].form-control, .form-group-sm textarea.form-control { height: auto } .form-group-sm .form-control-static { height: 30px; min-height: 34px; padding: 6px 10px; font-size: 12px; line-height: 1.5 } .input-group-lg > .form-control, .input-group-lg > .input-group-addon, .input-group-lg > .input-group-btn > .btn, .input-lg { height: 46px; padding: 10px 16px; font-size: 18px; line-height: 1.33333; border-radius: 6px } .input-group-lg > .input-group-btn > select.btn, .input-group-lg > select.form-control, .input-group-lg > select.input-group-addon, select.input-lg { height: 46px; line-height: 46px } .input-group-lg > .input-group-btn > select[multiple].btn, .input-group-lg > .input-group-btn > textarea.btn, .input-group-lg > select[multiple].form-control, .input-group-lg > select[multiple].input-group-addon, .input-group-lg > textarea.form-control, .input-group-lg > textarea.input-group-addon, select[multiple].input-lg, textarea.input-lg { height: auto } .form-group-lg .form-control { height: 46px; padding: 10px 16px; font-size: 18px; line-height: 1.33333; border-radius: 6px } .form-group-lg select.form-control { height: 46px; line-height: 46px } .form-group-lg select[multiple].form-control, .form-group-lg textarea.form-control { height: auto } .form-group-lg .form-control-static { height: 46px; min-height: 40px; padding: 11px 16px; font-size: 18px; line-height: 1.33333 } .has-feedback { position: relative } .has-feedback .form-control { padding-right: 45px } .form-control-feedback { position: absolute; top: 0; right: 0; z-index: 2; display: block; width: 36px; height: 36px; line-height: 36px; text-align: center; pointer-events: none } .form-group-lg .form-control + .form-control-feedback, .input-group-lg + .form-control-feedback, .input-group-lg > .form-control + .form-control-feedback, .input-group-lg > .input-group-addon + .form-control-feedback, .input-group-lg > .input-group-btn > .btn + .form-control-feedback, .input-lg + .form-control-feedback { width: 46px; height: 46px; line-height: 46px } .form-group-sm .form-control + .form-control-feedback, .input-group-sm + .form-control-feedback, .input-group-sm > .form-control + .form-control-feedback, .input-group-sm > .input-group-addon + .form-control-feedback, .input-group-sm > .input-group-btn > .btn + .form-control-feedback, .input-sm + .form-control-feedback { width: 30px; height: 30px; line-height: 30px } .has-success .checkbox, .has-success .checkbox-inline, .has-success.checkbox-inline label, .has-success.checkbox label, .has-success .control-label, .has-success .help-block, .has-success .radio, .has-success .radio-inline, .has-success.radio-inline label, .has-success.radio label { color: #3c763d } .has-success .form-control { border-color: #3c763d; box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075) } .has-success .form-control:focus { border-color: #2b542c; box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #67b168 } .has-success .input-group-addon { color: #3c763d; border-color: #3c763d; background-color: #dff0d8 } .has-success .form-control-feedback { color: #3c763d } .has-warning .checkbox, .has-warning .checkbox-inline, .has-warning.checkbox-inline label, .has-warning.checkbox label, .has-warning .control-label, .has-warning .help-block, .has-warning .radio, .has-warning .radio-inline, .has-warning.radio-inline label, .has-warning.radio label { color: #8a6d3b } .has-warning .form-control { border-color: #8a6d3b; box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075) } .has-warning .form-control:focus { border-color: #66512c; box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #c0a16b } .has-warning .input-group-addon { color: #8a6d3b; border-color: #8a6d3b; background-color: #fcf8e3 } .has-warning .form-control-feedback { color: #8a6d3b } .has-error .checkbox, .has-error .checkbox-inline, .has-error.checkbox-inline label, .has-error.checkbox label, .has-error .control-label, .has-error .help-block, .has-error .radio, .has-error .radio-inline, .has-error.radio-inline label, .has-error.radio label { color: #a94442 } .has-error .form-control { border-color: #a94442; box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075) } .has-error .form-control:focus { border-color: #843534; box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #ce8483 } .has-error .input-group-addon { color: #a94442; border-color: #a94442; background-color: #f2dede } .has-error .form-control-feedback { color: #a94442 } .has-feedback label ~ .form-control-feedback { top: 27px } .has-feedback label.sr-only ~ .form-control-feedback { top: 0 } .help-block { display: block; margin-top: 5px; margin-bottom: 10px; color: #a4aaae } @media (min-width: 768px) { .form-inline .form-group { display: inline-block; margin-bottom: 0; vertical-align: middle } .form-inline .form-control { display: inline-block; width: auto; vertical-align: middle } .form-inline .form-control-static { display: inline-block } .form-inline .input-group { display: inline-table; vertical-align: middle } .form-inline .input-group .form-control, .form-inline .input-group .input-group-addon, .form-inline .input-group .input-group-btn { width: auto } .form-inline .input-group > .form-control { width: 100% } .form-inline .control-label { margin-bottom: 0; vertical-align: middle } .form-inline .checkbox, .form-inline .radio { display: inline-block; margin-top: 0; margin-bottom: 0; vertical-align: middle } .form-inline .checkbox label, .form-inline .radio label { padding-left: 0 } .form-inline .checkbox input[type=checkbox], .form-inline .radio input[type=radio] { position: relative; margin-left: 0 } .form-inline .has-feedback .form-control-feedback { top: 0 } } .form-horizontal .checkbox, .form-horizontal .checkbox-inline, .form-horizontal .radio, .form-horizontal .radio-inline { margin-top: 0; margin-bottom: 0; padding-top: 7px } .form-horizontal .checkbox, .form-horizontal .radio { min-height: 29px } .form-horizontal .form-group { margin-left: -15px; margin-right: -15px } .form-horizontal .form-group:after, .form-horizontal .form-group:before { content: " "; display: table } .form-horizontal .form-group:after { clear: both } @media (min-width: 768px) { .form-horizontal .control-label { text-align: right; margin-bottom: 0; padding-top: 7px } } .form-horizontal .has-feedback .form-control-feedback { right: 15px } @media (min-width: 768px) { .form-horizontal .form-group-lg .control-label { padding-top: 11px; font-size: 18px } } @media (min-width: 768px) { .form-horizontal .form-group-sm .control-label { padding-top: 6px; font-size: 12px } } .btn { display: inline-block; margin-bottom: 0; font-weight: 400; text-align: center; vertical-align: middle; -ms-touch-action: manipulation; touch-action: manipulation; cursor: pointer; background-image: none; border: 1px solid transparent; white-space: nowrap; padding: 6px 12px; font-size: 14px; line-height: 1.6; border-radius: 4px; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none } .btn.active.focus, .btn.active:focus, .btn.focus, .btn:active.focus, .btn:active:focus, .btn:focus { outline: 5px auto -webkit-focus-ring-color; outline-offset: -2px } .btn.focus, .btn:focus, .btn:hover { color: #636b6f; text-decoration: none } .btn.active, .btn:active { outline: 0; background-image: none; box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125) } .btn.disabled, .btn[disabled], fieldset[disabled] .btn { cursor: not-allowed; opacity: .65; filter: alpha(opacity=65); box-shadow: none } a.btn.disabled, fieldset[disabled] a.btn { pointer-events: none } .btn-default { color: #636b6f; background-color: #fff; border-color: #ccc } .btn-default.focus, .btn-default:focus { color: #636b6f; background-color: #e6e6e6; border-color: #8c8c8c } .btn-default.active, .btn-default:active, .btn-default:hover, .open > .btn-default.dropdown-toggle { color: #636b6f; background-color: #e6e6e6; border-color: #adadad } .btn-default.active.focus, .btn-default.active:focus, .btn-default.active:hover, .btn-default:active.focus, .btn-default:active:focus, .btn-default:active:hover, .open > .btn-default.dropdown-toggle.focus, .open > .btn-default.dropdown-toggle:focus, .open > .btn-default.dropdown-toggle:hover { color: #636b6f; background-color: #d4d4d4; border-color: #8c8c8c } .btn-default.active, .btn-default:active, .open > .btn-default.dropdown-toggle { background-image: none } .btn-default.disabled.focus, .btn-default.disabled:focus, .btn-default.disabled:hover, .btn-default[disabled].focus, .btn-default[disabled]:focus, .btn-default[disabled]:hover, fieldset[disabled] .btn-default.focus, fieldset[disabled] .btn-default:focus, fieldset[disabled] .btn-default:hover { background-color: #fff; border-color: #ccc } .btn-default .badge { color: #fff; background-color: #636b6f } .btn-primary { color: #fff; background-color: #3097d1; border-color: #2a88bd } .btn-primary.focus, .btn-primary:focus { color: #fff; background-color: #2579a9; border-color: #133d55 } .btn-primary.active, .btn-primary:active, .btn-primary:hover, .open > .btn-primary.dropdown-toggle { color: #fff; background-color: #2579a9; border-color: #1f648b } .btn-primary.active.focus, .btn-primary.active:focus, .btn-primary.active:hover, .btn-primary:active.focus, .btn-primary:active:focus, .btn-primary:active:hover, .open > .btn-primary.dropdown-toggle.focus, .open > .btn-primary.dropdown-toggle:focus, .open > .btn-primary.dropdown-toggle:hover { color: #fff; background-color: #1f648b; border-color: #133d55 } .btn-primary.active, .btn-primary:active, .open > .btn-primary.dropdown-toggle { background-image: none } .btn-primary.disabled.focus, .btn-primary.disabled:focus, .btn-primary.disabled:hover, .btn-primary[disabled].focus, .btn-primary[disabled]:focus, .btn-primary[disabled]:hover, fieldset[disabled] .btn-primary.focus, fieldset[disabled] .btn-primary:focus, fieldset[disabled] .btn-primary:hover { background-color: #3097d1; border-color: #2a88bd } .btn-primary .badge { color: #3097d1; background-color: #fff } .btn-success { color: #fff; background-color: #2ab27b; border-color: #259d6d } .btn-success.focus, .btn-success:focus { color: #fff; background-color: #20895e; border-color: #0d3625 } .btn-success.active, .btn-success:active, .btn-success:hover, .open > .btn-success.dropdown-toggle { color: #fff; background-color: #20895e; border-color: #196c4b } .btn-success.active.focus, .btn-success.active:focus, .btn-success.active:hover, .btn-success:active.focus, .btn-success:active:focus, .btn-success:active:hover, .open > .btn-success.dropdown-toggle.focus, .open > .btn-success.dropdown-toggle:focus, .open > .btn-success.dropdown-toggle:hover { color: #fff; background-color: #196c4b; border-color: #0d3625 } .btn-success.active, .btn-success:active, .open > .btn-success.dropdown-toggle { background-image: none } .btn-success.disabled.focus, .btn-success.disabled:focus, .btn-success.disabled:hover, .btn-success[disabled].focus, .btn-success[disabled]:focus, .btn-success[disabled]:hover, fieldset[disabled] .btn-success.focus, fieldset[disabled] .btn-success:focus, fieldset[disabled] .btn-success:hover { background-color: #2ab27b; border-color: #259d6d } .btn-success .badge { color: #2ab27b; background-color: #fff } .btn-info { color: #fff; background-color: #8eb4cb; border-color: #7da8c3 } .btn-info.focus, .btn-info:focus { color: #fff; background-color: #6b9dbb; border-color: #3d6983 } .btn-info.active, .btn-info:active, .btn-info:hover, .open > .btn-info.dropdown-toggle { color: #fff; background-color: #6b9dbb; border-color: #538db0 } .btn-info.active.focus, .btn-info.active:focus, .btn-info.active:hover, .btn-info:active.focus, .btn-info:active:focus, .btn-info:active:hover, .open > .btn-info.dropdown-toggle.focus, .open > .btn-info.dropdown-toggle:focus, .open > .btn-info.dropdown-toggle:hover { color: #fff; background-color: #538db0; border-color: #3d6983 } .btn-info.active, .btn-info:active, .open > .btn-info.dropdown-toggle { background-image: none } .btn-info.disabled.focus, .btn-info.disabled:focus, .btn-info.disabled:hover, .btn-info[disabled].focus, .btn-info[disabled]:focus, .btn-info[disabled]:hover, fieldset[disabled] .btn-info.focus, fieldset[disabled] .btn-info:focus, fieldset[disabled] .btn-info:hover { background-color: #8eb4cb; border-color: #7da8c3 } .btn-info .badge { color: #8eb4cb; background-color: #fff } .btn-warning { color: #fff; background-color: #cbb956; border-color: #c5b143 } .btn-warning.focus, .btn-warning:focus { color: #fff; background-color: #b6a338; border-color: #685d20 } .btn-warning.active, .btn-warning:active, .btn-warning:hover, .open > .btn-warning.dropdown-toggle { color: #fff; background-color: #b6a338; border-color: #9b8a30 } .btn-warning.active.focus, .btn-warning.active:focus, .btn-warning.active:hover, .btn-warning:active.focus, .btn-warning:active:focus, .btn-warning:active:hover, .open > .btn-warning.dropdown-toggle.focus, .open > .btn-warning.dropdown-toggle:focus, .open > .btn-warning.dropdown-toggle:hover { color: #fff; background-color: #9b8a30; border-color: #685d20 } .btn-warning.active, .btn-warning:active, .open > .btn-warning.dropdown-toggle { background-image: none } .btn-warning.disabled.focus, .btn-warning.disabled:focus, .btn-warning.disabled:hover, .btn-warning[disabled].focus, .btn-warning[disabled]:focus, .btn-warning[disabled]:hover, fieldset[disabled] .btn-warning.focus, fieldset[disabled] .btn-warning:focus, fieldset[disabled] .btn-warning:hover { background-color: #cbb956; border-color: #c5b143 } .btn-warning .badge { color: #cbb956; background-color: #fff } .btn-danger { color: #fff; background-color: #bf5329; border-color: #aa4a24 } .btn-danger.focus, .btn-danger:focus { color: #fff; background-color: #954120; border-color: #411c0e } .btn-danger.active, .btn-danger:active, .btn-danger:hover, .open > .btn-danger.dropdown-toggle { color: #fff; background-color: #954120; border-color: #78341a } .btn-danger.active.focus, .btn-danger.active:focus, .btn-danger.active:hover, .btn-danger:active.focus, .btn-danger:active:focus, .btn-danger:active:hover, .open > .btn-danger.dropdown-toggle.focus, .open > .btn-danger.dropdown-toggle:focus, .open > .btn-danger.dropdown-toggle:hover { color: #fff; background-color: #78341a; border-color: #411c0e } .btn-danger.active, .btn-danger:active, .open > .btn-danger.dropdown-toggle { background-image: none } .btn-danger.disabled.focus, .btn-danger.disabled:focus, .btn-danger.disabled:hover, .btn-danger[disabled].focus, .btn-danger[disabled]:focus, .btn-danger[disabled]:hover, fieldset[disabled] .btn-danger.focus, fieldset[disabled] .btn-danger:focus, fieldset[disabled] .btn-danger:hover { background-color: #bf5329; border-color: #aa4a24 } .btn-danger .badge { color: #bf5329; background-color: #fff } .btn-link { color: #3097d1; font-weight: 400; border-radius: 0 } .btn-link, .btn-link.active, .btn-link:active, .btn-link[disabled], fieldset[disabled] .btn-link { background-color: transparent; box-shadow: none } .btn-link, .btn-link:active, .btn-link:focus, .btn-link:hover { border-color: transparent } .btn-link:focus, .btn-link:hover { color: #216a94; text-decoration: underline; background-color: transparent } .btn-link[disabled]:focus, .btn-link[disabled]:hover, fieldset[disabled] .btn-link:focus, fieldset[disabled] .btn-link:hover { color: #777; text-decoration: none } .btn-group-lg > .btn, .btn-lg { padding: 10px 16px; font-size: 18px; line-height: 1.33333; border-radius: 6px } .btn-group-sm > .btn, .btn-sm { padding: 5px 10px; font-size: 12px; line-height: 1.5; border-radius: 3px } .btn-group-xs > .btn, .btn-xs { padding: 1px 5px; font-size: 12px; line-height: 1.5; border-radius: 3px } .btn-block { display: block; width: 100% } .btn-block + .btn-block { margin-top: 5px } input[type=button].btn-block, input[type=reset].btn-block, input[type=submit].btn-block { width: 100% } .fade { opacity: 0; -webkit-transition: opacity .15s linear; transition: opacity .15s linear } .fade.in { opacity: 1 } .collapse { display: none } .collapse.in { display: block } tr.collapse.in { display: table-row } tbody.collapse.in { display: table-row-group } .collapsing { position: relative; height: 0; overflow: hidden; -webkit-transition-property: height, visibility; transition-property: height, visibility; -webkit-transition-duration: .35s; transition-duration: .35s; -webkit-transition-timing-function: ease; transition-timing-function: ease } .caret { display: inline-block; width: 0; height: 0; margin-left: 2px; vertical-align: middle; border-top: 4px dashed; border-top: 4px solid \9; border-right: 4px solid transparent; border-left: 4px solid transparent } .dropdown, .dropup { position: relative } .dropdown-toggle:focus { outline: 0 } .dropdown-menu { position: absolute; top: 100%; left: 0; z-index: 1000; display: none; float: left; min-width: 160px; padding: 5px 0; margin: 2px 0 0; list-style: none; font-size: 14px; text-align: left; background-color: #fff; border: 1px solid #ccc; border: 1px solid rgba(0, 0, 0, .15); border-radius: 4px; box-shadow: 0 6px 12px rgba(0, 0, 0, .175); background-clip: padding-box } .dropdown-menu.pull-right { right: 0; left: auto } .dropdown-menu .divider { height: 1px; margin: 10px 0; overflow: hidden; background-color: #e5e5e5 } .dropdown-menu > li > a { display: block; padding: 3px 20px; clear: both; font-weight: 400; line-height: 1.6; color: #333; white-space: nowrap } .dropdown-menu > li > a:focus, .dropdown-menu > li > a:hover { text-decoration: none; color: #262626; background-color: #f5f5f5 } .dropdown-menu > .active > a, .dropdown-menu > .active > a:focus, .dropdown-menu > .active > a:hover { color: #fff; text-decoration: none; outline: 0; background-color: #3097d1 } .dropdown-menu > .disabled > a, .dropdown-menu > .disabled > a:focus, .dropdown-menu > .disabled > a:hover { color: #777 } .dropdown-menu > .disabled > a:focus, .dropdown-menu > .disabled > a:hover { text-decoration: none; background-color: transparent; background-image: none; filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); cursor: not-allowed } .open > .dropdown-menu { display: block } .open > a { outline: 0 } .dropdown-menu-right { left: auto; right: 0 } .dropdown-menu-left { left: 0; right: auto } .dropdown-header { display: block; padding: 3px 20px; font-size: 12px; line-height: 1.6; color: #777; white-space: nowrap } .dropdown-backdrop { position: fixed; left: 0; right: 0; bottom: 0; top: 0; z-index: 990 } .pull-right > .dropdown-menu { right: 0; left: auto } .dropup .caret, .navbar-fixed-bottom .dropdown .caret { border-top: 0; border-bottom: 4px dashed; border-bottom: 4px solid \9; content: "" } .dropup .dropdown-menu, .navbar-fixed-bottom .dropdown .dropdown-menu { top: auto; bottom: 100%; margin-bottom: 2px } @media (min-width: 768px) { .navbar-right .dropdown-menu { right: 0; left: auto } .navbar-right .dropdown-menu-left { left: 0; right: auto } } .btn-group, .btn-group-vertical { position: relative; display: inline-block; vertical-align: middle } .btn-group-vertical > .btn, .btn-group > .btn { position: relative; float: left } .btn-group-vertical > .btn.active, .btn-group-vertical > .btn:active, .btn-group-vertical > .btn:focus, .btn-group-vertical > .btn:hover, .btn-group > .btn.active, .btn-group > .btn:active, .btn-group > .btn:focus, .btn-group > .btn:hover { z-index: 2 } .btn-group .btn + .btn, .btn-group .btn + .btn-group, .btn-group .btn-group + .btn, .btn-group .btn-group + .btn-group { margin-left: -1px } .btn-toolbar { margin-left: -5px } .btn-toolbar:after, .btn-toolbar:before { content: " "; display: table } .btn-toolbar:after { clear: both } .btn-toolbar .btn, .btn-toolbar .btn-group, .btn-toolbar .input-group { float: left } .btn-toolbar > .btn, .btn-toolbar > .btn-group, .btn-toolbar > .input-group { margin-left: 5px } .btn-group > .btn:not(:first-child):not(:last-child):not(.dropdown-toggle) { border-radius: 0 } .btn-group > .btn:first-child { margin-left: 0 } .btn-group > .btn:first-child:not(:last-child):not(.dropdown-toggle) { border-bottom-right-radius: 0; border-top-right-radius: 0 } .btn-group > .btn:last-child:not(:first-child), .btn-group > .dropdown-toggle:not(:first-child) { border-bottom-left-radius: 0; border-top-left-radius: 0 } .btn-group > .btn-group { float: left } .btn-group > .btn-group:not(:first-child):not(:last-child) > .btn { border-radius: 0 } .btn-group > .btn-group:first-child:not(:last-child) > .btn:last-child, .btn-group > .btn-group:first-child:not(:last-child) > .dropdown-toggle { border-bottom-right-radius: 0; border-top-right-radius: 0 } .btn-group > .btn-group:last-child:not(:first-child) > .btn:first-child { border-bottom-left-radius: 0; border-top-left-radius: 0 } .btn-group .dropdown-toggle:active, .btn-group.open .dropdown-toggle { outline: 0 } .btn-group > .btn + .dropdown-toggle { padding-left: 8px; padding-right: 8px } .btn-group-lg.btn-group > .btn + .dropdown-toggle, .btn-group > .btn-lg + .dropdown-toggle { padding-left: 12px; padding-right: 12px } .btn-group.open .dropdown-toggle { box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125) } .btn-group.open .dropdown-toggle.btn-link { box-shadow: none } .btn .caret { margin-left: 0 } .btn-group-lg > .btn .caret, .btn-lg .caret { border-width: 5px 5px 0; border-bottom-width: 0 } .dropup .btn-group-lg > .btn .caret, .dropup .btn-lg .caret { border-width: 0 5px 5px } .btn-group-vertical > .btn, .btn-group-vertical > .btn-group, .btn-group-vertical > .btn-group > .btn { display: block; float: none; width: 100%; max-width: 100% } .btn-group-vertical > .btn-group:after, .btn-group-vertical > .btn-group:before { content: " "; display: table } .btn-group-vertical > .btn-group:after { clear: both } .btn-group-vertical > .btn-group > .btn { float: none } .btn-group-vertical > .btn + .btn, .btn-group-vertical > .btn + .btn-group, .btn-group-vertical > .btn-group + .btn, .btn-group-vertical > .btn-group + .btn-group { margin-top: -1px; margin-left: 0 } .btn-group-vertical > .btn:not(:first-child):not(:last-child) { border-radius: 0 } .btn-group-vertical > .btn:first-child:not(:last-child) { border-top-right-radius: 4px; border-top-left-radius: 4px; border-bottom-right-radius: 0; border-bottom-left-radius: 0 } .btn-group-vertical > .btn:last-child:not(:first-child) { border-top-right-radius: 0; border-top-left-radius: 0; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px } .btn-group-vertical > .btn-group:not(:first-child):not(:last-child) > .btn { border-radius: 0 } .btn-group-vertical > .btn-group:first-child:not(:last-child) > .btn:last-child, .btn-group-vertical > .btn-group:first-child:not(:last-child) > .dropdown-toggle { border-bottom-right-radius: 0; border-bottom-left-radius: 0 } .btn-group-vertical > .btn-group:last-child:not(:first-child) > .btn:first-child { border-top-right-radius: 0; border-top-left-radius: 0 } .btn-group-justified { display: table; width: 100%; table-layout: fixed; border-collapse: separate } .btn-group-justified > .btn, .btn-group-justified > .btn-group { float: none; display: table-cell; width: 1% } .btn-group-justified > .btn-group .btn { width: 100% } .btn-group-justified > .btn-group .dropdown-menu { left: auto } [data-toggle=buttons] > .btn-group > .btn input[type=checkbox], [data-toggle=buttons] > .btn-group > .btn input[type=radio], [data-toggle=buttons] > .btn input[type=checkbox], [data-toggle=buttons] > .btn input[type=radio] { position: absolute; clip: rect(0, 0, 0, 0); pointer-events: none } .input-group { position: relative; display: table; border-collapse: separate } .input-group[class*=col-] { float: none; padding-left: 0; padding-right: 0 } .input-group .form-control { position: relative; z-index: 2; float: left; width: 100%; margin-bottom: 0 } .input-group .form-control:focus { z-index: 3 } .input-group-addon, .input-group-btn, .input-group .form-control { display: table-cell } .input-group-addon:not(:first-child):not(:last-child), .input-group-btn:not(:first-child):not(:last-child), .input-group .form-control:not(:first-child):not(:last-child) { border-radius: 0 } .input-group-addon, .input-group-btn { width: 1%; white-space: nowrap; vertical-align: middle } .input-group-addon { padding: 6px 12px; font-size: 14px; font-weight: 400; line-height: 1; color: #555; text-align: center; background-color: #eee; border: 1px solid #ccd0d2; border-radius: 4px } .input-group-addon.input-sm, .input-group-sm > .input-group-addon, .input-group-sm > .input-group-btn > .input-group-addon.btn { padding: 5px 10px; font-size: 12px; border-radius: 3px } .input-group-addon.input-lg, .input-group-lg > .input-group-addon, .input-group-lg > .input-group-btn > .input-group-addon.btn { padding: 10px 16px; font-size: 18px; border-radius: 6px } .input-group-addon input[type=checkbox], .input-group-addon input[type=radio] { margin-top: 0 } .input-group-addon:first-child, .input-group-btn:first-child > .btn, .input-group-btn:first-child > .btn-group > .btn, .input-group-btn:first-child > .dropdown-toggle, .input-group-btn:last-child > .btn-group:not(:last-child) > .btn, .input-group-btn:last-child > .btn:not(:last-child):not(.dropdown-toggle), .input-group .form-control:first-child { border-bottom-right-radius: 0; border-top-right-radius: 0 } .input-group-addon:first-child { border-right: 0 } .input-group-addon:last-child, .input-group-btn:first-child > .btn-group:not(:first-child) > .btn, .input-group-btn:first-child > .btn:not(:first-child), .input-group-btn:last-child > .btn, .input-group-btn:last-child > .btn-group > .btn, .input-group-btn:last-child > .dropdown-toggle, .input-group .form-control:last-child { border-bottom-left-radius: 0; border-top-left-radius: 0 } .input-group-addon:last-child { border-left: 0 } .input-group-btn { font-size: 0; white-space: nowrap } .input-group-btn, .input-group-btn > .btn { position: relative } .input-group-btn > .btn + .btn { margin-left: -1px } .input-group-btn > .btn:active, .input-group-btn > .btn:focus, .input-group-btn > .btn:hover { z-index: 2 } .input-group-btn:first-child > .btn, .input-group-btn:first-child > .btn-group { margin-right: -1px } .input-group-btn:last-child > .btn, .input-group-btn:last-child > .btn-group { z-index: 2; margin-left: -1px } .nav { margin-bottom: 0; padding-left: 0; list-style: none } .nav:after, .nav:before { content: " "; display: table } .nav:after { clear: both } .nav > li, .nav > li > a { position: relative; display: block } .nav > li > a { padding: 10px 15px } .nav > li > a:focus, .nav > li > a:hover { text-decoration: none; background-color: #eee } .nav > li.disabled > a { color: #777 } .nav > li.disabled > a:focus, .nav > li.disabled > a:hover { color: #777; text-decoration: none; background-color: transparent; cursor: not-allowed } .nav .open > a, .nav .open > a:focus, .nav .open > a:hover { background-color: #eee; border-color: #3097d1 } .nav .nav-divider { height: 1px; margin: 10px 0; overflow: hidden; background-color: #e5e5e5 } .nav > li > a > img { max-width: none } .nav-tabs { border-bottom: 1px solid #ddd } .nav-tabs > li { float: left; margin-bottom: -1px } .nav-tabs > li > a { margin-right: 2px; line-height: 1.6; border: 1px solid transparent; border-radius: 4px 4px 0 0 } .nav-tabs > li > a:hover { border-color: #eee #eee #ddd } .nav-tabs > li.active > a, .nav-tabs > li.active > a:focus, .nav-tabs > li.active > a:hover { color: #555; background-color: #f5f8fa; border: 1px solid #ddd; border-bottom-color: transparent; cursor: default } .nav-pills > li { float: left } .nav-pills > li > a { border-radius: 4px } .nav-pills > li + li { margin-left: 2px } .nav-pills > li.active > a, .nav-pills > li.active > a:focus, .nav-pills > li.active > a:hover { color: #fff; background-color: #3097d1 } .nav-stacked > li { float: none } .nav-stacked > li + li { margin-top: 2px; margin-left: 0 } .nav-justified, .nav-tabs.nav-justified { width: 100% } .nav-justified > li, .nav-tabs.nav-justified > li { float: none } .nav-justified > li > a, .nav-tabs.nav-justified > li > a { text-align: center; margin-bottom: 5px } .nav-justified > .dropdown .dropdown-menu { top: auto; left: auto } @media (min-width: 768px) { .nav-justified > li, .nav-tabs.nav-justified > li { display: table-cell; width: 1% } .nav-justified > li > a, .nav-tabs.nav-justified > li > a { margin-bottom: 0 } } .nav-tabs-justified, .nav-tabs.nav-justified { border-bottom: 0 } .nav-tabs-justified > li > a, .nav-tabs.nav-justified > li > a { margin-right: 0; border-radius: 4px } .nav-tabs-justified > .active > a, .nav-tabs-justified > .active > a:focus, .nav-tabs-justified > .active > a:hover, .nav-tabs.nav-justified > .active > a, .nav-tabs.nav-justified > .active > a:focus, .nav-tabs.nav-justified > .active > a:hover { border: 1px solid #ddd } @media (min-width: 768px) { .nav-tabs-justified > li > a, .nav-tabs.nav-justified > li > a { border-bottom: 1px solid #ddd; border-radius: 4px 4px 0 0 } .nav-tabs-justified > .active > a, .nav-tabs-justified > .active > a:focus, .nav-tabs-justified > .active > a:hover, .nav-tabs.nav-justified > .active > a, .nav-tabs.nav-justified > .active > a:focus, .nav-tabs.nav-justified > .active > a:hover { border-bottom-color: #f5f8fa } } .tab-content > .tab-pane { display: none } .tab-content > .active { display: block } .nav-tabs .dropdown-menu { margin-top: -1px; border-top-right-radius: 0; border-top-left-radius: 0 } .navbar { position: relative; min-height: 50px; margin-bottom: 22px; border: 1px solid transparent } .navbar:after, .navbar:before { content: " "; display: table } .navbar:after { clear: both } @media (min-width: 768px) { .navbar { border-radius: 4px } } .navbar-header:after, .navbar-header:before { content: " "; display: table } .navbar-header:after { clear: both } @media (min-width: 768px) { .navbar-header { float: left } } .navbar-collapse { overflow-x: visible; padding-right: 15px; padding-left: 15px; border-top: 1px solid transparent; box-shadow: inset 0 1px 0 hsla(0, 0%, 100%, .1); -webkit-overflow-scrolling: touch } .navbar-collapse:after, .navbar-collapse:before { content: " "; display: table } .navbar-collapse:after { clear: both } .navbar-collapse.in { overflow-y: auto } @media (min-width: 768px) { .navbar-collapse { width: auto; border-top: 0; box-shadow: none } .navbar-collapse.collapse { display: block !important; height: auto !important; padding-bottom: 0; overflow: visible !important } .navbar-collapse.in { overflow-y: visible } .navbar-fixed-bottom .navbar-collapse, .navbar-fixed-top .navbar-collapse, .navbar-static-top .navbar-collapse { padding-left: 0; padding-right: 0 } } .navbar-fixed-bottom .navbar-collapse, .navbar-fixed-top .navbar-collapse { max-height: 340px } @media (max-device-width: 480px) and (orientation: landscape) { .navbar-fixed-bottom .navbar-collapse, .navbar-fixed-top .navbar-collapse { max-height: 200px } } .container-fluid > .navbar-collapse, .container-fluid > .navbar-header, .container > .navbar-collapse, .container > .navbar-header { margin-right: -15px; margin-left: -15px } @media (min-width: 768px) { .container-fluid > .navbar-collapse, .container-fluid > .navbar-header, .container > .navbar-collapse, .container > .navbar-header { margin-right: 0; margin-left: 0 } } .navbar-static-top { z-index: 1000; border-width: 0 0 1px } @media (min-width: 768px) { .navbar-static-top { border-radius: 0 } } .navbar-fixed-bottom, .navbar-fixed-top { position: fixed; right: 0; left: 0; z-index: 1030 } @media (min-width: 768px) { .navbar-fixed-bottom, .navbar-fixed-top { border-radius: 0 } } .navbar-fixed-top { top: 0; border-width: 0 0 1px } .navbar-fixed-bottom { bottom: 0; margin-bottom: 0; border-width: 1px 0 0 } .navbar-brand { float: left; padding: 14px 15px; font-size: 18px; line-height: 22px; height: 50px } .navbar-brand:focus, .navbar-brand:hover { text-decoration: none } .navbar-brand > img { display: block } @media (min-width: 768px) { .navbar > .container-fluid .navbar-brand, .navbar > .container .navbar-brand { margin-left: -15px } } .navbar-toggle { position: relative; float: right; margin-right: 15px; padding: 9px 10px; margin-top: 8px; margin-bottom: 8px; background-color: transparent; background-image: none; border: 1px solid transparent; border-radius: 4px } .navbar-toggle:focus { outline: 0 } .navbar-toggle .icon-bar { display: block; width: 22px; height: 2px; border-radius: 1px } .navbar-toggle .icon-bar + .icon-bar { margin-top: 4px } @media (min-width: 768px) { .navbar-toggle { display: none } } .navbar-nav { margin: 7px -15px } .navbar-nav > li > a { padding-top: 10px; padding-bottom: 10px; line-height: 22px } @media (max-width: 767px) { .navbar-nav .open .dropdown-menu { position: static; float: none; width: auto; margin-top: 0; background-color: transparent; border: 0; box-shadow: none } .navbar-nav .open .dropdown-menu .dropdown-header, .navbar-nav .open .dropdown-menu > li > a { padding: 5px 15px 5px 25px } .navbar-nav .open .dropdown-menu > li > a { line-height: 22px } .navbar-nav .open .dropdown-menu > li > a:focus, .navbar-nav .open .dropdown-menu > li > a:hover { background-image: none } } @media (min-width: 768px) { .navbar-nav { float: left; margin: 0 } .navbar-nav > li { float: left } .navbar-nav > li > a { padding-top: 14px; padding-bottom: 14px } } .navbar-form { margin: 7px -15px; padding: 10px 15px; border-top: 1px solid transparent; border-bottom: 1px solid transparent; box-shadow: inset 0 1px 0 hsla(0, 0%, 100%, .1), 0 1px 0 hsla(0, 0%, 100%, .1) } @media (min-width: 768px) { .navbar-form .form-group { display: inline-block; margin-bottom: 0; vertical-align: middle } .navbar-form .form-control { display: inline-block; width: auto; vertical-align: middle } .navbar-form .form-control-static { display: inline-block } .navbar-form .input-group { display: inline-table; vertical-align: middle } .navbar-form .input-group .form-control, .navbar-form .input-group .input-group-addon, .navbar-form .input-group .input-group-btn { width: auto } .navbar-form .input-group > .form-control { width: 100% } .navbar-form .control-label { margin-bottom: 0; vertical-align: middle } .navbar-form .checkbox, .navbar-form .radio { display: inline-block; margin-top: 0; margin-bottom: 0; vertical-align: middle } .navbar-form .checkbox label, .navbar-form .radio label { padding-left: 0 } .navbar-form .checkbox input[type=checkbox], .navbar-form .radio input[type=radio] { position: relative; margin-left: 0 } .navbar-form .has-feedback .form-control-feedback { top: 0 } } @media (max-width: 767px) { .navbar-form .form-group { margin-bottom: 5px } .navbar-form .form-group:last-child { margin-bottom: 0 } } @media (min-width: 768px) { .navbar-form { width: auto; border: 0; margin-left: 0; margin-right: 0; padding-top: 0; padding-bottom: 0; box-shadow: none } } .navbar-nav > li > .dropdown-menu { margin-top: 0; border-top-right-radius: 0; border-top-left-radius: 0 } .navbar-fixed-bottom .navbar-nav > li > .dropdown-menu { margin-bottom: 0; border-top-right-radius: 4px; border-top-left-radius: 4px; border-bottom-right-radius: 0; border-bottom-left-radius: 0 } .navbar-btn { margin-top: 7px; margin-bottom: 7px } .btn-group-sm > .navbar-btn.btn, .navbar-btn.btn-sm { margin-top: 10px; margin-bottom: 10px } .btn-group-xs > .navbar-btn.btn, .navbar-btn.btn-xs, .navbar-text { margin-top: 14px; margin-bottom: 14px } @media (min-width: 768px) { .navbar-text { float: left; margin-left: 15px; margin-right: 15px } } @media (min-width: 768px) { .navbar-left { float: left !important } .navbar-right { float: right !important; margin-right: -15px } .navbar-right ~ .navbar-right { margin-right: 0 } } .navbar-default { background-color: #fff; border-color: #d3e0e9 } .navbar-default .navbar-brand { color: #777 } .navbar-default .navbar-brand:focus, .navbar-default .navbar-brand:hover { color: #5e5e5e; background-color: transparent } .navbar-default .navbar-nav > li > a, .navbar-default .navbar-text { color: #777 } .navbar-default .navbar-nav > li > a:focus, .navbar-default .navbar-nav > li > a:hover { color: #333; background-color: transparent } .navbar-default .navbar-nav > .active > a, .navbar-default .navbar-nav > .active > a:focus, .navbar-default .navbar-nav > .active > a:hover { color: #555; background-color: #eee } .navbar-default .navbar-nav > .disabled > a, .navbar-default .navbar-nav > .disabled > a:focus, .navbar-default .navbar-nav > .disabled > a:hover { color: #ccc; background-color: transparent } .navbar-default .navbar-toggle { border-color: #ddd } .navbar-default .navbar-toggle:focus, .navbar-default .navbar-toggle:hover { background-color: #ddd } .navbar-default .navbar-toggle .icon-bar { background-color: #888 } .navbar-default .navbar-collapse, .navbar-default .navbar-form { border-color: #d3e0e9 } .navbar-default .navbar-nav > .open > a, .navbar-default .navbar-nav > .open > a:focus, .navbar-default .navbar-nav > .open > a:hover { background-color: #eee; color: #555 } @media (max-width: 767px) { .navbar-default .navbar-nav .open .dropdown-menu > li > a { color: #777 } .navbar-default .navbar-nav .open .dropdown-menu > li > a:focus, .navbar-default .navbar-nav .open .dropdown-menu > li > a:hover { color: #333; background-color: transparent } .navbar-default .navbar-nav .open .dropdown-menu > .active > a, .navbar-default .navbar-nav .open .dropdown-menu > .active > a:focus, .navbar-default .navbar-nav .open .dropdown-menu > .active > a:hover { color: #555; background-color: #eee } .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a, .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a:focus, .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a:hover { color: #ccc; background-color: transparent } } .navbar-default .navbar-link { color: #777 } .navbar-default .navbar-link:hover { color: #333 } .navbar-default .btn-link { color: #777 } .navbar-default .btn-link:focus, .navbar-default .btn-link:hover { color: #333 } .navbar-default .btn-link[disabled]:focus, .navbar-default .btn-link[disabled]:hover, fieldset[disabled] .navbar-default .btn-link:focus, fieldset[disabled] .navbar-default .btn-link:hover { color: #ccc } .navbar-inverse { background-color: #222; border-color: #090909 } .navbar-inverse .navbar-brand { color: #9d9d9d } .navbar-inverse .navbar-brand:focus, .navbar-inverse .navbar-brand:hover { color: #fff; background-color: transparent } .navbar-inverse .navbar-nav > li > a, .navbar-inverse .navbar-text { color: #9d9d9d } .navbar-inverse .navbar-nav > li > a:focus, .navbar-inverse .navbar-nav > li > a:hover { color: #fff; background-color: transparent } .navbar-inverse .navbar-nav > .active > a, .navbar-inverse .navbar-nav > .active > a:focus, .navbar-inverse .navbar-nav > .active > a:hover { color: #fff; background-color: #090909 } .navbar-inverse .navbar-nav > .disabled > a, .navbar-inverse .navbar-nav > .disabled > a:focus, .navbar-inverse .navbar-nav > .disabled > a:hover { color: #444; background-color: transparent } .navbar-inverse .navbar-toggle { border-color: #333 } .navbar-inverse .navbar-toggle:focus, .navbar-inverse .navbar-toggle:hover { background-color: #333 } .navbar-inverse .navbar-toggle .icon-bar { background-color: #fff } .navbar-inverse .navbar-collapse, .navbar-inverse .navbar-form { border-color: #101010 } .navbar-inverse .navbar-nav > .open > a, .navbar-inverse .navbar-nav > .open > a:focus, .navbar-inverse .navbar-nav > .open > a:hover { background-color: #090909; color: #fff } @media (max-width: 767px) { .navbar-inverse .navbar-nav .open .dropdown-menu > .dropdown-header { border-color: #090909 } .navbar-inverse .navbar-nav .open .dropdown-menu .divider { background-color: #090909 } .navbar-inverse .navbar-nav .open .dropdown-menu > li > a { color: #9d9d9d } .navbar-inverse .navbar-nav .open .dropdown-menu > li > a:focus, .navbar-inverse .navbar-nav .open .dropdown-menu > li > a:hover { color: #fff; background-color: transparent } .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a, .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:focus, .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:hover { color: #fff; background-color: #090909 } .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a, .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a:focus, .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a:hover { color: #444; background-color: transparent } } .navbar-inverse .navbar-link { color: #9d9d9d } .navbar-inverse .navbar-link:hover { color: #fff } .navbar-inverse .btn-link { color: #9d9d9d } .navbar-inverse .btn-link:focus, .navbar-inverse .btn-link:hover { color: #fff } .navbar-inverse .btn-link[disabled]:focus, .navbar-inverse .btn-link[disabled]:hover, fieldset[disabled] .navbar-inverse .btn-link:focus, fieldset[disabled] .navbar-inverse .btn-link:hover { color: #444 } .breadcrumb { padding: 8px 15px; margin-bottom: 22px; list-style: none; background-color: #f5f5f5; border-radius: 4px } .breadcrumb > li { display: inline-block } .breadcrumb > li + li:before { content: "/\A0"; padding: 0 5px; color: #ccc } .breadcrumb > .active { color: #777 } .pagination { display: inline-block; padding-left: 0; margin: 22px 0; border-radius: 4px } .pagination > li { display: inline } .pagination > li > a, .pagination > li > span { position: relative; float: left; padding: 6px 12px; line-height: 1.6; text-decoration: none; color: #3097d1; background-color: #fff; border: 1px solid #ddd; margin-left: -1px } .pagination > li:first-child > a, .pagination > li:first-child > span { margin-left: 0; border-bottom-left-radius: 4px; border-top-left-radius: 4px } .pagination > li:last-child > a, .pagination > li:last-child > span { border-bottom-right-radius: 4px; border-top-right-radius: 4px } .pagination > li > a:focus, .pagination > li > a:hover, .pagination > li > span:focus, .pagination > li > span:hover { z-index: 2; color: #216a94; background-color: #eee; border-color: #ddd } .pagination > .active > a, .pagination > .active > a:focus, .pagination > .active > a:hover, .pagination > .active > span, .pagination > .active > span:focus, .pagination > .active > span:hover { z-index: 3; color: #fff; background-color: #3097d1; border-color: #3097d1; cursor: default } .pagination > .disabled > a, .pagination > .disabled > a:focus, .pagination > .disabled > a:hover, .pagination > .disabled > span, .pagination > .disabled > span:focus, .pagination > .disabled > span:hover { color: #777; background-color: #fff; border-color: #ddd; cursor: not-allowed } .pagination-lg > li > a, .pagination-lg > li > span { padding: 10px 16px; font-size: 18px; line-height: 1.33333 } .pagination-lg > li:first-child > a, .pagination-lg > li:first-child > span { border-bottom-left-radius: 6px; border-top-left-radius: 6px } .pagination-lg > li:last-child > a, .pagination-lg > li:last-child > span { border-bottom-right-radius: 6px; border-top-right-radius: 6px } .pagination-sm > li > a, .pagination-sm > li > span { padding: 5px 10px; font-size: 12px; line-height: 1.5 } .pagination-sm > li:first-child > a, .pagination-sm > li:first-child > span { border-bottom-left-radius: 3px; border-top-left-radius: 3px } .pagination-sm > li:last-child > a, .pagination-sm > li:last-child > span { border-bottom-right-radius: 3px; border-top-right-radius: 3px } .pager { padding-left: 0; margin: 22px 0; list-style: none; text-align: center } .pager:after, .pager:before { content: " "; display: table } .pager:after { clear: both } .pager li { display: inline } .pager li > a, .pager li > span { display: inline-block; padding: 5px 14px; background-color: #fff; border: 1px solid #ddd; border-radius: 15px } .pager li > a:focus, .pager li > a:hover { text-decoration: none; background-color: #eee } .pager .next > a, .pager .next > span { float: right } .pager .previous > a, .pager .previous > span { float: left } .pager .disabled > a, .pager .disabled > a:focus, .pager .disabled > a:hover, .pager .disabled > span { color: #777; background-color: #fff; cursor: not-allowed } .label { display: inline; padding: .2em .6em .3em; font-size: 75%; font-weight: 700; line-height: 1; color: #fff; text-align: center; white-space: nowrap; vertical-align: baseline; border-radius: .25em } .label:empty { display: none } .btn .label { position: relative; top: -1px } a.label:focus, a.label:hover { color: #fff; text-decoration: none; cursor: pointer } .label-default { background-color: #777 } .label-default[href]:focus, .label-default[href]:hover { background-color: #5e5e5e } .label-primary { background-color: #3097d1 } .label-primary[href]:focus, .label-primary[href]:hover { background-color: #2579a9 } .label-success { background-color: #2ab27b } .label-success[href]:focus, .label-success[href]:hover { background-color: #20895e } .label-info { background-color: #8eb4cb } .label-info[href]:focus, .label-info[href]:hover { background-color: #6b9dbb } .label-warning { background-color: #cbb956 } .label-warning[href]:focus, .label-warning[href]:hover { background-color: #b6a338 } .label-danger { background-color: #bf5329 } .label-danger[href]:focus, .label-danger[href]:hover { background-color: #954120 } .badge { display: inline-block; min-width: 10px; padding: 3px 7px; font-size: 12px; font-weight: 700; color: #fff; line-height: 1; vertical-align: middle; white-space: nowrap; text-align: center; background-color: #777; border-radius: 10px } .badge:empty { display: none } .btn .badge { position: relative; top: -1px } .btn-group-xs > .btn .badge, .btn-xs .badge { top: 0; padding: 1px 5px } .list-group-item.active > .badge, .nav-pills > .active > a > .badge { color: #3097d1; background-color: #fff } .list-group-item > .badge { float: right } .list-group-item > .badge + .badge { margin-right: 5px } .nav-pills > li > a > .badge { margin-left: 3px } a.badge:focus, a.badge:hover { color: #fff; text-decoration: none; cursor: pointer } .jumbotron { padding-top: 30px; padding-bottom: 30px; margin-bottom: 30px; background-color: #eee } .jumbotron, .jumbotron .h1, .jumbotron h1 { color: inherit } .jumbotron p { margin-bottom: 15px; font-size: 21px; font-weight: 200 } .jumbotron > hr { border-top-color: #d5d5d5 } .container-fluid .jumbotron, .container .jumbotron { border-radius: 6px; padding-left: 15px; padding-right: 15px } .jumbotron .container { max-width: 100% } @media screen and (min-width: 768px) { .jumbotron { padding-top: 48px; padding-bottom: 48px } .container-fluid .jumbotron, .container .jumbotron { padding-left: 60px; padding-right: 60px } .jumbotron .h1, .jumbotron h1 { font-size: 63px } } .thumbnail { display: block; padding: 4px; margin-bottom: 22px; line-height: 1.6; background-color: #f5f8fa; border: 1px solid #ddd; border-radius: 4px; -webkit-transition: border .2s ease-in-out; transition: border .2s ease-in-out } .thumbnail > img, .thumbnail a > img { display: block; max-width: 100%; height: auto; margin-left: auto; margin-right: auto } .thumbnail .caption { padding: 9px; color: #636b6f } a.thumbnail.active, a.thumbnail:focus, a.thumbnail:hover { border-color: #3097d1 } .alert { padding: 15px; margin-bottom: 22px; border: 1px solid transparent; border-radius: 4px } .alert h4 { margin-top: 0; color: inherit } .alert .alert-link { font-weight: 700 } .alert > p, .alert > ul { margin-bottom: 0 } .alert > p + p { margin-top: 5px } .alert-dismissable, .alert-dismissible { padding-right: 35px } .alert-dismissable .close, .alert-dismissible .close { position: relative; top: -2px; right: -21px; color: inherit } .alert-success { background-color: #dff0d8; border-color: #d6e9c6; color: #3c763d } .alert-success hr { border-top-color: #c9e2b3 } .alert-success .alert-link { color: #2b542c } .alert-info { background-color: #d9edf7; border-color: #bce8f1; color: #31708f } .alert-info hr { border-top-color: #a6e1ec } .alert-info .alert-link { color: #245269 } .alert-warning { background-color: #fcf8e3; border-color: #faebcc; color: #8a6d3b } .alert-warning hr { border-top-color: #f7e1b5 } .alert-warning .alert-link { color: #66512c } .alert-danger { background-color: #f2dede; border-color: #ebccd1; color: #a94442 } .alert-danger hr { border-top-color: #e4b9c0 } .alert-danger .alert-link { color: #843534 } @-webkit-keyframes progress-bar-stripes { 0% { background-position: 40px 0 } to { background-position: 0 0 } } @keyframes progress-bar-stripes { 0% { background-position: 40px 0 } to { background-position: 0 0 } } .progress { overflow: hidden; height: 22px; margin-bottom: 22px; background-color: #f5f5f5; border-radius: 4px; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1) } .progress-bar { float: left; width: 0; height: 100%; font-size: 12px; line-height: 22px; color: #fff; text-align: center; background-color: #3097d1; box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .15); -webkit-transition: width .6s ease; transition: width .6s ease } .progress-bar-striped, .progress-striped .progress-bar { background-image: -webkit-linear-gradient(45deg, hsla(0, 0%, 100%, .15) 25%, transparent 0, transparent 50%, hsla(0, 0%, 100%, .15) 0, hsla(0, 0%, 100%, .15) 75%, transparent 0, transparent); background-image: linear-gradient(45deg, hsla(0, 0%, 100%, .15) 25%, transparent 0, transparent 50%, hsla(0, 0%, 100%, .15) 0, hsla(0, 0%, 100%, .15) 75%, transparent 0, transparent); background-size: 40px 40px } .progress-bar.active, .progress.active .progress-bar { -webkit-animation: progress-bar-stripes 2s linear infinite; animation: progress-bar-stripes 2s linear infinite } .progress-bar-success { background-color: #2ab27b } .progress-striped .progress-bar-success { background-image: -webkit-linear-gradient(45deg, hsla(0, 0%, 100%, .15) 25%, transparent 0, transparent 50%, hsla(0, 0%, 100%, .15) 0, hsla(0, 0%, 100%, .15) 75%, transparent 0, transparent); background-image: linear-gradient(45deg, hsla(0, 0%, 100%, .15) 25%, transparent 0, transparent 50%, hsla(0, 0%, 100%, .15) 0, hsla(0, 0%, 100%, .15) 75%, transparent 0, transparent) } .progress-bar-info { background-color: #8eb4cb } .progress-striped .progress-bar-info { background-image: -webkit-linear-gradient(45deg, hsla(0, 0%, 100%, .15) 25%, transparent 0, transparent 50%, hsla(0, 0%, 100%, .15) 0, hsla(0, 0%, 100%, .15) 75%, transparent 0, transparent); background-image: linear-gradient(45deg, hsla(0, 0%, 100%, .15) 25%, transparent 0, transparent 50%, hsla(0, 0%, 100%, .15) 0, hsla(0, 0%, 100%, .15) 75%, transparent 0, transparent) } .progress-bar-warning { background-color: #cbb956 } .progress-striped .progress-bar-warning { background-image: -webkit-linear-gradient(45deg, hsla(0, 0%, 100%, .15) 25%, transparent 0, transparent 50%, hsla(0, 0%, 100%, .15) 0, hsla(0, 0%, 100%, .15) 75%, transparent 0, transparent); background-image: linear-gradient(45deg, hsla(0, 0%, 100%, .15) 25%, transparent 0, transparent 50%, hsla(0, 0%, 100%, .15) 0, hsla(0, 0%, 100%, .15) 75%, transparent 0, transparent) } .progress-bar-danger { background-color: #bf5329 } .progress-striped .progress-bar-danger { background-image: -webkit-linear-gradient(45deg, hsla(0, 0%, 100%, .15) 25%, transparent 0, transparent 50%, hsla(0, 0%, 100%, .15) 0, hsla(0, 0%, 100%, .15) 75%, transparent 0, transparent); background-image: linear-gradient(45deg, hsla(0, 0%, 100%, .15) 25%, transparent 0, transparent 50%, hsla(0, 0%, 100%, .15) 0, hsla(0, 0%, 100%, .15) 75%, transparent 0, transparent) } .media { margin-top: 15px } .media:first-child { margin-top: 0 } .media, .media-body { zoom: 1; overflow: hidden } .media-body { width: 10000px } .media-object { display: block } .media-object.img-thumbnail { max-width: none } .media-right, .media > .pull-right { padding-left: 10px } .media-left, .media > .pull-left { padding-right: 10px } .media-body, .media-left, .media-right { display: table-cell; vertical-align: top } .media-middle { vertical-align: middle } .media-bottom { vertical-align: bottom } .media-heading { margin-top: 0; margin-bottom: 5px } .media-list { padding-left: 0; list-style: none } .list-group { margin-bottom: 20px; padding-left: 0 } .list-group-item { position: relative; display: block; padding: 10px 15px; margin-bottom: -1px; background-color: #fff; border: 1px solid #d3e0e9 } .list-group-item:first-child { border-top-right-radius: 4px; border-top-left-radius: 4px } .list-group-item:last-child { margin-bottom: 0; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px } a.list-group-item, button.list-group-item { color: #555 } a.list-group-item .list-group-item-heading, button.list-group-item .list-group-item-heading { color: #333 } a.list-group-item:focus, a.list-group-item:hover, button.list-group-item:focus, button.list-group-item:hover { text-decoration: none; color: #555; background-color: #f5f5f5 } button.list-group-item { width: 100%; text-align: left } .list-group-item.disabled, .list-group-item.disabled:focus, .list-group-item.disabled:hover { background-color: #eee; color: #777; cursor: not-allowed } .list-group-item.disabled .list-group-item-heading, .list-group-item.disabled:focus .list-group-item-heading, .list-group-item.disabled:hover .list-group-item-heading { color: inherit } .list-group-item.disabled .list-group-item-text, .list-group-item.disabled:focus .list-group-item-text, .list-group-item.disabled:hover .list-group-item-text { color: #777 } .list-group-item.active, .list-group-item.active:focus, .list-group-item.active:hover { z-index: 2; color: #fff; background-color: #3097d1; border-color: #3097d1 } .list-group-item.active .list-group-item-heading, .list-group-item.active .list-group-item-heading > .small, .list-group-item.active .list-group-item-heading > small, .list-group-item.active:focus .list-group-item-heading, .list-group-item.active:focus .list-group-item-heading > .small, .list-group-item.active:focus .list-group-item-heading > small, .list-group-item.active:hover .list-group-item-heading, .list-group-item.active:hover .list-group-item-heading > .small, .list-group-item.active:hover .list-group-item-heading > small { color: inherit } .list-group-item.active .list-group-item-text, .list-group-item.active:focus .list-group-item-text, .list-group-item.active:hover .list-group-item-text { color: #d7ebf6 } .list-group-item-success { color: #3c763d; background-color: #dff0d8 } a.list-group-item-success, button.list-group-item-success { color: #3c763d } a.list-group-item-success .list-group-item-heading, button.list-group-item-success .list-group-item-heading { color: inherit } a.list-group-item-success:focus, a.list-group-item-success:hover, button.list-group-item-success:focus, button.list-group-item-success:hover { color: #3c763d; background-color: #d0e9c6 } a.list-group-item-success.active, a.list-group-item-success.active:focus, a.list-group-item-success.active:hover, button.list-group-item-success.active, button.list-group-item-success.active:focus, button.list-group-item-success.active:hover { color: #fff; background-color: #3c763d; border-color: #3c763d } .list-group-item-info { color: #31708f; background-color: #d9edf7 } a.list-group-item-info, button.list-group-item-info { color: #31708f } a.list-group-item-info .list-group-item-heading, button.list-group-item-info .list-group-item-heading { color: inherit } a.list-group-item-info:focus, a.list-group-item-info:hover, button.list-group-item-info:focus, button.list-group-item-info:hover { color: #31708f; background-color: #c4e3f3 } a.list-group-item-info.active, a.list-group-item-info.active:focus, a.list-group-item-info.active:hover, button.list-group-item-info.active, button.list-group-item-info.active:focus, button.list-group-item-info.active:hover { color: #fff; background-color: #31708f; border-color: #31708f } .list-group-item-warning { color: #8a6d3b; background-color: #fcf8e3 } a.list-group-item-warning, button.list-group-item-warning { color: #8a6d3b } a.list-group-item-warning .list-group-item-heading, button.list-group-item-warning .list-group-item-heading { color: inherit } a.list-group-item-warning:focus, a.list-group-item-warning:hover, button.list-group-item-warning:focus, button.list-group-item-warning:hover { color: #8a6d3b; background-color: #faf2cc } a.list-group-item-warning.active, a.list-group-item-warning.active:focus, a.list-group-item-warning.active:hover, button.list-group-item-warning.active, button.list-group-item-warning.active:focus, button.list-group-item-warning.active:hover { color: #fff; background-color: #8a6d3b; border-color: #8a6d3b } .list-group-item-danger { color: #a94442; background-color: #f2dede } a.list-group-item-danger, button.list-group-item-danger { color: #a94442 } a.list-group-item-danger .list-group-item-heading, button.list-group-item-danger .list-group-item-heading { color: inherit } a.list-group-item-danger:focus, a.list-group-item-danger:hover, button.list-group-item-danger:focus, button.list-group-item-danger:hover { color: #a94442; background-color: #ebcccc } a.list-group-item-danger.active, a.list-group-item-danger.active:focus, a.list-group-item-danger.active:hover, button.list-group-item-danger.active, button.list-group-item-danger.active:focus, button.list-group-item-danger.active:hover { color: #fff; background-color: #a94442; border-color: #a94442 } .list-group-item-heading { margin-top: 0; margin-bottom: 5px } .list-group-item-text { margin-bottom: 0; line-height: 1.3 } .panel { margin-bottom: 22px; background-color: #fff; border: 1px solid transparent; border-radius: 4px; box-shadow: 0 1px 1px rgba(0, 0, 0, .05) } .panel-body { padding: 15px } .panel-body:after, .panel-body:before { content: " "; display: table } .panel-body:after { clear: both } .panel-heading { padding: 10px 15px; border-bottom: 1px solid transparent; border-top-right-radius: 3px; border-top-left-radius: 3px } .panel-heading > .dropdown .dropdown-toggle, .panel-title { color: inherit } .panel-title { margin-top: 0; margin-bottom: 0; font-size: 16px } .panel-title > .small, .panel-title > .small > a, .panel-title > a, .panel-title > small, .panel-title > small > a { color: inherit } .panel-footer { padding: 10px 15px; background-color: #f5f5f5; border-top: 1px solid #d3e0e9; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px } .panel > .list-group, .panel > .panel-collapse > .list-group { margin-bottom: 0 } .panel > .list-group .list-group-item, .panel > .panel-collapse > .list-group .list-group-item { border-width: 1px 0; border-radius: 0 } .panel > .list-group:first-child .list-group-item:first-child, .panel > .panel-collapse > .list-group:first-child .list-group-item:first-child { border-top: 0; border-top-right-radius: 3px; border-top-left-radius: 3px } .panel > .list-group:last-child .list-group-item:last-child, .panel > .panel-collapse > .list-group:last-child .list-group-item:last-child { border-bottom: 0; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px } .panel > .panel-heading + .panel-collapse > .list-group .list-group-item:first-child { border-top-right-radius: 0; border-top-left-radius: 0 } .list-group + .panel-footer, .panel-heading + .list-group .list-group-item:first-child { border-top-width: 0 } .panel > .panel-collapse > .table, .panel > .table, .panel > .table-responsive > .table { margin-bottom: 0 } .panel > .panel-collapse > .table caption, .panel > .table-responsive > .table caption, .panel > .table caption { padding-left: 15px; padding-right: 15px } .panel > .table-responsive:first-child > .table:first-child, .panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child, .panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child, .panel > .table:first-child, .panel > .table:first-child > tbody:first-child > tr:first-child, .panel > .table:first-child > thead:first-child > tr:first-child { border-top-right-radius: 3px; border-top-left-radius: 3px } .panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:first-child, .panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:first-child, .panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:first-child, .panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:first-child, .panel > .table:first-child > tbody:first-child > tr:first-child td:first-child, .panel > .table:first-child > tbody:first-child > tr:first-child th:first-child, .panel > .table:first-child > thead:first-child > tr:first-child td:first-child, .panel > .table:first-child > thead:first-child > tr:first-child th:first-child { border-top-left-radius: 3px } .panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:last-child, .panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:last-child, .panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:last-child, .panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:last-child, .panel > .table:first-child > tbody:first-child > tr:first-child td:last-child, .panel > .table:first-child > tbody:first-child > tr:first-child th:last-child, .panel > .table:first-child > thead:first-child > tr:first-child td:last-child, .panel > .table:first-child > thead:first-child > tr:first-child th:last-child { border-top-right-radius: 3px } .panel > .table-responsive:last-child > .table:last-child, .panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child, .panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child, .panel > .table:last-child, .panel > .table:last-child > tbody:last-child > tr:last-child, .panel > .table:last-child > tfoot:last-child > tr:last-child { border-bottom-right-radius: 3px; border-bottom-left-radius: 3px } .panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:first-child, .panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:first-child, .panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:first-child, .panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:first-child, .panel > .table:last-child > tbody:last-child > tr:last-child td:first-child, .panel > .table:last-child > tbody:last-child > tr:last-child th:first-child, .panel > .table:last-child > tfoot:last-child > tr:last-child td:first-child, .panel > .table:last-child > tfoot:last-child > tr:last-child th:first-child { border-bottom-left-radius: 3px } .panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:last-child, .panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:last-child, .panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:last-child, .panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:last-child, .panel > .table:last-child > tbody:last-child > tr:last-child td:last-child, .panel > .table:last-child > tbody:last-child > tr:last-child th:last-child, .panel > .table:last-child > tfoot:last-child > tr:last-child td:last-child, .panel > .table:last-child > tfoot:last-child > tr:last-child th:last-child { border-bottom-right-radius: 3px } .panel > .panel-body + .table, .panel > .panel-body + .table-responsive, .panel > .table + .panel-body, .panel > .table-responsive + .panel-body { border-top: 1px solid #ddd } .panel > .table > tbody:first-child > tr:first-child td, .panel > .table > tbody:first-child > tr:first-child th { border-top: 0 } .panel > .table-bordered, .panel > .table-responsive > .table-bordered { border: 0 } .panel > .table-bordered > tbody > tr > td:first-child, .panel > .table-bordered > tbody > tr > th:first-child, .panel > .table-bordered > tfoot > tr > td:first-child, .panel > .table-bordered > tfoot > tr > th:first-child, .panel > .table-bordered > thead > tr > td:first-child, .panel > .table-bordered > thead > tr > th:first-child, .panel > .table-responsive > .table-bordered > tbody > tr > td:first-child, .panel > .table-responsive > .table-bordered > tbody > tr > th:first-child, .panel > .table-responsive > .table-bordered > tfoot > tr > td:first-child, .panel > .table-responsive > .table-bordered > tfoot > tr > th:first-child, .panel > .table-responsive > .table-bordered > thead > tr > td:first-child, .panel > .table-responsive > .table-bordered > thead > tr > th:first-child { border-left: 0 } .panel > .table-bordered > tbody > tr > td:last-child, .panel > .table-bordered > tbody > tr > th:last-child, .panel > .table-bordered > tfoot > tr > td:last-child, .panel > .table-bordered > tfoot > tr > th:last-child, .panel > .table-bordered > thead > tr > td:last-child, .panel > .table-bordered > thead > tr > th:last-child, .panel > .table-responsive > .table-bordered > tbody > tr > td:last-child, .panel > .table-responsive > .table-bordered > tbody > tr > th:last-child, .panel > .table-responsive > .table-bordered > tfoot > tr > td:last-child, .panel > .table-responsive > .table-bordered > tfoot > tr > th:last-child, .panel > .table-responsive > .table-bordered > thead > tr > td:last-child, .panel > .table-responsive > .table-bordered > thead > tr > th:last-child { border-right: 0 } .panel > .table-bordered > tbody > tr:first-child > td, .panel > .table-bordered > tbody > tr:first-child > th, .panel > .table-bordered > tbody > tr:last-child > td, .panel > .table-bordered > tbody > tr:last-child > th, .panel > .table-bordered > tfoot > tr:last-child > td, .panel > .table-bordered > tfoot > tr:last-child > th, .panel > .table-bordered > thead > tr:first-child > td, .panel > .table-bordered > thead > tr:first-child > th, .panel > .table-responsive > .table-bordered > tbody > tr:first-child > td, .panel > .table-responsive > .table-bordered > tbody > tr:first-child > th, .panel > .table-responsive > .table-bordered > tbody > tr:last-child > td, .panel > .table-responsive > .table-bordered > tbody > tr:last-child > th, .panel > .table-responsive > .table-bordered > tfoot > tr:last-child > td, .panel > .table-responsive > .table-bordered > tfoot > tr:last-child > th, .panel > .table-responsive > .table-bordered > thead > tr:first-child > td, .panel > .table-responsive > .table-bordered > thead > tr:first-child > th { border-bottom: 0 } .panel > .table-responsive { border: 0; margin-bottom: 0 } .panel-group { margin-bottom: 22px } .panel-group .panel { margin-bottom: 0; border-radius: 4px } .panel-group .panel + .panel { margin-top: 5px } .panel-group .panel-heading { border-bottom: 0 } .panel-group .panel-heading + .panel-collapse > .list-group, .panel-group .panel-heading + .panel-collapse > .panel-body { border-top: 1px solid #d3e0e9 } .panel-group .panel-footer { border-top: 0 } .panel-group .panel-footer + .panel-collapse .panel-body { border-bottom: 1px solid #d3e0e9 } .panel-default { border-color: #d3e0e9 } .panel-default > .panel-heading { color: #333; background-color: #fff; border-color: #d3e0e9 } .panel-default > .panel-heading + .panel-collapse > .panel-body { border-top-color: #d3e0e9 } .panel-default > .panel-heading .badge { color: #fff; background-color: #333 } .panel-default > .panel-footer + .panel-collapse > .panel-body { border-bottom-color: #d3e0e9 } .panel-primary { border-color: #3097d1 } .panel-primary > .panel-heading { color: #fff; background-color: #3097d1; border-color: #3097d1 } .panel-primary > .panel-heading + .panel-collapse > .panel-body { border-top-color: #3097d1 } .panel-primary > .panel-heading .badge { color: #3097d1; background-color: #fff } .panel-primary > .panel-footer + .panel-collapse > .panel-body { border-bottom-color: #3097d1 } .panel-success { border-color: #d6e9c6 } .panel-success > .panel-heading { color: #3c763d; background-color: #dff0d8; border-color: #d6e9c6 } .panel-success > .panel-heading + .panel-collapse > .panel-body { border-top-color: #d6e9c6 } .panel-success > .panel-heading .badge { color: #dff0d8; background-color: #3c763d } .panel-success > .panel-footer + .panel-collapse > .panel-body { border-bottom-color: #d6e9c6 } .panel-info { border-color: #bce8f1 } .panel-info > .panel-heading { color: #31708f; background-color: #d9edf7; border-color: #bce8f1 } .panel-info > .panel-heading + .panel-collapse > .panel-body { border-top-color: #bce8f1 } .panel-info > .panel-heading .badge { color: #d9edf7; background-color: #31708f } .panel-info > .panel-footer + .panel-collapse > .panel-body { border-bottom-color: #bce8f1 } .panel-warning { border-color: #faebcc } .panel-warning > .panel-heading { color: #8a6d3b; background-color: #fcf8e3; border-color: #faebcc } .panel-warning > .panel-heading + .panel-collapse > .panel-body { border-top-color: #faebcc } .panel-warning > .panel-heading .badge { color: #fcf8e3; background-color: #8a6d3b } .panel-warning > .panel-footer + .panel-collapse > .panel-body { border-bottom-color: #faebcc } .panel-danger { border-color: #ebccd1 } .panel-danger > .panel-heading { color: #a94442; background-color: #f2dede; border-color: #ebccd1 } .panel-danger > .panel-heading + .panel-collapse > .panel-body { border-top-color: #ebccd1 } .panel-danger > .panel-heading .badge { color: #f2dede; background-color: #a94442 } .panel-danger > .panel-footer + .panel-collapse > .panel-body { border-bottom-color: #ebccd1 } .embed-responsive { position: relative; display: block; height: 0; padding: 0; overflow: hidden } .embed-responsive .embed-responsive-item, .embed-responsive embed, .embed-responsive iframe, .embed-responsive object, .embed-responsive video { position: absolute; top: 0; left: 0; bottom: 0; height: 100%; width: 100%; border: 0 } .embed-responsive-16by9 { padding-bottom: 56.25% } .embed-responsive-4by3 { padding-bottom: 75% } .well { min-height: 20px; padding: 19px; margin-bottom: 20px; background-color: #f5f5f5; border: 1px solid #e3e3e3; border-radius: 4px; box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05) } .well blockquote { border-color: #ddd; border-color: rgba(0, 0, 0, .15) } .well-lg { padding: 24px; border-radius: 6px } .well-sm { padding: 9px; border-radius: 3px } .close { float: right; font-size: 21px; font-weight: 700; line-height: 1; color: #000; text-shadow: 0 1px 0 #fff; opacity: .2; filter: alpha(opacity=20) } .close:focus, .close:hover { color: #000; text-decoration: none; cursor: pointer; opacity: .5; filter: alpha(opacity=50) } button.close { padding: 0; cursor: pointer; background: transparent; border: 0; -webkit-appearance: none } .modal, .modal-open { overflow: hidden } .modal { display: none; position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 1050; -webkit-overflow-scrolling: touch; outline: 0 } .modal.fade .modal-dialog { -webkit-transform: translateY(-25%); transform: translateY(-25%); -webkit-transition: -webkit-transform .3s ease-out; transition: -webkit-transform .3s ease-out; transition: transform .3s ease-out; transition: transform .3s ease-out, -webkit-transform .3s ease-out } .modal.in .modal-dialog { -webkit-transform: translate(0); transform: translate(0) } .modal-open .modal { overflow-x: hidden; overflow-y: auto } .modal-dialog { position: relative; width: auto; margin: 10px } .modal-content { position: relative; background-color: #fff; border: 1px solid #999; border: 1px solid rgba(0, 0, 0, .2); border-radius: 6px; box-shadow: 0 3px 9px rgba(0, 0, 0, .5); background-clip: padding-box; outline: 0 } .modal-backdrop { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 1040; background-color: #000 } .modal-backdrop.fade { opacity: 0; filter: alpha(opacity=0) } .modal-backdrop.in { opacity: .5; filter: alpha(opacity=50) } .modal-header { padding: 15px; border-bottom: 1px solid #e5e5e5 } .modal-header:after, .modal-header:before { content: " "; display: table } .modal-header:after { clear: both } .modal-header .close { margin-top: -2px } .modal-title { margin: 0; line-height: 1.6 } .modal-body { position: relative; padding: 15px } .modal-footer { padding: 15px; text-align: right; border-top: 1px solid #e5e5e5 } .modal-footer:after, .modal-footer:before { content: " "; display: table } .modal-footer:after { clear: both } .modal-footer .btn + .btn { margin-left: 5px; margin-bottom: 0 } .modal-footer .btn-group .btn + .btn { margin-left: -1px } .modal-footer .btn-block + .btn-block { margin-left: 0 } .modal-scrollbar-measure { position: absolute; top: -9999px; width: 50px; height: 50px; overflow: scroll } @media (min-width: 768px) { .modal-dialog { width: 600px; margin: 30px auto } .modal-content { box-shadow: 0 5px 15px rgba(0, 0, 0, .5) } .modal-sm { width: 300px } } @media (min-width: 992px) { .modal-lg { width: 900px } } .tooltip { position: absolute; z-index: 1070; display: block; font-family: Raleway, sans-serif; font-style: normal; font-weight: 400; letter-spacing: normal; line-break: auto; line-height: 1.6; text-align: left; text-align: start; text-decoration: none; text-shadow: none; text-transform: none; white-space: normal; word-break: normal; word-spacing: normal; word-wrap: normal; font-size: 12px; opacity: 0; filter: alpha(opacity=0) } .tooltip.in { opacity: .9; filter: alpha(opacity=90) } .tooltip.top { margin-top: -3px; padding: 5px 0 } .tooltip.right { margin-left: 3px; padding: 0 5px } .tooltip.bottom { margin-top: 3px; padding: 5px 0 } .tooltip.left { margin-left: -3px; padding: 0 5px } .tooltip-inner { max-width: 200px; padding: 3px 8px; color: #fff; text-align: center; background-color: #000; border-radius: 4px } .tooltip-arrow { position: absolute; width: 0; height: 0; border-color: transparent; border-style: solid } .tooltip.top .tooltip-arrow { bottom: 0; left: 50%; margin-left: -5px; border-width: 5px 5px 0; border-top-color: #000 } .tooltip.top-left .tooltip-arrow { right: 5px } .tooltip.top-left .tooltip-arrow, .tooltip.top-right .tooltip-arrow { bottom: 0; margin-bottom: -5px; border-width: 5px 5px 0; border-top-color: #000 } .tooltip.top-right .tooltip-arrow { left: 5px } .tooltip.right .tooltip-arrow { top: 50%; left: 0; margin-top: -5px; border-width: 5px 5px 5px 0; border-right-color: #000 } .tooltip.left .tooltip-arrow { top: 50%; right: 0; margin-top: -5px; border-width: 5px 0 5px 5px; border-left-color: #000 } .tooltip.bottom .tooltip-arrow { top: 0; left: 50%; margin-left: -5px; border-width: 0 5px 5px; border-bottom-color: #000 } .tooltip.bottom-left .tooltip-arrow { top: 0; right: 5px; margin-top: -5px; border-width: 0 5px 5px; border-bottom-color: #000 } .tooltip.bottom-right .tooltip-arrow { top: 0; left: 5px; margin-top: -5px; border-width: 0 5px 5px; border-bottom-color: #000 } .popover { position: absolute; top: 0; left: 0; z-index: 1060; display: none; max-width: 276px; padding: 1px; font-family: Raleway, sans-serif; font-style: normal; font-weight: 400; letter-spacing: normal; line-break: auto; line-height: 1.6; text-align: left; text-align: start; text-decoration: none; text-shadow: none; text-transform: none; white-space: normal; word-break: normal; word-spacing: normal; word-wrap: normal; font-size: 14px; background-color: #fff; background-clip: padding-box; border: 1px solid #ccc; border: 1px solid rgba(0, 0, 0, .2); border-radius: 6px; box-shadow: 0 5px 10px rgba(0, 0, 0, .2) } .popover.top { margin-top: -10px } .popover.right { margin-left: 10px } .popover.bottom { margin-top: 10px } .popover.left { margin-left: -10px } .popover-title { margin: 0; padding: 8px 14px; font-size: 14px; background-color: #f7f7f7; border-bottom: 1px solid #ebebeb; border-radius: 5px 5px 0 0 } .popover-content { padding: 9px 14px } .popover > .arrow, .popover > .arrow:after { position: absolute; display: block; width: 0; height: 0; border-color: transparent; border-style: solid } .popover > .arrow { border-width: 11px } .popover > .arrow:after { border-width: 10px; content: "" } .popover.top > .arrow { left: 50%; margin-left: -11px; border-bottom-width: 0; border-top-color: #999; border-top-color: rgba(0, 0, 0, .25); bottom: -11px } .popover.top > .arrow:after { content: " "; bottom: 1px; margin-left: -10px; border-bottom-width: 0; border-top-color: #fff } .popover.right > .arrow { top: 50%; left: -11px; margin-top: -11px; border-left-width: 0; border-right-color: #999; border-right-color: rgba(0, 0, 0, .25) } .popover.right > .arrow:after { content: " "; left: 1px; bottom: -10px; border-left-width: 0; border-right-color: #fff } .popover.bottom > .arrow { left: 50%; margin-left: -11px; border-top-width: 0; border-bottom-color: #999; border-bottom-color: rgba(0, 0, 0, .25); top: -11px } .popover.bottom > .arrow:after { content: " "; top: 1px; margin-left: -10px; border-top-width: 0; border-bottom-color: #fff } .popover.left > .arrow { top: 50%; right: -11px; margin-top: -11px; border-right-width: 0; border-left-color: #999; border-left-color: rgba(0, 0, 0, .25) } .popover.left > .arrow:after { content: " "; right: 1px; border-right-width: 0; border-left-color: #fff; bottom: -10px } .carousel, .carousel-inner { position: relative } .carousel-inner { overflow: hidden; width: 100% } .carousel-inner > .item { display: none; position: relative; -webkit-transition: left .6s ease-in-out; transition: left .6s ease-in-out } .carousel-inner > .item > a > img, .carousel-inner > .item > img { display: block; max-width: 100%; height: auto; line-height: 1 } @media (-webkit-transform-3d),(transform-3d) { .carousel-inner > .item { -webkit-transition: -webkit-transform .6s ease-in-out; transition: -webkit-transform .6s ease-in-out; transition: transform .6s ease-in-out; transition: transform .6s ease-in-out, -webkit-transform .6s ease-in-out; -webkit-backface-visibility: hidden; backface-visibility: hidden; -webkit-perspective: 1000px; perspective: 1000px } .carousel-inner > .item.active.right, .carousel-inner > .item.next { -webkit-transform: translate3d(100%, 0, 0); transform: translate3d(100%, 0, 0); left: 0 } .carousel-inner > .item.active.left, .carousel-inner > .item.prev { -webkit-transform: translate3d(-100%, 0, 0); transform: translate3d(-100%, 0, 0); left: 0 } .carousel-inner > .item.active, .carousel-inner > .item.next.left, .carousel-inner > .item.prev.right { -webkit-transform: translateZ(0); transform: translateZ(0); left: 0 } } .carousel-inner > .active, .carousel-inner > .next, .carousel-inner > .prev { display: block } .carousel-inner > .active { left: 0 } .carousel-inner > .next, .carousel-inner > .prev { position: absolute; top: 0; width: 100% } .carousel-inner > .next { left: 100% } .carousel-inner > .prev { left: -100% } .carousel-inner > .next.left, .carousel-inner > .prev.right { left: 0 } .carousel-inner > .active.left { left: -100% } .carousel-inner > .active.right { left: 100% } .carousel-control { position: absolute; top: 0; left: 0; bottom: 0; width: 15%; opacity: .5; filter: alpha(opacity=50); font-size: 20px; color: #fff; text-align: center; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); background-color: transparent } .carousel-control.left { background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, .5), rgba(0, 0, 0, .0001)); background-image: linear-gradient(90deg, rgba(0, 0, 0, .5) 0, rgba(0, 0, 0, .0001)); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#80000000", endColorstr="#00000000", GradientType=1) } .carousel-control.right { left: auto; right: 0; background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, .0001), rgba(0, 0, 0, .5)); background-image: linear-gradient(90deg, rgba(0, 0, 0, .0001) 0, rgba(0, 0, 0, .5)); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#00000000", endColorstr="#80000000", GradientType=1) } .carousel-control:focus, .carousel-control:hover { outline: 0; color: #fff; text-decoration: none; opacity: .9; filter: alpha(opacity=90) } .carousel-control .glyphicon-chevron-left, .carousel-control .glyphicon-chevron-right, .carousel-control .icon-next, .carousel-control .icon-prev { position: absolute; top: 50%; margin-top: -10px; z-index: 5; display: inline-block } .carousel-control .glyphicon-chevron-left, .carousel-control .icon-prev { left: 50%; margin-left: -10px } .carousel-control .glyphicon-chevron-right, .carousel-control .icon-next { right: 50%; margin-right: -10px } .carousel-control .icon-next, .carousel-control .icon-prev { width: 20px; height: 20px; line-height: 1; font-family: serif } .carousel-control .icon-prev:before { content: "\2039" } .carousel-control .icon-next:before { content: "\203A" } .carousel-indicators { position: absolute; bottom: 10px; left: 50%; z-index: 15; width: 60%; margin-left: -30%; padding-left: 0; list-style: none; text-align: center } .carousel-indicators li { display: inline-block; width: 10px; height: 10px; margin: 1px; text-indent: -999px; border: 1px solid #fff; border-radius: 10px; cursor: pointer; background-color: #000 \9; background-color: transparent } .carousel-indicators .active { margin: 0; width: 12px; height: 12px; background-color: #fff } .carousel-caption { position: absolute; left: 15%; right: 15%; bottom: 20px; z-index: 10; padding-top: 20px; padding-bottom: 20px; color: #fff; text-align: center; text-shadow: 0 1px 2px rgba(0, 0, 0, .6) } .carousel-caption .btn { text-shadow: none } @media screen and (min-width: 768px) { .carousel-control .glyphicon-chevron-left, .carousel-control .glyphicon-chevron-right, .carousel-control .icon-next, .carousel-control .icon-prev { width: 30px; height: 30px; margin-top: -10px; font-size: 30px } .carousel-control .glyphicon-chevron-left, .carousel-control .icon-prev { margin-left: -10px } .carousel-control .glyphicon-chevron-right, .carousel-control .icon-next { margin-right: -10px } .carousel-caption { left: 20%; right: 20%; padding-bottom: 30px } .carousel-indicators { bottom: 20px } } .clearfix:after, .clearfix:before { content: " "; display: table } .clearfix:after { clear: both } .center-block { display: block; margin-left: auto; margin-right: auto } .pull-right { float: right !important } .pull-left { float: left !important } .hide { display: none !important } .show { display: block !important } .invisible { visibility: hidden } .text-hide { font: 0/0 a; color: transparent; text-shadow: none; background-color: transparent; border: 0 } .hidden { display: none !important } .affix { position: fixed } @-ms-viewport { width: device-width } .visible-lg, .visible-lg-block, .visible-lg-inline, .visible-lg-inline-block, .visible-md, .visible-md-block, .visible-md-inline, .visible-md-inline-block, .visible-sm, .visible-sm-block, .visible-sm-inline, .visible-sm-inline-block, .visible-xs, .visible-xs-block, .visible-xs-inline, .visible-xs-inline-block { display: none !important } @media (max-width: 767px) { .visible-xs { display: block !important } table.visible-xs { display: table !important } tr.visible-xs { display: table-row !important } td.visible-xs, th.visible-xs { display: table-cell !important } } @media (max-width: 767px) { .visible-xs-block { display: block !important } } @media (max-width: 767px) { .visible-xs-inline { display: inline !important } } @media (max-width: 767px) { .visible-xs-inline-block { display: inline-block !important } } @media (min-width: 768px) and (max-width: 991px) { .visible-sm { display: block !important } table.visible-sm { display: table !important } tr.visible-sm { display: table-row !important } td.visible-sm, th.visible-sm { display: table-cell !important } } @media (min-width: 768px) and (max-width: 991px) { .visible-sm-block { display: block !important } } @media (min-width: 768px) and (max-width: 991px) { .visible-sm-inline { display: inline !important } } @media (min-width: 768px) and (max-width: 991px) { .visible-sm-inline-block { display: inline-block !important } } @media (min-width: 992px) and (max-width: 1199px) { .visible-md { display: block !important } table.visible-md { display: table !important } tr.visible-md { display: table-row !important } td.visible-md, th.visible-md { display: table-cell !important } } @media (min-width: 992px) and (max-width: 1199px) { .visible-md-block { display: block !important } } @media (min-width: 992px) and (max-width: 1199px) { .visible-md-inline { display: inline !important } } @media (min-width: 992px) and (max-width: 1199px) { .visible-md-inline-block { display: inline-block !important } } @media (min-width: 1200px) { .visible-lg { display: block !important } table.visible-lg { display: table !important } tr.visible-lg { display: table-row !important } td.visible-lg, th.visible-lg { display: table-cell !important } } @media (min-width: 1200px) { .visible-lg-block { display: block !important } } @media (min-width: 1200px) { .visible-lg-inline { display: inline !important } } @media (min-width: 1200px) { .visible-lg-inline-block { display: inline-block !important } } @media (max-width: 767px) { .hidden-xs { display: none !important } } @media (min-width: 768px) and (max-width: 991px) { .hidden-sm { display: none !important } } @media (min-width: 992px) and (max-width: 1199px) { .hidden-md { display: none !important } } @media (min-width: 1200px) { .hidden-lg { display: none !important } } .visible-print { display: none !important } @media print { .visible-print { display: block !important } table.visible-print { display: table !important } tr.visible-print { display: table-row !important } td.visible-print, th.visible-print { display: table-cell !important } } .visible-print-block { display: none !important } @media print { .visible-print-block { display: block !important } } .visible-print-inline { display: none !important } @media print { .visible-print-inline { display: inline !important } } .visible-print-inline-block { display: none !important } @media print { .visible-print-inline-block { display: inline-block !important } } @media print { .hidden-print { display: none !important } }
ojizero/university
SoCalledAdvancedLab/ProjectSuperMarket/ServerSide/public/css/app.css
CSS
mit
137,855
var editchanges = false; var LOAD_OK = 'FALSE'; function setCollectorSpinners(){ $('#plin').spinner({ incremental: true, max: 999, min: 0, width: 3, }); $('#spin').spinner({ incremental: true, step: .1, max: 480, min: 0, width: 3 }); $('#sgyear').spinner({ incremental: true, max: 9999, min: -9999, width: 4 }); $('#sgyear').spinner( "option", "disabled", true ); //if (!Modernizr.inputtype.time){ $(function() { //$( "#tiin" ).attr('type','text'); $( "#tiin" ).timespinner(); $( "#culture" ).change(function() { var current = $( "#spinner" ).timespinner( "value" ); Globalize.culture( $(this).val() ); $( "#spinner" ).timespinner( "value", current ); }); }); //} } function setListSpinners(){ $('input[name="Playlist[]"]').spinner({ incremental: true, max: 999, min: 0, width: 3, }); $('input[name="Spoken[]"]').spinner({ incremental: true, max: 480, min: 0, width: 3, }); $('input[name="times[]"]').timespinner(); } function setSpinners(){ setCollectorSpinners(); setListSpinners(); $('#collector').unblock(); } function CritUpdate(){ $.ajax({ url: "AJAX/components/CritInfo.php", beforeSend: function() { $('#error').slideUp(); }, success: function(data) { if(data == ""){ $('#error').slideUp(); } else{ $('#error').slideDown(); } $('#error').html(data); } }); } $(document).ready(function(){ //######################################### //CheckLoad(); /*if(hasset=='FALSE'){ $.blockUI({ message: $('#Login') }); }*/ CheckDbOnLoad(); $.widget( "ui.timespinner", $.ui.spinner, { options: { // seconds step: 60 * 1000, // hours page: 60 }, _parse: function( value ) { if ( typeof value === "string" ) { // already a timestamp if ( Number( value ) == value ) { return Number( value ); } return +Globalize.parseDate( value ); } return value; }, _format: function( value ) { return Globalize.format( new Date(value), "t" ); } }); $(window).scroll(function(){ //$('#foot').offset({ top: offset.top, left: offset.left}) }); $.ajaxSetup({ type: "POST" }) $('#collector').ajaxStop(function (){ setCollectorSpinners(); $('#subcol1').removeAttr('disabled'); $('#collector').unblock(); UpdateCounts(); }); $('#list').ajaxStop(function (){ setListSpinners(); $('#list').unblock(); $('#collector').unblock(); //CheckReqs(); }); $('#list').ajaxStart(function (){ $('#list').block({ message: '<h1>Processing</h1>', css: { border: '3px solid #a00' } }); }); $('#stats').load('AJAX/showStats.php', function() { var monthNames = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ]; var dayNames= ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]; $(function() { $( "#tabs" ).tabs({ beforeLoad: function( event, ui ) { ui.panel.html("Loading Tab...");; ui.jqXHR.error(function() { ui.panel.html( "Error Loading Tab..." ); }); } }); $("#ui-tabs-1").css({width: "inherit"}); }); //$('#Date').html(monthNames[new Date.getDay()] + " " + new Date.getDate() + ' ' + monthNames[new Date.getMonth()] + ' ' + new Date.getFullYear()); }); $('#system').load('AJAX/sysCheck.php'); $('#collector').load('AJAX/components/Collector.php', function(){ setCollectorSpinners(); // AUTOCOMPLETE $('#title').autocomplete({ source: "AJAX/components/LibSearchTitle.php", minLength: 2 /*select: function( event, ui ) { log( ui.item ? "Selected: " + ui.item.value + " aka " + ui.item.id : "Nothing selected, input was " + this.value ); }*/ }); $('#Artist').autocomplete({ source: "AJAX/components/LibSearchArtist.php", minLength: 2 /*select: function( event, ui ) { log( ui.item ? "Selected: " + ui.item.value + " aka " + ui.item.id : "Nothing selected, input was " + this.value ); }*/ }); $('#Album').autocomplete({ source: "AJAX/components/LibSearchAlbum.php", minLength: 2 /*select: function( event, ui ) { log( ui.item ? "Selected: " + ui.item.value + " aka " + ui.item.id : "Nothing selected, input was " + this.value ); }*/ }); // REMOVES DISABLE (Prevents submission during load) weird, I know! $('#subcol1').removeAttr('disabled'); $('#collector').unblock(); } ); $.ajax({ url: "AJAX/components/CritInfo.php", success: function(data) { if(data == ""){ return false; } $('#error').append(data); $('#error').show(); } }); $('#info').load('AJAX/information.php', $(function() { $( "#accd" ).accordion({ collapsible: true }); }) ); //$('#list').load('AJAX/listing.php', function(){ $('#list').load('AJAX/components/list.php', function(){ //$.unblockUI(); if(LOAD_OK == 'TRUE'){ $.unblockUI(); } $('#collector').unblock(); var height_t = $("#list").height() + $('#info').height() + $('#tiin').height() + $('#system').height() + $('#status').height() + $('#jMenu').height() +$('#space').height(); if(height_t>$(window).height()){ $("#content").css({ height: height_t }); } setListSpinners(); }); //######################################### if(disable_prompt == true){ $('#newLoad').slideUp(); } setInterval( function() { // Create a newDate() object and extract the seconds of the current time on the visitor's var seconds = new Date().getSeconds(); // Add a leading zero to seconds value $("#sec").html(( seconds < 10 ? "0" : "" ) + seconds); },1000); setInterval( function() { // Create a newDate() object and extract the minutes of the current time on the visitor's var minutes = new Date().getMinutes(); // Add a leading zero to the minutes value $("#min").html(( minutes < 10 ? "0" : "" ) + minutes); },1000); setInterval( function() { // Create a newDate() object and extract the hours of the current time on the visitor's var hours = new Date().getHours(); // Add a leading zero to the hours value $("#hours").html(( hours < 10 ? "0" : "" ) + hours); }, 1000); //Verify Exit $(window).on('beforeunload', function() { /*$( "#question" ).dialog({ resizable: false, height:140, modal: true, buttons: { "Delete all items": function() { $( this ).dialog( "close" ); }, Cancel: function() { $( this ).dialog( "close" ); return false; } } });*/ if(ExitPrompt == 1){ return "Warning! Your log is currently not finalized. \nIt is recommended that you use the finalize option\nLog Options -> Finalize\n\nExiting now will automatically finalize your log for this time"; } }); $("#foot").hover(function(){$('#foot').fadeOut(100);$('#foot').fadeIn(500);}); $("span.fade").hover(function(){$('#foot').fadeOut(100);$('#foot').fadeIn(500);}); //$(document).unblockUI(); // LOAD VARIABLES if(argm!=''){ $('#loadMessage').text(argm); $('#loadMessage').addClass('ui-state-error'); //alert(argm); } //LOAD - Create Datepicker for date field $( "#datepicker" ).datepicker(); var dispCom = false; // simple jMenu plugin called //$("#jMenu").jMenu(); /*$('#ComTab').active(function(){ $('#ads').hide(); });*/ // more complex jMenu plugin called $("#jMenu").jMenu({ ulWidth : 'auto', effects : { effectSpeedOpen : 75, effectTypeOpen : 'slide', effectOpen : 'linear' }, animatedText : true, paddingLeft: 1, ulWidth: '130px' }); });
TDXDigital/TPS
TPSBIN/JS/Episode/Core.js
JavaScript
mit
8,388
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc on Mon Nov 22 22:42:37 GMT-06:00 2004 --> <TITLE> Uses of Class com.wesleyware.daowiz.fieldtypes.DoubleField </TITLE> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style"> </HEAD> <SCRIPT> function asd() { parent.document.title="Uses of Class com.wesleyware.daowiz.fieldtypes.DoubleField"; } </SCRIPT> <BODY BGCOLOR="white" onload="asd();"> <!-- ========== START OF NAVBAR ========== --> <A NAME="navbar_top"><!-- --></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"> <TR> <TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../com/wesleyware/daowiz/fieldtypes/DoubleField.html"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../index.html" TARGET="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="DoubleField.html" TARGET="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp; <SCRIPT> <!-- if(window==top) { document.writeln('<A HREF="../../../../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <!-- =========== END OF NAVBAR =========== --> <HR> <CENTER> <H2> <B>Uses of Class<br>com.wesleyware.daowiz.fieldtypes.DoubleField</B></H2> </CENTER> No usage of com.wesleyware.daowiz.fieldtypes.DoubleField <P> <HR> <!-- ========== START OF NAVBAR ========== --> <A NAME="navbar_bottom"><!-- --></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"> <TR> <TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../com/wesleyware/daowiz/fieldtypes/DoubleField.html"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../index.html" TARGET="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="DoubleField.html" TARGET="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp; <SCRIPT> <!-- if(window==top) { document.writeln('<A HREF="../../../../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <!-- =========== END OF NAVBAR =========== --> <HR> </BODY> </HTML>
wes-williams/DaoWiz
doc/com/wesleyware/daowiz/fieldtypes/class-use/DoubleField.html
HTML
mit
5,420
from pprint import pprint import json # Pygments, for reporting nicely formatted Python snippets from pygments import highlight from pygments.lexers import PythonLexer from pygments.formatters import HtmlFormatter from flask import Blueprint, send_from_directory from flask import Flask, redirect, url_for, session, request, jsonify, g,\ make_response, Response, render_template from werkzeug.utils import secure_filename from controllers.helpers import lti, get_assignments_from_request from main import app from models.models import (User, Course, Assignment, AssignmentGroup, Submission, Log) from controllers.ast_finder.ast_finder import find_elements blueprint_explain = Blueprint('explain', __name__, url_prefix='/explain') @blueprint_explain.route('/', methods=['GET', 'POST']) @blueprint_explain.route('/load', methods=['GET', 'POST']) @lti(request='initial') def load(lti=lti, lti_exception=None, assignments=None, submissions=None, embed=False): if assignments is None or submissions is None: assignments, submissions = get_assignments_from_request() if 'course_id' in request.values: course_id = int(request.values.get('course_id')) else: course_id = g.course.id if "course" in g else None MAX_QUESTIONS = 4 code, elements = submissions[0].load_explanation(MAX_QUESTIONS) return render_template('explain/explain.html', assignment= assignments[0], submission= submissions[0], code = code, course_id = course_id, elements=elements, embed=embed, user_id=g.user.id) @blueprint_explain.route('/download/', methods=['GET', 'POST']) @blueprint_explain.route('/download', methods=['GET', 'POST']) def download(): assignment_id = request.form.get('assignment_id', None) course_id = request.values.get('course_id', g.course.id if 'course' in g else None) if None in (assignment_id, course_id): return jsonify(success=False, message="No Assignment ID or Course ID given!") user = User.from_lti("canvas", session["pylti_user_id"], session.get("user_email", ""), session.get("lis_person_name_given", ""), session.get("lis_person_name_family", "")) submission = Submission.load(user.id, assignment_id) submission_destructured = submission.load_explanation() return jsonify(success=True, **submission_destructured) #TODO: I wrote book_id instead of course_id all over the place for the uploading @blueprint_explain.route('/explain/delete/', methods=['GET', 'POST']) @blueprint_explain.route('/explain/delete', methods=['GET', 'POST']) def delete(): directive_id = request.values.get('directive_id', None) book_id = request.values.get('book_id', None) student_id = request.values.get('student_id', None) if student_id: student = User.query.get(student_id) else: student = g.user if not (directive_id or book_id): return jsonify(success=False, message="Insufficient parameters! Given {}".format(request.values)) directory = os.path.join(app.config['FLASK_APP_DIR'], 'uploads', str(book_id), directive_id, str(student.id)) full_file_path = os.path.join(directory, file_name) try: os.remove(full_file_path) except OSError as e: app.logger.warning(e.args) any_files = bool(os.listdir(directory)) save_response(student_id, student.course_id, directive_id, complete=any_files, timestamp=datetime.datetime.utcnow()) return file_name @blueprint_explain.route('/explain/upload/', methods=['POST']) @blueprint_explain.route('/explain/upload', methods=['POST']) @lti(request='session', app=app) def upload(lti=lti): assignment_id = request.form.get('assignment_id', None) course_id = request.values.get('course_id', g.course.id if 'course' in g else None) if None in (assignment_id, course_id): return jsonify(success=False, message="No Assignment ID or Course ID given!") max_questions = int(request.values.get('max_questions', '4')) submission = Submission.load(g.user.id, int(assignment_id), int(course_id)) # Get the uploaded information data_file = request.files.get('files') if not data_file: return jsonify(success=False, invalid=True, message="No data file!") code_submission = data_file.read().strip() try: elements = find_elements(code_submission) except SyntaxError: return jsonify(success=True, invalid=True, message="Your python file has errors in it.") submission_destructured = submission.save_explanation_code(code_submission, elements) code, elements = submission.load_explanation(max_questions) return jsonify(success=True, invalid=False, code=code, elements=elements) @blueprint_explain.route('/explain/save/', methods=['POST']) @blueprint_explain.route('/explain/save', methods=['POST']) @lti(request='session', app=app) def save_explain(lti=lti): assignment_id = request.form.get('assignment_id', None) course_id = request.values.get('course_id', g.course.id if 'course' in g else None) if None in (assignment_id, course_id): return jsonify(success=False, message="No Assignment ID or Course ID given!") assignment_version = int(request.form.get('version', -1)) answer = request.form.get('answer', '') name = request.form.get('name', '') Submission.save_explanation_answer(g.user.id, int(assignment_id), int(course_id), name, answer) return jsonify(success=True) @blueprint_explain.route('/explain/submit/', methods=['POST']) @blueprint_explain.route('/explain/submit', methods=['POST']) @lti(request='session', app=app) def submit_explain(lti=lti): assignment_id = request.form.get('assignment_id', None) course_id = request.values.get('course_id', g.course.id if 'course' in g else None) if None in (assignment_id, course_id): return jsonify(success=False, message="No Assignment ID or Course ID given!") assignment = Assignment.by_id(int(assignment_id)) submission = Submission.save_correct(g.user.id, int(assignment_id), int(course_id)) lis_result_sourcedid = request.form.get('lis_result_sourcedid', submission.url) or None code, elements = submission.load_explanation(4) if lis_result_sourcedid is None or lis_result_sourcedid == "NOT IN SESSION": return jsonify(success=False, message="Not in a grading context.") hl_lines = [e['line'][0] for e in elements] message = """<h1>Code Annotation</h1> <div>Thank you for submitting. This activity will be graded manually, so please be patient!</div> <div><ul><li>{explanations}</li></ul></div> <div>{code}</div> """.format( code = highlight(code, PythonLexer(), HtmlFormatter(linenos=True, hl_lines=hl_lines, noclasses=True)), explanations = '</li><li>'.join( ['<b>{line} ({type}):</b> {answer}'.format(line=e['line'][0], answer=e['answer'], type=Submission.abbreviate_element_type(e['name'])) for e in sorted(elements, key=lambda e: e['line'][0])]) ) lti.post_grade(0, message, endpoint=lis_result_sourcedid) return jsonify(success=True)
RealTimeWeb/Blockpy-Server
controllers/explain.py
Python
mit
7,615
// // AppDelegate.m // UINavigationViewControllerCustomizedToolBar // // Created by liuge on 1/14/15. // Copyright (c) 2015 iLegendSoft. All rights reserved. // #import "AppDelegate.h" @interface AppDelegate () @end @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. return YES; } - (void)applicationWillResignActive:(UIApplication *)application { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. } - (void)applicationDidEnterBackground:(UIApplication *)application { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } - (void)applicationWillEnterForeground:(UIApplication *)application { // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. } - (void)applicationDidBecomeActive:(UIApplication *)application { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } - (void)applicationWillTerminate:(UIApplication *)application { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } @end
RungeZhai/UINavigationViewControllerCustomizedToolBar
UINavigationViewControllerCustomizedToolBar/AppDelegate.m
Matlab
mit
2,063
s := SolvableDBInitialize(); /* Magma printing */ s`SolvableDBName := "256S200-16,8,16-g97-path9"; s`SolvableDBFilename := "256S200-16,8,16-g97-path9.m"; s`SolvableDBPassportName := "256S200-16,8,16-g97"; s`SolvableDBPathNumber := 9; s`SolvableDBDegree := 256; s`SolvableDBOrders := \[ 16, 8, 16 ]; s`SolvableDBType := "Hyperbolic"; s`SolvableDBGenus := 97; s`SolvableDBGaloisOrbitSize := 1; s`SolvableDBPassportSize := 4; s`SolvableDBPointedPassportSize := 4; s`SolvableDBLevel := 8; s`SolvableDBBlocks := {@ PowerSet(IntegerRing()) | { IntegerRing() | 1, 5 }, { IntegerRing() | 2, 11 }, { IntegerRing() | 3, 16 }, { IntegerRing() | 4, 21 }, { IntegerRing() | 6, 24 }, { IntegerRing() | 7, 25 }, { IntegerRing() | 8, 26 }, { IntegerRing() | 9, 41 }, { IntegerRing() | 10, 46 }, { IntegerRing() | 12, 49 }, { IntegerRing() | 13, 50 }, { IntegerRing() | 14, 34 }, { IntegerRing() | 15, 60 }, { IntegerRing() | 17, 63 }, { IntegerRing() | 18, 44 }, { IntegerRing() | 19, 69 }, { IntegerRing() | 20, 72 }, { IntegerRing() | 22, 75 }, { IntegerRing() | 23, 76 }, { IntegerRing() | 27, 57 }, { IntegerRing() | 28, 81 }, { IntegerRing() | 29, 82 }, { IntegerRing() | 30, 83 }, { IntegerRing() | 31, 58 }, { IntegerRing() | 32, 84 }, { IntegerRing() | 33, 62 }, { IntegerRing() | 35, 85 }, { IntegerRing() | 36, 86 }, { IntegerRing() | 37, 87 }, { IntegerRing() | 38, 88 }, { IntegerRing() | 39, 109 }, { IntegerRing() | 40, 113 }, { IntegerRing() | 42, 116 }, { IntegerRing() | 43, 117 }, { IntegerRing() | 45, 59 }, { IntegerRing() | 47, 127 }, { IntegerRing() | 48, 66 }, { IntegerRing() | 51, 124 }, { IntegerRing() | 52, 131 }, { IntegerRing() | 53, 126 }, { IntegerRing() | 54, 132 }, { IntegerRing() | 55, 105 }, { IntegerRing() | 56, 133 }, { IntegerRing() | 61, 89 }, { IntegerRing() | 64, 148 }, { IntegerRing() | 65, 149 }, { IntegerRing() | 67, 156 }, { IntegerRing() | 68, 97 }, { IntegerRing() | 70, 161 }, { IntegerRing() | 71, 164 }, { IntegerRing() | 73, 166 }, { IntegerRing() | 74, 142 }, { IntegerRing() | 77, 170 }, { IntegerRing() | 78, 171 }, { IntegerRing() | 79, 172 }, { IntegerRing() | 80, 92 }, { IntegerRing() | 90, 158 }, { IntegerRing() | 91, 144 }, { IntegerRing() | 93, 179 }, { IntegerRing() | 94, 180 }, { IntegerRing() | 95, 181 }, { IntegerRing() | 96, 160 }, { IntegerRing() | 98, 143 }, { IntegerRing() | 99, 146 }, { IntegerRing() | 100, 147 }, { IntegerRing() | 101, 182 }, { IntegerRing() | 102, 183 }, { IntegerRing() | 103, 184 }, { IntegerRing() | 104, 137 }, { IntegerRing() | 106, 185 }, { IntegerRing() | 107, 163 }, { IntegerRing() | 108, 216 }, { IntegerRing() | 110, 217 }, { IntegerRing() | 111, 167 }, { IntegerRing() | 112, 125 }, { IntegerRing() | 114, 223 }, { IntegerRing() | 115, 130 }, { IntegerRing() | 118, 153 }, { IntegerRing() | 119, 225 }, { IntegerRing() | 120, 222 }, { IntegerRing() | 121, 226 }, { IntegerRing() | 122, 140 }, { IntegerRing() | 123, 168 }, { IntegerRing() | 128, 231 }, { IntegerRing() | 129, 232 }, { IntegerRing() | 134, 202 }, { IntegerRing() | 135, 230 }, { IntegerRing() | 136, 234 }, { IntegerRing() | 138, 235 }, { IntegerRing() | 139, 210 }, { IntegerRing() | 141, 195 }, { IntegerRing() | 145, 186 }, { IntegerRing() | 150, 213 }, { IntegerRing() | 151, 241 }, { IntegerRing() | 152, 228 }, { IntegerRing() | 154, 243 }, { IntegerRing() | 155, 244 }, { IntegerRing() | 157, 200 }, { IntegerRing() | 159, 188 }, { IntegerRing() | 162, 246 }, { IntegerRing() | 165, 205 }, { IntegerRing() | 169, 174 }, { IntegerRing() | 173, 189 }, { IntegerRing() | 175, 208 }, { IntegerRing() | 176, 211 }, { IntegerRing() | 177, 191 }, { IntegerRing() | 178, 192 }, { IntegerRing() | 187, 245 }, { IntegerRing() | 190, 214 }, { IntegerRing() | 193, 252 }, { IntegerRing() | 194, 218 }, { IntegerRing() | 196, 212 }, { IntegerRing() | 197, 251 }, { IntegerRing() | 198, 253 }, { IntegerRing() | 199, 247 }, { IntegerRing() | 201, 209 }, { IntegerRing() | 203, 239 }, { IntegerRing() | 204, 240 }, { IntegerRing() | 206, 250 }, { IntegerRing() | 207, 248 }, { IntegerRing() | 215, 221 }, { IntegerRing() | 219, 254 }, { IntegerRing() | 220, 229 }, { IntegerRing() | 224, 255 }, { IntegerRing() | 227, 236 }, { IntegerRing() | 233, 242 }, { IntegerRing() | 237, 256 }, { IntegerRing() | 238, 249 } @}; s`SolvableDBIsRamifiedAtEveryLevel := true; s`SolvableDBGaloisOrbit := [ PowerSequence(PermutationGroup<256 | \[ 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 1 ], \[ 2, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256 ]: Order := 857817775342842654119082271681232625157781520279485619859655650377269452553147589377440291360451408450375885342336584306157196834693696475322289288497426025679637332563368786442675207626794560187968867971521143307702077526646451464709187326100832876325702818980773671781454170250523018608495319068138257481070252817559459476987034665712738139286205234756808218860701203611083152093501947437109101726968262861606263662435022840944191408424615936000000000000000000000000000000000000000000000000000000000000000 >) | [ PermutationGroup<256 | \[ 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 1 ], \[ 2, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256 ]: Order := 857817775342842654119082271681232625157781520279485619859655650377269452553147589377440291360451408450375885342336584306157196834693696475322289288497426025679637332563368786442675207626794560187968867971521143307702077526646451464709187326100832876325702818980773671781454170250523018608495319068138257481070252817559459476987034665712738139286205234756808218860701203611083152093501947437109101726968262861606263662435022840944191408424615936000000000000000000000000000000000000000000000000000000000000000 > | [ 2, 9, 8, 19, 11, 1, 31, 35, 39, 13, 41, 51, 54, 18, 59, 26, 3, 66, 67, 32, 69, 4, 14, 5, 58, 85, 30, 90, 6, 96, 98, 52, 7, 44, 101, 38, 105, 56, 107, 43, 109, 118, 121, 48, 125, 50, 10, 130, 124, 132, 106, 119, 12, 136, 140, 123, 83, 143, 112, 45, 15, 25, 16, 128, 17, 115, 154, 37, 156, 36, 79, 84, 20, 27, 21, 34, 146, 22, 95, 23, 158, 24, 160, 131, 182, 88, 55, 133, 60, 187, 28, 76, 193, 29, 198, 199, 87, 201, 202, 33, 205, 104, 138, 210, 122, 211, 213, 111, 163, 218, 177, 221, 117, 40, 189, 153, 226, 141, 219, 42, 228, 229, 166, 185, 215, 49, 46, 224, 47, 173, 225, 234, 168, 236, 53, 174, 139, 212, 178, 220, 240, 57, 209, 81, 61, 134, 62, 231, 63, 64, 242, 65, 195, 110, 103, 243, 102, 245, 68, 247, 86, 70, 150, 172, 71, 72, 191, 73, 74, 99, 75, 181, 77, 142, 203, 78, 251, 80, 252, 82, 253, 165, 137, 235, 176, 89, 120, 97, 170, 91, 197, 92, 135, 93, 204, 94, 129, 114, 108, 183, 214, 227, 237, 100, 164, 208, 249, 239, 190, 192, 171, 180, 148, 144, 248, 167, 194, 179, 206, 145, 207, 116, 113, 155, 254, 152, 200, 149, 186, 126, 255, 127, 188, 169, 196, 157, 162, 151, 256, 147, 233, 159, 217, 184, 222, 161, 216, 238, 241, 175, 232, 230, 223, 250, 244, 246 ], [ 3, 10, 14, 6, 16, 27, 1, 36, 40, 44, 46, 2, 38, 25, 17, 34, 32, 12, 68, 22, 24, 61, 4, 57, 5, 86, 76, 29, 79, 70, 87, 33, 60, 7, 102, 31, 8, 51, 108, 66, 113, 9, 56, 49, 47, 18, 52, 42, 11, 88, 105, 53, 59, 137, 13, 118, 23, 37, 127, 63, 142, 15, 84, 65, 146, 116, 155, 83, 97, 19, 73, 75, 91, 20, 89, 21, 78, 150, 80, 81, 82, 172, 161, 62, 183, 58, 26, 124, 74, 188, 186, 28, 94, 191, 162, 200, 30, 103, 100, 64, 206, 143, 35, 106, 50, 138, 205, 130, 216, 39, 123, 114, 48, 119, 110, 41, 133, 140, 120, 125, 210, 43, 218, 55, 223, 45, 131, 129, 202, 217, 126, 104, 153, 135, 128, 208, 185, 54, 141, 117, 212, 72, 184, 145, 71, 147, 148, 149, 99, 169, 152, 203, 122, 221, 96, 244, 67, 159, 95, 157, 69, 90, 165, 166, 173, 144, 168, 194, 170, 171, 213, 92, 214, 77, 176, 238, 178, 93, 180, 177, 246, 250, 98, 85, 235, 164, 224, 181, 190, 163, 192, 179, 242, 220, 196, 226, 237, 236, 219, 156, 248, 230, 204, 241, 189, 201, 101, 211, 207, 195, 249, 121, 174, 107, 199, 115, 109, 229, 154, 111, 247, 112, 225, 198, 222, 139, 187, 239, 167, 231, 232, 134, 197, 175, 132, 245, 193, 136, 240, 151, 228, 251, 215, 160, 255, 158, 254, 182, 234, 209, 256, 233, 227, 243, 253, 252 ], [ 4, 7, 15, 20, 21, 28, 32, 1, 12, 45, 25, 52, 2, 57, 22, 60, 64, 3, 23, 71, 72, 77, 79, 81, 84, 5, 89, 73, 93, 6, 34, 74, 99, 27, 37, 30, 19, 8, 42, 112, 49, 119, 9, 16, 33, 59, 128, 10, 131, 11, 18, 17, 134, 55, 31, 13, 61, 14, 62, 75, 144, 146, 148, 78, 151, 46, 70, 158, 76, 95, 163, 164, 167, 150, 170, 172, 165, 175, 145, 177, 166, 179, 24, 142, 87, 83, 69, 26, 91, 92, 189, 191, 168, 195, 29, 97, 90, 36, 169, 203, 103, 160, 67, 35, 58, 38, 110, 215, 116, 219, 39, 53, 125, 224, 40, 225, 41, 48, 47, 227, 122, 51, 43, 44, 126, 202, 231, 100, 233, 113, 63, 105, 50, 65, 237, 138, 85, 98, 54, 124, 56, 213, 86, 173, 194, 174, 239, 171, 241, 190, 176, 196, 66, 157, 187, 161, 198, 80, 193, 68, 181, 197, 217, 107, 248, 111, 109, 117, 249, 205, 208, 186, 108, 238, 182, 137, 220, 226, 123, 141, 82, 184, 96, 156, 88, 218, 162, 252, 216, 250, 229, 121, 178, 130, 133, 185, 94, 159, 155, 253, 183, 149, 234, 210, 207, 199, 154, 101, 102, 132, 104, 106, 214, 206, 120, 221, 254, 115, 114, 118, 222, 236, 255, 135, 127, 140, 129, 212, 153, 256, 147, 242, 204, 235, 143, 232, 152, 201, 136, 139, 211, 240, 200, 245, 246, 251, 244, 243, 209, 247, 180, 192, 188, 223, 230, 228 ] ] ]; s`SolvableDBPassport := [ PowerSequence(PermutationGroup<256 | \[ 2, 9, 8, 19, 11, 1, 31, 35, 39, 13, 41, 51, 54, 18, 59, 26, 3, 66, 67, 32, 69, 4, 14, 5, 58, 85, 30, 90, 6, 96, 98, 52, 7, 44, 101, 38, 105, 56, 107, 43, 109, 118, 121, 48, 125, 50, 10, 130, 124, 132, 106, 119, 12, 136, 140, 123, 83, 143, 112, 45, 15, 25, 16, 128, 17, 115, 154, 37, 156, 36, 79, 84, 20, 27, 21, 34, 146, 22, 95, 23, 158, 24, 160, 131, 182, 88, 55, 133, 60, 187, 28, 76, 193, 29, 198, 199, 87, 201, 202, 33, 205, 104, 138, 210, 122, 211, 213, 111, 163, 218, 177, 221, 117, 40, 189, 153, 226, 141, 219, 42, 228, 229, 166, 185, 215, 49, 46, 224, 47, 173, 225, 234, 168, 236, 53, 174, 139, 212, 178, 220, 240, 57, 209, 81, 61, 134, 62, 231, 63, 64, 242, 65, 195, 110, 103, 243, 102, 245, 68, 247, 86, 70, 150, 172, 71, 72, 191, 73, 74, 99, 75, 181, 77, 142, 203, 78, 251, 80, 252, 82, 253, 165, 137, 235, 176, 89, 120, 97, 170, 91, 197, 92, 135, 93, 204, 94, 129, 114, 108, 183, 214, 227, 237, 100, 164, 208, 249, 239, 190, 192, 171, 180, 148, 144, 248, 167, 194, 179, 206, 145, 207, 116, 113, 155, 254, 152, 200, 149, 186, 126, 255, 127, 188, 169, 196, 157, 162, 151, 256, 147, 233, 159, 217, 184, 222, 161, 216, 238, 241, 175, 232, 230, 223, 250, 244, 246 ], \[ 3, 10, 14, 6, 16, 27, 1, 36, 40, 44, 46, 2, 38, 25, 17, 34, 32, 12, 68, 22, 24, 61, 4, 57, 5, 86, 76, 29, 79, 70, 87, 33, 60, 7, 102, 31, 8, 51, 108, 66, 113, 9, 56, 49, 47, 18, 52, 42, 11, 88, 105, 53, 59, 137, 13, 118, 23, 37, 127, 63, 142, 15, 84, 65, 146, 116, 155, 83, 97, 19, 73, 75, 91, 20, 89, 21, 78, 150, 80, 81, 82, 172, 161, 62, 183, 58, 26, 124, 74, 188, 186, 28, 94, 191, 162, 200, 30, 103, 100, 64, 206, 143, 35, 106, 50, 138, 205, 130, 216, 39, 123, 114, 48, 119, 110, 41, 133, 140, 120, 125, 210, 43, 218, 55, 223, 45, 131, 129, 202, 217, 126, 104, 153, 135, 128, 208, 185, 54, 141, 117, 212, 72, 184, 145, 71, 147, 148, 149, 99, 169, 152, 203, 122, 221, 96, 244, 67, 159, 95, 157, 69, 90, 165, 166, 173, 144, 168, 194, 170, 171, 213, 92, 214, 77, 176, 238, 178, 93, 180, 177, 246, 250, 98, 85, 235, 164, 224, 181, 190, 163, 192, 179, 242, 220, 196, 226, 237, 236, 219, 156, 248, 230, 204, 241, 189, 201, 101, 211, 207, 195, 249, 121, 174, 107, 199, 115, 109, 229, 154, 111, 247, 112, 225, 198, 222, 139, 187, 239, 167, 231, 232, 134, 197, 175, 132, 245, 193, 136, 240, 151, 228, 251, 215, 160, 255, 158, 254, 182, 234, 209, 256, 233, 227, 243, 253, 252 ], \[ 4, 7, 15, 20, 21, 28, 32, 1, 12, 45, 25, 52, 2, 57, 22, 60, 64, 3, 23, 71, 72, 77, 79, 81, 84, 5, 89, 73, 93, 6, 34, 74, 99, 27, 37, 30, 19, 8, 42, 112, 49, 119, 9, 16, 33, 59, 128, 10, 131, 11, 18, 17, 134, 55, 31, 13, 61, 14, 62, 75, 144, 146, 148, 78, 151, 46, 70, 158, 76, 95, 163, 164, 167, 150, 170, 172, 165, 175, 145, 177, 166, 179, 24, 142, 87, 83, 69, 26, 91, 92, 189, 191, 168, 195, 29, 97, 90, 36, 169, 203, 103, 160, 67, 35, 58, 38, 110, 215, 116, 219, 39, 53, 125, 224, 40, 225, 41, 48, 47, 227, 122, 51, 43, 44, 126, 202, 231, 100, 233, 113, 63, 105, 50, 65, 237, 138, 85, 98, 54, 124, 56, 213, 86, 173, 194, 174, 239, 171, 241, 190, 176, 196, 66, 157, 187, 161, 198, 80, 193, 68, 181, 197, 217, 107, 248, 111, 109, 117, 249, 205, 208, 186, 108, 238, 182, 137, 220, 226, 123, 141, 82, 184, 96, 156, 88, 218, 162, 252, 216, 250, 229, 121, 178, 130, 133, 185, 94, 159, 155, 253, 183, 149, 234, 210, 207, 199, 154, 101, 102, 132, 104, 106, 214, 206, 120, 221, 254, 115, 114, 118, 222, 236, 255, 135, 127, 140, 129, 212, 153, 256, 147, 242, 204, 235, 143, 232, 152, 201, 136, 139, 211, 240, 200, 245, 246, 251, 244, 243, 209, 247, 180, 192, 188, 223, 230, 228 ]: Order := 256 >) | [ PermutationGroup<256 | \[ 2, 9, 8, 19, 11, 1, 31, 35, 39, 13, 41, 51, 54, 18, 59, 26, 3, 66, 67, 32, 69, 4, 14, 5, 58, 85, 30, 90, 6, 96, 98, 52, 7, 44, 101, 38, 105, 56, 107, 43, 109, 118, 121, 48, 125, 50, 10, 130, 124, 132, 106, 119, 12, 136, 140, 123, 83, 143, 112, 45, 15, 25, 16, 128, 17, 115, 154, 37, 156, 36, 79, 84, 20, 27, 21, 34, 146, 22, 95, 23, 158, 24, 160, 131, 182, 88, 55, 133, 60, 187, 28, 76, 193, 29, 198, 199, 87, 201, 202, 33, 205, 104, 138, 210, 122, 211, 213, 111, 163, 218, 177, 221, 117, 40, 189, 153, 226, 141, 219, 42, 228, 229, 166, 185, 215, 49, 46, 224, 47, 173, 225, 234, 168, 236, 53, 174, 139, 212, 178, 220, 240, 57, 209, 81, 61, 134, 62, 231, 63, 64, 242, 65, 195, 110, 103, 243, 102, 245, 68, 247, 86, 70, 150, 172, 71, 72, 191, 73, 74, 99, 75, 181, 77, 142, 203, 78, 251, 80, 252, 82, 253, 165, 137, 235, 176, 89, 120, 97, 170, 91, 197, 92, 135, 93, 204, 94, 129, 114, 108, 183, 214, 227, 237, 100, 164, 208, 249, 239, 190, 192, 171, 180, 148, 144, 248, 167, 194, 179, 206, 145, 207, 116, 113, 155, 254, 152, 200, 149, 186, 126, 255, 127, 188, 169, 196, 157, 162, 151, 256, 147, 233, 159, 217, 184, 222, 161, 216, 238, 241, 175, 232, 230, 223, 250, 244, 246 ], \[ 3, 10, 14, 6, 16, 27, 1, 36, 40, 44, 46, 2, 38, 25, 17, 34, 32, 12, 68, 22, 24, 61, 4, 57, 5, 86, 76, 29, 79, 70, 87, 33, 60, 7, 102, 31, 8, 51, 108, 66, 113, 9, 56, 49, 47, 18, 52, 42, 11, 88, 105, 53, 59, 137, 13, 118, 23, 37, 127, 63, 142, 15, 84, 65, 146, 116, 155, 83, 97, 19, 73, 75, 91, 20, 89, 21, 78, 150, 80, 81, 82, 172, 161, 62, 183, 58, 26, 124, 74, 188, 186, 28, 94, 191, 162, 200, 30, 103, 100, 64, 206, 143, 35, 106, 50, 138, 205, 130, 216, 39, 123, 114, 48, 119, 110, 41, 133, 140, 120, 125, 210, 43, 218, 55, 223, 45, 131, 129, 202, 217, 126, 104, 153, 135, 128, 208, 185, 54, 141, 117, 212, 72, 184, 145, 71, 147, 148, 149, 99, 169, 152, 203, 122, 221, 96, 244, 67, 159, 95, 157, 69, 90, 165, 166, 173, 144, 168, 194, 170, 171, 213, 92, 214, 77, 176, 238, 178, 93, 180, 177, 246, 250, 98, 85, 235, 164, 224, 181, 190, 163, 192, 179, 242, 220, 196, 226, 237, 236, 219, 156, 248, 230, 204, 241, 189, 201, 101, 211, 207, 195, 249, 121, 174, 107, 199, 115, 109, 229, 154, 111, 247, 112, 225, 198, 222, 139, 187, 239, 167, 231, 232, 134, 197, 175, 132, 245, 193, 136, 240, 151, 228, 251, 215, 160, 255, 158, 254, 182, 234, 209, 256, 233, 227, 243, 253, 252 ], \[ 4, 7, 15, 20, 21, 28, 32, 1, 12, 45, 25, 52, 2, 57, 22, 60, 64, 3, 23, 71, 72, 77, 79, 81, 84, 5, 89, 73, 93, 6, 34, 74, 99, 27, 37, 30, 19, 8, 42, 112, 49, 119, 9, 16, 33, 59, 128, 10, 131, 11, 18, 17, 134, 55, 31, 13, 61, 14, 62, 75, 144, 146, 148, 78, 151, 46, 70, 158, 76, 95, 163, 164, 167, 150, 170, 172, 165, 175, 145, 177, 166, 179, 24, 142, 87, 83, 69, 26, 91, 92, 189, 191, 168, 195, 29, 97, 90, 36, 169, 203, 103, 160, 67, 35, 58, 38, 110, 215, 116, 219, 39, 53, 125, 224, 40, 225, 41, 48, 47, 227, 122, 51, 43, 44, 126, 202, 231, 100, 233, 113, 63, 105, 50, 65, 237, 138, 85, 98, 54, 124, 56, 213, 86, 173, 194, 174, 239, 171, 241, 190, 176, 196, 66, 157, 187, 161, 198, 80, 193, 68, 181, 197, 217, 107, 248, 111, 109, 117, 249, 205, 208, 186, 108, 238, 182, 137, 220, 226, 123, 141, 82, 184, 96, 156, 88, 218, 162, 252, 216, 250, 229, 121, 178, 130, 133, 185, 94, 159, 155, 253, 183, 149, 234, 210, 207, 199, 154, 101, 102, 132, 104, 106, 214, 206, 120, 221, 254, 115, 114, 118, 222, 236, 255, 135, 127, 140, 129, 212, 153, 256, 147, 242, 204, 235, 143, 232, 152, 201, 136, 139, 211, 240, 200, 245, 246, 251, 244, 243, 209, 247, 180, 192, 188, 223, 230, 228 ]: Order := 256 > | [ 6, 1, 17, 22, 24, 29, 33, 3, 2, 47, 5, 53, 10, 23, 61, 63, 65, 14, 4, 73, 75, 78, 80, 82, 62, 16, 74, 91, 94, 27, 7, 20, 100, 76, 8, 70, 68, 36, 9, 114, 11, 120, 40, 34, 60, 127, 129, 44, 126, 46, 12, 32, 135, 13, 87, 38, 142, 25, 15, 89, 145, 147, 149, 150, 152, 18, 19, 159, 21, 162, 165, 166, 168, 169, 171, 92, 173, 176, 71, 178, 144, 180, 57, 72, 26, 161, 97, 86, 186, 28, 190, 192, 194, 196, 79, 30, 188, 31, 170, 204, 35, 157, 155, 102, 37, 51, 39, 199, 41, 154, 108, 59, 223, 198, 66, 222, 113, 42, 52, 187, 43, 105, 56, 49, 45, 230, 232, 64, 197, 48, 84, 50, 88, 146, 193, 54, 183, 103, 137, 55, 118, 174, 58, 214, 220, 77, 240, 213, 228, 163, 238, 226, 116, 67, 224, 69, 236, 81, 242, 83, 246, 237, 109, 205, 182, 123, 216, 133, 234, 189, 211, 164, 130, 136, 250, 185, 111, 139, 218, 212, 172, 85, 200, 244, 124, 229, 90, 233, 115, 209, 167, 210, 93, 217, 153, 235, 191, 95, 96, 227, 98, 99, 175, 195, 101, 219, 221, 206, 143, 104, 106, 138, 107, 201, 125, 247, 243, 110, 119, 140, 112, 245, 253, 128, 131, 117, 202, 121, 122, 252, 148, 251, 241, 132, 184, 134, 203, 248, 208, 141, 249, 151, 156, 255, 158, 256, 160, 215, 207, 254, 177, 179, 181, 225, 231, 239 ], [ 19, 31, 59, 32, 69, 90, 52, 2, 51, 125, 58, 119, 9, 83, 4, 45, 128, 8, 14, 79, 84, 146, 95, 158, 131, 11, 60, 20, 193, 1, 44, 27, 202, 30, 105, 96, 67, 35, 118, 221, 124, 219, 39, 26, 7, 112, 224, 13, 225, 41, 66, 3, 236, 140, 98, 54, 15, 18, 25, 21, 81, 134, 231, 22, 242, 50, 36, 245, 34, 198, 150, 172, 191, 64, 99, 181, 71, 203, 61, 251, 72, 252, 5, 57, 55, 160, 156, 85, 28, 76, 170, 197, 73, 204, 6, 87, 187, 38, 74, 237, 138, 247, 154, 101, 143, 56, 218, 248, 153, 206, 107, 12, 215, 155, 43, 254, 109, 130, 10, 200, 229, 106, 121, 48, 49, 227, 255, 33, 188, 117, 16, 122, 132, 17, 162, 212, 182, 201, 136, 185, 123, 148, 88, 77, 93, 142, 256, 75, 233, 91, 78, 94, 115, 102, 120, 86, 114, 23, 135, 37, 253, 129, 194, 213, 238, 177, 163, 226, 241, 164, 239, 89, 111, 151, 165, 139, 145, 152, 166, 240, 24, 235, 199, 243, 133, 179, 70, 230, 167, 175, 186, 228, 80, 173, 168, 176, 29, 68, 103, 223, 137, 63, 169, 192, 249, 108, 110, 205, 104, 234, 210, 211, 144, 208, 42, 207, 250, 189, 40, 141, 116, 157, 244, 53, 46, 220, 47, 180, 195, 246, 62, 159, 100, 196, 209, 127, 65, 214, 174, 178, 171, 147, 183, 222, 161, 232, 184, 217, 190, 216, 82, 92, 97, 113, 126, 149 ], [ 8, 13, 18, 1, 26, 30, 2, 38, 43, 48, 50, 9, 56, 58, 3, 44, 52, 51, 37, 4, 5, 15, 19, 83, 11, 88, 34, 6, 95, 36, 55, 7, 45, 31, 104, 98, 35, 106, 111, 115, 117, 39, 123, 124, 10, 66, 119, 118, 41, 133, 122, 12, 112, 139, 54, 141, 14, 105, 46, 16, 57, 59, 131, 17, 134, 153, 103, 160, 87, 67, 20, 21, 28, 32, 60, 69, 22, 64, 23, 158, 24, 181, 86, 25, 137, 143, 85, 185, 27, 97, 89, 90, 29, 197, 70, 183, 96, 138, 33, 128, 208, 209, 101, 211, 132, 212, 164, 173, 167, 107, 166, 40, 130, 219, 218, 109, 168, 220, 42, 215, 192, 121, 179, 140, 113, 125, 225, 47, 227, 194, 49, 210, 195, 53, 224, 239, 176, 136, 240, 226, 180, 84, 235, 61, 79, 62, 231, 63, 202, 74, 65, 237, 229, 207, 199, 184, 154, 68, 198, 102, 156, 187, 71, 72, 77, 81, 73, 93, 99, 75, 148, 76, 144, 146, 78, 151, 80, 193, 82, 251, 161, 175, 201, 182, 196, 172, 155, 253, 91, 150, 92, 252, 159, 145, 94, 152, 162, 157, 206, 243, 238, 126, 100, 233, 170, 214, 205, 171, 249, 204, 241, 228, 142, 213, 108, 189, 163, 186, 110, 177, 216, 221, 254, 114, 116, 178, 120, 256, 191, 255, 127, 236, 129, 203, 234, 222, 135, 174, 147, 242, 149, 232, 248, 247, 244, 245, 250, 165, 169, 190, 246, 188, 200, 217, 223, 230 ] ], [ PermutationGroup<256 | \[ 2, 9, 8, 19, 11, 1, 31, 35, 39, 13, 41, 51, 54, 18, 59, 26, 3, 66, 67, 32, 69, 4, 14, 5, 58, 85, 30, 90, 6, 96, 98, 52, 7, 44, 101, 38, 105, 56, 107, 43, 109, 118, 121, 48, 125, 50, 10, 130, 124, 132, 106, 119, 12, 136, 140, 123, 83, 143, 112, 45, 15, 25, 16, 128, 17, 115, 154, 37, 156, 36, 79, 84, 20, 27, 21, 34, 146, 22, 95, 23, 158, 24, 160, 131, 182, 88, 55, 133, 60, 187, 28, 76, 193, 29, 198, 199, 87, 201, 202, 33, 205, 104, 138, 210, 122, 211, 213, 111, 163, 218, 177, 221, 117, 40, 189, 153, 226, 141, 219, 42, 228, 229, 166, 185, 215, 49, 46, 224, 47, 173, 225, 234, 168, 236, 53, 174, 139, 212, 178, 220, 240, 57, 209, 81, 61, 134, 62, 231, 63, 64, 242, 65, 195, 110, 103, 243, 102, 245, 68, 247, 86, 70, 150, 172, 71, 72, 191, 73, 74, 99, 75, 181, 77, 142, 203, 78, 251, 80, 252, 82, 253, 165, 137, 235, 176, 89, 120, 97, 170, 91, 197, 92, 135, 93, 204, 94, 129, 114, 108, 183, 214, 227, 237, 100, 164, 208, 249, 239, 190, 192, 171, 180, 148, 144, 248, 167, 194, 179, 206, 145, 207, 116, 113, 155, 254, 152, 200, 149, 186, 126, 255, 127, 188, 169, 196, 157, 162, 151, 256, 147, 233, 159, 217, 184, 222, 161, 216, 238, 241, 175, 232, 230, 223, 250, 244, 246 ], \[ 3, 10, 14, 6, 16, 27, 1, 36, 40, 44, 46, 2, 38, 25, 17, 34, 32, 12, 68, 22, 24, 61, 4, 57, 5, 86, 76, 29, 79, 70, 87, 33, 60, 7, 102, 31, 8, 51, 108, 66, 113, 9, 56, 49, 47, 18, 52, 42, 11, 88, 105, 53, 59, 137, 13, 118, 23, 37, 127, 63, 142, 15, 84, 65, 146, 116, 155, 83, 97, 19, 73, 75, 91, 20, 89, 21, 78, 150, 80, 81, 82, 172, 161, 62, 183, 58, 26, 124, 74, 188, 186, 28, 94, 191, 162, 200, 30, 103, 100, 64, 206, 143, 35, 106, 50, 138, 205, 130, 216, 39, 123, 114, 48, 119, 110, 41, 133, 140, 120, 125, 210, 43, 218, 55, 223, 45, 131, 129, 202, 217, 126, 104, 153, 135, 128, 208, 185, 54, 141, 117, 212, 72, 184, 145, 71, 147, 148, 149, 99, 169, 152, 203, 122, 221, 96, 244, 67, 159, 95, 157, 69, 90, 165, 166, 173, 144, 168, 194, 170, 171, 213, 92, 214, 77, 176, 238, 178, 93, 180, 177, 246, 250, 98, 85, 235, 164, 224, 181, 190, 163, 192, 179, 242, 220, 196, 226, 237, 236, 219, 156, 248, 230, 204, 241, 189, 201, 101, 211, 207, 195, 249, 121, 174, 107, 199, 115, 109, 229, 154, 111, 247, 112, 225, 198, 222, 139, 187, 239, 167, 231, 232, 134, 197, 175, 132, 245, 193, 136, 240, 151, 228, 251, 215, 160, 255, 158, 254, 182, 234, 209, 256, 233, 227, 243, 253, 252 ], \[ 4, 7, 15, 20, 21, 28, 32, 1, 12, 45, 25, 52, 2, 57, 22, 60, 64, 3, 23, 71, 72, 77, 79, 81, 84, 5, 89, 73, 93, 6, 34, 74, 99, 27, 37, 30, 19, 8, 42, 112, 49, 119, 9, 16, 33, 59, 128, 10, 131, 11, 18, 17, 134, 55, 31, 13, 61, 14, 62, 75, 144, 146, 148, 78, 151, 46, 70, 158, 76, 95, 163, 164, 167, 150, 170, 172, 165, 175, 145, 177, 166, 179, 24, 142, 87, 83, 69, 26, 91, 92, 189, 191, 168, 195, 29, 97, 90, 36, 169, 203, 103, 160, 67, 35, 58, 38, 110, 215, 116, 219, 39, 53, 125, 224, 40, 225, 41, 48, 47, 227, 122, 51, 43, 44, 126, 202, 231, 100, 233, 113, 63, 105, 50, 65, 237, 138, 85, 98, 54, 124, 56, 213, 86, 173, 194, 174, 239, 171, 241, 190, 176, 196, 66, 157, 187, 161, 198, 80, 193, 68, 181, 197, 217, 107, 248, 111, 109, 117, 249, 205, 208, 186, 108, 238, 182, 137, 220, 226, 123, 141, 82, 184, 96, 156, 88, 218, 162, 252, 216, 250, 229, 121, 178, 130, 133, 185, 94, 159, 155, 253, 183, 149, 234, 210, 207, 199, 154, 101, 102, 132, 104, 106, 214, 206, 120, 221, 254, 115, 114, 118, 222, 236, 255, 135, 127, 140, 129, 212, 153, 256, 147, 242, 204, 235, 143, 232, 152, 201, 136, 139, 211, 240, 200, 245, 246, 251, 244, 243, 209, 247, 180, 192, 188, 223, 230, 228 ]: Order := 256 > | [ 6, 1, 17, 22, 24, 29, 33, 3, 2, 47, 5, 53, 10, 23, 61, 63, 65, 14, 4, 73, 75, 78, 80, 82, 62, 16, 74, 91, 94, 27, 7, 20, 100, 76, 8, 70, 68, 36, 9, 114, 11, 120, 40, 34, 60, 127, 129, 44, 126, 46, 12, 32, 135, 13, 87, 38, 142, 25, 15, 89, 145, 147, 149, 150, 152, 18, 19, 159, 21, 162, 165, 166, 168, 169, 171, 92, 173, 176, 71, 178, 144, 180, 57, 72, 26, 161, 97, 86, 186, 28, 190, 192, 194, 196, 79, 30, 188, 31, 170, 204, 35, 157, 155, 102, 37, 51, 39, 199, 41, 154, 108, 59, 223, 198, 66, 222, 113, 42, 52, 187, 43, 105, 56, 49, 45, 230, 232, 64, 197, 48, 84, 50, 88, 146, 193, 54, 183, 103, 137, 55, 118, 174, 58, 214, 220, 77, 240, 213, 228, 163, 238, 226, 116, 67, 224, 69, 236, 81, 242, 83, 246, 237, 109, 205, 182, 123, 216, 133, 234, 189, 211, 164, 130, 136, 250, 185, 111, 139, 218, 212, 172, 85, 200, 244, 124, 229, 90, 233, 115, 209, 167, 210, 93, 217, 153, 235, 191, 95, 96, 227, 98, 99, 175, 195, 101, 219, 221, 206, 143, 104, 106, 138, 107, 201, 125, 247, 243, 110, 119, 140, 112, 245, 253, 128, 131, 117, 202, 121, 122, 252, 148, 251, 241, 132, 184, 134, 203, 248, 208, 141, 249, 151, 156, 255, 158, 256, 160, 215, 207, 254, 177, 179, 181, 225, 231, 239 ], [ 75, 62, 89, 166, 22, 144, 72, 24, 126, 15, 33, 84, 5, 74, 171, 61, 213, 63, 92, 205, 73, 189, 164, 91, 20, 6, 145, 123, 218, 82, 23, 174, 77, 142, 97, 57, 21, 16, 222, 45, 53, 131, 11, 17, 147, 60, 148, 127, 32, 1, 34, 149, 99, 37, 25, 46, 186, 76, 100, 78, 190, 170, 150, 211, 249, 47, 246, 28, 80, 172, 39, 165, 108, 107, 173, 71, 101, 206, 229, 167, 168, 194, 29, 169, 68, 27, 4, 3, 214, 178, 130, 111, 56, 118, 180, 159, 81, 161, 136, 208, 244, 30, 69, 26, 7, 86, 243, 112, 120, 225, 41, 230, 59, 231, 223, 52, 2, 18, 232, 134, 55, 49, 113, 14, 135, 146, 64, 240, 151, 114, 65, 87, 10, 228, 239, 184, 8, 58, 50, 12, 88, 163, 70, 115, 110, 234, 175, 176, 238, 201, 106, 138, 44, 227, 158, 162, 181, 192, 179, 188, 79, 177, 154, 109, 221, 216, 9, 40, 248, 182, 250, 220, 247, 207, 35, 102, 122, 43, 133, 153, 94, 155, 83, 19, 36, 217, 256, 93, 199, 219, 140, 117, 210, 66, 38, 51, 212, 233, 255, 95, 157, 152, 54, 137, 215, 160, 156, 85, 200, 13, 183, 124, 209, 254, 245, 125, 119, 48, 253, 116, 187, 202, 128, 252, 129, 105, 251, 235, 42, 203, 204, 241, 141, 103, 31, 197, 121, 143, 132, 104, 185, 195, 236, 90, 237, 191, 224, 67, 98, 96, 196, 139, 242, 198, 193, 226 ], [ 117, 167, 137, 184, 43, 50, 235, 175, 71, 210, 111, 196, 203, 118, 113, 104, 88, 194, 248, 49, 103, 87, 124, 13, 138, 208, 102, 244, 26, 250, 249, 116, 105, 153, 77, 195, 226, 93, 74, 178, 164, 94, 237, 218, 216, 139, 133, 91, 212, 239, 151, 217, 140, 99, 191, 28, 183, 238, 108, 40, 10, 55, 38, 223, 44, 144, 163, 54, 207, 185, 161, 12, 25, 86, 37, 51, 126, 5, 200, 31, 155, 8, 206, 42, 170, 141, 121, 179, 46, 221, 68, 58, 255, 83, 254, 189, 132, 150, 222, 11, 20, 240, 152, 193, 177, 64, 17, 92, 142, 29, 162, 165, 192, 168, 22, 180, 256, 233, 190, 229, 134, 79, 4, 241, 205, 122, 56, 247, 66, 75, 110, 146, 81, 243, 41, 32, 252, 197, 90, 172, 128, 36, 213, 97, 16, 120, 2, 114, 18, 127, 253, 131, 242, 145, 234, 107, 176, 215, 85, 173, 106, 143, 63, 70, 76, 7, 246, 21, 14, 53, 1, 157, 33, 34, 230, 60, 227, 69, 224, 30, 219, 72, 204, 228, 148, 3, 109, 35, 62, 24, 236, 19, 125, 188, 231, 181, 225, 130, 73, 211, 89, 154, 245, 59, 23, 100, 65, 135, 61, 158, 15, 95, 47, 6, 169, 80, 82, 159, 78, 27, 174, 220, 123, 182, 214, 202, 209, 52, 57, 9, 199, 48, 160, 84, 251, 201, 156, 129, 187, 45, 198, 96, 186, 136, 39, 98, 166, 149, 232, 147, 119, 112, 115, 171, 101, 67 ] ], [ PermutationGroup<256 | \[ 2, 9, 8, 19, 11, 1, 31, 35, 39, 13, 41, 51, 54, 18, 59, 26, 3, 66, 67, 32, 69, 4, 14, 5, 58, 85, 30, 90, 6, 96, 98, 52, 7, 44, 101, 38, 105, 56, 107, 43, 109, 118, 121, 48, 125, 50, 10, 130, 124, 132, 106, 119, 12, 136, 140, 123, 83, 143, 112, 45, 15, 25, 16, 128, 17, 115, 154, 37, 156, 36, 79, 84, 20, 27, 21, 34, 146, 22, 95, 23, 158, 24, 160, 131, 182, 88, 55, 133, 60, 187, 28, 76, 193, 29, 198, 199, 87, 201, 202, 33, 205, 104, 138, 210, 122, 211, 213, 111, 163, 218, 177, 221, 117, 40, 189, 153, 226, 141, 219, 42, 228, 229, 166, 185, 215, 49, 46, 224, 47, 173, 225, 234, 168, 236, 53, 174, 139, 212, 178, 220, 240, 57, 209, 81, 61, 134, 62, 231, 63, 64, 242, 65, 195, 110, 103, 243, 102, 245, 68, 247, 86, 70, 150, 172, 71, 72, 191, 73, 74, 99, 75, 181, 77, 142, 203, 78, 251, 80, 252, 82, 253, 165, 137, 235, 176, 89, 120, 97, 170, 91, 197, 92, 135, 93, 204, 94, 129, 114, 108, 183, 214, 227, 237, 100, 164, 208, 249, 239, 190, 192, 171, 180, 148, 144, 248, 167, 194, 179, 206, 145, 207, 116, 113, 155, 254, 152, 200, 149, 186, 126, 255, 127, 188, 169, 196, 157, 162, 151, 256, 147, 233, 159, 217, 184, 222, 161, 216, 238, 241, 175, 232, 230, 223, 250, 244, 246 ], \[ 3, 10, 14, 6, 16, 27, 1, 36, 40, 44, 46, 2, 38, 25, 17, 34, 32, 12, 68, 22, 24, 61, 4, 57, 5, 86, 76, 29, 79, 70, 87, 33, 60, 7, 102, 31, 8, 51, 108, 66, 113, 9, 56, 49, 47, 18, 52, 42, 11, 88, 105, 53, 59, 137, 13, 118, 23, 37, 127, 63, 142, 15, 84, 65, 146, 116, 155, 83, 97, 19, 73, 75, 91, 20, 89, 21, 78, 150, 80, 81, 82, 172, 161, 62, 183, 58, 26, 124, 74, 188, 186, 28, 94, 191, 162, 200, 30, 103, 100, 64, 206, 143, 35, 106, 50, 138, 205, 130, 216, 39, 123, 114, 48, 119, 110, 41, 133, 140, 120, 125, 210, 43, 218, 55, 223, 45, 131, 129, 202, 217, 126, 104, 153, 135, 128, 208, 185, 54, 141, 117, 212, 72, 184, 145, 71, 147, 148, 149, 99, 169, 152, 203, 122, 221, 96, 244, 67, 159, 95, 157, 69, 90, 165, 166, 173, 144, 168, 194, 170, 171, 213, 92, 214, 77, 176, 238, 178, 93, 180, 177, 246, 250, 98, 85, 235, 164, 224, 181, 190, 163, 192, 179, 242, 220, 196, 226, 237, 236, 219, 156, 248, 230, 204, 241, 189, 201, 101, 211, 207, 195, 249, 121, 174, 107, 199, 115, 109, 229, 154, 111, 247, 112, 225, 198, 222, 139, 187, 239, 167, 231, 232, 134, 197, 175, 132, 245, 193, 136, 240, 151, 228, 251, 215, 160, 255, 158, 254, 182, 234, 209, 256, 233, 227, 243, 253, 252 ], \[ 4, 7, 15, 20, 21, 28, 32, 1, 12, 45, 25, 52, 2, 57, 22, 60, 64, 3, 23, 71, 72, 77, 79, 81, 84, 5, 89, 73, 93, 6, 34, 74, 99, 27, 37, 30, 19, 8, 42, 112, 49, 119, 9, 16, 33, 59, 128, 10, 131, 11, 18, 17, 134, 55, 31, 13, 61, 14, 62, 75, 144, 146, 148, 78, 151, 46, 70, 158, 76, 95, 163, 164, 167, 150, 170, 172, 165, 175, 145, 177, 166, 179, 24, 142, 87, 83, 69, 26, 91, 92, 189, 191, 168, 195, 29, 97, 90, 36, 169, 203, 103, 160, 67, 35, 58, 38, 110, 215, 116, 219, 39, 53, 125, 224, 40, 225, 41, 48, 47, 227, 122, 51, 43, 44, 126, 202, 231, 100, 233, 113, 63, 105, 50, 65, 237, 138, 85, 98, 54, 124, 56, 213, 86, 173, 194, 174, 239, 171, 241, 190, 176, 196, 66, 157, 187, 161, 198, 80, 193, 68, 181, 197, 217, 107, 248, 111, 109, 117, 249, 205, 208, 186, 108, 238, 182, 137, 220, 226, 123, 141, 82, 184, 96, 156, 88, 218, 162, 252, 216, 250, 229, 121, 178, 130, 133, 185, 94, 159, 155, 253, 183, 149, 234, 210, 207, 199, 154, 101, 102, 132, 104, 106, 214, 206, 120, 221, 254, 115, 114, 118, 222, 236, 255, 135, 127, 140, 129, 212, 153, 256, 147, 242, 204, 235, 143, 232, 152, 201, 136, 139, 211, 240, 200, 245, 246, 251, 244, 243, 209, 247, 180, 192, 188, 223, 230, 228 ]: Order := 256 > | [ 8, 13, 18, 1, 26, 30, 2, 38, 43, 48, 50, 9, 56, 58, 3, 44, 52, 51, 37, 4, 5, 15, 19, 83, 11, 88, 34, 6, 95, 36, 55, 7, 45, 31, 104, 98, 35, 106, 111, 115, 117, 39, 123, 124, 10, 66, 119, 118, 41, 133, 122, 12, 112, 139, 54, 141, 14, 105, 46, 16, 57, 59, 131, 17, 134, 153, 103, 160, 87, 67, 20, 21, 28, 32, 60, 69, 22, 64, 23, 158, 24, 181, 86, 25, 137, 143, 85, 185, 27, 97, 89, 90, 29, 197, 70, 183, 96, 138, 33, 128, 208, 209, 101, 211, 132, 212, 164, 173, 167, 107, 166, 40, 130, 219, 218, 109, 168, 220, 42, 215, 192, 121, 179, 140, 113, 125, 225, 47, 227, 194, 49, 210, 195, 53, 224, 239, 176, 136, 240, 226, 180, 84, 235, 61, 79, 62, 231, 63, 202, 74, 65, 237, 229, 207, 199, 184, 154, 68, 198, 102, 156, 187, 71, 72, 77, 81, 73, 93, 99, 75, 148, 76, 144, 146, 78, 151, 80, 193, 82, 251, 161, 175, 201, 182, 196, 172, 155, 253, 91, 150, 92, 252, 159, 145, 94, 152, 162, 157, 206, 243, 238, 126, 100, 233, 170, 214, 205, 171, 249, 204, 241, 228, 142, 213, 108, 189, 163, 186, 110, 177, 216, 221, 254, 114, 116, 178, 120, 256, 191, 255, 127, 236, 129, 203, 234, 222, 135, 174, 147, 242, 149, 232, 248, 247, 244, 245, 250, 165, 169, 190, 246, 188, 200, 217, 223, 230 ], [ 7, 12, 1, 23, 25, 4, 34, 37, 42, 2, 49, 18, 55, 3, 62, 5, 15, 46, 70, 74, 76, 20, 57, 21, 14, 87, 6, 92, 28, 97, 36, 17, 32, 16, 103, 8, 58, 13, 110, 9, 116, 48, 122, 10, 126, 11, 45, 113, 44, 105, 38, 47, 52, 138, 124, 43, 24, 86, 53, 33, 22, 84, 60, 100, 64, 40, 157, 19, 161, 30, 145, 142, 71, 89, 72, 27, 174, 77, 29, 79, 80, 81, 68, 63, 184, 26, 31, 50, 75, 162, 73, 172, 178, 93, 159, 155, 69, 183, 149, 99, 207, 35, 98, 132, 51, 104, 214, 39, 217, 115, 220, 222, 41, 112, 216, 66, 140, 56, 114, 119, 212, 153, 111, 88, 120, 131, 59, 135, 128, 108, 127, 235, 117, 232, 134, 238, 54, 106, 226, 118, 139, 61, 102, 166, 144, 65, 146, 147, 148, 78, 240, 151, 133, 219, 67, 200, 160, 246, 158, 244, 83, 95, 190, 186, 163, 164, 229, 167, 150, 169, 170, 82, 165, 213, 234, 175, 180, 177, 192, 179, 188, 248, 85, 143, 137, 91, 227, 90, 205, 189, 94, 191, 237, 168, 210, 195, 233, 224, 215, 96, 206, 129, 152, 203, 107, 101, 209, 136, 250, 121, 208, 141, 171, 173, 243, 109, 130, 123, 199, 194, 154, 225, 125, 187, 223, 196, 253, 241, 218, 202, 230, 231, 252, 249, 185, 198, 197, 176, 228, 239, 204, 193, 254, 156, 236, 181, 221, 201, 211, 182, 242, 256, 255, 247, 245, 251 ], [ 6, 1, 17, 22, 24, 29, 33, 3, 2, 47, 5, 53, 10, 23, 61, 63, 65, 14, 4, 73, 75, 78, 80, 82, 62, 16, 74, 91, 94, 27, 7, 20, 100, 76, 8, 70, 68, 36, 9, 114, 11, 120, 40, 34, 60, 127, 129, 44, 126, 46, 12, 32, 135, 13, 87, 38, 142, 25, 15, 89, 145, 147, 149, 150, 152, 18, 19, 159, 21, 162, 165, 166, 168, 169, 171, 92, 173, 176, 71, 178, 144, 180, 57, 72, 26, 161, 97, 86, 186, 28, 190, 192, 194, 196, 79, 30, 188, 31, 170, 204, 35, 157, 155, 102, 37, 51, 39, 199, 41, 154, 108, 59, 223, 198, 66, 222, 113, 42, 52, 187, 43, 105, 56, 49, 45, 230, 232, 64, 197, 48, 84, 50, 88, 146, 193, 54, 183, 103, 137, 55, 118, 174, 58, 214, 220, 77, 240, 213, 228, 163, 238, 226, 116, 67, 224, 69, 236, 81, 242, 83, 246, 237, 109, 205, 182, 123, 216, 133, 234, 189, 211, 164, 130, 136, 250, 185, 111, 139, 218, 212, 172, 85, 200, 244, 124, 229, 90, 233, 115, 209, 167, 210, 93, 217, 153, 235, 191, 95, 96, 227, 98, 99, 175, 195, 101, 219, 221, 206, 143, 104, 106, 138, 107, 201, 125, 247, 243, 110, 119, 140, 112, 245, 253, 128, 131, 117, 202, 121, 122, 252, 148, 251, 241, 132, 184, 134, 203, 248, 208, 141, 249, 151, 156, 255, 158, 256, 160, 215, 207, 254, 177, 179, 181, 225, 231, 239 ] ], [ PermutationGroup<256 | \[ 2, 9, 8, 19, 11, 1, 31, 35, 39, 13, 41, 51, 54, 18, 59, 26, 3, 66, 67, 32, 69, 4, 14, 5, 58, 85, 30, 90, 6, 96, 98, 52, 7, 44, 101, 38, 105, 56, 107, 43, 109, 118, 121, 48, 125, 50, 10, 130, 124, 132, 106, 119, 12, 136, 140, 123, 83, 143, 112, 45, 15, 25, 16, 128, 17, 115, 154, 37, 156, 36, 79, 84, 20, 27, 21, 34, 146, 22, 95, 23, 158, 24, 160, 131, 182, 88, 55, 133, 60, 187, 28, 76, 193, 29, 198, 199, 87, 201, 202, 33, 205, 104, 138, 210, 122, 211, 213, 111, 163, 218, 177, 221, 117, 40, 189, 153, 226, 141, 219, 42, 228, 229, 166, 185, 215, 49, 46, 224, 47, 173, 225, 234, 168, 236, 53, 174, 139, 212, 178, 220, 240, 57, 209, 81, 61, 134, 62, 231, 63, 64, 242, 65, 195, 110, 103, 243, 102, 245, 68, 247, 86, 70, 150, 172, 71, 72, 191, 73, 74, 99, 75, 181, 77, 142, 203, 78, 251, 80, 252, 82, 253, 165, 137, 235, 176, 89, 120, 97, 170, 91, 197, 92, 135, 93, 204, 94, 129, 114, 108, 183, 214, 227, 237, 100, 164, 208, 249, 239, 190, 192, 171, 180, 148, 144, 248, 167, 194, 179, 206, 145, 207, 116, 113, 155, 254, 152, 200, 149, 186, 126, 255, 127, 188, 169, 196, 157, 162, 151, 256, 147, 233, 159, 217, 184, 222, 161, 216, 238, 241, 175, 232, 230, 223, 250, 244, 246 ], \[ 3, 10, 14, 6, 16, 27, 1, 36, 40, 44, 46, 2, 38, 25, 17, 34, 32, 12, 68, 22, 24, 61, 4, 57, 5, 86, 76, 29, 79, 70, 87, 33, 60, 7, 102, 31, 8, 51, 108, 66, 113, 9, 56, 49, 47, 18, 52, 42, 11, 88, 105, 53, 59, 137, 13, 118, 23, 37, 127, 63, 142, 15, 84, 65, 146, 116, 155, 83, 97, 19, 73, 75, 91, 20, 89, 21, 78, 150, 80, 81, 82, 172, 161, 62, 183, 58, 26, 124, 74, 188, 186, 28, 94, 191, 162, 200, 30, 103, 100, 64, 206, 143, 35, 106, 50, 138, 205, 130, 216, 39, 123, 114, 48, 119, 110, 41, 133, 140, 120, 125, 210, 43, 218, 55, 223, 45, 131, 129, 202, 217, 126, 104, 153, 135, 128, 208, 185, 54, 141, 117, 212, 72, 184, 145, 71, 147, 148, 149, 99, 169, 152, 203, 122, 221, 96, 244, 67, 159, 95, 157, 69, 90, 165, 166, 173, 144, 168, 194, 170, 171, 213, 92, 214, 77, 176, 238, 178, 93, 180, 177, 246, 250, 98, 85, 235, 164, 224, 181, 190, 163, 192, 179, 242, 220, 196, 226, 237, 236, 219, 156, 248, 230, 204, 241, 189, 201, 101, 211, 207, 195, 249, 121, 174, 107, 199, 115, 109, 229, 154, 111, 247, 112, 225, 198, 222, 139, 187, 239, 167, 231, 232, 134, 197, 175, 132, 245, 193, 136, 240, 151, 228, 251, 215, 160, 255, 158, 254, 182, 234, 209, 256, 233, 227, 243, 253, 252 ], \[ 4, 7, 15, 20, 21, 28, 32, 1, 12, 45, 25, 52, 2, 57, 22, 60, 64, 3, 23, 71, 72, 77, 79, 81, 84, 5, 89, 73, 93, 6, 34, 74, 99, 27, 37, 30, 19, 8, 42, 112, 49, 119, 9, 16, 33, 59, 128, 10, 131, 11, 18, 17, 134, 55, 31, 13, 61, 14, 62, 75, 144, 146, 148, 78, 151, 46, 70, 158, 76, 95, 163, 164, 167, 150, 170, 172, 165, 175, 145, 177, 166, 179, 24, 142, 87, 83, 69, 26, 91, 92, 189, 191, 168, 195, 29, 97, 90, 36, 169, 203, 103, 160, 67, 35, 58, 38, 110, 215, 116, 219, 39, 53, 125, 224, 40, 225, 41, 48, 47, 227, 122, 51, 43, 44, 126, 202, 231, 100, 233, 113, 63, 105, 50, 65, 237, 138, 85, 98, 54, 124, 56, 213, 86, 173, 194, 174, 239, 171, 241, 190, 176, 196, 66, 157, 187, 161, 198, 80, 193, 68, 181, 197, 217, 107, 248, 111, 109, 117, 249, 205, 208, 186, 108, 238, 182, 137, 220, 226, 123, 141, 82, 184, 96, 156, 88, 218, 162, 252, 216, 250, 229, 121, 178, 130, 133, 185, 94, 159, 155, 253, 183, 149, 234, 210, 207, 199, 154, 101, 102, 132, 104, 106, 214, 206, 120, 221, 254, 115, 114, 118, 222, 236, 255, 135, 127, 140, 129, 212, 153, 256, 147, 242, 204, 235, 143, 232, 152, 201, 136, 139, 211, 240, 200, 245, 246, 251, 244, 243, 209, 247, 180, 192, 188, 223, 230, 228 ]: Order := 256 > | [ 8, 13, 18, 1, 26, 30, 2, 38, 43, 48, 50, 9, 56, 58, 3, 44, 52, 51, 37, 4, 5, 15, 19, 83, 11, 88, 34, 6, 95, 36, 55, 7, 45, 31, 104, 98, 35, 106, 111, 115, 117, 39, 123, 124, 10, 66, 119, 118, 41, 133, 122, 12, 112, 139, 54, 141, 14, 105, 46, 16, 57, 59, 131, 17, 134, 153, 103, 160, 87, 67, 20, 21, 28, 32, 60, 69, 22, 64, 23, 158, 24, 181, 86, 25, 137, 143, 85, 185, 27, 97, 89, 90, 29, 197, 70, 183, 96, 138, 33, 128, 208, 209, 101, 211, 132, 212, 164, 173, 167, 107, 166, 40, 130, 219, 218, 109, 168, 220, 42, 215, 192, 121, 179, 140, 113, 125, 225, 47, 227, 194, 49, 210, 195, 53, 224, 239, 176, 136, 240, 226, 180, 84, 235, 61, 79, 62, 231, 63, 202, 74, 65, 237, 229, 207, 199, 184, 154, 68, 198, 102, 156, 187, 71, 72, 77, 81, 73, 93, 99, 75, 148, 76, 144, 146, 78, 151, 80, 193, 82, 251, 161, 175, 201, 182, 196, 172, 155, 253, 91, 150, 92, 252, 159, 145, 94, 152, 162, 157, 206, 243, 238, 126, 100, 233, 170, 214, 205, 171, 249, 204, 241, 228, 142, 213, 108, 189, 163, 186, 110, 177, 216, 221, 254, 114, 116, 178, 120, 256, 191, 255, 127, 236, 129, 203, 234, 222, 135, 174, 147, 242, 149, 232, 248, 247, 244, 245, 250, 165, 169, 190, 246, 188, 200, 217, 223, 230 ], [ 143, 185, 41, 44, 98, 156, 66, 140, 195, 109, 106, 130, 229, 85, 31, 9, 125, 54, 88, 83, 18, 131, 96, 67, 48, 122, 11, 14, 245, 105, 133, 26, 225, 35, 196, 182, 201, 234, 93, 163, 141, 189, 145, 132, 51, 39, 221, 121, 115, 220, 168, 50, 254, 94, 211, 152, 2, 56, 124, 58, 69, 119, 112, 25, 255, 226, 137, 243, 38, 247, 60, 30, 181, 59, 52, 160, 27, 202, 5, 253, 34, 187, 55, 8, 212, 101, 209, 136, 19, 86, 84, 198, 76, 230, 87, 235, 154, 210, 3, 236, 151, 165, 190, 174, 176, 178, 28, 150, 179, 77, 89, 118, 107, 248, 177, 173, 186, 73, 117, 250, 29, 240, 197, 123, 153, 219, 215, 49, 244, 191, 13, 180, 228, 10, 200, 233, 169, 78, 149, 204, 92, 45, 139, 32, 90, 16, 227, 7, 224, 21, 33, 188, 166, 175, 217, 104, 108, 36, 120, 138, 199, 223, 81, 15, 148, 95, 61, 251, 231, 57, 134, 1, 172, 128, 142, 256, 6, 129, 23, 135, 37, 241, 205, 214, 192, 158, 102, 222, 79, 146, 24, 232, 161, 72, 80, 147, 68, 184, 249, 216, 203, 46, 63, 246, 64, 71, 144, 74, 239, 65, 237, 100, 4, 99, 218, 213, 170, 20, 167, 252, 194, 206, 207, 116, 43, 82, 40, 159, 193, 157, 12, 155, 53, 242, 171, 113, 127, 75, 17, 162, 62, 126, 208, 110, 183, 114, 238, 91, 22, 164, 97, 70, 103, 111, 42, 47 ], [ 213, 148, 164, 218, 150, 107, 144, 172, 231, 142, 64, 75, 57, 170, 249, 71, 205, 99, 179, 206, 194, 110, 189, 163, 91, 79, 111, 118, 39, 177, 81, 208, 214, 77, 181, 72, 89, 84, 255, 63, 128, 62, 16, 146, 151, 74, 174, 134, 22, 27, 21, 239, 171, 83, 15, 131, 167, 28, 241, 238, 207, 190, 165, 138, 101, 202, 252, 186, 93, 166, 40, 250, 219, 108, 217, 173, 102, 154, 43, 115, 153, 109, 191, 175, 95, 20, 61, 32, 248, 141, 42, 130, 51, 9, 121, 251, 145, 158, 137, 201, 253, 76, 24, 34, 60, 69, 244, 127, 224, 126, 46, 233, 17, 149, 227, 33, 3, 25, 256, 147, 26, 45, 225, 4, 242, 78, 169, 212, 136, 236, 203, 30, 52, 210, 211, 160, 14, 5, 18, 59, 58, 216, 90, 116, 221, 104, 209, 235, 182, 103, 105, 35, 7, 230, 82, 193, 92, 195, 229, 197, 73, 123, 155, 113, 114, 254, 10, 119, 199, 183, 243, 117, 157, 247, 36, 67, 50, 66, 124, 41, 226, 198, 23, 6, 19, 215, 240, 220, 200, 120, 13, 48, 106, 12, 31, 2, 54, 228, 232, 80, 245, 139, 38, 98, 223, 161, 97, 86, 187, 44, 156, 11, 184, 222, 159, 47, 53, 49, 246, 112, 188, 100, 65, 180, 237, 8, 178, 85, 125, 176, 196, 234, 140, 96, 1, 192, 56, 37, 88, 143, 55, 122, 135, 29, 204, 168, 129, 68, 87, 70, 132, 185, 152, 162, 94, 133 ] ] ]; s`SolvableDBPointedPassport := [ PowerSequence(PermutationGroup<256 | \[ 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 1 ], \[ 2, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256 ]: Order := 857817775342842654119082271681232625157781520279485619859655650377269452553147589377440291360451408450375885342336584306157196834693696475322289288497426025679637332563368786442675207626794560187968867971521143307702077526646451464709187326100832876325702818980773671781454170250523018608495319068138257481070252817559459476987034665712738139286205234756808218860701203611083152093501947437109101726968262861606263662435022840944191408424615936000000000000000000000000000000000000000000000000000000000000000 >) | [ PermutationGroup<256 | \[ 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 1 ], \[ 2, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256 ]: Order := 857817775342842654119082271681232625157781520279485619859655650377269452553147589377440291360451408450375885342336584306157196834693696475322289288497426025679637332563368786442675207626794560187968867971521143307702077526646451464709187326100832876325702818980773671781454170250523018608495319068138257481070252817559459476987034665712738139286205234756808218860701203611083152093501947437109101726968262861606263662435022840944191408424615936000000000000000000000000000000000000000000000000000000000000000 > | [ 15, 45, 57, 28, 60, 89, 4, 30, 112, 16, 59, 7, 8, 84, 64, 27, 74, 52, 158, 77, 81, 144, 20, 61, 21, 83, 172, 93, 145, 95, 69, 99, 75, 32, 160, 34, 1, 18, 215, 46, 125, 12, 13, 131, 128, 3, 17, 119, 25, 26, 58, 134, 62, 85, 2, 48, 79, 19, 231, 148, 213, 22, 142, 151, 174, 225, 187, 24, 90, 23, 167, 170, 189, 71, 91, 72, 175, 190, 177, 166, 179, 186, 181, 146, 96, 14, 5, 44, 150, 252, 218, 73, 195, 229, 197, 253, 6, 67, 203, 78, 199, 86, 37, 38, 11, 98, 207, 113, 221, 42, 43, 224, 10, 47, 219, 49, 50, 124, 227, 126, 132, 9, 115, 31, 255, 33, 63, 233, 149, 254, 202, 35, 66, 237, 100, 101, 88, 55, 56, 41, 106, 164, 156, 194, 163, 239, 171, 241, 169, 249, 196, 234, 51, 222, 97, 245, 70, 193, 29, 198, 76, 92, 248, 111, 108, 173, 117, 130, 205, 208, 214, 191, 206, 165, 137, 201, 226, 168, 141, 220, 251, 247, 36, 87, 143, 107, 135, 82, 250, 217, 121, 123, 240, 118, 185, 140, 152, 232, 114, 161, 243, 256, 210, 211, 216, 183, 103, 104, 154, 133, 209, 122, 238, 110, 155, 40, 116, 153, 157, 39, 244, 53, 127, 159, 236, 54, 162, 136, 109, 147, 242, 65, 94, 182, 105, 246, 178, 138, 139, 176, 212, 180, 120, 68, 230, 80, 223, 184, 235, 102, 228, 204, 129, 200, 188, 192 ], [ 187, 67, 224, 134, 245, 135, 227, 112, 98, 155, 156, 157, 215, 198, 158, 255, 159, 160, 52, 197, 202, 237, 232, 230, 236, 125, 128, 99, 100, 45, 119, 95, 162, 253, 9, 114, 222, 199, 106, 103, 143, 183, 207, 96, 69, 244, 97, 85, 200, 221, 219, 30, 70, 39, 243, 101, 231, 225, 19, 90, 193, 246, 188, 28, 29, 35, 18, 53, 131, 47, 151, 251, 152, 233, 256, 129, 177, 178, 64, 65, 146, 147, 59, 181, 41, 223, 120, 247, 252, 32, 203, 149, 77, 78, 15, 2, 126, 48, 172, 92, 122, 40, 42, 216, 154, 115, 141, 138, 185, 104, 238, 58, 184, 37, 132, 102, 248, 206, 8, 36, 107, 209, 136, 254, 31, 161, 68, 4, 6, 54, 83, 109, 182, 57, 23, 220, 108, 110, 165, 201, 173, 242, 66, 239, 240, 79, 80, 81, 82, 93, 144, 145, 250, 38, 12, 44, 46, 84, 62, 11, 127, 17, 195, 241, 196, 228, 249, 234, 94, 191, 192, 148, 226, 180, 167, 168, 213, 174, 170, 171, 60, 140, 113, 116, 130, 204, 34, 33, 121, 210, 150, 169, 20, 175, 189, 190, 89, 1, 55, 10, 56, 27, 71, 73, 212, 43, 153, 111, 133, 205, 123, 214, 179, 139, 124, 235, 137, 208, 13, 176, 51, 86, 87, 7, 26, 163, 16, 186, 211, 76, 21, 24, 75, 229, 217, 3, 74, 194, 164, 166, 91, 22, 88, 49, 14, 63, 105, 118, 218, 117, 61, 72, 5, 50, 25, 142 ], [ 114, 199, 157, 224, 223, 47, 155, 219, 101, 183, 247, 103, 206, 222, 198, 200, 70, 154, 112, 135, 255, 159, 53, 127, 244, 254, 227, 128, 17, 119, 215, 187, 97, 120, 115, 42, 40, 110, 136, 104, 182, 138, 208, 243, 96, 102, 36, 201, 184, 250, 207, 67, 37, 173, 108, 214, 236, 221, 160, 253, 232, 68, 161, 95, 23, 209, 9, 46, 125, 12, 237, 230, 100, 162, 188, 126, 193, 29, 134, 62, 231, 63, 225, 245, 130, 116, 113, 217, 129, 45, 233, 33, 64, 74, 52, 48, 10, 39, 90, 6, 123, 153, 43, 218, 216, 107, 228, 139, 234, 212, 239, 35, 137, 38, 211, 235, 175, 238, 98, 55, 170, 205, 171, 248, 85, 87, 86, 30, 34, 176, 156, 189, 190, 19, 1, 166, 194, 111, 144, 165, 213, 246, 109, 242, 65, 158, 24, 181, 76, 197, 79, 20, 249, 122, 13, 41, 51, 59, 3, 66, 49, 7, 152, 256, 178, 147, 203, 78, 92, 252, 82, 202, 240, 80, 93, 145, 146, 22, 148, 142, 131, 168, 118, 117, 163, 149, 2, 16, 204, 94, 99, 75, 15, 151, 150, 71, 32, 18, 56, 124, 220, 69, 28, 89, 192, 141, 121, 179, 229, 91, 186, 164, 251, 180, 54, 210, 196, 241, 106, 174, 132, 105, 88, 8, 143, 77, 31, 72, 169, 5, 83, 14, 27, 73, 167, 58, 4, 177, 81, 61, 172, 57, 140, 50, 11, 25, 133, 226, 191, 195, 84, 60, 44, 185, 26, 21 ] ], [ PermutationGroup<256 | \[ 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 1 ], \[ 2, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256 ]: Order := 857817775342842654119082271681232625157781520279485619859655650377269452553147589377440291360451408450375885342336584306157196834693696475322289288497426025679637332563368786442675207626794560187968867971521143307702077526646451464709187326100832876325702818980773671781454170250523018608495319068138257481070252817559459476987034665712738139286205234756808218860701203611083152093501947437109101726968262861606263662435022840944191408424615936000000000000000000000000000000000000000000000000000000000000000 > | [ 15, 45, 57, 28, 60, 89, 4, 30, 112, 16, 59, 7, 8, 84, 64, 27, 74, 52, 158, 77, 81, 144, 20, 61, 21, 83, 172, 93, 145, 95, 69, 99, 75, 32, 160, 34, 1, 18, 215, 46, 125, 12, 13, 131, 128, 3, 17, 119, 25, 26, 58, 134, 62, 85, 2, 48, 79, 19, 231, 148, 213, 22, 142, 151, 174, 225, 187, 24, 90, 23, 167, 170, 189, 71, 91, 72, 175, 190, 177, 166, 179, 186, 181, 146, 96, 14, 5, 44, 150, 252, 218, 73, 195, 229, 197, 253, 6, 67, 203, 78, 199, 86, 37, 38, 11, 98, 207, 113, 221, 42, 43, 224, 10, 47, 219, 49, 50, 124, 227, 126, 132, 9, 115, 31, 255, 33, 63, 233, 149, 254, 202, 35, 66, 237, 100, 101, 88, 55, 56, 41, 106, 164, 156, 194, 163, 239, 171, 241, 169, 249, 196, 234, 51, 222, 97, 245, 70, 193, 29, 198, 76, 92, 248, 111, 108, 173, 117, 130, 205, 208, 214, 191, 206, 165, 137, 201, 226, 168, 141, 220, 251, 247, 36, 87, 143, 107, 135, 82, 250, 217, 121, 123, 240, 118, 185, 140, 152, 232, 114, 161, 243, 256, 210, 211, 216, 183, 103, 104, 154, 133, 209, 122, 238, 110, 155, 40, 116, 153, 157, 39, 244, 53, 127, 159, 236, 54, 162, 136, 109, 147, 242, 65, 94, 182, 105, 246, 178, 138, 139, 176, 212, 180, 120, 68, 230, 80, 223, 184, 235, 102, 228, 204, 129, 200, 188, 192 ], [ 147, 230, 82, 192, 100, 171, 80, 188, 245, 24, 135, 76, 68, 149, 204, 29, 186, 129, 256, 136, 178, 123, 169, 78, 92, 159, 180, 139, 214, 242, 246, 228, 166, 65, 255, 63, 33, 127, 156, 5, 187, 14, 87, 232, 193, 6, 61, 198, 23, 97, 161, 251, 72, 244, 53, 223, 94, 162, 252, 240, 211, 73, 145, 141, 107, 253, 202, 75, 237, 142, 122, 234, 101, 220, 168, 174, 132, 115, 212, 205, 210, 190, 233, 152, 224, 17, 62, 47, 176, 239, 56, 165, 104, 110, 241, 231, 22, 236, 226, 173, 125, 16, 25, 10, 126, 200, 143, 11, 67, 44, 105, 90, 1, 60, 96, 34, 37, 86, 181, 84, 184, 120, 247, 70, 158, 20, 89, 179, 213, 160, 197, 155, 114, 191, 170, 221, 46, 49, 40, 222, 102, 229, 227, 133, 209, 121, 189, 195, 163, 106, 153, 207, 36, 131, 21, 134, 27, 203, 91, 128, 74, 164, 98, 140, 9, 182, 55, 199, 39, 54, 130, 196, 35, 109, 13, 219, 235, 216, 137, 217, 151, 112, 3, 7, 157, 201, 146, 144, 85, 48, 138, 108, 208, 38, 183, 42, 238, 148, 59, 57, 225, 177, 43, 206, 41, 26, 31, 50, 119, 113, 254, 116, 185, 66, 19, 2, 18, 88, 83, 154, 69, 32, 15, 81, 95, 103, 79, 248, 243, 77, 93, 150, 194, 215, 12, 172, 111, 51, 117, 250, 118, 218, 52, 4, 99, 71, 45, 58, 124, 8, 249, 175, 64, 30, 28, 167 ], [ 117, 167, 137, 184, 43, 50, 235, 175, 71, 210, 111, 196, 203, 118, 113, 104, 88, 194, 248, 49, 103, 87, 124, 13, 138, 208, 102, 244, 26, 250, 249, 116, 105, 153, 77, 195, 226, 93, 74, 178, 164, 94, 237, 218, 216, 139, 133, 91, 212, 239, 151, 217, 140, 99, 191, 28, 183, 238, 108, 40, 10, 55, 38, 223, 44, 144, 163, 54, 207, 185, 161, 12, 25, 86, 37, 51, 126, 5, 200, 31, 155, 8, 206, 42, 170, 141, 121, 179, 46, 221, 68, 58, 255, 83, 254, 189, 132, 150, 222, 11, 20, 240, 152, 193, 177, 64, 17, 92, 142, 29, 162, 165, 192, 168, 22, 180, 256, 233, 190, 229, 134, 79, 4, 241, 205, 122, 56, 247, 66, 75, 110, 146, 81, 243, 41, 32, 252, 197, 90, 172, 128, 36, 213, 97, 16, 120, 2, 114, 18, 127, 253, 131, 242, 145, 234, 107, 176, 215, 85, 173, 106, 143, 63, 70, 76, 7, 246, 21, 14, 53, 1, 157, 33, 34, 230, 60, 227, 69, 224, 30, 219, 72, 204, 228, 148, 3, 109, 35, 62, 24, 236, 19, 125, 188, 231, 181, 225, 130, 73, 211, 89, 154, 245, 59, 23, 100, 65, 135, 61, 158, 15, 95, 47, 6, 169, 80, 82, 159, 78, 27, 174, 220, 123, 182, 214, 202, 209, 52, 57, 9, 199, 48, 160, 84, 251, 201, 156, 129, 187, 45, 198, 96, 186, 136, 39, 98, 166, 149, 232, 147, 119, 112, 115, 171, 101, 67 ] ], [ PermutationGroup<256 | \[ 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 1 ], \[ 2, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256 ]: Order := 857817775342842654119082271681232625157781520279485619859655650377269452553147589377440291360451408450375885342336584306157196834693696475322289288497426025679637332563368786442675207626794560187968867971521143307702077526646451464709187326100832876325702818980773671781454170250523018608495319068138257481070252817559459476987034665712738139286205234756808218860701203611083152093501947437109101726968262861606263662435022840944191408424615936000000000000000000000000000000000000000000000000000000000000000 > | [ 114, 199, 157, 224, 223, 47, 155, 219, 101, 183, 247, 103, 206, 222, 198, 200, 70, 154, 112, 135, 255, 159, 53, 127, 244, 254, 227, 128, 17, 119, 215, 187, 97, 120, 115, 42, 40, 110, 136, 104, 182, 138, 208, 243, 96, 102, 36, 201, 184, 250, 207, 67, 37, 173, 108, 214, 236, 221, 160, 253, 232, 68, 161, 95, 23, 209, 9, 46, 125, 12, 237, 230, 100, 162, 188, 126, 193, 29, 134, 62, 231, 63, 225, 245, 130, 116, 113, 217, 129, 45, 233, 33, 64, 74, 52, 48, 10, 39, 90, 6, 123, 153, 43, 218, 216, 107, 228, 139, 234, 212, 239, 35, 137, 38, 211, 235, 175, 238, 98, 55, 170, 205, 171, 248, 85, 87, 86, 30, 34, 176, 156, 189, 190, 19, 1, 166, 194, 111, 144, 165, 213, 246, 109, 242, 65, 158, 24, 181, 76, 197, 79, 20, 249, 122, 13, 41, 51, 59, 3, 66, 49, 7, 152, 256, 178, 147, 203, 78, 92, 252, 82, 202, 240, 80, 93, 145, 146, 22, 148, 142, 131, 168, 118, 117, 163, 149, 2, 16, 204, 94, 99, 75, 15, 151, 150, 71, 32, 18, 56, 124, 220, 69, 28, 89, 192, 141, 121, 179, 229, 91, 186, 164, 251, 180, 54, 210, 196, 241, 106, 174, 132, 105, 88, 8, 143, 77, 31, 72, 169, 5, 83, 14, 27, 73, 167, 58, 4, 177, 81, 61, 172, 57, 140, 50, 11, 25, 133, 226, 191, 195, 84, 60, 44, 185, 26, 21 ], [ 187, 67, 224, 134, 245, 135, 227, 112, 98, 155, 156, 157, 215, 198, 158, 255, 159, 160, 52, 197, 202, 237, 232, 230, 236, 125, 128, 99, 100, 45, 119, 95, 162, 253, 9, 114, 222, 199, 106, 103, 143, 183, 207, 96, 69, 244, 97, 85, 200, 221, 219, 30, 70, 39, 243, 101, 231, 225, 19, 90, 193, 246, 188, 28, 29, 35, 18, 53, 131, 47, 151, 251, 152, 233, 256, 129, 177, 178, 64, 65, 146, 147, 59, 181, 41, 223, 120, 247, 252, 32, 203, 149, 77, 78, 15, 2, 126, 48, 172, 92, 122, 40, 42, 216, 154, 115, 141, 138, 185, 104, 238, 58, 184, 37, 132, 102, 248, 206, 8, 36, 107, 209, 136, 254, 31, 161, 68, 4, 6, 54, 83, 109, 182, 57, 23, 220, 108, 110, 165, 201, 173, 242, 66, 239, 240, 79, 80, 81, 82, 93, 144, 145, 250, 38, 12, 44, 46, 84, 62, 11, 127, 17, 195, 241, 196, 228, 249, 234, 94, 191, 192, 148, 226, 180, 167, 168, 213, 174, 170, 171, 60, 140, 113, 116, 130, 204, 34, 33, 121, 210, 150, 169, 20, 175, 189, 190, 89, 1, 55, 10, 56, 27, 71, 73, 212, 43, 153, 111, 133, 205, 123, 214, 179, 139, 124, 235, 137, 208, 13, 176, 51, 86, 87, 7, 26, 163, 16, 186, 211, 76, 21, 24, 75, 229, 217, 3, 74, 194, 164, 166, 91, 22, 88, 49, 14, 63, 105, 118, 218, 117, 61, 72, 5, 50, 25, 142 ], [ 6, 1, 17, 22, 24, 29, 33, 3, 2, 47, 5, 53, 10, 23, 61, 63, 65, 14, 4, 73, 75, 78, 80, 82, 62, 16, 74, 91, 94, 27, 7, 20, 100, 76, 8, 70, 68, 36, 9, 114, 11, 120, 40, 34, 60, 127, 129, 44, 126, 46, 12, 32, 135, 13, 87, 38, 142, 25, 15, 89, 145, 147, 149, 150, 152, 18, 19, 159, 21, 162, 165, 166, 168, 169, 171, 92, 173, 176, 71, 178, 144, 180, 57, 72, 26, 161, 97, 86, 186, 28, 190, 192, 194, 196, 79, 30, 188, 31, 170, 204, 35, 157, 155, 102, 37, 51, 39, 199, 41, 154, 108, 59, 223, 198, 66, 222, 113, 42, 52, 187, 43, 105, 56, 49, 45, 230, 232, 64, 197, 48, 84, 50, 88, 146, 193, 54, 183, 103, 137, 55, 118, 174, 58, 214, 220, 77, 240, 213, 228, 163, 238, 226, 116, 67, 224, 69, 236, 81, 242, 83, 246, 237, 109, 205, 182, 123, 216, 133, 234, 189, 211, 164, 130, 136, 250, 185, 111, 139, 218, 212, 172, 85, 200, 244, 124, 229, 90, 233, 115, 209, 167, 210, 93, 217, 153, 235, 191, 95, 96, 227, 98, 99, 175, 195, 101, 219, 221, 206, 143, 104, 106, 138, 107, 201, 125, 247, 243, 110, 119, 140, 112, 245, 253, 128, 131, 117, 202, 121, 122, 252, 148, 251, 241, 132, 184, 134, 203, 248, 208, 141, 249, 151, 156, 255, 158, 256, 160, 215, 207, 254, 177, 179, 181, 225, 231, 239 ] ], [ PermutationGroup<256 | \[ 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 1 ], \[ 2, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256 ]: Order := 857817775342842654119082271681232625157781520279485619859655650377269452553147589377440291360451408450375885342336584306157196834693696475322289288497426025679637332563368786442675207626794560187968867971521143307702077526646451464709187326100832876325702818980773671781454170250523018608495319068138257481070252817559459476987034665712738139286205234756808218860701203611083152093501947437109101726968262861606263662435022840944191408424615936000000000000000000000000000000000000000000000000000000000000000 > | [ 114, 199, 157, 224, 223, 47, 155, 219, 101, 183, 247, 103, 206, 222, 198, 200, 70, 154, 112, 135, 255, 159, 53, 127, 244, 254, 227, 128, 17, 119, 215, 187, 97, 120, 115, 42, 40, 110, 136, 104, 182, 138, 208, 243, 96, 102, 36, 201, 184, 250, 207, 67, 37, 173, 108, 214, 236, 221, 160, 253, 232, 68, 161, 95, 23, 209, 9, 46, 125, 12, 237, 230, 100, 162, 188, 126, 193, 29, 134, 62, 231, 63, 225, 245, 130, 116, 113, 217, 129, 45, 233, 33, 64, 74, 52, 48, 10, 39, 90, 6, 123, 153, 43, 218, 216, 107, 228, 139, 234, 212, 239, 35, 137, 38, 211, 235, 175, 238, 98, 55, 170, 205, 171, 248, 85, 87, 86, 30, 34, 176, 156, 189, 190, 19, 1, 166, 194, 111, 144, 165, 213, 246, 109, 242, 65, 158, 24, 181, 76, 197, 79, 20, 249, 122, 13, 41, 51, 59, 3, 66, 49, 7, 152, 256, 178, 147, 203, 78, 92, 252, 82, 202, 240, 80, 93, 145, 146, 22, 148, 142, 131, 168, 118, 117, 163, 149, 2, 16, 204, 94, 99, 75, 15, 151, 150, 71, 32, 18, 56, 124, 220, 69, 28, 89, 192, 141, 121, 179, 229, 91, 186, 164, 251, 180, 54, 210, 196, 241, 106, 174, 132, 105, 88, 8, 143, 77, 31, 72, 169, 5, 83, 14, 27, 73, 167, 58, 4, 177, 81, 61, 172, 57, 140, 50, 11, 25, 133, 226, 191, 195, 84, 60, 44, 185, 26, 21 ], [ 116, 217, 184, 200, 42, 49, 102, 248, 190, 235, 110, 137, 249, 113, 120, 103, 87, 108, 254, 127, 157, 161, 10, 12, 183, 207, 244, 236, 25, 221, 250, 223, 86, 40, 163, 117, 118, 167, 78, 196, 214, 210, 151, 216, 154, 138, 105, 205, 104, 238, 175, 247, 88, 150, 218, 71, 155, 206, 243, 222, 126, 36, 37, 245, 5, 165, 130, 124, 219, 50, 188, 47, 63, 68, 70, 46, 129, 76, 255, 16, 227, 7, 215, 114, 107, 43, 153, 111, 53, 225, 246, 3, 202, 21, 125, 109, 51, 189, 198, 14, 145, 226, 195, 177, 194, 77, 100, 94, 171, 178, 233, 201, 212, 140, 174, 139, 241, 203, 182, 133, 64, 144, 74, 208, 209, 38, 55, 156, 11, 169, 199, 213, 164, 96, 44, 89, 191, 93, 172, 91, 99, 97, 173, 162, 33, 253, 34, 187, 1, 230, 90, 60, 239, 168, 185, 115, 54, 119, 31, 39, 13, 26, 147, 159, 82, 17, 242, 142, 24, 232, 23, 224, 149, 6, 251, 72, 128, 27, 134, 4, 112, 186, 121, 141, 170, 62, 66, 58, 65, 80, 231, 57, 131, 256, 146, 81, 59, 41, 229, 132, 73, 160, 181, 84, 29, 152, 240, 197, 166, 79, 20, 28, 135, 92, 211, 180, 192, 237, 234, 75, 176, 56, 122, 143, 101, 148, 35, 15, 22, 18, 67, 2, 19, 61, 179, 85, 83, 252, 95, 32, 158, 69, 123, 106, 48, 8, 220, 204, 193, 228, 45, 52, 9, 136, 98, 30 ], [ 213, 148, 164, 218, 150, 107, 144, 172, 231, 142, 64, 75, 57, 170, 249, 71, 205, 99, 179, 206, 194, 110, 189, 163, 91, 79, 111, 118, 39, 177, 81, 208, 214, 77, 181, 72, 89, 84, 255, 63, 128, 62, 16, 146, 151, 74, 174, 134, 22, 27, 21, 239, 171, 83, 15, 131, 167, 28, 241, 238, 207, 190, 165, 138, 101, 202, 252, 186, 93, 166, 40, 250, 219, 108, 217, 173, 102, 154, 43, 115, 153, 109, 191, 175, 95, 20, 61, 32, 248, 141, 42, 130, 51, 9, 121, 251, 145, 158, 137, 201, 253, 76, 24, 34, 60, 69, 244, 127, 224, 126, 46, 233, 17, 149, 227, 33, 3, 25, 256, 147, 26, 45, 225, 4, 242, 78, 169, 212, 136, 236, 203, 30, 52, 210, 211, 160, 14, 5, 18, 59, 58, 216, 90, 116, 221, 104, 209, 235, 182, 103, 105, 35, 7, 230, 82, 193, 92, 195, 229, 197, 73, 123, 155, 113, 114, 254, 10, 119, 199, 183, 243, 117, 157, 247, 36, 67, 50, 66, 124, 41, 226, 198, 23, 6, 19, 215, 240, 220, 200, 120, 13, 48, 106, 12, 31, 2, 54, 228, 232, 80, 245, 139, 38, 98, 223, 161, 97, 86, 187, 44, 156, 11, 184, 222, 159, 47, 53, 49, 246, 112, 188, 100, 65, 180, 237, 8, 178, 85, 125, 176, 196, 234, 140, 96, 1, 192, 56, 37, 88, 143, 55, 122, 135, 29, 204, 168, 129, 68, 87, 70, 132, 185, 152, 162, 94, 133 ] ] ]; s`SolvableDBMonodromyGroup := PermutationGroup<256 | \[ 2, 9, 8, 19, 11, 1, 31, 35, 39, 13, 41, 51, 54, 18, 59, 26, 3, 66, 67, 32, 69, 4, 14, 5, 58, 85, 30, 90, 6, 96, 98, 52, 7, 44, 101, 38, 105, 56, 107, 43, 109, 118, 121, 48, 125, 50, 10, 130, 124, 132, 106, 119, 12, 136, 140, 123, 83, 143, 112, 45, 15, 25, 16, 128, 17, 115, 154, 37, 156, 36, 79, 84, 20, 27, 21, 34, 146, 22, 95, 23, 158, 24, 160, 131, 182, 88, 55, 133, 60, 187, 28, 76, 193, 29, 198, 199, 87, 201, 202, 33, 205, 104, 138, 210, 122, 211, 213, 111, 163, 218, 177, 221, 117, 40, 189, 153, 226, 141, 219, 42, 228, 229, 166, 185, 215, 49, 46, 224, 47, 173, 225, 234, 168, 236, 53, 174, 139, 212, 178, 220, 240, 57, 209, 81, 61, 134, 62, 231, 63, 64, 242, 65, 195, 110, 103, 243, 102, 245, 68, 247, 86, 70, 150, 172, 71, 72, 191, 73, 74, 99, 75, 181, 77, 142, 203, 78, 251, 80, 252, 82, 253, 165, 137, 235, 176, 89, 120, 97, 170, 91, 197, 92, 135, 93, 204, 94, 129, 114, 108, 183, 214, 227, 237, 100, 164, 208, 249, 239, 190, 192, 171, 180, 148, 144, 248, 167, 194, 179, 206, 145, 207, 116, 113, 155, 254, 152, 200, 149, 186, 126, 255, 127, 188, 169, 196, 157, 162, 151, 256, 147, 233, 159, 217, 184, 222, 161, 216, 238, 241, 175, 232, 230, 223, 250, 244, 246 ], \[ 3, 10, 14, 6, 16, 27, 1, 36, 40, 44, 46, 2, 38, 25, 17, 34, 32, 12, 68, 22, 24, 61, 4, 57, 5, 86, 76, 29, 79, 70, 87, 33, 60, 7, 102, 31, 8, 51, 108, 66, 113, 9, 56, 49, 47, 18, 52, 42, 11, 88, 105, 53, 59, 137, 13, 118, 23, 37, 127, 63, 142, 15, 84, 65, 146, 116, 155, 83, 97, 19, 73, 75, 91, 20, 89, 21, 78, 150, 80, 81, 82, 172, 161, 62, 183, 58, 26, 124, 74, 188, 186, 28, 94, 191, 162, 200, 30, 103, 100, 64, 206, 143, 35, 106, 50, 138, 205, 130, 216, 39, 123, 114, 48, 119, 110, 41, 133, 140, 120, 125, 210, 43, 218, 55, 223, 45, 131, 129, 202, 217, 126, 104, 153, 135, 128, 208, 185, 54, 141, 117, 212, 72, 184, 145, 71, 147, 148, 149, 99, 169, 152, 203, 122, 221, 96, 244, 67, 159, 95, 157, 69, 90, 165, 166, 173, 144, 168, 194, 170, 171, 213, 92, 214, 77, 176, 238, 178, 93, 180, 177, 246, 250, 98, 85, 235, 164, 224, 181, 190, 163, 192, 179, 242, 220, 196, 226, 237, 236, 219, 156, 248, 230, 204, 241, 189, 201, 101, 211, 207, 195, 249, 121, 174, 107, 199, 115, 109, 229, 154, 111, 247, 112, 225, 198, 222, 139, 187, 239, 167, 231, 232, 134, 197, 175, 132, 245, 193, 136, 240, 151, 228, 251, 215, 160, 255, 158, 254, 182, 234, 209, 256, 233, 227, 243, 253, 252 ], \[ 4, 7, 15, 20, 21, 28, 32, 1, 12, 45, 25, 52, 2, 57, 22, 60, 64, 3, 23, 71, 72, 77, 79, 81, 84, 5, 89, 73, 93, 6, 34, 74, 99, 27, 37, 30, 19, 8, 42, 112, 49, 119, 9, 16, 33, 59, 128, 10, 131, 11, 18, 17, 134, 55, 31, 13, 61, 14, 62, 75, 144, 146, 148, 78, 151, 46, 70, 158, 76, 95, 163, 164, 167, 150, 170, 172, 165, 175, 145, 177, 166, 179, 24, 142, 87, 83, 69, 26, 91, 92, 189, 191, 168, 195, 29, 97, 90, 36, 169, 203, 103, 160, 67, 35, 58, 38, 110, 215, 116, 219, 39, 53, 125, 224, 40, 225, 41, 48, 47, 227, 122, 51, 43, 44, 126, 202, 231, 100, 233, 113, 63, 105, 50, 65, 237, 138, 85, 98, 54, 124, 56, 213, 86, 173, 194, 174, 239, 171, 241, 190, 176, 196, 66, 157, 187, 161, 198, 80, 193, 68, 181, 197, 217, 107, 248, 111, 109, 117, 249, 205, 208, 186, 108, 238, 182, 137, 220, 226, 123, 141, 82, 184, 96, 156, 88, 218, 162, 252, 216, 250, 229, 121, 178, 130, 133, 185, 94, 159, 155, 253, 183, 149, 234, 210, 207, 199, 154, 101, 102, 132, 104, 106, 214, 206, 120, 221, 254, 115, 114, 118, 222, 236, 255, 135, 127, 140, 129, 212, 153, 256, 147, 242, 204, 235, 143, 232, 152, 201, 136, 139, 211, 240, 200, 245, 246, 251, 244, 243, 209, 247, 180, 192, 188, 223, 230, 228 ] >; s`SolvableDBAutomorphismGroup := PermutationGroup<256 | \[ 255, 244, 253, 230, 224, 231, 245, 223, 184, 160, 155, 156, 247, 227, 188, 198, 181, 200, 126, 256, 135, 252, 202, 128, 187, 114, 232, 147, 148, 127, 222, 246, 158, 236, 113, 225, 125, 254, 235, 85, 103, 143, 182, 157, 68, 96, 83, 102, 67, 199, 243, 161, 69, 216, 221, 250, 129, 120, 97, 159, 233, 90, 95, 82, 172, 183, 49, 45, 53, 131, 228, 237, 239, 251, 193, 134, 192, 179, 149, 99, 100, 64, 47, 162, 40, 119, 112, 219, 242, 62, 240, 146, 171, 213, 63, 46, 59, 116, 80, 81, 117, 48, 41, 130, 215, 217, 196, 132, 138, 185, 234, 87, 35, 26, 137, 98, 101, 209, 86, 58, 165, 248, 175, 154, 37, 19, 30, 24, 57, 104, 70, 108, 206, 76, 21, 167, 115, 109, 189, 207, 190, 197, 42, 204, 241, 92, 28, 29, 79, 180, 186, 164, 201, 124, 11, 12, 44, 33, 60, 10, 52, 84, 212, 152, 121, 203, 136, 208, 177, 178, 93, 65, 210, 191, 123, 218, 169, 170, 78, 150, 17, 43, 66, 9, 110, 151, 25, 15, 139, 141, 174, 77, 75, 211, 214, 107, 142, 16, 50, 18, 153, 23, 166, 144, 226, 133, 140, 168, 118, 173, 194, 163, 94, 195, 105, 54, 106, 176, 88, 249, 55, 31, 8, 5, 36, 205, 14, 71, 238, 4, 6, 27, 61, 111, 39, 34, 72, 229, 73, 91, 145, 89, 51, 2, 7, 32, 13, 122, 220, 56, 74, 22, 3, 38, 1, 20 ], \[ 2, 9, 10, 7, 11, 1, 12, 13, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 31, 32, 25, 33, 34, 5, 49, 50, 3, 4, 6, 8, 51, 52, 53, 18, 54, 38, 55, 56, 107, 108, 109, 110, 111, 66, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 16, 124, 125, 59, 60, 126, 127, 128, 129, 130, 98, 87, 58, 36, 74, 84, 20, 17, 62, 14, 99, 100, 27, 76, 21, 24, 26, 131, 132, 88, 105, 133, 15, 19, 22, 23, 28, 29, 30, 35, 37, 106, 134, 135, 136, 137, 138, 139, 140, 141, 213, 205, 163, 214, 164, 215, 216, 199, 173, 217, 167, 218, 219, 154, 177, 220, 166, 153, 221, 222, 223, 224, 198, 189, 225, 226, 168, 227, 187, 228, 210, 212, 192, 229, 179, 63, 185, 75, 89, 202, 230, 231, 232, 64, 233, 197, 194, 201, 103, 143, 183, 69, 97, 85, 86, 70, 150, 142, 169, 72, 71, 73, 65, 146, 147, 57, 170, 149, 203, 204, 172, 92, 81, 82, 83, 234, 104, 235, 195, 61, 67, 68, 77, 78, 79, 80, 90, 91, 93, 94, 95, 96, 101, 102, 211, 236, 237, 193, 174, 208, 238, 239, 176, 178, 240, 180, 148, 171, 207, 165, 190, 144, 206, 186, 248, 243, 247, 155, 254, 191, 157, 251, 145, 245, 255, 253, 159, 152, 196, 200, 162, 241, 256, 252, 242, 188, 209, 184, 156, 161, 182, 249, 151, 175, 181, 158, 160, 250, 244, 246 ], \[ 253, 223, 227, 188, 198, 181, 255, 200, 113, 225, 114, 125, 254, 187, 129, 236, 202, 120, 97, 252, 159, 233, 90, 95, 224, 157, 246, 82, 172, 161, 244, 230, 231, 245, 183, 156, 96, 243, 117, 48, 40, 41, 130, 222, 127, 119, 131, 116, 112, 219, 215, 126, 45, 250, 247, 217, 162, 155, 47, 232, 197, 128, 134, 149, 99, 42, 87, 30, 68, 69, 192, 193, 179, 256, 242, 158, 204, 241, 92, 28, 29, 79, 70, 135, 102, 67, 160, 154, 251, 24, 180, 81, 186, 164, 76, 86, 83, 184, 147, 148, 137, 98, 85, 201, 199, 248, 226, 133, 43, 140, 168, 10, 66, 44, 118, 9, 115, 109, 49, 11, 173, 108, 194, 221, 46, 59, 52, 63, 84, 153, 53, 206, 110, 33, 60, 175, 209, 182, 190, 216, 163, 237, 103, 94, 191, 100, 64, 65, 146, 228, 169, 170, 39, 55, 26, 37, 31, 6, 27, 36, 19, 21, 121, 178, 210, 93, 123, 218, 239, 240, 151, 80, 195, 203, 211, 249, 73, 91, 145, 71, 23, 104, 143, 35, 207, 177, 5, 57, 141, 212, 166, 144, 89, 229, 107, 205, 72, 34, 88, 58, 235, 62, 171, 213, 139, 185, 54, 176, 138, 214, 238, 165, 152, 196, 50, 56, 122, 220, 124, 167, 13, 2, 18, 16, 12, 189, 25, 77, 111, 15, 17, 32, 142, 208, 101, 7, 75, 234, 78, 150, 174, 74, 105, 8, 1, 4, 38, 132, 136, 106, 20, 61, 14, 51, 3, 22 ]: Order := 256 >; s`SolvableDBPointedAutomorphismGroup := PermutationGroup<256 | \[ 255, 244, 253, 230, 224, 231, 245, 223, 184, 160, 155, 156, 247, 227, 188, 198, 181, 200, 126, 256, 135, 252, 202, 128, 187, 114, 232, 147, 148, 127, 222, 246, 158, 236, 113, 225, 125, 254, 235, 85, 103, 143, 182, 157, 68, 96, 83, 102, 67, 199, 243, 161, 69, 216, 221, 250, 129, 120, 97, 159, 233, 90, 95, 82, 172, 183, 49, 45, 53, 131, 228, 237, 239, 251, 193, 134, 192, 179, 149, 99, 100, 64, 47, 162, 40, 119, 112, 219, 242, 62, 240, 146, 171, 213, 63, 46, 59, 116, 80, 81, 117, 48, 41, 130, 215, 217, 196, 132, 138, 185, 234, 87, 35, 26, 137, 98, 101, 209, 86, 58, 165, 248, 175, 154, 37, 19, 30, 24, 57, 104, 70, 108, 206, 76, 21, 167, 115, 109, 189, 207, 190, 197, 42, 204, 241, 92, 28, 29, 79, 180, 186, 164, 201, 124, 11, 12, 44, 33, 60, 10, 52, 84, 212, 152, 121, 203, 136, 208, 177, 178, 93, 65, 210, 191, 123, 218, 169, 170, 78, 150, 17, 43, 66, 9, 110, 151, 25, 15, 139, 141, 174, 77, 75, 211, 214, 107, 142, 16, 50, 18, 153, 23, 166, 144, 226, 133, 140, 168, 118, 173, 194, 163, 94, 195, 105, 54, 106, 176, 88, 249, 55, 31, 8, 5, 36, 205, 14, 71, 238, 4, 6, 27, 61, 111, 39, 34, 72, 229, 73, 91, 145, 89, 51, 2, 7, 32, 13, 122, 220, 56, 74, 22, 3, 38, 1, 20 ], \[ 6, 1, 27, 28, 24, 29, 4, 30, 2, 3, 5, 7, 8, 76, 89, 57, 74, 34, 90, 73, 81, 91, 92, 82, 21, 83, 79, 93, 94, 95, 19, 20, 22, 23, 96, 70, 97, 36, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 25, 26, 31, 32, 33, 35, 37, 38, 172, 69, 60, 61, 186, 75, 142, 150, 169, 44, 187, 188, 158, 162, 167, 166, 168, 71, 144, 80, 189, 190, 191, 192, 179, 180, 181, 72, 160, 161, 68, 86, 145, 193, 194, 178, 195, 196, 197, 198, 159, 67, 77, 78, 199, 200, 155, 183, 87, 98, 39, 40, 41, 42, 43, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 58, 59, 62, 63, 64, 65, 66, 84, 85, 88, 99, 100, 101, 102, 103, 104, 105, 106, 164, 156, 218, 229, 170, 171, 213, 174, 163, 249, 234, 124, 120, 224, 245, 227, 252, 233, 253, 246, 237, 109, 111, 216, 123, 117, 133, 165, 173, 214, 177, 115, 205, 250, 209, 121, 210, 141, 212, 251, 247, 157, 244, 143, 220, 135, 242, 130, 217, 226, 139, 204, 153, 185, 235, 152, 129, 114, 236, 154, 146, 175, 176, 108, 219, 215, 206, 243, 137, 201, 138, 107, 110, 112, 113, 116, 118, 119, 122, 125, 126, 127, 128, 131, 132, 134, 136, 140, 147, 148, 149, 151, 182, 184, 202, 203, 207, 208, 211, 238, 241, 222, 255, 230, 256, 223, 221, 248, 254, 228, 240, 232, 225, 231, 239 ]: Order := 16 >; s`SolvableDBPathToPP1 := [ Strings() | "PP1", "2T1-1,2,2-g0-path1", "4T2-2,2,2-g0-path1", "8T4-4,2,2-g0-path1", "16T10-4,2,4-g1-path5", "32S5-8,2,8-g5-path2", "64S17-8,4,8-g17-path18", "128S111-16,4,16-g41-path7", "256S200-16,8,16-g97-path9" ]; s`SolvableDBChild := "128S111-16,4,16-g41-path7"; /* Return for eval */ return s;
michaelmusty/SolvableDessins
SolvableDB/256/256S200-16,8,16-g97-path9.m
Matlab
mit
84,379
/* * This file was automatically generated by sel-utils and * released under the MIT License. * * License: https://github.com/sel-project/sel-utils/blob/master/LICENSE * Repository: https://github.com/sel-project/sel-utils * Generated from https://github.com/sel-project/sel-utils/blob/master/xml/protocol/java338.xml */ package sul.protocol.java338.clientbound; import sul.utils.*; public class ServerDifficulty extends Packet { public static final int ID = (int)13; public static final boolean CLIENTBOUND = true; public static final boolean SERVERBOUND = false; @Override public int getId() { return ID; } // difficulty public static final byte PEACEFUL = (byte)0; public static final byte EASY = (byte)1; public static final byte NORMAL = (byte)2; public static final byte HARD = (byte)3; public byte difficulty; public ServerDifficulty() {} public ServerDifficulty(byte difficulty) { this.difficulty = difficulty; } @Override public int length() { return 2; } @Override public byte[] encode() { this._buffer = new byte[this.length()]; this.writeVaruint(ID); this.writeBigEndianByte(difficulty); return this.getBuffer(); } @Override public void decode(byte[] buffer) { this._buffer = buffer; this.readVaruint(); difficulty=readBigEndianByte(); } public static ServerDifficulty fromBuffer(byte[] buffer) { ServerDifficulty ret = new ServerDifficulty(); ret.decode(buffer); return ret; } @Override public String toString() { return "ServerDifficulty(difficulty: " + this.difficulty + ")"; } }
sel-utils/java
src/main/java/sul/protocol/java338/clientbound/ServerDifficulty.java
Java
mit
1,574
<!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_22) on Sun Aug 26 15:15:31 EDT 2012 --> <TITLE> XMLParser (Slick Util - LWJGL Utilities extracted from Slick) </TITLE> <META NAME="date" CONTENT="2012-08-26"> <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="XMLParser (Slick Util - LWJGL Utilities extracted from Slick)"; } } </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>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/XMLParser.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../../../../org/newdawn/slick/util/xml/XMLElementList.html" title="class in org.newdawn.slick.util.xml"><B>PREV CLASS</B></A>&nbsp; &nbsp;NEXT CLASS</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../index.html?org/newdawn/slick/util/xml/XMLParser.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="XMLParser.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<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> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <!-- ======== START OF CLASS DATA ======== --> <H2> <FONT SIZE="-1"> org.newdawn.slick.util.xml</FONT> <BR> Class XMLParser</H2> <PRE> java.lang.Object <IMG SRC="../../../../../resources/inherit.gif" ALT="extended by "><B>org.newdawn.slick.util.xml.XMLParser</B> </PRE> <HR> <DL> <DT><PRE>public class <B>XMLParser</B><DT>extends java.lang.Object</DL> </PRE> <P> A simple utility wrapper around the Java DOM implementation to hopefully make XML parsing that bit easier without requiring YAL. <P> <P> <DL> <DT><B>Author:</B></DT> <DD>kevin</DD> </DL> <HR> <P> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <A NAME="constructor_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Constructor Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../../../org/newdawn/slick/util/xml/XMLParser.html#XMLParser()">XMLParser</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create a new parser</TD> </TR> </TABLE> &nbsp; <!-- ========== METHOD SUMMARY =========== --> <A NAME="method_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Method Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../../org/newdawn/slick/util/xml/XMLElement.html" title="class in org.newdawn.slick.util.xml">XMLElement</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/newdawn/slick/util/xml/XMLParser.html#parse(java.lang.String)">parse</A></B>(java.lang.String&nbsp;ref)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Parse the XML document located by the slick resource loader using the reference given.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../../org/newdawn/slick/util/xml/XMLElement.html" title="class in org.newdawn.slick.util.xml">XMLElement</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/newdawn/slick/util/xml/XMLParser.html#parse(java.lang.String, java.io.InputStream)">parse</A></B>(java.lang.String&nbsp;name, java.io.InputStream&nbsp;in)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Parse the XML document that can be read from the given input stream</TD> </TR> </TABLE> &nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD> </TR> </TABLE> &nbsp; <P> <!-- ========= CONSTRUCTOR DETAIL ======== --> <A NAME="constructor_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Constructor Detail</B></FONT></TH> </TR> </TABLE> <A NAME="XMLParser()"><!-- --></A><H3> XMLParser</H3> <PRE> public <B>XMLParser</B>()</PRE> <DL> <DD>Create a new parser <P> </DL> <!-- ============ METHOD DETAIL ========== --> <A NAME="method_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Method Detail</B></FONT></TH> </TR> </TABLE> <A NAME="parse(java.lang.String)"><!-- --></A><H3> parse</H3> <PRE> public <A HREF="../../../../../org/newdawn/slick/util/xml/XMLElement.html" title="class in org.newdawn.slick.util.xml">XMLElement</A> <B>parse</B>(java.lang.String&nbsp;ref) throws <A HREF="../../../../../org/newdawn/slick/SlickException.html" title="class in org.newdawn.slick">SlickException</A></PRE> <DL> <DD>Parse the XML document located by the slick resource loader using the reference given. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>ref</CODE> - The reference to the XML document <DT><B>Returns:</B><DD>The root element of the newly parse document <DT><B>Throws:</B> <DD><CODE><A HREF="../../../../../org/newdawn/slick/SlickException.html" title="class in org.newdawn.slick">SlickException</A></CODE> - Indicates a failure to parse the XML, most likely the XML is malformed in some way.</DL> </DD> </DL> <HR> <A NAME="parse(java.lang.String, java.io.InputStream)"><!-- --></A><H3> parse</H3> <PRE> public <A HREF="../../../../../org/newdawn/slick/util/xml/XMLElement.html" title="class in org.newdawn.slick.util.xml">XMLElement</A> <B>parse</B>(java.lang.String&nbsp;name, java.io.InputStream&nbsp;in) throws <A HREF="../../../../../org/newdawn/slick/util/xml/SlickXMLException.html" title="class in org.newdawn.slick.util.xml">SlickXMLException</A></PRE> <DL> <DD>Parse the XML document that can be read from the given input stream <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>name</CODE> - The name of the document<DD><CODE>in</CODE> - The input stream from which the document can be read <DT><B>Returns:</B><DD>The root element of the newly parse document <DT><B>Throws:</B> <DD><CODE><A HREF="../../../../../org/newdawn/slick/util/xml/SlickXMLException.html" title="class in org.newdawn.slick.util.xml">SlickXMLException</A></CODE> - Indicates a failure to parse the XML, most likely the XML is malformed in some way.</DL> </DD> </DL> <!-- ========= END OF CLASS DATA ========= --> <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>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/XMLParser.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../../../../org/newdawn/slick/util/xml/XMLElementList.html" title="class in org.newdawn.slick.util.xml"><B>PREV CLASS</B></A>&nbsp; &nbsp;NEXT CLASS</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../index.html?org/newdawn/slick/util/xml/XMLParser.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="XMLParser.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<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> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> <i>Copyright &#169; 2006 New Dawn Software. All Rights Reserved.</i> </BODY> </HTML>
dxiao/PPBunnies
slick/trunk/Slick/javadoc-util/org/newdawn/slick/util/xml/XMLParser.html
HTML
mit
12,930
#region License // Copyright (c) 2007 James Newton-King // // 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. #endregion using System.Globalization; using System.IO; namespace uWebshop.Newtonsoft.Json.Linq { /// <summary> /// Represents a raw JSON string. /// </summary> public class JRaw : JValue { /// <summary> /// Initializes a new instance of the <see cref="JRaw"/> class from another <see cref="JRaw"/> object. /// </summary> /// <param name="other">A <see cref="JRaw"/> object to copy from.</param> public JRaw(JRaw other) : base(other) { } /// <summary> /// Initializes a new instance of the <see cref="JRaw"/> class. /// </summary> /// <param name="rawJson">The raw json.</param> public JRaw(object rawJson) : base(rawJson, JTokenType.Raw) { } /// <summary> /// Creates an instance of <see cref="JRaw"/> with the content of the reader's current token. /// </summary> /// <param name="reader">The reader.</param> /// <returns>An instance of <see cref="JRaw"/> with the content of the reader's current token.</returns> public static JRaw Create(JsonReader reader) { using (var sw = new StringWriter(CultureInfo.InvariantCulture)) using (var jsonWriter = new JsonTextWriter(sw)) { jsonWriter.WriteToken(reader); return new JRaw(sw.ToString()); } } internal override JToken CloneToken() { return new JRaw(this); } } }
uWebshop/uWebshop-Releases
Core/uWebshop.Domain/NewtonsoftJsonNet/Linq/JRaw.cs
C#
mit
2,442
var Code = require('code') var Lab = require('lab') var lab = exports.lab = Lab.script() var sinon = require('sinon') var describe = lab.describe var it = lab.it var before = lab.before var after = lab.after var expect = Code.expect var noop = require('101/noop') var mapKeys = require('../map-keys') describe('mapKeys', function () { describe('prototype', function () { before(function (done) { require('../index')() done() }) after(require('./fixtures/reset-object-prototype')) it('should iterate through all the key-value pairs in the object', function (done) { var obj = { foo: 1, bar: 2, baz: 3 } var callback = sinon.spy() var thisArg = {} obj.mapKeys(callback, thisArg) // assertions expect(callback.callCount).to.equal(3) expect(callback.calledOn(thisArg)).to.equal(true) expect(callback.firstCall.args[0]).to.equal('foo') expect(callback.firstCall.args[1]).to.equal(1) expect(callback.firstCall.args[2]).to.equal(obj) expect(callback.secondCall.args[0]).to.equal('bar') expect(callback.secondCall.args[1]).to.equal(2) expect(callback.secondCall.args[2]).to.equal(obj) expect(callback.thirdCall.args[0]).to.equal('baz') expect(callback.thirdCall.args[1]).to.equal(3) expect(callback.thirdCall.args[2]).to.equal(obj) done() }) it('should return an object with new mapped values', function (done) { var obj = { foo: 1, bar: 2, baz: 3 } var mappedObj = obj.mapKeys(prependWith('yolo')) Object.keys(obj).forEach(function (key) { expect(mappedObj[key]).to.equal(obj[prependWith('yolo')(key)]) }) done() }) }) describe('require', function () { it('should iterate through all the key-value pairs in the object', function (done) { var obj = { foo: 1, bar: 2, baz: 3 } var callback = sinon.spy() var thisArg = {} mapKeys(obj, callback, thisArg) // assertions expect(callback.callCount).to.equal(3) expect(callback.calledOn(thisArg)).to.equal(true) expect(callback.firstCall.args[0]).to.equal('foo') expect(callback.firstCall.args[1]).to.equal(1) expect(callback.firstCall.args[2]).to.equal(obj) expect(callback.secondCall.args[0]).to.equal('bar') expect(callback.secondCall.args[1]).to.equal(2) expect(callback.secondCall.args[2]).to.equal(obj) expect(callback.thirdCall.args[0]).to.equal('baz') expect(callback.thirdCall.args[1]).to.equal(3) expect(callback.thirdCall.args[2]).to.equal(obj) done() }) it('should return an object with new mapped values', function (done) { var obj = { foo: 1, bar: 2, baz: 3 } var mappedObj = mapKeys(obj, prependWith('yolo')) Object.keys(obj).forEach(function (key) { var newKey = prependWith('yolo')(key) expect(mappedObj[newKey]).to.equal(obj[key]) }) done() }) describe('errors', function () { it('should throw an error if obj must be an object', function (done) { var obj = 'notObject' var callback = noop var thisArg = {} var fn = mapKeys.bind(null, obj, callback, thisArg) expect(fn).to.throw(/must be an object/) done() }) it('should throw an error if callback must be a function', function (done) { var obj = { foo: 1, bar: 2, baz: 3 } var callback = 'notFunction' var thisArg = {} var fn = mapKeys.bind(null, obj, callback, thisArg) expect(fn).to.throw(/must be a function/) done() }) }) describe('use w/ array', function () { it('should iterate through all the key-value pairs in the object', function (done) { var arr = [ 1, 2, 3 ] var callback = sinon.spy() var thisArg = {} mapKeys(arr, callback, thisArg) // assertions expect(callback.callCount).to.equal(3) expect(callback.calledOn(thisArg)).to.equal(true) expect(callback.firstCall.args[0]).to.equal(0) // index expect(callback.firstCall.args[1]).to.equal(1) expect(callback.firstCall.args[2]).to.equal(arr) expect(callback.secondCall.args[0]).to.equal(1) // index expect(callback.secondCall.args[1]).to.equal(2) expect(callback.secondCall.args[2]).to.equal(arr) expect(callback.thirdCall.args[0]).to.equal(2) // index expect(callback.thirdCall.args[1]).to.equal(3) expect(callback.thirdCall.args[2]).to.equal(arr) done() }) it('should return an object with new mapped values', function (done) { var arr = [ 1, 2, 3 ] var mapped = mapKeys(arr, add(1)) expect(mapped).instanceOf(Array) Object.keys(arr).forEach(function (key) { var intKey = parseInt(key, 10) var newKey = add(1)(intKey) expect(mapped[newKey]).to.equal(arr[key]) }) done() }) }) }) }) function prependWith (pre) { return function (key) { return pre + key } } function add (n) { return function (i) { return i + n } }
tjmehta/object-loops
test/test-map-keys.js
JavaScript
mit
5,361
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; namespace Track.Auth.Web.Data.Migrations { public partial class CreateIdentitySchema : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "AspNetRoles", columns: table => new { Id = table.Column<string>(nullable: false), ConcurrencyStamp = table.Column<string>(nullable: true), Name = table.Column<string>(maxLength: 256, nullable: true), NormalizedName = table.Column<string>(maxLength: 256, nullable: true) }, constraints: table => { table.PrimaryKey("PK_AspNetRoles", x => x.Id); }); migrationBuilder.CreateTable( name: "AspNetUserTokens", columns: table => new { UserId = table.Column<string>(nullable: false), LoginProvider = table.Column<string>(nullable: false), Name = table.Column<string>(nullable: false), Value = table.Column<string>(nullable: true) }, constraints: table => { table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); }); migrationBuilder.CreateTable( name: "AspNetUsers", columns: table => new { Id = table.Column<string>(nullable: false), AccessFailedCount = table.Column<int>(nullable: false), ConcurrencyStamp = table.Column<string>(nullable: true), Email = table.Column<string>(maxLength: 256, nullable: true), EmailConfirmed = table.Column<bool>(nullable: false), LockoutEnabled = table.Column<bool>(nullable: false), LockoutEnd = table.Column<DateTimeOffset>(nullable: true), NormalizedEmail = table.Column<string>(maxLength: 256, nullable: true), NormalizedUserName = table.Column<string>(maxLength: 256, nullable: true), PasswordHash = table.Column<string>(nullable: true), PhoneNumber = table.Column<string>(nullable: true), PhoneNumberConfirmed = table.Column<bool>(nullable: false), SecurityStamp = table.Column<string>(nullable: true), TwoFactorEnabled = table.Column<bool>(nullable: false), UserName = table.Column<string>(maxLength: 256, nullable: true) }, constraints: table => { table.PrimaryKey("PK_AspNetUsers", x => x.Id); }); migrationBuilder.CreateTable( name: "AspNetRoleClaims", columns: table => new { Id = table.Column<int>(nullable: false) .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), ClaimType = table.Column<string>(nullable: true), ClaimValue = table.Column<string>(nullable: true), RoleId = table.Column<string>(nullable: false) }, constraints: table => { table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id); table.ForeignKey( name: "FK_AspNetRoleClaims_AspNetRoles_RoleId", column: x => x.RoleId, principalTable: "AspNetRoles", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "AspNetUserClaims", columns: table => new { Id = table.Column<int>(nullable: false) .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), ClaimType = table.Column<string>(nullable: true), ClaimValue = table.Column<string>(nullable: true), UserId = table.Column<string>(nullable: false) }, constraints: table => { table.PrimaryKey("PK_AspNetUserClaims", x => x.Id); table.ForeignKey( name: "FK_AspNetUserClaims_AspNetUsers_UserId", column: x => x.UserId, principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "AspNetUserLogins", columns: table => new { LoginProvider = table.Column<string>(nullable: false), ProviderKey = table.Column<string>(nullable: false), ProviderDisplayName = table.Column<string>(nullable: true), UserId = table.Column<string>(nullable: false) }, constraints: table => { table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey }); table.ForeignKey( name: "FK_AspNetUserLogins_AspNetUsers_UserId", column: x => x.UserId, principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "AspNetUserRoles", columns: table => new { UserId = table.Column<string>(nullable: false), RoleId = table.Column<string>(nullable: false) }, constraints: table => { table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId }); table.ForeignKey( name: "FK_AspNetUserRoles_AspNetRoles_RoleId", column: x => x.RoleId, principalTable: "AspNetRoles", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_AspNetUserRoles_AspNetUsers_UserId", column: x => x.UserId, principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "RoleNameIndex", table: "AspNetRoles", column: "NormalizedName"); migrationBuilder.CreateIndex( name: "IX_AspNetRoleClaims_RoleId", table: "AspNetRoleClaims", column: "RoleId"); migrationBuilder.CreateIndex( name: "IX_AspNetUserClaims_UserId", table: "AspNetUserClaims", column: "UserId"); migrationBuilder.CreateIndex( name: "IX_AspNetUserLogins_UserId", table: "AspNetUserLogins", column: "UserId"); migrationBuilder.CreateIndex( name: "IX_AspNetUserRoles_RoleId", table: "AspNetUserRoles", column: "RoleId"); migrationBuilder.CreateIndex( name: "IX_AspNetUserRoles_UserId", table: "AspNetUserRoles", column: "UserId"); migrationBuilder.CreateIndex( name: "EmailIndex", table: "AspNetUsers", column: "NormalizedEmail"); migrationBuilder.CreateIndex( name: "UserNameIndex", table: "AspNetUsers", column: "NormalizedUserName", unique: true); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "AspNetRoleClaims"); migrationBuilder.DropTable( name: "AspNetUserClaims"); migrationBuilder.DropTable( name: "AspNetUserLogins"); migrationBuilder.DropTable( name: "AspNetUserRoles"); migrationBuilder.DropTable( name: "AspNetUserTokens"); migrationBuilder.DropTable( name: "AspNetRoles"); migrationBuilder.DropTable( name: "AspNetUsers"); } } }
iqduke/Track
src/Track.Auth.Web/Data/Migrations/00000000000000_CreateIdentitySchema.cs
C#
mit
9,250
<!DOCTYPE html> <html> <head> <title>Typewriter</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <ul class="sections"> <li id="section-1"> <div class="annotation"> <div class="pilwrap "> <a class="pilcrow" href="#section-1">&#182;</a> </div> </div> </li> <li id="section-2"> <div class="annotation"> <div class="pilwrap "> <a class="pilcrow" href="#section-2">&#182;</a> </div> <h1 id="typewriter">Typewriter</h1> <p>A simple class which takes all the text content in an element and writes it letter by letter. Takes an <code>options</code> object where <code>timing</code> specifies in milliseconds the time between letters.</p> </div> <div class="content"><div class='highlight'><pre> <span class="hljs-keyword">var</span> Typewriter = <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">el, options</span>) </span>{ <span class="hljs-keyword">this</span>.el = el; <span class="hljs-keyword">this</span>.options = Typewriter.util.defaults(options, { <span class="hljs-attr">timing</span>: <span class="hljs-number">100</span> }); <span class="hljs-keyword">this</span>.first = <span class="hljs-literal">true</span>; <span class="hljs-keyword">this</span>.text = <span class="hljs-keyword">this</span>.el.innerHTML; <span class="hljs-keyword">this</span>.position = <span class="hljs-number">0</span>;</pre></div></div> </li> <li id="section-3"> <div class="annotation"> <div class="pilwrap "> <a class="pilcrow" href="#section-3">&#182;</a> </div> <p>Insert a space so that the element retains its height until typing starts.</p> </div> <div class="content"><div class='highlight'><pre> <span class="hljs-keyword">this</span>.el.textContent = <span class="hljs-string">"\u200C"</span>; };</pre></div></div> </li> <li id="section-4"> <div class="annotation"> <div class="pilwrap "> <a class="pilcrow" href="#section-4">&#182;</a> </div> <p>Start writing and call a <code>cb</code> function when typing is complete.</p> </div> <div class="content"><div class='highlight'><pre>Typewriter.prototype.start = <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">cb</span>) </span>{</pre></div></div> </li> <li id="section-5"> <div class="annotation"> <div class="pilwrap "> <a class="pilcrow" href="#section-5">&#182;</a> </div> <p>Do nothing if called multiple times</p> </div> <div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> (<span class="hljs-keyword">this</span>.interval === <span class="hljs-literal">undefined</span>){</pre></div></div> </li> <li id="section-6"> <div class="annotation"> <div class="pilwrap "> <a class="pilcrow" href="#section-6">&#182;</a> </div> <p>setInterval to be called every <code>options.timing</code> milliseconds.</p> </div> <div class="content"><div class='highlight'><pre> <span class="hljs-keyword">this</span>.interval = setInterval(<span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>) </span>{ <span class="hljs-keyword">if</span> (<span class="hljs-keyword">this</span>._renderNextCharacter()) {</pre></div></div> </li> <li id="section-7"> <div class="annotation"> <div class="pilwrap "> <a class="pilcrow" href="#section-7">&#182;</a> </div> <p>When <code>_renderNextCharacter()</code> returns true, stop writing and callback.</p> </div> <div class="content"><div class='highlight'><pre> clearInterval(<span class="hljs-keyword">this</span>.interval); cb(); } }.bind(<span class="hljs-keyword">this</span>), <span class="hljs-keyword">this</span>.options.timing); } };</pre></div></div> </li> <li id="section-8"> <div class="annotation"> <div class="pilwrap "> <a class="pilcrow" href="#section-8">&#182;</a> </div> <p>Adds the next character to the element. Returns true if the last character was added, false otherwise.</p> </div> <div class="content"><div class='highlight'><pre>Typewriter.prototype._renderNextCharacter = <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>) </span>{ <span class="hljs-keyword">if</span> (<span class="hljs-keyword">this</span>.first) {</pre></div></div> </li> <li id="section-9"> <div class="annotation"> <div class="pilwrap "> <a class="pilcrow" href="#section-9">&#182;</a> </div> <p>Since this is the first character, we need to get rid of the space entered by the constructor by replacing all text in the element.</p> </div> <div class="content"><div class='highlight'><pre> <span class="hljs-keyword">this</span>.el.textContent = <span class="hljs-keyword">this</span>.text[<span class="hljs-keyword">this</span>.position]; <span class="hljs-keyword">this</span>.first = <span class="hljs-literal">false</span>; } <span class="hljs-keyword">else</span> {</pre></div></div> </li> <li id="section-10"> <div class="annotation"> <div class="pilwrap "> <a class="pilcrow" href="#section-10">&#182;</a> </div> <p>Add the next letter.</p> </div> <div class="content"><div class='highlight'><pre> <span class="hljs-keyword">this</span>.el.textContent = <span class="hljs-keyword">this</span>.el.textContent + <span class="hljs-keyword">this</span>.text[<span class="hljs-keyword">this</span>.position]; } <span class="hljs-keyword">this</span>.position++;</pre></div></div> </li> <li id="section-11"> <div class="annotation"> <div class="pilwrap "> <a class="pilcrow" href="#section-11">&#182;</a> </div> <p>Check to see if this was the last letter.</p> </div> <div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> (<span class="hljs-keyword">this</span>.position &gt; <span class="hljs-keyword">this</span>.text.length - <span class="hljs-number">1</span>) <span class="hljs-keyword">return</span> <span class="hljs-literal">true</span>; <span class="hljs-keyword">else</span> <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>; };</pre></div></div> </li> <li id="section-12"> <div class="annotation"> <div class="pilwrap "> <a class="pilcrow" href="#section-12">&#182;</a> </div> <h1 id="util">Util</h1> </div> <div class="content"><div class='highlight'><pre>Typewriter.util = {};</pre></div></div> </li> <li id="section-13"> <div class="annotation"> <div class="pilwrap "> <a class="pilcrow" href="#section-13">&#182;</a> </div> <p>Utility function to replace undefined keys in <code>object</code> with those from a list of <code>defaults</code>. Will alter the original object.</p> </div> <div class="content"><div class='highlight'><pre>Typewriter.util.defaults = <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">object, defaults</span>) </span>{ <span class="hljs-keyword">for</span> (<span class="hljs-keyword">var</span> key <span class="hljs-keyword">in</span> defaults) {</pre></div></div> </li> <li id="section-14"> <div class="annotation"> <div class="pilwrap "> <a class="pilcrow" href="#section-14">&#182;</a> </div> <p>Do a simple undefined check in the source object</p> </div> <div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> (object[key] === <span class="hljs-literal">undefined</span>) {</pre></div></div> </li> <li id="section-15"> <div class="annotation"> <div class="pilwrap "> <a class="pilcrow" href="#section-15">&#182;</a> </div> <p>Then copy value from the defaults object</p> </div> <div class="content"><div class='highlight'><pre> object[key] = defaults[key]; } } <span class="hljs-keyword">return</span> object; };</pre></div></div> </li> <li id="section-16"> <div class="annotation"> <div class="pilwrap "> <a class="pilcrow" href="#section-16">&#182;</a> </div> <p>Export the module to either CommonJS or window</p> </div> <div class="content"><div class='highlight'><pre><span class="hljs-keyword">if</span> (<span class="hljs-keyword">typeof</span> <span class="hljs-built_in">module</span> !== <span class="hljs-string">'undefined'</span> &amp;&amp; <span class="hljs-built_in">module</span>.exports) { <span class="hljs-built_in">module</span>.exports = Typewriter; } <span class="hljs-keyword">else</span> { <span class="hljs-built_in">window</span>.Typewriter = Typewriter; }</pre></div></div> </li> </ul> </div> </body> </html>
Tellan/Typewriter
docs/typewriter.html
HTML
mit
11,357
/* * filterable.js v2.0 * Created by Howard Dyer (http://www.howard-dyer.co.uk) * Licensed under MIT (https://github.com/howarddyer/filterable.js/blob/master/LICENSE) */ $.fn.extend({ filterable: function() { elements = this; var viewModel = { queryString: ko.observable(), matches: ko.observable() } viewModel.queryString.subscribe(function(queryString) { startFilter(queryString); }) function startFilter(queryString) { if(queryString[queryString.length -1] == ',') queryString = queryString.slice(0,-1); queryArr = queryString.split(','); matchCount = 0; $(elements).each(function() { el = this; if(queryArr == '') return $(el).removeClass('filterable-match').removeClass('filterable-no-match') content = $(el).text().replace(/\s\s/g,''); if(matchString(queryArr,content)) { $(el).addClass('filterable-match').removeClass('filterable-no-match'); matchCount++; } else { $(this).addClass('filterable-no-match').removeClass('filterable-match'); } }) function matchString(queryArr,content) { var unmatched = false; $.each(queryArr, function(i,query) { if(unmatched) return; if(!(content.indexOf(query)>0)) unmatched = true; }) return (unmatched) ? false : true; } viewModel.matches(matchCount) } ko.applyBindings(viewModel); } })
howarddyer/filterable.js
filterable.js
JavaScript
mit
1,496
# # ChainDb.py - Bitcoin blockchain database # # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # import string import cStringIO import leveldb import io import os import time from decimal import Decimal from Cache import Cache from bitcoin.serialize import * from bitcoin.core import * from bitcoin.messages import msg_block, message_to_str, message_read from bitcoin.coredefs import COIN from bitcoin.scripteval import VerifySignature import zlib def tx_blk_cmp(a, b): if a.dFeePerKB != b.dFeePerKB: return int(a.dFeePerKB - b.dFeePerKB) return int(a.dPriority - b.dPriority) def block_value(height, fees): subsidy = 50 * COIN subsidy >>= (height / 210000) return subsidy + fees class TxIdx(object): def __init__(self, blkhash=0L, spentmask=0L): self.blkhash = blkhash self.spentmask = spentmask class BlkMeta(object): def __init__(self): self.height = -1 self.work = 0L def deserialize(self, s): l = s.split() if len(l) < 2: raise RuntimeError self.height = int(l[0]) self.work = long(l[1], 16) def serialize(self): r = str(self.height) + ' ' + hex(self.work) return r def __repr__(self): return "BlkMeta(height %d, work %x)" % (self.height, self.work) class HeightIdx(object): def __init__(self): self.blocks = [] def deserialize(self, s): self.blocks = [] l = s.split() for hashstr in l: hash = long(hashstr, 16) self.blocks.append(hash) def serialize(self): l = [] for blkhash in self.blocks: l.append(hex(blkhash)) return ' '.join(l) def __repr__(self): return "HeightIdx(blocks=%s)" % (self.serialize(),) class ChainDb(object): def __init__(self, settings, datadir, log, mempool, netmagic, readonly=False, fast_dbm=False,compression=False): self.settings = settings self.log = log self.mempool = mempool self.readonly = readonly self.netmagic = netmagic self.fast_dbm = fast_dbm self.blk_cache = Cache(1000) self.orphans = {} self.orphan_deps = {} self.compress_on_write = compression # LevelDB to hold: # tx:* transaction outputs # misc:* state # height:* list of blocks at height h # blkmeta:* block metadata # blocks:* block seek point in stream self.blk_write = io.BufferedWriter(io.FileIO(datadir + '/blocks.dat','ab')) self.blk_read = io.BufferedReader(io.FileIO(datadir + '/blocks.dat','rb')) self.db = leveldb.LevelDB(datadir + '/leveldb') try: self.db.Get('misc:height') except KeyError: self.log.write("INITIALIZING EMPTY BLOCKCHAIN DATABASE") batch = leveldb.WriteBatch() batch.Put('misc:height', str(-1)) batch.Put('misc:msg_start', self.netmagic.msg_start) batch.Put('misc:tophash', ser_uint256(0L)) batch.Put('misc:total_work', hex(0L)) self.db.Write(batch) try: start = self.db.Get('misc:msg_start') if start != self.netmagic.msg_start: raise KeyError except KeyError: self.log.write("Database magic number mismatch. Data corruption or incorrect network?") raise RuntimeError def puttxidx(self, txhash, txidx, batch=None): ser_txhash = ser_uint256(txhash) try: self.db.Get('tx:'+ser_txhash) old_txidx = self.gettxidx(txhash) self.log.write("WARNING: overwriting duplicate TX %064x, height %d, oldblk %064x, oldspent %x, newblk %064x" % (txhash, self.getheight(), old_txidx.blkhash, old_txidx.spentmask, txidx.blkhash)) except KeyError: pass batch = self.db if batch is not None else batch batch.Put('tx:'+ser_txhash, hex(txidx.blkhash) + ' ' + hex(txidx.spentmask)) return True def gettxidx(self, txhash): ser_txhash = ser_uint256(txhash) try: ser_value = self.db.Get('tx:'+ser_txhash) except KeyError: return None pos = string.find(ser_value, ' ') txidx = TxIdx() txidx.blkhash = long(ser_value[:pos], 16) txidx.spentmask = long(ser_value[pos+1:], 16) return txidx def gettx(self, txhash): txidx = self.gettxidx(txhash) if txidx is None: return None block = self.getblock(txidx.blkhash) if block: for tx in block.vtx: tx.calc_sha256() if tx.sha256 == txhash: return tx self.log.write("ERROR: Missing TX %064x in block %064x" % (txhash, txidx.blkhash)) return None def haveblock(self, blkhash, checkorphans): if self.blk_cache.exists(blkhash): return True if checkorphans and blkhash in self.orphans: return True ser_hash = ser_uint256(blkhash) try: self.db.Get('blocks:'+ser_hash) return True except KeyError: return False def have_prevblock(self, block): if self.getheight() < 0 and block.sha256 == self.netmagic.block0: return True if self.haveblock(block.hashPrevBlock, False): return True return False def getblock(self, blkhash): block = self.blk_cache.get(blkhash) if block is not None: return block ser_hash = ser_uint256(blkhash) try: # Lookup the block index, seek in the file fpos = long(self.db.Get('blocks:'+ser_hash)) self.blk_read.seek(fpos) # read and decode "block" msg recvbuf = self.blk_read.read(4+4) if recvbuf[:4] == 'ZLIB': msg_len = int(recvbuf[4:8].encode('hex'),16) recvbuf = self.blk_read.read(msg_len) f = cStringIO.StringIO(zlib.decompress(recvbuf)) msg = message_read(self.netmagic, f) else: self.blk_read.seek(fpos) msg = message_read(self.netmagic, self.blk_read) if msg is None: return None block = msg.block except KeyError: return None self.blk_cache.put(blkhash, block) return block def spend_txout(self, txhash, n_idx, batch=None): txidx = self.gettxidx(txhash) if txidx is None: return False txidx.spentmask |= (1L << n_idx) self.puttxidx(txhash, txidx, batch) return True def clear_txout(self, txhash, n_idx, batch=None): txidx = self.gettxidx(txhash) if txidx is None: return False txidx.spentmask &= ~(1L << n_idx) self.puttxidx(txhash, txidx, batch) return True def unique_outpts(self, block): outpts = {} txmap = {} for tx in block.vtx: if tx.is_coinbase: continue txmap[tx.sha256] = tx for txin in tx.vin: v = (txin.prevout.hash, txin.prevout.n) if v in outs: return None outpts[v] = False return (outpts, txmap) def txout_spent(self, txout): txidx = self.gettxidx(txout.hash) if txidx is None: return None if txout.n > 100000: # outpoint index sanity check return None if txidx.spentmask & (1L << txout.n): return True return False def spent_outpts(self, block): # list of outpoints this block wants to spend l = self.unique_outpts(block) if l is None: return None outpts = l[0] txmap = l[1] spendlist = {} # pass 1: if outpoint in db, make sure it is unspent for k in outpts.iterkeys(): outpt = COutPoint() outpt.hash = k[0] outpt.n = k[1] rc = self.txout_spent(outpt) if rc is None: continue if rc: return None outpts[k] = True # skip in pass 2 # pass 2: remaining outpoints must exist in this block for k, v in outpts.iteritems(): if v: continue if k[0] not in txmap: # validate txout hash return None tx = txmap[k[0]] # validate txout index (n) if k[1] >= len(tx.vout): return None # outpts[k] = True # not strictly necessary return outpts.keys() def tx_signed(self, tx, block, check_mempool): tx.calc_sha256() for i in xrange(len(tx.vin)): txin = tx.vin[i] # search database for dependent TX txfrom = self.gettx(txin.prevout.hash) # search block for dependent TX if txfrom is None and block is not None: for blktx in block.vtx: blktx.calc_sha256() if blktx.sha256 == txin.prevout.hash: txfrom = blktx break # search mempool for dependent TX if txfrom is None and check_mempool: try: txfrom = self.mempool.pool[txin.prevout.hash] except: self.log.write("TX %064x/%d no-dep %064x" % (tx.sha256, i, txin.prevout.hash)) return False if txfrom is None: self.log.write("TX %064x/%d no-dep %064x" % (tx.sha256, i, txin.prevout.hash)) return False if not VerifySignature(txfrom, tx, i, 0): self.log.write("TX %064x/%d sigfail" % (tx.sha256, i)) return False return True def tx_is_orphan(self, tx): if not tx.is_valid(): return None for txin in tx.vin: rc = self.txout_spent(txin.prevout) if rc is None: # not found: orphan try: txfrom = self.mempool.pool[txin.prevout.hash] except: return True if txin.prevout.n >= len(txfrom.vout): return None if rc is True: # spent? strange return None return False def connect_block(self, ser_hash, block, blkmeta): # verify against checkpoint list try: chk_hash = self.netmagic.checkpoints[blkmeta.height] if chk_hash != block.sha256: self.log.write("Block %064x does not match checkpoint hash %064x, height %d" % ( block.sha256, chk_hash, blkmeta.height)) return False except KeyError: pass # check TX connectivity outpts = self.spent_outpts(block) if outpts is None: self.log.write("Unconnectable block %064x" % (block.sha256, )) return False # verify script signatures if ('nosig' not in self.settings and ('forcesig' in self.settings or blkmeta.height > self.netmagic.checkpoint_max)): for tx in block.vtx: tx.calc_sha256() if tx.is_coinbase(): continue if not self.tx_signed(tx, block, False): self.log.write("Invalid signature in block %064x" % (block.sha256, )) return False # update database pointers for best chain batch = leveldb.WriteBatch() batch.Put('misc:total_work', hex(blkmeta.work)) batch.Put('misc:height', str(blkmeta.height)) batch.Put('misc:tophash', ser_hash) self.log.write("ChainDb: height %d, block %064x" % ( blkmeta.height, block.sha256)) # all TX's in block are connectable; index neverseen = 0 for tx in block.vtx: if not self.mempool.remove(tx.sha256): neverseen += 1 txidx = TxIdx(block.sha256) if not self.puttxidx(tx.sha256, txidx, batch): self.log.write("TxIndex failed %064x" % (tx.sha256,)) return False self.log.write("MemPool: blk.vtx.sz %d, neverseen %d, poolsz %d" % (len(block.vtx), neverseen, self.mempool.size())) # mark deps as spent for outpt in outpts: self.spend_txout(outpt[0], outpt[1], batch) self.db.Write(batch) return True def disconnect_block(self, block): ser_prevhash = ser_uint256(block.hashPrevBlock) prevmeta = BlkMeta() prevmeta.deserialize(self.db.Get('blkmeta:'+ser_prevhash)) tup = self.unique_outpts(block) if tup is None: return False outpts = tup[0] # mark deps as unspent batch = leveldb.WriteBatch() for outpt in outpts: self.clear_txout(outpt[0], outpt[1], batch) # update tx index and memory pool for tx in block.vtx: tx.calc_sha256() ser_hash = ser_uint256(tx.sha256) try: batch.Delete('tx:'+ser_hash) except KeyError: pass if not tx.is_coinbase(): self.mempool.add(tx) # update database pointers for best chain batch.Put('misc:total_work', hex(prevmeta.work)) batch.Put('misc:height', str(prevmeta.height)) batch.Put('misc:tophash', ser_prevhash) self.db.Write(batch) self.log.write("ChainDb(disconn): height %d, block %064x" % ( prevmeta.height, block.hashPrevBlock)) return True def getblockmeta(self, blkhash): ser_hash = ser_uint256(blkhash) try: meta = BlkMeta() meta.deserialize(self.db.Get('blkmeta:'+ser_hash)) except KeyError: return None return meta def getblockheight(self, blkhash): meta = self.getblockmeta(blkhash) if meta is None: return -1 return meta.height def reorganize(self, new_best_blkhash): self.log.write("REORGANIZE") conn = [] disconn = [] old_best_blkhash = self.gettophash() fork = old_best_blkhash longer = new_best_blkhash while fork != longer: while (self.getblockheight(longer) > self.getblockheight(fork)): block = self.getblock(longer) block.calc_sha256() conn.append(block) longer = block.hashPrevBlock if longer == 0: return False if fork == longer: break block = self.getblock(fork) block.calc_sha256() disconn.append(block) fork = block.hashPrevBlock if fork == 0: return False self.log.write("REORG disconnecting top hash %064x" % (old_best_blkhash,)) self.log.write("REORG connecting new top hash %064x" % (new_best_blkhash,)) self.log.write("REORG chain union point %064x" % (fork,)) self.log.write("REORG disconnecting %d blocks, connecting %d blocks" % (len(disconn), len(conn))) for block in disconn: if not self.disconnect_block(block): return False for block in conn: if not self.connect_block(ser_uint256(block.sha256), block, self.getblockmeta(block.sha256)): return False self.log.write("REORGANIZE DONE") return True def set_best_chain(self, ser_prevhash, ser_hash, block, blkmeta): # the easy case, extending current best chain if (blkmeta.height == 0 or self.db.Get('misc:tophash') == ser_prevhash): return self.connect_block(ser_hash, block, blkmeta) # switching from current chain to another, stronger chain return self.reorganize(block.sha256) def height(self,heightstr): try: return self.db.Get('height:'+heightstr) except KeyError: pass def putoneblock(self, block): block.calc_sha256() if not block.is_valid(): self.log.write("Invalid block %064x" % (block.sha256, )) return False if not self.have_prevblock(block): self.orphans[block.sha256] = True self.orphan_deps[block.hashPrevBlock] = block self.log.write("Orphan block %064x (%d orphans)" % (block.sha256, len(self.orphan_deps))) return False top_height = self.getheight() top_work = long(self.db.Get('misc:total_work'), 16) # read metadata for previous block prevmeta = BlkMeta() if top_height >= 0: ser_prevhash = ser_uint256(block.hashPrevBlock) prevmeta.deserialize(self.db.Get('blkmeta:'+ser_prevhash)) else: ser_prevhash = '' batch = leveldb.WriteBatch() # build network "block" msg, as canonical disk storage form msg = msg_block() msg.block = block msg_data = message_to_str(self.netmagic, msg) # write "block" msg to storage fpos = self.blk_write.tell() if self.compress_on_write: msg_data = zlib.compress(msg_data,1) msg_data = struct.pack('>4si%ds' % len(msg_data),'ZLIB',len(msg_data),msg_data) self.blk_write.write(msg_data) self.blk_write.flush() # add index entry ser_hash = ser_uint256(block.sha256) batch.Put('blocks:'+ser_hash, str(fpos)) # store metadata related to this block blkmeta = BlkMeta() blkmeta.height = prevmeta.height + 1 blkmeta.work = (prevmeta.work + uint256_from_compact(block.nBits)) batch.Put('blkmeta:'+ser_hash, blkmeta.serialize()) # store list of blocks at this height heightidx = HeightIdx() heightstr = str(blkmeta.height) try: heightidx.deserialize(self.db.Get('height:'+heightstr)) except KeyError: pass heightidx.blocks.append(block.sha256) batch.Put('height:'+heightstr, heightidx.serialize()) self.db.Write(batch) # if chain is not best chain, proceed no further if (blkmeta.work <= top_work): self.log.write("ChainDb: height %d (weak), block %064x" % (blkmeta.height, block.sha256)) return True # update global chain pointers if not self.set_best_chain(ser_prevhash, ser_hash, block, blkmeta): return False return True def putblock(self, block): block.calc_sha256() if self.haveblock(block.sha256, True): self.log.write("Duplicate block %064x submitted" % (block.sha256, )) return False if not self.putoneblock(block): return False blkhash = block.sha256 while blkhash in self.orphan_deps: block = self.orphan_deps[blkhash] if not self.putoneblock(block): return True del self.orphan_deps[blkhash] del self.orphans[block.sha256] blkhash = block.sha256 return True def locate(self, locator): for hash in locator.vHave: ser_hash = ser_uint256(hash) if ser_hash in self.blkmeta: blkmeta = BlkMeta() blkmeta.deserialize(self.db.Get('blkmeta:'+ser_hash)) return blkmeta return 0 def getheight(self): return int(self.db.Get('misc:height')) def gettophash(self): return uint256_from_str(self.db.Get('misc:tophash')) def loadfile(self, filename): fd = os.open(filename, os.O_RDONLY) self.log.write("IMPORTING DATA FROM " + filename) buf = '' wanted = 4096 while True: if wanted > 0: if wanted < 4096: wanted = 4096 s = os.read(fd, wanted) if len(s) == 0: break buf += s wanted = 0 buflen = len(buf) startpos = string.find(buf, self.netmagic.msg_start) if startpos < 0: wanted = 8 continue sizepos = startpos + 4 blkpos = startpos + 8 if blkpos > buflen: wanted = 8 continue blksize = struct.unpack("<i", buf[sizepos:blkpos])[0] if (blkpos + blksize) > buflen: wanted = 8 + blksize continue ser_blk = buf[blkpos:blkpos+blksize] buf = buf[blkpos+blksize:] f = cStringIO.StringIO(ser_blk) block = CBlock() block.deserialize(f) self.putblock(block) def newblock_txs(self): txlist = [] for tx in self.mempool.pool.itervalues(): # query finalized, non-coinbase mempool tx's if tx.is_coinbase() or not tx.is_final(): continue # iterate through inputs, calculate total input value valid = True nValueIn = 0 nValueOut = 0 dPriority = Decimal(0) for tin in tx.vin: in_tx = self.gettx(tin.prevout.hash) if (in_tx is None or tin.prevout.n >= len(in_tx.vout)): valid = False else: v = in_tx.vout[tin.prevout.n].nValue nValueIn += v dPriority += Decimal(v * 1) if not valid: continue # iterate through outputs, calculate total output value for txout in tx.vout: nValueOut += txout.nValue # calculate fees paid, if any tx.nFeesPaid = nValueIn - nValueOut if tx.nFeesPaid < 0: continue # calculate fee-per-KB and priority tx.ser_size = len(tx.serialize()) dPriority /= Decimal(tx.ser_size) tx.dFeePerKB = (Decimal(tx.nFeesPaid) / (Decimal(tx.ser_size) / Decimal(1000))) if tx.dFeePerKB < Decimal(50000): tx.dFeePerKB = Decimal(0) tx.dPriority = dPriority txlist.append(tx) # sort list by fee-per-kb, then priority sorted_txlist = sorted(txlist, cmp=tx_blk_cmp, reverse=True) # build final list of transactions. thanks to sort # order above, we add TX's to the block in the # highest-fee-first order. free transactions are # then appended in order of priority, until # free_bytes is exhausted. txlist = [] txlist_bytes = 0 free_bytes = 50000 while len(sorted_txlist) > 0: tx = sorted_txlist.pop() if txlist_bytes + tx.ser_size > (900 * 1000): continue if tx.dFeePerKB > 0: txlist.append(tx) txlist_bytes += tx.ser_size elif free_bytes >= tx.ser_size: txlist.append(tx) txlist_bytes += tx.ser_size free_bytes -= tx.ser_size return txlist def newblock(self): tophash = self.gettophash() prevblock = self.getblock(tophash) if prevblock is None: return None # obtain list of candidate transactions for a new block total_fees = 0 txlist = self.newblock_txs() for tx in txlist: total_fees += tx.nFeesPaid # # build coinbase # txin = CTxIn() txin.prevout.set_null() # FIXME: txin.scriptSig txout = CTxOut() txout.nValue = block_value(self.getheight(), total_fees) # FIXME: txout.scriptPubKey coinbase = CTransaction() coinbase.vin.append(txin) coinbase.vout.append(txout) # # build block # block = CBlock() block.hashPrevBlock = tophash block.nTime = int(time.time()) block.nBits = prevblock.nBits # TODO: wrong block.vtx.append(coinbase) block.vtx.extend(txlist) block.hashMerkleRoot = block.calc_merkle() return block
daedalus/python-bitcoin_r
ChainDb.py
Python
mit
20,073
using SpectrumFish; using Moq; using NUnit.Framework; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Num = System.Int32; namespace SpectrumFish.Tests { [TestFixture] class Z80Tests { [Test] public void GivenZ80WithChanges_WhenReset_ThenRegistersAndStuffMatchNewZ80() { // arrange var mockMem = new Mock<IMemory>(); var mockPorts = new Mock<IPorts>(); var testZ80 = new Z80(mockMem.Object, mockPorts.Object); testZ80.a = testZ80.f = testZ80.b = testZ80.c = testZ80.d = testZ80.e = testZ80.h = testZ80.l = 1; testZ80.a_ = testZ80.f_ = testZ80.b_ = testZ80.c_ = testZ80.d_ = testZ80.e_ = testZ80.h_ = testZ80.l_ = 1; testZ80.ixh = testZ80.ixl = testZ80.iyh = testZ80.iyl = 1; testZ80.i = 1; testZ80.r = 1; testZ80.r7 = 1; testZ80.sp = testZ80.pc = 1; testZ80.iff1 = testZ80.iff2 = testZ80.im = 1; testZ80.halted = true; //// act testZ80.reset(); // assert var expected = new Z80(mockMem.Object, mockPorts.Object); //Assert. (new Z80(mockMem.Object, mockPorts.Object), testZ80); Assert.AreEqual(expected, testZ80); } [Test] public void GivenNewZ80_WhenInterrupt_ThenWriteByteIsntCalled() { // arrange var mockMem = new Mock<IMemory>(); var writebyteIsCalled = false; mockMem.Setup(mem => mem.WriteByte(It.IsAny<Num>(), It.IsAny<Num>())).Callback(() => writebyteIsCalled = true); var mockPorts = new Mock<IPorts>(); var expected = new Z80(mockMem.Object, mockPorts.Object); var testZ80 = new Z80(mockMem.Object, mockPorts.Object); // act testZ80.interrupt(); // assert Assert.AreEqual(expected, testZ80); Assert.IsFalse(writebyteIsCalled); } [Test] public void GivenZ80WithIff1_WhenInterrupt_ThenStackPointCalled() { // arrange var mockMem = new Mock<IMemory>(); var writebyteIsCalled = false; mockMem.Setup(mem => mem.WriteByte(65534, 0)).Callback(() => writebyteIsCalled = true); var mockPorts = new Mock<IPorts>(); var testZ80 = new Z80(mockMem.Object, mockPorts.Object); // act testZ80.iff1 = 1; testZ80.halted = false; testZ80.im = 0; testZ80.interrupt(); // assert var expected = new Z80(mockMem.Object, mockPorts.Object) { r = 1, sp = 65534, pc = 56, tstates = 12 }; Assert.AreEqual(expected, testZ80); Assert.IsTrue(writebyteIsCalled); } [Test] public void GivenZ80IsHalted_WhenInterrupt_ThenStuffhappens() { // arrange Z80 expected = null; var mockMem = new Mock<IMemory>(); var writebyteIsCalled = false; mockMem.Setup(mem => mem.WriteByte(It.IsAny<Num>(), It.IsAny<Num>())).Callback(() => writebyteIsCalled = true); var mockPorts = new Mock<IPorts>(); var testZ80 = new Z80(mockMem.Object, mockPorts.Object); // act testZ80.iff1 = 0; testZ80.halted = false; testZ80.im = 0; testZ80.interrupt(); // assert expected = new Z80(mockMem.Object, mockPorts.Object) { r = 0, sp = 0, pc = 0 }; Assert.AreEqual(expected, testZ80); Assert.False(writebyteIsCalled); //----------------------------------------------------- // arrange writebyteIsCalled = false; mockMem.Setup(mem => mem.WriteByte(65534, 0)).Callback(() => writebyteIsCalled = true); // act testZ80.iff1 = 1; testZ80.halted = false; testZ80.im = 0; testZ80.interrupt(); // assert expected = new Z80(mockMem.Object, mockPorts.Object) { r = 1, sp = 65534, pc = 56, tstates = 12 }; Assert.AreEqual(expected, testZ80); Assert.IsTrue(writebyteIsCalled); //----------------------------------------------------- // arrange writebyteIsCalled = false; mockMem.Setup(mem => mem.WriteByte(65532, 57)).Callback(() => writebyteIsCalled = true); // act testZ80.iff1 = 1; testZ80.halted = true; testZ80.im = 0; testZ80.interrupt(); // assert expected = new Z80(mockMem.Object, mockPorts.Object) { r = 2, sp = 65532, pc = 56, tstates = 24 }; Assert.AreEqual(expected, testZ80); Assert.IsTrue(writebyteIsCalled); //----------------------------------------------------- // arrange writebyteIsCalled = false; mockMem.Setup(mem => mem.WriteByte(65530, 57)).Callback(() => writebyteIsCalled = true); //Act testZ80.iff1 = 1; testZ80.halted = true; testZ80.im = 1; testZ80.interrupt(); // assert expected = new Z80(mockMem.Object, mockPorts.Object) { r = 3, sp = 65530, pc = 56, im = 1, tstates = 37 }; Assert.AreEqual(expected, testZ80); Assert.IsTrue(writebyteIsCalled); //----------------------------------------------------- // arrange writebyteIsCalled = false; mockMem.Setup(mem => mem.WriteByte(65528, 57)).Callback(() => writebyteIsCalled = true); //Act testZ80.iff1 = 1; testZ80.halted = true; testZ80.im = 2; testZ80.interrupt(); // assert expected = new Z80(mockMem.Object, mockPorts.Object) { r = 4, sp = 65528, im = 2, tstates = 56 }; Assert.AreEqual(expected, testZ80); Assert.IsTrue(writebyteIsCalled); } [Test] public void GivenZ80_WhenNMI_ThenSomethingHappens() { // arrange var mockMem = new Mock<IMemory>(); var writebyteIsCalled = false; mockMem.Setup(mem => mem.WriteByte(65534, 0)).Callback(() => writebyteIsCalled = true); var mockPorts = new Mock<IPorts>(); var testZ80 = new Z80(mockMem.Object, mockPorts.Object); // act testZ80.iff1 = 1; testZ80.halted = false; testZ80.im = 0; testZ80.interrupt(); // assert var expected = new Z80(mockMem.Object, mockPorts.Object) { r=1, sp = 65534, pc=56, tstates = 12 }; Assert.AreEqual(expected, testZ80); Assert.IsTrue(writebyteIsCalled); } } }
FinnAngelo/Tomfoolery
ZX/ZxMe/FAfx.SpectrumFish.Tests/Z80Tests.cs
C#
mit
7,053
"""Convert CSV containing grid row/column IDs and category values to GeoJSON.""" import csv import argparse from geojson import Polygon, Feature, FeatureCollection, dump def main(): parser = argparse.ArgumentParser() parser.add_argument("csv_in") parser.add_argument("-columns", nargs="+", default=[]) args = parser.parse_args() with open(args.csv_in, 'r') as fin: csvreader = csv.reader(fin) header = next(csvreader) rid_idx = header.index('rid') cid_idx = header.index('cid') empath_indices = {} if not args.columns: for i in range(0, len(header)): if header[i] == 'rid' or header[i] == 'cid': continue empath_indices[header[i]] = i else: for cat in args.columns: empath_indices[cat] = header.index(cat) features = [] for line in csvreader: cid = line[cid_idx] rid = line[rid_idx] properties = {'rid':rid, 'cid':cid} for cat in empath_indices: properties[cat] = float(line[empath_indices[cat]]) bottomleftcorner = (float(cid) / 10**3, float(rid) / 10**3) coords = [bottomleftcorner] for i in [(0.001, 0), (0.001, 0.001), (0, 0.001), (0,0)]: coords.append((bottomleftcorner[0] + i[1], bottomleftcorner[1] + i[0])) features.append(Feature(geometry=Polygon([coords]), properties=properties)) with open(args.csv_in.replace(".csv", ".geojson"), 'w') as fout: dump(FeatureCollection(features), fout) if __name__ == "__main__": main()
joh12041/route-externalities
utils/grid_csv_to_geojson.py
Python
mit
1,678
// // TriviaTimer.m // TriviaPlayer // // Created by Nur Monson on 11/2/06. // Copyright 2006 theidiotproject. All rights reserved. // #import "TriviaTimer.h" @interface TriviaTimer (Private) - (void)timerFired:(NSTimer *)theTimer; - (void)addElapsedTime; @end @implementation TriviaTimer - (id)init { if( (self = [super init]) ) { targetObject = nil; lastTime = 0.0; timeElapsed = 0.0; timeLength = 0.0; stopped = YES; paused = NO; timer = nil; } return self; } - (void)dealloc { [self stop]; [super dealloc]; } + (TriviaTimer *)timerWithLength:(NSTimeInterval)length interval:(NSTimeInterval)interval target:(id)target selector:(SEL)selector { id newInstance = [[[self class] alloc] init]; [newInstance setTimeLength:length]; [newInstance setTimeInterval:interval]; [newInstance setTarget:target selector:selector]; return [newInstance autorelease]; } #pragma mark Set and Get - (NSTimeInterval)timeLength { return timeLength; } - (void)setTimeLength:(NSTimeInterval)length { if( length <= 0.0 ) return; timeLength = length; } - (NSTimeInterval)timeElapsed { return timeElapsed; } - (void)setTimeInterval:(NSTimeInterval)interval { if( interval <= 0.0 ) return; timeInterval = interval; } - (void)setTarget:(id)target selector:(SEL)selector { targetObject = target; targetSelector = selector; } #pragma mark running methods // will start from the begining - (void)start { if( timeLength <= 0.0 || timeInterval <= 0.0 ) return; [self stop]; paused = NO; stopped = NO; timeElapsed = 0.0; lastTime = [NSDate timeIntervalSinceReferenceDate]; timer = [NSTimer scheduledTimerWithTimeInterval:timeInterval target:self selector:@selector(timerFired:) userInfo:nil repeats:YES]; } - (void)stop { [timer invalidate]; timer = nil; if( stopped ) return; if( !paused ) [self addElapsedTime]; stopped = YES; } - (void)pause { if( stopped ) return; if( paused ) { // unpause lastTime = [NSDate timeIntervalSinceReferenceDate]; timer = [NSTimer scheduledTimerWithTimeInterval:timeInterval target:self selector:@selector(timerFired:) userInfo:nil repeats:YES]; paused = NO; } else { // pause [self addElapsedTime]; [timer invalidate]; timer = nil; paused = YES; } } - (BOOL)paused { return paused; } - (BOOL)stopped { return stopped; } - (void)timerFired:(NSTimer *)theTimer { [self addElapsedTime]; if( timeElapsed >= timeLength ) { [timer invalidate]; timer = nil; timeElapsed = 0.0; stopped = YES; } if( targetObject != nil ) [targetObject performSelector:targetSelector]; } - (void)addElapsedTime { NSTimeInterval thisTime = [NSDate timeIntervalSinceReferenceDate]; NSTimeInterval dt = thisTime - lastTime; timeElapsed += dt; lastTime = thisTime; } @end
samiamwork/Questionable
Source/Helpers/TriviaTimer.m
Matlab
mit
2,800
package cz.mjanys.web.user.converter; import com.google.common.collect.Sets; import cz.mjanys.iface.dto.Role; import cz.mjanys.web.user.pto.UserPto; import cz.mjanys.iface.converter.generic.AbstractExtendedConverter; import cz.mjanys.iface.dto.User; import org.springframework.stereotype.Component; import org.springframework.util.Assert; import java.util.HashSet; import java.util.Map; import java.util.Set; /** * @author Martin Janys */ @Component public class UserPtoToDtoConverter extends AbstractExtendedConverter<UserPto, User> { @Override public User newTarget() { return new User(); } @Override public User convert(UserPto source, User target) { Assert.notNull(source); Assert.notNull(target); target.setId(source.getId()); target.setUsername(source.getUsername()); target.setPassword(source.getPassword()); target.setEnable(source.isEnable()); target.setRoles(roles(source.getRoles())); return target; } private Set<Role> roles(Map<Role, Boolean> roles) { Set<Role> set = Sets.newHashSet(); for (Map.Entry<Role, Boolean> entry : roles.entrySet()) { if (entry.getValue()) { set.add(entry.getKey()); } } return set; } }
mjanys/Simple-CMS
src/main/java/cz/mjanys/web/user/converter/UserPtoToDtoConverter.java
Java
mit
1,313
<?php namespace Kubus\BackendBundle\Entity; use Doctrine\ORM\Mapping as ORM; /** * LessonLocation */ class LessonLocation { /** * @var integer */ private $id; /** * @var string */ private $street; /** * @var string */ private $postcode; /** * @var string */ private $city; /** * @var string */ private $country; /** * @var string */ private $room; /** * @var string */ private $description; /** * @var \DateTime */ private $createdAt; /** * @var \DateTime */ private $updatedAt; /** * Get id * * @return integer */ public function getId() { return $this->id; } /** * Set street * * @param string $street * @return LessonLocation */ public function setStreet($street) { $this->street = $street; return $this; } /** * Get street * * @return string */ public function getStreet() { return $this->street; } /** * Set postcode * * @param string $postcode * @return LessonLocation */ public function setPostcode($postcode) { $this->postcode = $postcode; return $this; } /** * Get postcode * * @return string */ public function getPostcode() { return $this->postcode; } /** * Set city * * @param string $city * @return LessonLocation */ public function setCity($city) { $this->city = $city; return $this; } /** * Get city * * @return string */ public function getCity() { return $this->city; } /** * Set country * * @param string $country * @return LessonLocation */ public function setCountry($country) { $this->country = $country; return $this; } /** * Get country * * @return string */ public function getCountry() { return $this->country; } /** * Set room * * @param string $room * @return LessonLocation */ public function setRoom($room) { $this->room = $room; return $this; } /** * Get room * * @return string */ public function getRoom() { return $this->room; } /** * Set description * * @param string $description * @return LessonLocation */ public function setDescription($description) { $this->description = $description; return $this; } /** * Get description * * @return string */ public function getDescription() { return $this->description; } /** * Set createdAt * * @param \DateTime $createdAt * @return LessonLocation */ public function setCreatedAt($createdAt) { $this->createdAt = $createdAt; return $this; } /** * Get createdAt * * @return \DateTime */ public function getCreatedAt() { return $this->createdAt; } /** * Set updatedAt * * @param \DateTime $updatedAt * @return LessonLocation */ public function setUpdatedAt($updatedAt) { $this->updatedAt = $updatedAt; return $this; } /** * Get updatedAt * * @return \DateTime */ public function getUpdatedAt() { return $this->updatedAt; } }
RonaldKlaus/kubus2
src/Kubus/BackendBundle/Entity/LessonLocation.php
PHP
mit
3,695
<!-- Javascript --> <script type="text/javascript" src="{{site.baseurl}}/assets/plugins/jquery-1.11.3.min.js"></script> <script type="text/javascript" src="{{site.baseurl}}/assets/plugins/bootstrap/js/bootstrap.min.js"></script> <!-- custom js --> <script type="text/javascript" src="{{site.baseurl}}/assets/js/main.js"></script> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create', '{{ ga_code }}', 'auto'); ga('send', 'pageview'); window.fbAsyncInit = function() { FB.init({ appId : "{{site.fb_app_id}}", xfbml : true, version : 'v2.6' }); }; (function(d, s, id){ var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/sdk.js"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); </script>
zhuongnx/zhuongnx.github.io
_includes/scripts.html
HTML
mit
1,255
<?php namespace o; class u_Request extends OStdModule { private $userAgent = null; private $url = null; function u_print_info () { $this->ARGS('', func_get_args()); $dump = Tht::getInfoDump(); Security::safePrint($dump); } function u_get_ip($flags=null) { $this->ARGS('m', func_get_args()); $flags = $this->flags($flags, [ 'all' => false, ]); $ip = Tht::getPhpGlobal('server', 'REMOTE_ADDR'); $ips = preg_split('/\s*,\s*/', $ip); if ($flags['all']) { return OList::create($ips); } else { return $ips[0]; } } // TODO: support proxies (via HTTP_X_FORWARDED_PROTO?) function u_is_https () { $this->ARGS('', func_get_args()); $https = Tht::getPhpGlobal('server', 'HTTPS'); $port = Tht::getPhpGlobal('server', 'SERVER_PORT'); return (!empty($https) && $https !== 'off') || intval($port) === 443; } function u_get_user_agent() { $this->ARGS('', func_get_args()); if ($this->userAgent) { return $this->userAgent; } $rawUa = Tht::getPhpGlobal('server', 'HTTP_USER_AGENT'); $ua = $this->parseUserAgent($rawUa); $this->userAgent = OMap::create($ua); return $this->userAgent; } function u_get_method() { $this->ARGS('', func_get_args()); $method = strtolower(Tht::getPhpGlobal('server', 'REQUEST_METHOD')); return $method; } function u_get_referrer() { $this->ARGS('', func_get_args()); return Tht::getPhpGlobal('server', 'HTTP_REFERER'); } // THANKS: http://www.thefutureoftheweb.com/blog/use-accept-language-header function u_get_languages () { $this->ARGS('', func_get_args()); $langs = []; $acceptLang = strtolower(Tht::getPhpGlobal('server', 'HTTP_ACCEPT_LANGUAGE')); if ($acceptLang) { preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/', $acceptLang, $matches); if (count($matches[1])) { $langs = array_combine($matches[1], $matches[4]); foreach ($langs as $lang => $val) { if ($val === '') $langs[$lang] = 1; } arsort($langs, SORT_NUMERIC); } } $langKeys = array_keys($langs); return OList::create($langKeys); } function u_is_ajax () { $this->ARGS('', func_get_args()); $requestedWith = Tht::getPhpGlobal('headers', 'x-requested-with'); return (strtolower($requestedWith) === 'xmlhttprequest'); } function u_get_headers() { $this->ARGS('', func_get_args()); $headers = Tht::getPhpGlobal('headers', '*'); return OMap::create($headers); } function u_get_url() { $this->ARGS('', func_get_args()); if ($this->url) { return $this->url; } $isHttps = $this->u_is_https(); $relativeUrl = $this->relativeUrl(); $scheme = $isHttps ? 'https' : 'http'; $hostWithPort = Tht::getPhpGlobal('server', 'HTTP_HOST'); $fullUrl = $scheme . '://' . $hostWithPort . $relativeUrl; $lUrl = new UrlTypeString($fullUrl); $this->url = $lUrl; return $this->url; } // UTILS // ====================================== function relativeUrl() { // Need to get from query to support FastCGI $pathFromQuery = Tht::getPhpGlobal('get', "_url"); if ($pathFromQuery) { // url is passed without leading slash return '/' . $pathFromQuery; } $path = Tht::getPhpGlobal('server', "REQUEST_URI"); // SCRIPT_URL if ($path) { return $path; } // Look for PHP dev server path instead. $path = Tht::getPhpGlobal('server', "SCRIPT_NAME"); if ($path) { return $path; } Tht::configError("Unable to determine route path. Only Apache and PHP dev server are supported."); } // Very basic parsing to get browser & OS. // Not really concerned with version numbers, etc. function parseUserAgent($rawUa) { $ua = strtolower($rawUa); // Operating System $os = 'other'; if (preg_match('/\b(ipad|ipod|iphone)\b/', $ua)) { $os = 'ios'; } else if (strpos($ua, 'android') !== false) { $os = 'android'; } else if (strpos($ua, 'linux') !== false) { $os = 'linux'; } else if (strpos($ua, 'macintosh') !== false) { $os = 'mac'; } else if (strpos($ua, 'windows') !== false) { $os = 'windows'; } // Browser // (order matters because browsers often include Safari & Chrome) $browser = 'other'; if (strpos($ua, 'trident') !== false) { $browser = 'ie'; } else if (strpos($ua, 'firefox') !== false) { $browser = 'firefox'; } else if (preg_match('/\bedge\b/', $ua)) { $browser = 'edge'; } else if (strpos($ua, 'chrome') !== false) { $browser = 'chrome'; } else if (strpos($ua, 'safari') !== false) { $browser = 'safari'; } $out = [ 'full' => trim($rawUa), 'os' => $os, 'browser' => $browser, ]; return $out; } }
joelesko/tht
tht/lib/modules/Request.php
PHP
mit
5,568
<?php echo "<title>rbl helper</title>"; echo "<h1>rbl helper<sup>0.6</sup></h1>"; echo "<a href='slow.php'>split-process version</a></br>"; echo "<form name='form' method='POST' action='index.php'>"; #initial empty screen if ($_POST['Submit1'] == null) { echo "<textarea name='textarea' rows='20' cols='160'>"; echo "</textarea>"; } #once some input is given and submit button has been clicked upon if ($_POST['Submit1'] == "Parse") { $i = 0; $radio = '12'; #column-to-awk $input = $_POST['textarea']; $inputline = explode("\n",$input); $tripped = explode(" ", $inputline[0]); if ($tripped[$radio] == "from") { #column-to-awk may be 13 instead of 12 $radio = '13'; } foreach ($inputline as $line){ $tripped = explode(" ", $line); $ip[$i] = $tripped[$radio]; $ips = array_unique($ip); $line2 = trim($ips[$i]); $i++; } echo "<textarea name='textarea' rows='20' cols='75'>"; echo implode($ips); echo "</textarea>"; echo "<textarea name='textarea2' rows='20' cols='85'>"; foreach ($ips as $izmama){ $wat = shell_exec('host -W 2 '. $izmama); echo $wat; } echo "</textarea>"; } #button row echo "<br><br><input type='Submit' name='Submit1' value='Parse'></form>"; ?>​
korikori/rbl-helper
index.php
PHP
mit
1,338
#include "Device/AT24CXX/DeviceAT24cxx.h" DEVICE_AT24CXX_STRUCT _deviceAT24CxxObject[BOARD_AT24CXX_NUM_LIMIT] = { 0 }; /*驱动注册*/ /** * Function: * STM32_PLUS_ERR DeviceAT24Cxx_DriverRegister(BOARD_AT24CXX_INDEX index, * DeviceAT24Cxx_Init_FuncPtr init, DeviceAT24Cxx_ReadByte_FuncPtr readByte, * DeviceAT24Cxx_ReadLength_FuncPtr readLength, DeviceAT24Cxx_WriteByte_FuncPtr writeByte, * DeviceAT24Cxx_WriteLength_FuncPtr writeLength) * * Brief: * Device a t 24 cxx driver register. * * Author: * Dink * * Date: * 2017/9/12 * * Param: * index - Zero-based index of the. * init - The init. * readByte - The read byte. * readLength - Length of the read. * writeByte - The write byte. * writeLength - Length of the write. * * Returns: * A STM32_PLUS_ERR. */ STM32_PLUS_ERR DeviceAT24Cxx_DriverRegister(BOARD_AT24CXX_INDEX index, DeviceAT24Cxx_Init_FuncPtr init, DeviceAT24Cxx_ReadByte_FuncPtr readByte, DeviceAT24Cxx_ReadLength_FuncPtr readLength, DeviceAT24Cxx_WriteByte_FuncPtr writeByte, DeviceAT24Cxx_WriteLength_FuncPtr writeLength) { if (index >= BOARD_AT24CXX_NUM_LIMIT) return STM32_PLUS_ERR_DEVICE_NUM_LIMIT; _deviceAT24CxxObject[index].init = init; _deviceAT24CxxObject[index].readByte = readByte; _deviceAT24CxxObject[index].readLength = readLength; _deviceAT24CxxObject[index].writeByte = writeByte; _deviceAT24CxxObject[index].writeLength = writeLength; return STM32_PLUS_ERR_NONE; } /*设备初始化*/ /** * Function: STM32_PLUS_ERR DeviceAT24Cxx_Init(BOARD_AT24CXX_INDEX index) * * Brief: * Device a t 24 cxx init. * * Author: * Dink * * Date: * 2017/9/12 * * Param: * index - Zero-based index of the. * * Returns: * A STM32_PLUS_ERR. */ STM32_PLUS_ERR DeviceAT24Cxx_Init(BOARD_AT24CXX_INDEX index, DEVICE_IIC_STRUCT* iicStruct) { if (index >= BOARD_AT24CXX_NUM_LIMIT) return STM32_PLUS_ERR_DEVICE_NUM_LIMIT; return _deviceAT24CxxObject[index].init(iicStruct); } /*读取一个字节*/ /** * Function: * STM32_PLUS_ERR DeviceAT24Cxx_ReadByte(BOARD_AT24CXX_INDEX index, uint32_t addr, * uint8_t* readDat) * * Brief: * Device a t 24 cxx read byte. * * Author: * Dink * * Date: * 2017/9/12 * * Param: * index - Zero-based index of the. * addr - The address. * readDat - [in,out] If non-null, the read dat. * * Returns: * A STM32_PLUS_ERR. */ STM32_PLUS_ERR DeviceAT24Cxx_ReadByte(BOARD_AT24CXX_INDEX index, uint32_t addr, uint8_t* readDat) { if (index >= BOARD_AT24CXX_NUM_LIMIT) return STM32_PLUS_ERR_DEVICE_NUM_LIMIT; return _deviceAT24CxxObject[index].readByte(addr,readDat); } /*读取指定长度*/ /** * Function: * STM32_PLUS_ERR DeviceAT24Cxx_ReadLength(BOARD_AT24CXX_INDEX index, uint32_t addr, * uint16_t length, uint8_t* readBuffer) * * Brief: * Device a t 24 cxx read length. * * Author: * Dink * * Date: * 2017/9/12 * * Param: * index - Zero-based index of the. * addr - The address. * length - The length. * readBuffer - [in,out] If non-null, buffer for read data. * * Returns: * A STM32_PLUS_ERR. */ STM32_PLUS_ERR DeviceAT24Cxx_ReadLength(BOARD_AT24CXX_INDEX index, uint32_t addr, uint16_t length, uint8_t* readBuffer) { if (index >= BOARD_AT24CXX_NUM_LIMIT) return STM32_PLUS_ERR_DEVICE_NUM_LIMIT; return _deviceAT24CxxObject[index].readLength(addr,length,readBuffer); } /*写入一个字节*/ /** * Function: * STM32_PLUS_ERR DeviceAT24Cxx_WriteByte(BOARD_AT24CXX_INDEX index, uint32_t addr, * uint8_t writeDat) * * Brief: * Device a t 24 cxx write byte. * * Author: * Dink * * Date: * 2017/9/12 * * Param: * index - Zero-based index of the. * addr - The address. * writeDat - The write dat. * * Returns: * A STM32_PLUS_ERR. */ STM32_PLUS_ERR DeviceAT24Cxx_WriteByte(BOARD_AT24CXX_INDEX index, uint32_t addr, uint8_t writeDat) { if (index >= BOARD_AT24CXX_NUM_LIMIT) return STM32_PLUS_ERR_DEVICE_NUM_LIMIT; return _deviceAT24CxxObject[index].writeByte(addr, writeDat); } /*写入指定长度*/ /** * Function: * STM32_PLUS_ERR DeviceAT24Cxx_WriteLength(BOARD_AT24CXX_INDEX index, uint32_t addr, * uint16_t length, uint8_t* writeBuffer) * * Brief: * Device a t 24 cxx write length. * * Author: * Dink * * Date: * 2017/9/12 * * Param: * index - Zero-based index of the. * addr - The address. * length - The length. * writeBuffer - [in,out] If non-null, buffer for write data. * * Returns: * A STM32_PLUS_ERR. */ STM32_PLUS_ERR DeviceAT24Cxx_WriteLength(BOARD_AT24CXX_INDEX index, uint32_t addr, uint16_t length, uint8_t* writeBuffer) { if (index >= BOARD_AT24CXX_NUM_LIMIT) return STM32_PLUS_ERR_DEVICE_NUM_LIMIT; return _deviceAT24CxxObject[index].writeLength(addr, length, writeBuffer); }
dinkdeng/STM32Plus_IAR
IAR/STM32Plus/Device/AT24CXX/DeviceAT24cxx.c
C
mit
5,093
/** * */ package io.pratik.dynamodbapps.models; import java.time.Instant; import java.util.List; import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbAttribute; import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbBean; import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbPartitionKey; import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbSortKey; /** * @author pratikdas * */ @DynamoDbBean public class Order { private String customerID; private String orderID; private double orderValue; private Instant createdDate; private List<Product> products; @DynamoDbPartitionKey @DynamoDbAttribute("CustomerID") public String getCustomerID() { return customerID; } public void setCustomerID(String customerID) { this.customerID = customerID; } @DynamoDbSortKey @DynamoDbAttribute("OrderID") public String getOrderID() { return orderID; } public void setOrderID(String orderID) { this.orderID = orderID; } public Instant getCreatedDate() { return createdDate; } public void setCreatedDate(Instant createdDate) { this.createdDate = createdDate; } public double getOrderValue() { return orderValue; } public void setOrderValue(double orderValue) { this.orderValue = orderValue; } public List<Product> getProducts() { return products; } public void setProducts(List<Product> products) { this.products = products; } }
thombergs/code-examples
aws/springdynamodb/dynamodbec/src/main/java/io/pratik/dynamodbapps/models/Order.java
Java
mit
1,484
--- layout: default --- <div class="home"> {%- if page.title -%} <h1 class="page-heading">{{ page.title }}</h1> {%- endif -%} {{ content }} {%- if site.posts.size > 0 -%} <h3 class="post-list-heading">{{ page.list_title | default: "연구실 소식들 (Group News)" }}</h3> <ul class="post-list"> {%- for post in site.posts limit:3 -%} <li> {%- assign date_format = site.minima.date_format | default: "%b %-d, %Y" -%} <span class="post-meta">{{ post.date | date: date_format }}</span> <h5> <a class="post-link" href="{{ post.url | relative_url }}"> <h6>{{ post.title | escape }}</h6> </a> </h5> {%- if site.show_excerpts -%} {{ post.excerpt }} {%- endif -%} </li> {%- endfor -%} </ul> {%- endif -%} <!-- Start of StatCounter Code for Default Guide --> <script type="text/javascript"> var sc_project=11456678; var sc_invisible=1; var sc_security="fdff3fbd"; var scJsHost = (("https:" == document.location.protocol) ? "https://secure." : "http://www."); document.write("<sc"+"ript type='text/javascript' src='" + scJsHost+ "statcounter.com/counter/counter.js'></"+"script>"); </script> <noscript><div class="statcounter"><a title="free hit counter" href="http://statcounter.com/" target="_blank"><img class="statcounter" src="//c.statcounter.com/11456678/0/fdff3fbd/1/" alt="free hit counter"></a></div></noscript> <!-- End of StatCounter Code for Default Guide --> </div>
gregchung/gregchung.github.io
_layouts/home.html
HTML
mit
1,551
<?php namespace Intervention\Validation\Rules; use Intervention\Validation\AbstractRegexRule; use Illuminate\Contracts\Validation\Rule; class Hexcolor extends AbstractRegexRule implements Rule { /** * Allowed lengths of hexcolor * * @var array */ protected $lengths = [ 3, 6, ]; /** * Create a new rule instance. * * @param int $length * @return void */ public function __construct(?int $length = null) { if (is_int($length)) { $this->lengths = [$length]; } } protected function pattern(): string { return "/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/"; } /** * Determine if the validation rule passes. * * @param string $attribute * @param mixed $value * @return bool */ public function passes($attribute, $value) { if (! $this->hasAllowedLength($value)) { return false; } return parent::passes($attribute, $value); } /** * Determine if the current value has the lenghts of EAN-8 or EAN-13 * * @return boolean */ public function hasAllowedLength($value): bool { return in_array(strlen(trim($value, '#')), $this->lengths); } }
Intervention/validation
src/Rules/Hexcolor.php
PHP
mit
1,297
<?xml version="1.0" ?><!DOCTYPE TS><TS language="es_UY" version="2.1"> <context> <name>AboutDialog</name> <message> <location filename="../forms/aboutdialog.ui" line="+14"/> <source>About Rubycoin</source> <translation type="unfinished"/> </message> <message> <location line="+39"/> <source>&lt;b&gt;Rubycoin&lt;/b&gt; version</source> <translation type="unfinished"/> </message> <message> <location line="+41"/> <source>Copyright © 2009-2014 The Bitcoin developers Copyright © 2012-2014 The NovaCoin developers Copyright © 2014 The Rubycoin developers</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source> This is experimental software. Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php. This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young (eay@cryptsoft.com) and UPnP software written by Thomas Bernard.</source> <translation type="unfinished"/> </message> </context> <context> <name>AddressBookPage</name> <message> <location filename="../forms/addressbookpage.ui" line="+14"/> <source>Address Book</source> <translation type="unfinished"/> </message> <message> <location line="+22"/> <source>Double-click to edit address or label</source> <translation>Doble clic para editar etiqueta o dirección </translation> </message> <message> <location line="+27"/> <source>Create a new address</source> <translation>Crear una nueva dirección </translation> </message> <message> <location line="+14"/> <source>Copy the currently selected address to the system clipboard</source> <translation>Copia la dirección seleccionada al portapapeles del sistema</translation> </message> <message> <location line="-11"/> <source>&amp;New Address</source> <translation type="unfinished"/> </message> <message> <location line="-46"/> <source>These are your Rubycoin addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</source> <translation type="unfinished"/> </message> <message> <location line="+60"/> <source>&amp;Copy Address</source> <translation type="unfinished"/> </message> <message> <location line="+11"/> <source>Show &amp;QR Code</source> <translation type="unfinished"/> </message> <message> <location line="+11"/> <source>Sign a message to prove you own a Rubycoin address</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Sign &amp;Message</source> <translation type="unfinished"/> </message> <message> <location line="+25"/> <source>Delete the currently selected address from the list</source> <translation type="unfinished"/> </message> <message> <location line="-14"/> <source>Verify a message to ensure it was signed with a specified Rubycoin address</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Verify Message</source> <translation type="unfinished"/> </message> <message> <location line="+14"/> <source>&amp;Delete</source> <translation>&amp;Borrar</translation> </message> <message> <location filename="../addressbookpage.cpp" line="+65"/> <source>Copy &amp;Label</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>&amp;Edit</source> <translation type="unfinished"/> </message> <message> <location line="+250"/> <source>Export Address Book Data</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Comma separated file (*.csv)</source> <translation>Archivos separados por coma (*.csv)</translation> </message> <message> <location line="+13"/> <source>Error exporting</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Could not write to file %1.</source> <translation type="unfinished"/> </message> </context> <context> <name>AddressTableModel</name> <message> <location filename="../addresstablemodel.cpp" line="+144"/> <source>Label</source> <translation>Etiqueta</translation> </message> <message> <location line="+0"/> <source>Address</source> <translation>Direccion </translation> </message> <message> <location line="+36"/> <source>(no label)</source> <translation>(Sin etiqueta)</translation> </message> </context> <context> <name>AskPassphraseDialog</name> <message> <location filename="../forms/askpassphrasedialog.ui" line="+26"/> <source>Passphrase Dialog</source> <translation type="unfinished"/> </message> <message> <location line="+21"/> <source>Enter passphrase</source> <translation>Escriba la contraseña</translation> </message> <message> <location line="+14"/> <source>New passphrase</source> <translation>Nueva contraseña</translation> </message> <message> <location line="+14"/> <source>Repeat new passphrase</source> <translation>Repetir nueva contraseña</translation> </message> <message> <location line="+33"/> <source>Serves to disable the trivial sendmoney when OS account compromised. Provides no real security.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>For staking only</source> <translation type="unfinished"/> </message> <message> <location filename="../askpassphrasedialog.cpp" line="+35"/> <source>Enter the new passphrase to the wallet.&lt;br/&gt;Please use a passphrase of &lt;b&gt;10 or more random characters&lt;/b&gt;, or &lt;b&gt;eight or more words&lt;/b&gt;.</source> <translation>Introduzca la nueva contraseña para el monedero. &lt;br/&gt; Utilice una contraseña de &lt;b&gt; 10 o más caracteres al azar &lt;/ b&gt;, o &lt;b&gt; ocho o más palabras &lt;/ b&gt;.</translation> </message> <message> <location line="+1"/> <source>Encrypt wallet</source> <translation>Monedero cifrado</translation> </message> <message> <location line="+7"/> <source>This operation needs your wallet passphrase to unlock the wallet.</source> <translation>Esta operacion necesita la contraseña del monedero para desbloquear el mismo</translation> </message> <message> <location line="+5"/> <source>Unlock wallet</source> <translation>Monedero destrabado</translation> </message> <message> <location line="+3"/> <source>This operation needs your wallet passphrase to decrypt the wallet.</source> <translation>Esta operacion necesita la contraseña del monedero para descifrar el mismo</translation> </message> <message> <location line="+5"/> <source>Decrypt wallet</source> <translation>Monedero descifrado</translation> </message> <message> <location line="+3"/> <source>Change passphrase</source> <translation>Cambiar contraseña</translation> </message> <message> <location line="+1"/> <source>Enter the old and new passphrase to the wallet.</source> <translation>Ingrese la contraseña anterior y la nueva de acceso a el monedero</translation> </message> <message> <location line="+46"/> <source>Confirm wallet encryption</source> <translation>Confirme el cifrado del monedero</translation> </message> <message> <location line="+1"/> <source>Warning: If you encrypt your wallet and lose your passphrase, you will &lt;b&gt;LOSE ALL OF YOUR COINS&lt;/b&gt;!</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Are you sure you wish to encrypt your wallet?</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source>IMPORTANT: Any previous backups you have made of your wallet file should be replaced with the newly generated, encrypted wallet file. For security reasons, previous backups of the unencrypted wallet file will become useless as soon as you start using the new, encrypted wallet.</source> <translation type="unfinished"/> </message> <message> <location line="+103"/> <location line="+24"/> <source>Warning: The Caps Lock key is on!</source> <translation type="unfinished"/> </message> <message> <location line="-133"/> <location line="+60"/> <source>Wallet encrypted</source> <translation>Monedero cifrado</translation> </message> <message> <location line="-58"/> <source>Rubycoin will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your coins from being stolen by malware infecting your computer.</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <location line="+7"/> <location line="+44"/> <location line="+6"/> <source>Wallet encryption failed</source> <translation>Fallo en el cifrado del monedero</translation> </message> <message> <location line="-56"/> <source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source> <translation>Fallo en el cifrado del monedero a causa de un error interno. Su monedero no esta cifrado</translation> </message> <message> <location line="+7"/> <location line="+50"/> <source>The supplied passphrases do not match.</source> <translation>Las contraseñas suministradas no coinciden.</translation> </message> <message> <location line="-38"/> <source>Wallet unlock failed</source> <translation>Fallo en el desbloqueo del mondero</translation> </message> <message> <location line="+1"/> <location line="+12"/> <location line="+19"/> <source>The passphrase entered for the wallet decryption was incorrect.</source> <translation>La contraseña introducida para el descifrado del monedero es incorrecta.</translation> </message> <message> <location line="-20"/> <source>Wallet decryption failed</source> <translation>Fallo en el descifrado del monedero</translation> </message> <message> <location line="+14"/> <source>Wallet passphrase was successfully changed.</source> <translation type="unfinished"/> </message> </context> <context> <name>BitcoinGUI</name> <message> <location filename="../bitcoingui.cpp" line="+280"/> <source>Sign &amp;message...</source> <translation type="unfinished"/> </message> <message> <location line="+242"/> <source>Synchronizing with network...</source> <translation>Sincronizando con la red...</translation> </message> <message> <location line="-308"/> <source>&amp;Overview</source> <translation>&amp;Vista previa</translation> </message> <message> <location line="+1"/> <source>Show general overview of wallet</source> <translation>Mostrar descripción general del monedero</translation> </message> <message> <location line="+17"/> <source>&amp;Transactions</source> <translation>&amp;transaciones </translation> </message> <message> <location line="+1"/> <source>Browse transaction history</source> <translation>Buscar en el historial de transacciones</translation> </message> <message> <location line="+5"/> <source>&amp;Address Book</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Edit the list of stored addresses and labels</source> <translation type="unfinished"/> </message> <message> <location line="-13"/> <source>&amp;Receive coins</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Show the list of addresses for receiving payments</source> <translation type="unfinished"/> </message> <message> <location line="-7"/> <source>&amp;Send coins</source> <translation type="unfinished"/> </message> <message> <location line="+35"/> <source>E&amp;xit</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Quit application</source> <translation>Salir de la aplicacion </translation> </message> <message> <location line="+4"/> <source>Show information about Rubycoin</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>About &amp;Qt</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Show information about Qt</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>&amp;Options...</source> <translation>&amp;Opciones...</translation> </message> <message> <location line="+4"/> <source>&amp;Encrypt Wallet...</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Backup Wallet...</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>&amp;Change Passphrase...</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="+250"/> <source>~%n block(s) remaining</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location line="+6"/> <source>Downloaded %1 of %2 blocks of transaction history (%3% done).</source> <translation type="unfinished"/> </message> <message> <location line="-247"/> <source>&amp;Export...</source> <translation type="unfinished"/> </message> <message> <location line="-62"/> <source>Send coins to a Rubycoin address</source> <translation type="unfinished"/> </message> <message> <location line="+45"/> <source>Modify configuration options for Rubycoin</source> <translation type="unfinished"/> </message> <message> <location line="+18"/> <source>Export the data in the current tab to a file</source> <translation type="unfinished"/> </message> <message> <location line="-14"/> <source>Encrypt or decrypt wallet</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Backup wallet to another location</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Change the passphrase used for wallet encryption</source> <translation>Cambie la clave utilizada para el cifrado del monedero</translation> </message> <message> <location line="+10"/> <source>&amp;Debug window</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Open debugging and diagnostic console</source> <translation type="unfinished"/> </message> <message> <location line="-5"/> <source>&amp;Verify message...</source> <translation type="unfinished"/> </message> <message> <location line="-200"/> <source>Rubycoin</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Wallet</source> <translation type="unfinished"/> </message> <message> <location line="+178"/> <source>&amp;About Rubycoin</source> <translation type="unfinished"/> </message> <message> <location line="+9"/> <source>&amp;Show / Hide</source> <translation type="unfinished"/> </message> <message> <location line="+9"/> <source>Unlock wallet</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>&amp;Lock Wallet</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Lock wallet</source> <translation type="unfinished"/> </message> <message> <location line="+34"/> <source>&amp;File</source> <translation>&amp;Archivo</translation> </message> <message> <location line="+8"/> <source>&amp;Settings</source> <translation>&amp;Configuracion </translation> </message> <message> <location line="+8"/> <source>&amp;Help</source> <translation>&amp;Ayuda</translation> </message> <message> <location line="+9"/> <source>Tabs toolbar</source> <translation>Barra de herramientas</translation> </message> <message> <location line="+8"/> <source>Actions toolbar</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <location line="+9"/> <source>[testnet]</source> <translation>[prueba_de_red]</translation> </message> <message> <location line="+0"/> <location line="+60"/> <source>Rubycoin client</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="+70"/> <source>%n active connection(s) to Rubycoin network</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location line="+40"/> <source>Downloaded %1 blocks of transaction history.</source> <translation type="unfinished"/> </message> <message> <location line="+413"/> <source>Staking.&lt;br&gt;Your weight is %1&lt;br&gt;Network weight is %2&lt;br&gt;Expected time to earn reward is %3</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Not staking because wallet is locked</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Not staking because wallet is offline</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Not staking because wallet is syncing</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Not staking because you don&apos;t have mature coins</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="-403"/> <source>%n second(s) ago</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location line="-284"/> <source>&amp;Unlock Wallet...</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="+288"/> <source>%n minute(s) ago</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message numerus="yes"> <location line="+4"/> <source>%n hour(s) ago</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message numerus="yes"> <location line="+4"/> <source>%n day(s) ago</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location line="+6"/> <source>Up to date</source> <translation>A la fecha</translation> </message> <message> <location line="+7"/> <source>Catching up...</source> <translation>Ponerse al dia...</translation> </message> <message> <location line="+10"/> <source>Last received block was generated %1.</source> <translation type="unfinished"/> </message> <message> <location line="+59"/> <source>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?</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Confirm transaction fee</source> <translation type="unfinished"/> </message> <message> <location line="+27"/> <source>Sent transaction</source> <translation>Transaccion enviada</translation> </message> <message> <location line="+1"/> <source>Incoming transaction</source> <translation>Transacción entrante</translation> </message> <message> <location line="+1"/> <source>Date: %1 Amount: %2 Type: %3 Address: %4 </source> <translation type="unfinished"/> </message> <message> <location line="+100"/> <location line="+15"/> <source>URI handling</source> <translation type="unfinished"/> </message> <message> <location line="-15"/> <location line="+15"/> <source>URI can not be parsed! This can be caused by an invalid Rubycoin address or malformed URI parameters.</source> <translation type="unfinished"/> </message> <message> <location line="+18"/> <source>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;unlocked&lt;/b&gt;</source> <translation>El Monedero esta &lt;b&gt;cifrado&lt;/b&gt; y actualmente &lt;b&gt;desbloqueado&lt;/b&gt;</translation> </message> <message> <location line="+10"/> <source>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;locked&lt;/b&gt;</source> <translation>El Monedero esta &lt;b&gt;cifrado&lt;/b&gt; y actualmente &lt;b&gt;bloqueado&lt;/b&gt;</translation> </message> <message> <location line="+25"/> <source>Backup Wallet</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Wallet Data (*.dat)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Backup Failed</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>There was an error trying to save the wallet data to the new location.</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="+76"/> <source>%n second(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message numerus="yes"> <location line="+4"/> <source>%n minute(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message numerus="yes"> <location line="+4"/> <source>%n hour(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message numerus="yes"> <location line="+4"/> <source>%n day(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location line="+18"/> <source>Not staking</source> <translation type="unfinished"/> </message> <message> <location filename="../bitcoin.cpp" line="+109"/> <source>A fatal error occurred. Rubycoin can no longer continue safely and will quit.</source> <translation type="unfinished"/> </message> </context> <context> <name>ClientModel</name> <message> <location filename="../clientmodel.cpp" line="+90"/> <source>Network Alert</source> <translation type="unfinished"/> </message> </context> <context> <name>CoinControlDialog</name> <message> <location filename="../forms/coincontroldialog.ui" line="+14"/> <source>Coin Control</source> <translation type="unfinished"/> </message> <message> <location line="+31"/> <source>Quantity:</source> <translation type="unfinished"/> </message> <message> <location line="+32"/> <source>Bytes:</source> <translation type="unfinished"/> </message> <message> <location line="+48"/> <source>Amount:</source> <translation type="unfinished"/> </message> <message> <location line="+32"/> <source>Priority:</source> <translation type="unfinished"/> </message> <message> <location line="+48"/> <source>Fee:</source> <translation type="unfinished"/> </message> <message> <location line="+35"/> <source>Low Output:</source> <translation type="unfinished"/> </message> <message> <location filename="../coincontroldialog.cpp" line="+551"/> <source>no</source> <translation type="unfinished"/> </message> <message> <location filename="../forms/coincontroldialog.ui" line="+51"/> <source>After Fee:</source> <translation type="unfinished"/> </message> <message> <location line="+35"/> <source>Change:</source> <translation type="unfinished"/> </message> <message> <location line="+69"/> <source>(un)select all</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>Tree mode</source> <translation type="unfinished"/> </message> <message> <location line="+16"/> <source>List mode</source> <translation type="unfinished"/> </message> <message> <location line="+45"/> <source>Amount</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Label</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Address</source> <translation>Direccion </translation> </message> <message> <location line="+5"/> <source>Date</source> <translation>Fecha</translation> </message> <message> <location line="+5"/> <source>Confirmations</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Confirmed</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Priority</source> <translation type="unfinished"/> </message> <message> <location filename="../coincontroldialog.cpp" line="-515"/> <source>Copy address</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy label</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <location line="+26"/> <source>Copy amount</source> <translation type="unfinished"/> </message> <message> <location line="-25"/> <source>Copy transaction ID</source> <translation type="unfinished"/> </message> <message> <location line="+24"/> <source>Copy quantity</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Copy fee</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy after fee</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy bytes</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy priority</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy low output</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy change</source> <translation type="unfinished"/> </message> <message> <location line="+317"/> <source>highest</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>high</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>medium-high</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>medium</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>low-medium</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>low</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>lowest</source> <translation type="unfinished"/> </message> <message> <location line="+155"/> <source>DUST</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>yes</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>This label turns red, if the transaction size is bigger than 10000 bytes. This means a fee of at least %1 per kb is required. Can vary +/- 1 Byte per input.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Transactions with higher priority get more likely into a block. This label turns red, if the priority is smaller than &quot;medium&quot;. This means a fee of at least %1 per kb is required.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>This label turns red, if any recipient receives an amount smaller than %1. This means a fee of at least %2 is required. Amounts below 0.546 times the minimum relay fee are shown as DUST.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>This label turns red, if the change is smaller than %1. This means a fee of at least %2 is required.</source> <translation type="unfinished"/> </message> <message> <location line="+37"/> <location line="+66"/> <source>(no label)</source> <translation>(Sin etiqueta)</translation> </message> <message> <location line="-9"/> <source>change from %1 (%2)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>(change)</source> <translation type="unfinished"/> </message> </context> <context> <name>EditAddressDialog</name> <message> <location filename="../forms/editaddressdialog.ui" line="+14"/> <source>Edit Address</source> <translation>Editar dirección</translation> </message> <message> <location line="+11"/> <source>&amp;Label</source> <translation>&amp;Etiqueta</translation> </message> <message> <location line="+10"/> <source>The label associated with this address book entry</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>&amp;Address</source> <translation>&amp;Direccion </translation> </message> <message> <location line="+10"/> <source>The address associated with this address book entry. This can only be modified for sending addresses.</source> <translation type="unfinished"/> </message> <message> <location filename="../editaddressdialog.cpp" line="+20"/> <source>New receiving address</source> <translation>Nueva dirección de recepción </translation> </message> <message> <location line="+4"/> <source>New sending address</source> <translation>Nueva dirección de envío </translation> </message> <message> <location line="+3"/> <source>Edit receiving address</source> <translation>Editar dirección de recepcion </translation> </message> <message> <location line="+4"/> <source>Edit sending address</source> <translation>Editar dirección de envío </translation> </message> <message> <location line="+76"/> <source>The entered address &quot;%1&quot; is already in the address book.</source> <translation>La dirección introducida &quot;% 1&quot; ya está en la libreta de direcciones.</translation> </message> <message> <location line="-5"/> <source>The entered address &quot;%1&quot; is not a valid Rubycoin address.</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>Could not unlock wallet.</source> <translation>No se puede abrir el monedero.</translation> </message> <message> <location line="+5"/> <source>New key generation failed.</source> <translation>Fallo en la nueva clave generada.</translation> </message> </context> <context> <name>GUIUtil::HelpMessageBox</name> <message> <location filename="../guiutil.cpp" line="+420"/> <location line="+12"/> <source>Rubycoin-Qt</source> <translation type="unfinished"/> </message> <message> <location line="-12"/> <source>version</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Usage:</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>command-line options</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>UI options</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Set language, for example &quot;de_DE&quot; (default: system locale)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Start minimized</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Show splash screen on startup (default: 1)</source> <translation type="unfinished"/> </message> </context> <context> <name>OptionsDialog</name> <message> <location filename="../forms/optionsdialog.ui" line="+14"/> <source>Options</source> <translation>Opciones</translation> </message> <message> <location line="+16"/> <source>&amp;Main</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB. Fee 0.01 recommended.</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source>Pay transaction &amp;fee</source> <translation type="unfinished"/> </message> <message> <location line="+31"/> <source>Reserved amount does not participate in staking and is therefore spendable at any time.</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source>Reserve</source> <translation type="unfinished"/> </message> <message> <location line="+31"/> <source>Automatically start Rubycoin after logging in to the system.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Start Rubycoin on system login</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Detach block and address databases at shutdown. This means they can be moved to another data directory, but it slows down shutdown. The wallet is always detached.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Detach databases at shutdown</source> <translation type="unfinished"/> </message> <message> <location line="+21"/> <source>&amp;Network</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Automatically open the Rubycoin client port on the router. This only works when your router supports UPnP and it is enabled.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Map port using &amp;UPnP</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Connect to the Rubycoin network through a SOCKS proxy (e.g. when connecting through Tor).</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Connect through SOCKS proxy:</source> <translation type="unfinished"/> </message> <message> <location line="+9"/> <source>Proxy &amp;IP:</source> <translation type="unfinished"/> </message> <message> <location line="+19"/> <source>IP address of the proxy (e.g. 127.0.0.1)</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>&amp;Port:</source> <translation type="unfinished"/> </message> <message> <location line="+19"/> <source>Port of the proxy (e.g. 9050)</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>SOCKS &amp;Version:</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>SOCKS version of the proxy (e.g. 5)</source> <translation type="unfinished"/> </message> <message> <location line="+36"/> <source>&amp;Window</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Show only a tray icon after minimizing the window.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Minimize to the tray instead of the taskbar</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Quit in the menu.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>M&amp;inimize on close</source> <translation type="unfinished"/> </message> <message> <location line="+21"/> <source>&amp;Display</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>User Interface &amp;language:</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>The user interface language can be set here. This setting will take effect after restarting Rubycoin.</source> <translation type="unfinished"/> </message> <message> <location line="+11"/> <source>&amp;Unit to show amounts in:</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>Choose the default subdivision unit to show in the interface and when sending coins.</source> <translation type="unfinished"/> </message> <message> <location line="+9"/> <source>Whether to show Rubycoin addresses in the transaction list or not.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Display addresses in transaction list</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Whether to show coin control features or not.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Display coin &amp;control features (experts only!)</source> <translation type="unfinished"/> </message> <message> <location line="+71"/> <source>&amp;OK</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>&amp;Cancel</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>&amp;Apply</source> <translation type="unfinished"/> </message> <message> <location filename="../optionsdialog.cpp" line="+55"/> <source>default</source> <translation type="unfinished"/> </message> <message> <location line="+149"/> <location line="+9"/> <source>Warning</source> <translation type="unfinished"/> </message> <message> <location line="-9"/> <location line="+9"/> <source>This setting will take effect after restarting Rubycoin.</source> <translation type="unfinished"/> </message> <message> <location line="+29"/> <source>The supplied proxy address is invalid.</source> <translation type="unfinished"/> </message> </context> <context> <name>OverviewPage</name> <message> <location filename="../forms/overviewpage.ui" line="+14"/> <source>Form</source> <translation>Formulario</translation> </message> <message> <location line="+33"/> <location line="+231"/> <source>The displayed information may be out of date. Your wallet automatically synchronizes with the Rubycoin network after a connection is established, but this process has not completed yet.</source> <translation type="unfinished"/> </message> <message> <location line="-160"/> <source>Stake:</source> <translation type="unfinished"/> </message> <message> <location line="+29"/> <source>Unconfirmed:</source> <translation type="unfinished"/> </message> <message> <location line="-107"/> <source>Wallet</source> <translation type="unfinished"/> </message> <message> <location line="+49"/> <source>Spendable:</source> <translation type="unfinished"/> </message> <message> <location line="+16"/> <source>Your current spendable balance</source> <translation type="unfinished"/> </message> <message> <location line="+71"/> <source>Immature:</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>Mined balance that has not yet matured</source> <translation type="unfinished"/> </message> <message> <location line="+20"/> <source>Total:</source> <translation type="unfinished"/> </message> <message> <location line="+16"/> <source>Your current total balance</source> <translation type="unfinished"/> </message> <message> <location line="+46"/> <source>&lt;b&gt;Recent transactions&lt;/b&gt;</source> <translation>&lt;b&gt;Transacciones recientes&lt;/b&gt;</translation> </message> <message> <location line="-108"/> <source>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</source> <translation type="unfinished"/> </message> <message> <location line="-29"/> <source>Total of coins that was staked, and do not yet count toward the current balance</source> <translation type="unfinished"/> </message> <message> <location filename="../overviewpage.cpp" line="+113"/> <location line="+1"/> <source>out of sync</source> <translation type="unfinished"/> </message> </context> <context> <name>QRCodeDialog</name> <message> <location filename="../forms/qrcodedialog.ui" line="+14"/> <source>QR Code Dialog</source> <translation type="unfinished"/> </message> <message> <location line="+59"/> <source>Request Payment</source> <translation type="unfinished"/> </message> <message> <location line="+56"/> <source>Amount:</source> <translation type="unfinished"/> </message> <message> <location line="-44"/> <source>Label:</source> <translation type="unfinished"/> </message> <message> <location line="+19"/> <source>Message:</source> <translation type="unfinished"/> </message> <message> <location line="+71"/> <source>&amp;Save As...</source> <translation type="unfinished"/> </message> <message> <location filename="../qrcodedialog.cpp" line="+62"/> <source>Error encoding URI into QR Code.</source> <translation type="unfinished"/> </message> <message> <location line="+40"/> <source>The entered amount is invalid, please check.</source> <translation type="unfinished"/> </message> <message> <location line="+23"/> <source>Resulting URI too long, try to reduce the text for label / message.</source> <translation type="unfinished"/> </message> <message> <location line="+25"/> <source>Save QR Code</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>PNG Images (*.png)</source> <translation type="unfinished"/> </message> </context> <context> <name>RPCConsole</name> <message> <location filename="../forms/rpcconsole.ui" line="+46"/> <source>Client name</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <location line="+23"/> <location line="+26"/> <location line="+23"/> <location line="+23"/> <location line="+36"/> <location line="+53"/> <location line="+23"/> <location line="+23"/> <location filename="../rpcconsole.cpp" line="+348"/> <source>N/A</source> <translation type="unfinished"/> </message> <message> <location line="-217"/> <source>Client version</source> <translation type="unfinished"/> </message> <message> <location line="-45"/> <source>&amp;Information</source> <translation type="unfinished"/> </message> <message> <location line="+68"/> <source>Using OpenSSL version</source> <translation type="unfinished"/> </message> <message> <location line="+49"/> <source>Startup time</source> <translation type="unfinished"/> </message> <message> <location line="+29"/> <source>Network</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Number of connections</source> <translation type="unfinished"/> </message> <message> <location line="+23"/> <source>On testnet</source> <translation type="unfinished"/> </message> <message> <location line="+23"/> <source>Block chain</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Current number of blocks</source> <translation type="unfinished"/> </message> <message> <location line="+23"/> <source>Estimated total blocks</source> <translation type="unfinished"/> </message> <message> <location line="+23"/> <source>Last block time</source> <translation type="unfinished"/> </message> <message> <location line="+52"/> <source>&amp;Open</source> <translation type="unfinished"/> </message> <message> <location line="+16"/> <source>Command-line options</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Show the Rubycoin-Qt help message to get a list with possible Rubycoin command-line options.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Show</source> <translation type="unfinished"/> </message> <message> <location line="+24"/> <source>&amp;Console</source> <translation type="unfinished"/> </message> <message> <location line="-260"/> <source>Build date</source> <translation type="unfinished"/> </message> <message> <location line="-104"/> <source>Rubycoin - Debug window</source> <translation type="unfinished"/> </message> <message> <location line="+25"/> <source>Rubycoin Core</source> <translation type="unfinished"/> </message> <message> <location line="+279"/> <source>Debug log file</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Open the Rubycoin debug log file from the current data directory. This can take a few seconds for large log files.</source> <translation type="unfinished"/> </message> <message> <location line="+102"/> <source>Clear console</source> <translation type="unfinished"/> </message> <message> <location filename="../rpcconsole.cpp" line="-33"/> <source>Welcome to the Rubycoin RPC console.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Use up and down arrows to navigate history, and &lt;b&gt;Ctrl-L&lt;/b&gt; to clear screen.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Type &lt;b&gt;help&lt;/b&gt; for an overview of available commands.</source> <translation type="unfinished"/> </message> </context> <context> <name>SendCoinsDialog</name> <message> <location filename="../forms/sendcoinsdialog.ui" line="+14"/> <location filename="../sendcoinsdialog.cpp" line="+182"/> <location line="+5"/> <location line="+5"/> <location line="+5"/> <location line="+6"/> <location line="+5"/> <location line="+5"/> <source>Send Coins</source> <translation>Enviar monedas</translation> </message> <message> <location line="+76"/> <source>Coin Control Features</source> <translation type="unfinished"/> </message> <message> <location line="+20"/> <source>Inputs...</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>automatically selected</source> <translation type="unfinished"/> </message> <message> <location line="+19"/> <source>Insufficient funds!</source> <translation type="unfinished"/> </message> <message> <location line="+77"/> <source>Quantity:</source> <translation type="unfinished"/> </message> <message> <location line="+22"/> <location line="+35"/> <source>0</source> <translation type="unfinished"/> </message> <message> <location line="-19"/> <source>Bytes:</source> <translation type="unfinished"/> </message> <message> <location line="+51"/> <source>Amount:</source> <translation type="unfinished"/> </message> <message> <location line="+22"/> <location line="+86"/> <location line="+86"/> <location line="+32"/> <source>0.00 RBY</source> <translation type="unfinished"/> </message> <message> <location line="-191"/> <source>Priority:</source> <translation type="unfinished"/> </message> <message> <location line="+19"/> <source>medium</source> <translation type="unfinished"/> </message> <message> <location line="+32"/> <source>Fee:</source> <translation type="unfinished"/> </message> <message> <location line="+35"/> <source>Low Output:</source> <translation type="unfinished"/> </message> <message> <location line="+19"/> <source>no</source> <translation type="unfinished"/> </message> <message> <location line="+32"/> <source>After Fee:</source> <translation type="unfinished"/> </message> <message> <location line="+35"/> <source>Change</source> <translation type="unfinished"/> </message> <message> <location line="+50"/> <source>custom change address</source> <translation type="unfinished"/> </message> <message> <location line="+106"/> <source>Send to multiple recipients at once</source> <translation>Enviar a varios destinatarios a la vez</translation> </message> <message> <location line="+3"/> <source>Add &amp;Recipient</source> <translation type="unfinished"/> </message> <message> <location line="+20"/> <source>Remove all transaction fields</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Clear &amp;All</source> <translation type="unfinished"/> </message> <message> <location line="+28"/> <source>Balance:</source> <translation>Balance:</translation> </message> <message> <location line="+16"/> <source>123.456 RBY</source> <translation type="unfinished"/> </message> <message> <location line="+31"/> <source>Confirm the send action</source> <translation>Confirmar el envío</translation> </message> <message> <location line="+3"/> <source>S&amp;end</source> <translation type="unfinished"/> </message> <message> <location filename="../sendcoinsdialog.cpp" line="-173"/> <source>Enter a Rubycoin address (e.g. Gf3MqcdvirAVxWcRs2LWK5UMeW9tK3UT8F)</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source>Copy quantity</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy amount</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy fee</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy after fee</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy bytes</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy priority</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy low output</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy change</source> <translation type="unfinished"/> </message> <message> <location line="+86"/> <source>&lt;b&gt;%1&lt;/b&gt; to %2 (%3)</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Confirm send coins</source> <translation>Confirmar el envio de monedas</translation> </message> <message> <location line="+1"/> <source>Are you sure you want to send %1?</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source> and </source> <translation type="unfinished"/> </message> <message> <location line="+29"/> <source>The recipient address is not valid, please recheck.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>The amount to pay must be larger than 0.</source> <translation>La cantidad a pagar debe ser mayor que 0.</translation> </message> <message> <location line="+5"/> <source>The amount exceeds your balance.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>The total exceeds your balance when the %1 transaction fee is included.</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Duplicate address found, can only send to each address once per send operation.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Error: Transaction creation failed.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source> <translation type="unfinished"/> </message> <message> <location line="+251"/> <source>WARNING: Invalid Rubycoin address</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>(no label)</source> <translation>(Sin etiqueta)</translation> </message> <message> <location line="+4"/> <source>WARNING: unknown change address</source> <translation type="unfinished"/> </message> </context> <context> <name>SendCoinsEntry</name> <message> <location filename="../forms/sendcoinsentry.ui" line="+14"/> <source>Form</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source>A&amp;mount:</source> <translation>A&amp;Monto:</translation> </message> <message> <location line="+13"/> <source>Pay &amp;To:</source> <translation>Pagar &amp;A:</translation> </message> <message> <location line="+24"/> <location filename="../sendcoinsentry.cpp" line="+25"/> <source>Enter a label for this address to add it to your address book</source> <translation>Introduzca una etiqueta para esta dirección para añadirla a su libreta de direcciones</translation> </message> <message> <location line="+9"/> <source>&amp;Label:</source> <translation>&amp;Etiqueta:</translation> </message> <message> <location line="+18"/> <source>The address to send the payment to (e.g. Gf3MqcdvirAVxWcRs2LWK5UMeW9tK3UT8F)</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>Choose address from address book</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>Alt+A</source> <translation>Alt+A</translation> </message> <message> <location line="+7"/> <source>Paste address from clipboard</source> <translation>Pegar la dirección desde el portapapeles</translation> </message> <message> <location line="+10"/> <source>Alt+P</source> <translation>Alt+P</translation> </message> <message> <location line="+7"/> <source>Remove this recipient</source> <translation type="unfinished"/> </message> <message> <location filename="../sendcoinsentry.cpp" line="+1"/> <source>Enter a Rubycoin address (e.g. Gf3MqcdvirAVxWcRs2LWK5UMeW9tK3UT8F)</source> <translation type="unfinished"/> </message> </context> <context> <name>SignVerifyMessageDialog</name> <message> <location filename="../forms/signverifymessagedialog.ui" line="+14"/> <source>Signatures - Sign / Verify a Message</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <location line="+124"/> <source>&amp;Sign Message</source> <translation type="unfinished"/> </message> <message> <location line="-118"/> <source>You can sign messages with your addresses to prove you own them. Be careful not to sign anything vague, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.</source> <translation type="unfinished"/> </message> <message> <location line="+18"/> <source>The address to sign the message with (e.g. Gf3MqcdvirAVxWcRs2LWK5UMeW9tK3UT8F)</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <location line="+203"/> <source>Choose an address from the address book</source> <translation type="unfinished"/> </message> <message> <location line="-193"/> <location line="+203"/> <source>Alt+A</source> <translation>Alt+A</translation> </message> <message> <location line="-193"/> <source>Paste address from clipboard</source> <translation>Pegar la dirección desde el portapapeles</translation> </message> <message> <location line="+10"/> <source>Alt+P</source> <translation>Alt+P</translation> </message> <message> <location line="+12"/> <source>Enter the message you want to sign here</source> <translation type="unfinished"/> </message> <message> <location line="+24"/> <source>Copy the current signature to the system clipboard</source> <translation type="unfinished"/> </message> <message> <location line="+21"/> <source>Sign the message to prove you own this Rubycoin address</source> <translation type="unfinished"/> </message> <message> <location line="+17"/> <source>Reset all sign message fields</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <location line="+146"/> <source>Clear &amp;All</source> <translation type="unfinished"/> </message> <message> <location line="-87"/> <location line="+70"/> <source>&amp;Verify Message</source> <translation type="unfinished"/> </message> <message> <location line="-64"/> <source>Enter the signing address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack.</source> <translation type="unfinished"/> </message> <message> <location line="+21"/> <source>The address the message was signed with (e.g. Gf3MqcdvirAVxWcRs2LWK5UMeW9tK3UT8F)</source> <translation type="unfinished"/> </message> <message> <location line="+40"/> <source>Verify the message to ensure it was signed with the specified Rubycoin address</source> <translation type="unfinished"/> </message> <message> <location line="+17"/> <source>Reset all verify message fields</source> <translation type="unfinished"/> </message> <message> <location filename="../signverifymessagedialog.cpp" line="+27"/> <location line="+3"/> <source>Enter a Rubycoin address (e.g. Gf3MqcdvirAVxWcRs2LWK5UMeW9tK3UT8F)</source> <translation type="unfinished"/> </message> <message> <location line="-2"/> <source>Click &quot;Sign Message&quot; to generate signature</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Enter Rubycoin signature</source> <translation type="unfinished"/> </message> <message> <location line="+82"/> <location line="+81"/> <source>The entered address is invalid.</source> <translation type="unfinished"/> </message> <message> <location line="-81"/> <location line="+8"/> <location line="+73"/> <location line="+8"/> <source>Please check the address and try again.</source> <translation type="unfinished"/> </message> <message> <location line="-81"/> <location line="+81"/> <source>The entered address does not refer to a key.</source> <translation type="unfinished"/> </message> <message> <location line="-73"/> <source>Wallet unlock was cancelled.</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>Private key for the entered address is not available.</source> <translation type="unfinished"/> </message> <message> <location line="+12"/> <source>Message signing failed.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Message signed.</source> <translation type="unfinished"/> </message> <message> <location line="+59"/> <source>The signature could not be decoded.</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <location line="+13"/> <source>Please check the signature and try again.</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>The signature did not match the message digest.</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Message verification failed.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Message verified.</source> <translation type="unfinished"/> </message> </context> <context> <name>TransactionDesc</name> <message> <location filename="../transactiondesc.cpp" line="+19"/> <source>Open until %1</source> <translation>Abrir hasta %1</translation> </message> <message numerus="yes"> <location line="-2"/> <source>Open for %n block(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location line="+8"/> <source>conflicted</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>%1/offline</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>%1/unconfirmed</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>%1 confirmations</source> <translation type="unfinished"/> </message> <message> <location line="+18"/> <source>Status</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="+7"/> <source>, broadcast through %n node(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location line="+4"/> <source>Date</source> <translation>Fecha</translation> </message> <message> <location line="+7"/> <source>Source</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Generated</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <location line="+17"/> <source>From</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <location line="+22"/> <location line="+58"/> <source>To</source> <translation type="unfinished"/> </message> <message> <location line="-77"/> <location line="+2"/> <source>own address</source> <translation type="unfinished"/> </message> <message> <location line="-2"/> <source>label</source> <translation type="unfinished"/> </message> <message> <location line="+37"/> <location line="+12"/> <location line="+45"/> <location line="+17"/> <location line="+30"/> <source>Credit</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="-102"/> <source>matures in %n more block(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location line="+2"/> <source>not accepted</source> <translation type="unfinished"/> </message> <message> <location line="+44"/> <location line="+8"/> <location line="+15"/> <location line="+30"/> <source>Debit</source> <translation type="unfinished"/> </message> <message> <location line="-39"/> <source>Transaction fee</source> <translation type="unfinished"/> </message> <message> <location line="+16"/> <source>Net amount</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Message</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Comment</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Transaction ID</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Generated coins must mature 50 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to &quot;not accepted&quot; and it won&apos;t be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Debug information</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>Transaction</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Inputs</source> <translation type="unfinished"/> </message> <message> <location line="+23"/> <source>Amount</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>true</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>false</source> <translation type="unfinished"/> </message> <message> <location line="-211"/> <source>, has not been successfully broadcast yet</source> <translation type="unfinished"/> </message> <message> <location line="+35"/> <source>unknown</source> <translation>desconocido</translation> </message> </context> <context> <name>TransactionDescDialog</name> <message> <location filename="../forms/transactiondescdialog.ui" line="+14"/> <source>Transaction details</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>This pane shows a detailed description of the transaction</source> <translation type="unfinished"/> </message> </context> <context> <name>TransactionTableModel</name> <message> <location filename="../transactiontablemodel.cpp" line="+226"/> <source>Date</source> <translation>Fecha</translation> </message> <message> <location line="+0"/> <source>Type</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Address</source> <translation>Direccion </translation> </message> <message> <location line="+0"/> <source>Amount</source> <translation type="unfinished"/> </message> <message> <location line="+60"/> <source>Open until %1</source> <translation>Abrir hasta %1</translation> </message> <message> <location line="+12"/> <source>Confirmed (%1 confirmations)</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="-15"/> <source>Open for %n more block(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location line="+6"/> <source>Offline</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Unconfirmed</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Confirming (%1 of %2 recommended confirmations)</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Conflicted</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Immature (%1 confirmations, will be available after %2)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>This block was not received by any other nodes and will probably not be accepted!</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Generated but not accepted</source> <translation type="unfinished"/> </message> <message> <location line="+42"/> <source>Received with</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Received from</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Sent to</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Payment to yourself</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Mined</source> <translation type="unfinished"/> </message> <message> <location line="+38"/> <source>(n/a)</source> <translation type="unfinished"/> </message> <message> <location line="+190"/> <source>Transaction status. Hover over this field to show number of confirmations.</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Date and time that the transaction was received.</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Type of transaction.</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Destination address of transaction.</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Amount removed from or added to balance.</source> <translation type="unfinished"/> </message> </context> <context> <name>TransactionView</name> <message> <location filename="../transactionview.cpp" line="+55"/> <location line="+16"/> <source>All</source> <translation type="unfinished"/> </message> <message> <location line="-15"/> <source>Today</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>This week</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>This month</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Last month</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>This year</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Range...</source> <translation type="unfinished"/> </message> <message> <location line="+11"/> <source>Received with</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Sent to</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>To yourself</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Mined</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Other</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Enter address or label to search</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Min amount</source> <translation type="unfinished"/> </message> <message> <location line="+34"/> <source>Copy address</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy label</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy amount</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy transaction ID</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Edit label</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Show transaction details</source> <translation type="unfinished"/> </message> <message> <location line="+144"/> <source>Export Transaction Data</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Comma separated file (*.csv)</source> <translation>Archivos separados por coma (*.csv)</translation> </message> <message> <location line="+8"/> <source>Confirmed</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Date</source> <translation>Fecha</translation> </message> <message> <location line="+1"/> <source>Type</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Label</source> <translation>Etiqueta</translation> </message> <message> <location line="+1"/> <source>Address</source> <translation>Direccion </translation> </message> <message> <location line="+1"/> <source>Amount</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>ID</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Error exporting</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Could not write to file %1.</source> <translation type="unfinished"/> </message> <message> <location line="+100"/> <source>Range:</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>to</source> <translation type="unfinished"/> </message> </context> <context> <name>WalletModel</name> <message> <location filename="../walletmodel.cpp" line="+206"/> <source>Sending...</source> <translation type="unfinished"/> </message> </context> <context> <name>bitcoin-core</name> <message> <location filename="../bitcoinstrings.cpp" line="+33"/> <source>Rubycoin version</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Usage:</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Send command to -server or rubycoind</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>List commands</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Get help for a command</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Options:</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Specify configuration file (default: rubycoin.conf)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Specify pid file (default: rubycoind.pid)</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Specify wallet file (within data directory)</source> <translation type="unfinished"/> </message> <message> <location line="-1"/> <source>Specify data directory</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Set database cache size in megabytes (default: 25)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Set database disk log size in megabytes (default: 100)</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Listen for connections on &lt;port&gt; (default: 15714 or testnet: 25714)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Maintain at most &lt;n&gt; connections to peers (default: 125)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Connect to a node to retrieve peer addresses, and disconnect</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Specify your own public address</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Bind to given address. Use [host]:port notation for IPv6</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Stake your coins to support network and gain reward (default: 1)</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Threshold for disconnecting misbehaving peers (default: 100)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source> <translation type="unfinished"/> </message> <message> <location line="-44"/> <source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source> <translation type="unfinished"/> </message> <message> <location line="+51"/> <source>Detach block and address databases. Increases shutdown time (default: 0)</source> <translation type="unfinished"/> </message> <message> <location line="+109"/> <source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source> <translation type="unfinished"/> </message> <message> <location line="-5"/> <source>Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds </source> <translation type="unfinished"/> </message> <message> <location line="-87"/> <source>Listen for JSON-RPC connections on &lt;port&gt; (default: 15715 or testnet: 25715)</source> <translation type="unfinished"/> </message> <message> <location line="-11"/> <source>Accept command line and JSON-RPC commands</source> <translation type="unfinished"/> </message> <message> <location line="+101"/> <source>Error: Transaction creation failed </source> <translation type="unfinished"/> </message> <message> <location line="-5"/> <source>Error: Wallet locked, unable to create transaction </source> <translation type="unfinished"/> </message> <message> <location line="-8"/> <source>Importing blockchain data file.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Importing bootstrap blockchain data file.</source> <translation type="unfinished"/> </message> <message> <location line="-88"/> <source>Run in the background as a daemon and accept commands</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Use the test network</source> <translation type="unfinished"/> </message> <message> <location line="-24"/> <source>Accept connections from outside (default: 1 if no -proxy or -connect)</source> <translation type="unfinished"/> </message> <message> <location line="-38"/> <source>An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s</source> <translation type="unfinished"/> </message> <message> <location line="+117"/> <source>Error initializing database environment %s! To recover, BACKUP THAT DIRECTORY, then remove everything from it except for wallet.dat.</source> <translation type="unfinished"/> </message> <message> <location line="-20"/> <source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source> <translation type="unfinished"/> </message> <message> <location line="+11"/> <source>Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</source> <translation type="unfinished"/> </message> <message> <location line="+61"/> <source>Warning: Please check that your computer&apos;s date and time are correct! If your clock is wrong Rubycoin will not work properly.</source> <translation type="unfinished"/> </message> <message> <location line="-31"/> <source>Warning: error reading wallet.dat! All keys read correctly, but transaction data or address book entries might be missing or incorrect.</source> <translation type="unfinished"/> </message> <message> <location line="-18"/> <source>Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect you should restore from a backup.</source> <translation type="unfinished"/> </message> <message> <location line="-30"/> <source>Attempt to recover private keys from a corrupt wallet.dat</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Block creation options:</source> <translation type="unfinished"/> </message> <message> <location line="-62"/> <source>Connect only to the specified node(s)</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Discover own IP address (default: 1 when listening and no -externalip)</source> <translation type="unfinished"/> </message> <message> <location line="+94"/> <source>Failed to listen on any port. Use -listen=0 if you want this.</source> <translation type="unfinished"/> </message> <message> <location line="-90"/> <source>Find peers using DNS lookup (default: 1)</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Sync checkpoints policy (default: strict)</source> <translation type="unfinished"/> </message> <message> <location line="+83"/> <source>Invalid -tor address: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Invalid amount for -reservebalance=&lt;amount&gt;</source> <translation type="unfinished"/> </message> <message> <location line="-82"/> <source>Maximum per-connection receive buffer, &lt;n&gt;*1000 bytes (default: 5000)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Maximum per-connection send buffer, &lt;n&gt;*1000 bytes (default: 1000)</source> <translation type="unfinished"/> </message> <message> <location line="-16"/> <source>Only connect to nodes in network &lt;net&gt; (IPv4, IPv6 or Tor)</source> <translation type="unfinished"/> </message> <message> <location line="+28"/> <source>Output extra debugging information. Implies all other -debug* options</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Output extra network debugging information</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Prepend debug output with timestamp</source> <translation type="unfinished"/> </message> <message> <location line="+35"/> <source>SSL options: (see the Bitcoin Wiki for SSL setup instructions)</source> <translation type="unfinished"/> </message> <message> <location line="-74"/> <source>Select the version of socks proxy to use (4-5, default: 5)</source> <translation type="unfinished"/> </message> <message> <location line="+41"/> <source>Send trace/debug info to console instead of debug.log file</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Send trace/debug info to debugger</source> <translation type="unfinished"/> </message> <message> <location line="+28"/> <source>Set maximum block size in bytes (default: 250000)</source> <translation type="unfinished"/> </message> <message> <location line="-1"/> <source>Set minimum block size in bytes (default: 0)</source> <translation type="unfinished"/> </message> <message> <location line="-29"/> <source>Shrink debug.log file on client startup (default: 1 when no -debug)</source> <translation type="unfinished"/> </message> <message> <location line="-42"/> <source>Specify connection timeout in milliseconds (default: 5000)</source> <translation type="unfinished"/> </message> <message> <location line="+109"/> <source>Unable to sign checkpoint, wrong checkpointkey? </source> <translation type="unfinished"/> </message> <message> <location line="-80"/> <source>Use UPnP to map the listening port (default: 0)</source> <translation type="unfinished"/> </message> <message> <location line="-1"/> <source>Use UPnP to map the listening port (default: 1 when listening)</source> <translation type="unfinished"/> </message> <message> <location line="-25"/> <source>Use proxy to reach tor hidden services (default: same as -proxy)</source> <translation type="unfinished"/> </message> <message> <location line="+42"/> <source>Username for JSON-RPC connections</source> <translation type="unfinished"/> </message> <message> <location line="+47"/> <source>Verifying database integrity...</source> <translation type="unfinished"/> </message> <message> <location line="+57"/> <source>WARNING: syncronized checkpoint violation detected, but skipped!</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Warning: Disk space is low!</source> <translation type="unfinished"/> </message> <message> <location line="-2"/> <source>Warning: This version is obsolete, upgrade required!</source> <translation type="unfinished"/> </message> <message> <location line="-48"/> <source>wallet.dat corrupt, salvage failed</source> <translation type="unfinished"/> </message> <message> <location line="-54"/> <source>Password for JSON-RPC connections</source> <translation type="unfinished"/> </message> <message> <location line="-84"/> <source>%s, you must set a rpcpassword in the configuration file: %s It is recommended you use the following random password: rpcuser=rubycoinrpc rpcpassword=%s (you do not need to remember this password) The username and password MUST NOT be the same. If the file does not exist, create it with owner-readable-only file permissions. It is also recommended to set alertnotify so you are notified of problems; for example: alertnotify=echo %%s | mail -s &quot;Rubycoin Alert&quot; admin@foo.com </source> <translation type="unfinished"/> </message> <message> <location line="+51"/> <source>Find peers using internet relay chat (default: 0)</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Sync time with other nodes. Disable if time on your system is precise e.g. syncing with NTP (default: 1)</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source>When creating transactions, ignore inputs with value less than this (default: 0.01)</source> <translation type="unfinished"/> </message> <message> <location line="+16"/> <source>Allow JSON-RPC connections from specified IP address</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Send commands to node running on &lt;ip&gt; (default: 127.0.0.1)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Require a confirmations for change (default: 0)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Enforce transaction scripts to use canonical PUSH operators (default: 1)</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Execute command when a relevant alert is received (%s in cmd is replaced by message)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Upgrade wallet to latest format</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Set key pool size to &lt;n&gt; (default: 100)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Rescan the block chain for missing wallet transactions</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>How many blocks to check at startup (default: 2500, 0 = all)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>How thorough the block verification is (0-6, default: 1)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Imports blocks from external blk000?.dat file</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>Use OpenSSL (https) for JSON-RPC connections</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Server certificate file (default: server.cert)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Server private key (default: server.pem)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source> <translation type="unfinished"/> </message> <message> <location line="+53"/> <source>Error: Wallet unlocked for staking only, unable to create transaction.</source> <translation type="unfinished"/> </message> <message> <location line="+18"/> <source>WARNING: Invalid checkpoint found! Displayed transactions may not be correct! You may need to upgrade, or notify developers.</source> <translation type="unfinished"/> </message> <message> <location line="-158"/> <source>This help message</source> <translation type="unfinished"/> </message> <message> <location line="+95"/> <source>Wallet %s resides outside data directory %s.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Cannot obtain a lock on data directory %s. Rubycoin is probably already running.</source> <translation type="unfinished"/> </message> <message> <location line="-98"/> <source>Rubycoin</source> <translation type="unfinished"/> </message> <message> <location line="+140"/> <source>Unable to bind to %s on this computer (bind returned error %d, %s)</source> <translation type="unfinished"/> </message> <message> <location line="-130"/> <source>Connect through socks proxy</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Allow DNS lookups for -addnode, -seednode and -connect</source> <translation type="unfinished"/> </message> <message> <location line="+122"/> <source>Loading addresses...</source> <translation type="unfinished"/> </message> <message> <location line="-15"/> <source>Error loading blkindex.dat</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Error loading wallet.dat: Wallet corrupted</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Error loading wallet.dat: Wallet requires newer version of Rubycoin</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Wallet needed to be rewritten: restart Rubycoin to complete</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Error loading wallet.dat</source> <translation type="unfinished"/> </message> <message> <location line="-16"/> <source>Invalid -proxy address: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="-1"/> <source>Unknown network specified in -onlynet: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="-1"/> <source>Unknown -socks proxy version requested: %i</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Cannot resolve -bind address: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Cannot resolve -externalip address: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="-24"/> <source>Invalid amount for -paytxfee=&lt;amount&gt;: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="+44"/> <source>Error: could not start node</source> <translation type="unfinished"/> </message> <message> <location line="+11"/> <source>Sending...</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Invalid amount</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Insufficient funds</source> <translation type="unfinished"/> </message> <message> <location line="-34"/> <source>Loading block index...</source> <translation type="unfinished"/> </message> <message> <location line="-103"/> <source>Add a node to connect to and attempt to keep the connection open</source> <translation type="unfinished"/> </message> <message> <location line="+122"/> <source>Unable to bind to %s on this computer. Rubycoin is probably already running.</source> <translation type="unfinished"/> </message> <message> <location line="-97"/> <source>Fee per KB to add to transactions you send</source> <translation type="unfinished"/> </message> <message> <location line="+55"/> <source>Invalid amount for -mininput=&lt;amount&gt;: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="+25"/> <source>Loading wallet...</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>Cannot downgrade wallet</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Cannot initialize keypool</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Cannot write default address</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Rescanning...</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Done loading</source> <translation type="unfinished"/> </message> <message> <location line="-167"/> <source>To use the %s option</source> <translation type="unfinished"/> </message> <message> <location line="+14"/> <source>Error</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>You must set rpcpassword=&lt;password&gt; in the configuration file: %s If the file does not exist, create it with owner-readable-only file permissions.</source> <translation type="unfinished"/> </message> </context> </TS>
coinkeeper/2015-06-22_19-11_rubycoin
src/qt/locale/bitcoin_es_UY.ts
TypeScript
mit
109,361
{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "%matplotlib inline" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from __future__ import division \n", "\n", "import os\n", "import errno\n", "import glob\n", "# import ConfigParser # python2\n", "\n", "import configparser\n", "\n", "import numpy as np\n", "import pylab as plt\n", "\n", "import astra\n", "\n", "import logging\n", "import logging.handlers\n", "import json" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "astra.__version__" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "logging.getLogger('').setLevel(logging.ERROR)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def mkdir_p(path):\n", " try:\n", " os.makedirs(path)\n", " except OSError as exc: # Python >2.5\n", " if exc.errno == errno.EEXIST and os.path.isdir(path):\n", " pass\n", " else:\n", " raise" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "def log_progress(sequence, every=None, size=None):\n", " from ipywidgets import IntProgress, HTML, VBox\n", " from IPython.display import display\n", "\n", " is_iterator = False\n", " if size is None:\n", " try:\n", " size = len(sequence)\n", " except TypeError:\n", " is_iterator = True\n", " if size is not None:\n", " if every is None:\n", " if size <= 200:\n", " every = 1\n", " else:\n", " every = size / 200 # every 0.5%\n", " else:\n", " assert every is not None, 'sequence is iterator, set every'\n", "\n", " if is_iterator:\n", " progress = IntProgress(min=0, max=1, value=1)\n", " progress.bar_style = 'info'\n", " else:\n", " progress = IntProgress(min=0, max=size, value=0)\n", " label = HTML()\n", " box = VBox(children=[label, progress])\n", " display(box)\n", "\n", " index = 0\n", " try:\n", " for index, record in enumerate(sequence, 1):\n", " if index == 1 or index % every == 0:\n", " if is_iterator:\n", " label.value = '{index} / ?'.format(index=index)\n", " else:\n", " progress.value = index\n", " label.value = u'{index} / {size}'.format(\n", " index=index,\n", " size=size\n", " )\n", " yield record\n", " except:\n", " progress.bar_style = 'danger'\n", " raise\n", " else:\n", " progress.bar_style = 'success'\n", " progress.value = index\n", " label.value = unicode(index or '?')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def read_config(config_path):\n", " def as_dict(config):\n", " d = dict(config._sections)\n", " for k in d:\n", " d[k] = dict(config._defaults, **d[k])\n", " d[k].pop('__name__', None)\n", " return d\n", " \n", " config = ConfigParser.RawConfigParser()\n", " config.optionxform = str\n", " config.read(config_path)\n", " res = as_dict(config)\n", " return res" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Data directory\n", "data_root = '/diskmnt/a/makov/yaivan/MMC_1/'\n", "# data_root = '/media/makov/buext4/yaivan/MMC_1'\n", "# nrecon_folder = os.path.join(data_root,'_tmp','nrecon', 'bh_92_rc_20')\n", "nrecon_root_folder = os.path.join(data_root,'_tmp','nrecon')\n", "astra_root_folder = os.path.join(data_root,'_tmp','astra')\n", "mkdir_p(astra_root_folder)\n", "\n", "LOG_FILENAME = os.path.join(astra_root_folder, 'astra_rec.out')\n", "\n", "my_logger = logging.getLogger('')\n", "my_logger.setLevel(logging.DEBUG)\n", "handler = logging.handlers.RotatingFileHandler(\n", " LOG_FILENAME, maxBytes=1e5, backupCount=5)\n", "formatter = logging.Formatter('%(asctime)-15s %(levelname)-8s %(message)s')\n", "handler.setFormatter(formatter)\n", "\n", "my_logger.addHandler(handler)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "nrecon_folders = glob.glob(os.path.join(nrecon_root_folder, '*'))\n", "nrecon_folders = [nf for nf in nrecon_folders if os.path.isdir(nf)]\n", "print len(nrecon_folders)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def build_reconstruction_geomety(detector_size, angles):\n", " \n", " # proj_geom = astra.create_proj_geom('parallel', 1.0, detector_size, angles)\n", " \n", " #Object to Source (mm) = 56.135\n", " #Camera to Source (mm) = 225.082\n", " \n", " # All distances in [pixels]\n", " pixel_size = 2.82473e-3\n", " os_distance = 56.135/pixel_size\n", " ds_distance = 225.082/pixel_size\n", " \n", " proj_geom = astra.create_proj_geom('fanflat', ds_distance/os_distance, detector_size, angles,\n", " os_distance, (ds_distance-os_distance))\n", " return proj_geom" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "def astra_tomo2d_fanflat_fbp(sinogram, angles):\n", " angles = angles.astype('float64') # hack for astra stability, may be removed in future releases\n", " detector_size = sinogram.shape[1]\n", " \n", "\n", " rec_size = detector_size # size of reconstruction region\n", " vol_geom = astra.create_vol_geom(rec_size, rec_size)\n", "\n", " proj_geom = build_reconstruction_geomety(detector_size, angles)\n", " \n", " sinogram_id = astra.data2d.create('-sino', proj_geom, data=sinogram)\n", " # Create a data object for the reconstruction\n", " rec_id = astra.data2d.create('-vol', vol_geom)\n", "\n", " # Set up the parameters for a reconstruction algorithm using the GPU\n", " cfg = astra.astra_dict('FBP_CUDA')\n", " cfg['ReconstructionDataId'] = rec_id\n", " cfg['ProjectionDataId'] = sinogram_id\n", " cfg['option'] = {}\n", " cfg['option']['ShortScan'] = True\n", "# cfg['option']['MinConstraint'] = 0\n", " # cfg['option']['MaxConstraint'] = 5\n", "\n", " # Available algorithms:\n", " # SIRT_CUDA, SART_CUDA, EM_CUDA, FBP_CUDA (see the FBP sample)\n", "\n", " # Create the algorithm object from the configuration structure\n", " alg_id = astra.algorithm.create(cfg)\n", "\n", " # Run 150 iterations of the algorithm\n", " astra.algorithm.run(alg_id, 1)\n", "\n", " # Get the result\n", " rec = astra.data2d.get(rec_id)\n", "\n", " # Clean up. Note that GPU memory is tied up in the algorithm object,\n", " # and main RAM in the data objects.\n", " astra.algorithm.delete(alg_id)\n", " astra.data2d.delete(rec_id)\n", " astra.data2d.delete(sinogram_id)\n", " astra.clear()\n", " return rec, proj_geom, cfg\n", "\n", "def astra_tomo2d_fanflat_sirt(sinogram, angles):\n", " angles = angles.astype('float64') # hack for astra stability, may be removed in future releases\n", " detector_size = sinogram.shape[1]\n", " \n", "\n", " rec_size = detector_size # size of reconstruction region\n", " vol_geom = astra.create_vol_geom(rec_size, rec_size)\n", "\n", " proj_geom = build_reconstruction_geomety(detector_size, angles)\n", " \n", " sinogram_id = astra.data2d.create('-sino', proj_geom, data=sinogram)\n", " # Create a data object for the reconstruction\n", " rec_id = astra.data2d.create('-vol', vol_geom)\n", "\n", " # Set up the parameters for a reconstruction algorithm using the GPU\n", " cfg = astra.astra_dict('SIRT_CUDA')\n", " cfg['ReconstructionDataId'] = rec_id\n", " cfg['ProjectionDataId'] = sinogram_id\n", " cfg['option'] = {}\n", "# cfg['option']['MinConstraint'] = 0\n", " # cfg['option']['MaxConstraint'] = 5\n", "\n", " # Available algorithms:\n", " # SIRT_CUDA, SART_CUDA, EM_CUDA, FBP_CUDA (see the FBP sample)\n", "\n", " # Create the algorithm object from the configuration structure\n", " alg_id = astra.algorithm.create(cfg)\n", "\n", " # Run 150 iterations of the algorithm\n", " astra.algorithm.run(alg_id, 200)\n", "\n", " # Get the result\n", " rec = astra.data2d.get(rec_id)\n", "\n", " # Clean up. Note that GPU memory is tied up in the algorithm object,\n", " # and main RAM in the data objects.\n", " astra.algorithm.delete(alg_id)\n", " astra.data2d.delete(rec_id)\n", " astra.data2d.delete(sinogram_id)\n", " astra.clear()\n", " return rec, proj_geom, cfg\n", "\n", "def astra_tomo2d_fanflat_sart(sinogram, angles):\n", " angles = angles.astype('float64') # hack for astra stability, may be removed in future releases\n", " detector_size = sinogram.shape[1]\n", " \n", "\n", " rec_size = detector_size # size of reconstruction region\n", " vol_geom = astra.create_vol_geom(rec_size, rec_size)\n", "\n", " proj_geom = build_reconstruction_geomety(detector_size, angles)\n", " \n", " sinogram_id = astra.data2d.create('-sino', proj_geom, data=sinogram)\n", " # Create a data object for the reconstruction\n", " rec_id = astra.data2d.create('-vol', vol_geom)\n", "\n", " # Set up the parameters for a reconstruction algorithm using the GPU\n", " cfg = astra.astra_dict('SART_CUDA')\n", " cfg['ReconstructionDataId'] = rec_id\n", " cfg['ProjectionDataId'] = sinogram_id\n", " cfg['option'] = {}\n", " cfg['option']['MinConstraint'] = 0\n", " # cfg['option']['MaxConstraint'] = 5\n", "\n", " # Available algorithms:\n", " # SIRT_CUDA, SART_CUDA, EM_CUDA, FBP_CUDA (see the FBP sample)\n", "\n", " # Create the algorithm object from the configuration structure\n", " alg_id = astra.algorithm.create(cfg)\n", "\n", " # Run 150 iterations of the algorithm\n", " astra.algorithm.run(alg_id, 1000)\n", "\n", " # Get the result\n", " rec = astra.data2d.get(rec_id)\n", "\n", " # Clean up. Note that GPU memory is tied up in the algorithm object,\n", " # and main RAM in the data objects.\n", " astra.algorithm.delete(alg_id)\n", " astra.data2d.delete(rec_id)\n", " astra.data2d.delete(sinogram_id)\n", " astra.clear()\n", " return rec, proj_geom, cfg\n", "\n", "# Define the plugin class (has to subclass astra.plugin.base)\n", "# Note that usually, these will be defined in a separate package/module\n", "class SIRTPlugin(astra.plugin.base):\n", " \"\"\"Example of an ASTRA plugin class, implementing a simple 2D SIRT algorithm.\n", "\n", " Options:\n", "\n", " 'rel_factor': relaxation factor (optional)\n", " \"\"\"\n", "\n", " # The astra_name variable defines the name to use to\n", " # call the plugin from ASTRA\n", " astra_name = \"SIRT-PLUGIN\"\n", "\n", " def initialize(self,cfg, rel_factor = 1):\n", " self.W = astra.OpTomo(cfg['ProjectorId'])\n", " self.vid = cfg['ReconstructionDataId']\n", " self.sid = cfg['ProjectionDataId']\n", " self.rel = rel_factor\n", "\n", " def run(self, its):\n", " v = astra.data2d.get_shared(self.vid)\n", " s = astra.data2d.get_shared(self.sid)\n", " print s.shape\n", " W = self.W\n", " for i in range(its):\n", " v[:] += self.rel*(W.T*(s - (W*v).reshape(s.shape))).reshape(v.shape)/s.size\n", " \n", "# from plugin import SIRTPlugin \n", "def astra_tomo2d_fanflat_plugin(sinogram, angles):\n", " angles = angles.astype('float64') # hack for astra stability, may be removed in future releases\n", " detector_size = sinogram.shape[1]\n", " \n", "\n", " rec_size = detector_size # size of reconstruction region\n", " \n", " vol_geom = astra.create_vol_geom(rec_size, rec_size)\n", " proj_geom = build_reconstruction_geomety(detector_size, angles)\n", " proj_id = astra.create_projector('cuda',proj_geom,vol_geom)\n", " \n", " sinogram_id = astra.data2d.create('-sino', proj_geom, data=sinogram)\n", " # Create a data object for the reconstruction\n", " rec_id = astra.data2d.create('-vol', vol_geom)\n", " \n", " astra.plugin.register(SIRTPlugin)\n", " print astra.plugin.get_registered()\n", " \n", " # Set up the parameters for a reconstruction algorithm using the GPU\n", " cfg = astra.astra_dict('SIRT-PLUGIN')\n", " cfg['ProjectorId'] = proj_id\n", " cfg['ReconstructionDataId'] = rec_id\n", " cfg['ProjectionDataId'] = sinogram_id\n", " cfg['option'] = {}\n", " cfg['option']['rel_factor'] = 1.5\n", "# cfg['option']['MinConstraint'] = 0\n", " # cfg['option']['MaxConstraint'] = 5\n", "\n", " # Available algorithms:\n", " # SIRT_CUDA, SART_CUDA, EM_CUDA, FBP_CUDA (see the FBP sample)\n", "\n", " # Create the algorithm object from the configuration structure\n", " alg_id = astra.algorithm.create(cfg)\n", "\n", " # Run 150 iterations of the algorithm\n", " astra.algorithm.run(alg_id, 10)\n", "\n", " # Get the result\n", " rec = astra.data2d.get(rec_id)\n", "\n", " # Clean up. Note that GPU memory is tied up in the algorithm object,\n", " # and main RAM in the data objects.\n", " astra.algorithm.delete(alg_id)\n", " astra.data2d.delete(rec_id)\n", " astra.data2d.delete(sinogram_id)\n", " astra.clear()\n", " return rec, proj_geom, cfg\n", "\n", "def create_sinogram(data, angles): \n", " angles = angles.astype('float64') # hack for astra stability, may be removed in future releases\n", " detector_size = data.shape[1]\n", "\n", " rec_size = detector_size # size of reconstruction region\n", " vol_geom = astra.create_vol_geom(rec_size, rec_size)\n", "\n", " proj_geom = build_reconstruction_geomety(detector_size, angles)\n", " proj_id = astra.create_projector('cuda',proj_geom,vol_geom)\n", " \n", " W = astra.OpTomo(proj_id)\n", " P = data\n", " sinogram = W * P\n", " sinogram = sinogram.reshape([len(angles), detector_size])\n", " return np.rot90(sinogram,3)\n", "\n", "def get_reconstruction(sinogram, reconstruction_function, min_level=None):\n", " angles = np.arange(sinogram.shape[0])*0.1#-11.493867*2\n", " angles = angles.astype('float64')/180.*np.pi\n", " if min_level is None:\n", " astra_rec, proj_geom, cfg = reconstruction_function(np.flipud(sinogram), angles)\n", " else:\n", " astra_rec, proj_geom, cfg = reconstruction_function(np.flipud(sinogram), angles, min_level)\n", " logging.info('Projection geometry: {}'.format(proj_geom))\n", " logging.info('Reconstruction config: {}'.format(cfg))\n", " astra_rec = np.flipud(astra_rec)\n", " return astra_rec\n", "\n", "def get_reconstruction_fbp(sinogram):\n", " return get_reconstruction(sinogram, astra_tomo2d_fanflat_fbp)\n", "\n", "def get_reconstruction_sirt(sinogram):\n", " return get_reconstruction(sinogram, astra_tomo2d_fanflat_sirt)\n", "\n", "def get_reconstruction_sart(sinogram):\n", " return get_reconstruction(sinogram, astra_tomo2d_fanflat_sart)\n", "\n", "def get_reconstruction_plugin(sinogram):\n", " return get_reconstruction(sinogram, astra_tomo2d_fanflat_plugin)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# for nrecon_folder in log_progress(nrecon_folders):\n", "# data_file = os.path.join(nrecon_folder, 'MMC1_2.82um__sino0960.tif')\n", " \n", "# logging.info('Sinogram file: {}'.format(data_file))\n", "# sinogram = plt.imread(data_file)\n", "# logging.info('Sinogram angles, length: {}'.format(sinogram.shape))\n", " \n", "# nrecon_config_file = os.path.join(nrecon_folder, 'MMC1_2.82um__rec.log')\n", "# nrecon_config = read_config(nrecon_config_file)\n", " \n", "# rec_sart = get_reconstruction_sart(sinogram)\n", " \n", "# output_folder = os.path.join(astra_root_folder, nrecon_folder[len(nrecon_root_folder)+1:])\n", "# mkdir_p(output_folder)\n", "# astra_sart_file = os.path.join(output_folder, 'MMC1_2.82um__rec0960_astra_sart.png')\n", " \n", " \n", "# logging.info('Output file: {}'.format(astra_sart_file))\n", "# plt.imsave(astra_sart_file, rec_sart, cmap = plt.cm.gray)\n", " \n", "# data_config = os.path.join(output_folder, 'MMC1_2.82um__rec.log')\n", "# logging.info('Output config file: {}'.format(data_config))\n", " \n", "# config = ConfigParser.RawConfigParser()\n", "# config.optionxform = str\n", "# config.add_section('Reconstruction')\n", "# config.set('Reconstruction', 'Minimum for CS to Image Conversion', rec_sart.min())\n", "# config.set('Reconstruction', 'Maximum for CS to Image Conversion', rec_sart.max())\n", " \n", "# bh = nrecon_config['Reconstruction']['Beam Hardening Correction (%)'] \n", "# rc = nrecon_config['Reconstruction']['Ring Artifact Correction']\n", " \n", "# config.set('Reconstruction', 'Beam Hardening Correction (%)', bh)\n", "# config.set('Reconstruction', 'Ring Artifact Correction', rc)\n", " \n", "# with open(data_config, 'wb') as configfile:\n", "# config.write(configfile)\n", "# # # sinogram = sinogram[-1800:] \n", "# # nrecon_rec_file = os.path.join(nrecon_folder,'MMC1_2.82um__rec0960.png')\n", "# # nrecon_rec = plt.imread(nrecon_rec_file)[...,0]" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "nrecon_folder = [d for d in nrecon_folders if 'bh_92_rc_20' in d][0]\n", "nrecon_rec = plt.imread(os.path.join(nrecon_folder, 'MMC1_2.82um__rec0960.png'))[...,0]\n", "nrecon_rec = nrecon_rec*(0.52+0.18)-0.18\n", "print nrecon_folder" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import matplotlib\n", "font = {'size' : 18}\n", "matplotlib.rc('font', **font)\n", "\n", "plt.figure(figsize=(10,12))\n", "plt.imshow(nrecon_rec, cmap=plt.cm.gray)\n", "plt.colorbar()\n", "# plt.colorbar(orientation='horizontal')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# buzmakov\n", "from numba import jit\n", "import logging\n", "from scipy import ndimage\n", "import skimage.io\n", "\n", "def calculate_background(data, zeros_mask): \n", " labeled_mask, num_features = ndimage.measurements.label(zeros_mask)\n", " logging.info('Found regions: {}'.format(num_features-1))\n", " sigma = []\n", " for nf in range(num_features):\n", " if nf == 0 :\n", " continue\n", " \n", " data_constant = data[labeled_mask==nf]\n", " s = np.std(data_constant)\n", " sigma.append(s)\n", " \n", " logging.info('STD for regions: {}'.format(sigma))\n", " std = np.mean(sigma)\n", " logging.info('Mean STD for regions: {}'.format(std))\n", " mean_value = data.mean()\n", " logging.info('Mean reconstructed value for all data: {}'.format(mean_value))\n", " res = std/mean_value\n", " logging.info('Normalized STD: {}'.format(res))\n", " return res\n", "\n", "#ingacheva\n", "from scipy import misc\n", "from scipy import ndimage\n", "\n", "@jit\n", "def base_value(distance_transform, original):\n", " delta = distance_transform.max() * 0.9\n", " threshold = distance_transform.max() - delta\n", " xx = 1 * np.logical_and(distance_transform >= threshold, distance_transform > 0)\n", " summ = xx.sum()\n", " base_v = original[distance_transform >= threshold].sum() / summ\n", " return base_v\n", "\n", "@jit\n", "def weighted_variance(mask, distance_transform, original):\n", " base_v = base_value(distance_transform, original)\n", " weight = np.zeros_like(mask)\n", " weight[mask > 0.0] = np.sqrt(distance_transform[mask > 0.0])\n", " threshold = distance_transform.max() * 0.8\n", " xx = 1 * np.logical_and(distance_transform <= threshold, distance_transform > 0.0)\n", " orig = np.zeros_like(mask)\n", " orig = orig.astype('float64')\n", " orig[xx > 0.0] = original[xx > 0.0] - base_v\n", " res = weight[xx > 0.0] * np.power(orig[xx > 0.0], 2)\n", " result = np.sqrt(res.sum() / weight[xx > 0.0].sum())\n", " return result\n", "\n", "@jit\n", "def calck_square(mask, distance_transform, original):\n", " base_v = base_value(distance_transform, original)\n", " iter_max = int(distance_transform.max())\n", " sq = 0\n", " for i in range(1, iter_max):\n", " \n", " value = original[(distance_transform>=i)*(distance_transform< i+1)].sum()\n", " sq += np.abs(base_v - value)\n", " sq = sq / (base_v * iter_max)\n", " return sq\n", "\n", "@jit\n", "def calculate_cupping(original, mask):\n", " mask[mask > 0.0] = 1.0\n", " labeled, nr_objects = ndimage.label(mask > 0.0)\n", "# ndimage.find_objects(labeled)\n", " logging.info('Number of objects is {}'.format(nr_objects))\n", "\n", "\n", " result = 0\n", " square = 0\n", " for i in range(1, nr_objects+1):\n", " mask[mask > 0.0] = 0.0\n", " mask[labeled == i] = 1.0\n", " \n", " \n", " sx = mask.sum(axis=0)\n", " sxx = np.argwhere(sx>0)\n", " x_min = sxx.min()\n", " x_max = sxx.max()\n", " \n", " sy = mask.sum(axis=1)\n", " syy = np.argwhere(sy>0)\n", " y_min = syy.min()\n", " y_max = syy.max()\n", " \n", " dist = ndimage.distance_transform_edt(mask[y_min:y_max, x_min:x_max])\n", " \n", "\n", " #res = weighted_variance(mask, dist, original)\n", " #result += res\n", " #data['weighted_variance'] = res\n", "\n", " sq = calck_square(mask[y_min:y_max, x_min:x_max],\n", " dist,\n", " original[y_min:y_max, x_min:x_max])\n", " square += sq\n", " logging.info(\"square {} of the object {}\".format(sq, i))\n", "\n", " #result = result / nr_objects\n", " #print 'mean weighted variance ', result\n", "\n", " square = square / nr_objects\n", " return square\n", "\n", "mask_background = skimage.io.imread(\n", " '/diskmnt/a/makov/yaivan/MMC_1/_tmp/binary_masks/MMC1_2.82um__rec0960_MASK_ZEROS_CONERS.png')[...,0]\n", "mask_cup = skimage.io.imread(\n", " '/diskmnt/a/makov/yaivan/MMC_1/_tmp/binary_masks/MMC1_2.82um__rec0960_Mask_objects.png')[...,0]" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plt.figure(figsize=(10,5))\n", "plt.subplot(121)\n", "plt.imshow(mask_background, cmap=plt.cm.viridis)\n", "plt.subplot(122)\n", "plt.imshow(mask_cup, cmap=plt.cm.viridis)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "data_file = os.path.join(nrecon_folder, 'MMC1_2.82um__sino0960.tif')\n", "sinogram = plt.imread(data_file)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plt.figure(figsize=(12,10))\n", "plt.imshow(sinogram, cmap=plt.cm.viridis)\n", "plt.colorbar(orientation='horizontal')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "r=get_reconstruction_fbp(np.log(sinogram+2))\n", "plt.figure(figsize=(12,10))\n", "plt.imshow(r, cmap=plt.cm.gray)\n", "# plt.colorbar(orientation='horizontal')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plt.figure(figsize=(13,7))\n", "plt.plot(sinogram.max(axis=0), label='Max')\n", "plt.hold(True)\n", "plt.plot(sinogram.min(axis=0), label='Min')\n", "plt.plot(sinogram.mean(axis=0), label='Mean')\n", "plt.plot(sinogram[0], label='0')\n", "plt.plot(sinogram[1700,::-1], label='170')\n", "plt.plot(sinogram[1800,::-1], label='180')\n", "plt.legend(loc=0)\n", "plt.grid(True)\n", "plt.show()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plt.figure(figsize=(10,7))\n", "plt.plot(sinogram.max(axis=1), label='Max')\n", "plt.hold(True)\n", "plt.plot(sinogram.min(axis=1), label='Min')\n", "plt.plot(sinogram.mean(axis=1), label='Mean')\n", "plt.plot(sinogram[:,int(sinogram.shape[1]/2)], label='Center')\n", "plt.legend(loc=0)\n", "plt.show()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plt.figure(figsize=(12,10))\n", "plt.imshow(r, cmap=plt.cm.viridis)\n", "plt.colorbar(orientation='horizontal')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plt.figure(figsize=(12,10))\n", "plt.imshow(r, cmap=plt.cm.viridis)\n", "plt.colorbar(orientation='horizontal')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "rois = []\n", "rois.append(np.ix_(np.r_[2100:2350],np.r_[1700:2000]))\n", "rois.append(np.ix_(np.r_[2750:3200],np.r_[2350:2900]))\n", "rois.append(np.ix_(np.r_[2300:2380],np.r_[1200:1300]))\n", "rois.append(np.ix_(np.r_[2600:2750],np.r_[1100:1300]))\n", "rois.append(np.ix_(np.r_[2400:2900],np.r_[600:1000]))\n", "rois.append(np.ix_(np.r_[2700:3500],np.r_[1300:2100]))\n", "rois.append(np.ix_(np.r_[1450:2000],np.r_[600:1150]))\n", "rois.append(np.ix_(np.r_[1750:2050],np.r_[2500:2930]))" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def astra_my(sinogram, angles, min_level=0):\n", " angles = angles.astype('float64') # hack for astra stability, may be removed in future releases\n", " detector_size = sinogram.shape[1]\n", " \n", "\n", " rec_size = detector_size # size of reconstruction region\n", " vol_geom = astra.create_vol_geom(rec_size, rec_size)\n", "\n", " proj_geom = build_reconstruction_geomety(detector_size, angles)\n", " \n", " sinogram_id = astra.data2d.create('-sino', proj_geom, data=sinogram)\n", " # Create a data object for the reconstruction\n", " rec_id = astra.data2d.create('-vol', vol_geom)\n", "\n", " # Set up the parameters for a reconstruction algorithm using the GPU\n", " cfg = astra.astra_dict('SART_CUDA')\n", " cfg['ReconstructionDataId'] = rec_id\n", " cfg['ProjectionDataId'] = sinogram_id\n", " cfg['option'] = {}\n", " cfg['option']['MinConstraint'] = min_level\n", " # cfg['option']['MaxConstraint'] = 5\n", "\n", " # Available algorithms:\n", " # SIRT_CUDA, SART_CUDA, EM_CUDA, FBP_CUDA (see the FBP sample)\n", "\n", " # Create the algorithm object from the configuration structure\n", " alg_id = astra.algorithm.create(cfg)\n", "\n", " # Run 150 iterations of the algorithm\n", " astra.algorithm.run(alg_id, 10000)\n", "\n", " # Get the result\n", " rec = astra.data2d.get(rec_id)\n", "\n", " # Clean up. Note that GPU memory is tied up in the algorithm object,\n", " # and main RAM in the data objects.\n", " astra.algorithm.delete(alg_id)\n", " astra.data2d.delete(rec_id)\n", " astra.data2d.delete(sinogram_id)\n", " astra.clear()\n", " return rec, proj_geom, cfg\n", "\n", "def get_reconstruction_my(sinogram, min_level):\n", " return get_reconstruction(sinogram, astra_my, min_level)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "scrolled": false }, "outputs": [], "source": [ "# rec_my = rec_fbp\n", "# plt.figure(figsize=(15,15))\n", "# plt.imshow(rec_my/(rec_my.max()-rec_my.min())-nrecon_rec/(nrecon_rec.max()-nrecon_rec.min()), cmap=plt.cm.gray)\n", "# plt.title('My')\n", "# plt.show()\n", "logging.getLogger('').setLevel(logging.ERROR)\n", "rec_fbp = get_reconstruction_fbp(sinogram[-1800:])\n", "\n", "for min_level in log_progress(np.arange(-3,-1,1)):\n", " print 'Min_level = {}'.format(min_level)\n", " rec_my = get_reconstruction_my(sinogram, min_level)\n", " \n", "\n", " artifact_my_bg = calculate_background(rec_my, mask_background)\n", " artifact_my_cup = calculate_cupping(rec_my, mask_cup)\n", " print 'My: bg:{}, cup:{}'.format(artifact_my_bg, artifact_my_cup)\n", "\n", " artifact_fbp_bg = calculate_background(rec_fbp, mask_background)\n", " artifact_fbp_cup = calculate_cupping(rec_fbp, mask_cup)\n", " print 'FBP: bg:{}, cup:{}'.format(artifact_fbp_bg, artifact_fbp_cup)\n", "\n", " artifact_nrecon_bg = calculate_background(nrecon_rec, mask_background)\n", " artifact_nrecon_cup = calculate_cupping(nrecon_rec, mask_cup)\n", " print 'NRecon: bg:{}, cup:{}'.format(artifact_nrecon_bg, artifact_nrecon_cup)\n", "\n", " for roi in rois:\n", " d_my = rec_my[roi]\n", " d_fbp = rec_fbp[roi]\n", " d_nrecon = nrecon_rec[roi]\n", "\n", " plt.figure(figsize=(15,15))\n", "\n", " plt.subplot(221)\n", " plt.imshow(d_my, cmap=plt.cm.gray, vmin=0)\n", " plt.title('My')\n", "\n", " plt.subplot(222)\n", " plt.imshow(d_fbp, cmap=plt.cm.gray, vmin=0)\n", " plt.title('FBP')\n", "\n", " plt.subplot(223)\n", " plt.imshow(d_nrecon, cmap=plt.cm.gray, vmin=0)\n", " plt.title('NRecon')\n", "\n", " plt.subplot(224)\n", " pos = int(d_my.shape[0]/2)\n", " d_my_1 = d_my[pos]\n", " d_my_1 = d_my_1/ (d_my_1.max()-d_my_1.min())\n", "\n", " d_fbp_1 = d_fbp[pos]\n", " d_fbp_1 = d_fbp_1/ (d_fbp_1.max()-d_fbp_1.min())\n", "\n", " d_nrecon_1 = d_nrecon[pos]\n", " d_nrecon_1 = d_nrecon_1/ (d_nrecon_1.max()-d_nrecon_1.min())\n", "\n", "\n", " plt.plot(d_my_1, label='my')\n", " plt.plot(d_fbp_1, label='FBP')\n", " plt.plot(d_nrecon_1, label='NRecon')\n", " plt.grid()\n", " plt.legend(loc=0)\n", " # plt.colorbar(orientation='horizontal')\n", " plt.show()\n", " \n", " plt.figure(figsize=(15,15))\n", " plt.imshow(rec_my, cmap=plt.cm.gray)\n", " plt.title('My')\n", " plt.show()\n", " \n", " plt.figure(figsize=(15,15))\n", " plt.imshow(nrecon_rec, cmap=plt.cm.gray)\n", " plt.title('NRecon')\n", " plt.show()\n", " " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plt.plot(sinogram.min(axis=0))" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "anaconda-cloud": {}, "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.2" } }, "nbformat": 4, "nbformat_minor": 1 }
buzmakov/tomography_scripts
tomo/yaivan/nrecon_reconstructor.ipynb
Jupyter Notebooks (Python)
mit
34,432
<!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_41) on Tue Mar 05 22:46:30 EST 2013 --> <TITLE> Zip.WhenEmpty (Apache Ant API) </TITLE> <META NAME="date" CONTENT="2013-03-05"> <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="Zip.WhenEmpty (Apache Ant API)"; } } </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>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../../../../org/apache/tools/ant/taskdefs/Zip.UnicodeExtraField.html" title="class in org.apache.tools.ant.taskdefs"><B>PREV CLASS</B></A>&nbsp; &nbsp;NEXT CLASS</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../index.html?org/apache/tools/ant/taskdefs/Zip.WhenEmpty.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="Zip.WhenEmpty.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<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> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#fields_inherited_from_class_org.apache.tools.ant.types.EnumeratedAttribute">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <!-- ======== START OF CLASS DATA ======== --> <H2> <FONT SIZE="-1"> org.apache.tools.ant.taskdefs</FONT> <BR> Class Zip.WhenEmpty</H2> <PRE> java.lang.Object <IMG SRC="../../../../../resources/inherit.gif" ALT="extended by "><A HREF="../../../../../org/apache/tools/ant/types/EnumeratedAttribute.html" title="class in org.apache.tools.ant.types">org.apache.tools.ant.types.EnumeratedAttribute</A> <IMG SRC="../../../../../resources/inherit.gif" ALT="extended by "><B>org.apache.tools.ant.taskdefs.Zip.WhenEmpty</B> </PRE> <DL> <DT><B>Enclosing class:</B><DD><A HREF="../../../../../org/apache/tools/ant/taskdefs/Zip.html" title="class in org.apache.tools.ant.taskdefs">Zip</A></DD> </DL> <HR> <DL> <DT><PRE>public static class <B>Zip.WhenEmpty</B><DT>extends <A HREF="../../../../../org/apache/tools/ant/types/EnumeratedAttribute.html" title="class in org.apache.tools.ant.types">EnumeratedAttribute</A></DL> </PRE> <P> Possible behaviors when there are no matching files for the task: "fail", "skip", or "create". <P> <P> <HR> <P> <!-- =========== FIELD SUMMARY =========== --> <A NAME="field_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Field Summary</B></FONT></TH> </TR> </TABLE> &nbsp;<A NAME="fields_inherited_from_class_org.apache.tools.ant.types.EnumeratedAttribute"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left"><B>Fields inherited from class org.apache.tools.ant.types.<A HREF="../../../../../org/apache/tools/ant/types/EnumeratedAttribute.html" title="class in org.apache.tools.ant.types">EnumeratedAttribute</A></B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><A HREF="../../../../../org/apache/tools/ant/types/EnumeratedAttribute.html#value">value</A></CODE></TD> </TR> </TABLE> &nbsp; <!-- ======== CONSTRUCTOR SUMMARY ======== --> <A NAME="constructor_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Constructor Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../../../org/apache/tools/ant/taskdefs/Zip.WhenEmpty.html#Zip.WhenEmpty()">Zip.WhenEmpty</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <!-- ========== METHOD SUMMARY =========== --> <A NAME="method_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Method Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;java.lang.String[]</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/apache/tools/ant/taskdefs/Zip.WhenEmpty.html#getValues()">getValues</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The string values for the enumerated value</TD> </TR> </TABLE> &nbsp;<A NAME="methods_inherited_from_class_org.apache.tools.ant.types.EnumeratedAttribute"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left"><B>Methods inherited from class org.apache.tools.ant.types.<A HREF="../../../../../org/apache/tools/ant/types/EnumeratedAttribute.html" title="class in org.apache.tools.ant.types">EnumeratedAttribute</A></B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><A HREF="../../../../../org/apache/tools/ant/types/EnumeratedAttribute.html#containsValue(java.lang.String)">containsValue</A>, <A HREF="../../../../../org/apache/tools/ant/types/EnumeratedAttribute.html#getIndex()">getIndex</A>, <A HREF="../../../../../org/apache/tools/ant/types/EnumeratedAttribute.html#getInstance(java.lang.Class, java.lang.String)">getInstance</A>, <A HREF="../../../../../org/apache/tools/ant/types/EnumeratedAttribute.html#getValue()">getValue</A>, <A HREF="../../../../../org/apache/tools/ant/types/EnumeratedAttribute.html#indexOfValue(java.lang.String)">indexOfValue</A>, <A HREF="../../../../../org/apache/tools/ant/types/EnumeratedAttribute.html#setValue(java.lang.String)">setValue</A>, <A HREF="../../../../../org/apache/tools/ant/types/EnumeratedAttribute.html#toString()">toString</A></CODE></TD> </TR> </TABLE> &nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait</CODE></TD> </TR> </TABLE> &nbsp; <P> <!-- ========= CONSTRUCTOR DETAIL ======== --> <A NAME="constructor_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Constructor Detail</B></FONT></TH> </TR> </TABLE> <A NAME="Zip.WhenEmpty()"><!-- --></A><H3> Zip.WhenEmpty</H3> <PRE> public <B>Zip.WhenEmpty</B>()</PRE> <DL> </DL> <!-- ============ METHOD DETAIL ========== --> <A NAME="method_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Method Detail</B></FONT></TH> </TR> </TABLE> <A NAME="getValues()"><!-- --></A><H3> getValues</H3> <PRE> public java.lang.String[] <B>getValues</B>()</PRE> <DL> <DD>The string values for the enumerated value <P> <DD><DL> <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../org/apache/tools/ant/types/EnumeratedAttribute.html#getValues()">getValues</A></CODE> in class <CODE><A HREF="../../../../../org/apache/tools/ant/types/EnumeratedAttribute.html" title="class in org.apache.tools.ant.types">EnumeratedAttribute</A></CODE></DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>the values</DL> </DD> </DL> <!-- ========= END OF CLASS DATA ========= --> <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>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../../../../org/apache/tools/ant/taskdefs/Zip.UnicodeExtraField.html" title="class in org.apache.tools.ant.taskdefs"><B>PREV CLASS</B></A>&nbsp; &nbsp;NEXT CLASS</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../index.html?org/apache/tools/ant/taskdefs/Zip.WhenEmpty.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="Zip.WhenEmpty.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<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> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#fields_inherited_from_class_org.apache.tools.ant.types.EnumeratedAttribute">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> </BODY> </HTML>
bownie/Brazil
thirdparty/apache-ant-1.9.0/manual/api/org/apache/tools/ant/taskdefs/Zip.WhenEmpty.html
HTML
mit
12,995
<?php namespace SypherLev\Blueprint\QueryBuilders\MySql; use SypherLev\Blueprint\Error\BlueprintException; use SypherLev\Blueprint\QueryBuilders\QueryInterface; class MySqlQuery implements QueryInterface { // init: use no whitelists private $columnwhitelist = []; private $tablewhitelist = []; // init: minimum required by the compiler private $type = false; private $table = false; // init: optional params; used if set // Patterns private $joins = []; private $columns = []; // Contexts private $records = []; private $updates = []; private $group = []; private $aggregates = []; // init: this is not a count query private $count = false; // Filters private $wheres = []; private $order = []; private $direction = false; private $limit; private $bindings = []; private $allowedjoins = ['INNER', 'OUTER', 'LEFT', 'RIGHT']; private $allowedorders = ['ASC', 'DESC']; private $allowedaggregates = ['SUM', 'COUNT', 'AVG', 'MAX', 'MIN']; private $allowedtypes = ['SELECT', 'UPDATE', 'INSERT', 'DELETE']; // WHERE THE MAGIC HAPPENS public function compile(): string { // check for the bare minimum if ($this->table === false || $this->type === false) { throw (new BlueprintException('Query compilation failure: missing table or type')); } switch ($this->type) { case 'UPDATE': return $this->generateUPDATEStatement(); case 'INSERT': return $this->generateINSERTStatement(); case 'DELETE': return $this->generateDELETEStatement(); default: return $this->generateSELECTStatement(); } } private function generateSELECTStatement(): string { $query = $this->type . ' '; if (!empty($this->columns)) { $query .= $this->compileColumns(); if (!empty($this->aggregates)) { $query = rtrim($query, ' '); $query .= ', ' . $this->compileAggregates(); } } else if (!empty($this->aggregates)) { $query .= $this->compileAggregates(); } else if ($this->count) { $query .= 'COUNT(*) AS `count` '; } else { $query .= '* '; } $query .= 'FROM `' . $this->table . '` '; if (!empty($this->joins)) { $query .= $this->compileJoins(); } if (!empty($this->wheres)) { $query .= $this->compileWheres(); } if (!empty($this->group)) { $query .= $this->compileGroup(); } if (!empty($this->order)) { $query .= $this->compileOrder(); } if (!is_null($this->limit)) { $query .= $this->compileLimit(); } return $query; } private function generateDELETEStatement(): string { $query = $this->type . ' '; $query .= 'FROM `' . $this->table . '` '; if (!empty($this->wheres)) { $query .= $this->compileWheres(); } return $query; } private function generateINSERTStatement(): string { if (empty($this->records)) { throw new BlueprintException('No records added for INSERT: statement cannot be executed.'); } if (!empty($this->columns)) { foreach ($this->records as $record) { foreach ($record as $key => $set) { $valid = false; foreach ($this->columns as $column) { if ($column->table == $this->table && $column->column == $key) { $valid = true; } } if (!$valid) { throw new BlueprintException(' PHP :: Pattern mismatch: Column ' . $key . ' in table ' . $this->table . ' failed validation in INSERT'); } } } } $query = $this->type . ' INTO '; $query .= '`' . $this->table . '` '; if (!empty($this->columns)) { $query .= '(' . $this->compileColumns() . ') '; } $query .= 'VALUES '; $query .= $this->compileRecords(); return $query; } private function generateUPDATEStatement(): string { if (empty($this->updates)) { throw new BlueprintException('No SET added for UPDATE: statement cannot be executed.'); } if (!empty($this->columns)) { foreach ($this->updates as $update) { $valid = false; foreach ($this->columns as $column) { if ($column->table == $this->table && $column->column == $update->column) { $valid = true; } } if (!$valid) { throw new BlueprintException(' PHP :: Pattern mismatch: Column ' . $update->column . ' in table ' . $this->table . ' failed validation in UPDATE'); } } } $query = $this->type . ' '; $query .= '`' . $this->table . '` '; $query .= 'SET ' . $this->compileUpdates(); if (!empty($this->wheres)) { $query .= $this->compileWheres(); } return $query; } // QUERY CHUNK SETTERS public function setTable(string $tablename) { if (!$this->validateTableName($tablename)) { throw (new BlueprintException('Primary table name missing from whitelist')); } $this->table = $tablename; } public function setType(string $type) { $type = strtoupper($type); if (!in_array($type, $this->allowedtypes)) { throw (new BlueprintException('Disallowed query type: query must be one of ' . implode('|', $this->allowedtypes))); } $this->type = $type; } public function setColumns(array $columns) { if (empty($columns)) { throw (new BlueprintException('Columns list is empty')); } $table = false; if (!empty($this->table)) { $table = $this->table; } if (!$this->hasNumericKeys($columns)) { // then this is an aliased column list or a table list foreach ($columns as $key => $col) { if (is_array($col)) { // then this is a table list, aliased or not $tablename = $key; foreach ($col as $alias => $innercol) { if (!$this->hasNumericKeys($col)) { // then this is an aliased table list $this->newColumnEntry($innercol, $alias, $tablename); } else { // then this is a non-aliased table list $this->newColumnEntry($innercol, "", $tablename); } } } else { // then this is an aliased column list $this->newColumnEntry($col, $key, $table); } } } else { // then this is a plain list of columns foreach ($columns as $column) { $this->newColumnEntry($column, "", $table); } } } public function setUpdates(array $updates) { if (empty($updates)) { throw (new BlueprintException('Update array is empty')); } if ($this->hasNumericKeys($updates)) { throw (new BlueprintException('Invalid numeric key in update array; all keys must be strings')); } foreach ($updates as $column => $param) { $this->newUpdateEntry($column, $param); } } public function setCount(bool $count = false) { $this->count = $count; } public function addInsertRecord(array $record) { if ($this->hasNumericKeys($record)) { throw (new BlueprintException('Invalid numeric key in inserted record; all keys must be strings')); } if (empty($this->columns)) { $this->setColumns(array_keys($record)); } else { $columns_to_check = array_keys($record); $validated_columns = []; foreach ($this->columns as $col) { if ($col->table == $this->table) { $validated_columns[] = $col->column; } } foreach ($columns_to_check as $col) { if (!in_array($col, $validated_columns)) { throw new BlueprintException(' PHP :: Pattern mismatch: Column ' . $col . ' in table ' . $this->table . ' failed validation in INSERT'); } } $this->columns = []; $this->setColumns(array_keys($record)); } $this->newInsertEntry($record); } public function setLimit(int $rows, int $offset = 0) { $this->limit = new \stdClass(); $this->limit->rows = $rows; $this->limit->offset = $offset; } public function setJoin(string $first, string $second, array $on, string $type = 'INNER') { $type = strtoupper($type); if (!in_array($type, $this->allowedjoins)) { throw (new BlueprintException('Disallowed JOIN type: joins must be one of ' . implode('|', $this->allowedjoins))); } if ($this->hasNumericKeys($on)) { throw (new BlueprintException('Bad join relations array: array must have string keys in the format column1 => column2')); } $this->newJoinEntry($first, $second, $on, $type); } public function setWhere(array $where, string $innercondition = 'AND', string $outercondition = 'AND') { if (empty($where)) { throw (new BlueprintException('Where list is empty')); } $placeholder = 'sypherlev_blueprint_tablename_placeholder'; foreach ($where as $key => $value) { if (is_array($value) && strpos(strtoupper($key), ' IN') === false) { // then this is an array of table => [column => param, ...] if ($this->hasNumericKeys($value) && strpos($key, ' IN') === false) { throw (new BlueprintException('Bad where relations array: array must have string keys in the format column => param or table => [column => param]')); } $this->newWhereEntry($where, $innercondition, $outercondition); break; } else if (is_array($value) && strpos(strtoupper($key), ' IN') !== false) { // then this is an IN or NOT IN array $where = [$placeholder => $where]; $this->newWhereEntry($where, $innercondition, $outercondition); break; } else { if ($this->hasNumericKeys($where)) { throw (new BlueprintException('Bad where relations array: array must have string keys in the format column => param or table => [column => param]')); } $where = [$placeholder => $where]; $this->newWhereEntry($where, $innercondition, $outercondition); break; } } } public function setOrderBy(array $orderby, string $direction = 'ASC', bool $aliases = false) { $table = false; if (!empty($this->table)) { $table = $this->table; } $direction = strtoupper($direction); if (!in_array($direction, $this->allowedorders)) { throw (new BlueprintException('Disallowed ORDER BY type: order must be one of ' . implode('|', $this->allowedorders))); } if (!$this->hasNumericKeys($orderby)) { // then this is an array of tables foreach ($orderby as $table => $cols) { if (is_array($cols)) { foreach ($cols as $col) { if (is_string($col)) { $this->newOrderEntry($col, $table); } else { throw (new BlueprintException('Invalid non-string column name in ORDER BY clause')); } } } else { if (is_string($cols)) { $this->newOrderEntry($cols, $table); } else { throw (new BlueprintException('Invalid non-string column name in ORDER BY clause')); } } } } else { // then this is a plain array of columns foreach ($orderby as $col) { if (is_string($col)) { if ($aliases) { $this->newOrderEntry($col); } else { $this->newOrderEntry($col, $table); } } else { throw (new BlueprintException('Invalid non-string column name in ORDER BY clause')); } } } $this->direction = $direction; } public function setAggregate(string $function, array $columns) { $table = false; if (!empty($this->table)) { $table = $this->table; } $function = strtoupper($function); if (!in_array($function, $this->allowedaggregates)) { throw (new BlueprintException('Disallowed aggregate function: aggregate must be one of ' . implode('|', $this->allowedaggregates))); } if ($this->hasNumericKeys($columns)) { // then this is an array in the form [columns1, column2, ...] foreach ($columns as $columnName) { if(!is_string($columnName)) { throw (new BlueprintException('Disallowed column name '.$columnName.' in aggregate assignment: Column names may only be strings')); } $this->newAggregateEntry($function, $columnName, $table, ""); } } else { // then this is an array in the form [tableName => [column1, column2, ...]] OR [alias => columnname] foreach ($columns as $tableName => $inner_columns) { if (is_array($inner_columns)) { // [tablename => [column1, column2, ...]] foreach ($inner_columns as $idx => $col) { if(!is_string($col)) { throw (new BlueprintException('Disallowed column name '.$col.' in aggregate assignment: Column names may only be strings')); } if (is_string($idx)) { // then aliases are in use $this->newAggregateEntry($function, $col, $tableName, $idx); } else { $this->newAggregateEntry($function, $col, $tableName, false); } } } else { // [alias => columnname] if(!is_string($inner_columns)) { throw (new BlueprintException('Disallowed column name '.$inner_columns.' in aggregate assignment: Column names may only be strings')); } $this->newAggregateEntry($function, $inner_columns, $table, $tableName); } } } } public function setGroupBy(array $groupby) { $table = false; if (!empty($this->table)) { $table = $this->table; } if (!$this->hasNumericKeys($groupby)) { // then this is an array of tables => columns foreach ($groupby as $table => $cols) { if (is_string($cols)) { $this->newGroupEntry($table, $cols); } else if (is_array($cols)) { foreach ($cols as $col) { $this->newGroupEntry($table, $col); } } else { throw (new BlueprintException('Invalid non-string column name in GROUP BY clause')); } } } else { // then this is a plain array of columns foreach ($groupby as $col) { if (is_string($col)) { $this->newGroupEntry($table, $col); } else { throw (new BlueprintException('Invalid non-string column name in GROUP BY clause')); } } } } public function addToColumnWhitelist(array $columns) { foreach ($columns as $col) { $this->columnwhitelist[] = $col; } } public function addToTableWhitelist(array $table) { foreach ($table as $tab) { $this->tablewhitelist[] = $tab; } } public function getBindings() : array { $bindings = []; foreach ($this->bindings as $type => $bindinglist) { foreach ($bindinglist as $idx => $bind) { $bindings[$idx] = $bind; } } return $bindings; } public function getSection(string $sectionName) : array { if (property_exists($this, $sectionName)) { return $this->{$sectionName}; } else { return []; } } // PRIVATE FUNCTIONS // COMPILATION FUNCTIONS private function compileColumns() : string { $columnstring = ''; foreach ($this->columns as $columnentry) { if ($columnentry->table == false) { $columnentry->table = $this->table; } if ($columnentry->column == '*') { $columnstring .= '`' . $columnentry->table . '`.' . $columnentry->column; } else { $columnstring .= '`' . $columnentry->table . '`.`' . $columnentry->column . '`'; } if ($columnentry->alias !== "") { $columnstring .= ' AS `' . $columnentry->alias . '`'; } $columnstring .= ', '; } return rtrim($columnstring, ', ') . ' '; } private function compileAggregates() : string { $aggregatestring = ''; foreach ($this->aggregates as $aggentry) { if ($aggentry->table == false) { $aggentry->table = $this->table; } if ($aggentry->alias === false || $aggentry->alias === '') { $aggentry->alias = $aggentry->column; } $aggregatestring .= $aggentry->function . '(`' . $aggentry->table . '`.`' . $aggentry->column . '`)'; if ($aggentry->alias !== false) { $aggregatestring .= ' AS `' . $aggentry->alias . '`'; } $aggregatestring .= ', '; } return rtrim($aggregatestring, ', ') . ' '; } private function compileJoins() : string { $compilestring = ''; foreach ($this->joins as $joinentry) { $compilestring .= $joinentry->type . ' JOIN `' . $joinentry->secondtable . '` ON '; foreach ($joinentry->relations as $first => $second) { $compilestring .= '`' . $joinentry->firsttable . '`.`' . $first . '` = `' . $joinentry->secondtable . '`.`' . $second . '` AND '; } $compilestring = rtrim($compilestring, ' AND '); $compilestring .= ' '; } return $compilestring; } private function compileWheres() : string { $compilestring = 'WHERE '; foreach ($this->wheres as $whereentry) { foreach ($whereentry->params as $table => $columns) { if ($table === 'sypherlev_blueprint_tablename_placeholder' || $table === false) { $table = $this->table; } $compilestring .= '('; foreach ($columns as $column => $placeholder) { $operand = $this->checkOperand($column, $placeholder); $compilestring .= '`' . $table . '`.`' . $this->stripOperands($column) . '` ' . $operand . ' ' . $placeholder . ' ' . $whereentry->inner . ' '; } $compilestring = rtrim($compilestring, ' ' . $whereentry->inner . ' '); $compilestring .= ') ' . $whereentry->outer . ' '; } } $compilestring = rtrim($compilestring, 'AND '); return rtrim($compilestring, 'OR ') . ' '; } private function compileGroup() : string { $compilestring = 'GROUP BY '; foreach ($this->group as $groupentry) { $compilestring .= '`' . $groupentry->table . '`.`' . $groupentry->column . '`, '; } return rtrim($compilestring, ', ') . ' '; } private function compileOrder() : string { $compilestring = 'ORDER BY '; foreach ($this->order as $orderentry) { if ($orderentry->table !== false) { $compilestring .= '`' . $orderentry->table . '`.'; } $compilestring .= '`' . $orderentry->column . '`, '; } return rtrim($compilestring, ', ') . ' ' . $this->direction . ' '; } private function compileLimit() : string { return 'LIMIT ' . (int)$this->limit->offset . ', ' . (int)$this->limit->rows . ' '; } private function compileRecords() : string { $compilestring = ''; foreach ($this->records as $record) { $compilestring .= '('; foreach ($record as $column => $placeholder) { $compilestring .= $placeholder . ', '; } $compilestring = rtrim($compilestring, ', ') . '), '; } return rtrim($compilestring, ', ') . ' '; } private function compileUpdates() : string { $compilestring = ''; foreach ($this->updates as $updateentry) { $compilestring .= '`' . $updateentry->column . '` = ' . $updateentry->param . ', '; } return rtrim($compilestring, ', ') . ' '; } // PARSING AND VALIDATION FUNCTIONS private function newUpdateEntry(string $column, $param) { if (!empty($this->columnwhitelist)) { if (!in_array($column, $this->columnwhitelist)) { throw (new BlueprintException('Column '.$column.' in update list not found in white list')); } } $newupdate = new \stdClass(); $newupdate->column = $column; $newupdate->param = $this->newBindEntry($param, ':up'); $this->updates[] = $newupdate; } private function newColumnEntry(string $column, string $alias = "", string $table = "") { if (!$this->validateColumnName($column)) { throw (new BlueprintException('Column '.$column.' in selection list not found in white list')); } if ($table !== "" && !$this->validateTableName($table)) { throw (new BlueprintException('Table name '.$table.' in selection list not found in white list')); } $newcolumn = new \stdClass(); $newcolumn->table = $table; $newcolumn->column = $column; $newcolumn->alias = $alias; $this->columns[] = $newcolumn; } private function newOrderEntry(string $column, string $table = "") { if (!$this->validateColumnName($column)) { throw (new BlueprintException('Column '.$column.' in ORDER BY not found in white list')); } if ($table !== "" && !$this->validateTableName($table)) { throw (new BlueprintException('Table name '.$table.' in ORDER BY not found in white list')); } $neworder = new \stdClass(); $neworder->table = $table; $neworder->column = $column; $this->order[] = $neworder; } private function newAggregateEntry(string $function, string $column, string $table = "", string $alias = "") { if (!$this->validateColumnName($column)) { throw (new BlueprintException("Column in $function(`$table`.`$column`) not found in white list")); } if ($table !== "" && !$this->validateTableName($table)) { throw (new BlueprintException("Table name in $function(`$table`.`$column`) not found in white list")); } $newagg = new \stdClass(); $newagg->table = $table; $newagg->column = $column; $newagg->function = $function; $newagg->alias = $alias; $this->aggregates[] = $newagg; } private function newGroupEntry(string $table, string $column) { if (!$this->validateColumnName($column)) { throw (new BlueprintException('Column '.$column.' in GROUP BY not found in white list')); } if ($table !== "" && !$this->validateTableName($table)) { throw (new BlueprintException('Table name '.$table.' in GROUP BY not found in white list')); } $newgroup = new \stdClass(); $newgroup->table = $table; $newgroup->column = $column; $this->group[] = $newgroup; } private function newJoinEntry(string $firsttable, string $secondtable, array $relations, string $type) { foreach ($relations as $column1 => $column2) { if (!$this->validateColumnName($column1)) { throw (new BlueprintException('Column '.$column1.' in JOIN not found in white list')); } if (!$this->validateColumnName($column2)) { throw (new BlueprintException('Column '.$column2.' in JOIN not found in white list')); } } if (!$this->validateTableName($firsttable)) { throw (new BlueprintException('Table name '.$firsttable.' in JOIN not found in white list')); } if (!$this->validateTableName($secondtable)) { throw (new BlueprintException('Table name '.$secondtable.' in JOIN not found in white list')); } $newjoin = new \stdClass(); $newjoin->firsttable = $firsttable; $newjoin->secondtable = $secondtable; $newjoin->relations = $relations; $newjoin->type = $type; $this->joins[] = $newjoin; } private function newWhereEntry(array $paramArray, string $inner, string $outer) { foreach ($paramArray as $table => $columns) { if (!$this->validateTableName($table)) { throw (new BlueprintException('Table name '.$table.' in WHERE not found in white list')); } foreach ($columns as $column => $param) { if (!$this->validateColumnName($column)) { throw (new BlueprintException('Column '.$column.' in WHERE not found in white list')); } if (strpos(strtoupper($column), ' IN') !== false && is_array($param)) { $paramstring = '('; foreach ($param as $in) { $paramstring .= $this->newBindEntry($in) . ', '; } $paramstring = rtrim($paramstring, ', ') . ')'; $paramArray[$table][$column] = $paramstring; } else if ($param !== null) { $paramArray[$table][$column] = $this->newBindEntry($param); } else { $paramArray[$table][$column] = 'NULL'; } } } $newwhere = new \stdClass(); $newwhere->params = $paramArray; $newwhere->inner = $inner; $newwhere->outer = $outer; $this->wheres[] = $newwhere; } private function newInsertEntry(array $record) { foreach ($record as $column => $param) { // insert record column validation is handled by $this->setColumns() // no need to add it here $record[$column] = $this->newBindEntry($param, ':ins'); } $this->records[] = $record; } private function newBindEntry($param, string $type = ':wh') : string { if (!isset($this->bindings[$type])) { $this->bindings[$type] = []; } $count = count($this->bindings[$type]); $this->bindings[$type][$type . $count] = $param; return $type . $count; } // ADDITONAL FUNCTIONS private function checkOperand($variable, $param) : string { if ($param == 'NULL' && strpos($variable, '!=') !== false) { return 'IS NOT'; } if (strpos($variable, '!=') !== false) { return '!='; } if (strpos($variable, '>=') !== false) { return '>='; } if (strpos($variable, '<=') !== false) { return '<='; } if (strpos($variable, '>') !== false) { return '>'; } if (strpos($variable, '<') !== false) { return '<'; } if (strpos(strtolower($variable), ' not like') !== false) { return 'NOT LIKE'; } if (strpos(strtolower($variable), ' like') !== false) { return 'LIKE'; } if (strpos(strtolower($variable), ' not in') !== false) { return 'NOT IN'; } if (strpos(strtolower($variable), ' in') !== false) { return 'IN'; } if ($param === 'NULL') { return 'IS'; } return '='; } private function stripOperands($variable) : string { $variable = strtolower($variable); $variable = preg_replace('/ not like$/', '', $variable); $variable = preg_replace('/ like$/', '', $variable); $variable = preg_replace('/ not in$/', '', $variable); $variable = preg_replace('/ in$/', '', $variable); $variable = rtrim($variable, '>='); $variable = rtrim($variable, '!='); $variable = rtrim($variable, '<='); $variable = rtrim($variable, '>'); $variable = rtrim($variable, '<'); return rtrim($variable, ' '); } private function hasNumericKeys(array $array) : bool { foreach ($array as $key => $value) { if (!is_string($key)) { return true; } } return false; } private function validateTableName(string $table) : bool { if($table === 'sypherlev_blueprint_tablename_placeholder') { // the placeholder table name is always valid return true; } if (!empty($this->tablewhitelist) && !in_array($table, $this->tablewhitelist)) { return false; } return true; } private function validateColumnName(string $column) : bool { $column = $this->stripOperands($column); if (!empty($this->columnwhitelist) && !in_array($column, $this->columnwhitelist)) { return false; } return true; } }
sypherlev/blueprint
src/QueryBuilders/MySql/MySqlQuery.php
PHP
mit
31,093
import {expect} from 'chai'; import lib from './src'; const err = 'No items resolved'; function resolveMe() { return Promise.resolve('sup'); } function rejectMe() { return Promise.reject('naw'); } function throwMe() { throw new Error('no thanks'); } function valueMe() { return 'value'; } describe('chain of promises', function () { it('resolves first item (resolved promise)', function () { return lib([resolveMe]).then((result) => expect(result).to.equal('sup')); }); it('resolves first item (value)', function () { return lib([valueMe]).then((result) => expect(result).to.equal('value')); }); it('resolves subsequent (resolved promise) item if first rejects', function () { return lib([rejectMe, resolveMe]).then((result) => expect(result).to.equal('sup')); }); it('resolves subsequent (value) item if first rejects', function () { return lib([rejectMe, valueMe]).then((result) => expect(result).to.equal('value')); }); it('resolves subsequent (resolved promise) item if first throws', function () { return lib([throwMe, resolveMe]).then((result) => expect(result).to.equal('sup')); }); it('resolves subsequent (value) item if first throws', function () { return lib([throwMe, valueMe]).then((result) => expect(result).to.equal('value')); }); it('rejects if all items reject', function () { return lib([rejectMe]).catch((e) => expect(e.message).to.equal(err)); }); it('rejects if all items throw', function () { return lib([throwMe]).catch((e) => expect(e.message).to.equal(err)); }); it('rejects it all items reject or throw', function () { return lib([throwMe, rejectMe]).catch((e) => expect(e.message).to.equal(err)); }); it('rejects if list is empty', function () { return lib([]).catch((e) => expect(e.message).to.equal('List must not be empty')); }); it('rejects if list is not an array', function () { return lib('lolwhut').catch((e) => expect(e.message).to.equal('List must be an array')); }); it('rejects if items are not functions', function () { return lib([1, 2, 3]).catch((e) => expect(e.message).to.equal('List items must be functions')); }); });
nelsonpecora/chain-of-promises
test.js
JavaScript
mit
2,185
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>User agent detail - LG-KP220</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/css/materialize.min.css"> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> <link href="../circle.css" rel="stylesheet"> </head> <body> <div class="container"> <div class="section"> <h1 class="header center orange-text">User agent detail</h1> <div class="row center"> <h5 class="header light"> LG-KP220 </h5> </div> </div> <div class="section"> <table class="striped"><tr><th></th><th colspan="3">General</th><th colspan="5">Device</th><th colspan="3">Bot</th><th colspan="2"></th></tr><tr><th>Provider</th><th>Browser</th><th>Engine</th><th>OS</th><th>Brand</th><th>Model</th><th>Type</th><th>Is mobile</th><th>Is touch</th><th>Is bot</th><th>Name</th><th>Type</th><th>Parse time</th><th>Actions</th></tr><tr><th colspan="14" class="green lighten-3">Test suite</th></tr><tr><td>UAParser<br /><small>v0.5.0.2</small><br /><small>vendor/thadafinser/uap-core/tests/test_device.yaml</small></td><td> </td><td><i class="material-icons">close</i></td><td> </td><td style="border-left: 1px solid #555">LG</td><td>KP220</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-cfed3005-df48-4fa8-bf03-4f6ef8988f59">Detail</a> <!-- Modal Structure --> <div id="modal-cfed3005-df48-4fa8-bf03-4f6ef8988f59" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>UAParser result detail</h4> <p><pre><code class="php">Array ( [user_agent_string] => LG-KP220 [family] => LG KP220 [brand] => LG [model] => KP220 ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><th colspan="14" class="green lighten-3">Providers</th></tr><tr><td>BrowscapFull<br /><small>6014</small><br /></td> <td colspan="12" class="center-align red lighten-1"> <strong>No result found</strong> </td> </tr><tr><td>BrowscapLite<br /><small>6014</small><br /></td> <td colspan="12" class="center-align red lighten-1"> <strong>No result found</strong> </td> </tr><tr><td>BrowscapPhp<br /><small>6014</small><br /></td> <td colspan="12" class="center-align red lighten-1"> <strong>No result found</strong> </td> </tr><tr><td>DonatjUAParser<br /><small>v0.5.1</small><br /></td><td>LG-KP220 </td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-15fbc1f0-2615-4d42-b5d9-a30dd647b050">Detail</a> <!-- Modal Structure --> <div id="modal-15fbc1f0-2615-4d42-b5d9-a30dd647b050" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>DonatjUAParser result detail</h4> <p><pre><code class="php">Array ( [platform] => [browser] => LG-KP220 [version] => ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>JenssegersAgent<br /><small>v2.3.3</small><br /></td> <td colspan="12" class="center-align red lighten-1"> <strong>No result found</strong> </td> </tr><tr><td>NeutrinoApiCom<br /><small></small><br /></td><td> </td><td><i class="material-icons">close</i></td><td> </td><td style="border-left: 1px solid #555">LG</td><td>KP220</td><td>mobile-browser</td><td>yes</td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.20901</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-8c2a7a4e-3fbf-4df2-8d61-5e730422f67b">Detail</a> <!-- Modal Structure --> <div id="modal-8c2a7a4e-3fbf-4df2-8d61-5e730422f67b" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>NeutrinoApiCom result detail</h4> <p><pre><code class="php">stdClass Object ( [mobile_screen_height] => 0 [is_mobile] => 1 [type] => mobile-browser [mobile_brand] => LG [mobile_model] => KP220 [version] => [is_android] => [browser_name] => unknown [operating_system_family] => unknown [operating_system_version] => [is_ios] => [producer] => LG [operating_system] => unknown [mobile_screen_width] => 0 [mobile_browser] => ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>PiwikDeviceDetector<br /><small>3.6.1</small><br /></td><td> </td><td> </td><td> </td><td style="border-left: 1px solid #555">LG</td><td>KP220</td><td>smartphone</td><td>yes</td><td></td><td style="border-left: 1px solid #555"></td><td></td><td></td><td>0.009</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-4a941d34-a8d3-4914-9724-346f60ad7046">Detail</a> <!-- Modal Structure --> <div id="modal-4a941d34-a8d3-4914-9724-346f60ad7046" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>PiwikDeviceDetector result detail</h4> <p><pre><code class="php">Array ( [client] => [operatingSystem] => Array ( ) [device] => Array ( [brand] => LG [brandName] => LG [model] => KP220 [device] => 1 [deviceName] => smartphone ) [bot] => [extra] => Array ( [isBot] => [isBrowser] => [isFeedReader] => [isMobileApp] => [isPIM] => [isLibrary] => [isMediaPlayer] => [isCamera] => [isCarBrowser] => [isConsole] => [isFeaturePhone] => [isPhablet] => [isPortableMediaPlayer] => [isSmartDisplay] => [isSmartphone] => 1 [isTablet] => [isTV] => [isDesktop] => [isMobile] => 1 [isTouchEnabled] => ) ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>SinergiBrowserDetector<br /><small>6.0.1</small><br /></td> <td colspan="12" class="center-align red lighten-1"> <strong>No result found</strong> </td> </tr><tr><td>UAParser<br /><small>v3.4.5</small><br /></td><td> </td><td><i class="material-icons">close</i></td><td> </td><td style="border-left: 1px solid #555">LG</td><td>KP220</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.012</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-3160e405-8a8f-46dd-8f47-5115f06462d2">Detail</a> <!-- Modal Structure --> <div id="modal-3160e405-8a8f-46dd-8f47-5115f06462d2" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>UAParser result detail</h4> <p><pre><code class="php">UAParser\Result\Client Object ( [ua] => UAParser\Result\UserAgent Object ( [major] => [minor] => [patch] => [family] => Other ) [os] => UAParser\Result\OperatingSystem Object ( [major] => [minor] => [patch] => [patchMinor] => [family] => Other ) [device] => UAParser\Result\Device Object ( [brand] => LG [model] => KP220 [family] => LG KP220 ) [originalUserAgent] => LG-KP220 ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>UserAgentApiCom<br /><small></small><br /></td> <td colspan="12" class="center-align red lighten-1"> <strong>No result found</strong> </td> </tr><tr><td>UserAgentStringCom<br /><small></small><br /></td> <td colspan="12" class="center-align red lighten-1"> <strong>No result found</strong> </td> </tr><tr><td>WhatIsMyBrowserCom<br /><small></small><br /></td><td> </td><td> </td><td> </td><td style="border-left: 1px solid #555">LG</td><td>LGKP220</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0.24401</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-5fc1ff22-a74d-481b-9ad1-fcfde73ded9c">Detail</a> <!-- Modal Structure --> <div id="modal-5fc1ff22-a74d-481b-9ad1-fcfde73ded9c" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>WhatIsMyBrowserCom result detail</h4> <p><pre><code class="php">stdClass Object ( [operating_system_name] => [simple_sub_description_string] => [simple_browser_string] => [browser_version] => [extra_info] => Array ( ) [operating_platform] => LGKP220 [extra_info_table] => Array ( ) [layout_engine_name] => [detected_addons] => Array ( ) [operating_system_flavour_code] => [hardware_architecture] => [operating_system_flavour] => [operating_system_frameworks] => Array ( ) [browser_name_code] => [operating_system_version] => [simple_operating_platform_string] => LGKP220 [is_abusive] => [layout_engine_version] => [browser_capabilities] => Array ( ) [operating_platform_vendor_name] => LG [operating_system] => [operating_system_version_full] => [operating_platform_code] => LGKP220 [browser_name] => [operating_system_name_code] => [user_agent] => LG-KP220 [browser_version_full] => [browser] => ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>WhichBrowser<br /><small>v2.0.18</small><br /></td><td> </td><td> </td><td> </td><td style="border-left: 1px solid #555">LG</td><td>KP220</td><td>mobile:feature</td><td>yes</td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.003</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-083a336f-5d73-4505-84f3-c5fc9bb78652">Detail</a> <!-- Modal Structure --> <div id="modal-083a336f-5d73-4505-84f3-c5fc9bb78652" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>WhichBrowser result detail</h4> <p><pre><code class="php">Array ( [device] => Array ( [type] => mobile [subtype] => feature [manufacturer] => LG [model] => KP220 ) ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>Woothee<br /><small>v1.2.0</small><br /></td> <td colspan="12" class="center-align red lighten-1"> <strong>No result found</strong> </td> </tr><tr><td>Wurfl<br /><small>1.7.1.0</small><br /></td><td> </td><td><i class="material-icons">close</i></td><td> </td><td style="border-left: 1px solid #555">LG</td><td>KP220</td><td>Feature Phone</td><td>yes</td><td></td><td style="border-left: 1px solid #555"></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0.029</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-a2bedf8c-4a95-42a7-96c5-aaf233b2ac50">Detail</a> <!-- Modal Structure --> <div id="modal-a2bedf8c-4a95-42a7-96c5-aaf233b2ac50" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>Wurfl result detail</h4> <p><pre><code class="php">Array ( [virtual] => Array ( [is_android] => false [is_ios] => false [is_windows_phone] => false [is_app] => false [is_full_desktop] => false [is_largescreen] => false [is_mobile] => true [is_robot] => false [is_smartphone] => false [is_touchscreen] => false [is_wml_preferred] => false [is_xhtmlmp_preferred] => true [is_html_preferred] => false [advertised_device_os] => [advertised_device_os_version] => [advertised_browser] => [advertised_browser_version] => [complete_device_name] => LG KP220 [device_name] => LG KP220 [form_factor] => Feature Phone [is_phone] => true [is_app_webview] => false ) [all] => Array ( [brand_name] => LG [model_name] => KP220 [unique] => true [ununiqueness_handler] => [is_wireless_device] => true [device_claims_web_support] => false [has_qwerty_keyboard] => false [can_skip_aligned_link_row] => true [uaprof] => http://gsm.lge.com/html/gsm/LG-UAP-KP220-v0.1.xml [uaprof2] => [uaprof3] => [nokia_series] => 0 [nokia_edition] => 0 [device_os] => [mobile_browser] => Teleca-Obigo [mobile_browser_version] => 2.0 [device_os_version] => [pointing_method] => [release_date] => 2008_january [marketing_name] => [model_extra_info] => [nokia_feature_pack] => 0 [can_assign_phone_number] => true [is_tablet] => false [manufacturer_name] => [is_bot] => false [is_google_glass] => false [proportional_font] => false [built_in_back_button_support] => false [card_title_support] => true [softkey_support] => true [table_support] => true [numbered_menus] => false [menu_with_select_element_recommended] => false [menu_with_list_of_links_recommended] => true [icons_on_menu_items_support] => false [break_list_of_links_with_br_element_recommended] => true [access_key_support] => false [wrap_mode_support] => false [times_square_mode_support] => false [deck_prefetch_support] => false [elective_forms_recommended] => true [wizards_recommended] => false [image_as_link_support] => false [insert_br_element_after_widget_recommended] => false [wml_can_display_images_and_text_on_same_line] => false [wml_displays_image_in_center] => false [opwv_wml_extensions_support] => false [wml_make_phone_call_string] => wtai://wp/mc; [chtml_display_accesskey] => false [emoji] => false [chtml_can_display_images_and_text_on_same_line] => false [chtml_displays_image_in_center] => false [imode_region] => none [chtml_make_phone_call_string] => tel: [chtml_table_support] => false [xhtml_honors_bgcolor] => false [xhtml_supports_forms_in_table] => false [xhtml_support_wml2_namespace] => false [xhtml_autoexpand_select] => false [xhtml_select_as_dropdown] => false [xhtml_select_as_radiobutton] => false [xhtml_select_as_popup] => false [xhtml_display_accesskey] => false [xhtml_supports_invisible_text] => false [xhtml_supports_inline_input] => false [xhtml_supports_monospace_font] => false [xhtml_supports_table_for_layout] => false [xhtml_supports_css_cell_table_coloring] => false [xhtml_format_as_css_property] => false [xhtml_format_as_attribute] => false [xhtml_nowrap_mode] => false [xhtml_marquee_as_css_property] => false [xhtml_readable_background_color1] => #FFFFFF [xhtml_readable_background_color2] => #FFFFFF [xhtml_allows_disabled_form_elements] => false [xhtml_document_title_support] => true [xhtml_preferred_charset] => utf8 [opwv_xhtml_extensions_support] => false [xhtml_make_phone_call_string] => tel: [xhtmlmp_preferred_mime_type] => application/vnd.wap.xhtml+xml [xhtml_table_support] => true [xhtml_send_sms_string] => none [xhtml_send_mms_string] => none [xhtml_file_upload] => not_supported [cookie_support] => true [accept_third_party_cookie] => false [xhtml_supports_iframe] => none [xhtml_avoid_accesskeys] => false [xhtml_can_embed_video] => none [ajax_support_javascript] => false [ajax_manipulate_css] => false [ajax_support_getelementbyid] => false [ajax_support_inner_html] => false [ajax_xhr_type] => none [ajax_manipulate_dom] => false [ajax_support_events] => false [ajax_support_event_listener] => false [ajax_preferred_geoloc_api] => none [xhtml_support_level] => 1 [preferred_markup] => html_wi_oma_xhtmlmp_1_0 [wml_1_1] => true [wml_1_2] => false [wml_1_3] => true [html_wi_w3_xhtmlbasic] => true [html_wi_oma_xhtmlmp_1_0] => true [html_wi_imode_html_1] => false [html_wi_imode_html_2] => false [html_wi_imode_html_3] => false [html_wi_imode_html_4] => false [html_wi_imode_html_5] => false [html_wi_imode_htmlx_1] => false [html_wi_imode_htmlx_1_1] => false [html_wi_imode_compact_generic] => false [html_web_3_2] => false [html_web_4_0] => false [voicexml] => false [multipart_support] => false [total_cache_disable_support] => false [time_to_live_support] => false [resolution_width] => 128 [resolution_height] => 160 [columns] => 11 [max_image_width] => 120 [max_image_height] => 130 [rows] => 6 [physical_screen_width] => 27 [physical_screen_height] => 34 [dual_orientation] => false [density_class] => 1.0 [wbmp] => true [bmp] => true [epoc_bmp] => false [gif_animated] => true [jpg] => true [png] => true [tiff] => false [transparent_png_alpha] => false [transparent_png_index] => false [svgt_1_1] => false [svgt_1_1_plus] => false [greyscale] => false [gif] => true [colors] => 16777216 [webp_lossy_support] => false [webp_lossless_support] => false [post_method_support] => true [basic_authentication_support] => true [empty_option_value_support] => true [emptyok] => false [nokia_voice_call] => true [wta_voice_call] => false [wta_phonebook] => true [wta_misc] => false [wta_pdc] => false [https_support] => true [phone_id_provided] => false [max_data_rate] => 9 [wifi] => false [sdio] => false [vpn] => false [has_cellular_radio] => true [max_deck_size] => 30000 [max_url_length_in_requests] => 256 [max_url_length_homepage] => 0 [max_url_length_bookmark] => 0 [max_url_length_cached_page] => 0 [max_no_of_connection_settings] => 0 [max_no_of_bookmarks] => 0 [max_length_of_username] => 0 [max_length_of_password] => 0 [max_object_size] => 0 [downloadfun_support] => false [directdownload_support] => true [inline_support] => false [oma_support] => false [ringtone] => false [ringtone_3gpp] => false [ringtone_midi_monophonic] => false [ringtone_midi_polyphonic] => false [ringtone_imelody] => false [ringtone_digiplug] => false [ringtone_compactmidi] => false [ringtone_mmf] => false [ringtone_rmf] => false [ringtone_xmf] => false [ringtone_amr] => false [ringtone_awb] => false [ringtone_aac] => false [ringtone_wav] => false [ringtone_mp3] => false [ringtone_spmidi] => false [ringtone_qcelp] => false [ringtone_voices] => 1 [ringtone_df_size_limit] => 0 [ringtone_directdownload_size_limit] => 0 [ringtone_inline_size_limit] => 0 [ringtone_oma_size_limit] => 0 [wallpaper] => false [wallpaper_max_width] => 0 [wallpaper_max_height] => 0 [wallpaper_preferred_width] => 0 [wallpaper_preferred_height] => 0 [wallpaper_resize] => none [wallpaper_wbmp] => false [wallpaper_bmp] => false [wallpaper_gif] => false [wallpaper_jpg] => false [wallpaper_png] => false [wallpaper_tiff] => false [wallpaper_greyscale] => false [wallpaper_colors] => 2 [wallpaper_df_size_limit] => 0 [wallpaper_directdownload_size_limit] => 0 [wallpaper_inline_size_limit] => 0 [wallpaper_oma_size_limit] => 0 [screensaver] => false [screensaver_max_width] => 0 [screensaver_max_height] => 0 [screensaver_preferred_width] => 0 [screensaver_preferred_height] => 0 [screensaver_resize] => none [screensaver_wbmp] => false [screensaver_bmp] => false [screensaver_gif] => false [screensaver_jpg] => false [screensaver_png] => false [screensaver_greyscale] => false [screensaver_colors] => 2 [screensaver_df_size_limit] => 0 [screensaver_directdownload_size_limit] => 0 [screensaver_inline_size_limit] => 0 [screensaver_oma_size_limit] => 0 [picture] => false [picture_max_width] => 0 [picture_max_height] => 0 [picture_preferred_width] => 0 [picture_preferred_height] => 0 [picture_resize] => none [picture_wbmp] => false [picture_bmp] => false [picture_gif] => false [picture_jpg] => false [picture_png] => false [picture_greyscale] => false [picture_colors] => 2 [picture_df_size_limit] => 0 [picture_directdownload_size_limit] => 0 [picture_inline_size_limit] => 0 [picture_oma_size_limit] => 0 [video] => false [oma_v_1_0_forwardlock] => false [oma_v_1_0_combined_delivery] => false [oma_v_1_0_separate_delivery] => false [streaming_video] => false [streaming_3gpp] => false [streaming_mp4] => false [streaming_mov] => false [streaming_video_size_limit] => 0 [streaming_real_media] => none [streaming_flv] => false [streaming_3g2] => false [streaming_vcodec_h263_0] => -1 [streaming_vcodec_h263_3] => -1 [streaming_vcodec_mpeg4_sp] => -1 [streaming_vcodec_mpeg4_asp] => -1 [streaming_vcodec_h264_bp] => -1 [streaming_acodec_amr] => none [streaming_acodec_aac] => none [streaming_wmv] => none [streaming_preferred_protocol] => rtsp [streaming_preferred_http_protocol] => none [wap_push_support] => true [connectionless_service_indication] => false [connectionless_service_load] => false [connectionless_cache_operation] => false [connectionoriented_unconfirmed_service_indication] => false [connectionoriented_unconfirmed_service_load] => false [connectionoriented_unconfirmed_cache_operation] => false [connectionoriented_confirmed_service_indication] => false [connectionoriented_confirmed_service_load] => false [connectionoriented_confirmed_cache_operation] => false [utf8_support] => false [ascii_support] => false [iso8859_support] => false [expiration_date] => false [j2me_cldc_1_0] => false [j2me_cldc_1_1] => false [j2me_midp_1_0] => false [j2me_midp_2_0] => false [doja_1_0] => false [doja_1_5] => false [doja_2_0] => false [doja_2_1] => false [doja_2_2] => false [doja_3_0] => false [doja_3_5] => false [doja_4_0] => false [j2me_jtwi] => false [j2me_mmapi_1_0] => false [j2me_mmapi_1_1] => false [j2me_wmapi_1_0] => false [j2me_wmapi_1_1] => false [j2me_wmapi_2_0] => false [j2me_btapi] => false [j2me_3dapi] => false [j2me_locapi] => false [j2me_nokia_ui] => false [j2me_motorola_lwt] => false [j2me_siemens_color_game] => false [j2me_siemens_extension] => false [j2me_heap_size] => 0 [j2me_max_jar_size] => 0 [j2me_storage_size] => 0 [j2me_max_record_store_size] => 0 [j2me_screen_width] => 0 [j2me_screen_height] => 0 [j2me_canvas_width] => 0 [j2me_canvas_height] => 0 [j2me_bits_per_pixel] => 0 [j2me_audio_capture_enabled] => false [j2me_video_capture_enabled] => false [j2me_photo_capture_enabled] => false [j2me_capture_image_formats] => none [j2me_http] => false [j2me_https] => false [j2me_socket] => false [j2me_udp] => false [j2me_serial] => false [j2me_gif] => false [j2me_gif89a] => false [j2me_jpg] => false [j2me_png] => false [j2me_bmp] => false [j2me_bmp3] => false [j2me_wbmp] => false [j2me_midi] => false [j2me_wav] => false [j2me_amr] => false [j2me_mp3] => false [j2me_mp4] => false [j2me_imelody] => false [j2me_rmf] => false [j2me_au] => false [j2me_aac] => false [j2me_realaudio] => false [j2me_xmf] => false [j2me_wma] => false [j2me_3gpp] => false [j2me_h263] => false [j2me_svgt] => false [j2me_mpeg4] => false [j2me_realvideo] => false [j2me_real8] => false [j2me_realmedia] => false [j2me_left_softkey_code] => 0 [j2me_right_softkey_code] => 0 [j2me_middle_softkey_code] => 0 [j2me_select_key_code] => 0 [j2me_return_key_code] => 0 [j2me_clear_key_code] => 0 [j2me_datefield_no_accepts_null_date] => false [j2me_datefield_broken] => false [receiver] => false [sender] => false [mms_max_size] => 307200 [mms_max_height] => 480 [mms_max_width] => 640 [built_in_recorder] => false [built_in_camera] => false [mms_jpeg_baseline] => true [mms_jpeg_progressive] => false [mms_gif_static] => true [mms_gif_animated] => false [mms_png] => false [mms_bmp] => true [mms_wbmp] => true [mms_amr] => true [mms_wav] => true [mms_midi_monophonic] => true [mms_midi_polyphonic] => false [mms_midi_polyphonic_voices] => 0 [mms_spmidi] => true [mms_mmf] => false [mms_mp3] => false [mms_evrc] => false [mms_qcelp] => false [mms_ota_bitmap] => false [mms_nokia_wallpaper] => false [mms_nokia_operatorlogo] => false [mms_nokia_3dscreensaver] => false [mms_nokia_ringingtone] => false [mms_rmf] => false [mms_xmf] => false [mms_symbian_install] => false [mms_jar] => false [mms_jad] => false [mms_vcard] => true [mms_vcalendar] => false [mms_wml] => false [mms_wbxml] => false [mms_wmlc] => false [mms_video] => false [mms_mp4] => false [mms_3gpp] => false [mms_3gpp2] => false [mms_max_frame_rate] => 0 [nokiaring] => false [picturemessage] => false [operatorlogo] => false [largeoperatorlogo] => false [callericon] => false [nokiavcard] => false [nokiavcal] => false [sckl_ringtone] => false [sckl_operatorlogo] => false [sckl_groupgraphic] => false [sckl_vcard] => false [sckl_vcalendar] => false [text_imelody] => false [ems] => false [ems_variablesizedpictures] => false [ems_imelody] => false [ems_odi] => false [ems_upi] => false [ems_version] => 0 [siemens_ota] => false [siemens_logo_width] => 101 [siemens_logo_height] => 29 [siemens_screensaver_width] => 101 [siemens_screensaver_height] => 50 [gprtf] => false [sagem_v1] => false [sagem_v2] => false [panasonic] => false [sms_enabled] => true [wav] => true [mmf] => false [smf] => false [mld] => false [midi_monophonic] => true [midi_polyphonic] => false [sp_midi] => true [rmf] => false [xmf] => false [compactmidi] => false [digiplug] => false [nokia_ringtone] => false [imelody] => true [au] => false [amr] => true [awb] => false [aac] => true [mp3] => true [voices] => 1 [qcelp] => false [evrc] => false [flash_lite_version] => [fl_wallpaper] => false [fl_screensaver] => false [fl_standalone] => false [fl_browser] => false [fl_sub_lcd] => false [full_flash_support] => false [css_supports_width_as_percentage] => true [css_border_image] => none [css_rounded_corners] => none [css_gradient] => none [css_spriting] => false [css_gradient_linear] => none [is_transcoder] => false [transcoder_ua_header] => user-agent [rss_support] => false [pdf_support] => false [progressive_download] => false [playback_vcodec_h263_0] => -1 [playback_vcodec_h263_3] => -1 [playback_vcodec_mpeg4_sp] => -1 [playback_vcodec_mpeg4_asp] => -1 [playback_vcodec_h264_bp] => -1 [playback_real_media] => none [playback_3gpp] => false [playback_3g2] => false [playback_mp4] => false [playback_mov] => false [playback_acodec_amr] => none [playback_acodec_aac] => none [playback_df_size_limit] => 0 [playback_directdownload_size_limit] => 0 [playback_inline_size_limit] => 0 [playback_oma_size_limit] => 0 [playback_acodec_qcelp] => false [playback_wmv] => none [hinted_progressive_download] => false [html_preferred_dtd] => xhtml_mp1 [viewport_supported] => false [viewport_width] => [viewport_userscalable] => [viewport_initial_scale] => [viewport_maximum_scale] => [viewport_minimum_scale] => [mobileoptimized] => false [handheldfriendly] => false [canvas_support] => none [image_inlining] => false [is_smarttv] => false [is_console] => false [nfc_support] => false [ux_full_desktop] => false [jqm_grade] => none [is_sencha_touch_ok] => false ) ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>Zsxsoft<br /><small>1.3</small><br /></td><td> </td><td><i class="material-icons">close</i></td><td> </td><td style="border-left: 1px solid #555">LG</td><td>KP220</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0.001</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-5d43e024-b46c-44f6-8914-529b05569bc2">Detail</a> <!-- Modal Structure --> <div id="modal-5d43e024-b46c-44f6-8914-529b05569bc2" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>Zsxsoft result detail</h4> <p><pre><code class="php">Array ( [browser] => Array ( [link] => # [title] => Unknown [name] => Unknown [version] => [code] => null [image] => img/16/browser/null.png ) [os] => Array ( [link] => [name] => [version] => [code] => null [x64] => [title] => [type] => os [dir] => os [image] => img/16/os/null.png ) [device] => Array ( [link] => http://www.lgmobile.com [title] => LG KP220 [model] => KP220 [brand] => LG [code] => lg [dir] => device [type] => device [image] => img/16/device/lg.png ) [platform] => Array ( [link] => http://www.lgmobile.com [title] => LG KP220 [model] => KP220 [brand] => LG [code] => lg [dir] => device [type] => device [image] => img/16/device/lg.png ) ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr></table> </div> <div class="section"> <h1 class="header center orange-text">About this comparison</h1> <div class="row center"> <h5 class="header light"> The primary goal of this project is simple<br /> I wanted to know which user agent parser is the most accurate in each part - device detection, bot detection and so on...<br /> <br /> The secondary goal is to provide a source for all user agent parsers to improve their detection based on this results.<br /> <br /> You can also improve this further, by suggesting ideas at <a href="https://github.com/ThaDafinser/UserAgentParserComparison">ThaDafinser/UserAgentParserComparison</a><br /> <br /> The comparison is based on the abstraction by <a href="https://github.com/ThaDafinser/UserAgentParser">ThaDafinser/UserAgentParser</a> </h5> </div> </div> <div class="card"> <div class="card-content"> Comparison created <i>2016-05-10 08:03:38</i> | by <a href="https://github.com/ThaDafinser">ThaDafinser</a> </div> </div> </div> <script src="https://code.jquery.com/jquery-2.1.4.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/js/materialize.min.js"></script> <script src="http://cdnjs.cloudflare.com/ajax/libs/list.js/1.2.0/list.min.js"></script> <script> $(document).ready(function(){ // the "href" attribute of .modal-trigger must specify the modal ID that wants to be triggered $('.modal-trigger').leanModal(); }); </script> </body> </html>
ThaDafinser/UserAgentParserComparison
v5/user-agent-detail/9c/3b/9c3ba336-0710-4ba7-b7b9-effa63bc9f89.html
HTML
mit
39,906
package main import ( "net/http" "sync" "gopkg.in/mgo.v2" ) var dbSessions = make(map[*http.Request]map[string]interface{}) var dbSessionsLock sync.RWMutex var uidExtra = make(map[string]string) var uidExtraLock sync.Mutex func OpenVars(r *http.Request) { dbSessionsLock.Lock() if dbSessions == nil { dbSessions = map[*http.Request]map[string]interface{}{} } dbSessions[r] = map[string]interface{}{} dbSessionsLock.Unlock() } func SetVar(r *http.Request, key string, val interface{}) { dbSessionsLock.Lock() if dbSessions == nil { dbSessions = map[*http.Request]map[string]interface{}{} } if dbSessions[r] == nil { dbSessions[r] = make(map[string]interface{}) } dbSessions[r][key] = val dbSessionsLock.Unlock() } func GetVar(r *http.Request, key string) interface{} { dbSessionsLock.Lock() val := dbSessions[r][key] dbSessionsLock.Unlock() return val } func RemoveVars(r *http.Request) { dbSessionsLock.Lock() delete(dbSessions, r) dbSessionsLock.Unlock() } func DbSession(db *mgo.Session, next http.HandlerFunc) http.HandlerFunc { return func(rw http.ResponseWriter, r *http.Request) { thisDb := db.Copy() defer thisDb.Close() SetVar(r, "db", thisDb) next(rw, r) } } func StoreSession(ip, uid string) { uidExtraLock.Lock() defer uidExtraLock.Unlock() uidExtra[uid] = ip } func CheckSession(ip, uid string) bool { uidExtraLock.Lock() defer uidExtraLock.Unlock() _, ok := uidExtra[uid] if !ok { return false } return uidExtra[uid] == ip } func DestroySession(uid string) { uidExtraLock.Lock() defer uidExtraLock.Unlock() delete(uidExtra, uid) }
Code4SierraLeone/KnowYourCity
app/database.go
GO
mit
1,605
<?php namespace App\Console\Commands\Scaffold; class Relation { /** * @var string */ private $relationType; /** * @var BaseModel */ public $model; public function __construct($relationType, BaseModel $model) { $this->relationType = strtolower($relationType); $this->model = $model; } /** * Is the current relation a "belongsTo" * * @return bool */ public function isBelongsTo() { return $this->relationType == "belongsto"; } /** * Is the current relation a "belongsToMany" * * @return bool */ public function isBelongsToMany() { return $this->relationType == "belongstomany"; } /** * Return the related models' table name * * @return string */ public function getRelatedModelTableName() { return $this->model->getTableName(); } /** * Return the foreign key name * * @return string */ public function getForeignKeyName() { return $this->model->tableNameLower() . "_id"; } /** * Get the name of the pivot table of current relation * and specified model * * @param Model $model * @return string */ public function getPivotTableName(Model $model) { $tableOne = $this->model->lower(); $tableTwo = $model->lower(); if(strcmp($tableOne, $tableTwo) > 1) $tableName = $tableTwo ."_".$tableOne; else $tableName = $tableOne ."_".$tableTwo; return $tableName; } /** * Return the "reverse" of relationship * * @return array */ public function reverseRelations() { $reverseRelations = array(); switch($this->relationType) { case "belongsto": $reverseRelations = array('hasOne', 'hasMany'); break; case "hasone": $reverseRelations = array('belongsTo'); break; case "belongstomany": $reverseRelations = array('belongsToMany'); break; case "hasmany": $reverseRelations = array('belongsTo'); break; } return $reverseRelations; } /** * Return the table name of the relation * * @return string */ public function getTableName() { return $this->model->plural(); } /** * Return the type of the relation * * @return string */ public function getType() { switch($this->relationType) { case "belongsto": return "belongsTo"; break; case "hasone": return "hasOne"; break; case "belongstomany": return "belongsToMany"; break; case "hasmany": return "hasMany"; break; } return ""; } /** * Get the name of the related or specified model * * @param Model $model * @param string $type * @return string */ public function getName(Model $model = null, $type = "") { $relationName = ""; if(!$type) $type = $this->relationType; if(!$model) $model = $this->model; switch($type) { case "belongsto": case "hasone": $relationName = $model->lower(); break; case "belongstomany": case "hasmany": $relationName = $model->plural(); break; } return $relationName; } /** * Return the name of the relation of the specified model * * @param Model $model * @param $type * @return string */ public function getReverseName(Model $model, $type) { return $this->getName($model, strtolower($type)); } }
deyvisonrocha/laravel-base
app/Console/Commands/Scaffold/Relation.php
PHP
mit
4,041
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `openpty` fn in crate `libc`."><meta name="keywords" content="rust, rustlang, rust-lang, openpty"><title>libc::openpty - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="https://doc.rust-lang.org/favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc fn"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../libc/index.html'><div class='logo-container'><img src='https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png' alt='logo'></div></a><div class="sidebar-elems"><p class='location'><a href='index.html'>libc</a></p><script>window.sidebarCurrent = {name: 'openpty', ty: 'fn', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../src/libc/unix/bsd/apple/mod.rs.html#2107-2111' title='goto source code'>[src]</a></span><span class='in-band'>Function <a href='index.html'>libc</a>::<wbr><a class="fn" href=''>openpty</a></span></h1><pre class='rust fn'>pub unsafe extern &quot;C&quot; fn openpty(<br>&nbsp;&nbsp;&nbsp;&nbsp;amaster: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*mut </a><a class="type" href="../libc/type.c_int.html" title="type libc::c_int">c_int</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;aslave: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*mut </a><a class="type" href="../libc/type.c_int.html" title="type libc::c_int">c_int</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;name: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*mut </a><a class="type" href="../libc/type.c_char.html" title="type libc::c_char">c_char</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;termp: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*mut </a><a class="struct" href="../libc/struct.termios.html" title="struct libc::termios">termios</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;winp: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*mut </a><a class="struct" href="../libc/struct.winsize.html" title="struct libc::winsize">winsize</a><br>) -&gt; <a class="type" href="../libc/type.c_int.html" title="type libc::c_int">c_int</a></pre></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd>↑</kbd></dt><dd>Move up in search results</dd><dt><kbd>↓</kbd></dt><dd>Move down in search results</dd><dt><kbd>↹</kbd></dt><dd>Switch tab</dd><dt><kbd>&#9166;</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g., <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g., <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g., <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../";window.currentCrate = "libc";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>
IllinoisRoboticsInSpace/Arduino_Control
rust-serial/target/doc/libc/fn.openpty.html
HTML
mit
5,376
(function() { 'use strict'; angular.module('autocompleteList', ['ngMaterial']).directive('autocompleteList', autocompleteList); /** * @name Autocomplete List Directive * * @description This element is made up of an md-autocomplete that will show prompts based on the unselected items, and an md-list that will display all selected items. * **Basic Example** ```html <autocomplete-list ng-model="ctrl.selectedPeople" items="ctrl.allPeople" item-text="item.firstName + ' ' + item.lastName" placeholder="Find people..."> </autocomplete-list> ``` * ### Customizing list contents * The contents of the list is by default based on the text of each items generated by the `itemText` expression. The exact contents is: ```html <p>{{ aclCtrl.itemText({item: item}) }}</p> <md-button type="button" class="md-exclude multi-select-secondary-button" ng-click="aclCtrl.deselectItem(item)" aria-label="remove"> <md-icon> <svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"> <path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/> <path d="M0 0h24v24H0z" fill="none"/> </svg> </md-icon> </md-button> ``` * The contents can be customized by providing contents to the directive which will then be rendered inside each list item. When writing custom contents you have access to the following properties and functions: * * | Name | Type | Description | * | ---- | ---- | ----------- | * | item | <code>Object</code> | The item object to render | * | aclCtrl.itemText | <code>Function</code> | The function that wraps the expression provided for `itemText`. To call it you need to provide an object with a single property; `item`, which is the item to build the text for. Eg. `<p>{{ aclCtrl.itemText({item: item}) }}</p>` | * | aclCtrl.deselectItem | <code>Function</code> | When called, will remove an item from the model. The first argument is the item to remove. Eg. <md-button ng-click="aclCtrl.deselectItem(item)"></md-button> | * * ### Directive attributes * @param {Array.<Object>} ngModel - Required. Array of selected objects. These are tracked via reference. * @param {Array.<Object>} items - Entire list of items to select from. * @param {Expression} itemText - Expression to convert an item object into a single string to be displayed in the autocomplete and the list. The text generated here will also be searched when the user types in the autocomplete box. The item is accessed via the `item` property. */ function autocompleteList() { return { restrict: 'EA', templateUrl: templateUrlFunc, require: { ngModel: 'ngModel', autocompleteList: 'autocompleteList' }, controllerAs: 'aclCtrl', bindToController: true, scope: { // Full list of all items items: '=', // An expression that converts an item into a text string itemText: '&', // A string that is used as the placeholder in the autocomplete placeholder: '@' }, compile: compileFunc, controller: ctrlFunc }; } function templateUrlFunc(element, attrs) { // Clone the user's element, and save it // After stripping all empty text nodes from it. var clone = element.clone(); attrs.$mdUserTemplate = clone; return 'autocompleteList.html'; } function compileFunc(element, attrs) { // The place to insert the contents var listElement = element[0].querySelector('md-list-item'); // The user's original content filtered to only return elements var userListContent = attrs.$mdUserTemplate[0].querySelectorAll('*'); // Append the user's content to the template if (userListContent.length > 0) { for (var i = 0; i < userListContent.length; ++i) { listElement.appendChild(userListContent[i]); } } // If no list contents has been specified, fill it with the default else { angular.element(listElement).attr('ng-include', "'autocompleteListContents.html'"); } return linkFunc; } function linkFunc(scope, element, attrs, ctrls, transclude) { // Attach the model controller to this directive's controller ctrls.autocompleteList.modelCtrl = ctrls.ngModel; // Set the default value for placeholder ctrls.autocompleteList.placeholder = ctrls.autocompleteList.placeholder || "Search..."; } function ctrlFunc() { // jshint validthis: true //-- private variables var ctrl = this; //-- public variables ctrl.searchText = ""; ctrl.modelCtrl = null; //-- public methods ctrl.selectedItemChange = selectedItemChange; ctrl.matchingItems = matchingItems; ctrl.deselectItem = deselectItem; ctrl.selectedItems = selectedItems; ctrl.itemText = ctrl.itemText || function(item) { return item; }; function selectedItems() { return ctrl.modelCtrl.$modelValue; } // Called when an item is selected via the autocomplete function selectedItemChange(item) { // If the item has not been cleared if (item) { // Add the item to the model var value = ctrl.selectedItems().concat(item); ctrl.modelCtrl.$setViewValue(value); // Clear the selectedItem ctrl.searchText = ''; } } // Iterates through all the items and checks if their text representation // contains the search string. // Automatically filters out selected items function matchingItems(string) { // Lowercase String string = string.toLowerCase(); var items = []; ctrl.items.forEach(function(item) { // Skip selectedItems if (ctrl.selectedItems().indexOf(item) !== -1) { return; } // Check if the search string could be contained in the item text if (itemMatchesString(item, string)) { items.push(item); } }); return items; } function itemMatchesString(item, string) { if (ctrl.itemText({item: item}).toLowerCase().indexOf(string) !== -1) { return true; } } // Called to remove an item from selectedItems function deselectItem(item) { for (var i = 0; i < ctrl.selectedItems().length; ++i) { if (ctrl.selectedItems()[i] === item) { ctrl.selectedItems().splice(i, 1); return; } } } } })(); /* Attributes: * - ngModel: * ngModel can either be an array of objects or a single object. * If it is an array, each object should be in the form: * { * text: 'Text to display on the control', * value: 'The default value of the item' * } * If it is an object, each key value pair becomes an option in the * list such that the key represents the text value and the paired * value is the default value of the item. * Eg: * { * 'Text to display on the control': 'Default value of the item' * .... * } * - options: * If options is present, a select control is added to each item instead * of a checkbox. options should be a plain object where each key becomes * the text content of the <option> element and the value becomes the * value attribute. */ angular.module("autocompleteList").run(["$templateCache", function($templateCache) {$templateCache.put("autocompleteList.html","<md-autocomplete md-search-text=aclCtrl.searchText md-selected-item-change=aclCtrl.selectedItemChange(item) md-items=\"item in aclCtrl.matchingItems(aclCtrl.searchText)\"md-item-text=aclCtrl.itemText(item) placeholder=\"{{ aclCtrl.placeholder }}\"md-no-cache><md-item-template><span md-highlight-text=aclCtrl.searchText md-highlight-flags=gi>{{ aclCtrl.itemText({item: item}) }}</span></md-item-template><md-not-found>No members were found matching \"{{ aclCtrl.searchText }}\".</md-not-found></md-autocomplete><md-list><md-list-item ng-repeat=\"item in aclCtrl.selectedItems()\"></md-list-item></md-list>"); $templateCache.put("autocompleteListClear.svg","<svg fill=#000000 height=24 viewBox=\"0 0 24 24\"width=24 xmlns=http://www.w3.org/2000/svg><path d=\"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z\"/><path d=\"M0 0h24v24H0z\"fill=none /></svg>"); $templateCache.put("autocompleteListContents.html","<p>{{ aclCtrl.itemText({item: item}) }}</p><md-button type=button class=\"md-exclude multi-select-secondary-button\"ng-click=aclCtrl.deselectItem(item) aria-label=remove><md-icon ng-include=\"\'autocompleteListClear.svg\'\"></md-icon></md-button>");}]);
jamesfer/angular-material-autocomplete-list
dist/autocompleteList.js
JavaScript
mit
8,710