repo_name
stringlengths
4
116
path
stringlengths
3
942
size
stringlengths
1
7
content
stringlengths
3
1.05M
license
stringclasses
15 values
ir-g/ir-g.github.io
_posts/2018-02-06-east-coast-getting-the-dor.md
1715
--- title: East Coast getting the DOR? --- It looks like Virgin Trains East Coast(VTEC) will last only a few more months, due to the financial difficulties the franchise is encountering. Chris Grayling has said that nationalisation is one of the options on the table for the next two years. [The Guardian reports](https://www.theguardian.com/business/2018/feb/05/east-coast-could-return-to-public-sector-chris-grayling-admits) that the only option offered in place of nationalisation would be the provision of a “short-term, not for profit” contract to the current VTEC consortium, 90% owned by Stagecoach, 10% owned by Virgin Group. This comes after the group has reported over £200 million in losses, that Grayling attributes to the franchise receiving too high a bid. VTEC have argued that they expected Network Rail to have completed upgrades on the route that would have allowed for improved services. This does raise a long-term concern, though. After Directly Operated Rail Limited was created by the Department for Transport under Labour Transport Secretary (Now Lord) Andrew Adonis, it has been seen as a firm model for more state-run rail services in the UK, though the government may be loathe to return the franchise to the state when Jeremy Corbyn is supporting nationalisation. This does nonetheless lead to a wider conundrum regarding the issue. State rail and utility ownership are strongly supported by many traditional Labour and Conservative voters, not really seen as particularly divisive. The franchising model doesn’t currently win many over, with too many failures and few successes, it is going to struggle to find a politician able to enthusiastically back it as things stand.
artistic-2.0
GlowstoneMC/glowstonemc.github.io
content/jd/glowkit/1.17/org/bukkit/configuration/file/package-tree.html
6518
<!DOCTYPE HTML> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (16) --> <title>org.bukkit.configuration.file Class Hierarchy (Glowkit 1.17-R0.1-SNAPSHOT API)</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="description" content="tree: package: org.bukkit.configuration.file"> <meta name="generator" content="javadoc/PackageTreeWriter"> <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> <link rel="stylesheet" type="text/css" href="../../../../script-dir/jquery-ui.min.css" title="Style"> <link rel="stylesheet" type="text/css" href="../../../../jquery-ui.overrides.css" title="Style"> <script type="text/javascript" src="../../../../script.js"></script> <script type="text/javascript" src="../../../../script-dir/jquery-3.5.1.min.js"></script> <script type="text/javascript" src="../../../../script-dir/jquery-ui.min.js"></script> </head> <body class="package-tree-page"> <script type="text/javascript">var pathtoroot = "../../../../"; loadScripts(document, 'script');</script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <div class="flex-box"> <header role="banner" class="flex-header"> <nav role="navigation"> <!-- ========= START OF TOP NAVBAR ======= --> <div class="top-nav" id="navbar.top"> <div class="skip-nav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <ul id="navbar.top.firstrow" class="nav-list" title="Navigation"> <li><a href="../../../../index.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li>Class</li> <li class="nav-bar-cell1-rev">Tree</li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-all.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> </div> <div class="sub-nav"> <div class="nav-list-search"><label for="search">SEARCH:</label> <input type="text" id="search" value="search" disabled="disabled"> <input type="reset" id="reset" value="reset" disabled="disabled"> </div> </div> <!-- ========= END OF TOP NAVBAR ========= --> <span class="skip-nav" id="skip.navbar.top"> <!-- --> </span></nav> </header> <div class="flex-content"> <main role="main"> <div class="header"> <h1 class="title">Hierarchy For Package org.bukkit.configuration.file</h1> <span class="package-hierarchy-label">Package Hierarchies:</span> <ul class="horizontal"> <li><a href="../../../../overview-tree.html">All Packages</a></li> </ul> </div> <section class="hierarchy"> <h2 title="Class Hierarchy">Class Hierarchy</h2> <ul> <li class="circle">java.lang.<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link"><span class="type-name-link">Object</span></a> <ul> <li class="circle">org.yaml.snakeyaml.constructor.<a href="https://javadoc.io/doc/org.yaml/snakeyaml/1.27/org/yaml/snakeyaml/constructor/BaseConstructor.html" title="class or interface in org.yaml.snakeyaml.constructor" class="external-link"><span class="type-name-link">BaseConstructor</span></a> <ul> <li class="circle">org.yaml.snakeyaml.constructor.<a href="https://javadoc.io/doc/org.yaml/snakeyaml/1.27/org/yaml/snakeyaml/constructor/SafeConstructor.html" title="class or interface in org.yaml.snakeyaml.constructor" class="external-link"><span class="type-name-link">SafeConstructor</span></a> <ul> <li class="circle">org.bukkit.configuration.file.<a href="YamlConstructor.html" title="class in org.bukkit.configuration.file"><span class="type-name-link">YamlConstructor</span></a></li> </ul> </li> </ul> </li> <li class="circle">org.yaml.snakeyaml.representer.<a href="https://javadoc.io/doc/org.yaml/snakeyaml/1.27/org/yaml/snakeyaml/representer/BaseRepresenter.html" title="class or interface in org.yaml.snakeyaml.representer" class="external-link"><span class="type-name-link">BaseRepresenter</span></a> <ul> <li class="circle">org.yaml.snakeyaml.representer.<a href="https://javadoc.io/doc/org.yaml/snakeyaml/1.27/org/yaml/snakeyaml/representer/Representer.html" title="class or interface in org.yaml.snakeyaml.representer" class="external-link"><span class="type-name-link">Representer</span></a> <ul> <li class="circle">org.bukkit.configuration.file.<a href="YamlRepresenter.html" title="class in org.bukkit.configuration.file"><span class="type-name-link">YamlRepresenter</span></a></li> </ul> </li> </ul> </li> <li class="circle">org.bukkit.configuration.<a href="../ConfigurationOptions.html" title="class in org.bukkit.configuration"><span class="type-name-link">ConfigurationOptions</span></a> <ul> <li class="circle">org.bukkit.configuration.<a href="../MemoryConfigurationOptions.html" title="class in org.bukkit.configuration"><span class="type-name-link">MemoryConfigurationOptions</span></a> <ul> <li class="circle">org.bukkit.configuration.file.<a href="FileConfigurationOptions.html" title="class in org.bukkit.configuration.file"><span class="type-name-link">FileConfigurationOptions</span></a> <ul> <li class="circle">org.bukkit.configuration.file.<a href="YamlConfigurationOptions.html" title="class in org.bukkit.configuration.file"><span class="type-name-link">YamlConfigurationOptions</span></a></li> </ul> </li> </ul> </li> </ul> </li> <li class="circle">org.bukkit.configuration.<a href="../MemorySection.html" title="class in org.bukkit.configuration"><span class="type-name-link">MemorySection</span></a> (implements org.bukkit.configuration.<a href="../ConfigurationSection.html" title="interface in org.bukkit.configuration">ConfigurationSection</a>) <ul> <li class="circle">org.bukkit.configuration.<a href="../MemoryConfiguration.html" title="class in org.bukkit.configuration"><span class="type-name-link">MemoryConfiguration</span></a> (implements org.bukkit.configuration.<a href="../Configuration.html" title="interface in org.bukkit.configuration">Configuration</a>) <ul> <li class="circle">org.bukkit.configuration.file.<a href="FileConfiguration.html" title="class in org.bukkit.configuration.file"><span class="type-name-link">FileConfiguration</span></a> <ul> <li class="circle">org.bukkit.configuration.file.<a href="YamlConfiguration.html" title="class in org.bukkit.configuration.file"><span class="type-name-link">YamlConfiguration</span></a></li> </ul> </li> </ul> </li> </ul> </li> </ul> </li> </ul> </section> </main> </div> </div> </body> </html>
artistic-2.0
srcx/shttpd
thread_mgr.c
3871
/* shttpd (c)1999,2000 Stepan Roh * see license.txt for copying */ /* thread_mgr.c * obsluha vlaken */ #include "thread_mgr.h" #include "request.h" #define BUFFER_LEN 65535 #ifdef PTHREADS #include <stdlib.h> #include <pthread.h> #include <semaphore.h> #include "config.h" #include "logfile.h" typedef struct { pthread_t th; /* vlakno */ int free; /* volny zaznam ? */ int temp; /* docasne vlakno ? */ void *buffer; /* I/O buffer vlakna */ int buffer_len; /* delka bufferu */ } thread_item_t; static thread_item_t *threads = NULL; /* cekajici pozadavek */ static struct sockaddr_in req_client; static int req_sock; /* cekani na pozadavek */ static sem_t waiting_for_request; /* cekani na prevzeti pozadavku */ static sem_t waiting_for_handle; /* vlakno */ static void *do_thread (void *arg) { thread_item_t *t = (thread_item_t *)arg; struct sockaddr_in client; int sock; log_printf (ERROR_LOG, LOG_LEVEL_INFO, "Thread number %d has started\n", t - threads); do { sem_wait (&waiting_for_request); /* ceka na pozadavek */ client = req_client; sock = req_sock; log_printf (ERROR_LOG, LOG_LEVEL_INFO, "Thread number %d is handling request\n", t - threads); sem_post (&waiting_for_handle); handle_request (client, sock, t->buffer, t->buffer_len); log_printf (ERROR_LOG, LOG_LEVEL_INFO, "Thread number %d closed connection\n", t - threads); } while (!t->temp); if (t->buffer) free (t->buffer); log_printf (ERROR_LOG, LOG_LEVEL_INFO, "Thread number %d is terminating\n", t - threads); return NULL; } /* inicializuje vlakna */ int init_threads (void) { int i; if (pthread_mutex_init (&log_mutex, NULL)) return -1; if (sem_init (&waiting_for_request, 0, 0)) return -1; if (sem_init (&waiting_for_handle, 0, 0)) return -1; threads = malloc (sizeof (thread_item_t) * server_config.max_threads); for (i = 0; i < server_config.max_threads; i++) { threads[i].free = 1; } /* vytvoreni zakladni mnoziny vlaken */ for (i = 0; i < server_config.min_threads; i++) { if (pthread_create (&threads[i].th, NULL, do_thread, &threads[i])) return -1; threads[i].free = threads[i].temp = 0; threads[i].buffer_len = BUFFER_LEN; if (!(threads[i].buffer = malloc (threads[i].buffer_len))) return -1; } return 0; } /* obslouzi jeden pozadavek */ void handle_request_thread (struct sockaddr_in client, int sock) { int val, i; req_client = client; req_sock = sock; sem_post (&waiting_for_request); sem_getvalue (&waiting_for_request, &val); if (val > 0) { /* vsichni maji praci */ for (i = server_config.min_threads; i < server_config.max_threads; i++) { if (threads[i].free) { threads[i].buffer_len = BUFFER_LEN; if (!(threads[i].buffer = malloc (threads[i].buffer_len))) break; threads[i].temp = 1; if (pthread_create (&threads[i].th, NULL, do_thread, &threads[i])) break; threads[i].free = 0; break; } } } sem_wait (&waiting_for_handle); } /* ukonci vlakna */ void done_threads (void) { int i; pthread_mutex_destroy (&log_mutex); for (i = 0; i < server_config.max_threads; i++) { if (!threads[i].free) { pthread_cancel (threads[i].th); if (threads[i].buffer) free (threads[i].buffer); } } sem_destroy (&waiting_for_request); sem_destroy (&waiting_for_handle); free (threads); } #else #include <stdlib.h> static void *buffer = NULL; static int buffer_len = 0; /* inicializuje vlakna */ int init_threads (void) { buffer_len = BUFFER_LEN; if (!(buffer = malloc (buffer_len))) return -1; return 0; } /* obslouzi jeden pozadavek */ void handle_request_thread (struct sockaddr_in client, int sock) { handle_request (client, sock, buffer, buffer_len); } /* ukonci vlakna */ void done_threads (void) { if (buffer) free (buffer); } #endif
artistic-2.0
Us3rNam/F2F-Network
Register.py
398
#!/usr/bin/env python """ Created by _UserName_ 11/28/2013 """ import Connect, DB import uuid def Register(): # Generate A Unique Idenfifier ident = uuid.uuid4().hex # Allow For Database Manipulation database = DB.DB() # Create Database database.create() # Add Self To Database externalIP = "127.0.0.1" database.personalInfo(ident, externalIP)
artistic-2.0
speakeasy/SKYEngine
src/com/speakeasy/skyengine/resources/io/lzma/streams/cs/CoderOutputStream.java
2095
/* * Copyright (c) 2011 Tamas Cservenak. All rights reserved. * * <[email protected]> * http://www.cservenak.com/ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.speakeasy.skyengine.resources.io.lzma.streams.cs; import java.io.IOException; import java.io.OutputStream; public class CoderOutputStream extends OutputStream { private final CoderThread ct; private OutputStream out; protected CoderOutputStream(final OutputStream out, final Coder coder) throws IOException { this.ct = new CoderThread(coder, out); this.out = ct.getOutputStreamSink(); this.ct.start(); } public void write(int b) throws IOException { out.write(b); } public void write(byte b[]) throws IOException { write(b, 0, b.length); } public void write(byte b[], int off, int len) throws IOException { if ((off | len | (b.length - (len + off)) | (off + len)) < 0) { throw new IndexOutOfBoundsException(); } out.write(b, off, len); } public void flush() throws IOException { out.flush(); } public void close() throws IOException { try { flush(); } catch (IOException ignored) { // why do we swallow exception here?! } out.close(); try { ct.join(); } catch (InterruptedException e) { throw new IOException(e); } ct.checkForException(); } }
artistic-2.0
mkelley64/MCBS913-A3
README.md
110
MCBS913-A3 ========== Created for MCBS-913 (Bioinformatics) at the University of New Hampshire [Spring 2014]
artistic-2.0
PapenfussLab/Mungo
mungo/hmmer.py
15959
""" hmmer module """ from __future__ import print_function from mungo.mungoCore import * import blast, sequence from mungo.useful import smartopen, extractRootName, ClassFromDict, warnDeprecated import sys, re, warnings hmmer2frame = {0: 1, 1: 2, 2: 3, 3: -1, 4: -2, 5: -3} frame2hmmer = dict([(v,k) for k,v in hmmer2frame.iteritems()]) def HmmerFile(iFileHandle, **kw): "Factory function returning a HmmerFileReader" return HmmerReader(iFileHandle, **kw) class HmmerReader(AbstractDataReader): def __init__(self, iFileHandle, seqType=None, eValueCutoff=None, scoreCutoff=None): super(HmmerReader, self).__init__(iFileHandle) self.seqType = seqType self.eValueCutoff = eValueCutoff self.scoreCutoff = scoreCutoff def _generator(self): """Return an iterator to a HMMer file.""" if self.seqType in [Domain, SixFrameDomain, BlockSixFrameDomain, OrfDomain, OrfDomain2]: _Domain = self.seqType elif self.seqType=='SixFrame': _Domain = SixFrameDomain elif self.seqType=='BlockSixFrame': _Domain = BlockSixFrameDomain elif self.seqType=='ORFs': _Domain = OrfDomain else: _Domain = Domain startToken = '^Parsed for domains' endToken = '^Alignments of top-scoring domains' abortToken = '\[no hits above thresholds\]' startRegex = re.compile(startToken) if not jumpToMatch(self.iFile, startRegex): raise Exception('No match found. File may be empty.') # 3. Parse domain details line = self.iFile.next() line = self.iFile.next() endRegex = re.compile(endToken) abortRegex = re.compile(abortToken) domains = [] for line in self.iFile: line = line.strip() if endRegex.match(line) or abortRegex.match(line): break elif not line: continue tokens = line.split() d = _Domain(dict(zip(Domain.attributes[1:], tokens))) if (self.eValueCutoff and d.eValue>self.eValueCutoff) or \ (self.scoreCutoff and d.score<self.scoreCutoff): continue yield d class PfamReader(AbstractDataReader): def __init__(self, iFileHandle, eValueCutoff=None, scoreCutoff=None): super(PfamReader, self).__init__(iFileHandle) self.eValueCutoff = eValueCutoff self.scoreCutoff = scoreCutoff def _generator(self): pass class Domain(AbstractFeature): """Domain feature class""" attributes = ['domain', 'accession', 'count', 'sStart', 'sEnd', 'sCode', 'qStart', 'qEnd', 'qCode', 'score', 'eValue'] converters = zip( ['qStart','qEnd','sStart','sEnd','score','eValue'], [int,int,int,int,float,float]) format = attributesToFormat(attributes) def __init__(self, *args, **kw): """Constructor: @param args: HMMer field values @type args: list, dict, Domain Optional keywords: @keyword domain: Domain name @keyword accession: Subject name @keyword count: Id/total hits on subject @keyword sStart: @keyword sEnd: @keyword sCode: @keyword qStart: @keyword qEnd: @keyword qCode: @keyword score: Bit score @keyword eValue: """ super(Domain, self).__init__(*args, **kw) self.genomic = False def __repr__(self): d = {} for k,v in self.__dict__.iteritems(): d[k] = v return self.format % d def getTokens(self): return [self.__dict__[key] for key in self.attributes] def addAttribute(self, attribute, default=None): self.attributes.append(attribute) self.format = self.format + '\t%%(%s)s' % attribute self.__dict__[attribute] = default def addStrandAttribute(self, strand=None): self.addAttribute('strand', strand) def swapStartEnd(self): if self.sStart>self.sEnd: self.sStart,self.sEnd = self.sEnd,self.sStart def getSequence(self, blastdb, getAll=False, convertAccession=lambda x: x): if getAll: start = 0 end = 0 else: start = self.sStart end = self.sEnd accession = convertAccession(self.accession) h,s = blast.getSequence(blastdb, accession, start, end) return h,s @staticmethod def fromGenomic(tokens): strand = tokens[-1] d = Domain(tokens[0:-1]) d.genomic = True d.addStrandAttribute(strand) return d class OrfDomain(Domain): def toGenomic(self, orfStart, orfStrand, doSwapStartEnd=True): """Convert from ORF to genomic coordinates.""" self.genomic = True self.sStart,self.sEnd = convertOrfToGenomic( self.sStart, self.sEnd, orfStrand, orfStart) self.addStrandAttribute(orfStrand) if doSwapStartEnd: self.swapStartEnd() class OrfDomain2(Domain): "ORF domain class for use with my ORF files" def toGenomic(self, doSwapStartEnd=True): """Convert from ORF to genomic coordinates.""" self.genomic = True o = parseOrfHeader(self.accession) self.sStart,self.sEnd = convertOrfToGenomic( self.sStart, self.sEnd, o.strand, o.start) self.addStrandAttribute(o.strand) if doSwapStartEnd: self.swapStartEnd() class SixFrameDomain(Domain): def toGenomic(self, L, doSwapStartEnd=True): """Convert from 6 frame to genomic coordinates. @param L: Length of DNA sequence. """ self.genomic = True o = parseSixFrameHeader(self.accession) self.sStart,self.sEnd = convertSixFrameToGenomic( self.sStart, self.sEnd, o.frame, L) self.accession = o.name self.strand = o.strand self.addStrandAttribute(o.strand) if doSwapStartEnd: self.swapStartEnd() def toBlockCoords(self, L=1e99, blockSize=5000000, delimiter='.'): self.accession, self.sStart, self.sEnd = \ blast.genomeToBlock( self.accession, self.sStart, self.sEnd, L=L, blockSize=blockSize, delimiter=delimiter) def getSequenceFromString(self, seq): s = seq[self.sStart-1:self.sEnd] if self.strand=='-': s = sequence.reverseComplement(s) return s def getSequence(self, blastDb, padFivePrime=0, padThreePrime=0): if self.genomic: start = max(1,self.sStart-padFivePrime) end = self.sEnd+padThreePrime h,s = blast.getSequence(blastDb, self.accession, start, end, self.strand) else: raise Exception('You must call the toGenomic method first.') return h,s class BlockSixFrameDomain(Domain): def toGenomic(self, relative=False, doSwapStartEnd=True, relDelimiter=':'): """Convert from 6 frame to genomic coordinates.""" self.genomic = True chrom,blockStart,blockEnd,gStart,gEnd,strand = \ convertBlockSixFrameToGenomic( self.accession, self.sStart, self.sEnd) if relative: self.accession = '%s%s%i-%i' % (chrom,relDelimiter,blockStart,blockEnd) self.sStart = gStart self.sEnd = gEnd else: self.accession = chrom self.sStart = blockStart + gStart - 1 self.sEnd = blockStart + gEnd - 1 self.addStrandAttribute(strand) if doSwapStartEnd: self.swapStartEnd() class GenomicDomain(AbstractFeature): """GenomicDomain feature class""" attributes = ['domain', 'accession', 'count', 'sStart', 'sEnd', 'sCode', 'qStart', 'qEnd', 'qCode', 'score', 'eValue'] converters = zip( ['qStart','qEnd','sStart','sEnd','score','eValue'], [int,int,int,int,float,float]) format = attributesToFormat(attributes) def __init__(self, *args, **kw): """Constructor: @param args: HMMer field values @type args: list, dict, Domain Optional keywords: @keyword domain: Domain name @keyword accession: Subject name @keyword count: Id/total hits on subject @keyword sStart: @keyword sEnd: @keyword sCode: @keyword qStart: @keyword qEnd: @keyword qCode: @keyword score: Bit score @keyword eValue: @keyword strand: """ super(GenomicDomain, self).__init__(*args, **kw) def toDict(self): return self.__dict__ def toList(self): return self.__dict__.items() def __repr__(self): try: d = {} for k,v in self.__dict__.iteritems(): d[k] = v return self.format % d except: return str(self.__dict__) def toBlockCoords(self, L=1e99, blockSize=5000000, delimiter='.'): self.accession, self.sStart, self.sEnd = \ blast.genomeToBlock( self.accession, self.sStart, self.sEnd, L=L, blockSize=blockSize, delimiter=delimiter) def getSequence(self, blastDb, padFivePrime=0, padThreePrime=0): start = max(1,self.sStart-padFivePrime) end = self.sEnd+padThreePrime h,s = blast.getSequence(blastDb, self.accession, start, end, self.strand) return h,s def loadGenomicDomains(filename): data = [] gene = [] for line in open(filename): line = line.strip() if not line: continue elif line[0] in ['#', '>']: if gene: data.append(gene) gene = [] else: tokens = line.split('\t') d = GenomicDomain(tokens) gene.append(d) data.append(gene) return data def jumpToMatch(iFile, regex): """Jump to regex match in file. @param iFile: File object @param regex: Compiled regex object @return: True if successful, False otherwise """ for line in iFile: if regex.match(line): return True return False def extractUptoMatch(iFile, regex): """Extract up to regex match from file. @param iFile: File object @param regex: Compiled regex object @return: string """ block = [] for line in iFile: if regex.match(line): break else: block.append(line.rstrip()) return block def parseSixFrameHeader(header): """Parse a 6 frame header (from translate or python). @param header: Six frame header "<name>:<frame>" or "<name>.<start>-<end>:<frame>" (assumes input frame is hmmer frame (0-5)). @return: a simple class with attributes name, start, end, strand and frame. """ header = header.strip() regex = re.compile( '(?P<name>\w+)([\.|:](?P<start>\d+)[-|,](?P<end>\d+))?:(?P<frame>[0-5])') rs = regex.search(header) d = rs.groupdict() d['frame'] = hmmer2frame[int(d['frame'])] if d['frame']>0: d['strand'] = '+' else: d['strand'] = '-' try: d['start'] = int(d['start']) d['end'] = int(d['end']) except: pass return ClassFromDict(d) def parseOrfHeader(header): """Parse an ORF header (from extractORFs.py). @param header: ORF header "<name>.<orfId>.<start>-<end> Length=<length>" (Length optional). @return: a simple class with attributes name, start, end, strand and length. """ regex = re.compile( '(?P<name>\w+)\.(?P<orfId>\d+)\.(?P<start>\d+)-(?P<end>\d+)(\SLength=(?P<length>\d+))?') rs = regex.match(header.strip()) d = rs.groupdict() try: d['start'] = int(d['start']) d['end'] = int(d['end']) d['length'] = int(d['length']) except: pass if d['start']>d['end']: d['strand'] = '-' else: d['strand'] = '+' return ClassFromDict(d) def convertSixFrameToGenomic(start, end, frame, L): """Convert 6 frame coords to genomic. @param start: Amino acid start coord @param end: Amino acid end coord @param frame: Frame @param L: Nucleotide seq length @return: (gStart, gEnd, strand) """ if frame>=0: gStart = 3*(start-1)+(frame-1)+1 gEnd = 3*(end-1)+(frame-1)+3 else: gStart = L-(3*(start-1)+abs(frame)-1) gEnd = L-(3*(end-1)+abs(frame)+1) return gStart,gEnd def convertBlockSixFrameToGenomic(block, start, end): """Convenience function that takes block 6 frame coords (block,start,end), extracts the block start/end and frame and converts them to genomic coords ie. chrom.blockStart-blockEnd:frame aaStart aaEnd or chrom:blockStart-blockEnd:frame aaStart aaEnd --> chrom,blockStart,blockEnd,gStart,gEnd,strand @param block: Block accession ("<name>.<blockStart>-<blockEnd>:<frame>") @param start: Domain start @param end: Domain end @return: (chrom, blockStart, blockEnd, gStart, gEnd, strand) string[:.]number-number:number """ #prog = re.compile('\.|-|\:') #tokens = prog.split(block) #prog = re.compile("(?P<chrom>[\w]+)[.:](?P<bstart>[0-9]+)-(?P<bend>[0-9]+):(?P<frame>[0-9]+)") #rs = prog.search(block) #if rs: # g = rs.groupdict() # chrom,blockStart,blockEnd,hmmerFrame = g["chrom"],g["bstart"],g["bend"],g["frame"] # blockStart = int(blockStart) # blockEnd = int(blockEnd) # hmmerFrame = int(hmmerFrame) # L = blockEnd-blockStart+1 tokens = block.split(":") if len(tokens)==2: hmmerFrame = tokens[1] tokens = tokens[0].split(".") chrom = tokens[0] blockStart,blockEnd = tokens[1].split("-") elif len(tokens)==3: chrom = tokens[0] blockStart,blockEnd = tokens[1].split("-") hmmerFrame = tokens[2] else: print(tokens, file=sys.stderr) raise Exception("Don't know what to do") blockStart = int(blockStart) blockEnd = int(blockEnd) L = blockEnd-blockStart+1 hmmerFrame = int(hmmerFrame) frame = hmmer2frame[hmmerFrame] if frame>0: strand = '+' else: strand = '-' gStart,gEnd = convertSixFrameToGenomic(start, end, frame, L) return chrom,blockStart,blockEnd,gStart,gEnd,strand def convertGenomicToBlockCoords(domain, chrLen, blockSize=5000000, delimiter='.'): domain.accession, domain.sStart, domain.sEnd = \ blast.genomeToBlock( domain.accession, domain.sStart, domain.sEnd, L=chrLen, blockSize=blockSize, delimiter=delimiter) return domain def convertOrfToGenomic(start, end, strand, orfStart): """Convert domain coordinates in ORF to genomic. @param start: Domain start coord @param end: Domain end coord @param strand: Strand @param orfStart: ORF start coord @return: (gStart, gEnd) """ if strand=='+': gStart = orfStart + 3*(start-1) gEnd = orfStart + 3*(end-1) + 2 else: gStart = orfStart - 3*(start-1) gEnd = orfStart - 3*(end-1) - 2 return gStart, gEnd def loadDomains(iFileHandle): """Load hmmer domain results. @param iFileHandle: Input file or filename @param seqType: Type of sequence searched [None (default), 'SixFrame', 'BlockSixFrame' or 'ORFs'] @param eValueCutoff: E-value threshold (default None) @param scoreCutoff: Score threshold (default None) @return: list of domains """ domains = [] for d in HmmerFile(iFileHandle): domains.append(d) return domains
artistic-2.0
f3l/openid-server-app
perl-lib/org/lockaby/id/handler/endpoint.pm
4328
#!/usr/bin/perl package org::lockaby::id::handler::endpoint; use strict; use warnings; use utf8; use Apache2::Const qw(:common); use Apache2::RequestIO (); sub new { my $class = shift; my %args = ( config => undef, session => undef, engine => undef, @_, ); my $self = { config => $args{config}, session => $args{session}, engine => $args{engine}, }; bless ($self, $class); return $self; } sub get_endpoint { my $self = shift; my %args = ( username => undef, @_, ); eval { if ($self->{engine}->is_valid_username(username => $args{username})) { my $format = $self->{engine}->q()->param('format'); if (defined($format)) { return $self->_get_xrds(username => $args{username}) if ($format eq "xrds"); } else { return $self->_get_user(username => $args{username}); } } $self->{engine}->r()->status(Apache2::Const::NOT_FOUND); return Apache2::Const::NOT_FOUND; }; if ($@) { $self->{engine}->r()->content_type("text/plain"); $self->{engine}->r()->print($@); $self->{engine}->r()->status(Apache2::Const::SERVER_ERROR); return Apache2::Const::SERVER_ERROR; } } sub _get_xrds { my $self = shift; my %args = ( username => undef, @_, ); $self->{engine}->r()->content_type('application/xrds+xml; charset=utf-8'); $self->{engine}->r()->print("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); $self->{engine}->r()->print(qq| <xrds:XRDS xmlns:xrds="xri://\$xrds" xmlns="xri://\$xrd*(\$v*2.0)" xmlns:openid="http://openid.net/xmlns/1.0"> <XRD> <!-- OpenID 2.0 login service --> <Service priority="10"> <Type>http://specs.openid.net/auth/2.0/signon</Type> <URI>http://${\$self->{config}->{url}}/openid/service</URI> <LocalID>http://${\$self->{config}->{url}}/${\$args{username}}</LocalID> </Service> <!-- OpenID 1.1 login service --> <Service priority="20"> <Type>http://openid.net/signon/1.1</Type> <URI>http://${\$self->{config}->{url}}/openid/service</URI> <openid:Delegate>http://${\$self->{config}->{url}}/${\$args{username}}</openid:Delegate> </Service> <!-- OpenID 1.0 login service --> <Service priority="30"> <Type>http://openid.net/signon/1.0</Type> <URI>http://${\$self->{config}->{url}}/openid/service</URI> <openid:Delegate>http://${\$self->{config}->{url}}/${\$args{username}}</openid:Delegate> </Service> </XRD> </xrds:XRDS> |); return Apache2::Const::OK; } sub _get_user { my $self = shift; my %args = ( username => undef, @_, ); my $t = org::lockaby::id::template->new({ title => $self->{config}->{url} . " - " . $args{username}, meta => [ '<link rel="openid2.provider" href="http://' . $self->{config}->{url} . '/openid/service"/>', '<link rel="openid2.local_id" href="http://' . $self->{config}->{url} . '/' . $args{username} . '"/>', '<link rel="openid.server" href="http://' . $self->{config}->{url} . '/openid/service"/>', '<link rel="openid.delegate" href="http://' . $self->{config}->{url} . '/' . $args{username} . '"/>', '<meta http-equiv="X-XRDS-Location" content="http://' . $self->{config}->{url} . '/' . $args{username} . '?format=xrds">', ], }); $self->{engine}->r()->content_type('text/html; charset=utf-8'); $self->{engine}->r()->headers_out->set('X-XRDS-Location', 'http://' . $self->{config}->{url} . "/" . $args{username} . '?format=xrds'); $self->{engine}->r()->print($t->get_header()); $self->{engine}->r()->print(qq| <center>This is the OpenID endpoint for <b>${\$args{username}}</b> at <b>${\$self->{config}->{url}}</b>.</center> |); $self->{engine}->r()->print($t->get_footer()); return Apache2::Const::OK; } 1;
artistic-2.0
plainblack/Wing
author.t/tenant_files/dbicdh/MySQL/deploy/1/001-auto-__VERSION.sql
473
-- -- Created by SQL::Translator::Producer::MySQL -- Created on Thu Aug 1 14:58:11 2013 -- ; SET foreign_key_checks=0; -- -- Table: `dbix_class_deploymenthandler_versions` -- CREATE TABLE `dbix_class_deploymenthandler_versions` ( `id` integer NOT NULL auto_increment, `version` varchar(50) NOT NULL, `ddl` text NULL, `upgrade_sql` text NULL, PRIMARY KEY (`id`), UNIQUE `dbix_class_deploymenthandler_versions_version` (`version`) ); SET foreign_key_checks=1;
artistic-2.0
SWI-Prolog/packages-real
doc/r..eal.html
12721
<html> <head> <title>r..eal 0:0:3 </title> <link rel="stylesheet" type="text/css" href="../../pldoc/pldoc.css"> </head> <body> <h1 class="file"> r..eal 0:0:3, 2011/12/22 </h1> <p> A C-based Prolog interface to R. <h2 class="wiki">Introduction</h2> <p> This library enables the communication with an R process started as a shared library. It is the result of the efforts of two research groups that have worked in parallel. The syntactic emphasis on a minimalistic interface. A single predicate (<a href="/doc_for?object=real:%20%3C-%20/%202">&lt;-/2</a>,<a href="/doc_for?object=real:%20%3C-%20/%201">&lt;-/1</a>) channels the bulk of the interactions. In addition to using R as a shared library, r..eal uses the c-interfaces of Yap and R to pass objects in both directions. The usual mode of operation is to load Prolog values on to R variables and then call an R function on these values. The return value of the called function can be either placed on R variable or passed back to Prolog. It has been tested extensively on YAP 6.3.0 on Linux machines but it should also compile and work on MS operating systems and Macs. We hope it will soon be ported to the SWI engine. <p> The main modes for utilising the interface are <pre class="code"> &lt;- +Rexpr &lt;- +Rvar </pre> <p> Print Rvar or evaluate expression, Rexpr, in R <pre class="code"> +PLvar &lt;- +Rexpr +Rexpr1 &lt;- +Rexpr2 +Rvar &lt;- +PLval +PLvar &lt;- +Rvar </pre> <p> Evaluate Rexpr and pass result to PLvar. <p> Pass Rexpr1 &lt;- Rexpr2 to R. <p> Pass PLval to Rvar (using the c-interface when Rvar is numeric, list or list of 2 levels). See data transfer below. <p> Assign contents of Rvar to PLvar using the c-interface. <h2 class="wiki">Syntax</h2> <p> There are syntactic conventions in R that make unparsable prolog code. Notably function and variable names are allowed to contain dots, square brackets are used to access parts of vectors and arrays and functions are allowed empty argument tuples. We have introduced relevant syntax which allows for easy transition between prolog and R. Prolog constructs are converted by the library as follows: <ul> <li><code>..</code> within atoms -&gt; <code>.</code> (ex. <code> as..integer(c(1,2,3)) -&gt; as.integer(c(1,2,3))</code> )</li> <li><code>^[]</code> after atoms -&gt; <code>[]</code> (ex. <code>a^[2] -&gt; a[2] </code>)</li> <li><code>(.)</code> at the end of atoms that are known R functions -&gt; <code>()</code> (ex. <code>dev..off(.) -&gt; dev.off()</code> )</li> <li><code>[]</code> -&gt; c() (which equal to R's NULL value)</li> <li>( f(x) :- (..)) -&gt; f(x) (...)</li> <li>Lists of lists of numbers are converted to matrices. All first level lists must have the same length.</li> <li>Filenames must be given as Prolog strings.</li> <li>R specific operators (eg. %*% should be quoted in Prolog.</li> <li>expressions that pose difficulty in translation can alwasy be passed as Prolog atoms or strings eg. 'inp$id'</li> </ul> <h2 class="wiki">Data transfers</h2> <p> Following R convension we will talk about the type of and the class of data. i, defined by i &lt;- as.integer(c(1,2,3)), is of class integer vector and type integer. R vectors are mapped to prolog lists and matrices are mapped to nested lists. The convention works the other way around too. <p> There are two ways to pass prolog data to R. The more efficient one is by using <pre class="code"> Rvar &lt;- PLval </pre> <p> We will call this the low-level interface. It is implemented as C code and transfers via C data between R and Prolog. In what follows atomic PLval data are simply considered as singleton lists. Flat Plval lists are translated to R vectors and lists of one level of nesting to R matrices (which are 2 dimensional arrays in R parlance). The type of values of the vector or matrice is taken to be the type of the first data element of the Plval according to the following : <dl class="termlist"> <dt class="term">integer-&gt;integer<dd> <dt class="term">float-&gt;double<dd> <dt class="term">atom-&gt;char<dd> <dt class="term">boolean-&gt;logical<dd> </dl> <p> Booleans are represented in prolog as true/false atoms. Currently arrays of aribtrary dimensions are not supported in the low-level interface. Note that in R a scalar is just a one element vector. When passing Prolog objects to R, the user can specify the type of the R object by using the (:) operator (see <a href="/doc_for?object=real:real_type/1">real_type/1</a>). For example: <pre class="code"> r &lt;- float:[1,2,3]. &lt;- r. % don't be deceived : R &lt;- r. i &lt;- int:[1,2,3]. &lt;- i. I &lt;- i. </pre> <p> In addition Prolog data can be passed through the expression mechanism. That is, data appearing in an arbitrary R expression will be parsed and be part of the long string that will be passed from Prolog to R for evaluation. This is only advisable for short data structures. For instance, <pre class="code"> tut_4a :- state &lt;- c("tas", "sa", "qld", "nsw", "nsw"), &lt;- state. </pre> <p> Through this interface it is more convenient to represent R chars by Prolog list of codes, as in the above example. <h2 class="wiki">Examples</h2> <pre class="code"> ?- e &lt;- numeric. yes ?- e^[3] &lt;- 17. yes ?- Z &lt;- e. Z = ['$NaN','$NaN',17.0] ?- e^[10] &lt;- 12. yes ?- Z &lt;- e. Z = ['$NaN','$NaN',17.0,'$NaN','$NaN','$NaN','$NaN','$NaN','$NaN',12.0] int :- i &lt;- [1,2,3,4], I &lt;- i, write( i(I) ), nl. bool_back :- t &lt;- [1,2,3,4,5,1], s &lt;- t==1, S &lt;- s, write( s(S) ), nl. list :- a &lt;- [x=1,y=0,z=3], A &lt;- a, write( 'A'(A) ), nl. matrix :- a &lt;- [[1,2,3],[4,5,6]], A &lt;- a. expr1 :- a &lt;- [[1,2,3],[4,5,6]], B &lt;- a*3. expr2 :- a &lt;- [[1,2,3],[4,5,6]], b &lt;- 3, C &lt;- a*b. use_module( library(apply_macros), [maplist/3] ). between_1_and( N, Bs ) :- findall( B, between(1,N,B), Bs ). :- use_module( library(apply_macros), [maplist/3] ). plot_cpu :- points &lt;- [10,100,500,1000], points &lt;- 'as.integer'(points * 10), &lt;- points, Points &lt;- points, write( points(Points) ), nl, findall( T, (member(P,Points),between_1_and(P,Long), write( '.' ), flush_output, statistics( cputime, _) , long &lt;- Long, statistics( cputime, [_,SCpu] ), _Back &lt;- long, statistics( cputime, [_,TCpu] ), T = SCpu-TCpu ), Ts ), write( ts(Ts) ), nl, maplist( arg(1), Ts, Push ), write( push(Push) ), nl, maplist( arg(2), Ts, Pull ), write( pull(Pull) ), nl, push &lt;- Push, pull &lt;- Pull, &lt;- plot( points, push, ylab='"push + pull (red)"' ), r_char( red, Red ), &lt;- points( points, pull, col=Red ). rtest :- y &lt;- rnorm(50), &lt;- y, x &lt;- rnorm(y), &lt;- x11(width=5,height=3.5), &lt;- plot(x,y), write( 'Press Return to continue...' ), nl, read_line_to_codes( user_input, _ ), &lt;- dev..off(.), Y &lt;- y, write( y(Y) ), nl, findall( Zx, between(1,9,Zx), Z ), z &lt;- Z, &lt;- z, cars &lt;- [1, 3, 6, 4, 9], % cars &lt;- c(1, 3, 6, 4, 9), &lt;- pie(cars), write( 'Press Return to continue...' ), nl, read_line_to_codes( user_input, _ ), devoff. tut6 :- d &lt;- outer(0:9, 0:9), fr &lt;- table(outer(d, d, "-")), r(plot(as.numeric(names(fr)), fr, type="h", xlab="Determinant", ylab="Frequency")). tut4b :- astate &lt;- [tas,sa,qld,nsw,nsw,nt,wa], statef &lt;- factor(state), incmeans &lt;- tapply( c(60, 49, 40, 61, 64, 60, 59, 54), statef, mean ), &lt;- incmeans. logical :- t &lt;- [1,2,3,4,5,1], s &lt;- t==1, &lt;- s, S &lt;- s, write( s(S) ), nl. </pre> <p> Note, r..eal is sensitive to the amount of stack made available to Yap. With a generous stack, huge objects can be passed between the two systems. <pre class="code"> κρότος;yapr/sureal% yap -s80000 -f -g "ensure_loaded(library(real))" YAP 6.3.0 (x86_64-linux): Fri Nov 11 16:06:00 CET 2011 MYDDAS version MYDDAS-0.9.1 ?- findall( I, between(1,1000000,I), Is), i &lt;- Is, K &lt;- i, length( K, Len ), write( len(Len) ), nl, fail. len(1000000) </pre> <h2 class="wiki">Info</h2> <p> We are grateful to Jan Wielemaker for re-setting and improving the whole of the C code. Many thanks to the developers of YapR for inspiration and some functions. <dl class="tags"> <dt class="keyword-author">author<dd class="keyword-author">- Nicos Angelopoulos<dd class="keyword-author">- Vitor Costa Santos <dt class="keyword-version">version<dd class="keyword-version">- 0:0:2, 2011/12/07 <dt class="keyword-see">See also<dd class="keyword-see">- <code class="nofile">examples/real_ex.pl</code><dd class="keyword-see">- <a href="http://www.r-project.org/">http://www.r-project.org/</a> <dt class="keyword-license">license<dd class="keyword-license">- whatever </dl> <dl> <dt class="pubdef"><span style="float:right"></span><a name="init_r/0"><b class="pred">init_r</b></a><dd class="defbody">Start an R object. This is done automatically upon loading the library. We should add some checking that none exists here before starting a new one. This is currently not the case. <dt class="pubdef"><span style="float:right"></span><a name="end_r/0"><b class="pred">end_r</b></a><dd class="defbody">Stop the R object and close the communication channel. <dt class="pubdef"><span style="float:right"></span><a name="real/2"><b class="pred">real</b><var class="arglist">(Version, Date)</var></a><dd class="defbody"><var>Version</var> and release date. <dt class="pubdef"><span style="float:right"></span><a name="&lt;-/1"><b class="pred">&lt;-</b><var class="arglist">(+Rvar)</var></a> <dt class="pubdef"><b class="pred">&lt;-</b><var class="arglist">(+Rexpr)</var><dd class="defbody"> <blockquote> If <var>Rvar</var> is an atom and a known R object, then print <var>Rvar</var> on R. Else treat the input as an R expression and pass it on R for interpretation. (Throws result away, if expression is not a &lt;- expression itself). </blockquote> <dt class="pubdef"><span style="float:right"></span><a name="&lt;-/2"><b class="pred">&lt;-</b><var class="arglist">(+PLvar, +Rexpr)</var></a> <dt class="pubdef"><b class="pred">&lt;-</b><var class="arglist">(+Rexpr1, +Rexpr2)</var> <dt class="pubdef"><b class="pred">&lt;-</b><var class="arglist">(+Rvar, +PLval)</var> <dt class="pubdef"><b class="pred">&lt;-</b><var class="arglist">(+PLvar, +Rvar)</var><dd class="defbody">Evaluate <var>Rexpr</var> and store its return value to <var>PLvar</var>. <p> Pass <var>Rexpr1</var> &lt;- <var>Rexpr2</var> to R. <p> Pass Prolog value <var>PLval</var> to <var>Rvar</var>. If <var>PLval</var> is a single value, flat list or list of depth 2 use the low-level interface to pass the value to an R variable (see section on data transfer). <p> Place value of <var>Rvar</var> to <var>PLvar</var>. <p> Note that all <var>Rexpr</var>* are first processed as described in the section about syntax before passed to R. <dt class="pubdef"><span style="float:right"></span><a name="r/1"><b class="pred">r</b><var class="arglist">(R)</var></a><dd class="defbody">Nickname for &lt;-(<var>R</var>). <dt class="pubdef"><span style="float:right"></span><a name="r/2"><b class="pred">r</b><var class="arglist">(?L, +R)</var></a><dd class="defbody">Nickname for &lt;-(<var>L</var>,<var>R</var>). <dt class="pubdef"><span style="float:right"></span><a name="is_rvar/1"><b class="pred">is_rvar</b><var class="arglist">(+Rvar)</var></a><dd class="defbody">True if <var>Rvar</var> is an atom and a known variable in the R environment. <dt class="pubdef"><span style="float:right"></span><a name="real_type/1"><b class="pred">real_type</b><var class="arglist">(-Type)</var></a><dd class="defbody">Enumerate or test all Types known to r..eal. These can be used as i &lt;- <var>Type</var>:Values. Eg. <pre class="code"> i &lt;- int:[1,2.0,3]. </pre> <p> <dt class="pubdef"><span style="float:right"></span><a name="r_char/2"><b class="pred">r_char</b><var class="arglist">(+Atomic, +RcharAtom)</var></a><dd class="defbody">Wrap an atomic value with double quotes so it can pass as an R char type. <dt class="pubdef"><span style="float:right"></span><a name="devoff/0"><b class="pred">devoff</b></a><dd class="defbody">Close the current plot devise without any reporting. Short for &lt;- invisible('dev.off'()'). </dl> </body> </html>
artistic-2.0
chaomodus/ddatedtime
qulawk/c/qulawk.c
320
#include "qulawk-routine.h" #include <time.h> #include <stdio.h> #include <stdlib.h> int main(void) { struct tm now; time_t tnow; struct qulawk_t qnow; tnow = time(NULL); gmtime_r(&tnow, &now); xlate_qulawk(&qnow, &now, 0); printf("%i:%i'%i.%i\n", qnow.session, qnow.period, qnow.bit, qnow.moment); }
artistic-2.0
BusinessPi/businesspi.github.io
video-parousiasi-businesspi-greeklug.html
16233
<!DOCTYPE html> <html lang="en-US"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="author" content="Salih Emin" /> <meta name="copyright" content="Salih Emin" /> <meta name="description" content="To GreekLUG, στις 26 Σεπτεμβρίου διοργάνωσε εκδήλωση εορτασμού του Software Freedom Day όπου και παρουσιάστηκε το έργο BusinessPi " /> <meta property="og:type" content="article" /> <meta name="twitter:card" content="summary"> <meta name="keywords" content="presentation, greeklug, Videos, " /> <meta property="og:title" content="Βίντεο από την παρουσίαση του BusinessPi "/> <meta property="og:url" content="http://businesspi.github.io/video-parousiasi-businesspi-greeklug.html" /> <meta property="og:description" content="To GreekLUG, στις 26 Σεπτεμβρίου διοργάνωσε εκδήλωση εορτασμού του Software Freedom Day όπου και παρουσιάστηκε το έργο BusinessPi" /> <meta property="og:site_name" content="BusinessPi" /> <meta property="og:article:author" content="Salih Emin" /> <meta property="og:article:published_time" content="2015-09-28T09:30:00+03:00" /> <meta property="" content="2015-09-28T09:30:00+03:00" /> <meta name="twitter:title" content="Βίντεο από την παρουσίαση του BusinessPi "> <meta name="twitter:description" content="To GreekLUG, στις 26 Σεπτεμβρίου διοργάνωσε εκδήλωση εορτασμού του Software Freedom Day όπου και παρουσιάστηκε το έργο BusinessPi"> <title>Βίντεο από την παρουσίαση του BusinessPi · BusinessPi </title> <!-- <link rel="stylesheet" type="text/css" href="http://businesspi.github.io/theme/css/bootstrap-combined.min.css" media="screen">--> <!-- <link rel="stylesheet" type="text/css" href="http://businesspi.github.io/theme/css/font-awesome.css" media="screen"> --> <link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet"> <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.1/css/font-awesome.css" rel="stylesheet"> <link rel="stylesheet" type="text/css" href="http://businesspi.github.io/theme/css/pygments.css" media="screen"> <link rel="stylesheet" type="text/css" href="http://businesspi.github.io/theme/tipuesearch/tipuesearch.css" media="screen"> <link rel="stylesheet" type="text/css" href="http://businesspi.github.io/theme/css/elegant.css" media="screen"> <link rel="stylesheet" type="text/css" href="http://businesspi.github.io/theme/css/custom.css" media="screen"> <link href="http://businesspi.github.io/feeds/all.rss.xml" type="application/atom+xml" rel="alternate" title="BusinessPi - Full Atom Feed" /> <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','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-67310740-1', 'auto'); ga('send', 'pageview'); </script> </head> <body> <div id="content-sans-footer"> <div class="navbar navbar-static-top"> <div class="navbar-inner"> <div class="container-fluid"> <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </a> <a class="brand" href="http://businesspi.github.io/"><span class=site-name>BusinessPi</span></a> <div class="nav-collapse collapse"> <ul class="nav pull-right top-menu"> <li ><a href="http://businesspi.github.io">Home</a></li> <li ><a href="http://businesspi.github.io/pages/downloads.html">Downloads</a></li> <li ><a href="http://businesspi.github.io/pages/feedback.html">Feedback</a></li> <li ><a href="http://businesspi.github.io/categories.html">Categories</a></li> <li ><a href="http://businesspi.github.io/tags.html">Tags</a></li> <li ><a href="http://businesspi.github.io/archives.html">Archives</a></li> <li><form class="navbar-search" action="http://businesspi.github.io/search.html" onsubmit="return validateForm(this.elements['q'].value);"> <input type="text" class="search-query" placeholder="Search" name="q" id="tipue_search_input"></form></li> </ul> </div> </div> </div> </div> <div class="container-fluid"> <div class="row-fluid"> <div class="span1"></div> <div class="span10"> <article> <div class="row-fluid"> <header class="page-header span10 offset2"> <h1><a href="http://businesspi.github.io/video-parousiasi-businesspi-greeklug.html"> Βίντεο από την παρουσίαση του BusinessPi </a></h1> </header> </div> <div class="row-fluid"> <div class="span2 table-of-content"> <nav> <h4>Contents</h4> <div class="toc"> <ul> <li><a href="#businesspi">Παρουσίαση του έργου BusinessPi</a><ul> <li><a href="#_1">Βίντεο</a></li> <li><a href="#_2">Αρχείο παρουσίασης</a></li> </ul> </li> </ul> </div> </nav> </div> <div class="span8 article-content"> <h1 id="businesspi">Παρουσίαση του έργου BusinessPi</h1> <p>Παρακάτω παραθέτω το βίντεο από την ομιλία - παρουσίαση που έκανα για το έργο BusinessPi στην <a href="http://businesspi.github.io/businesspi-software-freedom-day-greeklug.html">εκδήλωση εορτασμού του Software Freedom Day</a> που διοργάνωσε ο GreekLUG Θεσσαλονίκης. Επίσης παραθέτω και το <strong>αρχείο παρουσίασης</strong> για όσους θέλουν να το δουν, μιας και στο βίντεο δεν φαίνεται καθαρά. </p> <p>Επί τη ευκαιρία θα ήθελα να ευχαριστήσω όλους όσους μπόρεσαν να παραβρεθούν, παρά την βροχή, στην παρουσίαση του έργου αλλά και όσους βοήθησαν στην αρχική μετάφραση του Vtiger (<a href="">διαβάστε τα ονόματα στο αρχείο του Vtiger</a>) αλλά και τον <a href="https://gr.linkedin.com/in/kopasas">Πασχαλίδη Κωσταντίνο</a> για την δημιουργία του logo του BusinessPi και τον <a href="https://gr.linkedin.com/in/hambos22">Πουλκίδη Χαράλαμπο</a> για τις παρατηρήσεις και τις διορθώσεις που πρότεινε για την <a href="http://businesspi.github.io">ιστοσελίδα του BusinessPi</a>.</p> <h2 id="_1">Βίντεο</h2> <iframe allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/12O5mbEDbHM" width="560"></iframe> <h2 id="_2">Αρχείο παρουσίασης</h2> <p>Το αρχείο παρουσίασης μπορείτε να το δείτε κάνοντας δεξί κλικ <a href="http://businesspi.github.io/pages/presentation.html#/intro">"άνοιγμα σε νέα καρτέλα" εδώ</a></p> <section> <p id="post-share-links"> Share on: <a href="http://twitter.com/home?status=%CE%92%CE%AF%CE%BD%CF%84%CE%B5%CE%BF%20%CE%B1%CF%80%CF%8C%20%CF%84%CE%B7%CE%BD%20%CF%80%CE%B1%CF%81%CE%BF%CF%85%CF%83%CE%AF%CE%B1%CF%83%CE%B7%20%CF%84%CE%BF%CF%85%20BusinessPi%20http%3A//businesspi.github.io/video-parousiasi-businesspi-greeklug.html" target="_blank" title="Share on Twitter">Twitter</a> ❄ <a href="http://www.facebook.com/sharer/sharer.php?s=100&amp;p%5Burl%5D=http%3A//businesspi.github.io/video-parousiasi-businesspi-greeklug.html" target="_blank" title="Share on Facebook">Facebook</a> ❄ <a href="https://plus.google.com/share?url=http%3A//businesspi.github.io/video-parousiasi-businesspi-greeklug.html" target="_blank" title="Share on Google Plus">Google+</a> ❄ <a href="mailto:?subject=%CE%92%CE%AF%CE%BD%CF%84%CE%B5%CE%BF%20%CE%B1%CF%80%CF%8C%20%CF%84%CE%B7%CE%BD%20%CF%80%CE%B1%CF%81%CE%BF%CF%85%CF%83%CE%AF%CE%B1%CF%83%CE%B7%20%CF%84%CE%BF%CF%85%20BusinessPi&amp;body=http%3A//businesspi.github.io/video-parousiasi-businesspi-greeklug.html" target="_blank" title="Share via Email">Email</a> </p> </section> <section> <p id="comment-message">Πείτε την γνώμη σας στα σχόλια </p> <div class="accordion" id="accordion2"> <div class="accordion-group"> <div class="accordion-heading"> <a class="accordion-toggle disqus-comment-count" data-toggle="collapse" data-parent="#accordion2" href="http://businesspi.github.io/video-parousiasi-businesspi-greeklug.html#disqus_thread"> Comments </a> </div> <div id="disqus_thread" class="accordion-body collapse"> <div class="accordion-inner"> <div class="comments"> <div id="disqus_thread"></div> <script type="text/javascript"> var disqus_shortname = 'businesspi'; var disqus_identifier = 'http://businesspi.github.io/video-parousiasi-businesspi-greeklug.html'; var disqus_url = 'http://businesspi.github.io/video-parousiasi-businesspi-greeklug.html'; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); </script> <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript> <a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a> </div> </div> </div> </div> </div> </section> <hr/> <section> <h2>Related Posts</h2> <ul class="related-posts-list"> <li><a href="http://businesspi.github.io/businesspi-software-freedom-day-greeklug.html" title="Παρουσίαση του έργου BusinessPi στην εκδήλωση SFD του GreekLUG">Παρουσίαση του έργου BusinessPi στην εκδήλωση SFD του GreekLUG</a></li> <li><a href="http://businesspi.github.io/seminario-businesspi-pamak.html" title="Παρουσίαση BusinessPi στο Παν. Μακεδονίας">Παρουσίαση BusinessPi στο Παν. Μακεδονίας</a></li> </ul> <hr /> </section> </div> <section> <div class="span2" style="float:right;font-size:0.9em;"> <h4>Published</h4> <time pubdate="pubdate" datetime="2015-09-28T09:30:00+03:00">Sep 28, 2015</time> <h4>Last Updated</h4> <time datetime="2015-09-28T09:30:00+03:00">Sep 28, 2015</time> <h4>Category</h4> <a class="category-link" href="http://businesspi.github.io/categories.html#videos-ref">Videos</a> <h4>Tags</h4> <ul class="list-of-tags tags-in-article"> <li><a href="http://businesspi.github.io/tags.html#greeklug-ref">greeklug <span>2</span> </a></li> <li><a href="http://businesspi.github.io/tags.html#presentation-ref">presentation <span>3</span> </a></li> </ul> <h4>Contact</h4> <a href="https://plus.google.com/+Salihemin" title="My Google-Plus Profile" class="sidebar-social-links" target="_blank"> <i class="fa fa-google-plus sidebar-social-links"></i></a> <a href="https://twitter.com/cerebrux" title="My Twitter Profile" class="sidebar-social-links" target="_blank"> <i class="fa fa-twitter sidebar-social-links"></i></a> <a href="https://github.com/cerebrux" title="My Github Profile" class="sidebar-social-links" target="_blank"> <i class="fa fa-github sidebar-social-links"></i></a> <a href="https://www.linkedin.com/in/salihemin" title="My linkedin Profile" class="sidebar-social-links" target="_blank"> <i class="fa fa-linkedin sidebar-social-links"></i></a> </div> </section> </div> </article> </div> <div class="span1"></div> </div> </div> <div id="push"></div> </div> <footer> <div id="footer"> <ul class="footer-content"> <li class="elegant-license"><a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img alt="Άδεια Creative Commons" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png" /></a><br /> Το έργο με τίτλο <span xmlns:dct="http://purl.org/dc/terms/" href="http://purl.org/dc/dcmitype/Text" property="dct:title" rel="dct:type">BusinessPi</span> από τον δημιουργό <a xmlns:cc="http://creativecommons.org/ns#" href="https://github.com/ellak-monades-aristeias/BusinessPi/wiki" property="cc:attributionName" rel="cc:attributionURL">Salih Emin</a> διατίθεται με την άδεια <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">Creative Commons Αναφορά Δημιουργού - Μη Εμπορική Χρήση - Παρόμοια Διανομή 4.0 Διεθνές </a>.</li> <li class="elegant-power">Powered by <a href="http://getpelican.com/" title="Pelican Home Page">Pelican</a>. Theme: <a href="http://oncrashreboot.com/pelican-elegant" title="Theme Elegant Home Page">Elegant</a> by <a href="http://oncrashreboot.com" title="Talha Mansoor Home Page">Talha Mansoor</a></li> </ul> </div> </footer> <script src="http://code.jquery.com/jquery.min.js"></script> <script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script> <script> function validateForm(query) { return (query.length > 0); } </script> <script type="text/javascript"> var disqus_shortname = 'businesspi'; (function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); </script> <script language="javascript" type="text/javascript"> function uncollapse() { if (window.location.hash.match(/^#comment-\d+$/)) { $('#disqus_thread').collapse('show'); } } </script> <script type="text/javascript" language="JavaScript"> uncollapse(); window.onhashchange=function(){ if (window.location.hash.match(/^#comment-\d+$/)) window.location.reload(true); } </script> <script> $('#disqus_thread').on('shown', function () { var link = document.getElementsByClassName('accordion-toggle'); var old_innerHTML = link[0].innerHTML; $(link[0]).fadeOut(500, function() { $(this).text('Click here to hide comments').fadeIn(500); }); $('#disqus_thread').on('hidden', function () { $(link[0]).fadeOut(500, function() { $(this).text(old_innerHTML).fadeIn(500); }); }) }) </script> </body> <!-- Theme: Elegant built for Pelican License : http://oncrashreboot.com/pelican-elegant --> </html>
artistic-2.0
reteo/CustomOreGen
src/api/java/ttftcuts/atg/api/ATGBiomes.java
9346
package ttftcuts.atg.api; import java.util.List; import ttftcuts.atg.api.events.*; import ttftcuts.atg.api.events.listenable.ATGBiomeGroupAssignmentEvent.ATGGroupActivationEvent; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; import net.minecraftforge.common.MinecraftForge; import com.google.common.base.Optional; /** * * @author TTFTCUTS * * Biome related API things! Biome groups, adding biomes to those groups and more. * */ public abstract class ATGBiomes { public static enum BiomeType { LAND, COAST, SEA } /** * Gets an ATG biome by name. * * @param biomeName * The name of the biome you want to get. * * @return the corresponding biome. */ public static BiomeGenBase getBiome(String biomeName) { final ATGBiomeRequestEvent event = new ATGBiomeRequestEvent(biomeName); MinecraftForge.EVENT_BUS.post(event); if ( !event.biome.isPresent() ) { return null; } return event.biome.get(); } /** * Gets a list of names corresponding to the Biome Groups which contain a specified biome. * * @param biome * The biome you want to find groups for. * * @return a list of names of containing Biome Groups. */ public static List<String> getGroupFromBiome(BiomeGenBase biome) { final ATGBiomeGroupRequestEvent event = new ATGBiomeGroupRequestEvent(biome); MinecraftForge.EVENT_BUS.post(event); return event.groups; } /** * Gets the raw height, temperature and moisture values from the generator for a specific pair of x/z coordinates. * * WARNING: This is a VERY expensive calculation and the result is NOT cached, so please use as little as possible! * * @param world * The world that you want to get the information for. * * @param x * X coordinate of the point to query. * * @param z * Z coordinate of the point to query. * * @return an array of three doubles corresponding to the height, temperature and moisture at the specified point in the ranges 0.0-1.0. */ public static double[] getGeneratorInfo(World world, double x, double z) { final ATGGeneratorInfoEvent event = new ATGGeneratorInfoEvent(world,x,z); MinecraftForge.EVENT_BUS.post(event); return event.info; } /** * Adds a new biome GROUP to ATG. Not something that would usually need to be used. * * @param type * The biome type that this group belongs to. LAND, COAST or SEA. * * @param name * The name of this group. * * @param temp * Temperature value for this group. Same range as biome temperatures. * * @param moisture * Moisture value for this group. Same range as biome rainfall. * * @param height * Average height value for this group. Same range as biome heights. * * @param minHeight * Minimum height to generate this group. Above this value, it will be skipped. * * @param maxHeight * Maximum height to generate this group. Below this value, it will be skipped. * * @param salt * Biome blob generation salt. Used to offset biome boundaries from other groups to avoid strange artifacts. * * @param generate * Set to false to prevent this group generating in the default manner. Primarily for use with the biome group assignment events. */ public static void addBiomeGroup(BiomeType type, String name, double temp, double moisture, double height, double minHeight, double maxHeight, long salt, boolean generate) { ATGBiomeGroupAddEvent event = new ATGBiomeGroupAddEvent(type, name, temp, moisture, height, minHeight, maxHeight, salt, generate); MinecraftForge.EVENT_BUS.post(event); if ( event.response == ATGBiomeGroupAddEvent.ResponseType.FAILED ) { // FAILED! } } public static void addBiomeGroup(BiomeType type, String name, double temp, double moisture, double height, double minHeight, double maxHeight, long salt) { addBiomeGroup(type, name, temp, moisture, height, minHeight, maxHeight, salt, true); } public static void addBiomeGroup(BiomeType type, String name, double temp, double moisture, double height, long salt) { addBiomeGroup(type, name, temp, moisture, height, 0.0, 1.0, salt); } public static void addBiomeGroup(BiomeType type, String name, double temp, double moisture, double height) { addBiomeGroup(type, name, temp, moisture, height, 0); } /** * Modifies a biome group to make it more or less likely to be chosen by the generator. * Best used to ensure a height-constrained biome group generates in favour of an otherwise identically ranged group. * * @param type * Group type for the second parameter. LAND, COAST or SEA. * * @param name * Name of the group to modify. * * @param modifier * Modifier value. Positive makes the group more likely to be picked. Very small values can have a large effect. */ public static void modGroupSuitability(BiomeType type, String name, double modifier) { ATGBiomeGroupEvent event = new ATGBiomeGroupEvent( ATGBiomeGroupEvent.EventType.SUITABILITY, type, name, modifier ); MinecraftForge.EVENT_BUS.post(event); if ( event.response == ATGBiomeGroupEvent.ResponseType.FAILED ) { // FAILED! } } /** * Register a biome with ATG. * * @param type * Type of the biome group this biome will inhabit. LAND, COAST or SEA. * * @param group * Name of the biome group this biome will inhabit. * * @param biome * The biome to be registered. * * @param weight * Generation weight for this biome. All vanilla biomes are weighted 1.0 except mushroom island. */ public static void addBiome(BiomeType type, String group, BiomeGenBase biome, double weight) { ATGBiomeEvent event = new ATGBiomeEvent( type, group, biome, null, weight); MinecraftForge.EVENT_BUS.post(event); } /** * Replace a biome in a group with a different biome. * * @param type * Type of the target biome group. LAND, COAST or SEA. * * @param group * Name of the target biome group. * * @param toReplace * Biome to replace in the specified group. * * @param replacement * Biome which will replace toReplace in the group. * * @param weight * Generation weight for the replacement biome. */ public static void replaceBiome(BiomeType type, String group, BiomeGenBase toReplace, BiomeGenBase replacement, double weight) { ATGBiomeEvent event = new ATGBiomeEvent( type, group, replacement, toReplace, weight ); MinecraftForge.EVENT_BUS.post(event); } /** * Add a sub-biome to a biome. Sub-biomes appear as smaller patches within their parent biome. * * @param biome * Parent biome. * * @param subBiome * Biome that will appear as a sub-biome. * * @param weight * Generation weight for the sub-biome. The parent biome is always weighted at 1.0, so a 1.0 weight here with a single sub-biome would be a 50/50 split. */ public static void addSubBiome(BiomeGenBase biome, BiomeGenBase subBiome, double weight) { ATGBiomeModEvent event = new ATGBiomeModEvent(ATGBiomeModEvent.EventType.SUBBIOME, biome, null, subBiome, weight); MinecraftForge.EVENT_BUS.post(event); } /** * Add an IGenMod to a biome to modify how it generates. * * @param biome * Biome to attach the mod to. * * @param mod * IGenMod object that will modify the biome. */ public static void addGenMod(BiomeGenBase biome, IGenMod mod) { ATGBiomeModEvent event = new ATGBiomeModEvent(ATGBiomeModEvent.EventType.GENMOD, biome, mod, null, 0); MinecraftForge.EVENT_BUS.post(event); } /** * Get the IGenMod assigned to a biome, or Optional.absent if there isn't one. * * @param biome * The biome to get the IGenMod for. * * @return an Optional corresponding to the IGenMod for the biome, or Optional.absent. */ public static Optional<IGenMod> getGenMod(BiomeGenBase biome) { ATGBiomeModRequestEvent event = new ATGBiomeModRequestEvent(biome); MinecraftForge.EVENT_BUS.post(event); return event.mod; } /** * Sets the rock parameters for a biome, to modify how ATG boulders generate there. * * @param biome * The biome to set rock properties for. * * @param rockChance * 1 in rockChance chunks will contain a rock. * * @param bigRockChance * 1 in bigRockChance rocks will be large. * * @param rocksPerChunk * rockChance will be checked rocksPerChunk times per chunk. */ public static void setBiomeRocks(BiomeGenBase biome, int rockChance, int bigRockChance, int rocksPerChunk) { ATGBiomeRocksEvent event = new ATGBiomeRocksEvent(biome, rockChance, bigRockChance, rocksPerChunk); MinecraftForge.EVENT_BUS.post(event); } /** * Use this to enable the posting of "ATGBiomeGroupAssignmentEvent"s at generation, to allow custom biome group overrides. * If this is not called at least once, none of those events will be sent. * * Listening for ATGBiomeGroupAssignmentEvent allows direct replacement of the biome group at every x/z coordinate pair. * When enabled, it slows generation by about 10% due to event volume, so it's off by default. * * Only call this if you intend to listen for those events. */ public static void enableBiomeGroupAssignmentEvent() { ATGGroupActivationEvent event = new ATGGroupActivationEvent(); MinecraftForge.EVENT_BUS.post(event); } }
artistic-2.0
sonoprob/0x56
bot/py/ircoscbot.py
3668
#! /usr/bin/env python """ stats -- Prints some channel information. disconnect -- Disconnect the bot. The bot will try to reconnect after 60 seconds. die -- Let the bot cease to exist. """ import liblo import irc.bot import irc.strings from irc.client import ip_numstr_to_quad, ip_quad_to_numstr class TestBot(irc.bot.SingleServerIRCBot): def __init__(self, channel, nickname, server, port=6667, OSCport=57120): irc.bot.SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname) self.server = server self.channel = channel self.nickname = nickname try: self.target = liblo.Address(OSCport) except liblo.AddressError, err: print str(err) sys.exit("OSC address error") def on_nicknameinuse(self, c, e): c.nick(c.get_nickname() + "_") def on_welcome(self, c, e): c.join(self.channel) print "connected to:\t" + self.server def on_privmsg(self, c, e): self.do_command(e, e.arguments[0]) def on_pubmsg(self, c, e): a = e.arguments[0].split(":", 1) if len(a) > 1 and irc.strings.lower(a[0]) == irc.strings.lower(self.connection.get_nickname()): self.do_command(e, a[1].strip()) return def do_command(self, e, cmd): nick = e.source.nick c = self.connection target = self.target c.notice(nick, "--- Channel statistics ---") msg = liblo.Message(self.nickname) # nickname is osc tag... #msg.add(nick) #~ if nick == "iow": #~ for i in cmd: #~ #msg.add(ord(i)) #ord: char's ascii number #~ msg.add(i) #~ liblo.send(target, msg) #~ for i in cmd: #~ msg.add(ord(i)) #~ liblo.send(target, msg) #~ print msg for i in cmd: msg.add(ord(i)) liblo.send(target, msg) if cmd == "disconnect": self.disconnect() elif cmd == "die": self.die() elif cmd == "stats": print 'stats?' for chname, chobj in self.channels.items(): c.notice(nick, "--- Channel statistics ---") c.notice(nick, "Channel: " + chname) users = chobj.users() users.sort() c.notice(nick, "Users: " + ", ".join(users)) opers = chobj.opers() opers.sort() c.notice(nick, "Opers: " + ", ".join(opers)) voiced = chobj.voiced() voiced.sort() c.notice(nick, "Voiced: " + ", ".join(voiced)) else: c.notice(nick, "Not understood: " + cmd) def main(): import sys nickname = "p1n1" #channel = "#mode+v" server = "127.0.0.1" IRCport = 6667 OSCport = 57120 print len(sys.argv) if len(sys.argv) != 5: print("Usage: Dtestbot <server[:port]> <channel> <nickname> <oscport>") print("$ ./ircbot.py 127.0.0.1 \"mode+v\" jk 57124") sys.exit(1) s = sys.argv[1].split(":", 1) server = s[0] if len(s) == 2: try: port = int(s[1]) except ValueError: print("Error: Erroneous port.") sys.exit(1) else: port = 6667 channel = sys.argv[2] nickname = sys.argv[3] OSCport = sys.argv[4] #print nickname #bot = TestBot(channel, nickname, server, port) bot = TestBot("#mode+v", nickname, "127.0.0.1", 6667, OSCport) #bot = TestBot(channel, nickname, server, IRCport, OSCport) bot.start() print 'started...' if __name__ == "__main__": main()
artistic-2.0
ChIna-king-Arthur/MFC
cow2/TeeChartAPI/printer.cpp
5140
// Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++ // NOTE: Do not modify the contents of this file. If this class is regenerated by // Microsoft Visual C++, your modifications will be overwritten. #include "stdafx.h" #include "printer.h" ///////////////////////////////////////////////////////////////////////////// // CPrinter properties ///////////////////////////////////////////////////////////////////////////// // CPrinter operations long CPrinter::GetDetail() { long result; InvokeHelper(0x18, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); return result; } void CPrinter::SetDetail(long nNewValue) { static BYTE parms[] = VTS_I4; InvokeHelper(0x18, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, nNewValue); } long CPrinter::GetMarginBottom() { long result; InvokeHelper(0x2, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); return result; } void CPrinter::SetMarginBottom(long nNewValue) { static BYTE parms[] = VTS_I4; InvokeHelper(0x2, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, nNewValue); } long CPrinter::GetMarginLeft() { long result; InvokeHelper(0x3, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); return result; } void CPrinter::SetMarginLeft(long nNewValue) { static BYTE parms[] = VTS_I4; InvokeHelper(0x3, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, nNewValue); } long CPrinter::GetMarginTop() { long result; InvokeHelper(0x4, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); return result; } void CPrinter::SetMarginTop(long nNewValue) { static BYTE parms[] = VTS_I4; InvokeHelper(0x4, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, nNewValue); } long CPrinter::GetMarginRight() { long result; InvokeHelper(0x5, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); return result; } void CPrinter::SetMarginRight(long nNewValue) { static BYTE parms[] = VTS_I4; InvokeHelper(0x5, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, nNewValue); } long CPrinter::GetOrientation() { long result; InvokeHelper(0x1, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); return result; } void CPrinter::SetOrientation(long nNewValue) { static BYTE parms[] = VTS_I4; InvokeHelper(0x1, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, nNewValue); } void CPrinter::Print() { InvokeHelper(0x40, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); } void CPrinter::PrintLandscape() { InvokeHelper(0x41, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); } void CPrinter::PrintPortrait() { InvokeHelper(0x43, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); } void CPrinter::ShowPreview() { InvokeHelper(0x1c, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); } void CPrinter::PrintPartial(long Left, long Top, long Right, long Bottom) { static BYTE parms[] = VTS_I4 VTS_I4 VTS_I4 VTS_I4; InvokeHelper(0x6, DISPATCH_METHOD, VT_EMPTY, NULL, parms, Left, Top, Right, Bottom); } void CPrinter::BeginDoc() { InvokeHelper(0x7, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); } void CPrinter::EndDoc() { InvokeHelper(0x8, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); } long CPrinter::GetPrinterIndex() { long result; InvokeHelper(0x9, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); return result; } void CPrinter::SetPrinterIndex(long nNewValue) { static BYTE parms[] = VTS_I4; InvokeHelper(0x9, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, nNewValue); } long CPrinter::GetPrinterCount() { long result; InvokeHelper(0xa, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); return result; } CString CPrinter::GetPrinterDescription(long Index) { CString result; static BYTE parms[] = VTS_I4; InvokeHelper(0xb, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, parms, Index); return result; } void CPrinter::PrintChart() { InvokeHelper(0xc, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); } long CPrinter::GetPageHeight() { long result; InvokeHelper(0xd, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); return result; } long CPrinter::GetPageWidth() { long result; InvokeHelper(0xe, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); return result; } CString CPrinter::GetJobTitle() { CString result; InvokeHelper(0xf, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); return result; } void CPrinter::SetJobTitle(LPCTSTR lpszNewValue) { static BYTE parms[] = VTS_BSTR; InvokeHelper(0xf, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, lpszNewValue); } BOOL CPrinter::GetPrintProportional() { BOOL result; InvokeHelper(0x11, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); return result; } void CPrinter::SetPrintProportional(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; InvokeHelper(0x11, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, bNewValue); } void CPrinter::PrintPartialHandle(const VARIANT& DC, long Left, long Top, long Right, long Bottom) { static BYTE parms[] = VTS_VARIANT VTS_I4 VTS_I4 VTS_I4 VTS_I4; InvokeHelper(0x12, DISPATCH_METHOD, VT_EMPTY, NULL, parms, &DC, Left, Top, Right, Bottom); } void CPrinter::PrintPages(long FromPage, long ToPage) { static BYTE parms[] = VTS_I4 VTS_I4; InvokeHelper(0x10, DISPATCH_METHOD, VT_EMPTY, NULL, parms, FromPage, ToPage); }
artistic-2.0
reepblue/SourceSDKContent
SDK2013/Template/client/template/c_baseglowanimating.h
1320
//=========== Copyright © 2014, rHetorical, All rights reserved. ============= // // Purpose: // //============================================================================= #ifndef C_BASEGLOWANIMATING_H #define C_BASEGLOWANIMATING_H #ifdef _WIN32 #pragma once #endif #include "cbase.h" #include "c_baseanimating.h" #include "glow_outline_effect.h" //----------------------------------------------------------------------------- // Purpose: Base //----------------------------------------------------------------------------- class C_BaseGlowAnimating : public C_BaseAnimating { DECLARE_CLASS( C_BaseGlowAnimating, C_BaseAnimating ); public: DECLARE_CLIENTCLASS(); DECLARE_PREDICTABLE(); C_BaseGlowAnimating( void ); ~C_BaseGlowAnimating(); virtual void OnPreDataChanged( DataUpdateType_t updateType ); virtual void OnDataChanged( DataUpdateType_t updateType ); CGlowObject *GetGlowObject( void ){ return m_pGlowEffect; } virtual void GetGlowEffectColor( float *r, float *g, float *b ); protected: virtual void UpdateGlowEffect( void ); virtual void DestroyGlowEffect( void ); private: bool m_bGlowEnabled; bool m_bOldGlowEnabled; CGlowObject *m_pGlowEffect; float m_flRedGlowColor; float m_flGreenGlowColor; float m_flBlueGlowColor; }; #endif //C_BASEGLOWANIMATING_H
artistic-2.0
ugexe/rakudo
src/core/Str.pm
79321
my class Cursor {... } my class Range {... } my class Match {... } my class X::Str::Numeric { ... } my class X::Str::Match::x { ... } my class X::Str::Trans::IllegalKey { ... } my class X::Str::Trans::InvalidArg { ... } my class X::Numeric::Confused { ... } my constant $?TABSTOP = 8; my class Str does Stringy { # declared in BOOTSTRAP # class Str is Cool { # has str $!value is box_target; multi method WHY('Life, the Universe, and Everything':) { 42 } multi method WHICH(Str:D:) { nqp::box_s( nqp::concat( nqp::concat(nqp::unbox_s(self.^name), '|'), $!value ), ObjAt ); } submethod BUILD(Str() :$value = '') { nqp::bindattr_s(self, Str, '$!value', nqp::unbox_s($value)) } multi method Bool(Str:D:) { nqp::p6bool(nqp::chars($!value)); } multi method Str(Str:D:) { self } multi method Stringy(Str:D:) { self } multi method DUMP(Str:D:) { self.perl } method Int(Str:D:) { self.Numeric.Int; } method Num(Str:D:) { self.Numeric.Num; } multi method ACCEPTS(Str:D: Str:D \other) { nqp::p6bool(nqp::iseq_s(nqp::unbox_s(other),$!value)); } multi method ACCEPTS(Str:D: Any:U \other) { False; } multi method ACCEPTS(Str:D: Any:D \other) { nqp::p6bool(nqp::iseq_s(nqp::unbox_s(other.Str),$!value)); } method chomp(Str:D:) { my str $str = nqp::unbox_s(self); my int $chars = nqp::chars($str); $chars && nqp::iscclass(nqp::const::CCLASS_NEWLINE,$str,$chars-1) ?? nqp::p6box_s(nqp::substr($str,0,$chars-1)) !! self } method chop(Str:D: Int() $chopping = 1) { my str $str = nqp::unbox_s(self); my int $chars = nqp::chars($str) - $chopping; $chars > 0 ?? nqp::p6box_s(nqp::substr($str,0,$chars)) !! ''; } # chars used to handle ranges for pred/succ my str $RANGECHAR = "01234567890" # arabic digits ~ "ABCDEFGHIJKLMNOPQRSTUVWXYZA" # latin uppercase ~ "abcdefghijklmnopqrstuvwxyza" # latin lowercase ~ "\x[391,392,393,394,395,396,397,398,399,39A,39B,39C,39D,39E,39F,3A0,3A1,3A3,3A4,3A5,3A6,3A7,3A8,3A9,391]" # greek uppercase ~ "\x[3B1,3B2,3B3,3B4,3B5,3B6,3B7,3B8,3B9,3BA,3BB,3BC,3BD,3BE,3BF,3C0,3C1,3C3,3C4,3C5,3C6,3C7,3C8,3C9,3B1]" # greek lowercase ~ "\x[5D0,5D1,5D2,5D3,5D4,5D5,5D6,5D7,5D8,5D9,5DA,5DB,5DC,5DD,5DE,5DF,5E0,5E1,5E2,5E3,5E4,5E5,5E6,5E7,5E8,5E9,5EA,5D0]" # hebrew ~ "\x[410,411,412,413,414,415,416,417,418,419,41A,41B,41C,41D,41E,41F,420,421,422,423,424,425,426,427,428,429,42A,42B,42C,42D,42E,42F,410]" # cyrillic uppercase ~ "\x[430,431,432,433,434,435,436,437,438,439,43A,43B,43C,43D,43E,43F,440,441,442,443,444,445,446,447,448,449,44A,44B,44C,44D,44E,44F,430]" # cyrillic lowercase ~ "\x[660,661,662,663,664,665,666,667,668,669,660]" # arabic-indic digits ~ "\x[966,967,968,969,96A,96B,96C,96D,96E,96F,966]" # devanagari digits ~ "\x[9E6,9E7,9E8,9E9,9EA,9EB,9EC,9ED,9EE,9EF,9E6]" # bengali digits ~ "\x[A66,A67,A68,A69,A6A,A6B,A6C,A6D,A6E,A6F,A66]" # gurmukhi digits ~ "\x[AE6,AE7,AE8,AE9,AEA,AEB,AEC,AED,AEE,AEF,AE6]" # gujarati digits ~ "\x[B66,B67,B68,B69,B6A,B6B,B6C,B6D,B6E,B6F,B66]" # oriya digits ~ "\x[FF10,FF11,FF12,FF13,FF14,FF15,FF16,FF17,FF18,FF19,FF10]" # fullwidth digits ~ "\x[2070,2071,00B2,00B3,2074,2075,2076,2077,2078,2079]" # superscripts ~ "\x[2080,2081,2082,2083,2084,2085,2086,2087,2088,2089]" # subscripts ~ "\x[2160,2161,2162,2163,2164,2165,2166,2167,2168,2169,216a,216b,2160]" # clock roman uc ~ "\x[2170,2171,2172,2173,2174,2175,2176,2177,2178,2179,217a,217b,2170]" # clock roman lc ~ "\x[2460,2461,2462,2463,2464,2465,2466,2467,2468,2469,246A,246B,246C,246D,246E,246F,2470,2471,2472,2473,2460]" # circled digits 1..20 ~ "\x[2474,2475,2476,2477,2478,2479,247A,247B,247C,247D,247E,247F,2480,2481,2482,2483,2484,2485,2486,2487,2474]" # parenthesized digits 1..20 ~ "\x[249C,249D,249E,249F,24A0,24A1,24A2,24A3,24A4,24A5,24A6,24A7,24A8,24A9,24AA,24AB,24AC,24AD,24AE,24AF,24B0,24B1,24B2,24B3,24B4,24B5,249C]" # parenthesized latin lc ~ "\x[2581,2582,2583,2584,2585,2586,2587,2588]" # lower blocks ~ "\x[2680,2681,2682,2683,2684,2685,2680]" # die faces ~ "\x[2776,2777,2778,2779,277A,277B,277C,277D,277E,277F,2776]" # dingbat negative circled 1..10 ~ "\x[1F37A,1F37B]" # beer mugs ~ "\x[1F42A,1F42B]"; # camels # digit to extend the string with if carried past first rangechar position my $carrydigit := nqp::hash( '0', '1', # arabic "\x0660", "\x0661", # arabic-indic "\x0966", "\x0967", # devanagari "\x09E6", "\x09E7", # bengali "\x0A66", "\x0A67", # gurmukhi "\x0AE6", "\x0AE7", # gujarati "\x0B66", "\x0B67", # oriya "\xFF10", "\xFF11", # fullwidth XXX: should be treated as digit? "\x2070", "\x2071", # superscripts XXX: should be treated as digit? "\x2080", "\x2081", # subscripts XXX: should be treated as digit? "\x1F37A","\x1F37B",# beer mugs "\x1F42A","\x1F42B",# camels ); # calculate the beginning and ending positions of <!after '.'><rangechar+> my sub RANGEPOS(str $str) { my int $pos = nqp::chars($str); while $pos > 0 { $pos = $pos - 1; my str $ch = nqp::substr($str, $pos, 1); if nqp::isge_i(nqp::index($RANGECHAR, $ch, 0), 0) { my int $end = $pos; while $pos > 0 { $pos = $pos - 1; $ch = nqp::substr($str, $pos, 1); last if nqp::iseq_s($ch, '.'); return ($pos+1, $end) unless nqp::isge_i(nqp::index($RANGECHAR, $ch, 0), 0); } return ($pos, $end) unless nqp::iseq_s($ch, '.'); } } (0, -1); } method pred(Str:D:) { my str $str = self; my Int ($Ir0, $Ir1) = RANGEPOS($str); my int $r0 = $Ir0; my int $r1 = $Ir1; while $r1 >= $r0 { my str $ch0 = nqp::substr($str, $r1, 1); my int $ipos = nqp::index($RANGECHAR, $ch0); $ipos = $RANGECHAR.index($ch0, $ipos+1) // $ipos; my str $ch1 = nqp::substr($RANGECHAR, $ipos-1, 1); $str = nqp::replace($str, $r1, 1, $ch1); # return if no carry return $str if $ch0 gt $ch1; # carry to previous position $r1 = $r1 - 1; } # cannot carry beyond first rangechar position fail('Decrement out of range'); } method succ(Str:D:) { my str $str = self; my Int ($Ir0, $Ir1) = RANGEPOS($str); my int $r0 = $Ir0; my int $r1 = $Ir1; while $r1 >= $r0 { my str $ch0 = nqp::substr($str, $r1, 1); my int $ipos = nqp::index($RANGECHAR, $ch0); my str $ch1 = nqp::substr($RANGECHAR, $ipos+1, 1); $str = nqp::replace($str, $r1, 1, $ch1); return $str if $ch1 gt $ch0; # carry to previous position $r1 = $r1 - 1; # extend string if carried past first rangechar position $str = nqp::replace($str, $r0, 0, nqp::existskey($carrydigit, $ch1) ?? nqp::atkey($carrydigit, $ch1) !! $ch1) if $r1 < $r0; } $str; } multi method Numeric(Str:D: :$strict = True) { # Handle special empty string return 0 if self.trim eq ""; val(self, :val-or-fail); } multi method gist(Str:D:) { self } multi method perl(Str:D:) { '"' ~ Rakudo::Internals.PERLIFY-STR(self) ~ '"' } role ProcessStr does Iterator { has str $!str; has int $!chars; submethod BUILD(\string) { $!str = nqp::unbox_s(string); $!chars = nqp::chars($!str); self } method new(\string) { nqp::create(self).BUILD(string) } } multi method comb(Str:D:) { Seq.new(class :: does ProcessStr { has int $!pos; method pull-one() { $!pos < $!chars ?? nqp::p6box_s(nqp::substr($!str, $!pos++, 1)) !! IterationEnd } method count-only() { nqp::p6box_i($!pos = $!chars) } }.new(self)); } multi method comb(Str:D: Int:D $size, $limit = *) { my int $inf = nqp::istype($limit,Whatever) || $limit == Inf; return self.comb if $size <= 1 && $inf; Seq.new(class :: does Iterator { has str $!str; has int $!chars; has int $!size; has int $!pos; has int $!max; has int $!todo; submethod BUILD(\string,\size,\limit,\inf) { $!str = nqp::unbox_s(string); $!chars = nqp::chars($!str); $!size = 1 max size; $!pos = -size; $!max = 1 + floor( ( $!chars - 1 ) / $!size ); $!todo = (inf ?? $!max !! (0 max limit)) + 1; self } method new(\s,\z,\l,\i) { nqp::create(self).BUILD(s,z,l,i) } method pull-one() { ($!todo = $!todo - 1) && ($!pos = $!pos + $!size) < $!chars ?? nqp::p6box_s(nqp::substr($!str, $!pos, $!size)) !! IterationEnd } method push-all($target) { my int $todo = $!todo; my int $pos = $!pos; my int $size = $!size; my int $chars = $!chars; $target.push(nqp::p6box_s(nqp::substr($!str, $pos, $size))) while ($todo = $todo - 1 ) && ($pos = $pos + $size) < $chars; $!pos = $!chars; IterationEnd } method count-only() { $!pos = $!chars; $!max } }.new(self,$size,$limit,$inf)) } multi method comb(Str:D: Str $pat) { Seq.new(class :: does Iterator { has str $!str; has str $!pat; has int $!pos; submethod BUILD(\string, \pat) { $!str = nqp::unbox_s(string); $!pat = nqp::unbox_s(pat); self } method new(\string, \pat) { nqp::create(self).BUILD(string, pat) } method pull-one() { my int $found = nqp::index($!str, $!pat, $!pos); if $found < 0 { IterationEnd } else { $!pos = $found + 1; nqp::p6box_s($!pat) } } method count-only() { my int $seen; my int $found; until ($found = nqp::index($!str, $!pat, $!pos)) < 0 { $seen = $seen + 1; $!pos = $found + 1; } nqp::p6box_i($seen) } }.new(self, $pat)); } multi method comb(Str:D: Str $pat, $limit) { return self.comb($pat) if nqp::istype($limit,Whatever) || $limit == Inf; Seq.new(class :: does Iterator { has str $!str; has str $!pat; has int $!pos; has int $!todo; submethod BUILD(\string, \pat, \limit) { $!str = nqp::unbox_s(string); $!pat = nqp::unbox_s(pat); $!todo = nqp::unbox_i(limit.Int); self } method new(\string, \pat, \limit) { nqp::create(self).BUILD(string, pat, limit) } method pull-one() { my int $found = nqp::index($!str, $!pat, $!pos); if $found < 0 || $!todo == 0 { IterationEnd } else { $!pos = $found + 1; $!todo = $!todo - 1; nqp::p6box_s($!pat) } } method count-only() { my int $seen; my int $found; until ($found = nqp::index($!str, $!pat, $!pos)) < 0 || $!todo == 0 { $seen = $seen + 1; $!pos = $found + 1; $!todo = $!todo - 1; } nqp::p6box_i($seen) } }.new(self, $pat, $limit)); } multi method comb(Str:D: Regex $pat, $limit = Inf, :$match) { my $x; $x = (1..$limit) unless nqp::istype($limit, Whatever) || $limit == Inf; $match ?? self.match(:g, :$x, $pat) !! self.match(:g, :$x, $pat).map: { .Str } } # A temporary routine for differential testing of .match overhead. # This can only be used for a single non-multi match. method simplematch($pat) { my $caller_dollar_slash := nqp::getlexcaller('$/'); my %opts; %opts<c> = 0; my $patrx := nqp::istype($pat,Code) ?? $pat !! / "$pat": /; my $cur := $patrx(Cursor.'!cursor_init'(self, |%opts)); my \result = $cur.pos >= 0 ?? $cur.MATCH_SAVE !! Nil; $caller_dollar_slash = result; result; } method match($pat, :continue(:$c), :pos(:$p), :global(:$g), :overlap(:$ov), :exhaustive(:$ex), # :st(:nd(:rd(:th($nth)))) is cute, but slow :st(:$nd), :rd(:$th), :$nth = $nd // $th, :$x) { my $caller_dollar_slash := nqp::getlexcaller('$/'); my %opts; if $p.defined { %opts<p> = $p } else { %opts<c> = $c // 0; } my $patrx := nqp::istype($pat,Code) ?? $pat !! / "$pat": /; my $cur := $patrx(Cursor.'!cursor_init'(self, |%opts)); %opts<ov> = $ov if $ov; %opts<ex> = $ex if $ex; my $matches := gather { while $cur.pos >= 0 { take $cur.MATCH_SAVE; $cur := $cur.'!cursor_more'(|%opts); } } my $multi = $g || $ov || $ex; my @matches; if $nth.defined or $x.defined { my $clip; my $idxs; # Translate :nth lists to monotonic 0-based indices my sub nthidx($n is copy) { if nqp::istype($n, Callable) or nqp::istype($n, Whatever) { # WhateverCode forces us to remember early once @matches := $matches.list; once $matches := Nil; # WhateverCode is 1-based $n = nqp::istype($n, Whatever) ?? +@matches !! $n(+@matches); } state $max = -Inf; if ($n > $max or once $n == -Inf) { $max = $n; # After first positive, <= 0 are "ignored" per spec once die "Attempt to retrieve before :1st match -- :nth($n)" if $max < 1; $n - 1; } else { Slip.new(); } } if $nth.defined and not $x.defined { $multi = Positional.ACCEPTS($nth); $idxs := $nth.map(&nthidx).Array; $clip := $idxs.elems..Inf; } if $x.defined { $multi = True; if nqp::istype($x, Int) { $clip := $x..$x; } elsif nqp::istype($x, Range) { my $mx = $x.max.floor; $mx = $mx - 1 unless $mx ~~ $x; my $mn = $x.min.ceiling; $mn = $mn + 1 unless $mn ~~ $x; $clip := $mn..$mx; } elsif nqp::istype($x, Whatever) { $clip := 0..Inf; } else { X::Str::Match::x.new(:got($x)).fail; } $clip := 0..($clip.max) if $clip.min < 0; return Slip.new() if $clip.max < 1 or $clip.max < $clip.min; if $nth.defined { $idxs := $nth.map(&nthidx).Array; return Slip.new() if $clip.min and not $idxs.EXISTS-POS($clip.min - 1); } else { $idxs := (0..Inf).Array; } } unless $matches.defined { # Whatever, we have an extra layer of memoization. $matches := @matches.values; @matches := (); } # Just "list $matches.grep", once we have True.last @matches := (gather do for $matches -> $m { state $i = 0; state $took = 0; state $n = $idxs.EXISTS-POS(0) ?? $idxs.shift !! Nil; last unless $n.defined; if $i == $n { $n = $idxs.EXISTS-POS(0) ?? $idxs.shift !! Nil; take $m; $took++; last if $took >= $clip.max; }; $i++; last unless $n.defined; }).cache; @matches := () unless not $clip.min or @matches.EXISTS-POS($clip.min - 1); } else { @matches := $matches.list; } if $multi { try $caller_dollar_slash = @matches; @matches } else { try $caller_dollar_slash = (@matches[0] // $cur.MATCH_SAVE); (@matches[0] // $cur.MATCH_SAVE) } } multi method subst-mutate( Str:D $self is rw: $matcher, $replacement, :ii(:$samecase), :ss(:$samespace), :mm(:$samemark), *%options ) { my $global = %options<g> || %options<global>; my $caller_dollar_slash := nqp::getlexcaller('$/'); my $SET_DOLLAR_SLASH = nqp::istype($matcher, Regex); my $word_by_word = so $samespace || %options<s> || %options<sigspace>; try $caller_dollar_slash = $/ if $SET_DOLLAR_SLASH; my @matches = self.match($matcher, |%options); if !@matches || (@matches == 1 && !@matches[0]) { Nil; } else { $self = $self!APPLY-MATCHES( @matches, $replacement, $caller_dollar_slash, $SET_DOLLAR_SLASH, $word_by_word, $samespace, $samecase, $samemark, ); if $global { my \result := nqp::create(List); nqp::bindattr(result, List, '$!reified', nqp::getattr(@matches, List, '$!reified')); result } else { @matches[0] } } } multi method subst(Str:D: $matcher, $replacement, :$global, :$g, :ii(:$samecase), :ss(:$samespace), :mm(:$samemark), *%options) { # take the fast lane if we can return Rakudo::Internals.TRANSPOSE(self,$matcher,$replacement) if nqp::istype($matcher,Str) && nqp::istype($replacement,Str) && ($g || $global) && !$samecase && !$samespace && !$samemark && !%options; my $caller_dollar_slash := nqp::getlexcaller('$/'); my $SET_DOLLAR_SLASH = nqp::istype($matcher, Regex); my $word_by_word = so $samespace || %options<s> || %options<sigspace>; # nothing to do try $caller_dollar_slash = $/ if $SET_DOLLAR_SLASH; my @matches = self.match($matcher, :g($g || $global), |%options); !@matches || (@matches == 1 && !@matches[0]) ?? self !! self!APPLY-MATCHES( @matches, $replacement, $caller_dollar_slash, $SET_DOLLAR_SLASH, $word_by_word, $samespace, $samecase, $samemark, ); } method !APPLY-MATCHES(\matches,$replacement,\cds,\SDS,\word_by_word,\space,\case,\mark) { my \callable := nqp::istype($replacement,Callable); my int $prev; my str $str = nqp::unbox_s(self); my Mu $result := nqp::list_s(); try cds = $/ if SDS; # need to do something special if SDS || space || case || mark || callable { my \noargs := callable ?? $replacement.count == 0 !! False; my \fancy := space || case || mark || word_by_word; my \case-and-mark := case && mark; for flat matches -> $m { try cds = $m if SDS; nqp::push_s( $result,nqp::substr($str,$prev,nqp::unbox_i($m.from) - $prev) ); if fancy { my $mstr := $m.Str; my $it := ~(callable ?? (noargs ?? $replacement() !! $replacement($m)) !! $replacement ); if word_by_word { # all spacers delegated to word-by-word my &filter := case-and-mark ?? -> $w,$p { $w.samemark($p).samecase($p) } !! case ?? -> $w,$p { $w.samecase($p) } !! -> $w,$p { $w.samemark($p) } nqp::push_s($result,nqp::unbox_s( $it.word-by-word($mstr,&filter,:samespace(?space)) ) ); } elsif case-and-mark { nqp::push_s($result,nqp::unbox_s( $it.samecase($mstr).samemark($mstr) ) ); } elsif case { nqp::push_s($result,nqp::unbox_s($it.samecase(~$m))); } else { # mark nqp::push_s($result,nqp::unbox_s($it.samemark(~$m))); } } else { nqp::push_s($result,nqp::unbox_s( ~(callable ?? (noargs ?? $replacement() !! $replacement($m)) !! $replacement ) ) ); } $prev = nqp::unbox_i($m.to); } nqp::push_s($result,nqp::substr($str,$prev)); nqp::p6box_s(nqp::join('',$result)); } # simple string replacement else { for flat matches -> $m { nqp::push_s( $result,nqp::substr($str,$prev,nqp::unbox_i($m.from) - $prev) ); $prev = nqp::unbox_i($m.to); } nqp::push_s($result,nqp::substr($str,$prev)); nqp::p6box_s(nqp::join(nqp::unbox_s(~$replacement),$result)); } } #?if moar method ords(Str:D:) { self.NFC.list } #?endif #?if !moar method ords(Str:D:) { Seq.new(class :: does ProcessStr { has int $!pos; method pull-one() { $!pos < $!chars ?? nqp::p6box_i(nqp::ordat($!str, $!pos++)) !! IterationEnd } }.new(self)); } #?endif multi method lines(Str:D: :$count!) { # we should probably deprecate this feature $count ?? self.lines.elems !! self.lines; } multi method lines(Str:D: $limit) { # we should probably deprecate this feature nqp::istype($limit,Whatever) || $limit == Inf ?? self.lines !! self.lines[ 0 .. $limit.Int - 1 ] } multi method lines(Str:D:) { Seq.new(class :: does ProcessStr { has int $!pos; method pull-one() { my int $left; return IterationEnd if ($left = $!chars - $!pos) <= 0; my int $nextpos = nqp::findcclass( nqp::const::CCLASS_NEWLINE, $!str, $!pos, $left); my str $found = nqp::substr($!str, $!pos, $nextpos - $!pos); $!pos = $nextpos + 1; $found; } method push-all($target) { my int $left; my int $nextpos; while ($left = $!chars - $!pos) > 0 { $nextpos = nqp::findcclass( nqp::const::CCLASS_NEWLINE, $!str, $!pos, $left); $target.push(nqp::substr($!str, $!pos, $nextpos - $!pos)); $!pos = $nextpos + 1; } IterationEnd } method count-only() { my int $found; my int $left; my int $nextpos; while ($left = $!chars - $!pos) > 0 { $nextpos = nqp::findcclass( nqp::const::CCLASS_NEWLINE, $!str, $!pos, $left); $found = $found + 1; $!pos = $nextpos + 1; } nqp::p6box_i($found) } }.new(self)); } method !split-sanity(\v,\k,\kv,\p) { # cannot combine these my int $any = ?v + ?k + ?kv + ?p; X::Adverb.new( what => 'split', source => 'Str', nogo => (:v(v),:k(k),:kv(kv),:p(p)).grep(*.value).map(*.key), ).throw if $any > 1; $any } multi method split(Str:D: Regex:D $pat, $parts = *;; :$v is copy, :$k, :$kv, :$p, :$skip-empty) { my int $any = self!split-sanity($v,$k,$kv,$p); my $limit = nqp::istype($parts,Whatever) ?? Inf !! $parts; return ().list if $limit <= 0; my \matches = $limit == Inf ?? self.match($pat, :g) !! self.match($pat, :x(1..$limit-1), :g); my str $str = nqp::unbox_s(self); my int $elems = +matches; # make sure all reified my $matches := nqp::getattr(matches,List,'$!reified'); my $result := nqp::list; my int $i; my int $pos; my int $found; if $any || $skip-empty { my int $notskip = !$skip-empty; my int $next; while nqp::islt_i($i,$elems) { my $match := nqp::decont(nqp::atpos($matches,$i)); $found = nqp::getattr_i($match,Match,'$!from'); $next = nqp::getattr_i($match,Match,'$!to'); if $notskip { nqp::push($result, nqp::substr($str,$pos,nqp::sub_i($found,$pos))); } elsif nqp::sub_i($found,$pos) -> $chars { nqp::push($result, nqp::substr($str,$pos,$chars)); } if $any { if $v { nqp::push($result,$match); } elsif $k { nqp::push($result,0); } elsif $kv { nqp::push($result,0); nqp::push($result,$match); } else { # $p nqp::push($result, Pair.new(0,$match)); } } $pos = $next; $i = nqp::add_i($i,1); } nqp::push($result,nqp::substr($str,$pos)) if $notskip || nqp::islt_i($pos,nqp::chars($str)); } else { my $match; nqp::setelems($result,$elems + 1); while nqp::islt_i($i,$elems) { $match := nqp::decont(nqp::atpos($matches,$i)); $found = nqp::getattr_i($match,Match,'$!from'); nqp::bindpos($result,$i, nqp::substr($str,$pos,nqp::sub_i($found,$pos))); $pos = nqp::getattr_i($match,Match,'$!to'); $i = nqp::add_i($i,1); } nqp::bindpos($result,$i,nqp::substr($str,$pos)); } $result } multi method split(Str:D: Str(Cool) $match;; :$v is copy, :$k, :$kv, :$p, :$skip-empty) { my int $any = self!split-sanity($v,$k,$kv,$p); # nothing to work with my str $needle = nqp::unbox_s($match); my int $chars = nqp::chars($needle); if !self.chars { return $chars ?? self.list !! (); } # split really, really fast in NQP, also supports "" my $matches := nqp::split($needle,nqp::unbox_s(self)); # interleave the necessary strings if needed if $chars { if $any { my $match-list := $v ?? nqp::list($needle) !! $k ?? nqp::list(0) !! $kv ?? nqp::list(0,$needle) !! nqp::list(Pair.new(0,$needle)); # $p if $match-list { my int $i = nqp::elems($matches); if $skip-empty { nqp::splice($matches,$match-list,$i, nqp::not_i(nqp::isne_i( nqp::chars(nqp::atpos($matches,$i)),0))) while $i = nqp::sub_i($i,1); nqp::splice($matches,nqp::list,0,1) unless nqp::chars(nqp::atpos($matches,0)); } else { nqp::splice($matches,$match-list,$i,0) while $i = nqp::sub_i($i,1); } } } elsif $skip-empty { my int $i = nqp::elems($matches); my $match-list := nqp::list; while nqp::isge_i($i = nqp::sub_i($i,1),0) { nqp::splice($matches,$match-list,$i,1) if nqp::iseq_i(nqp::chars(nqp::atpos($matches,$i)),0); } } } # single chars need empty before/after, unless inhibited elsif !$skip-empty { nqp::unshift($matches,""); nqp::push($matches,""); } # since most of data structures are built already, there is little # point in making this a lazy iterator here $matches } multi method split(Str:D: Str(Cool) $match, $parts;; :$v is copy, :$k, :$kv, :$p, :$skip-empty) { my int $any = self!split-sanity($v,$k,$kv,$p); # don't do it here my $limit = nqp::istype($parts,Whatever) ?? Inf !! $parts; return ().list if $limit <= 0; # nothing to work with my int $chars = $match.chars; if !self.chars { return $chars ?? self.list !! (); } # nothing to do elsif $limit < 2 { return $limit <= 0 ?? () !! self.list; } # want them all elsif $limit == Inf { return self.split($match,:$v,:$k,:$kv,:$p,:$skip-empty); } # we have something to split on elsif $chars { # let the multi-needle handler handle all nameds return self.split(($match,),$parts,:$v,:$k,:$kv,:$p,:$skip-empty) if $any || $skip-empty; # make the sequence Seq.new(class :: does Iterator { has str $!string; has str $!chars; has str $!match; has int $!match-chars; has int $!todo; has int $!pos; method BUILD(\string, \match, \todo) { $!string = nqp::unbox_s(string); $!chars = nqp::chars($!string); $!match = nqp::unbox_s(match); $!match-chars = nqp::chars($!match); $!todo = todo - 1; self } method new(\string,\match,\todo) { nqp::create(self).BUILD(string,match,todo) } method !last-part() is raw { my str $string = nqp::substr($!string,$!pos); $!pos = $!chars + 1; $!todo = 0; nqp::p6box_s($string) } method !next-part(int $found) is raw { my str $string = nqp::substr($!string,$!pos, $found - $!pos); $!pos = $found + $!match-chars; nqp::p6box_s($string); } method pull-one() is raw { if $!todo { $!todo = $!todo - 1; my int $found = nqp::index($!string,$!match,$!pos); nqp::islt_i($found,0) ?? nqp::isle_i($!pos,$!chars) ?? self!last-part !! IterationEnd !! self!next-part($found); } else { nqp::isle_i($!pos,$!chars) ?? self!last-part !! IterationEnd } } method push-all($target) { while $!todo { $!todo = $!todo - 1; my int $found = nqp::index($!string,$!match,$!pos); nqp::islt_i($found,0) ?? ($!todo = 0) !! $target.push(self!next-part($found)); } $target.push(self!last-part) if nqp::isle_i($!pos,$!chars); IterationEnd } method sink-all() { IterationEnd } }.new(self,$match,$limit)); } # just separate chars else { Seq.new(class :: does Iterator { has str $!string; has int $!todo; has int $!chars; has int $!pos; has int $!first; has int $!last; method BUILD(\string, \todo, \skip-empty) { $!string = nqp::unbox_s(string); $!chars = nqp::chars($!string); $!todo = todo; $!first = !skip-empty; if $!todo > $!chars + 2 { # will return all chars $!todo = $!chars + 1; $!last = !skip-empty; } else { $!todo = $!todo - 1; $!last = !skip-empty && ($!todo == $!chars + 1); } self } method new(\string,\todo,\skip-empty) { nqp::create(self).BUILD(string,todo,skip-empty) } method pull-one() is raw { if $!first { # do empty string first $!first = 0; $!todo = $!todo - 1; "" } elsif $!todo { # next char $!todo = $!todo - 1; nqp::p6box_s(nqp::substr($!string,$!pos++,1)) } elsif $!last { # do final empty string $!last = 0; "" } elsif nqp::islt_i($!pos,$!chars) { # do rest of string my str $rest = nqp::substr($!string,$!pos); $!pos = $!chars; nqp::p6box_s($rest) } else { IterationEnd } } method push-all($target) { $target.push("") if $!first; $!todo = $!todo - 1; while $!todo { $target.push( nqp::p6box_s(nqp::substr($!string,$!pos++,1))); $!todo = $!todo - 1; } $target.push( nqp::p6box_s(nqp::substr($!string,$!pos))) if nqp::islt_i($!pos,$!chars); $target.push("") if $!last; IterationEnd } method count-only() { nqp::p6box_i($!todo + $!first + $!last) } method sink-all() { IterationEnd } }.new(self,$limit,$skip-empty)); } } multi method split(Str:D: @needles, $parts = *;; :$v is copy, :$k, :$kv, :$p, :$skip-empty) { my int $any = self!split-sanity($v,$k,$kv,$p); # must all be Cool, otherwise we'll just use a regex return self.split(rx/ @needles /,:$v,:$k,:$kv,:$p,:$skip-empty) if Rakudo::Internals.NOT_ALL_TYPE(@needles,Cool); my int $limit = $parts.Int unless nqp::istype($parts,Whatever) || $parts == Inf; my str $str = nqp::unbox_s(self); my $positions := nqp::list; my $needles := nqp::list; my $needle-chars := nqp::list; my $sorted := nqp::list; my int $found = -1; my $needles-seen := nqp::hash; my int $tried; my int $fired; # search using all needles for @needles.kv -> $index, $needle { my str $need = nqp::unbox_s($needle.DEFINITE ?? $needle.Str !! ""); my int $chars = nqp::chars($need); nqp::push($needles,$need); nqp::push($needle-chars,$chars); # search for this needle if there is one, and not done before if $chars && !nqp::existskey($needles-seen,$need) { nqp::bindkey($needles-seen,$need,1); my int $pos; my int $i; my int $seen = nqp::elems($positions); my int $todo = $limit - 1; # no limit: -1 while $todo && nqp::isge_i($i = nqp::index($str, $need, $pos),0) { nqp::push($positions,Pair.new($i,nqp::unbox_i($index))); nqp::push($sorted,nqp::unbox_i($found = $found + 1)); $pos = $i + $chars; $todo = $todo - 1; } $tried = $tried + 1; $fired = $fired + nqp::isge_i(nqp::elems($positions),$seen); } } # no needle tried, assume we want chars return self.split("",$parts) if nqp::not_i($tried); # sort by position if more than one needle fired nqp::p6sort($sorted, -> int $a, int $b { # $a <=> $b || $b.chars <=> $a.chars, aka pos asc, length desc nqp::getattr(nqp::atpos($positions,$a),Pair,'$!key') <=> nqp::getattr(nqp::atpos($positions,$b),Pair,'$!key') || nqp::atpos($needle-chars, nqp::getattr(nqp::atpos($positions,$b),Pair,'$!value')) <=> nqp::atpos($needle-chars, nqp::getattr(nqp::atpos($positions,$a),Pair,'$!value')) }) if nqp::isgt_i($fired,1); # remove elements we don't want if $limit { my int $todo = $limit - 1; my $limited := nqp::list; my $pair; my int $from; my int $pos; while $todo && nqp::elems($sorted) { my int $index = nqp::shift($sorted); $pair := nqp::atpos($positions,$index); $from = nqp::getattr($pair,Pair,'$!key'); if nqp::isge_i($from,$pos) { # not hidden by other needle nqp::push($limited,$index); $pos = $from + nqp::atpos( $needle-chars,nqp::getattr($pair,Pair,'$!value')); $todo = $todo - 1; } } $sorted := $limited; } # create the final result my int $skip = ?$skip-empty; my $pair; my int $from; my int $pos; my $result := nqp::list; if $any { while nqp::elems($sorted) { $pair := nqp::atpos($positions,nqp::shift($sorted)); $from = nqp::getattr($pair,Pair,'$!key'); if nqp::isge_i($from,$pos) { # not hidden by other needle my int $needle-index = nqp::getattr($pair,Pair,'$!value'); nqp::push($result,nqp::substr($str,$pos,$from - $pos)) unless $skip && nqp::iseq_i($from,$pos); nqp::push($result,$needle-index) if $k || $kv; nqp::push($result,nqp::atpos($needles,$needle-index)) if $v || $kv; nqp::push($result,Pair.new( $needle-index,nqp::atpos($needles,$needle-index))) if $p; $pos = $from + nqp::atpos($needle-chars,$needle-index); } } } else { while nqp::elems($sorted) { $pair := nqp::atpos($positions,nqp::shift($sorted)); $from = nqp::getattr($pair,Pair,'$!key'); if nqp::isge_i($from,$pos) { # not hidden by other needle nqp::push($result,nqp::substr($str,$pos,$from - $pos)) unless $skip && nqp::iseq_i($from,$pos); $pos = $from + nqp::atpos( $needle-chars,nqp::getattr($pair,Pair,'$!value')); } } } nqp::push($result,nqp::substr($str,$pos)) unless $skip && nqp::iseq_i($pos,nqp::chars($str)); $result } # Note that in these same* methods, as used by s/LHS/RHS/, the # pattern is actually the original string matched by LHS, while the # invocant "original" is really the replacement RHS part. Confusing... method samecase(Str:D: Str $pattern) { my str $str = nqp::unbox_s(self); my str $pat = nqp::unbox_s($pattern); my int $min = min(nqp::chars($str),nqp::chars($pattern)); my int $i = 0; my int $j = 0; my int $case = 0; my int $last-case; my Mu $ret := nqp::list_s(); my str $substr; while $i < $min { repeat { $last-case = $case; $case = nqp::iscclass(nqp::const::CCLASS_LOWERCASE, $pat, $j) ?? 1 !! nqp::iscclass(nqp::const::CCLASS_UPPERCASE, $pat, $j) ?? 2 !! 0; last if $case != $last-case; $j = $j + 1; } while $j < $min; $substr = nqp::substr($str, $i, $j - $i); nqp::push_s($ret, $last-case == 1 ?? nqp::lc($substr) !! $last-case == 2 ?? nqp::uc($substr) !! $substr); $i = $j } $substr = nqp::substr($str,$i); nqp::push_s($ret, $case == 1 ?? nqp::lc($substr) !! $case == 2 ?? nqp::uc($substr) !! $substr); nqp::join("",$ret); } #?if moar method samemark(Str:D: Str:D $pattern) { my @marklist = $pattern.comb; my $patmarks; join '', self.comb.map: -> $orig { $patmarks := .NFD[1..*] with @marklist.shift; Uni.new($orig.NFD[0], |$patmarks).Str; } } #?endif #?if jvm method samemark(Str:D: Str:D $pattern) { X::NYI.new(:feature<samemark>).throw } #?endif method samespace(Str:D: Str:D $pattern) { self.word-by-word($pattern, :samespace) } method word-by-word(Str:D: Str:D $pattern, &filter?, Bool :$samespace) { my str $str = nqp::unbox_s(self); my str $pat = nqp::unbox_s($pattern); my Mu $ret := nqp::list_s; my int $chars = nqp::chars($str); my int $pos = 0; my int $nextpos; my int $patchars = nqp::chars($pat); my int $patpos = 0; my int $patnextpos; my int $left; my $patword; # Still something to look for? while ($left = $chars - $pos) > 0 { $nextpos = nqp::findcclass( nqp::const::CCLASS_WHITESPACE, $str, $pos, $left); $patnextpos = nqp::findcclass(nqp::const::CCLASS_WHITESPACE, $pat, $patpos, $patchars - $patpos); if &filter { # We latch on last pattern word if pattern runs out of words first. $patword := nqp::p6box_s(nqp::substr($pat, $patpos, $patnextpos - $patpos)) if $patpos < $patchars; nqp::push_s($ret, nqp::unbox_s(filter(nqp::substr($str, $pos, $nextpos - $pos), $patword))); } else { nqp::push_s($ret, nqp::substr($str, $pos, $nextpos - $pos)); } # Did we have the last word? last if $nextpos >= $chars; $pos = nqp::findnotcclass( nqp::const::CCLASS_WHITESPACE, $str, $nextpos, $chars - $nextpos); if $patnextpos >= $patchars { # No more pat space, just copy original space. nqp::push_s($ret, nqp::substr($str, $nextpos, $pos - $nextpos)); $patpos = $patnextpos; } else { # Traverse pat space, use if wanted $patpos = nqp::findnotcclass( nqp::const::CCLASS_WHITESPACE, $pat, $patnextpos, $patchars - $patnextpos); if $samespace { # Carry over pattern space? nqp::push_s($ret, nqp::substr($pat, $patnextpos, $patpos - $patnextpos)); } else { # Nope, just use original space. nqp::push_s($ret, nqp::substr($str, $nextpos, $pos - $nextpos)); } } } nqp::join("",$ret) } method trim-leading(Str:D:) { my str $str = nqp::unbox_s(self); my int $pos = nqp::findnotcclass( nqp::const::CCLASS_WHITESPACE, $str, 0, nqp::chars($str)); $pos ?? nqp::p6box_s(nqp::substr($str, $pos)) !! self; } method trim-trailing(Str:D:) { my str $str = nqp::unbox_s(self); my int $pos = nqp::chars($str) - 1; $pos = $pos - 1 while nqp::isge_i($pos, 0) && nqp::iscclass(nqp::const::CCLASS_WHITESPACE, $str, $pos); nqp::islt_i($pos, 0) ?? '' !! nqp::p6box_s(nqp::substr($str, 0, $pos + 1)); } method trim(Str:D:) { my str $str = nqp::unbox_s(self); my int $pos = nqp::chars($str) - 1; my int $left = nqp::findnotcclass( nqp::const::CCLASS_WHITESPACE, $str, 0, $pos + 1); $pos = $pos - 1 while nqp::isge_i($pos, $left) && nqp::iscclass(nqp::const::CCLASS_WHITESPACE, $str, $pos); nqp::islt_i($pos, $left) ?? '' !! nqp::p6box_s(nqp::substr($str, $left, $pos + 1 - $left)); } multi method words(Str:D: :$autoderef!) { # in Actions.postprocess_words my @list := self.words.List; return @list == 1 ?? @list[0] !! @list; } multi method words(Str:D: $limit) { # we should probably deprecate this feature nqp::istype($limit,Whatever) || $limit == Inf ?? self.words !! self.words[ 0 .. $limit.Int - 1 ] } multi method words(Str:D:) { Seq.new(class :: does Iterator { has str $!str; has int $!chars; has int $!pos; submethod BUILD(\string) { $!str = nqp::unbox_s(string); $!chars = nqp::chars($!str); $!pos = nqp::findnotcclass( nqp::const::CCLASS_WHITESPACE, $!str, 0, $!chars); self } method new(\string) { nqp::create(self).BUILD(string) } method pull-one() { my int $left; my int $nextpos; if ($left = $!chars - $!pos) > 0 { $nextpos = nqp::findcclass( nqp::const::CCLASS_WHITESPACE, $!str, $!pos, $left); my str $found = nqp::substr($!str, $!pos, $nextpos - $!pos); $!pos = nqp::findnotcclass( nqp::const::CCLASS_WHITESPACE, $!str, $nextpos, $!chars - $nextpos); return nqp::p6box_s($found); } IterationEnd } method push-exactly($target, int $n) { my int $found; my int $left; my int $nextpos; while ($left = $!chars - $!pos) > 0 { $nextpos = nqp::findcclass( nqp::const::CCLASS_WHITESPACE, $!str, $!pos, $left); $target.push(nqp::p6box_s( nqp::substr($!str, $!pos, $nextpos - $!pos) )); $!pos = nqp::findnotcclass( nqp::const::CCLASS_WHITESPACE, $!str, $nextpos, $!chars - $nextpos); $found = $found + 1; return nqp::p6box_i($found) if $found == $n; } nqp::p6box_i($found) } method push-all($target) { my int $left; my int $nextpos; while ($left = $!chars - $!pos) > 0 { $nextpos = nqp::findcclass( nqp::const::CCLASS_WHITESPACE, $!str, $!pos, $left); $target.push(nqp::p6box_s( nqp::substr($!str, $!pos, $nextpos - $!pos) )); $!pos = nqp::findnotcclass( nqp::const::CCLASS_WHITESPACE, $!str, $nextpos, $!chars - $nextpos); } IterationEnd } method count-only() { my int $found; my int $left; my int $nextpos; while ($left = $!chars - $!pos) > 0 { $nextpos = nqp::findcclass( nqp::const::CCLASS_WHITESPACE, $!str, $!pos, $left); $found = $found + 1; $!pos = nqp::findnotcclass( nqp::const::CCLASS_WHITESPACE, $!str, $nextpos, $!chars - $nextpos); } nqp::p6box_i($found) } }.new(self)); } my $enc_type := nqp::hash('utf8',utf8,'utf16',utf16,'utf32',utf32); #?if moar proto method encode(|) {*} multi method encode(Str:D $encoding = 'utf8', Bool:D :$replacement) { self.encode($encoding, :replacement($replacement ?? ($encoding ~~ m:i/^utf/ ?? "\x[FFFD]" !! "?" ) !! Nil )); } multi method encode(Str:D $encoding = 'utf8', Str :$replacement) { #?endif #?if !moar method encode(Str:D $encoding = 'utf8') { #?endif my str $enc = Rakudo::Internals.NORMALIZE_ENCODING($encoding); my $type := nqp::existskey($enc_type,$enc) ?? nqp::atkey($enc_type,$enc) !! blob8; #?if moar return nqp::encoderep(nqp::unbox_s(self), $enc, nqp::unbox_s($replacement), nqp::decont($type.new)) if $replacement.defined; #?endif nqp::encode(nqp::unbox_s(self), $enc, nqp::decont($type.new)) } #?if moar method NFC() { nqp::strtocodes(nqp::unbox_s(self), nqp::const::NORMALIZE_NFC, nqp::create(NFC)) } method NFD() { nqp::strtocodes(nqp::unbox_s(self), nqp::const::NORMALIZE_NFD, nqp::create(NFD)) } method NFKC() { nqp::strtocodes(nqp::unbox_s(self), nqp::const::NORMALIZE_NFKC, nqp::create(NFKC)) } method NFKD() { nqp::strtocodes(nqp::unbox_s(self), nqp::const::NORMALIZE_NFKD, nqp::create(NFKD)) } #?endif #?if jvm method NFC() { X::NYI.new(:feature<NFC>).throw } method NFD() { X::NYI.new(:feature<NFD>).throw } method NFKC() { X::NYI.new(:feature<NFKC>).throw } method NFKD() { X::NYI.new(:feature<NFKD>).throw } #?endif method wordcase(Str:D: :&filter = &tclc, Mu :$where = True) { self.subst(:g, / [<:L> \w* ] +% <['\-]> /, -> $m { my Str $s = $m.Str; $s ~~ $where ?? filter($s) !! $s; }); } my class LSM { has Str $!source; has @!substitutions; has $!squash; has $!complement; has int $!index; has int $!next_match; has $!first_substitution; # need this one for :c with arrays has $!next_substitution; has $!substitution_length; has $!prev_result; has $!match_obj; has $!last_match_obj; has str $.unsubstituted_text; has str $.substituted_text; submethod BUILD(:$!source, :$!squash, :$!complement) { } method add_substitution($key, $value) { $/ := CALLERS::('$/'); push @!substitutions, $key => $value; } submethod compare_substitution($substitution, Int $pos, Int $length) { $/ := CALLERS::('$/'); if $!next_match > $pos || $!next_match == $pos && $!substitution_length < $length { $!next_match = $pos; $!substitution_length = $length; $!next_substitution = $substitution; $!match_obj = $!last_match_obj; } } proto method triage_substitution(|) {*} multi method triage_substitution($_ where { nqp::istype(.key,Regex) }) { $/ := CALLERS::('$/'); my $m := $!source.match(.key, :continue($!index)); return unless $m; $!last_match_obj = $/; self.compare_substitution($_, $m.from, $m.to - $m.from); True } multi method triage_substitution($_ where { nqp::istype(.key,Cool) }) { $/ := CALLERS::('$/'); my $pos := index($!source, .key, $!index); return unless defined $pos; self.compare_substitution($_, $pos, .key.chars); True } multi method triage_substitution($_) { X::Str::Trans::IllegalKey.new(key => $_).throw; } proto method increment_index(|) {*} multi method increment_index(Regex $s) { $/ := CALLERS::('$/'); substr($!source,$!index) ~~ $s; $!last_match_obj = $/; $!index = $!next_match + $/.chars; } multi method increment_index(Cool $s) { $/ := CALLERS::('$/'); $!index = $!next_match + nqp::chars($s.Str); } method get_next_substitution_result { my $result = $!complement ?? $!first_substitution.value !! $!next_substitution.value; my $cds := CALLERS::('$/'); $/ := CALLERS::('$/'); $cds = $!match_obj; my $orig-result = $result = ($result ~~ Callable ?? $result() !! $result).Str; if $!prev_result && $!prev_result eq $result && $!unsubstituted_text eq '' && $!squash { $result = ''; } $!prev_result = $orig-result; nqp::unbox_s($result) } method next_substitution() { $/ := CALLERS::('$/'); $!next_match = $!source.chars; $!first_substitution //= @!substitutions[0]; # triage_substitution has a side effect! @!substitutions = @!substitutions.grep: { self.triage_substitution($_) } $!unsubstituted_text # = nqp::substr(nqp::unbox_s($!source), $!index, = substr($!source,$!index, $!next_match - $!index); if defined $!next_substitution { if $!complement { my $oldidx = $!index; if $!unsubstituted_text { my $result = self.get_next_substitution_result; self.increment_index($!next_substitution.key); $!substituted_text = substr($!source,$oldidx + $!unsubstituted_text.chars, $!index - $oldidx - $!unsubstituted_text.chars); $!unsubstituted_text = $!squash ?? $result !! $result x $!unsubstituted_text.chars; } else { return if $!next_match == $!source.chars; my $result = self.get_next_substitution_result; self.increment_index($!next_substitution.key); $!substituted_text = ''; $!unsubstituted_text = substr($!source,$oldidx, $!index - $oldidx); } } else { return if $!next_match == $!source.chars; $!substituted_text = self.get_next_substitution_result; self.increment_index($!next_substitution.key); } } return $!next_match < $!source.chars && @!substitutions; } } proto method trans(|) { $/ := nqp::getlexcaller('$/'); {*} } multi method trans(Str:D: Pair:D \what, *%n) { my $from = what.key; my $to = what.value; $/ := CALLERS::('$/'); return self.trans(|%n, (what,)) if !nqp::istype($from,Str) # from not a string || !$from.defined # or a type object || !nqp::istype($to,Str) # or to not a string || !$to.defined # or a type object || %n; # or any named params passed # from 1 char return Rakudo::Internals.TRANSPOSE(self, $from, substr($to,0,1)) if $from.chars == 1; sub expand(Str:D \x) { my str $s = nqp::unbox_s(x); my int $found = nqp::index($s,'..',1); return x # not found or at the end without trail if nqp::iseq_i($found,-1) || nqp::iseq_i($found,nqp::chars($s)-2); my int $from = nqp::ordat($s,$found - 1); my int $to = nqp::ordat($s,$found + 2); my Mu $result := nqp::list_s(); nqp::push_s($result,nqp::substr($s,0,$found - 1)); while nqp::isle_i($from,$to) { nqp::push_s($result,nqp::chr($from)); $from = $from + 1; } nqp::push_s($result,nqp::substr($s,$found + 3)); expand(nqp::p6box_s(nqp::join('',$result))); } my str $sfrom = nqp::unbox_s(expand($from)); my str $str = nqp::unbox_s(self); my str $chars = nqp::chars($str); my Mu $result := nqp::list_s(); my str $check; my int $i; # something to convert to if $to.chars -> $tochars { nqp::setelems($result,$chars); # all convert to one char if $tochars == 1 { my str $sto = nqp::unbox_s($to); while nqp::islt_i($i,$chars) { $check = nqp::substr($str,$i,1); nqp::bindpos_s( $result, $i, nqp::iseq_i(nqp::index($sfrom,$check),-1) ?? $check !! $sto ); $i = $i + 1; } } # multiple chars to convert to else { my str $sto = nqp::unbox_s(expand($to)); my int $sfl = nqp::chars($sfrom); my int $found; # repeat until mapping complete $sto = $sto ~ $sto while nqp::islt_i(nqp::chars($sto),$sfl); while nqp::islt_i($i,$chars) { $check = nqp::substr($str,$i,1); $found = nqp::index($sfrom,$check); nqp::bindpos_s($result, $i, nqp::iseq_i($found,-1) ?? $check !! nqp::substr($sto,$found,1) ); $i = $i + 1; } } } # just remove else { while nqp::islt_i($i,$chars) { $check = nqp::substr($str,$i,1); nqp::push_s($result, $check) if nqp::iseq_i(nqp::index($sfrom,$check),-1); $i = $i + 1; } } nqp::p6box_s(nqp::join('',$result)); } multi method trans(Str:D: *@changes, :complement(:$c), :squash(:$s), :delete(:$d)) { my sub myflat(*@s) { @s.map: { nqp::istype($_, Iterable) ?? .list.Slip !! $_ } } my sub expand($s) { return myflat($s.list).Slip if nqp::istype($s,Iterable) || nqp::istype($s,Positional); flat $s.comb(/ (\w) '..' (\w) | . /, :match).map: { flat(.[0] ?? ~.[0] .. ~.[1] !! ~$_).Slip }; } $/ := CALLERS::('$/'); my $lsm = LSM.new(:source(self), :squash($s), :complement($c)); for @changes -> $p { X::Str::Trans::InvalidArg.new(got => $p).throw unless nqp::istype($p,Pair); if nqp::istype($p.key,Regex) { $lsm.add_substitution($p.key, $p.value); } elsif nqp::istype($p.value,Callable) { my @from = expand $p.key; for @from -> $f { $lsm.add_substitution($f, $p.value); } } else { my @from = expand $p.key; my @to = expand $p.value; if @to { my $padding = $d ?? '' !! @to[@to - 1]; @to = flat @to, $padding xx @from - @to; } else { @to = '' xx @from } for flat @from Z @to -> $f, $t { $lsm.add_substitution($f, $t); } } } my Mu $ret := nqp::list_s(); while $lsm.next_substitution { nqp::push_s($ret, nqp::unbox_s($lsm.unsubstituted_text)); nqp::push_s($ret, nqp::unbox_s($lsm.substituted_text)); } nqp::push_s($ret, nqp::unbox_s($lsm.unsubstituted_text)); nqp::p6box_s(nqp::join('', $ret)) } proto method indent($) {*} # Zero indent does nothing multi method indent(Int() $steps where { $_ == 0 }) { self; } # Positive indent does indent multi method indent(Int() $steps where { $_ > 0 }) { # We want to keep trailing \n so we have to .comb explicitly instead of .lines self.comb(/:r ^^ \N* \n?/).map({ given $_.Str { when /^ \n? $ / { $_; } # Use the existing space character if they're all the same # (but tabs are done slightly differently) when /^(\t+) ([ \S .* | $ ])/ { $0 ~ "\t" x ($steps div $?TABSTOP) ~ ' ' x ($steps mod $?TABSTOP) ~ $1 } when /^(\h) $0* [ \S | $ ]/ { $0 x $steps ~ $_ } # Otherwise we just insert spaces after the existing leading space default { $_ ~~ /^(\h*) (.*)$/; $0 ~ (' ' x $steps) ~ $1 } } }).join; } # Negative indent (de-indent) multi method indent(Int() $steps where { $_ < 0 }) { de-indent(self, $steps); } # Whatever indent (de-indent) multi method indent(Whatever $steps) { de-indent(self, $steps); } sub de-indent($obj, $steps) { # Loop through all lines to get as much info out of them as possible my @lines = $obj.comb(/:r ^^ \N* \n?/).map({ # Split the line into indent and content my ($indent, $rest) = @($_ ~~ /^(\h*) (.*)$/); # Split the indent into characters and annotate them # with their visual size my $indent-size = 0; my @indent-chars = $indent.comb.map(-> $char { my $width = $char eq "\t" ?? $?TABSTOP - ($indent-size mod $?TABSTOP) !! 1; $indent-size += $width; $char => $width; }).eager; { :$indent-size, :@indent-chars, :rest(~$rest) }; }); # Figure out the amount * should de-indent by, we also use this for warnings my $common-prefix = min @lines.grep({ .<indent-size> || .<rest> ~~ /\S/}).map({ $_<indent-size> }); return $obj if $common-prefix === Inf; # Set the actual de-indent amount here my Int $de-indent = nqp::istype($steps,Whatever) ?? $common-prefix !! -$steps; warn "Asked to remove $de-indent spaces, but the shortest indent is $common-prefix spaces" if $de-indent > $common-prefix; # Work forwards from the left end of the indent whitespace, removing # array elements up to # (or over, in the case of tab-explosion) # the specified de-indent amount. @lines.map(-> $l { my $pos = 0; while $l<indent-chars> and $pos < $de-indent { if $l<indent-chars>.shift.key eq "\t" { $pos -= $pos % $?TABSTOP; $pos += $?TABSTOP; } else { $pos++ } } if $l<indent-chars> and $pos % $?TABSTOP { my $check = $?TABSTOP - $pos % $?TABSTOP; $check = $l<indent-chars>[lazy 0..^$check].first(*.key eq "\t",:k); with $check { $l<indent-chars>.shift for 0..$check; $pos -= $pos % $?TABSTOP; $pos += $?TABSTOP; } } $l<indent-chars>».key.join ~ ' ' x ($pos - $de-indent) ~ $l<rest>; }).join; } proto method codes(|) { * } multi method codes(Str:D:) returns Int:D { #?if moar self.NFC.codes #?endif #?if jvm nqp::p6box_i(nqp::chars(nqp::unbox_s(self))) #?endif } multi method codes(Str:U:) returns Int:D { self.Str; # generate undefined warning 0 } proto method chars(|) { * } multi method chars(Str:D:) returns Int:D { nqp::p6box_i(nqp::chars($!value)) } multi method chars(Str:U:) returns Int:D { self.Str; # generate undefined warning 0 } proto method uc(|) { * } multi method uc(Str:D:) { nqp::p6box_s(nqp::uc($!value)); } multi method uc(Str:U:) { self.Str; } proto method lc(|) { * } multi method lc(Str:D:) { nqp::p6box_s(nqp::lc($!value)); } multi method lc(Str:U:) { self.Str; } proto method tc(|) { * } multi method tc(Str:D:) { nqp::p6box_s(nqp::tc(nqp::substr($!value,0,1)) ~ nqp::substr($!value,1)); } multi method tc(Str:U:) { self.Str } proto method fc(|) { * } multi method fc(Str:D:) { nqp::p6box_s(nqp::fc($!value)); } multi method fc(Str:U:) { self.Str; } proto method tclc(|) { * } multi method tclc(Str:D:) { nqp::p6box_s(nqp::tclc($!value)) } multi method tclc(Str:U:) { self.Str } proto method flip(|) { * } multi method flip(Str:D:) { nqp::p6box_s(nqp::flip($!value)) } multi method flip(Str:U:) { self.Str } proto method ord(|) { * } multi method ord(Str:D:) returns Int { nqp::chars($!value) ?? nqp::p6box_i(nqp::ord($!value)) !! Nil; } multi method ord(Str:U: --> Nil) { } } multi sub prefix:<~>(Str:D \a) returns Str:D { a } multi sub prefix:<~>(str $a) returns str { $a } multi sub infix:<~>(Str:D \a, Str:D \b) returns Str:D { nqp::p6box_s(nqp::concat(nqp::unbox_s(a), nqp::unbox_s(b))) } multi sub infix:<~>(str $a, str $b) returns str { nqp::concat($a, $b) } multi sub infix:<~>(*@args) returns Str:D { @args.join } multi sub infix:<x>(Str:D $s, Int:D $repetition) returns Str:D { $repetition < 0 ?? '' !! nqp::p6box_s(nqp::x(nqp::unbox_s($s), nqp::unbox_i($repetition))) } multi sub infix:<x>(str $s, int $repetition) returns str { nqp::if(nqp::islt_i($repetition, 0), '', nqp::x($s, $repetition)) } multi sub infix:<cmp>(Str:D \a, Str:D \b) returns Order:D { ORDER(nqp::cmp_s(nqp::unbox_s(a), nqp::unbox_s(b))) } multi sub infix:<cmp>(str $a, str $b) returns Order:D { ORDER(nqp::cmp_s($a, $b)) } multi sub infix:<===>(Str:D \a, Str:D \b) returns Bool:D { nqp::p6bool(nqp::iseq_s(nqp::unbox_s(a), nqp::unbox_s(b))) } multi sub infix:<===>(str $a, str $b) returns Bool:D { nqp::p6bool(nqp::iseq_s($a, $b)) } multi sub infix:<leg>(Str:D \a, Str:D \b) returns Order:D { ORDER(nqp::cmp_s(nqp::unbox_s(a), nqp::unbox_s(b))) } multi sub infix:<leg>(str $a, str $b) returns Order:D { ORDER(nqp::cmp_s($a, $b)) } multi sub infix:<eq>(Str:D \a, Str:D \b) returns Bool:D { nqp::p6bool(nqp::iseq_s(nqp::unbox_s(a), nqp::unbox_s(b))) } multi sub infix:<eq>(str $a, str $b) returns Bool:D { nqp::p6bool(nqp::iseq_s($a, $b)) } multi sub infix:<ne>(Str:D \a, Str:D \b) returns Bool:D { nqp::p6bool(nqp::isne_s(nqp::unbox_s(a), nqp::unbox_s(b))) } multi sub infix:<ne>(str $a, str $b) returns Bool:D { nqp::p6bool(nqp::isne_s($a, $b)) } multi sub infix:<lt>(Str:D \a, Str:D \b) returns Bool:D { nqp::p6bool(nqp::islt_s(nqp::unbox_s(a), nqp::unbox_s(b))) } multi sub infix:<lt>(str $a, str $b) returns Bool:D { nqp::p6bool(nqp::islt_s($a, $b)) } multi sub infix:<le>(Str:D \a, Str:D \b) returns Bool:D { nqp::p6bool(nqp::isle_s(nqp::unbox_s(a), nqp::unbox_s(b))) } multi sub infix:<le>(str $a, str $b) returns Bool:D { nqp::p6bool(nqp::isle_s($a, $b)) } multi sub infix:<gt>(Str:D \a, Str:D \b) returns Bool:D { nqp::p6bool(nqp::isgt_s(nqp::unbox_s(a), nqp::unbox_s(b))) } multi sub infix:<gt>(str $a, str $b) returns Bool:D { nqp::p6bool(nqp::isgt_s($a, $b)) } multi sub infix:<ge>(Str:D \a, Str:D \b) returns Bool:D { nqp::p6bool(nqp::isge_s(nqp::unbox_s(a), nqp::unbox_s(b))) } multi sub infix:<le>(str $a, str $b) returns Bool:D { nqp::p6bool(nqp::isle_s($a, $b)) } multi sub infix:<~|>(Str:D \a, Str:D \b) returns Str:D { nqp::p6box_s(nqp::bitor_s(nqp::unbox_s(a), nqp::unbox_s(b))) } multi sub infix:<~|>(str $a, str $b) returns str { nqp::bitor_s($a, $b) } multi sub infix:<~&>(Str:D \a, Str:D \b) returns Str:D { nqp::p6box_s(nqp::bitand_s(nqp::unbox_s(a), nqp::unbox_s(b))) } multi sub infix:<~&>(str $a, str $b) returns str { nqp::bitand_s($a, $b) } multi sub infix:<~^>(Str:D \a, Str:D \b) returns Str:D { nqp::p6box_s(nqp::bitxor_s(nqp::unbox_s(a), nqp::unbox_s(b))) } multi sub infix:<~^>(str $a, str $b) returns str { nqp::bitxor_s($a, $b) } multi sub prefix:<~^>(Str \a) { fail "prefix:<~^> NYI"; # XXX } # XXX: String-wise shifts NYI multi sub infix:«~>»(Str:D \a, Int:D \b) returns Str:D { X::NYI.new(feature => "infix:«~>»").throw; } multi sub infix:«~>»(str $a, int $b) { X::NYI.new(feature => "infix:«~>»").throw; } multi sub infix:«~<»(Str:D \a, Int:D \b) returns Str:D { X::NYI.new(feature => "infix:«~<»").throw; } multi sub infix:«~<»(str $a, int $b) { X::NYI.new(feature => "infix:«~<»").throw; } multi sub ords(Str $s) { $s.ords } # TODO: Cool variants sub trim (Str:D $s) returns Str:D { $s.trim } sub trim-leading (Str:D $s) returns Str:D { $s.trim-leading } sub trim-trailing(Str:D $s) returns Str:D { $s.trim-trailing } # the opposite of Real.base, used for :16($hex_str) proto sub UNBASE (|) { * } multi sub UNBASE(Int:D $base, Any:D $num) { X::Numeric::Confused.new(:$num, :$base).throw; } multi sub UNBASE(Int:D $base, Str:D $str) { my Str $ch = substr($str, 0, 1); if $ch eq '0' { $ch = substr($str, 1, 1); if $base <= 11 && $ch eq any(<x d o b>) or $base <= 24 && $ch eq any <o x> or $base <= 33 && $ch eq 'x' { $str.Numeric; } else { ":{$base}<$str>".Numeric; } } elsif $ch eq ':' && substr($str, 1, 1) ~~ ('1'..'9') { $str.Numeric; } else { ":{$base}<$str>".Numeric; } } # for :16[1, 2, 3] sub UNBASE_BRACKET($base, @a) { my $v = 0; my $denom = 1; my Bool $seen-dot = False; for @a { if $seen-dot { die "Only one decimal dot allowed" if $_ eq '.'; $denom *= $base; $v += $_ / $denom } elsif $_ eq '.' { $seen-dot = True; } else { $v = $v * $base + $_; } } $v; } sub chrs(*@c) returns Str:D { @c.map({.chr}).join; } proto sub substr(|) { * } multi sub substr(Str:D \what, Int:D \start) { my str $str = nqp::unbox_s(what); my int $max = nqp::chars($str); my int $from = nqp::unbox_i(start); Rakudo::Internals.SUBSTR-START-OOR($from,$max).fail if nqp::islt_i($from,0) || nqp::isgt_i($from,$max); nqp::p6box_s(nqp::substr($str,$from)); } multi sub substr(Str:D \what, Callable:D \start) { my str $str = nqp::unbox_s(what); my int $max = nqp::chars($str); my int $from = nqp::unbox_i((start)(nqp::p6box_i($max))); Rakudo::Internals.SUBSTR-START-OOR($from,$max).fail if nqp::islt_i($from,0) || nqp::isgt_i($from,$max); nqp::p6box_s(nqp::substr($str,$from)); } multi sub substr(Str:D \what, Int:D \start, Int:D \want) { my str $str = nqp::unbox_s(what); my int $max = nqp::chars($str); my int $from = nqp::unbox_i(start); Rakudo::Internals.SUBSTR-START-OOR($from,$max).fail if nqp::islt_i($from,0) || nqp::isgt_i($from,$max); my int $chars = nqp::unbox_i(want); Rakudo::Internals.SUBSTR-CHARS-OOR($chars).fail if nqp::islt_i($chars,0); nqp::p6box_s(nqp::substr($str,$from,$chars)); } multi sub substr(Str() $what, \start, $want?) { # should really be int, but \ then doesn't work for rw access my $r := Rakudo::Internals.SUBSTR-SANITY($what, start, $want, my Int $from, my Int $chars); $r.defined ?? nqp::p6box_s(nqp::substr( nqp::unbox_s($what),nqp::unbox_i($from),nqp::unbox_i($chars) )) !! $r; } sub substr-rw(\what, \start, $want?) is rw { my $Str := nqp::istype(what,Str) ?? what !! what.Str; # should really be int, but \ then doesn't work for rw access my $r := Rakudo::Internals.SUBSTR-SANITY($Str, start, $want, my Int $from, my Int $chars); $r.defined ?? Proxy.new( FETCH => sub ($) { nqp::p6box_s(nqp::substr( nqp::unbox_s($Str), nqp::unbox_i($from), nqp::unbox_i($chars) )); }, STORE => sub ($, Str() $new) { my $str = nqp::unbox_s($Str); what = nqp::p6box_s( nqp::concat( nqp::substr($str,0,nqp::unbox_i($from)), nqp::concat( nqp::unbox_s($new), nqp::substr($str,nqp::unbox_i($from + $chars)) ) ) ); }, ) !! $r; } proto sub samemark(|) {*} multi sub samemark($s, $pat) { $s.samemark($pat) } # These probably belong in a separate unicodey file proto sub uniname(|) {*} multi sub uniname(Str:D $str) { $str ?? uniname($str.ord) !! Nil } multi sub uniname(Int:D $code) { nqp::getuniname($code) } proto sub uninames(|) {*} multi sub uninames(Str:D $str) { $str.NFC.map: { uniname($_) } } #?if jvm multi sub unival(|) { die 'unival NYI on jvm backend' } multi sub univals(|) { die 'univals NYI on jvm backend' } multi sub uniprop(|) { die 'uniprop NYI on jvm backend' } multi sub uniprop-int(|) { die 'uniprop-int NYI on jvm backend' } multi sub uniprop-bool(|) { die 'uniprop-bool NYI on jvm backend' } multi sub uniprop-str(|) { die 'uniprop-str NYI on jvm backend' } multi sub unimatch(|) { die 'unimatch NYI on jvm backend' } #?endif #?if moar proto sub uniprop(|) {*} multi sub uniprop(Str:D $str, |c) { $str ?? uniprop($str.ord, |c) !! Nil } multi sub uniprop(Int:D $code, Stringy:D $propname = "GeneralCategory") { my $prop := Rakudo::Internals.PROPCODE($propname); state %prefs; # could prepopulate this with various prefs given %prefs{$propname} // '' { when 'S' { nqp::getuniprop_str($code,$prop) } when 'I' { nqp::getuniprop_int($code,$prop) } when 'B' { nqp::getuniprop_bool($code,$prop) } # your ad here default { my $result = nqp::getuniprop_str($code,$prop); if $result ne '' { %prefs{$propname} = 'S'; $result } else { %prefs{$propname} = 'I'; nqp::getuniprop_int($code,$prop) } } } } proto sub uniprop-int(|) {*} multi sub uniprop-int(Str:D $str, Stringy:D $propname) { $str ?? uniprop-int($str.ord, $propname) !! Nil } multi sub uniprop-int(Int:D $code, Stringy:D $propname) { nqp::getuniprop_int($code,Rakudo::Internals.PROPCODE($propname)); } proto sub uniprop-bool(|) {*} multi sub uniprop-bool(Str:D $str, Stringy:D $propname) { $str ?? uniprop-bool($str.ord, $propname) !! Nil } multi sub uniprop-bool(Int:D $code, Stringy:D $propname) { so nqp::getuniprop_bool($code,Rakudo::Internals.PROPCODE($propname)); } proto sub uniprop-str(|) {*} multi sub uniprop-str(Str:D $str, Stringy:D $propname) { $str ?? uniprop-str($str.ord, $propname) !! Nil } multi sub uniprop-str(Int:D $code, Stringy:D $propname) { nqp::getuniprop_str($code,Rakudo::Internals.PROPCODE($propname)); } proto sub unival(|) {*} multi sub unival(Str:D $str) { $str ?? unival($str.ord) !! Nil } multi sub unival(Int:D $code) { state $nuprop = nqp::unipropcode("NumericValueNumerator"); state $deprop = nqp::unipropcode("NumericValueDenominator"); my $nu = nqp::getuniprop_str($code, $nuprop); my $de = nqp::getuniprop_str($code, $deprop); !$de || $de eq '1' ?? $nu.Int !! $nu / $de; } proto sub univals(|) {*} multi sub univals(Str:D $str) { $str.ords.map: { unival($_) } } proto sub unimatch(|) {*} multi sub unimatch(Str:D $str, |c) { $str ?? unimatch($str.ord, |c) !! Nil } multi sub unimatch(Int:D $code, Stringy:D $pvalname, Stringy:D $propname = $pvalname) { my $prop := Rakudo::Internals.PROPCODE($propname); so nqp::matchuniprop($code,$prop,Rakudo::Internals.PVALCODE($prop,$pvalname)); } #?endif # vim: ft=perl6 expandtab sw=4
artistic-2.0
KalinaRain/MyWorkSpace
pmdetection/src/main/java/com/work/pm25/Utility.java
2771
package com.work.pm25; import android.text.TextUtils; import bean.City; import bean.County; import bean.Province; /** * Created by KalinaRain on 2015/5/20. */ public class Utility { /** * 解析和处理服务器返回的省级数据 */ public synchronized static boolean handleProvincesResponse(PM25DB pm25DB, String response) { if (!TextUtils.isEmpty(response)) { String[] allProvinces = response.split(","); if (allProvinces != null && allProvinces.length > 0) { for (String p : allProvinces) { String[] array = p.split("\\|"); Province province = new Province(); province.setProvinceCode(array[0]); province.setProvinceName(array[1]); // 将解析出来的数据存储到Province表 pm25DB.saveProvince(province); } return true; } } return false; } /** * 解析和处理服务器返回的市级数据 */ public static boolean handleCitiesResponse(PM25DB pm25DB, String response, int provinceId) { if (!TextUtils.isEmpty(response)) { String[] allCities = response.split(","); if (allCities != null && allCities.length > 0) { for (String c : allCities) { String[] array = c.split("\\|"); City city = new City(); city.setCityCode(array[0]); city.setCityName(array[1]); city.setProvinceId(provinceId); // 将解析出来的数据存储到City表 pm25DB.saveCity(city); } return true; } } return false; } /** * 解析和处理服务器返回的县级数据 */ public static boolean handleCountiesResponse(PM25DB pm25DB, String response, int cityId) { if (!TextUtils.isEmpty(response)) { String[] allCounties = response.split(","); if (allCounties != null && allCounties.length > 0) { for (String c : allCounties) { String[] array = c.split("\\|"); County county = new County(); county.setCountyCode(array[0]); county.setCountyName(array[1]); county.setCityId(cityId); // 将解析出来的数据存储到County表 pm25DB.saveCounty(county); } return true; } } return false; } }
artistic-2.0
el-germi/industrial-robot
src/main/java/com/germi/indrob/utility/UtilityExtension.java
619
package com.germi.indrob.utility; import javax.swing.filechooser.FileFilter; import javax.swing.filechooser.FileNameExtensionFilter; public class UtilityExtension{ protected String name; protected String[] defs; protected FileFilter filt; public UtilityExtension(String a, String... b) { this.name=a; this.defs=b; this.filt=new FileNameExtensionFilter(a,b); } public String getName() { return this.name; } public String getPreferedExtension() { return this.defs[0]; } public FileFilter getFilter() { return this.filt; } public String[] getDefinitions() { return this.defs; } }
artistic-2.0
kmddev/imgix.js
src/xpath.js
1664
'use strict'; /** * Get html element by auto-generated (via XPath) class name * @memberof imgix * @static * @private * @param {string} xpath the xpath of the element * @returns {Element} element with the xpath */ imgix.getElementByXPathClassName = function (xpath) { return document.querySelector('.' + imgix.getXPathClass(xpath)); }; /** * Get image from an html element by auto-generated (via XPath) class name * @memberof imgix * @static * @private * @param {string} xpath the xpath of the element to get * @returns {string} url of image on the element */ imgix.getElementImageByXPathClassName = function (xpath) { return imgix.getElementImage(imgix.getElementByXPathClassName(xpath)); }; // Current: https://github.com/firebug/firebug/blob/5026362f2d1734adfcc4b44d5413065c50b27400/extension/content/firebug/lib/xpath.js imgix.getElementTreeXPath = function (element) { var paths = []; // Use nodeName (instead of localName) so namespace prefix is included (if any). for (; element && element.nodeType === Node.ELEMENT_NODE; element = element.parentNode) { var index = 0; for (var sibling = element.previousSibling; sibling; sibling = sibling.previousSibling) { // Ignore document type declaration. if (sibling.nodeType === Node.DOCUMENT_TYPE_NODE) { continue; } if (sibling.nodeName === element.nodeName) { ++index; } } var tagName = (element.prefix ? element.prefix + ':' : '') + element.localName, pathIndex = (index ? '[' + (index + 1) + ']' : ''); paths.splice(0, 0, tagName + pathIndex); } return paths.length ? '/' + paths.join('/') : null; };
bsd-2-clause
orlenko/sfpirg
mezzanine/calendar/migrations/0006_auto__add_field_event_location__add_field_event_link_url.py
12037
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'Event.location' db.add_column(u'calendar_event', 'location', self.gf('django.db.models.fields.TextField')(null=True, blank=True), keep_default=False) # Adding field 'Event.link_url' db.add_column(u'calendar_event', 'link_url', self.gf('django.db.models.fields.URLField')(max_length=200, null=True, blank=True), keep_default=False) def backwards(self, orm): # Deleting field 'Event.location' db.delete_column(u'calendar_event', 'location') # Deleting field 'Event.link_url' db.delete_column(u'calendar_event', 'link_url') models = { u'auth.group': { 'Meta': {'object_name': 'Group'}, u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) }, u'auth.permission': { 'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'}, 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) }, u'auth.user': { 'Meta': {'object_name': 'User'}, 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) }, u'calendar.dummytable': { 'Meta': {'object_name': 'DummyTable'}, u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) }, u'calendar.event': { 'Meta': {'object_name': 'Event'}, '_meta_title': ('django.db.models.fields.CharField', [], {'max_length': '500', 'null': 'True', 'blank': 'True'}), 'category': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'events'", 'to': u"orm['sfpirgapp.Category']"}), 'content': ('mezzanine.core.fields.RichTextField', [], {}), 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'end': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), 'expiry_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), 'featured_image': ('mezzanine.core.fields.FileField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), 'gen_description': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'in_menus': ('mezzanine.pages.fields.MenusField', [], {'default': '(1, 2, 3, 4, 5)', 'max_length': '100', 'null': 'True', 'blank': 'True'}), 'in_sitemap': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'keywords': ('mezzanine.generic.fields.KeywordsField', [], {'object_id_field': "'object_pk'", 'to': u"orm['generic.AssignedKeyword']", 'frozen_by_south': 'True'}), 'keywords_string': ('django.db.models.fields.CharField', [], {'max_length': '500', 'blank': 'True'}), 'link_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), 'location': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), 'publish_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), 'short_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), 'site': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['sites.Site']"}), 'slug': ('django.db.models.fields.CharField', [], {'max_length': '2000', 'null': 'True', 'blank': 'True'}), 'start': ('django.db.models.fields.DateTimeField', [], {}), 'status': ('django.db.models.fields.IntegerField', [], {'default': '2'}), 'theme_color': ('django.db.models.fields.CharField', [], {'default': "'grey'", 'max_length': '255'}), 'title': ('django.db.models.fields.CharField', [], {'max_length': '500'}), 'type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['calendar.EventType']", 'null': 'True', 'blank': 'True'}), 'zip_import': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}) }, u'calendar.eventimage': { 'Meta': {'ordering': "('_order',)", 'object_name': 'EventImage'}, '_order': ('django.db.models.fields.IntegerField', [], {'null': 'True'}), 'description': ('django.db.models.fields.CharField', [], {'max_length': '1000', 'blank': 'True'}), 'file': ('mezzanine.core.fields.FileField', [], {'max_length': '200'}), 'gallery': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'images'", 'to': u"orm['calendar.Event']"}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) }, u'calendar.eventtype': { 'Meta': {'ordering': "['name']", 'object_name': 'EventType'}, u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), 'site': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['sites.Site']"}) }, u'contenttypes.contenttype': { 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) }, u'generic.assignedkeyword': { 'Meta': {'ordering': "('_order',)", 'object_name': 'AssignedKeyword'}, '_order': ('django.db.models.fields.IntegerField', [], {'null': 'True'}), 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'keyword': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'assignments'", 'to': u"orm['generic.Keyword']"}), 'object_pk': ('django.db.models.fields.IntegerField', [], {}) }, u'generic.keyword': { 'Meta': {'object_name': 'Keyword'}, u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'site': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['sites.Site']"}), 'slug': ('django.db.models.fields.CharField', [], {'max_length': '2000', 'null': 'True', 'blank': 'True'}), 'title': ('django.db.models.fields.CharField', [], {'max_length': '500'}) }, u'sfpirgapp.category': { 'Meta': {'ordering': "('_order',)", 'object_name': 'Category'}, '_meta_title': ('django.db.models.fields.CharField', [], {'max_length': '500', 'null': 'True', 'blank': 'True'}), '_order': ('django.db.models.fields.IntegerField', [], {'null': 'True'}), 'content': ('mezzanine.core.fields.RichTextField', [], {}), 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'expiry_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), 'featured_image': ('sfpirgapp.fields.MyImageField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), 'gen_description': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'in_sitemap': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'keywords': ('mezzanine.generic.fields.KeywordsField', [], {'object_id_field': "'object_pk'", 'to': u"orm['generic.AssignedKeyword']", 'frozen_by_south': 'True'}), 'keywords_string': ('django.db.models.fields.CharField', [], {'max_length': '500', 'blank': 'True'}), 'login_required': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'publish_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), 'short_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), 'site': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['sites.Site']"}), 'slug': ('django.db.models.fields.CharField', [], {'max_length': '2000', 'null': 'True', 'blank': 'True'}), 'status': ('django.db.models.fields.IntegerField', [], {'default': '2'}), 'theme_color': ('django.db.models.fields.CharField', [], {'default': "'grey'", 'max_length': '255'}), 'title': ('django.db.models.fields.CharField', [], {'max_length': '500'}), 'titles': ('django.db.models.fields.CharField', [], {'max_length': '1000', 'null': 'True'}), 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'categorys'", 'to': u"orm['auth.User']"}) }, u'sites.site': { 'Meta': {'ordering': "('domain',)", 'object_name': 'Site', 'db_table': "'django_site'"}, 'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) } } complete_apps = ['calendar']
bsd-2-clause
nahratzah/monsoon_plus_plus
intf/include/monsoon/interpolate.h
1173
#ifndef MONSOON_INTERPOLATE_H #define MONSOON_INTERPOLATE_H ///\file ///\ingroup intf #include <monsoon/intf_export_.h> #include <monsoon/metric_value.h> #include <monsoon/time_point.h> #include <optional> namespace monsoon { /** * \brief Interpolate a value at at time point, using linear interpolation. * \ingroup intf * * \param tp The time point for which to interpolate the metric value. * \param x A (time point, value) tuple before \p tp. * \param y A (time point, value) tuple after \p tp. * \return the interpolated metric value at \p tp, if it is computable. * If the interpolation fails, an empty optional is returned. * \throw std::invalid_argument * If \p x and \p y have the same time stamp * \throw std::invalid_argument * If \p tp is outside the range between \p x and \p y. * \throw std::invalid_argument * If \p tp is equal to either \p x or \p y. * \relates metric_value */ auto monsoon_intf_export_ interpolate(time_point tp, std::tuple<time_point, const metric_value&> x, std::tuple<time_point, const metric_value&> y) -> std::optional<metric_value>; } /* namespace monsoon */ #endif /* MONSOON_INTERPOLATE_H */
bsd-2-clause
Pushjet/Pushjet-Android
gradle/wrapper/dists/gradle-1.12-all/4ff8jj5a73a7zgj5nnzv1ubq0/gradle-1.12/docs/groovydoc/org/gradle/api/artifacts/dsl/ArtifactHandler.html
11848
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- **************************************************************** --> <!-- * PLEASE KEEP COMPLICATED EXPRESSIONS OUT OF THESE TEMPLATES, * --> <!-- * i.e. only iterate & print data where possible. Thanks, Jez. * --> <!-- **************************************************************** --> <html> <head> <!-- Generated by groovydoc (1.8.6) on Tue Apr 29 11:29:24 CEST 2014 --> <title>ArtifactHandler (Gradle API 1.12)</title> <meta name="date" content="2014-04-29"> <link href="../../../../../groovy.ico" type="image/x-icon" rel="shortcut icon"> <link href="../../../../../groovy.ico" type="image/x-icon" rel="icon"> <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="ArtifactHandler (Gradle API 1.12)"; } } </script> <noscript> </noscript> </head><body onload="windowTitle();" bgcolor="white"> <hr> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></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> <b>Groovy Documentation</b> </EM></TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><!--<FONT SIZE="-2"> &nbsp;<A HREF="../../../../../groovy/lang/ExpandoMetaClass.ExpandoMetaProperty.html" title="class in groovy.lang"><B>PREV CLASS</B></A>&nbsp; &nbsp;<A HREF="../../../../../groovy/lang/GroovyClassLoader.html" title="class in groovy.lang"><B>NEXT CLASS</B></A></FONT>--></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../index.html?org/gradle/api/artifacts/dsl/ArtifactHandler.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="ArtifactHandler.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<script type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../allclasses-frame.html"><B>All Classes</B></A>'); } //--> </script> <noscript> <A HREF="../../../../../allclasses-frame.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="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <!-- ======== START OF CLASS DATA ======== --> <H2> <FONT SIZE="-1"> org.gradle.api.artifacts.dsl</FONT> <BR> <span CLASS="ClassTitleFont">[Java] Interface ArtifactHandler</span></H2> <hr> <PRE>public&nbsp;interface ArtifactHandler </PRE> <P> This class is for defining artifacts to be published and adding them to configurations. Creating publish artifacts does not mean to create an archive. What is created is a domain object which represents a file to be published and information on how it should be published (e.g. the name). <p>To create an publish artifact and assign it to a configuration you can use the following syntax:</p> <code>&lt;configurationName> &lt;artifact-notation>, &lt;artifact-notation> ...</code> or <code>&lt;configurationName> &lt;artifact-notation> { ... some code to configure the artifact }</code> <p>The notation can be one of the following types:</p> <ul> <li><a href='../../../../../org/gradle/api/tasks/bundling/AbstractArchiveTask.html' title='AbstractArchiveTask'>AbstractArchiveTask</a>. The information for publishing the artifact is extracted from the archive task (e.g. name, extension, ...). An archive artifact is represented using an instance of PublishArtifact.</li> <li><a href='http://docs.oracle.com/javase/1.5.0/docs/api/java/io/File.html' title='File'>File</a>. The information for publishing the artifact is extracted from the file name. You can tweak the resulting values by using a closure to configure the properties of the artifact instance. A file artifact is represented using an instance of <a href='../../../../../org/gradle/api/artifacts/ConfigurablePublishArtifact.html' title='ConfigurablePublishArtifact'>ConfigurablePublishArtifact</a> </li> <li><a href='http://docs.oracle.com/javase/1.5.0/docs/api/java/util/Map.html' title='Map'>Map</a>. The map should contain a 'file' key. This is converted to an artifact as described above. You can also specify other properties of the artifact using entries in the map. </li> </ul> <h2>Examples</h2> <p>An example showing how to associate an archive task with a configuration via the artifact handler. This way the archive can be published or referred in other projects via the configuration. <pre autoTested=''> configurations { //declaring new configuration that will be used to associate with artifacts schema } task schemaJar(type: Jar) { //some imaginary task that creates a jar artifact with some schema } //associating the task that produces the artifact with the configuration artifacts { //configuration name and the task: schema schemaJar } </pre> </P> <hr> <!-- =========== NESTED CLASS SUMMARY =========== --> <A NAME="nested_summary"><!-- --></A> <!-- =========== ENUM CONSTANT SUMMARY =========== --> <A NAME="enum_constant_summary"><!-- --></A> <!-- =========== FIELD SUMMARY =========== --> <A NAME="field_summary"><!-- --></A> <!-- =========== PROPERTY SUMMARY =========== --> <A NAME="property_summary"><!-- --></A> <!-- =========== ELEMENT SUMMARY =========== --> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <A NAME="constructor_summary"><!-- --></A> <!-- ========== METHOD SUMMARY =========== --> <A NAME="method_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2" CLASS="ClassHeadingFont"> <B>Method Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1" CLASS="ClassItemFont"> <CODE><a href='../../../../../org/gradle/api/artifacts/PublishArtifact.html'>PublishArtifact</a></CODE></FONT> </TD> <TD> <CODE><b><a href="#add(java.lang.String, java.lang.Object)">add</a></b>(<a href='http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html' title='String'>String</a> configurationName, <a href='http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html' title='Object'>Object</a> artifactNotation)</CODE> <BR> <P>Adds an artifact to the given configuration.</P> </TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1" CLASS="ClassItemFont"> <CODE><a href='../../../../../org/gradle/api/artifacts/PublishArtifact.html'>PublishArtifact</a></CODE></FONT> </TD> <TD> <CODE><b><a href="#add(java.lang.String, java.lang.Object, groovy.lang.Closure)">add</a></b>(<a href='http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html' title='String'>String</a> configurationName, <a href='http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html' title='Object'>Object</a> artifactNotation, <a href='http://groovy.codehaus.org/gapi/groovy/lang/Closure.html' title='Closure'>Closure</a> configureClosure)</CODE> <BR> <P>Adds an artifact to the given configuration.</P> </TD> </TR> </TABLE> &nbsp; <P> <!-- ============ ENUM CONSTANT DETAIL ========== --> <A NAME="enum_constant_detail"><!-- --></A> <!-- =========== FIELD DETAIL =========== --> <A NAME="field_detail"><!-- --></A> <!-- =========== PROPERTY DETAIL =========== --> <A NAME="prop_detail"><!-- --></A> <!-- =========== ELEMENT DETAIL =========== --> <A NAME="element_detail"><!-- --></A> <!-- ========= CONSTRUCTOR DETAIL ======== --> <A NAME="constructor_detail"><!-- --></A> <!-- ============ 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="add(java.lang.String, java.lang.Object)"><!-- --></A><H3> add</H3> <PRE>public&nbsp;<a href='../../../../../org/gradle/api/artifacts/PublishArtifact.html'>PublishArtifact</a> <B>add</B>(<a href='http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html' title='String'>String</a> configurationName, <a href='http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html' title='Object'>Object</a> artifactNotation)</PRE> <DL> <DD> Adds an artifact to the given configuration. <DL><DT><B>Parameters:</B></DT><DD><code>configurationName</code> - The name of the configuration.</DD><DD><code>artifactNotation</code> - The artifact notation, in one of the notations described above.</DD></DL><DL><DT><B>Returns:</B></DT><DD>The artifact.</DD></DL> </DD> <P> </DL> <HR> <A NAME="add(java.lang.String, java.lang.Object, groovy.lang.Closure)"><!-- --></A><H3> add</H3> <PRE>public&nbsp;<a href='../../../../../org/gradle/api/artifacts/PublishArtifact.html'>PublishArtifact</a> <B>add</B>(<a href='http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html' title='String'>String</a> configurationName, <a href='http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html' title='Object'>Object</a> artifactNotation, <a href='http://groovy.codehaus.org/gapi/groovy/lang/Closure.html' title='Closure'>Closure</a> configureClosure)</PRE> <DL> <DD> Adds an artifact to the given configuration. <DL><DT><B>Parameters:</B></DT><DD><code>configurationName</code> - The name of the configuration.</DD><DD><code>artifactNotation</code> - The artifact notation, in one of the notations described above.</DD><DD><code>configureClosure</code> - The closure to execute to configure the artifact.</DD></DL><DL><DT><B>Returns:</B></DT><DD>The artifact.</DD></DL> </DD> <P> </DL> <HR> &nbsp; <!-- ========= END OF CLASS DATA ========= --> <p>Gradle API 1.12</p> <hr> </body> </html>
bsd-2-clause
ahoka/esrtk
BsdEthernet/sys/cdrio.h
5010
/*- * Copyright (c) 2000,2001,2002 Søren Schmidt <[email protected]> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer, * without modification, immediately at the beginning of the file. * 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. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. * * $FreeBSD: releng/10.2/sys/sys/cdrio.h 230132 2012-01-15 13:23:18Z uqs $ */ #ifndef _SYS_CDRIO_H_ #define _SYS_CDRIO_H_ #include <sys/ioccom.h> struct cdr_track { int datablock_type; /* data type code */ #define CDR_DB_RAW 0x0 /* 2352 bytes of raw data */ #define CDR_DB_RAW_PQ 0x1 /* 2368 bytes raw data + P/Q subchan */ #define CDR_DB_RAW_PW 0x2 /* 2448 bytes raw data + P-W subchan */ #define CDR_DB_RAW_PW_R 0x3 /* 2448 bytes raw data + P-W raw sub */ #define CDR_DB_RES_4 0x4 /* reserved */ #define CDR_DB_RES_5 0x5 /* reserved */ #define CDR_DB_RES_6 0x6 /* reserved */ #define CDR_DB_VS_7 0x7 /* vendor specific */ #define CDR_DB_ROM_MODE1 0x8 /* 2048 bytes Mode 1 (ISO/IEC 10149) */ #define CDR_DB_ROM_MODE2 0x9 /* 2336 bytes Mode 2 (ISO/IEC 10149) */ #define CDR_DB_XA_MODE1 0xa /* 2048 bytes Mode 1 (CD-ROM XA 1) */ #define CDR_DB_XA_MODE2_F1 0xb /* 2056 bytes Mode 2 (CD-ROM XA 1) */ #define CDR_DB_XA_MODE2_F2 0xc /* 2324 bytes Mode 2 (CD-ROM XA 2) */ #define CDR_DB_XA_MODE2_MIX 0xd /* 2332 bytes Mode 2 (CD-ROM XA 1/2) */ #define CDR_DB_RES_14 0xe /* reserved */ #define CDR_DB_VS_15 0xf /* vendor specific */ int preemp; /* preemphasis if audio track*/ int test_write; /* use test writes, laser turned off */ }; struct cdr_cue_entry { u_int8_t adr:4; u_int8_t ctl:4; u_int8_t track; u_int8_t index; u_int8_t dataform; u_int8_t scms; u_int8_t min; u_int8_t sec; u_int8_t frame; }; struct cdr_cuesheet { int32_t len; struct cdr_cue_entry *entries; int session_format; #define CDR_SESS_CDROM 0x00 #define CDR_SESS_CDI 0x10 #define CDR_SESS_CDROM_XA 0x20 int session_type; #define CDR_SESS_NONE 0x00 #define CDR_SESS_FINAL 0x01 #define CDR_SESS_RESERVED 0x02 #define CDR_SESS_MULTI 0x03 int test_write; }; struct cdr_format_capacity { u_int32_t blocks; u_int32_t reserved:2; u_int32_t type:6; u_int32_t param:24; }; struct cdr_format_capacities { u_int8_t reserved1[3]; u_int8_t length; u_int32_t blocks; u_int32_t type:2; u_int32_t reserved2:6; u_int32_t block_size:24; struct cdr_format_capacity format[32]; }; struct cdr_format_params { u_int8_t reserved; u_int8_t vs:1; u_int8_t immed:1; u_int8_t try_out:1; u_int8_t ip:1; u_int8_t stpf:1; u_int8_t dcrt:1; u_int8_t dpry:1; u_int8_t fov:1; u_int16_t length; struct cdr_format_capacity format; }; #define CDRIOCBLANK _IOW('c', 100, int) #define CDR_B_ALL 0x0 #define CDR_B_MIN 0x1 #define CDR_B_SESSION 0x6 #define CDRIOCNEXTWRITEABLEADDR _IOR('c', 101, int) #define CDRIOCINITWRITER _IOW('c', 102, int) #define CDRIOCINITTRACK _IOW('c', 103, struct cdr_track) #define CDRIOCSENDCUE _IOW('c', 104, struct cdr_cuesheet) #define CDRIOCFLUSH _IO('c', 105) #define CDRIOCFIXATE _IOW('c', 106, int) #define CDRIOCREADSPEED _IOW('c', 107, int) #define CDRIOCWRITESPEED _IOW('c', 108, int) #define CDR_MAX_SPEED 0xffff #define CDRIOCGETBLOCKSIZE _IOR('c', 109, int) #define CDRIOCSETBLOCKSIZE _IOW('c', 110, int) #define CDRIOCGETPROGRESS _IOR('c', 111, int) #define CDRIOCREADFORMATCAPS _IOR('c', 112, struct cdr_format_capacities) #define CDRIOCFORMAT _IOW('c', 113, struct cdr_format_params) #endif /* !_SYS_CDRIO_H_ */
bsd-2-clause
MasterAlish/django-ma-settings
ma_settings/master_settings.py
1876
from django.conf import settings from django.db.models.loading import get_model from models import MasterSetting, SettingTypes def get(name, default=None): try: setting = MasterSetting.objects.get(name=name) if setting.type == SettingTypes.INT: return int(setting.value) elif setting.type == SettingTypes.FLOAT: return float(setting.value) elif setting.type == SettingTypes.FOREIGN: model = get_model(*setting.foreign_model.split(".")) try: return model.objects.get(id=int(setting.value)) except model.DoesNotExist: return default elif setting.type == SettingTypes.CHOICES: return setting.value else: return setting.value except MasterSetting.DoesNotExist: return default def set(name, value): setting = MasterSetting.objects.get(name=name) if setting.type == SettingTypes.INT: setting.value = str(int(setting.value)) elif setting.type == SettingTypes.FLOAT: setting.value = str(float(setting.value)) elif setting.type == SettingTypes.FOREIGN: model = get_model(*setting.foreign_model.split(".")) try: object_ = model.objects.get(id=int(value.id)) setting.value = str(object_.id) except model.DoesNotExist: return None elif setting.type == SettingTypes.CHOICES: options_ = settings.MASTER_SETTINGS[setting.name]['options'] if value in options_: setting.value = value else: raise ValueError("Available options are: %s " % str(options_)) else: setting.value = value setting.save() def exists(name): try: MasterSetting.objects.get(name=name) return True except MasterSetting.DoesNotExist: return False
bsd-2-clause
mindbody/API-Examples
SDKs/Python/test/test_get_session_types_request.py
1006
# coding: utf-8 """ MINDBODY Public API No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 OpenAPI spec version: v6 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import unittest import swagger_client from swagger_client.models.get_session_types_request import GetSessionTypesRequest # noqa: E501 from swagger_client.rest import ApiException class TestGetSessionTypesRequest(unittest.TestCase): """GetSessionTypesRequest unit test stubs""" def setUp(self): pass def tearDown(self): pass def testGetSessionTypesRequest(self): """Test GetSessionTypesRequest""" # FIXME: construct object with mandatory attributes with example values # model = swagger_client.models.get_session_types_request.GetSessionTypesRequest() # noqa: E501 pass if __name__ == '__main__': unittest.main()
bsd-2-clause
brunolauze/MonoNative
MonoNative/mscorlib/System/Reflection/mscorlib_System_Reflection_AssemblySignatureKeyAttribute.h
3274
#ifndef __MONO_NATIVE_MSCORLIB_SYSTEM_REFLECTION_ASSEMBLYSIGNATUREKEYATTRIBUTE_H #define __MONO_NATIVE_MSCORLIB_SYSTEM_REFLECTION_ASSEMBLYSIGNATUREKEYATTRIBUTE_H #include <mscorlib/System/mscorlib_System_Attribute.h> #include <mscorlib/System/mscorlib_System_String.h> #include <mscorlib/System/Runtime/InteropServices/mscorlib_System_Runtime_InteropServices__Attribute.h> #include <mscorlib/System/mscorlib_System_Object.h> namespace mscorlib { namespace System { class Type; } } namespace mscorlib { namespace System { namespace Reflection { class AssemblySignatureKeyAttribute : public mscorlib::System::Attribute , public virtual mscorlib::System::Runtime::InteropServices::_Attribute { public: AssemblySignatureKeyAttribute(mscorlib::System::String publicKey, mscorlib::System::String countersignature) : mscorlib::System::Attribute(mscorlib::NativeTypeInfo::GetTypeInfo("mscorlib","System.Reflection.AssemblySignatureKeyAttribute")) , mscorlib::System::Runtime::InteropServices::_Attribute(NULL) { MonoType *__parameter_types__[2]; void *__parameters__[2]; __parameter_types__[0] = Global::GetType("mscorlib", "System", "String"); __parameter_types__[1] = Global::GetType("mscorlib", "System", "String"); __parameters__[0] = (MonoObject*)publicKey; __parameters__[1] = (MonoObject*)countersignature; __native_object__ = Global::New("mscorlib", "System.Reflection", "AssemblySignatureKeyAttribute", 2, __parameter_types__, __parameters__); }; AssemblySignatureKeyAttribute(mscorlib::NativeTypeInfo *nativeTypeInfo) : mscorlib::System::Attribute(nativeTypeInfo) , mscorlib::System::Runtime::InteropServices::_Attribute(NULL) { }; AssemblySignatureKeyAttribute(MonoObject *nativeObject) : mscorlib::System::Attribute(nativeObject) , mscorlib::System::Runtime::InteropServices::_Attribute(nativeObject) { }; ~AssemblySignatureKeyAttribute() { }; AssemblySignatureKeyAttribute & operator=(AssemblySignatureKeyAttribute &value) { __native_object__ = value.GetNativeObject(); return value; }; bool operator==(AssemblySignatureKeyAttribute &value) { return mscorlib::System::Object::Equals(value); }; operator MonoObject*() { return __native_object__; }; MonoObject* operator=(MonoObject* value) { return __native_object__ = value; }; virtual MonoObject* GetNativeObject() override { return __native_object__; }; //Public Properties __declspec(property(get=get_PublicKey, put=set_PublicKey)) mscorlib::System::String PublicKey; __declspec(property(get=get_Countersignature, put=set_Countersignature)) mscorlib::System::String Countersignature; __declspec(property(get=get_TypeId)) mscorlib::System::Object TypeId; //Get Set Properties Methods // Get/Set:PublicKey mscorlib::System::String get_PublicKey() const; void set_PublicKey(mscorlib::System::String value); // Get/Set:Countersignature mscorlib::System::String get_Countersignature() const; void set_Countersignature(mscorlib::System::String value); // Get:TypeId mscorlib::System::Object get_TypeId() const; protected: private: }; } } } #endif
bsd-2-clause
gdey/go-challange-battleship
battleship/ship_type.go
1552
package battleship type ShipType uint8 const ( Missed ShipType = iota Hit AircraftCarrier Battleship Submarine Destroyer Cruiser PatrolBoat ) func (st ShipType) Mark() string { s := "\u2573\u29BFA*CARRIERDESTR*SUB*SHIP*BCRUIS" switch st { case Missed: return s[0:3] //"\u2573" case Hit: return s[3:6] //"\u29BF" case AircraftCarrier: return s[6:15] //"A*CARRIER" case Destroyer: return s[15:20] //"DESTR" case Submarine: return s[20:25] //"*SUB*" case Battleship: return s[23:30] //"B*SHIP*" case PatrolBoat: return s[28:31] //"P*B" case Cruiser: return s[31:] //"CRUIS" default: return "" } } func (st ShipType) String() string { switch st { case Missed: return "missed" case Hit: return "hit" case AircraftCarrier: return "aircraft carrier" case Destroyer: return "destroyer" case Submarine: return "submarine" case Battleship: return "battleship" case PatrolBoat: return "patrol boat" case Cruiser: return "cruiser" default: return "" } } func (st ShipType) Size() int { switch st { case Missed: return 1 case Hit: return 1 case AircraftCarrier: return 5 case Destroyer: return 3 case Submarine: return 3 case Battleship: return 4 case PatrolBoat: return 2 case Cruiser: return 3 default: return 0 } } func (st ShipType) Score() int { switch st { case AircraftCarrier: return 20 case Destroyer: return 6 case Submarine: return 6 case Battleship: return 12 case PatrolBoat: return 2 case Cruiser: return 6 default: return 0 } }
bsd-2-clause
wyc/utwil
call_test.go
584
package utwil import ( "encoding/json" "fmt" "testing" ) // This test calls ToPhoneNumber and also forwards the call to ToPhoneNumber. // ToPhoneNumber should expect two calls. func TestCall(t *testing.T) { callbackPostURL := fmt.Sprintf("http://twimlets.com/forward?PhoneNumber=%s", ToPhoneNumber) call, err := TestClient.Call(FromPhoneNumber, ToPhoneNumber, callbackPostURL) if err != nil { t.Fatalf("Failed: %s", err.Error()) } bs, err := json.MarshalIndent(call, "", " ") if err != nil { t.Fatalf("Failed: %s", err.Error()) } t.Logf("Call:\n%s\n", string(bs)) }
bsd-2-clause
hrkfdn/pyle
templates/dirlist.html
807
{% extends "layout.html" %} {% block content %} <div class="panel panel-primary"> <div class="panel-heading"><h3 class="panel-title">Directory Index</h3></div> <table class="table table-hover table-condensed table-bordered"> {% for dir in directories %} <ul style="list-style: none;"> <li> <span class="glyphicon glyphicon-folder-close"></span> <a href="{{ "/list" ~ path ~ dir }}">{{ dir }}</a> </li> </ul> {% endfor %} {% for file in files %} <ul style="list-style: none;"> <li> <span class="glyphicon glyphicon-file"></span> <a href="{{ path ~ file }}">{{ file }}</a> </li> </ul> {% endfor %} </table> </div> {% endblock content %}
bsd-2-clause
maxeler/Brain-Network
APP/CPUCode/gui/src/com/maxeler/brainnetwork/gui/ComputeButton.java
2215
/********************************************************************* * Maxeler Technologies: BrainNetwork * * * * Version: 1.2 * * Date: 05 July 2013 * * * * GUI code source file * * * *********************************************************************/ package com.maxeler.brainnetwork.gui; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JToggleButton; //Toggle button used to start/stop the demo public class ComputeButton extends JToggleButton implements ActionListener, Runnable{ //UID generated for component serialization private static final long serialVersionUID = -145094948834407005L; //Reference to image correlation kernel and speed-up private LinearCorrelation [] kernel = null; private SpeedUpTextField speedup = null; //Constructor public ComputeButton (LinearCorrelation [] kernel, SpeedUpTextField speedup){ //Instantiate a toggle button initialized to false super("Compute",false); //Store external references this.kernel = kernel; this.speedup = speedup; //Button size setSize(150,40); //In order to react to action on the button addActionListener(this); } //Describe reaction to event @Override public void actionPerformed(ActionEvent actionEvent) { //Trigger a new thread to manage the event Thread t = new Thread(this); t.start(); } //Thread to manage the event @Override public void run() { //Deactivate the button until the threads end setEnabled(false); //Switch the running flag according to the status BrainNetwork.running = isSelected(); //When stop execution, restart all the correlation kernel if (!BrainNetwork.running) for (int i=0; i<kernel.length; ++i){ kernel[i].restart(); } else speedup.resetToZero(); //Finally, reactivate the button setEnabled(true); } }
bsd-2-clause
mustpax/sortmybox
app/views/Admin/usageStats.html
479
#{extends 'Admin/header.html' /} #{set title:'Usage stats'/} #{set usageStats:'active'/} <link rel="stylesheet" href="#{static-path '/public/css/nv.d3.css' /}"> <div class="charts"> </div> #{set 'script'} <script type="text/javascript" src="#{static-path '/public/js/d3.v2.js' /}"></script> <script type="text/javascript" src="#{static-path '/public/js/nv.d3.js' /}"></script> <script type="text/javascript" src="#{static-path '/public/js/usageStats.js' /}"></script> #{/set}
bsd-2-clause
maikgreubel/phpgenerics
src/Generics/Streams/StandardOutputStream.php
2960
<?php /** * This file is part of the PHP Generics package. * * @package Generics */ namespace Generics\Streams; use Generics\Streams\Interceptor\StreamInterceptor; use Countable; /** * This class provides a stream for standard output * * @author Maik Greubel <[email protected]> */ class StandardOutputStream implements OutputStream { /** * Interceptor * * @var StreamInterceptor */ private $interceptor; /** * The standard out channel * * @var resource */ private $stdout; /** * Create a new instance of StandardOutputStream */ public function __construct() { $this->open(); } /** * Opens a new standard output channel */ private function open() { $this->stdout = fopen("php://stdout", "w"); } /** * * {@inheritdoc} * @see \Generics\Streams\Stream::isOpen() */ public function isOpen(): bool { return is_resource($this->stdout); } /** * * {@inheritdoc} * @see \Generics\Streams\OutputStream::flush() */ public function flush() { if ($this->isOpen()) { fflush($this->stdout); } if ($this->interceptor instanceof StreamInterceptor) { $this->interceptor->reset(); } } /** * * {@inheritdoc} * @see \Generics\Streams\Stream::ready() */ public function ready(): bool { return $this->isOpen(); } /** * * {@inheritdoc} * @see Countable::count() */ public function count() { return 0; } /** * * {@inheritdoc} * @see \Generics\Resettable::reset() */ public function reset() { $this->close(); $this->open(); if ($this->interceptor instanceof StreamInterceptor) { $this->interceptor->reset(); $this->setInterceptor($this->interceptor); } } /** * * {@inheritdoc} * @see \Generics\Streams\OutputStream::write() */ public function write($buffer) { if ($this->isWriteable()) { fwrite($this->stdout, $buffer); } } /** * * {@inheritdoc} * @see \Generics\Streams\Stream::close() */ public function close() { if ($this->isOpen()) { fclose($this->stdout); $this->stdout = null; } } /** * * {@inheritdoc} * @see \Generics\Streams\OutputStream::isWriteable() */ public function isWriteable(): bool { return $this->isOpen(); } /** * Apply a stream interceptor * * @param StreamInterceptor $interceptor */ public function setInterceptor(StreamInterceptor $interceptor) { $this->interceptor = $interceptor; stream_filter_append($this->stdout, $interceptor->getFilterName()); } }
bsd-2-clause
genomearchitect/genomearchitect.github.io
_includes/head.html
1002
{% include base_path %} <meta charset="utf-8"> {% include seo.html %} <link href="{{ base_path }}/feed.xml" type="application/atom+xml" rel="alternate" title="{{ site.title }} Feed"> <!-- http://t.co/dKP3o1e --> <meta name="HandheldFriendly" content="True"> <meta name="MobileOptimized" content="320"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <script> document.documentElement.className = document.documentElement.className.replace(/\bno-js\b/g, '') + ' js '; </script> <!--<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">--> <!--<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>--> <!-- For all browsers --> <link rel="stylesheet" href="{{ base_path }}/assets/css/main.css"> <!--<link rel="icon" href="{{ base_path }}/favicon.ico" type="image/x-icon" />--> <link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon" /> <meta http-equiv="cleartype" content="on">
bsd-2-clause
vilmospapp/jodd
jodd-core/src/main/python/ConvertBean.py
4825
# Copyright (c) 2003-present, Jodd Team (http://jodd.org) # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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. f = open('ConvertBean.java', 'r') java = f.read() f.close() genStart = java.find('@@generated') java = java[0:genStart + 11] ### ----------------------------------------------------------------- types = [ [0, 'Boolean', 'boolean', 'false'], [2, 'Integer', 'int', '0'], [4, 'Long', 'long', '0'], [6, 'Float', 'float', '0'], [8, 'Double', 'double', '0'], [10, 'Short', 'short', '(short) 0'], [12, 'Character', 'char', '(char) 0'], [14, 'Byte', 'byte', '(byte) 0'], ] template = ''' /** * Converts value to <code>$T</code>. */ public $T to$T(Object value) { return ($T) typeConverters[#].convert(value); } /** * Converts value to <code>$T</code>. Returns default value * when conversion result is <code>null</code> */ public $T to$T(Object value, $T defaultValue) { $T result = ($T) typeConverters[#].convert(value); if (result == null) { return defaultValue; } return result; } /** * Converts value to <code>$t</code>. Returns default value * when conversion result is <code>null</code>. */ public $t to$PValue(Object value, $t defaultValue) { $T result = ($T) typeConverters[#++].convert(value); if (result == null) { return defaultValue; } return result.$tValue(); } /** * Converts value to <code>$t</code> with common default value. */ public $t to$PValue(Object value) { return to$PValue(value, $D); } ''' for type in types: # small type data = template data = data.replace('#++', str(type[0] + 1)) data = data.replace('#', str(type[0])) data = data.replace('$T', type[1]) data = data.replace('$t', type[2]) data = data.replace('$P', type[2].title()) data = data.replace('$D', type[3]) java += data ### ----------------------------------------------------------------- types = [ [16, 'boolean[]', 'BooleanArray', 0], [17, 'int[]', 'IntegerArray', 0], [18, 'long[]', 'LongArray', 0], [19, 'float[]', 'FloatArray', 0], [20, 'double[]', 'DoubleArray', 0], [21, 'short[]', 'ShortArray', 0], [22, 'char[]', 'CharacterArray', 0], [23, 'String', 'String', 1], [24, 'String[]', 'StringArray', 0], [25, 'Class', 'Class', 0], [26, 'Class[]', 'ClassArray', 0], [27, 'JDateTime', 'JDateTime', 1], [28, 'Date', 'Date', 1], [29, 'Calendar', 'Calendar', 1], [30, 'BigInteger', 'BigInteger', 1], [31, 'BigDecimal', 'BigDecimal', 1], ] template = ''' /** * Converts value to <code>$T</code>. */ public $T to$N(Object value) { return ($T) typeConverters[#].convert(value); } ''' template2 = ''' /** * Converts value to <code>$T</code>. Returns default value * when conversion result is <code>null</code> */ public $T to$N(Object value, $T defaultValue) { $T result = ($T) typeConverters[#].convert(value); if (result == null) { return defaultValue; } return result; } ''' for type in types: # small type data = template data = data.replace('#', str(type[0])) data = data.replace('$T', type[1]) data = data.replace('$N', type[2]) java += data if type[3] == 1: data = template2 data = data.replace('#', str(type[0])) data = data.replace('$T', type[1]) data = data.replace('$N', type[2]) java += data ### ----------------------------------------------------------------- java += '}' f = open('ConvertBean.java', 'w') f.write(java) f.close()
bsd-2-clause
kbsriram/keypan
src/core/com/kbsriram/keypan/core/CUtils.java
3841
package com.kbsriram.keypan.core; import java.io.IOException; import java.io.Reader; import java.util.regex.Pattern; public final class CUtils { public final static String byte2hex(byte[] b) { StringBuilder sb = new StringBuilder(); for (int i=0; i<b.length; i++) { int v = b[i] & 0xff; sb.append(s_byte2hex[v >> 4]); sb.append(s_byte2hex[v & 0xf]); } return sb.toString(); } public final static String asString(Reader r) throws IOException { char[] buf = new char[2048]; int nread; StringBuilder sb = new StringBuilder(); while ((nread = r.read(buf)) > 0) { sb.append(buf, 0, nread); } return sb.toString(); } public final static String groupedFingerprint(String fp) { if (fp.length() != 40) { throw new IllegalArgumentException("bad fp"); } StringBuilder sb = new StringBuilder(); for (int i=0; i<40; i+=4) { if (i > 0) { sb.append(" "); } sb.append(fp.substring(i, i+4)); } return sb.toString().toLowerCase(); } public final static Pattern asPattern(String fp) { if (fp.length() != 40) { throw new IllegalArgumentException("bad fp"); } StringBuilder sb = new StringBuilder(); for (int i=0; i<40; i+=4) { if (i > 0) { sb.append("[\\p{Z}\\s]*"); } sb.append(fp.substring(i, i+4)); } return Pattern.compile(sb.toString(), Pattern.CASE_INSENSITIVE); } public final static <T> void lognote(Class<T> cls, String msg) { if (s_debug) { System.out.println("NOTE: "+cls.getSimpleName()+": "+msg); return; } int mlen = msg.length(); if (mlen > MAX_NOTE_LEN) { msg = msg.substring(0, MAX_NOTE_LEN-3)+"..."; mlen = MAX_NOTE_LEN; } System.out.print(msg); int delta = (MAX_NOTE_LEN - msg.length()); while (delta > 0) { System.out.print(" "); delta--; } if (s_cli) { System.out.print("\r"); } else { System.out.println(); } System.out.flush(); } public final static void clear() { if (s_debug) { return; } for (int i=0; i<MAX_NOTE_LEN; i++) { System.out.print(" "); } System.out.print("\r"); System.out.flush(); } public final static String nullIfEmpty(String s) { if ((s == null) || (s.length() == 0)) { return null; } else { return s; } } public final static void setDebug(boolean v) { s_debug = v; } public final static void setCLI(boolean v) { s_cli = v; } public final static boolean isDebug() { return s_debug; } public final static <T> void logw(Class<T> cls, String msg) { logw(cls, msg, null); } public final static <T> void logw(Class<T> cls, String msg, Throwable th) { System.err.println("WARN: "+cls.getSimpleName()+": "+msg); if (th != null) { th.printStackTrace(); } } public final static <T> void logd(Class<T> cls, String msg) { logd(cls, msg, null); } public final static <T> void logd(Class<T> cls, String msg, Throwable th) { if (s_debug) { System.err.println("DEBUG: "+cls.getSimpleName()+": "+msg); if (th != null) { th.printStackTrace(); } } } private static boolean s_debug = false; private static boolean s_cli = true; private final static int MAX_NOTE_LEN = 35; private final static char[] s_byte2hex = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; }
bsd-2-clause
sarbi127/inviwo
include/inviwo/qt/editor/inviwoqteditordefine.h
2133
/********************************************************************************* * * Inviwo - Interactive Visualization Workshop * * Copyright (c) 2013-2015 Inviwo Foundation * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *********************************************************************************/ #ifndef _IVW_QTEDITOR_DEFINE_H_ #define _IVW_QTEDITOR_DEFINE_H_ #ifdef INVIWO_ALL_DYN_LINK //DYNAMIC // If we are building DLL files we must declare dllexport/dllimport #ifdef IVW_QTEDITOR_EXPORTS #ifdef _WIN32 #define IVW_QTEDITOR_API __declspec(dllexport) #else //UNIX (GCC) #define IVW_QTEDITOR_API __attribute__ ((visibility ("default"))) #endif #else #ifdef _WIN32 #define IVW_QTEDITOR_API __declspec(dllimport) #else #define IVW_QTEDITOR_API #endif #endif #else //STATIC #define IVW_QTEDITOR_API #endif #endif /* _IVW_QTEDITOR_DEFINE_H_ */
bsd-2-clause
vwilson/CS499-Shortest-Path
CS499/src/main/java/cs499blue/models/Edge.java
887
package cs499blue.models; import cs499blue.algorithms.Distance; /** * author: vwilson * date: 4/1/14 */ public class Edge { private Vertex a, b; public Edge(Vertex a, Vertex b) { this.a = a; this.b = b; } public Vertex getA() { return a; } public Vertex getB() { return b; } public Double getWeight() { return Distance.distanceFrom(a, b); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Edge edge = (Edge) o; if (!a.equals(edge.a)) return false; if (!b.equals(edge.b)) return false; return true; } @Override public int hashCode() { int result = a.hashCode(); result = 31 * result + b.hashCode(); return result; } }
bsd-2-clause
dbaxa/django_xss_detection
django_xss_detection/test_templates/tags/ifequal.html
586
{% ifequal user.id comment.user_id %} <div type="vuln" name="ifequal_if_vulnerability"> {{ ifequal_if_vulnerability | safe }} </div> {% else %} <div type="vuln" name="ifequal_else_vulnerability"> {{ ifequal_else_vulnerability | safe }} </div> {% endifequal %} {% ifnotequal user.id comment.user_id %} <div type="vuln" name="ifnotequal_vulnerability"> {{ ifnotequal_vulnerability | safe }} </div> {{ not_a_vuln }} {% else %} <div type="vuln" name="ifnotequal_else_vulnerability"> {{ ifnotequal_else_vulnerability | safe }} </div> {{ not_a_vuln }} {% endifnotequal %}
bsd-2-clause
wushuyi/newClassSystem
server/routes/index.js
309
var express = require('express'); var router = express.Router(); /* GET home page. */ router.get('/', function(req, res, next) { res.render('index', { title: 'Express' }); }); router.get('/socket', function(req, res, next){ res.render('socket', {title: 'socket.io test'}) }); module.exports = router;
bsd-2-clause
OutOfTheVoid/FRC-2605-Robot-Code-2014
src/BallPickupBehavior.h
1501
#ifndef SHS_2605_BALL_PICKUP_BEHAVIOR_H #define SHS_2605_BALL_PICKUP_BEHAVIOR_H #include "WPILib.h" #include "Behaviors/Behavior.h" #include "Util/Delegate.h" #include "Controls/NumericStepper.h" #include "SubSystems/MecanumDrive.h" #include "SubSystems/ShooterBelts.h" #include "SubSystems/CollectorArms.h" #include "SubSystems/ShooterWinch.h" #include "Sensors/IRDistanceSensor.h" #include "Logging/Logger.h" #define ANGLE_BALL_PICKUP 0.18 #define ANGLE_BALL_CLAMP 0.0 #define POSITION_LEFT_PICKUP 0.90 #define POSITION_RIGHT_PICKUP 1.10 #define BALL_THRESHOLD 0.25 #define POSITION_LEFT_CLAMP 0.60 #define POSITION_RIGHT_CLAMP 0.92 class BallPickupBehavior : public Behavior { public: BallPickupBehavior ( MecanumDrive * Drive, CollectorArms * Arms, ShooterWinch * Winch, ShooterBelts * Belts, NumericStepper * Gear, Delegate <void> * OnShift, IRDistanceSensor * BallSensor, DigitalInput * BallLimit ); ~BallPickupBehavior (); void Start (); void Restart (); void Update (); void Stop (); bool IsDone (); private: typedef enum { STATE_START = 0, STATE_DRIVE_BACK, STATE_PICKUP, STATE_FINISHED } BallPickupState; BallPickupState State; bool Done; // Drive MecanumDrive * Drive; Delegate <void> * OnShift; NumericStepper * Gear; // Belts ShooterBelts * Belts; // Arms CollectorArms * Arms; // Winch ShooterWinch * Winch; // Ball sensors IRDistanceSensor * BallSensor; DigitalInput * BallLimit; // Logging Logger * Log; }; #endif
bsd-2-clause
bear/rsinfo
rsinfo.py
6094
#!/usr/bin/env python # # :copyright: (c) 2013 by Mike Taylor # :author: Mike Taylor # :license: BSD 2-Clause # # See LICENSE file for details # import os import time import json import argparse import pyrax _data_centers = [ 'DFW', 'ORD' ] _commands = [ 'list' ] _config_file = '~/.rackspace.cfg' _username = 'ops' _server_info_keys = ( 'accessIPv4', 'status', 'name' ) _marker = '##### auto-generated for rsinfo #####' _usage = """ list list details for the servers If a server name is specified, the list will only contain that server If a datacenter has been given, the list will only contain those servers hosts generate output that can be used in /etc/hosts ssh generate output that can be used in ~/.ssh/config Config File Format: [rackspace_cloud] username = USERNAME api_key = KEY """ def loadConfig(): parser = argparse.ArgumentParser(epilog=_usage, formatter_class=argparse.RawDescriptionHelpFormatter) parser.add_argument('-c', '--config', default=_config_file, help='where to retrieve configuration items and the rackspace API keys (default: %(default)s)') parser.add_argument('-d', '--datacenter', default='ALL', help='datacenter to work within (default: %(default)s)', choices=_data_centers) parser.add_argument('-s', '--server', help='limit output to the named server') parser.add_argument('command', choices=['list', 'hosts', 'ssh']) return parser.parse_args() def initCredentials(datacenter): pyrax.set_setting("identity_type", "rackspace") pyrax.set_credential_file(os.path.expanduser(cfg.config), datacenter) def loadServers(datacenters): # {'OS-EXT-STS:task_state': None, # 'addresses': { u'public': [], # u'private': [] # }, # 'links': [], # 'image': { u'id': u'GUID', # u'links': [] # }, # 'manager': <novaclient.v1_1.servers.ServerManager object at 0x101abb450>, # 'OS-EXT-STS:vm_state': u'active', # 'flavor': { u'id': u'2', # u'links': [] # }, # 'id': u'', # 'user_id': u'NNN', # 'OS-DCF:diskConfig': u'AUTO', # 'accessIPv4': u'', # 'accessIPv6': u'', # 'progress': 100, # 'OS-EXT-STS:power_state': 1, # 'metadata': {}, # 'status': u'ACTIVE', # 'updated': u'2013-04-25T05:11:09Z', # 'hostId': u'', # 'key_name': None, # 'name': u'sssss', # 'created': u'2013-02-11T19:33:31Z', # 'tenant_id': u'NNN', # '_info': {}, # 'config_drive': u'', # '_loaded': True # } result = {} for dc in datacenters: initCredentials(dc) print 'searching for servers in', dc cs = pyrax.cloudservers for s in cs.servers.list(detailed=True): if s.name not in result: result[s.name] = None result[s.name] = s print len(result), 'servers processed' return result def loadFileWithoutAutoGeneratedItems(filename, marker): print 'loading', filename result = [] f = False for line in open(filename, 'r').readlines(): if line.startswith(marker): f = not f else: if not f: result.append(line) return result def saveFile(filepath, filename, cleandata, newdata, marker, allowAlt=False): fullname = os.path.join(filepath, filename) print 'saving', fullname try: h = open(fullname, 'w+') h.write(''.join(cleandata)) h.write('\n%s\n' % marker) h.write(''.join(newdata)) h.write('\n%s\n' % marker) except IOError: print 'unable to write to', fullname if allowAlt: print 'attempting alternate location' saveFile('/tmp', filename, cleandata, newdata, marker) def getServerInfo(serverName, serverList): result = None if cfg.datacenter == 'ALL': s = ' in server list' else: s = ' in datacenter %s' % cfg.datacenter if serverName not in serverList: print '%s not found %s' % (serverName, s) else: item = serverList[serverName] result = {} for key in _server_info_keys: result[key] = item.__getattr__(key) return result _hosts_config = """%(accessIPv4)s\t%(name)s\n""" def generateHostsFile(servers): clean = loadFileWithoutAutoGeneratedItems('/etc/hosts', _marker) new = [] for s in servers: r = getServerInfo(s, servers) new.append(_hosts_config % r) saveFile('/etc', 'hosts', clean, new, _marker, allowAlt=True) _ssh_config = """Host %(name)s User %(username)s StrictHostKeyChecking no IdentityFile ~/.ssh/id_rsa """ def generateConfigFile(servers): clean = loadFileWithoutAutoGeneratedItems('~/.ssh/config', _marker) new = [] for s in servers: r = getServerInfo(s, servers) r['username'] = _username new.append(_ssh_config % r) saveFile('~/.ssh', 'config', clean, new, _marker, allowAlt=True) def getCommandParam(cmdText, commands): try: p = commands.index(cmdText) result = commands[p + 1] except: result = '' return result if __name__ == '__main__': cfg = loadConfig() if cfg.datacenter == 'ALL': datacenters = _data_centers else: datacenters = [ datacenter ] servers = loadServers(datacenters) if cfg.command == 'list': results = [] if cfg.server is None: for s in servers: r = getServerInfo(s, servers) if r is not None: results.append(r) else: r = getServerInfo(cfg.server, servers) if r is not None: results.append(r) print json.dumps(results) elif cfg.command == 'hosts': generateHostsFile(servers) elif cfg.command == 'ssh': generateConfigFile(servers)
bsd-2-clause
bfontaine/homebrew-core
5617
class PerconaServerAT56 < Formula desc "Drop-in MySQL replacement" homepage "https://www.percona.com" url "https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-5.6.37-82.2/source/tarball/percona-server-5.6.37-82.2.tar.gz" version "5.6.37-82.2" sha256 "3cf04b64c8bf5b9cc1ea1a68c54ba77a4709d9c9051314e70a4cbd4c904da702" bottle do sha256 "2eca6a7f69f893abeadf61df5eccc97510099686275140f1934e5ee8122c202f" => :high_sierra sha256 "a5dc522f52d0c853b2ff04291884156111729f67379b24fa7d7022bcd3347632" => :sierra sha256 "a9ba8cad6f5237e783ad3495206f3ba63365fff78048e34008f23cdd500a2c90" => :el_capitan sha256 "ef56b2abe4ad121257e62cc4178c459dc034407b18ffc06bea6cf39c60d7286b" => :yosemite end keg_only :versioned_formula option "with-test", "Build with unit tests" option "with-embedded", "Build the embedded server" option "with-memcached", "Build with InnoDB Memcached plugin" option "with-local-infile", "Build with local infile loading support" depends_on "cmake" => :build depends_on "pidof" unless MacOS.version >= :mountain_lion depends_on "openssl" # Where the database files should be located. Existing installs have them # under var/percona, but going forward they will be under var/mysql to be # shared with the mysql and mariadb formulae. def datadir @datadir ||= (var/"percona").directory? ? var/"percona" : var/"mysql" end pour_bottle? do reason "The bottle needs a var/mysql datadir (yours is var/percona)." satisfy { datadir == var/"mysql" } end def install # Don't hard-code the libtool path. See: # https://github.com/Homebrew/homebrew/issues/20185 inreplace "cmake/libutils.cmake", "COMMAND /usr/bin/libtool -static -o ${TARGET_LOCATION}", "COMMAND libtool -static -o ${TARGET_LOCATION}" args = std_cmake_args + %W[ -DMYSQL_DATADIR=#{datadir} -DINSTALL_PLUGINDIR=lib/plugin -DSYSCONFDIR=#{etc} -DINSTALL_MANDIR=#{man} -DINSTALL_DOCDIR=#{doc} -DINSTALL_INFODIR=#{info} -DINSTALL_INCLUDEDIR=include/mysql -DINSTALL_MYSQLSHAREDIR=#{share.basename}/mysql -DWITH_SSL=yes -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DCOMPILATION_COMMENT=Homebrew -DWITH_EDITLINE=system -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_VERBOSE_MAKEFILE=ON ] # PAM plugin is Linux-only at the moment args.concat %w[ -DWITHOUT_AUTH_PAM=1 -DWITHOUT_AUTH_PAM_COMPAT=1 -DWITHOUT_DIALOG=1 ] # TokuDB is broken on MacOsX # https://bugs.launchpad.net/percona-server/+bug/1531446 args.concat %w[-DWITHOUT_TOKUDB=1] # To enable unit testing at build, we need to download the unit testing suite if build.with? "test" args << "-DENABLE_DOWNLOADS=ON" else args << "-DWITH_UNIT_TESTS=OFF" end # Build the embedded server args << "-DWITH_EMBEDDED_SERVER=ON" if build.with? "embedded" # Build with InnoDB Memcached plugin args << "-DWITH_INNODB_MEMCACHED=ON" if build.with? "memcached" # Build with local infile loading support args << "-DENABLED_LOCAL_INFILE=1" if build.with? "local-infile" system "cmake", ".", *std_cmake_args, *args system "make" system "make", "install" # Don't create databases inside of the prefix! # See: https://github.com/Homebrew/homebrew/issues/4975 rm_rf prefix+"data" # Link the setup script into bin bin.install_symlink prefix/"scripts/mysql_install_db" # Fix up the control script and link into bin inreplace "#{prefix}/support-files/mysql.server", /^(PATH=".*)(")/, "\\1:#{HOMEBREW_PREFIX}/bin\\2" bin.install_symlink prefix/"support-files/mysql.server" # mysqlaccess deprecated on 5.6.17, and removed in 5.7.4. # See: https://bugs.mysql.com/bug.php?id=69012 # Move mysqlaccess to libexec libexec.mkpath mv "#{bin}/mysqlaccess", libexec mv "#{bin}/mysqlaccess.conf", libexec # Install my.cnf that binds to 127.0.0.1 by default (buildpath/"my.cnf").write <<-EOS.undent # Default Homebrew MySQL server config [mysqld] # Only allow connections from localhost bind-address = 127.0.0.1 EOS etc.install "my.cnf" end def post_install # Make sure that data directory exists datadir.mkpath unless File.exist? "#{datadir}/mysql/user.frm" ENV["TMPDIR"] = nil system "#{bin}/mysql_install_db", "--verbose", "--user=#{ENV["USER"]}", "--basedir=#{prefix}", "--datadir=#{datadir}", "--tmpdir=/tmp" end end def caveats; <<-EOS.undent A "/etc/my.cnf" from another install may interfere with a Homebrew-built server starting up correctly. MySQL is configured to only allow connections from localhost by default To connect: mysql -uroot EOS end plist_options :manual => "mysql.server start" def plist; <<-EOS.undent <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>KeepAlive</key> <true/> <key>Label</key> <string>#{plist_name}</string> <key>Program</key> <string>#{opt_bin}/mysqld_safe</string> <key>RunAtLoad</key> <true/> <key>WorkingDirectory</key> <string>#{var}</string> </dict> </plist> EOS end test do system "/bin/sh", "-n", "#{bin}/mysqld_safe" (prefix/"mysql-test").cd do system "./mysql-test-run.pl", "status", "--vardir=#{testpath}" end end end
bsd-2-clause
sebastienros/jint
Jint.Tests.Test262/test/language/statements/for-of/dstr-obj-id-identifier-resolution-last.js
1252
// This file was procedurally generated from the following sources: // - src/dstr-assignment/obj-id-identifier-resolution-last.case // - src/dstr-assignment/default/for-of.template /*--- description: Evaluation of DestructuringAssignmentTarget (last of many) (For..of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation es6id: 13.7.5.11 features: [destructuring-binding] flags: [generated] info: | IterationStatement : for ( LeftHandSideExpression of AssignmentExpression ) Statement 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« », AssignmentExpression, iterate). 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement, keyResult, assignment, labelSet). 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation [...] 4. If destructuring is true and if lhsKind is assignment, then a. Assert: lhs is a LeftHandSideExpression. b. Let assignmentPattern be the parse of the source text corresponding to lhs using AssignmentPattern as the goal symbol. [...] ---*/ var x = null; var w; var counter = 0; for ({ w, x } of [{ x: 4 }]) { assert.sameValue(x, 4); counter += 1; } assert.sameValue(counter, 1);
bsd-2-clause
Devronium/ConceptApplicationServer
core/server/Samples/CIDE/Help/-standard.net.ym.html
23302
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>-standard.net.ym</title> <link href="css/style.css" rel="stylesheet" type="text/css"> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" > </head> <body bgcolor="#ffffff"> <table border="0" width="100%" bgcolor="#F0F0FF"> <tr> <td>Concept Framework 2.2 documentation</td> <td align="right"><a href="index.html">Contents</a> | <a href="index_fun.html">Index</a></td> </tr> </table> <h2>-standard.net.ym</h2> <table border="0" cellspacing="0" cellpadding="0" width="400" style="border-style:solid;border-width:1px;border-color:#D0D0D0;"> <tr bgcolor="#f0f0f0"> <td><i>Static library name</i></td> <td><i>Version</i></td> <td><i>Deprecated</i></td> </tr> <tr bgcolor="#fafafa"> <td><b>-standard.net.ym</b></td> <td>version 1.0</td> <td>no</td> </tr> </table> <br /> <b>Import library : </b>-standard.net.ym<br /> <i>(you must include this at the top of your source: "import -standard.net.ym" (no quotes)</i><br /> <br /><br /> <b>Description:</b><br /> <table width="100%" bgcolor="#FAFAFF" style="border-style:solid;border-width:1px;border-color:#D0D0D0;"> <tr><td> Yahoo! Messenger client library based on the libyahoo library. <br> <br>TODO: Documentation. Only example is available for now. </td></tr> </table> <br /> <br /> <br /> <b>Example:</b> <table bgcolor="#F0F0FF" width="100%" style="border-style:solid;border-width:1px;border-color:#D0D0D0;"><tr><td> <font color="#101060"><pre>include lang.con <br> <br>import standard.net.ym <br>import standard.C.io <br>import standard.lib.str <br>import standard.lib.thread <br> <br>include Application.con <br>include RButton.con <br>include RVBox.con <br>include RHBox.con <br>include RHButtonBox.con <br>include RTreeView.con <br>include RNotebook.con <br>include RScrolledWindow.con <br>include RStatusbar.con <br>include RCombobox.con <br>include RImage.con <br>include RVPaned.con <br>include RTextView.con <br>include RFrame.con <br>include REdit.con <br>include RCheckButton.con <br>include RLabel.con <br>include Serializable.con <br>include RHButtonBox.con <br> <br>define MSG_IM 0x1000 <br>define MSG_ADDED 0x1001 <br>define MSG_MAIL 0x1002 <br> <br> <br>define MAX_NOTIFY 10 <br> <br>class Message extends Serializable { <br> var who=""; <br> var name=""; <br> var msg=""; <br>} <br> <br>class BeAdded extends RForm { <br> var InfoText; <br> var RejectText; <br> var lbl1; <br> var who=""; <br> var delegate; <br> <br> public function AcceptClicked(Sender, EventData) { <br> delegate(1); <br> Hide(); <br> } <br> <br> public function RejectClicked(Sender, EventData) { <br> //yahoo_reject_buddy(who, RejectText.Text); <br> delegate(0, RejectText.Text); <br> Hide(); <br> } <br> <br> public function EventHide(Sender, EventData) { <br> delegate(0, RejectText.Text); <br> } <br> <br> public function BeAdded(Owner, who, msg, deleg) { <br> BeginUpdateSession(); <br> super(Owner); <br> delegate=deleg; <br> <br> var vbox=new RVBox(this); <br> vbox.Show(); <br> lbl1=new RLabel(vbox); <br> lbl1.Caption=LANG_WANTS_TO_ADD; <br> lbl1.Show(); <br> <br> InfoText=new RTextView(vbox); <br> InfoText.CursorVisible=false; <br> InfoText.ReadOnly=true; <br> InfoText.Text=msg; <br> InfoText.Show(); <br> <br> <br> var lbl2=new RLabel(vbox); <br> lbl2.Caption=LANG_REJECT_MESSAGE; <br> lbl2.Show(); <br> <br> RejectText=new RTextView(vbox); <br> RejectText.Text=DEFAULT_REJECT; <br> RejectText.Show(); <br> <br> var btnbox=new RHButtonBox(vbox); <br> btnbox.Show(); <br> <br> var btn1=new RButton(btnbox); <br> btn1.Caption=LANG_ACCEPT; <br> btn1.OnClicked=AcceptClicked; <br> btn1.Show(); <br> <br> var btn2=new RButton(btnbox); <br> btn2.Caption=LANG_REJECT; <br> btn2.OnClicked=RejectClicked; <br> btn2.Show(); <br> <br> BorderWidth=20; <br> <br> Width=200; <br> Height=200; <br> <br> Caption=LANG_ADD_REQUEST; <br> SkipTaskbar=true; <br> <br> Decorations=DECOR_TITLE; <br> Type=WT_DIALOG; <br> <br> Modal=true; <br> OnHide=EventHide; <br> EndUpdateSession(); <br> } <br>} <br> <br>class LoginForm extends RForm { <br> var EditUser; <br> var EditPass; <br> var CheckInvisible; <br> var Button; <br> <br> var delegate; <br> <br> function LogInClicked(Sender, EventData) { <br> delegate(EditUser.Text, EditPass.Text, CheckInvisible.Checked); <br> Hide(); <br> } <br> <br> function LoginForm(Owner, deleg) { <br> super(Owner); <br> <br> BeginUpdateSession(); <br> Caption=LANG_SIGN_IN; <br> <br> delegate=deleg; <br> var Frame=new RFrame(this); <br> Frame.Caption=LANG_Y_ACCOUNT; <br> Frame.Show(); <br> <br> var vbox=new RVBox(Frame); <br> vbox.Show(); <br> <br> var lbl1=new RLabel(vbox); <br> lbl1.Caption=LANG_USERNAME; <br> lbl1.Show(); <br> <br> EditUser=new REdit(vbox); <br> EditUser.ActivateDefault=true; <br> EditUser.Show(); <br> <br> EditPass=new REdit(vbox); <br> EditPass.Masked=true; <br> EditPass.MaskedChar="*"; <br> EditPass.ActivateDefault=true; <br> EditPass.Show(); <br> <br> var lbl2=new RLabel(vbox); <br> lbl2.Caption=LANG_PASSWORD; <br> lbl2.Show(); <br> <br> CheckInvisible=new RCheckButton(vbox); <br> CheckInvisible.Caption=LANG_SIGN_INVISIBLE; <br> CheckInvisible.Checked=false; <br> CheckInvisible.Show(); <br> <br> Button=new RButton(vbox); <br> Button.Caption=LANG_SIGN_IN; <br> Button.OnClicked=LogInClicked; <br> Button.Show(); <br> <br> Modal=true; <br> DefaultControl=Button; <br> EndUpdateSession(); <br> } <br>} <br> <br>class IMForm extends RForm { <br> var TextView; <br> var ScrollView; <br> var InputView; <br> var Status; <br> var yid=""; <br> var my_id=""; <br> //var names; <br> <br> <br> public function Timer(Sender, EventData) { <br> Urgent=false; <br> } <br> <br> public function SetTyping(flag) { <br> if (flag) { <br> Status.Caption=yid+" "+LANG_TYPING; <br> } else { <br> Status.Caption=""; <br> } <br> } <br> <br> public function AddMessage(who, message, name) { <br> BeginUpdateSession(); <br> var must_scroll=false; <br> <br> /*if (names[who]) <br> who=names[who];*/ <br> <br> var vadj=ScrollView.VAdjustment; <br> if (vadj.Value==vadj.Upper-vadj.PageSize) <br> must_scroll=true; <br> <br> if (name) <br> who=name; <br> <br> TextView.AddStyledText(who+": ","otheruser"); <br> TextView.AddStyledText(message+"\n","text"); <br> <br> if (must_scroll) <br> vadj.Value=vadj.Upper-vadj.PageSize; <br> Urgent=true; <br> AddTimer(Timer, 3000); <br> EndUpdateSession(); <br> } <br> <br> public function SendClicked(Sender, EventData) { <br> var text=InputView.Text; <br> <br> if (text) { <br> BeginUpdateSession(); <br> InputView.Text=""; <br> var must_scroll=false; <br> var vadj=ScrollView.VAdjustment; <br> if (vadj.Value==vadj.Upper-vadj.PageSize) <br> must_scroll=true; <br> <br> TextView.AddStyledText(my_id+": ","myuser"); <br> TextView.AddStyledText(text+"\n","text"); <br> EndUpdateSession(); <br> <br> if (must_scroll) <br> vadj.Value=vadj.Upper-vadj.PageSize; <br> <br> yahoo_send_im(yid,text,false); <br> } <br> } <br> <br> public function IMForm(Owner, who, my_id, names) { <br> super(null); <br> //this.names=names; <br> LinkIfNotLinked(Owner); <br> <br> var vbox=new RVBox(this); <br> vbox.Show(); <br> yid=who; <br> this.my_id=my_id; <br> <br> var hpane=new RVPaned(vbox); <br> hpane.Show(); <br> hpane.Position=280; <br> <br> ScrollView=new RScrolledWindow(hpane); <br> ScrollView.HScrollPolicy=POLICY_AUTOMATIC; <br> ScrollView.VScrollPolicy=POLICY_ALWAYS; <br> ScrollView.Show(); <br> <br> TextView=new RTextView(ScrollView); <br> TextView.CursorVisible=false; <br> TextView.ReadOnly=true; <br> TextView.LeftMargin=5; <br> TextView.RightMargin=5; <br> TextView.Wrap=WRAP_WORD; <br> TextView.Show(); <br> <br> var style0=TextView.CreateStyle("text"); <br> style0.FontName="arial 10"; <br> style0.ForeColor=0x000000; <br> <br> var style1=TextView.CreateStyle("myuser"); <br> style1.FontName="arial bold 10"; <br> style1.ForeColor=0x505050; <br> <br> var style2=TextView.CreateStyle("otheruser"); <br> style2.FontName="arial bold 10"; <br> style2.ForeColor=0x0000A0; <br> <br> <br> var hbox=new RHBox(hpane); <br> hbox.Packing=PACK_SHRINK; <br> hbox.Show(); <br> <br> var Scroll1=new RScrolledWindow(hbox); <br> Scroll1.HScrollPolicy=POLICY_AUTOMATIC; <br> Scroll1.VScrollPolicy=POLICY_AUTOMATIC; <br> Scroll1.Show(); <br> <br> InputView=new /*RTextView*/REdit(Scroll1); <br> InputView.Packing=PACK_EXPAND_WIDGET; <br> InputView.Font.Name="arial 10"; <br> InputView.ActivateDefault=true; <br> InputView.Show(); <br> <br> var Button=new RButton(hbox); <br> Button.Caption=LANG_SEND; <br> Button.Packing=PACK_SHRINK; <br> Button.MinWidth=75; <br> Button.OnClicked=SendClicked; <br> Button.Show(); <br> <br> Width=500; <br> Height=350; <br> DefaultControl=Button; <br> <br> Status=new RStatusbar(vbox); <br> Status.Show(); <br> } <br>} <br> <br> <br>class MainForm extends RForm { <br> var Tabs; <br> var Buddies; <br> var AddressBook; <br> var StatusBar; <br> var StatusCombo; <br> var yab_done=false; <br> var[] groups; <br> var[] Images; <br> var[] ids; <br> var my_id=""; <br> var to_add=-1; <br> var reject_reason=""; <br> var ScrollStatus; <br> var StatusList; <br> <br> <br> var[] IM_windows; <br> <br> var logindialog; <br> <br> public function Notify(evt,text) { <br> StatusList.InsertItem(0, [ Images[evt],text]); <br> <br> while (StatusList.Items.Count&gt;MAX_NOTIFY) <br> StatusList.DeleteItem(StatusList.Items.Count-1); <br> } <br> <br> function GetIMWindow(who) { <br> var len=length IM_windows; <br> <br> if (IM_windows[who]) { <br> IM_windows[who].Show(); <br> //IM_windows[who].Urgent=true; <br> } else { <br> IM_windows[who]=new IMForm(this, who, my_id, ids); <br> IM_windows[who].Show(); <br> IM_windows[who].Caption=""+ids[who]+" ("+who+") -- "+LANG_INSTANT_MESSAGE; <br> //IM_windows[who].Urgent=true; <br> } <br> return IM_windows[who]; <br> } <br> <br> <br> function OnIM(id, who, msg, tm, stat, utf8) { <br> //var frm=GetIMWindow(who); <br> //frm.AddMessage(who, msg); <br> var im=new Message(); <br> <br> im.who=who; <br> im.msg=msg; <br> im.name=ids[who]; <br> <br> SendAPMessage(GetAPID(), MSG_IM, im.Serialize("")); <br> } <br> <br> function OnStatus(id, who, stat, msg, away) { <br> //echo "$who is now ${yahoo_status_code(stat)}/$away/$msg\n"; <br> var buddie=this.FindId(who); <br> if (buddie) { <br> var item=Buddies.Items.GetPath(buddie); <br> <br> if (stat!=YAHOO_STATUS_OFFLINE) { <br> item[0]=Images["online"]; <br> if (item[3]==1) { <br> who=item[1]; <br> Notify("online", LANG_IS_NOW_AVAILABLE); <br> item[3]=2; <br> } <br> item[2]=yahoo_status_code(stat); <br> } else { <br> item[0]=Images["offline"]; <br> item[3]=1; <br> who=item[1]; <br> Notify("offline", LANG_IS_NOW_OFFLINE); <br> item[2]=" "; <br> } <br> <br> Buddies.UpdateItem(buddie, item); <br> } <br> } <br> <br> function OnType(id, who, stat) { <br> var frm=GetIMWindow(who); <br> frm.SetTyping(stat); <br> } <br> <br> function OnYab(id, arr) { <br> var len=length arr; <br> <br> // group messages (optimeze Concept network traffic) <br> BeginUpdateSession(); <br> for (var i=0;i&lt;len;i++) { <br> var arr2=arr[i]; <br> var group=arr2["group"]; <br> if (arr2["id"]) { <br> <br> if (typeof groups[group]!="string") { <br> groups[group]=group; <br> <br> Buddies.AddItem([ Images["group"], group, "(group)", 0, 0]); <br> } <br> <br> groups[group]=group; <br> <br> var path=this.FindGroup(group); <br> <br> var name=""; <br> if (arr2["yab_entry"]) { <br> name=arr2["yab_entry"]["fname"]+" "+arr2["yab_entry"]["lname"]; <br> yab_done=true; <br> } <br> <br> if (path&gt;=0) { <br> var bud_id=this.FindId(arr2["id"]); <br> if (bud_id) { <br> var item_upd=Buddies.Items.GetPath(bud_id); <br> if ((item_upd) && (item_upd[1]!=name) && (trim(name))) { <br> var bud_item=Buddies.Items.GetPath(bud_id); <br> bud_item[1]=name; <br> Buddies.UpdateItem(bud_id, bud_item); <br> ids[arr2["id"]]=name; <br> } <br> } else { <br> if (!trim(name)) <br> name=arr2["id"]; <br> <br> ids[arr2["id"]]=name; <br> Buddies.AddChild([path], [ Images["offline"], name, "", 1, arr2["id"] ]); <br> } <br> } <br> } <br> } <br> Buddies.ExpandAll(); <br> EndUpdateSession(); <br> <br> } <br> <br> public function OnContact(id, myid, who, msg) { <br> var my_msg=new Message(); <br> my_msg.who=who; <br> my_msg.msg=msg; <br> to_add=-1; <br> <br> SendAPMessage(GetAPID(), MSG_ADDED, my_msg.Serialize("")); <br> <br> while (to_add==-1) { <br> Sleep(1000); <br> } <br> <br> if (!to_add) <br> yahoo_reject_buddy(who, reject_reason); <br> } <br> <br> public function Login(username, password, invisible=false) { <br> my_id=username; <br> if (invisible) <br> yahoo_login(username,password,YAHOO_STATUS_INVISIBLE); <br> else <br> yahoo_login(username,password,YAHOO_STATUS_AVAILABLE); <br> <br> } <br> <br> public function OnError(id, err, fatal) { <br> CApplication::MessageBox(err); <br> } <br> <br> public function OnSysMsg(id, msg) { <br> CApplication::MessageBox(msg); <br> } <br> <br> public function FindId(id) { <br> var len=Buddies.Items.Count; <br> for (var i=0;i&lt;len;i++) { <br> var item=Buddies.Items.GetPath(i); <br> <br> var j=0; <br> do { <br> var child_item=Buddies.Items.GetPath([i,j]); <br> if ((child_item) && (child_item[4]==id)) <br> return [i,j]; <br> j++; <br> } while (child_item); <br> } <br> return 0; <br> } <br> <br> <br> public function FindGroup(group) { <br> var len=Buddies.Items.Count; <br> for (var i=0;i&lt;len;i++) { <br> var item=Buddies.Items.GetPath(i); <br> if (item[1]==group) { <br> return i; <br> } <br> } <br> return -1; <br> } <br> <br> <br> public function TimerBuddies(Sender,EventData) { <br> yahoo_get_yab(); <br> } <br> <br> public function OnLogin(id, succ, url) { <br> var err; <br> <br> switch (succ) { <br> case YAHOO_LOGIN_OK: <br> StatusBar.Caption=LANG_LOGGED; <br> // don't interrupt this procedure (no yahoo function should be called here ... so ... add a timer !) <br> AddTimer(TimerBuddies,1000); <br> break; <br> case YAHOO_LOGIN_UNAME: <br> err="Could not log into Yahoo service - username not recognised. Please verify that your username is correctly typed."; <br> break; <br> case YAHOO_LOGIN_PASSWD: <br> err="Could not log into Yahoo service - password incorrect. Please verify that your password is correctly typed."; <br> break; <br> case YAHOO_LOGIN_LOCK: <br> err="Could not log into Yahoo service. Your account has been locked.\nVisit $url to reactivate it."; <br> break; <br> case YAHOO_LOGIN_DUPL: <br> err="You have been logged out of the yahoo service, possibly due to a duplicate login."; <br> break; <br> case YAHOO_LOGIN_SOCK: <br> err="The server closed the socket."; <br> break; <br> default: <br> err="Could not log in, unknown reason: $succ."; <br> } <br> <br> if (err) { <br> CApplication::MessageBox(err); <br> logindialog.Show(); <br> logindialog.Raise(); <br> } <br> } <br> <br> <br> public function SimpleOnMail(from, subj, cnt) { <br> if (from) <br> Notify("mail", LANG_MAIL); <br> if (cnt) <br> Notify("multimail", LANG_MULTIMAIL); <br> } <br> <br> public function OnMail(id, from, subj, cnt) { <br> // reusing Message to store mail data <br> var msg=new Message(); <br> <br> msg.who=from; <br> msg.msg=subj; <br> msg.name=cnt; <br> <br> SendAPMessage(GetAPID(), MSG_MAIL, msg.Serialize("")); <br> } <br> <br> private function InitYahoo() { <br> yahoo_set_callback(YM_ON_GOT_IM, OnIM); <br> yahoo_set_callback(YM_ON_TYPING_NOTIFY, OnType); <br> yahoo_set_callback(YM_ON_STATUS_CHANGED, OnStatus); <br> yahoo_set_callback(YM_ON_GOT_BUDDIES, OnYab); <br> <br> yahoo_set_callback(YM_ON_YAHOO_ERROR, OnError); <br> yahoo_set_callback(YM_ON_SYSTEM_MESSAGE, OnSysMsg); <br> yahoo_set_callback(YM_ON_LOGIN_RESPONSE, OnLogin); <br> <br> yahoo_set_callback(YM_ON_CONTACT_ADDED, OnContact); <br> <br> yahoo_set_callback(YM_ON_MAIL_NOTIFY, OnMail); <br> <br> } <br> <br> public function OnBuddySelect(Sender, EventData) { <br> var path=Sender.RowIndex; <br> if (path!="-1") { <br> var item=Buddies.Items.GetPath(path); <br> var who=item[4]; <br> <br> GetIMWindow(who); <br> } <br> } <br> <br> private function LoadImages() { <br> var img=new RImage(null); <br> img.Filename="res/offline.gif"; <br> Images["offline"]=img; <br> <br> var img1=new RImage(null); <br> img1.Filename="res/online.gif"; <br> Images["online"]=img1; <br> <br> var img2=new RImage(null); <br> img2.Filename="res/friend_root.bmp"; <br> Images["group"]=img2; <br> <br> var img3=new RImage(null); <br> img3.Filename="res/mail.gif"; <br> Images["mail"]=img3; <br> <br> var img4=new RImage(null); <br> img4.Filename="res/multiplemail.gif"; <br> Images["multimail"]=img4; <br> } <br> <br> public function StatusChanged(Sender, EventData) { <br> var index=StatusCombo.RowIndex; <br> var status=-1; <br> <br> switch (index) { <br> case 0: <br> status=YAHOO_STATUS_AVAILABLE; <br> break; <br> case 1: <br> status=YAHOO_STATUS_BRB; <br> break; <br> case 2: <br> status=YAHOO_STATUS_BUSY; <br> break; <br> case 3: <br> status=YAHOO_STATUS_NOTATHOME; <br> break; <br> case 4: <br> status=YAHOO_STATUS_NOTATDESK; <br> break; <br> case 5: <br> status=YAHOO_STATUS_NOTINOFFICE; <br> break; <br> case 6: <br> status=YAHOO_STATUS_ONPHONE; <br> break; <br> case 7: <br> status=YAHOO_STATUS_ONVACATION; <br> break; <br> case 8: <br> status=YAHOO_STATUS_OUTTOLUNCH; <br> break; <br> case 9: <br> status=YAHOO_STATUS_STEPPEDOUT; <br> break; <br> case 10: <br> status=YAHOO_STATUS_INVISIBLE; <br> break; <br> case 11: <br> status=YAHOO_STATUS_IDLE; <br> break; <br> case 12: <br> status=YAHOO_STATUS_OFFLINE; <br> break; <br> case 13: <br> status=YAHOO_STATUS_CUSTOM; <br> break; <br> case 14: <br> status=YAHOO_STATUS_NOTIFY; <br> break; <br> } <br> if (status!=-1) <br> yahoo_set_away(status,"", 1); <br> } <br> <br> public function OnAcceptAdd(added, rejtxt="") { <br> to_add=added; <br> reject_reason=rejtxt; <br> } <br> <br> public function DebugCallback(SenderAPID, MSGID, szData) { <br> switch (MSGID) { <br> case MSG_IM: <br> var im2=Serializable.UnSerialize(szData, true); <br> if (im2) { <br> var frm=GetIMWindow(im2.who); <br> if (frm) <br> frm.AddMessage(im2.who, im2.msg, im2.name); <br> } <br> break; <br> case MSG_ADDED: <br> im2=Serializable.UnSerialize(szData, true); <br> if (im2) { <br> var b=new BeAdded(this, im2.who, im2.msg, OnAcceptAdd); <br> b.Show(); <br> } <br> break; <br> case MSG_MAIL: <br> im2=Serializable.UnSerialize(szData, true); <br> if (im2) { <br> SimpleOnMail(im2.who, im2.msg, im2.name); <br> } <br> break; <br> } <br> } <br> <br> public function MainForm(Owner) { <br> super(Owner); <br> Caption=LANG_APP_NAME; <br> <br> var box=new RVBox(this); <br> box.Show(); <br> <br> StatusCombo=new RComboBox(box); <br> StatusCombo.Show(); <br> StatusCombo.AddColumns(1); <br> <br> <br> StatusCombo.AddItem(STATUS_AVAILABLE); <br> StatusCombo.AddItem(STATUS_BRB); <br> StatusCombo.AddItem(STATUS_BUSY); <br> StatusCombo.AddItem(STATUS_NOTATHOME); <br> StatusCombo.AddItem(STATUS_NOTATDESK); <br> StatusCombo.AddItem(STATUS_NOTINOFFICE); <br> StatusCombo.AddItem(STATUS_ONPHONE); <br> StatusCombo.AddItem(STATUS_ONVACATION); <br> StatusCombo.AddItem(STATUS_OUTTOLUNCH); <br> StatusCombo.AddItem(STATUS_STEPPEDOUT); <br> StatusCombo.AddItem(STATUS_INVISIBLE); <br> StatusCombo.AddItem(STATUS_IDLE); <br> StatusCombo.AddItem(STATUS_OFFLINE); <br> StatusCombo.AddItem(STATUS_CUSTOM); <br> StatusCombo.AddItem(STATUS_NOTIFY); <br> StatusCombo.OnChanged=StatusChanged; <br> StatusCombo.RowIndex=0; <br> <br> <br> var hpaned=new RVPaned(box); <br> hpaned.Show(); <br> <br> Tabs=new RNotebook(hpaned); <br> Tabs.Show(); <br> <br> var scroll1=new RScrolledWindow(Tabs); <br> scroll1.HScrollPolicy=POLICY_AUTOMATIC; <br> scroll1.VScrollPolicy=POLICY_AUTOMATIC; <br> scroll1.Show(); <br> <br> Buddies=new RTreeView(scroll1); <br> Buddies.Model=MODEL_TREEVIEW; <br> Buddies.Sorted=true; <br> Buddies.SortColumn=1; <br> Buddies.OnRowActivated=OnBuddySelect; <br> Buddies.AddColumn(" ", IMAGE_COLUMN); <br> Buddies.AddColumn("Contact", NORMAL_COLUMN); <br> Buddies.AddColumn("Status", NORMAL_COLUMN); <br> Buddies.SearchColumn=2; <br> Buddies.HoverSelection=true; <br> Buddies.HeadersVisible=false; <br> <br> Buddies.Show(); <br> Tabs.Pages[0].Caption=LANG_MESSENGER; <br> <br> var scroll2=new RScrolledWindow(Tabs); <br> scroll2.HScrollPolicy=POLICY_AUTOMATIC; <br> scroll2.VScrollPolicy=POLICY_AUTOMATIC; <br> //scroll2.Show(); <br> <br> AddressBook=new RTreeView(scroll2); <br> AddressBook.Model=MODEL_LISTVIEW; <br> AddressBook.Show(); <br> Tabs.Pages[1].Caption=LANG_ADDRESSBOOK; <br> <br> var ScrollStatus=new RScrolledWindow(hpaned); <br> ScrollStatus.HScrollPolicy=POLICY_AUTOMATIC; <br> ScrollStatus.VScrollPolicy=POLICY_AUTOMATIC; <br> ScrollStatus.Show(); <br> <br> StatusList=new RTreeView(ScrollStatus); <br> StatusList.Model=MODEL_LISTVIEW; <br> StatusList.HeadersVisible=false; <br> StatusList.HoverSelection=true; <br> <br> StatusList.AddColumn(" ", IMAGE_COLUMN); <br> StatusList.AddColumn("Event", NORMAL_COLUMN); <br> StatusList.Show(); <br> <br> <br> hpaned.Position=450; <br> StatusBar=new RStatusbar(box); <br> StatusBar.Show(); <br> StatusBar.Caption=LANG_NOT_LOGGED; <br> <br> LoadImages(); <br> InitYahoo(); <br> <br> Width=250; <br> Height=600; <br> <br> logindialog=new LoginForm(this, Login); <br> logindialog.Show(); <br> <br> } <br>} <br> <br> <br>class Main { <br> function Main() { <br> try { <br> var Application=new CApplication(new MainForm(NULL)); <br> Application.ShellDebug=Application.ApplicationForm.DebugCallback; <br> <br> <br> Application.Init(); <br> Application.Run(); <br> Application.Done(); <br> <br> } catch (var Exception) { <br> echo Exception; <br> } <br> } <br>} <br></pre></font> </td></tr></table> <br /> <br /> <br /> <!-- <p> <a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-html40" alt="Valid HTML 4.0 Transitional" height="31" width="88" border="0"></a> <a href="http://jigsaw.w3.org/css-validator/"> <img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!" border="0"/> </a> </p> --> <table bgcolor="#F0F0F0" width="100%"><tr><td>Documented by Eduard Suica, generation time: Sun Jan 27 18:15:22 2013 GMT</td><td align="right">(c)2013 <a href="http://www.devronium.com">Devronium Applications</a></td></tr></table> </body> </html>
bsd-2-clause
aha0x0x/snippets
java/aha/datastructure/DoubleLinkedList.java
3509
/* * Copyright (c) 2014 Abdul Hannan Ahsan <[email protected]> * * 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 aha.datastructure; public class DoubleLinkedList<T> { private T value; private DoubleLinkedList<T> previous; private DoubleLinkedList<T> next; public DoubleLinkedList( T value ) { this.value = value; this.previous = null; this.next = null; } public DoubleLinkedList( T value, DoubleLinkedList<T> previous, DoubleLinkedList<T> next ) { this.value = value; this.previous = previous; this.next = next; } @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append( "[" ).append( value ); DoubleLinkedList<T> current = next; while( current != null ) { builder.append( "," + current.getValue() ); current = current.getNext(); } builder.append( "]" ); return builder.toString(); } public T getValue() { return value; } public DoubleLinkedList<T> getPrevious() { return previous; } public DoubleLinkedList<T> getNext() { return next; } public void setValue( final T value ) { this.value = value; } public void setPrevious( final DoubleLinkedList<T> previous ) { this.previous = previous; } public void setNext( final DoubleLinkedList<T> next ) { this.next = next; } public static<T> DoubleLinkedList<T> createList( final T[] values ) { if( values.length == 0 ) { return null; } DoubleLinkedList<T> root = new DoubleLinkedList<T>( values[0] ); DoubleLinkedList<T> current = root; for( int idx = 1; idx < values.length; ++idx ) { DoubleLinkedList<T> next = new DoubleLinkedList<T>( values[idx] ); current.setNext( next ); next.setPrevious( current ); current = current.getNext(); } return root; } public static void main( String[] args ) { Integer[] values = { 34, -29, 45, 342, 99, 7 }; DoubleLinkedList<Integer> dlist = DoubleLinkedList.createList( values ); System.out.println( dlist ); } }
bsd-2-clause
mollie/mollie-api-python
examples/11-refund-payment.py
1522
# Example: How to prepare a new refund with the Mollie API. # import os from mollie.api.client import Client from mollie.api.error import Error def main(): try: # # Initialize the Mollie API library with your API key. # # See: https://www.mollie.com/dashboard/settings/profiles # api_key = os.environ.get("MOLLIE_API_KEY", "test_test") mollie_client = Client() mollie_client.set_api_key(api_key) body = "" payment_id = "" body += "<p>Attempting to retrieve the first page of payments and grabbing the first.</p>" payments = mollie_client.payments.list() if not len(payments): body += "<p>You have no payments. You can create one from the examples.</p>" return body payment = next(payments) if ( payment.can_be_refunded() and payment.amount_remaining["currency"] == "EUR" and float(payment.amount_remaining["value"]) >= 2.0 ): data = {"amount": {"value": "2.00", "currency": "EUR"}} refund = mollie_client.payment_refunds.with_parent_id(payment_id).create(data) body += f'<p>{refund.amount["currency"]} {refund.amount["value"]} of payment {payment_id} refunded</p>' else: body += f"<p>Payment {payment_id} can not be refunded</p>" return body except Error as err: return f"API call failed: {err}" if __name__ == "__main__": print(main())
bsd-2-clause
DreamOps/dreamops.github.io
archives/2013/04/index.html
30713
<!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title>archives: 2013/4 | DreamOps Success Group</title> <meta name="author" content="DreamOps Crew"> <meta name="description" content="Force.com is a remarkable platform, and we want to help take it to the next level. We have a dream. We want Salesforce DX to be the most scalable, most agile, most developer-friendly platform on the planet -- or in the cloud -- bar none."> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta property="og:site_name" content="DreamOps Success Group"/> <meta property="og:image" content="undefined"/> <link rel="alternative" href="/atom.xml" title="DreamOps Success Group" type="application/atom+xml"> <link href="/favicon.ico" rel="icon"> <!-- CSS --> <link rel="stylesheet" href="/css/themes/bootstrap.css" media="screen" type="text/css"> <link rel="stylesheet" href="/css/font-awesome.css" media="screen" type="text/css"> <link rel="stylesheet" href="/css/style.css" media="screen" type="text/css"> <link rel="stylesheet" href="/css/responsive.css" media="screen" type="text/css"> <link rel="stylesheet" href="/css/highlight.css" media="screen" type="text/css"> <link rel="stylesheet" href="/css/google-fonts.css" media="screen" type="text/css"> <!--[if lt IE 9]><script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]--> <script src="/js/jquery-2.0.3.min.js"></script> <!-- analytics --> <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','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-92989768-1', 'auto'); ga('send', 'pageview'); </script> </head> <body> <nav id="main-nav" class="navbar navbar-inverse navbar-default navbar-fixed-top" role="navigation"> <div class="container"> <button type="button" class="navbar-header navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="/">DreamOps Success Group</a> <div class="collapse navbar-collapse nav-menu"> <ul class="nav navbar-nav"> <li> <a href="/archives" title="All the articles."> <i class="fa fa-archive"></i>archives </a> </li> <li> <a href="/categories" title="All the categories."> <i class="fa fa-folder"></i>categories </a> </li> <li> <a href="/tags" title="All the tags."> <i class="fa fa-tags"></i>tags </a> </li> <li> <a href="/about" title="More about DreamOps."> <i class="fa fa-user"></i>about </a> </li> </ul> </div> </div> <!-- container --> </nav> <div class="clearfix"></div> <div class="container"> <div class="content"> <!-- title --> <div class="page-header page-header-inverse "> <h1 class="archive-title title title-inverse ">2013/4</h1> </div> <div class="row page"> <!-- cols --> <div class="col-md-9"> <div id="top_search"></div> <div class="archive"> <h4 class="archive-ul" data-toggle="collapse" data-target="#2017">2017<b class="caret"></b></h4> <ul id="2017" class="collapse in"> <li class="listing-item"> <span class="date_class"> 2017-05-28 </span> &raquo; <span class="title"><a href="/2017/05/28/lightning-component-dev-tips/" >Lightning Component Dev Tips</a></span> </li> <li class="listing-item"> <span class="date_class"> 2017-05-27 </span> &raquo; <span class="title"><a href="/2017/05/27/creating-a-jira-change-log-in-confluence/" >Creating a JIRA Change Log in Confluence</a></span> </li> <li class="listing-item"> <span class="date_class"> 2017-05-23 </span> &raquo; <span class="title"><a href="/2017/05/23/introducing-slackforce-a-salesforce-slack-community/" >Introducing Slackforce: A Salesforce Slack Community</a></span> </li> <li class="listing-item"> <span class="date_class"> 2017-05-22 </span> &raquo; <span class="title"><a href="/2017/05/22/updating-multiple-sites-from-jenkins/" >Updating Multiple Sites from Jenkins</a></span> </li> <li class="listing-item"> <span class="date_class"> 2017-05-17 </span> &raquo; <span class="title"><a href="/2017/05/17/free-debugger-for-unlimited-edition/" >Free Debugger for Unlimited Edition</a></span> </li> <li class="listing-item"> <span class="date_class"> 2017-05-16 </span> &raquo; <span class="title"><a href="/2017/05/16/build-better-communities-with-lightning/" >Build Better Communities with Lightning</a></span> </li> <li class="listing-item"> <span class="date_class"> 2017-05-06 </span> &raquo; <span class="title"><a href="/2017/05/06/selenium-and-salesforcedx-scratch-orgs/" >Selenium and SalesforceDX Scratch Orgs</a></span> </li> <li class="listing-item"> <span class="date_class"> 2017-04-29 </span> &raquo; <span class="title"><a href="/2017/04/29/locker-service-in-summer-17/" >Locker Service in Summer 17</a></span> </li> <li class="listing-item"> <span class="date_class"> 2017-04-28 </span> &raquo; <span class="title"><a href="/2017/04/28/leveraging-use-case-diagrams-in-smoke-testing/" >Leveraging Use Case Diagrams in Smoke Testing</a></span> </li> <li class="listing-item"> <span class="date_class"> 2017-04-13 </span> &raquo; <span class="title"><a href="/2017/04/13/introducing-the-nimbleuser-salesforce-apex-style-guide/" >Introducing the NimbleUser Salesforce Apex Style Guide</a></span> </li> <li class="listing-item"> <span class="date_class"> 2017-04-12 </span> &raquo; <span class="title"><a href="/2017/04/12/machine-to-machine-salesforce-integrations-in-java-with-rest-and-soap/" >Machine-to-Machine Salesforce Integrations in Java with REST and SOAP</a></span> </li> <li class="listing-item"> <span class="date_class"> 2017-04-06 </span> &raquo; <span class="title"><a href="/2017/04/06/salesforce-expands-partnership-with-girl-develop-it—get-involved/" >Salesforce Expands Partnership with Girl Develop It—Get Involved!</a></span> </li> <li class="listing-item"> <span class="date_class"> 2017-04-01 </span> &raquo; <span class="title"><a href="/2017/04/01/now-salesforce-can-even-read-your-mind/" >Now, Salesforce can even read your mind</a></span> </li> <li class="listing-item"> <span class="date_class"> 2017-03-27 </span> &raquo; <span class="title"><a href="/2017/03/27/ultimate-salesforce-chrome-extensions-2017/" >Ultimate Salesforce Chrome Extensions 2017</a></span> </li> <li class="listing-item"> <span class="date_class"> 2017-03-15 </span> &raquo; <span class="title"><a href="/2017/03/15/building-lightning-components-with-chart-js/" >Building Lightning Components with Chart.js</a></span> </li> <li class="listing-item"> <span class="date_class"> 2017-03-13 </span> &raquo; <span class="title"><a href="/2017/03/13/using-vlookup-validation-rules-in-salesforce/" >Using VLOOKUP Validation Rules in Salesforce</a></span> </li> <li class="listing-item"> <span class="date_class"> 2017-03-11 </span> &raquo; <span class="title"><a href="/2017/03/11/top-open-source-projects/" >Top Open Source Projects</a></span> </li> <li class="listing-item"> <span class="date_class"> 2017-03-10 </span> &raquo; <span class="title"><a href="/2017/03/10/design-build-publish-lighting-component-appexchange/" >How to Design, Build and Publish Your Lightning Component for AppExchange</a></span> </li> <li class="listing-item"> <span class="date_class"> 2017-03-10 </span> &raquo; <span class="title"><a href="/2017/03/10/pilot-madness/" >Pilot Madness!</a></span> </li> <li class="listing-item"> <span class="date_class"> 2017-03-05 </span> &raquo; <span class="title"><a href="/2017/03/05/salesforce-dx-week-1/" >Salesforce DX Week 1</a></span> </li> <li class="listing-item"> <span class="date_class"> 2017-03-03 </span> &raquo; <span class="title"><a href="/2017/03/03/tips-for-an-effective-architecture-review-board/" >Tips for an Effective Architecture Review Board</a></span> </li> <li class="listing-item"> <span class="date_class"> 2017-02-20 </span> &raquo; <span class="title"><a href="/2017/02/20/what-is-salesforce-dx-and-what-does-it-mean-for-admins/" >What is Salesforce DX and what does it mean for Admins</a></span> </li> <li class="listing-item"> <span class="date_class"> 2017-02-19 </span> &raquo; <span class="title"><a href="/2017/02/19/lightning-design-system-in-visualforce/" >Lightning Design System in Visualforce Part 2 - Forms</a></span> </li> <li class="listing-item"> <span class="date_class"> 2017-02-13 </span> &raquo; <span class="title"><a href="/2017/02/13/secure-your-org-with-salesforce-health-check/" >Secure your Org with Salesforce Health Check</a></span> </li> <li class="listing-item"> <span class="date_class"> 2017-02-10 </span> &raquo; <span class="title"><a href="/2017/02/10/10-ux-lightning-experience-need-fixing/" >10 UX Issues in Lightning Experience that Need Fixing</a></span> </li> <li class="listing-item"> <span class="date_class"> 2017-02-06 </span> &raquo; <span class="title"><a href="/2017/02/06/the-thousand-developer-march-on-dx-ga/" >The Thousand Developer March on DX GA</a></span> </li> <li class="listing-item"> <span class="date_class"> 2017-01-31 </span> &raquo; <span class="title"><a href="/2017/01/31/confluence-templates-for-all/" >Confluence Templates For All</a></span> </li> <li class="listing-item"> <span class="date_class"> 2017-01-29 </span> &raquo; <span class="title"><a href="/2017/01/29/undertanding-how-your-app-experience-fits-into-lightning-experience/" >Understanding how your App Experience fits into Lightning Experience</a></span> </li> <li class="listing-item"> <span class="date_class"> 2017-01-17 </span> &raquo; <span class="title"><a href="/2017/01/17/ant-sf-dx-for-the-rest-of-us/" >Ant-SF: DX for the rest of us</a></span> </li> <li class="listing-item"> <span class="date_class"> 2017-01-09 </span> &raquo; <span class="title"><a href="/2017/01/09/hot-javascript-tips-visualforce-developers/" >Hot JavaScript tips for Visualforce Developers!</a></span> </li> </ul> <h4 class="archive-ul" data-toggle="collapse" data-target="#2016">2016<b class="caret"></b></h4> <ul id="2016" class="collapse in"> <li class="listing-item"> <span class="date_class"> 2016-12-30 </span> &raquo; <span class="title"><a href="/2016/12/30/javascript-promises-in-lightning-components/" >JavaScript Promises in Lightning Components</a></span> </li> <li class="listing-item"> <span class="date_class"> 2016-12-08 </span> &raquo; <span class="title"><a href="/2016/12/08/sample-application-with-ionic-2-and-salesforce/" >Sample Application with Ionic 2 and Salesforce</a></span> </li> <li class="listing-item"> <span class="date_class"> 2016-12-05 </span> &raquo; <span class="title"><a href="/2016/12/05/implementing-material-design-in-salesforce/" >Implementing Material Design in Salesforce</a></span> </li> <li class="listing-item"> <span class="date_class"> 2016-11-20 </span> &raquo; <span class="title"><a href="/2016/11/20/browse-the-dreamops-guide/" >Browse the DreamOps Guide</a></span> </li> <li class="listing-item"> <span class="date_class"> 2016-11-15 </span> &raquo; <span class="title"><a href="/2016/11/15/jira-our-nexus-of-truth/" >JIRA: Our nexus of truth</a></span> </li> <li class="listing-item"> <span class="date_class"> 2016-10-25 </span> &raquo; <span class="title"><a href="/2016/10/25/source-driven-development-huh-what/" >Source driven development - Huh? What?</a></span> </li> <li class="listing-item"> <span class="date_class"> 2016-10-20 </span> &raquo; <span class="title"><a href="/2016/10/20/write-better-apex-with-codescan/" >Write Better Apex With CodeScan</a></span> </li> <li class="listing-item"> <span class="date_class"> 2016-10-18 </span> &raquo; <span class="title"><a href="/2016/10/18/from-waterfall-to-pipeline-to-mobius-strip/" >From waterfall to pipeline to mobius strip</a></span> </li> <li class="listing-item"> <span class="date_class"> 2016-10-14 </span> &raquo; <span class="title"><a href="/2016/10/14/visualforce-development-cookbook-second-edition/" >Visualforce Development Cookbook Second Edition</a></span> </li> <li class="listing-item"> <span class="date_class"> 2016-08-10 </span> &raquo; <span class="title"><a href="/2016/08/10/quick-easy-etl-from-salesforce-to-mysql-with-workflow-heroku/" >Quick &amp; Easy ETL from Salesforce to MySQL with Workflow &amp; Heroku</a></span> </li> <li class="listing-item"> <span class="date_class"> 2016-07-25 </span> &raquo; <span class="title"><a href="/2016/07/25/are-you-ready-for-lightning-find-out-in-less-than-5-minutes/" >Are you ready for Lightning? Find out in less than 5 minutes!</a></span> </li> <li class="listing-item"> <span class="date_class"> 2016-07-19 </span> &raquo; <span class="title"><a href="/2016/07/19/introducing-the-flow-factory/" >Introducing the Flow Factory</a></span> </li> <li class="listing-item"> <span class="date_class"> 2016-06-14 </span> &raquo; <span class="title"><a href="/2016/06/14/machine-learning-on-heroku-with-predictionio/" >Machine Learning on Heroku with PredictionIO</a></span> </li> <li class="listing-item"> <span class="date_class"> 2016-06-01 </span> &raquo; <span class="title"><a href="/2016/06/01/login-forensics-login-history-plus-for/" >Login Forensics: Login History plus for auditing user logins</a></span> </li> <li class="listing-item"> <span class="date_class"> 2016-05-25 </span> &raquo; <span class="title"><a href="/2016/05/25/bitbucket-pipelines-beta/" >Bitbucket Pipelines (Beta)</a></span> </li> <li class="listing-item"> <span class="date_class"> 2016-03-17 </span> &raquo; <span class="title"><a href="/2016/03/17/uploading-data-to-the-salesforce-wave-analytics-cloud/" >Uploading data to the Salesforce Wave Analytics Cloud</a></span> </li> <li class="listing-item"> <span class="date_class"> 2016-02-28 </span> &raquo; <span class="title"><a href="/2016/02/28/dynamically-calling-flows-in-apex/" >Dynamically Calling Flows in Apex</a></span> </li> <li class="listing-item"> <span class="date_class"> 2016-02-25 </span> &raquo; <span class="title"><a href="/2016/02/25/angular2-ionic2-salesforce/" >Building Customer-Facing Mobile Apps with Angular 2, Ionic 2, and Salesforce</a></span> </li> <li class="listing-item"> <span class="date_class"> 2016-02-22 </span> &raquo; <span class="title"><a href="/2016/02/22/a-seriously-nimble-and-free-tool-that-every-salesforce-admin-needs/" >A Seriously Nimble (And Free) Tool That Every App Builder Needs</a></span> </li> <li class="listing-item"> <span class="date_class"> 2016-02-13 </span> &raquo; <span class="title"><a href="/2016/02/13/visit-planet-dreamops/" >Visit Planet DreamOps</a></span> </li> <li class="listing-item"> <span class="date_class"> 2016-02-06 </span> &raquo; <span class="title"><a href="/2016/02/06/pair-programming-with-salesforce-app-cloud/" >Pair Programming with Salesforce App Cloud</a></span> </li> <li class="listing-item"> <span class="date_class"> 2016-02-05 </span> &raquo; <span class="title"><a href="/2016/02/05/spring-’16-–-developer-tidbits/" >Spring ’16 – Developer Tidbits</a></span> </li> <li class="listing-item"> <span class="date_class"> 2016-01-10 </span> &raquo; <span class="title"><a href="/2016/01/10/apex-sharing-and-applying-to-apex-enterprise-patterns/" >Apex Sharing and applying to Apex Enterprise Patterns</a></span> </li> </ul> <h4 class="archive-ul" data-toggle="collapse" data-target="#2015">2015<b class="caret"></b></h4> <ul id="2015" class="collapse in"> <li class="listing-item"> <span class="date_class"> 2015-12-29 </span> &raquo; <span class="title"><a href="/2015/12/29/lightning-everywhere/" >Lightning Everywhere</a></span> </li> <li class="listing-item"> <span class="date_class"> 2015-12-12 </span> &raquo; <span class="title"><a href="/2015/12/12/visual-flow-with-list-view-and-related-list-buttons/" >Visual Flow with List View and Related List Buttons</a></span> </li> <li class="listing-item"> <span class="date_class"> 2015-11-23 </span> &raquo; <span class="title"><a href="/2015/11/23/google-script-connection-to-salesforce-nimble-ams-via-oauth/" >Google Script Connection to Salesforce / Nimble AMS via OAUTH</a></span> </li> <li class="listing-item"> <span class="date_class"> 2015-10-29 </span> &raquo; <span class="title"><a href="/2015/10/29/sobject-test-data-design-pattern/" >sObject Test Data Design Pattern</a></span> </li> <li class="listing-item"> <span class="date_class"> 2015-10-18 </span> &raquo; <span class="title"><a href="/2015/10/18/setup-audit-trail-api-in-winter’16/" >Setup Audit Trail API in Winter’16</a></span> </li> <li class="listing-item"> <span class="date_class"> 2015-09-28 </span> &raquo; <span class="title"><a href="/2015/09/28/designing-with-the-users-mind-in-mind/" >Designing with the Users in Mind</a></span> </li> <li class="listing-item"> <span class="date_class"> 2015-09-27 </span> &raquo; <span class="title"><a href="/2015/09/27/using-task-lists-to-get-more-done-better/" >Using task lists to get more done better</a></span> </li> <li class="listing-item"> <span class="date_class"> 2015-06-08 </span> &raquo; <span class="title"><a href="/2015/06/08/comparing-application-deployment-2005-vs-2015/" >Comparing Application Deployment: 2005 vs. 2015</a></span> </li> <li class="listing-item"> <span class="date_class"> 2015-04-19 </span> &raquo; <span class="title"><a href="/2015/04/19/considerations-placing-validation-code-in-an-apex-triggers/" >Where to place Validation code in an Apex Trigger?</a></span> </li> <li class="listing-item"> <span class="date_class"> 2015-03-19 </span> &raquo; <span class="title"><a href="/2015/03/19/unit-testing-apex-enterprise-patterns-and-apexmocks-part-2/" >Unit Testing, Apex Enterprise Patterns and ApexMocks – Part 2</a></span> </li> <li class="listing-item"> <span class="date_class"> 2015-03-18 </span> &raquo; <span class="title"><a href="/2015/03/18/17-sites-every-force-com-developer-should-bookmark/" >17 Sites Every Force.com Developer Should Bookmark</a></span> </li> <li class="listing-item"> <span class="date_class"> 2015-03-17 </span> &raquo; <span class="title"><a href="/2015/03/17/dita-best-practices-use-the-maps-folks-use-the-maps/" >DITA Best Practices: Use the maps, folks. Use the maps.</a></span> </li> <li class="listing-item"> <span class="date_class"> 2015-03-01 </span> &raquo; <span class="title"><a href="/2015/03/01/extending-lightning-process-builder-and-visual-workflow-with-apex/" >Extending Lightning Process Builder and Visual Workflow with Apex</a></span> </li> <li class="listing-item"> <span class="date_class"> 2015-02-24 </span> &raquo; <span class="title"><a href="/2015/02/24/5-skills-salesforce-devs-need-for-2015/" >5 Skills Salesforce Devs Need for 2015</a></span> </li> <li class="listing-item"> <span class="date_class"> 2015-02-17 </span> &raquo; <span class="title"><a href="/2015/02/17/if-programming-languages-were-beer/" >If Programming Languages Were Beer ...</a></span> </li> <li class="listing-item"> <span class="date_class"> 2015-01-20 </span> &raquo; <span class="title"><a href="/2015/01/20/nuops-how-the-nimble-ams-sausages-are-made/" >NuOps: How the Nimble AMS Sausages are Made</a></span> </li> <li class="listing-item"> <span class="date_class"> 2015-01-14 </span> &raquo; <span class="title"><a href="/2015/01/14/creating-assigning-and-checking-custom-permissions/" >Creating, Assigning and Checking Custom Permissions</a></span> </li> </ul> <h4 class="archive-ul" data-toggle="collapse" data-target="#2014">2014<b class="caret"></b></h4> <ul id="2014" class="collapse in"> <li class="listing-item"> <span class="date_class"> 2014-12-22 </span> &raquo; <span class="title"><a href="/2014/12/22/permission-sets-and-packaging/" >Permission Sets and Packaging</a></span> </li> <li class="listing-item"> <span class="date_class"> 2014-11-03 </span> &raquo; <span class="title"><a href="/2014/11/03/what-is-salesforce1-lightning/" >What is Salesforce1 Lightning?</a></span> </li> <li class="listing-item"> <span class="date_class"> 2014-10-26 </span> &raquo; <span class="title"><a href="/2014/10/26/calling-flow-from-apex/" >Calling Flow from Apex</a></span> </li> <li class="listing-item"> <span class="date_class"> 2014-10-23 </span> &raquo; <span class="title"><a href="/2014/10/23/salesforce-publisher-actions-101-solutions-to-common-problems/" >Salesforce Publisher Actions 101 - Solutions to Common Problems</a></span> </li> <li class="listing-item"> <span class="date_class"> 2014-10-21 </span> &raquo; <span class="title"><a href="/2014/10/21/salesforce-developer-console-query-editor/" >Salesforce Developer Console Query Editor</a></span> </li> <li class="listing-item"> <span class="date_class"> 2014-09-27 </span> &raquo; <span class="title"><a href="/2014/09/27/the-new-github-deploy-to-salesforce-button/" >The new GitHub Deploy to Salesforce Button!</a></span> </li> <li class="listing-item"> <span class="date_class"> 2014-08-24 </span> &raquo; <span class="title"><a href="/2014/08/24/customizing-salesforce-help/" >Customizing Salesforce Help</a></span> </li> <li class="listing-item"> <span class="date_class"> 2014-07-29 </span> &raquo; <span class="title"><a href="/2014/07/29/post-install-apex-metadata-api-configuration-solved/" >Post Install Apex Metadata API Configuration Solved!</a></span> </li> <li class="listing-item"> <span class="date_class"> 2014-07-29 </span> &raquo; <span class="title"><a href="/2014/07/29/salesforce-com-new-open-source-releases/" >Salesforce.com’s New Open Source Releases – Part 3</a></span> </li> <li class="listing-item"> <span class="date_class"> 2014-07-22 </span> &raquo; <span class="title"><a href="/2014/07/22/choosey-partners-choose-trialforce/" >Choosey partners choose Trialforce</a></span> </li> <li class="listing-item"> <span class="date_class"> 2014-04-24 </span> &raquo; <span class="title"><a href="/2014/04/24/apex-metadata-api-and-spring’14-keys-to-the-kingdom/" >Apex Metadata API and Spring’14 : Keys to the Kingdom!</a></span> </li> <li class="listing-item"> <span class="date_class"> 2014-04-01 </span> &raquo; <span class="title"><a href="/2014/04/01/mountain-top-servers-are-now-literally-in-the-clouds/" >Mountain-top servers are now literally in the clouds</a></span> </li> <li class="listing-item"> <span class="date_class"> 2014-03-23 </span> &raquo; <span class="title"><a href="/2014/03/23/unit-testing-with-the-domain-layer/" >Unit Testing with the Domain Layer</a></span> </li> <li class="listing-item"> <span class="date_class"> 2014-03-07 </span> &raquo; <span class="title"><a href="/2014/03/07/getting-started-with-chromecast-on-visualforce/" >Getting Started with Chromecast on Visualforce</a></span> </li> <li class="listing-item"> <span class="date_class"> 2014-02-19 </span> &raquo; <span class="title"><a href="/2014/02/19/clicks-not-code-with-visual-flow-custom-buttons/" >Clicks not Code with Visual Flow Custom Buttons</a></span> </li> <li class="listing-item"> <span class="date_class"> 2014-02-12 </span> &raquo; <span class="title"><a href="/2014/02/12/my-devops-take-aways/" >My DevOps Take Aways</a></span> </li> <li class="listing-item"> <span class="date_class"> 2014-01-19 </span> &raquo; <span class="title"><a href="/2014/01/19/apex-testing-username-creation-best-practice/" >Apex Testing Username Creation Best Practice</a></span> </li> <li class="listing-item"> <span class="date_class"> 2014-01-07 </span> &raquo; <span class="title"><a href="/2014/01/07/why-feature-branches-are-a-good-thing/" >Why feature branches are a good thing</a></span> </li> <li class="listing-item"> <span class="date_class"> 2014-01-05 </span> &raquo; <span class="title"><a href="/2014/01/05/welcome-to-dreamops/" >Welcome to DreamOps</a></span> </li> </ul> <h4 class="archive-ul" data-toggle="collapse" data-target="#2013">2013<b class="caret"></b></h4> <ul id="2013" class="collapse in"> <li class="listing-item"> <span class="date_class"> 2013-04-15 </span> &raquo; <span class="title"><a href="/2013/04/15/why-standard-profile-permissions-can-t-be-changed/" >Why &#39;Standard&#39; Profile Permissions Can&#39;t Be Changed</a></span> </li> </ul> </div> </div> <!-- col-md-9/col-md-12 --> <div class="col-md-3"> <div id="sidebar"> <div id="site_search"> <div class="form-group"> <input type="text" id="local-search-input" name="q" results="0" placeholder="Search" class="st-search-input st-default-search-input form-control"/> </div> <div id="local-search-result"></div> </div> <div class="widget"> <h4>Recent Posts</h4> <ul class="entry list-unstyled"> <li> <a href="/2017/05/28/lightning-component-dev-tips/" ><i class="fa fa-file-o"></i>Lightning Component Dev Tips</a> </li> <li> <a href="/2017/05/27/creating-a-jira-change-log-in-confluence/" ><i class="fa fa-file-o"></i>Creating a JIRA Change Log ...</a> </li> <li> <a href="/2017/05/23/introducing-slackforce-a-salesforce-slack-community/" ><i class="fa fa-file-o"></i>Introducing Slackforce: A S...</a> </li> <li> <a href="/2017/05/22/updating-multiple-sites-from-jenkins/" ><i class="fa fa-file-o"></i>Updating Multiple Sites fro...</a> </li> <li> <a href="/2017/05/17/free-debugger-for-unlimited-edition/" ><i class="fa fa-file-o"></i>Free Debugger for Unlimited...</a> </li> </ul> </div> <div class="widget"> <h4>Links</h4> <ul class="blogroll list-unstyled"> <li><i class=""></i><a href="https://github.com/DreamOps/ant-sf" title="Ant SF (pilot)" target="_blank"]);">Migration Tool on steroids</a></li> <li><i class=""></i><a href="http://www.dreamops.org/guide" title="Guide (beta)" target="_blank"]);">Guide to Continuous Delivery</a></li> <li><i class=""></i><a href="http://www.dreamops.org/planet" title="Planet (feedly)" target="_blank"]);">Every SF blog in the known universe</a></li> <li><i class=""></i><a href="http://www.dreamops.org/group" title="Success Group" target="_blank"]);">Chew the fat, geek to geek</a></li> <li><i class=""></i><a href="http://www.dreamops.org/hub" title="Hub" target="_blank"]);">Show me the source</a></li> <li><i class=""></i><a href="http://www.dreamops.org/wiki/index.html" title="Wiki" target="_blank"]);">Best Practice Articles</a></li> <li><i class=""></i><a href="/roadmap/index.html" title="Roadmap" target="_blank"]);">Invent the Future</a></li> </ul> </div> </div> <!-- sidebar --> </div> <!-- col-md-3 --> </div> </div> <div class="container-narrow"> <footer> <p><a href="http://www.dreamops.org/powered-by/index.html">DreamOps is made possible by Nimble AMS Engineering</a>.</p> </footer> </div> <!-- container-narrow --> <a id="gotop" href="#"> <span>▲</span> </a> <a href="/atom.xml"><img src="/images/rss.png"/></a> <script src="/js/jquery.imagesloaded.min.js"></script> <script src="/js/gallery.js"></script> <script src="/js/bootstrap.min.js"></script> <script src="/js/main.js"></script> <script src="/js/search.js"></script> <link rel="stylesheet" href="/fancybox/jquery.fancybox.css" media="screen" type="text/css"> <script src="/fancybox/jquery.fancybox.pack.js"></script> <script type="text/javascript"> (function($){ $('.fancybox').fancybox(); })(jQuery); </script> <script type="text/javascript"> var search_path = "search.xml"; if (search_path.length == 0) { search_path = "search.xml"; } var path = "/" + search_path; searchFunc(path, 'local-search-input', 'local-search-result'); </script> </body> </html>
bsd-2-clause
m6w6/ext-psi
src/data.c
7823
/******************************************************************************* Copyright (c) 2016, Michael Wallner <[email protected]>. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ #ifdef HAVE_CONFIG_H # include "config.h" #else # include "php_config.h" #endif #include "php_psi.h" #include "data.h" #include "php_globals.h" #include "zend_types.h" #include <dlfcn.h> #include <ctype.h> #if PSI_THREADED_PARSER # include <pthread.h> static pthread_mutex_t psi_string_mutex = PTHREAD_MUTEX_INITIALIZER; zend_string *psi_string_init_interned(const char *buf, size_t len, int p) { zend_string *str; pthread_mutex_lock(&psi_string_mutex); str = zend_string_init_interned(buf, len, p); pthread_mutex_unlock(&psi_string_mutex); return str; } zend_string *psi_new_interned_string(zend_string *str) { zend_string *new_str; pthread_mutex_lock(&psi_string_mutex); new_str = zend_new_interned_string(str); pthread_mutex_unlock(&psi_string_mutex); return new_str; } #endif static void psi_data_ctor_internal(struct psi_data *data, psi_error_cb error, unsigned flags) { data->error = error; data->flags = flags; if (data->flags & PSI_DEBUG) { int fd = psi_fdopen(getenv("PSI_DEBUG")); if (fd > 0) { data->debug_fd = fd; } else { data->debug_fd = STDERR_FILENO; } } } struct psi_data *psi_data_ctor_with_dtors(struct psi_data *data, psi_error_cb error, unsigned flags) { if (!data) { data = pecalloc(1, sizeof(*data), 1); } psi_data_ctor_internal(data, error, flags); if (!data->file.libnames) { data->file.libnames = psi_plist_init((psi_plist_dtor) psi_names_free); } if (!data->file.dlopened) { data->file.dlopened = psi_plist_init((psi_plist_dtor) psi_libs_free); } if (!data->consts) { data->consts = psi_plist_init((psi_plist_dtor) psi_const_free); } if (!data->types) { data->types = psi_plist_init((psi_plist_dtor) psi_decl_arg_free); } if (!data->structs) { data->structs = psi_plist_init((psi_plist_dtor) psi_decl_struct_free); } if (!data->unions) { data->unions = psi_plist_init((psi_plist_dtor) psi_decl_union_free); } if (!data->enums) { data->enums = psi_plist_init((psi_plist_dtor) psi_decl_enum_free); } if (!data->decls) { data->decls = psi_plist_init((psi_plist_dtor) psi_decl_free); } if (!data->vars) { data->vars = psi_plist_init((psi_plist_dtor) psi_decl_extvar_free); } if (!data->impls) { data->impls = psi_plist_init((psi_plist_dtor) psi_impl_free); } return data; } struct psi_data *psi_data_ctor(struct psi_data *data, psi_error_cb error, unsigned flags) { if (!data) { data = pecalloc(1, sizeof(*data), 1); } psi_data_ctor_internal(data, error, flags); if (!data->file.libnames) { data->file.libnames = psi_plist_init(NULL); } if (!data->file.dlopened) { data->file.dlopened = psi_plist_init(NULL); } if (!data->consts) { data->consts = psi_plist_init(NULL); } if (!data->types) { data->types = psi_plist_init(NULL); } if (!data->structs) { data->structs = psi_plist_init(NULL); } if (!data->unions) { data->unions = psi_plist_init(NULL); } if (!data->enums) { data->enums = psi_plist_init(NULL); } if (!data->decls) { data->decls = psi_plist_init(NULL); } if (!data->vars) { data->vars = psi_plist_init(NULL); } if (!data->impls) { data->impls = psi_plist_init(NULL); } return data; } struct psi_data *psi_data_exchange(struct psi_data *dest, struct psi_data *src) { if (!dest) { dest = pemalloc(sizeof(*dest), 1); } *dest = *src; memset(src, 0, sizeof(*src)); return dest; } void psi_data_dtor(struct psi_data *data) { if (data->debug_fd) { close(data->debug_fd); } if (data->consts) { psi_plist_free(data->consts); } if (data->types) { psi_plist_free(data->types); } if (data->structs) { psi_plist_free(data->structs); } if (data->unions) { psi_plist_free(data->unions); } if (data->enums) { psi_plist_free(data->enums); } if (data->decls) { psi_plist_free(data->decls); } if (data->vars) { psi_plist_free(data->vars); } if (data->impls) { psi_plist_free(data->impls); } psi_decl_file_dtor(&data->file); } void psi_data_dump(struct psi_dump *dump, struct psi_data *D) { size_t i = 0; zend_string *libname; if (D->file.filename) { PSI_DUMP(dump, "// filename=%s (%u errors)\n", D->file.filename->val, D->errors); } while (psi_plist_get(D->file.libnames, i++, &libname)) { PSI_DUMP(dump, "#pragma lib \"%s\"\n", libname->val); } if (psi_plist_count(D->types)) { size_t i = 0; struct psi_decl_arg *def; while (psi_plist_get(D->types, i++, &def)) { PSI_DUMP(dump, "typedef "); psi_decl_arg_dump(dump, def, 0); PSI_DUMP(dump, ";\n"); } PSI_DUMP(dump, "\n"); } if (psi_plist_count(D->unions)) { size_t i = 0; struct psi_decl_union *unn; while (psi_plist_get(D->unions, i++, &unn)) { if (!psi_decl_type_is_anon(unn->name, "union")) { psi_decl_union_dump(dump, unn); PSI_DUMP(dump, "\n"); } } PSI_DUMP(dump, "\n"); } if (psi_plist_count(D->structs)) { size_t i = 0; struct psi_decl_struct *strct; while (psi_plist_get(D->structs, i++, &strct)) { if (!psi_decl_type_is_anon(strct->name, "struct")) { psi_decl_struct_dump(dump, strct); PSI_DUMP(dump, "\n"); } } PSI_DUMP(dump, "\n"); } if (psi_plist_count(D->enums)) { size_t i = 0; struct psi_decl_enum *enm; while (psi_plist_get(D->enums, i++, &enm)) { if (true || !psi_decl_type_is_anon(enm->name, "enum")) { psi_decl_enum_dump(dump, enm, 0); PSI_DUMP(dump, "\n"); } } PSI_DUMP(dump, "\n"); } if (psi_plist_count(D->consts)) { size_t i = 0; struct psi_const *c; while (psi_plist_get(D->consts, i++, &c)) { psi_const_dump(dump, c); PSI_DUMP(dump, "\n"); } PSI_DUMP(dump, "\n"); } if (psi_plist_count(D->decls)) { size_t i = 0; struct psi_decl *decl; while (psi_plist_get(D->decls, i++, &decl)) { if (decl->extvar) { PSI_DUMP(dump, "/* extvar accessor \n"); } psi_decl_dump(dump, decl); if (decl->extvar) { PSI_DUMP(dump, " */"); } PSI_DUMP(dump, "\n"); } PSI_DUMP(dump, "\n"); } if (psi_plist_count(D->vars)) { size_t i = 0; struct psi_decl_extvar *evar; while (psi_plist_get(D->vars, i++, &evar)) { psi_decl_extvar_dump(dump, evar); } PSI_DUMP(dump, "\n"); } if (psi_plist_count(D->impls)) { size_t i = 0; struct psi_impl *impl; while (psi_plist_get(D->impls, i++, &impl)) { psi_impl_dump(dump, impl); PSI_DUMP(dump, "\n"); } PSI_DUMP(dump, "\n"); } }
bsd-2-clause
cblecker/homebrew-core
Formula/git-gui.rb
2119
class GitGui < Formula desc "Tcl/Tk UI for the git revision control system" homepage "https://git-scm.com" # NOTE: Please keep these values in sync with git.rb when updating. url "https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.31.1.tar.xz" sha256 "9f61417a44d5b954a5012b6f34e526a3336dcf5dd720e2bb7ada92ad8b3d6680" license "GPL-2.0-only" head "https://github.com/git/git.git", shallow: false bottle do sha256 cellar: :any_skip_relocation, arm64_big_sur: "f6941b6984b73e4f89c9635a6113a0401461821febd431116dd06cf4971ec469" sha256 cellar: :any_skip_relocation, big_sur: "430d3e73a3d07bb170c1bd3eb3db3a5cbb283e1fd72671e9607f00cce23982eb" sha256 cellar: :any_skip_relocation, catalina: "603bf37ef37e46f4ec88855d44bd61a227299638dda5690c367b55c733ba3cf7" sha256 cellar: :any_skip_relocation, mojave: "59df29678a0fa2c9546ee91ec1c8d4061ad3ae7436ecb4beef92fecd6c62de41" end depends_on "tcl-tk" # Patch to fix Homebrew/homebrew-core#68798. # Remove when the following PR has been merged # and included in a release: # https://github.com/git/git/pull/944 patch do url "https://github.com/git/git/commit/1db62e44b7ec93b6654271ef34065b31496cd02e.patch?full_index=1" sha256 "0c7816ee9c8ddd7aa38aa29541c9138997650713bce67bdef501b1de0b50f539" end def install # build verbosely ENV["V"] = "1" # By setting TKFRAMEWORK to a non-existent directory we ensure that # the git makefiles don't install a .app for git-gui # We also tell git to use the homebrew-installed wish binary from tcl-tk. # See https://github.com/Homebrew/homebrew-core/issues/36390 tcl_bin = Formula["tcl-tk"].opt_bin args = %W[ TKFRAMEWORK=/dev/null prefix=#{prefix} gitexecdir=#{bin} sysconfdir=#{etc} CC=#{ENV.cc} CFLAGS=#{ENV.cflags} LDFLAGS=#{ENV.ldflags} TCL_PATH=#{tcl_bin}/tclsh TCLTK_PATH=#{tcl_bin}/wish ] system "make", "-C", "git-gui", "install", *args system "make", "-C", "gitk-git", "install", *args end test do system bin/"git-gui", "--version" end end
bsd-2-clause
smilix/StockViewer
web/lib/bootstrap/css/bootstrap-mod.css
126610
/*! * Bootstrap v2.3.2 * * Copyright 2012 Twitter, Inc * Licensed under the Apache License v2.0 * http://www.apache.org/licenses/LICENSE-2.0 * * Designed and built with all the love in the world @twitter by @mdo and @fat. * * Modification: print style removed */ .clearfix { *zoom: 1; } .clearfix:before, .clearfix:after { display: table; line-height: 0; content: ""; } .clearfix:after { clear: both; } .hide-text { font: 0/0 a; color: transparent; text-shadow: none; background-color: transparent; border: 0; } .input-block-level { display: block; width: 100%; min-height: 30px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } article, aside, details, figcaption, figure, footer, header, hgroup, nav, section { display: block; } audio, canvas, video { display: inline-block; *display: inline; *zoom: 1; } audio:not([controls]) { display: none; } html { font-size: 100%; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; } a:focus { outline: thin dotted #333; outline: 5px auto -webkit-focus-ring-color; outline-offset: -2px; } a:hover, a:active { outline: 0; } sub, sup { position: relative; font-size: 75%; line-height: 0; vertical-align: baseline; } sup { top: -0.5em; } sub { bottom: -0.25em; } img { width: auto\9; height: auto; max-width: 100%; vertical-align: middle; border: 0; -ms-interpolation-mode: bicubic; } #map_canvas img, .google-maps img { max-width: none; } button, input, select, textarea { margin: 0; font-size: 100%; vertical-align: middle; } button, input { *overflow: visible; line-height: normal; } button::-moz-focus-inner, input::-moz-focus-inner { padding: 0; border: 0; } button, html input[type="button"], input[type="reset"], input[type="submit"] { cursor: pointer; -webkit-appearance: button; } label, select, button, input[type="button"], input[type="reset"], input[type="submit"], input[type="radio"], input[type="checkbox"] { cursor: pointer; } input[type="search"] { -webkit-box-sizing: content-box; -moz-box-sizing: content-box; box-sizing: content-box; -webkit-appearance: textfield; } input[type="search"]::-webkit-search-decoration, input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; } textarea { overflow: auto; vertical-align: top; } body { margin: 0; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; color: #333333; background-color: #ffffff; } a { color: #0088cc; text-decoration: none; } a:hover, a:focus { color: #005580; text-decoration: underline; } .img-rounded { -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; } .img-polaroid { padding: 4px; background-color: #fff; border: 1px solid #ccc; border: 1px solid rgba(0, 0, 0, 0.2); -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); } .img-circle { -webkit-border-radius: 500px; -moz-border-radius: 500px; border-radius: 500px; } .row { margin-left: -20px; *zoom: 1; } .row:before, .row:after { display: table; line-height: 0; content: ""; } .row:after { clear: both; } [class*="span"] { float: left; min-height: 1px; margin-left: 20px; } .container, .navbar-static-top .container, .navbar-fixed-top .container, .navbar-fixed-bottom .container { width: 940px; } .span12 { width: 940px; } .span11 { width: 860px; } .span10 { width: 780px; } .span9 { width: 700px; } .span8 { width: 620px; } .span7 { width: 540px; } .span6 { width: 460px; } .span5 { width: 380px; } .span4 { width: 300px; } .span3 { width: 220px; } .span2 { width: 140px; } .span1 { width: 60px; } .offset12 { margin-left: 980px; } .offset11 { margin-left: 900px; } .offset10 { margin-left: 820px; } .offset9 { margin-left: 740px; } .offset8 { margin-left: 660px; } .offset7 { margin-left: 580px; } .offset6 { margin-left: 500px; } .offset5 { margin-left: 420px; } .offset4 { margin-left: 340px; } .offset3 { margin-left: 260px; } .offset2 { margin-left: 180px; } .offset1 { margin-left: 100px; } .row-fluid { width: 100%; *zoom: 1; } .row-fluid:before, .row-fluid:after { display: table; line-height: 0; content: ""; } .row-fluid:after { clear: both; } .row-fluid [class*="span"] { display: block; float: left; width: 100%; min-height: 30px; margin-left: 2.127659574468085%; *margin-left: 2.074468085106383%; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .row-fluid [class*="span"]:first-child { margin-left: 0; } .row-fluid .controls-row [class*="span"] + [class*="span"] { margin-left: 2.127659574468085%; } .row-fluid .span12 { width: 100%; *width: 99.94680851063829%; } .row-fluid .span11 { width: 91.48936170212765%; *width: 91.43617021276594%; } .row-fluid .span10 { width: 82.97872340425532%; *width: 82.92553191489361%; } .row-fluid .span9 { width: 74.46808510638297%; *width: 74.41489361702126%; } .row-fluid .span8 { width: 65.95744680851064%; *width: 65.90425531914893%; } .row-fluid .span7 { width: 57.44680851063829%; *width: 57.39361702127659%; } .row-fluid .span6 { width: 48.93617021276595%; *width: 48.88297872340425%; } .row-fluid .span5 { width: 40.42553191489362%; *width: 40.37234042553192%; } .row-fluid .span4 { width: 31.914893617021278%; *width: 31.861702127659576%; } .row-fluid .span3 { width: 23.404255319148934%; *width: 23.351063829787233%; } .row-fluid .span2 { width: 14.893617021276595%; *width: 14.840425531914894%; } .row-fluid .span1 { width: 6.382978723404255%; *width: 6.329787234042553%; } .row-fluid .offset12 { margin-left: 104.25531914893617%; *margin-left: 104.14893617021275%; } .row-fluid .offset12:first-child { margin-left: 102.12765957446808%; *margin-left: 102.02127659574467%; } .row-fluid .offset11 { margin-left: 95.74468085106382%; *margin-left: 95.6382978723404%; } .row-fluid .offset11:first-child { margin-left: 93.61702127659574%; *margin-left: 93.51063829787232%; } .row-fluid .offset10 { margin-left: 87.23404255319149%; *margin-left: 87.12765957446807%; } .row-fluid .offset10:first-child { margin-left: 85.1063829787234%; *margin-left: 84.99999999999999%; } .row-fluid .offset9 { margin-left: 78.72340425531914%; *margin-left: 78.61702127659572%; } .row-fluid .offset9:first-child { margin-left: 76.59574468085106%; *margin-left: 76.48936170212764%; } .row-fluid .offset8 { margin-left: 70.2127659574468%; *margin-left: 70.10638297872339%; } .row-fluid .offset8:first-child { margin-left: 68.08510638297872%; *margin-left: 67.9787234042553%; } .row-fluid .offset7 { margin-left: 61.70212765957446%; *margin-left: 61.59574468085106%; } .row-fluid .offset7:first-child { margin-left: 59.574468085106375%; *margin-left: 59.46808510638297%; } .row-fluid .offset6 { margin-left: 53.191489361702125%; *margin-left: 53.085106382978715%; } .row-fluid .offset6:first-child { margin-left: 51.063829787234035%; *margin-left: 50.95744680851063%; } .row-fluid .offset5 { margin-left: 44.68085106382979%; *margin-left: 44.57446808510638%; } .row-fluid .offset5:first-child { margin-left: 42.5531914893617%; *margin-left: 42.4468085106383%; } .row-fluid .offset4 { margin-left: 36.170212765957444%; *margin-left: 36.06382978723405%; } .row-fluid .offset4:first-child { margin-left: 34.04255319148936%; *margin-left: 33.93617021276596%; } .row-fluid .offset3 { margin-left: 27.659574468085104%; *margin-left: 27.5531914893617%; } .row-fluid .offset3:first-child { margin-left: 25.53191489361702%; *margin-left: 25.425531914893618%; } .row-fluid .offset2 { margin-left: 19.148936170212764%; *margin-left: 19.04255319148936%; } .row-fluid .offset2:first-child { margin-left: 17.02127659574468%; *margin-left: 16.914893617021278%; } .row-fluid .offset1 { margin-left: 10.638297872340425%; *margin-left: 10.53191489361702%; } .row-fluid .offset1:first-child { margin-left: 8.51063829787234%; *margin-left: 8.404255319148938%; } [class*="span"].hide, .row-fluid [class*="span"].hide { display: none; } [class*="span"].pull-right, .row-fluid [class*="span"].pull-right { float: right; } .container { margin-right: auto; margin-left: auto; *zoom: 1; } .container:before, .container:after { display: table; line-height: 0; content: ""; } .container:after { clear: both; } .container-fluid { padding-right: 20px; padding-left: 20px; *zoom: 1; } .container-fluid:before, .container-fluid:after { display: table; line-height: 0; content: ""; } .container-fluid:after { clear: both; } p { margin: 0 0 10px; } .lead { margin-bottom: 20px; font-size: 21px; font-weight: 200; line-height: 30px; } small { font-size: 85%; } strong { font-weight: bold; } em { font-style: italic; } cite { font-style: normal; } .muted { color: #999999; } a.muted:hover, a.muted:focus { color: #808080; } .text-warning { color: #c09853; } a.text-warning:hover, a.text-warning:focus { color: #a47e3c; } .text-error { color: #b94a48; } a.text-error:hover, a.text-error:focus { color: #953b39; } .text-info { color: #3a87ad; } a.text-info:hover, a.text-info:focus { color: #2d6987; } .text-success { color: #468847; } a.text-success:hover, a.text-success:focus { color: #356635; } .text-left { text-align: left; } .text-right { text-align: right; } .text-center { text-align: center; } h1, h2, h3, h4, h5, h6 { margin: 10px 0; font-family: inherit; font-weight: bold; line-height: 20px; color: inherit; text-rendering: optimizelegibility; } h1 small, h2 small, h3 small, h4 small, h5 small, h6 small { font-weight: normal; line-height: 1; color: #999999; } h1, h2, h3 { line-height: 40px; } h1 { font-size: 38.5px; } h2 { font-size: 31.5px; } h3 { font-size: 24.5px; } h4 { font-size: 17.5px; } h5 { font-size: 14px; } h6 { font-size: 11.9px; } h1 small { font-size: 24.5px; } h2 small { font-size: 17.5px; } h3 small { font-size: 14px; } h4 small { font-size: 14px; } .page-header { padding-bottom: 9px; margin: 20px 0 30px; border-bottom: 1px solid #eeeeee; } ul, ol { padding: 0; margin: 0 0 10px 25px; } ul ul, ul ol, ol ol, ol ul { margin-bottom: 0; } li { line-height: 20px; } ul.unstyled, ol.unstyled { margin-left: 0; list-style: none; } ul.inline, ol.inline { margin-left: 0; list-style: none; } ul.inline > li, ol.inline > li { display: inline-block; *display: inline; padding-right: 5px; padding-left: 5px; *zoom: 1; } dl { margin-bottom: 20px; } dt, dd { line-height: 20px; } dt { font-weight: bold; } dd { margin-left: 10px; } .dl-horizontal { *zoom: 1; } .dl-horizontal:before, .dl-horizontal:after { display: table; line-height: 0; content: ""; } .dl-horizontal:after { clear: both; } .dl-horizontal dt { float: left; width: 160px; overflow: hidden; clear: left; text-align: right; text-overflow: ellipsis; white-space: nowrap; } .dl-horizontal dd { margin-left: 180px; } hr { margin: 20px 0; border: 0; border-top: 1px solid #eeeeee; border-bottom: 1px solid #ffffff; } abbr[title], abbr[data-original-title] { cursor: help; border-bottom: 1px dotted #999999; } abbr.initialism { font-size: 90%; text-transform: uppercase; } blockquote { padding: 0 0 0 15px; margin: 0 0 20px; border-left: 5px solid #eeeeee; } blockquote p { margin-bottom: 0; font-size: 17.5px; font-weight: 300; line-height: 1.25; } blockquote small { display: block; line-height: 20px; color: #999999; } blockquote small:before { content: '\2014 \00A0'; } blockquote.pull-right { float: right; padding-right: 15px; padding-left: 0; border-right: 5px solid #eeeeee; border-left: 0; } blockquote.pull-right p, blockquote.pull-right small { text-align: right; } blockquote.pull-right small:before { content: ''; } blockquote.pull-right small:after { content: '\00A0 \2014'; } q:before, q:after, blockquote:before, blockquote:after { content: ""; } address { display: block; margin-bottom: 20px; font-style: normal; line-height: 20px; } code, pre { padding: 0 3px 2px; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12px; color: #333333; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; } code { padding: 2px 4px; color: #d14; white-space: nowrap; background-color: #f7f7f9; border: 1px solid #e1e1e8; } pre { display: block; padding: 9.5px; margin: 0 0 10px; font-size: 13px; line-height: 20px; word-break: break-all; word-wrap: break-word; white-space: pre; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid #ccc; border: 1px solid rgba(0, 0, 0, 0.15); -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } pre.prettyprint { margin-bottom: 20px; } pre code { padding: 0; color: inherit; white-space: pre; white-space: pre-wrap; background-color: transparent; border: 0; } .pre-scrollable { max-height: 340px; overflow-y: scroll; } form { margin: 0 0 20px; } fieldset { padding: 0; margin: 0; border: 0; } legend { display: block; width: 100%; padding: 0; margin-bottom: 20px; font-size: 21px; line-height: 40px; color: #333333; border: 0; border-bottom: 1px solid #e5e5e5; } legend small { font-size: 15px; color: #999999; } label, input, button, select, textarea { font-size: 14px; font-weight: normal; line-height: 20px; } input, button, select, textarea { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; } label { display: block; margin-bottom: 5px; } select, textarea, input[type="text"], input[type="password"], input[type="datetime"], input[type="datetime-local"], input[type="date"], input[type="month"], input[type="time"], input[type="week"], input[type="number"], input[type="email"], input[type="url"], input[type="search"], input[type="tel"], input[type="color"], .uneditable-input { display: inline-block; height: 20px; padding: 4px 6px; margin-bottom: 10px; font-size: 14px; line-height: 20px; color: #555555; vertical-align: middle; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } input, textarea, .uneditable-input { width: 206px; } textarea { height: auto; } textarea, input[type="text"], input[type="password"], input[type="datetime"], input[type="datetime-local"], input[type="date"], input[type="month"], input[type="time"], input[type="week"], input[type="number"], input[type="email"], input[type="url"], input[type="search"], input[type="tel"], input[type="color"], .uneditable-input { background-color: #ffffff; border: 1px solid #cccccc; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -webkit-transition: border linear 0.2s, box-shadow linear 0.2s; -moz-transition: border linear 0.2s, box-shadow linear 0.2s; -o-transition: border linear 0.2s, box-shadow linear 0.2s; transition: border linear 0.2s, box-shadow linear 0.2s; } textarea:focus, input[type="text"]:focus, input[type="password"]:focus, input[type="datetime"]:focus, input[type="datetime-local"]:focus, input[type="date"]:focus, input[type="month"]:focus, input[type="time"]:focus, input[type="week"]:focus, input[type="number"]:focus, input[type="email"]:focus, input[type="url"]:focus, input[type="search"]:focus, input[type="tel"]:focus, input[type="color"]:focus, .uneditable-input:focus { border-color: rgba(82, 168, 236, 0.8); outline: 0; outline: thin dotted \9; /* IE6-9 */ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6); -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6); } input[type="radio"], input[type="checkbox"] { margin: 4px 0 0; margin-top: 1px \9; *margin-top: 0; line-height: normal; } input[type="file"], input[type="image"], input[type="submit"], input[type="reset"], input[type="button"], input[type="radio"], input[type="checkbox"] { width: auto; } select, input[type="file"] { height: 30px; /* In IE7, the height of the select element cannot be changed by height, only font-size */ *margin-top: 4px; /* For IE7, add top margin to align select with labels */ line-height: 30px; } select { width: 220px; background-color: #ffffff; border: 1px solid #cccccc; } select[multiple], select[size] { height: auto; } select:focus, input[type="file"]:focus, input[type="radio"]:focus, input[type="checkbox"]:focus { outline: thin dotted #333; outline: 5px auto -webkit-focus-ring-color; outline-offset: -2px; } .uneditable-input, .uneditable-textarea { color: #999999; cursor: not-allowed; background-color: #fcfcfc; border-color: #cccccc; -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025); -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025); } .uneditable-input { overflow: hidden; white-space: nowrap; } .uneditable-textarea { width: auto; height: auto; } input:-moz-placeholder, textarea:-moz-placeholder { color: #999999; } input:-ms-input-placeholder, textarea:-ms-input-placeholder { color: #999999; } input::-webkit-input-placeholder, textarea::-webkit-input-placeholder { color: #999999; } .radio, .checkbox { min-height: 20px; padding-left: 20px; } .radio input[type="radio"], .checkbox input[type="checkbox"] { float: left; margin-left: -20px; } .controls > .radio:first-child, .controls > .checkbox:first-child { padding-top: 5px; } .radio.inline, .checkbox.inline { display: inline-block; padding-top: 5px; margin-bottom: 0; vertical-align: middle; } .radio.inline + .radio.inline, .checkbox.inline + .checkbox.inline { margin-left: 10px; } .input-mini { width: 60px; } .input-small { width: 90px; } .input-medium { width: 150px; } .input-large { width: 210px; } .input-xlarge { width: 270px; } .input-xxlarge { width: 530px; } input[class*="span"], select[class*="span"], textarea[class*="span"], .uneditable-input[class*="span"], .row-fluid input[class*="span"], .row-fluid select[class*="span"], .row-fluid textarea[class*="span"], .row-fluid .uneditable-input[class*="span"] { float: none; margin-left: 0; } .input-append input[class*="span"], .input-append .uneditable-input[class*="span"], .input-prepend input[class*="span"], .input-prepend .uneditable-input[class*="span"], .row-fluid input[class*="span"], .row-fluid select[class*="span"], .row-fluid textarea[class*="span"], .row-fluid .uneditable-input[class*="span"], .row-fluid .input-prepend [class*="span"], .row-fluid .input-append [class*="span"] { display: inline-block; } input, textarea, .uneditable-input { margin-left: 0; } .controls-row [class*="span"] + [class*="span"] { margin-left: 20px; } input.span12, textarea.span12, .uneditable-input.span12 { width: 926px; } input.span11, textarea.span11, .uneditable-input.span11 { width: 846px; } input.span10, textarea.span10, .uneditable-input.span10 { width: 766px; } input.span9, textarea.span9, .uneditable-input.span9 { width: 686px; } input.span8, textarea.span8, .uneditable-input.span8 { width: 606px; } input.span7, textarea.span7, .uneditable-input.span7 { width: 526px; } input.span6, textarea.span6, .uneditable-input.span6 { width: 446px; } input.span5, textarea.span5, .uneditable-input.span5 { width: 366px; } input.span4, textarea.span4, .uneditable-input.span4 { width: 286px; } input.span3, textarea.span3, .uneditable-input.span3 { width: 206px; } input.span2, textarea.span2, .uneditable-input.span2 { width: 126px; } input.span1, textarea.span1, .uneditable-input.span1 { width: 46px; } .controls-row { *zoom: 1; } .controls-row:before, .controls-row:after { display: table; line-height: 0; content: ""; } .controls-row:after { clear: both; } .controls-row [class*="span"], .row-fluid .controls-row [class*="span"] { float: left; } .controls-row .checkbox[class*="span"], .controls-row .radio[class*="span"] { padding-top: 5px; } input[disabled], select[disabled], textarea[disabled], input[readonly], select[readonly], textarea[readonly] { cursor: not-allowed; background-color: #eeeeee; } input[type="radio"][disabled], input[type="checkbox"][disabled], input[type="radio"][readonly], input[type="checkbox"][readonly] { background-color: transparent; } .control-group.warning .control-label, .control-group.warning .help-block, .control-group.warning .help-inline { color: #c09853; } .control-group.warning .checkbox, .control-group.warning .radio, .control-group.warning input, .control-group.warning select, .control-group.warning textarea { color: #c09853; } .control-group.warning input, .control-group.warning select, .control-group.warning textarea { border-color: #c09853; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); } .control-group.warning input:focus, .control-group.warning select:focus, .control-group.warning textarea:focus { border-color: #a47e3c; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #dbc59e; -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #dbc59e; box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #dbc59e; } .control-group.warning .input-prepend .add-on, .control-group.warning .input-append .add-on { color: #c09853; background-color: #fcf8e3; border-color: #c09853; } .control-group.error .control-label, .control-group.error .help-block, .control-group.error .help-inline { color: #b94a48; } .control-group.error .checkbox, .control-group.error .radio, .control-group.error input, .control-group.error select, .control-group.error textarea { color: #b94a48; } .control-group.error input, .control-group.error select, .control-group.error textarea { border-color: #b94a48; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); } .control-group.error input:focus, .control-group.error select:focus, .control-group.error textarea:focus { border-color: #953b39; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #d59392; -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #d59392; box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #d59392; } .control-group.error .input-prepend .add-on, .control-group.error .input-append .add-on { color: #b94a48; background-color: #f2dede; border-color: #b94a48; } .control-group.success .control-label, .control-group.success .help-block, .control-group.success .help-inline { color: #468847; } .control-group.success .checkbox, .control-group.success .radio, .control-group.success input, .control-group.success select, .control-group.success textarea { color: #468847; } .control-group.success input, .control-group.success select, .control-group.success textarea { border-color: #468847; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); } .control-group.success input:focus, .control-group.success select:focus, .control-group.success textarea:focus { border-color: #356635; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7aba7b; -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7aba7b; box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7aba7b; } .control-group.success .input-prepend .add-on, .control-group.success .input-append .add-on { color: #468847; background-color: #dff0d8; border-color: #468847; } .control-group.info .control-label, .control-group.info .help-block, .control-group.info .help-inline { color: #3a87ad; } .control-group.info .checkbox, .control-group.info .radio, .control-group.info input, .control-group.info select, .control-group.info textarea { color: #3a87ad; } .control-group.info input, .control-group.info select, .control-group.info textarea { border-color: #3a87ad; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); } .control-group.info input:focus, .control-group.info select:focus, .control-group.info textarea:focus { border-color: #2d6987; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7ab5d3; -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7ab5d3; box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7ab5d3; } .control-group.info .input-prepend .add-on, .control-group.info .input-append .add-on { color: #3a87ad; background-color: #d9edf7; border-color: #3a87ad; } input:focus:invalid, textarea:focus:invalid, select:focus:invalid { color: #b94a48; border-color: #ee5f5b; } input:focus:invalid:focus, textarea:focus:invalid:focus, select:focus:invalid:focus { border-color: #e9322d; -webkit-box-shadow: 0 0 6px #f8b9b7; -moz-box-shadow: 0 0 6px #f8b9b7; box-shadow: 0 0 6px #f8b9b7; } .form-actions { padding: 19px 20px 20px; margin-top: 20px; margin-bottom: 20px; background-color: #f5f5f5; border-top: 1px solid #e5e5e5; *zoom: 1; } .form-actions:before, .form-actions:after { display: table; line-height: 0; content: ""; } .form-actions:after { clear: both; } .help-block, .help-inline { color: #595959; } .help-block { display: block; margin-bottom: 10px; } .help-inline { display: inline-block; *display: inline; padding-left: 5px; vertical-align: middle; *zoom: 1; } .input-append, .input-prepend { display: inline-block; margin-bottom: 10px; font-size: 0; white-space: nowrap; vertical-align: middle; } .input-append input, .input-prepend input, .input-append select, .input-prepend select, .input-append .uneditable-input, .input-prepend .uneditable-input, .input-append .dropdown-menu, .input-prepend .dropdown-menu, .input-append .popover, .input-prepend .popover { font-size: 14px; } .input-append input, .input-prepend input, .input-append select, .input-prepend select, .input-append .uneditable-input, .input-prepend .uneditable-input { position: relative; margin-bottom: 0; *margin-left: 0; vertical-align: top; -webkit-border-radius: 0 4px 4px 0; -moz-border-radius: 0 4px 4px 0; border-radius: 0 4px 4px 0; } .input-append input:focus, .input-prepend input:focus, .input-append select:focus, .input-prepend select:focus, .input-append .uneditable-input:focus, .input-prepend .uneditable-input:focus { z-index: 2; } .input-append .add-on, .input-prepend .add-on { display: inline-block; width: auto; height: 20px; min-width: 16px; padding: 4px 5px; font-size: 14px; font-weight: normal; line-height: 20px; text-align: center; text-shadow: 0 1px 0 #ffffff; background-color: #eeeeee; border: 1px solid #ccc; } .input-append .add-on, .input-prepend .add-on, .input-append .btn, .input-prepend .btn, .input-append .btn-group > .dropdown-toggle, .input-prepend .btn-group > .dropdown-toggle { vertical-align: top; -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0; } .input-append .active, .input-prepend .active { background-color: #a9dba9; border-color: #46a546; } .input-prepend .add-on, .input-prepend .btn { margin-right: -1px; } .input-prepend .add-on:first-child, .input-prepend .btn:first-child { -webkit-border-radius: 4px 0 0 4px; -moz-border-radius: 4px 0 0 4px; border-radius: 4px 0 0 4px; } .input-append input, .input-append select, .input-append .uneditable-input { -webkit-border-radius: 4px 0 0 4px; -moz-border-radius: 4px 0 0 4px; border-radius: 4px 0 0 4px; } .input-append input + .btn-group .btn:last-child, .input-append select + .btn-group .btn:last-child, .input-append .uneditable-input + .btn-group .btn:last-child { -webkit-border-radius: 0 4px 4px 0; -moz-border-radius: 0 4px 4px 0; border-radius: 0 4px 4px 0; } .input-append .add-on, .input-append .btn, .input-append .btn-group { margin-left: -1px; } .input-append .add-on:last-child, .input-append .btn:last-child, .input-append .btn-group:last-child > .dropdown-toggle { -webkit-border-radius: 0 4px 4px 0; -moz-border-radius: 0 4px 4px 0; border-radius: 0 4px 4px 0; } .input-prepend.input-append input, .input-prepend.input-append select, .input-prepend.input-append .uneditable-input { -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0; } .input-prepend.input-append input + .btn-group .btn, .input-prepend.input-append select + .btn-group .btn, .input-prepend.input-append .uneditable-input + .btn-group .btn { -webkit-border-radius: 0 4px 4px 0; -moz-border-radius: 0 4px 4px 0; border-radius: 0 4px 4px 0; } .input-prepend.input-append .add-on:first-child, .input-prepend.input-append .btn:first-child { margin-right: -1px; -webkit-border-radius: 4px 0 0 4px; -moz-border-radius: 4px 0 0 4px; border-radius: 4px 0 0 4px; } .input-prepend.input-append .add-on:last-child, .input-prepend.input-append .btn:last-child { margin-left: -1px; -webkit-border-radius: 0 4px 4px 0; -moz-border-radius: 0 4px 4px 0; border-radius: 0 4px 4px 0; } .input-prepend.input-append .btn-group:first-child { margin-left: 0; } input.search-query { padding-right: 14px; padding-right: 4px \9; padding-left: 14px; padding-left: 4px \9; /* IE7-8 doesn't have border-radius, so don't indent the padding */ margin-bottom: 0; -webkit-border-radius: 15px; -moz-border-radius: 15px; border-radius: 15px; } /* Allow for input prepend/append in search forms */ .form-search .input-append .search-query, .form-search .input-prepend .search-query { -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0; } .form-search .input-append .search-query { -webkit-border-radius: 14px 0 0 14px; -moz-border-radius: 14px 0 0 14px; border-radius: 14px 0 0 14px; } .form-search .input-append .btn { -webkit-border-radius: 0 14px 14px 0; -moz-border-radius: 0 14px 14px 0; border-radius: 0 14px 14px 0; } .form-search .input-prepend .search-query { -webkit-border-radius: 0 14px 14px 0; -moz-border-radius: 0 14px 14px 0; border-radius: 0 14px 14px 0; } .form-search .input-prepend .btn { -webkit-border-radius: 14px 0 0 14px; -moz-border-radius: 14px 0 0 14px; border-radius: 14px 0 0 14px; } .form-search input, .form-inline input, .form-horizontal input, .form-search textarea, .form-inline textarea, .form-horizontal textarea, .form-search select, .form-inline select, .form-horizontal select, .form-search .help-inline, .form-inline .help-inline, .form-horizontal .help-inline, .form-search .uneditable-input, .form-inline .uneditable-input, .form-horizontal .uneditable-input, .form-search .input-prepend, .form-inline .input-prepend, .form-horizontal .input-prepend, .form-search .input-append, .form-inline .input-append, .form-horizontal .input-append { display: inline-block; *display: inline; margin-bottom: 0; vertical-align: middle; *zoom: 1; } .form-search .hide, .form-inline .hide, .form-horizontal .hide { display: none; } .form-search label, .form-inline label, .form-search .btn-group, .form-inline .btn-group { display: inline-block; } .form-search .input-append, .form-inline .input-append, .form-search .input-prepend, .form-inline .input-prepend { margin-bottom: 0; } .form-search .radio, .form-search .checkbox, .form-inline .radio, .form-inline .checkbox { padding-left: 0; margin-bottom: 0; vertical-align: middle; } .form-search .radio input[type="radio"], .form-search .checkbox input[type="checkbox"], .form-inline .radio input[type="radio"], .form-inline .checkbox input[type="checkbox"] { float: left; margin-right: 3px; margin-left: 0; } .control-group { margin-bottom: 10px; } legend + .control-group { margin-top: 20px; -webkit-margin-top-collapse: separate; } .form-horizontal .control-group { margin-bottom: 20px; *zoom: 1; } .form-horizontal .control-group:before, .form-horizontal .control-group:after { display: table; line-height: 0; content: ""; } .form-horizontal .control-group:after { clear: both; } .form-horizontal .control-label { float: left; width: 160px; padding-top: 5px; text-align: right; } .form-horizontal .controls { *display: inline-block; *padding-left: 20px; margin-left: 180px; *margin-left: 0; } .form-horizontal .controls:first-child { *padding-left: 180px; } .form-horizontal .help-block { margin-bottom: 0; } .form-horizontal input + .help-block, .form-horizontal select + .help-block, .form-horizontal textarea + .help-block, .form-horizontal .uneditable-input + .help-block, .form-horizontal .input-prepend + .help-block, .form-horizontal .input-append + .help-block { margin-top: 10px; } .form-horizontal .form-actions { padding-left: 180px; } table { max-width: 100%; background-color: transparent; border-collapse: collapse; border-spacing: 0; } .table { width: 100%; margin-bottom: 20px; } .table th, .table td { padding: 8px; line-height: 20px; text-align: left; vertical-align: top; border-top: 1px solid #dddddd; } .table th { font-weight: bold; } .table thead th { vertical-align: bottom; } .table caption + thead tr:first-child th, .table caption + thead tr:first-child td, .table colgroup + thead tr:first-child th, .table colgroup + thead tr:first-child td, .table thead:first-child tr:first-child th, .table thead:first-child tr:first-child td { border-top: 0; } .table tbody + tbody { border-top: 2px solid #dddddd; } .table .table { background-color: #ffffff; } .table-condensed th, .table-condensed td { padding: 4px 5px; } .table-bordered { border: 1px solid #dddddd; border-collapse: separate; *border-collapse: collapse; border-left: 0; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } .table-bordered th, .table-bordered td { border-left: 1px solid #dddddd; } .table-bordered caption + thead tr:first-child th, .table-bordered caption + tbody tr:first-child th, .table-bordered caption + tbody tr:first-child td, .table-bordered colgroup + thead tr:first-child th, .table-bordered colgroup + tbody tr:first-child th, .table-bordered colgroup + tbody tr:first-child td, .table-bordered thead:first-child tr:first-child th, .table-bordered tbody:first-child tr:first-child th, .table-bordered tbody:first-child tr:first-child td { border-top: 0; } .table-bordered thead:first-child tr:first-child > th:first-child, .table-bordered tbody:first-child tr:first-child > td:first-child, .table-bordered tbody:first-child tr:first-child > th:first-child { -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-topleft: 4px; } .table-bordered thead:first-child tr:first-child > th:last-child, .table-bordered tbody:first-child tr:first-child > td:last-child, .table-bordered tbody:first-child tr:first-child > th:last-child { -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; -moz-border-radius-topright: 4px; } .table-bordered thead:last-child tr:last-child > th:first-child, .table-bordered tbody:last-child tr:last-child > td:first-child, .table-bordered tbody:last-child tr:last-child > th:first-child, .table-bordered tfoot:last-child tr:last-child > td:first-child, .table-bordered tfoot:last-child tr:last-child > th:first-child { -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; -moz-border-radius-bottomleft: 4px; } .table-bordered thead:last-child tr:last-child > th:last-child, .table-bordered tbody:last-child tr:last-child > td:last-child, .table-bordered tbody:last-child tr:last-child > th:last-child, .table-bordered tfoot:last-child tr:last-child > td:last-child, .table-bordered tfoot:last-child tr:last-child > th:last-child { -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; -moz-border-radius-bottomright: 4px; } .table-bordered tfoot + tbody:last-child tr:last-child td:first-child { -webkit-border-bottom-left-radius: 0; border-bottom-left-radius: 0; -moz-border-radius-bottomleft: 0; } .table-bordered tfoot + tbody:last-child tr:last-child td:last-child { -webkit-border-bottom-right-radius: 0; border-bottom-right-radius: 0; -moz-border-radius-bottomright: 0; } .table-bordered caption + thead tr:first-child th:first-child, .table-bordered caption + tbody tr:first-child td:first-child, .table-bordered colgroup + thead tr:first-child th:first-child, .table-bordered colgroup + tbody tr:first-child td:first-child { -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-topleft: 4px; } .table-bordered caption + thead tr:first-child th:last-child, .table-bordered caption + tbody tr:first-child td:last-child, .table-bordered colgroup + thead tr:first-child th:last-child, .table-bordered colgroup + tbody tr:first-child td:last-child { -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; -moz-border-radius-topright: 4px; } .table-striped tbody > tr:nth-child(odd) > td, .table-striped tbody > tr:nth-child(odd) > th { background-color: #f9f9f9; } .table-hover tbody tr:hover > td, .table-hover tbody tr:hover > th { background-color: #f5f5f5; } table td[class*="span"], table th[class*="span"], .row-fluid table td[class*="span"], .row-fluid table th[class*="span"] { display: table-cell; float: none; margin-left: 0; } .table td.span1, .table th.span1 { float: none; width: 44px; margin-left: 0; } .table td.span2, .table th.span2 { float: none; width: 124px; margin-left: 0; } .table td.span3, .table th.span3 { float: none; width: 204px; margin-left: 0; } .table td.span4, .table th.span4 { float: none; width: 284px; margin-left: 0; } .table td.span5, .table th.span5 { float: none; width: 364px; margin-left: 0; } .table td.span6, .table th.span6 { float: none; width: 444px; margin-left: 0; } .table td.span7, .table th.span7 { float: none; width: 524px; margin-left: 0; } .table td.span8, .table th.span8 { float: none; width: 604px; margin-left: 0; } .table td.span9, .table th.span9 { float: none; width: 684px; margin-left: 0; } .table td.span10, .table th.span10 { float: none; width: 764px; margin-left: 0; } .table td.span11, .table th.span11 { float: none; width: 844px; margin-left: 0; } .table td.span12, .table th.span12 { float: none; width: 924px; margin-left: 0; } .table tbody tr.success > td { background-color: #dff0d8; } .table tbody tr.error > td { background-color: #f2dede; } .table tbody tr.warning > td { background-color: #fcf8e3; } .table tbody tr.info > td { background-color: #d9edf7; } .table-hover tbody tr.success:hover > td { background-color: #d0e9c6; } .table-hover tbody tr.error:hover > td { background-color: #ebcccc; } .table-hover tbody tr.warning:hover > td { background-color: #faf2cc; } .table-hover tbody tr.info:hover > td { background-color: #c4e3f3; } [class^="icon-"], [class*=" icon-"] { display: inline-block; width: 14px; height: 14px; margin-top: 1px; *margin-right: .3em; line-height: 14px; vertical-align: text-top; background-image: url("../img/glyphicons-halflings.png"); background-position: 14px 14px; background-repeat: no-repeat; } /* White icons with optional class, or on hover/focus/active states of certain elements */ .icon-white, .nav-pills > .active > a > [class^="icon-"], .nav-pills > .active > a > [class*=" icon-"], .nav-list > .active > a > [class^="icon-"], .nav-list > .active > a > [class*=" icon-"], .navbar-inverse .nav > .active > a > [class^="icon-"], .navbar-inverse .nav > .active > a > [class*=" icon-"], .dropdown-menu > li > a:hover > [class^="icon-"], .dropdown-menu > li > a:focus > [class^="icon-"], .dropdown-menu > li > a:hover > [class*=" icon-"], .dropdown-menu > li > a:focus > [class*=" icon-"], .dropdown-menu > .active > a > [class^="icon-"], .dropdown-menu > .active > a > [class*=" icon-"], .dropdown-submenu:hover > a > [class^="icon-"], .dropdown-submenu:focus > a > [class^="icon-"], .dropdown-submenu:hover > a > [class*=" icon-"], .dropdown-submenu:focus > a > [class*=" icon-"] { background-image: url("../img/glyphicons-halflings-white.png"); } .icon-glass { background-position: 0 0; } .icon-music { background-position: -24px 0; } .icon-search { background-position: -48px 0; } .icon-envelope { background-position: -72px 0; } .icon-heart { background-position: -96px 0; } .icon-star { background-position: -120px 0; } .icon-star-empty { background-position: -144px 0; } .icon-user { background-position: -168px 0; } .icon-film { background-position: -192px 0; } .icon-th-large { background-position: -216px 0; } .icon-th { background-position: -240px 0; } .icon-th-list { background-position: -264px 0; } .icon-ok { background-position: -288px 0; } .icon-remove { background-position: -312px 0; } .icon-zoom-in { background-position: -336px 0; } .icon-zoom-out { background-position: -360px 0; } .icon-off { background-position: -384px 0; } .icon-signal { background-position: -408px 0; } .icon-cog { background-position: -432px 0; } .icon-trash { background-position: -456px 0; } .icon-home { background-position: 0 -24px; } .icon-file { background-position: -24px -24px; } .icon-time { background-position: -48px -24px; } .icon-road { background-position: -72px -24px; } .icon-download-alt { background-position: -96px -24px; } .icon-download { background-position: -120px -24px; } .icon-upload { background-position: -144px -24px; } .icon-inbox { background-position: -168px -24px; } .icon-play-circle { background-position: -192px -24px; } .icon-repeat { background-position: -216px -24px; } .icon-refresh { background-position: -240px -24px; } .icon-list-alt { background-position: -264px -24px; } .icon-lock { background-position: -287px -24px; } .icon-flag { background-position: -312px -24px; } .icon-headphones { background-position: -336px -24px; } .icon-volume-off { background-position: -360px -24px; } .icon-volume-down { background-position: -384px -24px; } .icon-volume-up { background-position: -408px -24px; } .icon-qrcode { background-position: -432px -24px; } .icon-barcode { background-position: -456px -24px; } .icon-tag { background-position: 0 -48px; } .icon-tags { background-position: -25px -48px; } .icon-book { background-position: -48px -48px; } .icon-bookmark { background-position: -72px -48px; } .icon-print { background-position: -96px -48px; } .icon-camera { background-position: -120px -48px; } .icon-font { background-position: -144px -48px; } .icon-bold { background-position: -167px -48px; } .icon-italic { background-position: -192px -48px; } .icon-text-height { background-position: -216px -48px; } .icon-text-width { background-position: -240px -48px; } .icon-align-left { background-position: -264px -48px; } .icon-align-center { background-position: -288px -48px; } .icon-align-right { background-position: -312px -48px; } .icon-align-justify { background-position: -336px -48px; } .icon-list { background-position: -360px -48px; } .icon-indent-left { background-position: -384px -48px; } .icon-indent-right { background-position: -408px -48px; } .icon-facetime-video { background-position: -432px -48px; } .icon-picture { background-position: -456px -48px; } .icon-pencil { background-position: 0 -72px; } .icon-map-marker { background-position: -24px -72px; } .icon-adjust { background-position: -48px -72px; } .icon-tint { background-position: -72px -72px; } .icon-edit { background-position: -96px -72px; } .icon-share { background-position: -120px -72px; } .icon-check { background-position: -144px -72px; } .icon-move { background-position: -168px -72px; } .icon-step-backward { background-position: -192px -72px; } .icon-fast-backward { background-position: -216px -72px; } .icon-backward { background-position: -240px -72px; } .icon-play { background-position: -264px -72px; } .icon-pause { background-position: -288px -72px; } .icon-stop { background-position: -312px -72px; } .icon-forward { background-position: -336px -72px; } .icon-fast-forward { background-position: -360px -72px; } .icon-step-forward { background-position: -384px -72px; } .icon-eject { background-position: -408px -72px; } .icon-chevron-left { background-position: -432px -72px; } .icon-chevron-right { background-position: -456px -72px; } .icon-plus-sign { background-position: 0 -96px; } .icon-minus-sign { background-position: -24px -96px; } .icon-remove-sign { background-position: -48px -96px; } .icon-ok-sign { background-position: -72px -96px; } .icon-question-sign { background-position: -96px -96px; } .icon-info-sign { background-position: -120px -96px; } .icon-screenshot { background-position: -144px -96px; } .icon-remove-circle { background-position: -168px -96px; } .icon-ok-circle { background-position: -192px -96px; } .icon-ban-circle { background-position: -216px -96px; } .icon-arrow-left { background-position: -240px -96px; } .icon-arrow-right { background-position: -264px -96px; } .icon-arrow-up { background-position: -289px -96px; } .icon-arrow-down { background-position: -312px -96px; } .icon-share-alt { background-position: -336px -96px; } .icon-resize-full { background-position: -360px -96px; } .icon-resize-small { background-position: -384px -96px; } .icon-plus { background-position: -408px -96px; } .icon-minus { background-position: -433px -96px; } .icon-asterisk { background-position: -456px -96px; } .icon-exclamation-sign { background-position: 0 -120px; } .icon-gift { background-position: -24px -120px; } .icon-leaf { background-position: -48px -120px; } .icon-fire { background-position: -72px -120px; } .icon-eye-open { background-position: -96px -120px; } .icon-eye-close { background-position: -120px -120px; } .icon-warning-sign { background-position: -144px -120px; } .icon-plane { background-position: -168px -120px; } .icon-calendar { background-position: -192px -120px; } .icon-random { width: 16px; background-position: -216px -120px; } .icon-comment { background-position: -240px -120px; } .icon-magnet { background-position: -264px -120px; } .icon-chevron-up { background-position: -288px -120px; } .icon-chevron-down { background-position: -313px -119px; } .icon-retweet { background-position: -336px -120px; } .icon-shopping-cart { background-position: -360px -120px; } .icon-folder-close { width: 16px; background-position: -384px -120px; } .icon-folder-open { width: 16px; background-position: -408px -120px; } .icon-resize-vertical { background-position: -432px -119px; } .icon-resize-horizontal { background-position: -456px -118px; } .icon-hdd { background-position: 0 -144px; } .icon-bullhorn { background-position: -24px -144px; } .icon-bell { background-position: -48px -144px; } .icon-certificate { background-position: -72px -144px; } .icon-thumbs-up { background-position: -96px -144px; } .icon-thumbs-down { background-position: -120px -144px; } .icon-hand-right { background-position: -144px -144px; } .icon-hand-left { background-position: -168px -144px; } .icon-hand-up { background-position: -192px -144px; } .icon-hand-down { background-position: -216px -144px; } .icon-circle-arrow-right { background-position: -240px -144px; } .icon-circle-arrow-left { background-position: -264px -144px; } .icon-circle-arrow-up { background-position: -288px -144px; } .icon-circle-arrow-down { background-position: -312px -144px; } .icon-globe { background-position: -336px -144px; } .icon-wrench { background-position: -360px -144px; } .icon-tasks { background-position: -384px -144px; } .icon-filter { background-position: -408px -144px; } .icon-briefcase { background-position: -432px -144px; } .icon-fullscreen { background-position: -456px -144px; } .dropup, .dropdown { position: relative; } .dropdown-toggle { *margin-bottom: -3px; } .dropdown-toggle:active, .open .dropdown-toggle { outline: 0; } .caret { display: inline-block; width: 0; height: 0; vertical-align: top; border-top: 4px solid #000000; border-right: 4px solid transparent; border-left: 4px solid transparent; content: ""; } .dropdown .caret { margin-top: 8px; margin-left: 2px; } .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; background-color: #ffffff; border: 1px solid #ccc; border: 1px solid rgba(0, 0, 0, 0.2); *border-right-width: 2px; *border-bottom-width: 2px; -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); -moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); -webkit-background-clip: padding-box; -moz-background-clip: padding; background-clip: padding-box; } .dropdown-menu.pull-right { right: 0; left: auto; } .dropdown-menu .divider { *width: 100%; height: 1px; margin: 9px 1px; *margin: -5px 0 5px; overflow: hidden; background-color: #e5e5e5; border-bottom: 1px solid #ffffff; } .dropdown-menu > li > a { display: block; padding: 3px 20px; clear: both; font-weight: normal; line-height: 20px; color: #333333; white-space: nowrap; } .dropdown-menu > li > a:hover, .dropdown-menu > li > a:focus, .dropdown-submenu:hover > a, .dropdown-submenu:focus > a { color: #ffffff; text-decoration: none; background-color: #0081c2; background-image: -moz-linear-gradient(top, #0088cc, #0077b3); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0077b3)); background-image: -webkit-linear-gradient(top, #0088cc, #0077b3); background-image: -o-linear-gradient(top, #0088cc, #0077b3); background-image: linear-gradient(to bottom, #0088cc, #0077b3); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0); } .dropdown-menu > .active > a, .dropdown-menu > .active > a:hover, .dropdown-menu > .active > a:focus { color: #ffffff; text-decoration: none; background-color: #0081c2; background-image: -moz-linear-gradient(top, #0088cc, #0077b3); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0077b3)); background-image: -webkit-linear-gradient(top, #0088cc, #0077b3); background-image: -o-linear-gradient(top, #0088cc, #0077b3); background-image: linear-gradient(to bottom, #0088cc, #0077b3); background-repeat: repeat-x; outline: 0; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0); } .dropdown-menu > .disabled > a, .dropdown-menu > .disabled > a:hover, .dropdown-menu > .disabled > a:focus { color: #999999; } .dropdown-menu > .disabled > a:hover, .dropdown-menu > .disabled > a:focus { text-decoration: none; cursor: default; background-color: transparent; background-image: none; filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); } .open { *z-index: 1000; } .open > .dropdown-menu { display: block; } .dropdown-backdrop { position: fixed; top: 0; right: 0; bottom: 0; left: 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 solid #000000; content: ""; } .dropup .dropdown-menu, .navbar-fixed-bottom .dropdown .dropdown-menu { top: auto; bottom: 100%; margin-bottom: 1px; } .dropdown-submenu { position: relative; } .dropdown-submenu > .dropdown-menu { top: 0; left: 100%; margin-top: -6px; margin-left: -1px; -webkit-border-radius: 0 6px 6px 6px; -moz-border-radius: 0 6px 6px 6px; border-radius: 0 6px 6px 6px; } .dropdown-submenu:hover > .dropdown-menu { display: block; } .dropup .dropdown-submenu > .dropdown-menu { top: auto; bottom: 0; margin-top: 0; margin-bottom: -2px; -webkit-border-radius: 5px 5px 5px 0; -moz-border-radius: 5px 5px 5px 0; border-radius: 5px 5px 5px 0; } .dropdown-submenu > a:after { display: block; float: right; width: 0; height: 0; margin-top: 5px; margin-right: -10px; border-color: transparent; border-left-color: #cccccc; border-style: solid; border-width: 5px 0 5px 5px; content: " "; } .dropdown-submenu:hover > a:after { border-left-color: #ffffff; } .dropdown-submenu.pull-left { float: none; } .dropdown-submenu.pull-left > .dropdown-menu { left: -100%; margin-left: 10px; -webkit-border-radius: 6px 0 6px 6px; -moz-border-radius: 6px 0 6px 6px; border-radius: 6px 0 6px 6px; } .dropdown .dropdown-menu .nav-header { padding-right: 20px; padding-left: 20px; } .typeahead { z-index: 1051; margin-top: 2px; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } .well { min-height: 20px; padding: 19px; margin-bottom: 20px; background-color: #f5f5f5; border: 1px solid #e3e3e3; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); } .well blockquote { border-color: #ddd; border-color: rgba(0, 0, 0, 0.15); } .well-large { padding: 24px; -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; } .well-small { padding: 9px; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; } .fade { opacity: 0; -webkit-transition: opacity 0.15s linear; -moz-transition: opacity 0.15s linear; -o-transition: opacity 0.15s linear; transition: opacity 0.15s linear; } .fade.in { opacity: 1; } .collapse { position: relative; height: 0; overflow: hidden; -webkit-transition: height 0.35s ease; -moz-transition: height 0.35s ease; -o-transition: height 0.35s ease; transition: height 0.35s ease; } .collapse.in { height: auto; } .close { float: right; font-size: 20px; font-weight: bold; line-height: 20px; color: #000000; text-shadow: 0 1px 0 #ffffff; opacity: 0.2; filter: alpha(opacity=20); } .close:hover, .close:focus { color: #000000; text-decoration: none; cursor: pointer; opacity: 0.4; filter: alpha(opacity=40); } button.close { padding: 0; cursor: pointer; background: transparent; border: 0; -webkit-appearance: none; } .btn { display: inline-block; *display: inline; padding: 4px 12px; margin-bottom: 0; *margin-left: .3em; font-size: 14px; line-height: 20px; color: #333333; text-align: center; text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75); vertical-align: middle; cursor: pointer; background-color: #f5f5f5; *background-color: #e6e6e6; background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6)); background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6); background-image: -o-linear-gradient(top, #ffffff, #e6e6e6); background-image: linear-gradient(to bottom, #ffffff, #e6e6e6); background-repeat: repeat-x; border: 1px solid #cccccc; *border: 0; border-color: #e6e6e6 #e6e6e6 #bfbfbf; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); border-bottom-color: #b3b3b3; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe6e6e6', GradientType=0); filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); *zoom: 1; -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); } .btn:hover, .btn:focus, .btn:active, .btn.active, .btn.disabled, .btn[disabled] { color: #333333; background-color: #e6e6e6; *background-color: #d9d9d9; } .btn:active, .btn.active { background-color: #cccccc \9; } .btn:first-child { *margin-left: 0; } .btn:hover, .btn:focus { color: #333333; text-decoration: none; background-position: 0 -15px; -webkit-transition: background-position 0.1s linear; -moz-transition: background-position 0.1s linear; -o-transition: background-position 0.1s linear; transition: background-position 0.1s linear; } .btn:focus { outline: thin dotted #333; outline: 5px auto -webkit-focus-ring-color; outline-offset: -2px; } .btn.active, .btn:active { background-image: none; outline: 0; -webkit-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05); -moz-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05); box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05); } .btn.disabled, .btn[disabled] { cursor: default; background-image: none; opacity: 0.65; filter: alpha(opacity=65); -webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none; } .btn-large { padding: 11px 19px; font-size: 17.5px; -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; } .btn-large [class^="icon-"], .btn-large [class*=" icon-"] { margin-top: 4px; } .btn-small { padding: 2px 10px; font-size: 11.9px; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; } .btn-small [class^="icon-"], .btn-small [class*=" icon-"] { margin-top: 0; } .btn-mini [class^="icon-"], .btn-mini [class*=" icon-"] { margin-top: -1px; } .btn-mini { padding: 0 6px; font-size: 10.5px; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; } .btn-block { display: block; width: 100%; padding-right: 0; padding-left: 0; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .btn-block + .btn-block { margin-top: 5px; } input[type="submit"].btn-block, input[type="reset"].btn-block, input[type="button"].btn-block { width: 100%; } .btn-primary.active, .btn-warning.active, .btn-danger.active, .btn-success.active, .btn-info.active, .btn-inverse.active { color: rgba(255, 255, 255, 0.75); } .btn-primary { color: #ffffff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); background-color: #006dcc; *background-color: #0044cc; background-image: -moz-linear-gradient(top, #0088cc, #0044cc); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); background-image: -o-linear-gradient(top, #0088cc, #0044cc); background-image: linear-gradient(to bottom, #0088cc, #0044cc); background-repeat: repeat-x; border-color: #0044cc #0044cc #002a80; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0044cc', GradientType=0); filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); } .btn-primary:hover, .btn-primary:focus, .btn-primary:active, .btn-primary.active, .btn-primary.disabled, .btn-primary[disabled] { color: #ffffff; background-color: #0044cc; *background-color: #003bb3; } .btn-primary:active, .btn-primary.active { background-color: #003399 \9; } .btn-warning { color: #ffffff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); background-color: #faa732; *background-color: #f89406; background-image: -moz-linear-gradient(top, #fbb450, #f89406); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fbb450), to(#f89406)); background-image: -webkit-linear-gradient(top, #fbb450, #f89406); background-image: -o-linear-gradient(top, #fbb450, #f89406); background-image: linear-gradient(to bottom, #fbb450, #f89406); background-repeat: repeat-x; border-color: #f89406 #f89406 #ad6704; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffbb450', endColorstr='#fff89406', GradientType=0); filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); } .btn-warning:hover, .btn-warning:focus, .btn-warning:active, .btn-warning.active, .btn-warning.disabled, .btn-warning[disabled] { color: #ffffff; background-color: #f89406; *background-color: #df8505; } .btn-warning:active, .btn-warning.active { background-color: #c67605 \9; } .btn-danger { color: #ffffff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); background-color: #da4f49; *background-color: #bd362f; background-image: -moz-linear-gradient(top, #ee5f5b, #bd362f); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ee5f5b), to(#bd362f)); background-image: -webkit-linear-gradient(top, #ee5f5b, #bd362f); background-image: -o-linear-gradient(top, #ee5f5b, #bd362f); background-image: linear-gradient(to bottom, #ee5f5b, #bd362f); background-repeat: repeat-x; border-color: #bd362f #bd362f #802420; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffee5f5b', endColorstr='#ffbd362f', GradientType=0); filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); } .btn-danger:hover, .btn-danger:focus, .btn-danger:active, .btn-danger.active, .btn-danger.disabled, .btn-danger[disabled] { color: #ffffff; background-color: #bd362f; *background-color: #a9302a; } .btn-danger:active, .btn-danger.active { background-color: #942a25 \9; } .btn-success { color: #ffffff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); background-color: #5bb75b; *background-color: #51a351; background-image: -moz-linear-gradient(top, #62c462, #51a351); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#62c462), to(#51a351)); background-image: -webkit-linear-gradient(top, #62c462, #51a351); background-image: -o-linear-gradient(top, #62c462, #51a351); background-image: linear-gradient(to bottom, #62c462, #51a351); background-repeat: repeat-x; border-color: #51a351 #51a351 #387038; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff62c462', endColorstr='#ff51a351', GradientType=0); filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); } .btn-success:hover, .btn-success:focus, .btn-success:active, .btn-success.active, .btn-success.disabled, .btn-success[disabled] { color: #ffffff; background-color: #51a351; *background-color: #499249; } .btn-success:active, .btn-success.active { background-color: #408140 \9; } .btn-info { color: #ffffff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); background-color: #49afcd; *background-color: #2f96b4; background-image: -moz-linear-gradient(top, #5bc0de, #2f96b4); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#5bc0de), to(#2f96b4)); background-image: -webkit-linear-gradient(top, #5bc0de, #2f96b4); background-image: -o-linear-gradient(top, #5bc0de, #2f96b4); background-image: linear-gradient(to bottom, #5bc0de, #2f96b4); background-repeat: repeat-x; border-color: #2f96b4 #2f96b4 #1f6377; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2f96b4', GradientType=0); filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); } .btn-info:hover, .btn-info:focus, .btn-info:active, .btn-info.active, .btn-info.disabled, .btn-info[disabled] { color: #ffffff; background-color: #2f96b4; *background-color: #2a85a0; } .btn-info:active, .btn-info.active { background-color: #24748c \9; } .btn-inverse { color: #ffffff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); background-color: #363636; *background-color: #222222; background-image: -moz-linear-gradient(top, #444444, #222222); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#444444), to(#222222)); background-image: -webkit-linear-gradient(top, #444444, #222222); background-image: -o-linear-gradient(top, #444444, #222222); background-image: linear-gradient(to bottom, #444444, #222222); background-repeat: repeat-x; border-color: #222222 #222222 #000000; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff444444', endColorstr='#ff222222', GradientType=0); filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); } .btn-inverse:hover, .btn-inverse:focus, .btn-inverse:active, .btn-inverse.active, .btn-inverse.disabled, .btn-inverse[disabled] { color: #ffffff; background-color: #222222; *background-color: #151515; } .btn-inverse:active, .btn-inverse.active { background-color: #080808 \9; } button.btn, input[type="submit"].btn { *padding-top: 3px; *padding-bottom: 3px; } button.btn::-moz-focus-inner, input[type="submit"].btn::-moz-focus-inner { padding: 0; border: 0; } button.btn.btn-large, input[type="submit"].btn.btn-large { *padding-top: 7px; *padding-bottom: 7px; } button.btn.btn-small, input[type="submit"].btn.btn-small { *padding-top: 3px; *padding-bottom: 3px; } button.btn.btn-mini, input[type="submit"].btn.btn-mini { *padding-top: 1px; *padding-bottom: 1px; } .btn-link, .btn-link:active, .btn-link[disabled] { background-color: transparent; background-image: none; -webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none; } .btn-link { color: #0088cc; cursor: pointer; border-color: transparent; -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0; } .btn-link:hover, .btn-link:focus { color: #005580; text-decoration: underline; background-color: transparent; } .btn-link[disabled]:hover, .btn-link[disabled]:focus { color: #333333; text-decoration: none; } .btn-group { position: relative; display: inline-block; *display: inline; *margin-left: .3em; font-size: 0; white-space: nowrap; vertical-align: middle; *zoom: 1; } .btn-group:first-child { *margin-left: 0; } .btn-group + .btn-group { margin-left: 5px; } .btn-toolbar { margin-top: 10px; margin-bottom: 10px; font-size: 0; } .btn-toolbar > .btn + .btn, .btn-toolbar > .btn-group + .btn, .btn-toolbar > .btn + .btn-group { margin-left: 5px; } .btn-group > .btn { position: relative; -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0; } .btn-group > .btn + .btn { margin-left: -1px; } .btn-group > .btn, .btn-group > .dropdown-menu, .btn-group > .popover { font-size: 14px; } .btn-group > .btn-mini { font-size: 10.5px; } .btn-group > .btn-small { font-size: 11.9px; } .btn-group > .btn-large { font-size: 17.5px; } .btn-group > .btn:first-child { margin-left: 0; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-topleft: 4px; } .btn-group > .btn:last-child, .btn-group > .dropdown-toggle { -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; -moz-border-radius-topright: 4px; -moz-border-radius-bottomright: 4px; } .btn-group > .btn.large:first-child { margin-left: 0; -webkit-border-bottom-left-radius: 6px; border-bottom-left-radius: 6px; -webkit-border-top-left-radius: 6px; border-top-left-radius: 6px; -moz-border-radius-bottomleft: 6px; -moz-border-radius-topleft: 6px; } .btn-group > .btn.large:last-child, .btn-group > .large.dropdown-toggle { -webkit-border-top-right-radius: 6px; border-top-right-radius: 6px; -webkit-border-bottom-right-radius: 6px; border-bottom-right-radius: 6px; -moz-border-radius-topright: 6px; -moz-border-radius-bottomright: 6px; } .btn-group > .btn:hover, .btn-group > .btn:focus, .btn-group > .btn:active, .btn-group > .btn.active { z-index: 2; } .btn-group .dropdown-toggle:active, .btn-group.open .dropdown-toggle { outline: 0; } .btn-group > .btn + .dropdown-toggle { *padding-top: 5px; padding-right: 8px; *padding-bottom: 5px; padding-left: 8px; -webkit-box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.125), inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); -moz-box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.125), inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.125), inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); } .btn-group > .btn-mini + .dropdown-toggle { *padding-top: 2px; padding-right: 5px; *padding-bottom: 2px; padding-left: 5px; } .btn-group > .btn-small + .dropdown-toggle { *padding-top: 5px; *padding-bottom: 4px; } .btn-group > .btn-large + .dropdown-toggle { *padding-top: 7px; padding-right: 12px; *padding-bottom: 7px; padding-left: 12px; } .btn-group.open .dropdown-toggle { background-image: none; -webkit-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05); -moz-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05); box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05); } .btn-group.open .btn.dropdown-toggle { background-color: #e6e6e6; } .btn-group.open .btn-primary.dropdown-toggle { background-color: #0044cc; } .btn-group.open .btn-warning.dropdown-toggle { background-color: #f89406; } .btn-group.open .btn-danger.dropdown-toggle { background-color: #bd362f; } .btn-group.open .btn-success.dropdown-toggle { background-color: #51a351; } .btn-group.open .btn-info.dropdown-toggle { background-color: #2f96b4; } .btn-group.open .btn-inverse.dropdown-toggle { background-color: #222222; } .btn .caret { margin-top: 8px; margin-left: 0; } .btn-large .caret { margin-top: 6px; } .btn-large .caret { border-top-width: 5px; border-right-width: 5px; border-left-width: 5px; } .btn-mini .caret, .btn-small .caret { margin-top: 8px; } .dropup .btn-large .caret { border-bottom-width: 5px; } .btn-primary .caret, .btn-warning .caret, .btn-danger .caret, .btn-info .caret, .btn-success .caret, .btn-inverse .caret { border-top-color: #ffffff; border-bottom-color: #ffffff; } .btn-group-vertical { display: inline-block; *display: inline; /* IE7 inline-block hack */ *zoom: 1; } .btn-group-vertical > .btn { display: block; float: none; max-width: 100%; -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0; } .btn-group-vertical > .btn + .btn { margin-top: -1px; margin-left: 0; } .btn-group-vertical > .btn:first-child { -webkit-border-radius: 4px 4px 0 0; -moz-border-radius: 4px 4px 0 0; border-radius: 4px 4px 0 0; } .btn-group-vertical > .btn:last-child { -webkit-border-radius: 0 0 4px 4px; -moz-border-radius: 0 0 4px 4px; border-radius: 0 0 4px 4px; } .btn-group-vertical > .btn-large:first-child { -webkit-border-radius: 6px 6px 0 0; -moz-border-radius: 6px 6px 0 0; border-radius: 6px 6px 0 0; } .btn-group-vertical > .btn-large:last-child { -webkit-border-radius: 0 0 6px 6px; -moz-border-radius: 0 0 6px 6px; border-radius: 0 0 6px 6px; } .alert { padding: 8px 35px 8px 14px; margin-bottom: 20px; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); background-color: #fcf8e3; border: 1px solid #fbeed5; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } .alert, .alert h4 { color: #c09853; } .alert h4 { margin: 0; } .alert .close { position: relative; top: -2px; right: -21px; line-height: 20px; } .alert-success { color: #468847; background-color: #dff0d8; border-color: #d6e9c6; } .alert-success h4 { color: #468847; } .alert-danger, .alert-error { color: #b94a48; background-color: #f2dede; border-color: #eed3d7; } .alert-danger h4, .alert-error h4 { color: #b94a48; } .alert-info { color: #3a87ad; background-color: #d9edf7; border-color: #bce8f1; } .alert-info h4 { color: #3a87ad; } .alert-block { padding-top: 14px; padding-bottom: 14px; } .alert-block > p, .alert-block > ul { margin-bottom: 0; } .alert-block p + p { margin-top: 5px; } .nav { margin-bottom: 20px; margin-left: 0; list-style: none; } .nav > li > a { display: block; } .nav > li > a:hover, .nav > li > a:focus { text-decoration: none; background-color: #eeeeee; } .nav > li > a > img { max-width: none; } .nav > .pull-right { float: right; } .nav-header { display: block; padding: 3px 15px; font-size: 11px; font-weight: bold; line-height: 20px; color: #999999; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); text-transform: uppercase; } .nav li + .nav-header { margin-top: 9px; } .nav-list { padding-right: 15px; padding-left: 15px; margin-bottom: 0; } .nav-list > li > a, .nav-list .nav-header { margin-right: -15px; margin-left: -15px; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); } .nav-list > li > a { padding: 3px 15px; } .nav-list > .active > a, .nav-list > .active > a:hover, .nav-list > .active > a:focus { color: #ffffff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2); background-color: #0088cc; } .nav-list [class^="icon-"], .nav-list [class*=" icon-"] { margin-right: 2px; } .nav-list .divider { *width: 100%; height: 1px; margin: 9px 1px; *margin: -5px 0 5px; overflow: hidden; background-color: #e5e5e5; border-bottom: 1px solid #ffffff; } .nav-tabs, .nav-pills { *zoom: 1; } .nav-tabs:before, .nav-pills:before, .nav-tabs:after, .nav-pills:after { display: table; line-height: 0; content: ""; } .nav-tabs:after, .nav-pills:after { clear: both; } .nav-tabs > li, .nav-pills > li { float: left; } .nav-tabs > li > a, .nav-pills > li > a { padding-right: 12px; padding-left: 12px; margin-right: 2px; line-height: 14px; } .nav-tabs { border-bottom: 1px solid #ddd; } .nav-tabs > li { margin-bottom: -1px; } .nav-tabs > li > a { padding-top: 8px; padding-bottom: 8px; line-height: 20px; border: 1px solid transparent; -webkit-border-radius: 4px 4px 0 0; -moz-border-radius: 4px 4px 0 0; border-radius: 4px 4px 0 0; } .nav-tabs > li > a:hover, .nav-tabs > li > a:focus { border-color: #eeeeee #eeeeee #dddddd; } .nav-tabs > .active > a, .nav-tabs > .active > a:hover, .nav-tabs > .active > a:focus { color: #555555; cursor: default; background-color: #ffffff; border: 1px solid #ddd; border-bottom-color: transparent; } .nav-pills > li > a { padding-top: 8px; padding-bottom: 8px; margin-top: 2px; margin-bottom: 2px; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; } .nav-pills > .active > a, .nav-pills > .active > a:hover, .nav-pills > .active > a:focus { color: #ffffff; background-color: #0088cc; } .nav-stacked > li { float: none; } .nav-stacked > li > a { margin-right: 0; } .nav-tabs.nav-stacked { border-bottom: 0; } .nav-tabs.nav-stacked > li > a { border: 1px solid #ddd; -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0; } .nav-tabs.nav-stacked > li:first-child > a { -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -moz-border-radius-topleft: 4px; } .nav-tabs.nav-stacked > li:last-child > a { -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -moz-border-radius-bottomleft: 4px; } .nav-tabs.nav-stacked > li > a:hover, .nav-tabs.nav-stacked > li > a:focus { z-index: 2; border-color: #ddd; } .nav-pills.nav-stacked > li > a { margin-bottom: 3px; } .nav-pills.nav-stacked > li:last-child > a { margin-bottom: 1px; } .nav-tabs .dropdown-menu { -webkit-border-radius: 0 0 6px 6px; -moz-border-radius: 0 0 6px 6px; border-radius: 0 0 6px 6px; } .nav-pills .dropdown-menu { -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; } .nav .dropdown-toggle .caret { margin-top: 6px; border-top-color: #0088cc; border-bottom-color: #0088cc; } .nav .dropdown-toggle:hover .caret, .nav .dropdown-toggle:focus .caret { border-top-color: #005580; border-bottom-color: #005580; } /* move down carets for tabs */ .nav-tabs .dropdown-toggle .caret { margin-top: 8px; } .nav .active .dropdown-toggle .caret { border-top-color: #fff; border-bottom-color: #fff; } .nav-tabs .active .dropdown-toggle .caret { border-top-color: #555555; border-bottom-color: #555555; } .nav > .dropdown.active > a:hover, .nav > .dropdown.active > a:focus { cursor: pointer; } .nav-tabs .open .dropdown-toggle, .nav-pills .open .dropdown-toggle, .nav > li.dropdown.open.active > a:hover, .nav > li.dropdown.open.active > a:focus { color: #ffffff; background-color: #999999; border-color: #999999; } .nav li.dropdown.open .caret, .nav li.dropdown.open.active .caret, .nav li.dropdown.open a:hover .caret, .nav li.dropdown.open a:focus .caret { border-top-color: #ffffff; border-bottom-color: #ffffff; opacity: 1; filter: alpha(opacity=100); } .tabs-stacked .open > a:hover, .tabs-stacked .open > a:focus { border-color: #999999; } .tabbable { *zoom: 1; } .tabbable:before, .tabbable:after { display: table; line-height: 0; content: ""; } .tabbable:after { clear: both; } .tab-content { overflow: auto; } .tabs-below > .nav-tabs, .tabs-right > .nav-tabs, .tabs-left > .nav-tabs { border-bottom: 0; } .tab-content > .tab-pane, .pill-content > .pill-pane { display: none; } .tab-content > .active, .pill-content > .active { display: block; } .tabs-below > .nav-tabs { border-top: 1px solid #ddd; } .tabs-below > .nav-tabs > li { margin-top: -1px; margin-bottom: 0; } .tabs-below > .nav-tabs > li > a { -webkit-border-radius: 0 0 4px 4px; -moz-border-radius: 0 0 4px 4px; border-radius: 0 0 4px 4px; } .tabs-below > .nav-tabs > li > a:hover, .tabs-below > .nav-tabs > li > a:focus { border-top-color: #ddd; border-bottom-color: transparent; } .tabs-below > .nav-tabs > .active > a, .tabs-below > .nav-tabs > .active > a:hover, .tabs-below > .nav-tabs > .active > a:focus { border-color: transparent #ddd #ddd #ddd; } .tabs-left > .nav-tabs > li, .tabs-right > .nav-tabs > li { float: none; } .tabs-left > .nav-tabs > li > a, .tabs-right > .nav-tabs > li > a { min-width: 74px; margin-right: 0; margin-bottom: 3px; } .tabs-left > .nav-tabs { float: left; margin-right: 19px; border-right: 1px solid #ddd; } .tabs-left > .nav-tabs > li > a { margin-right: -1px; -webkit-border-radius: 4px 0 0 4px; -moz-border-radius: 4px 0 0 4px; border-radius: 4px 0 0 4px; } .tabs-left > .nav-tabs > li > a:hover, .tabs-left > .nav-tabs > li > a:focus { border-color: #eeeeee #dddddd #eeeeee #eeeeee; } .tabs-left > .nav-tabs .active > a, .tabs-left > .nav-tabs .active > a:hover, .tabs-left > .nav-tabs .active > a:focus { border-color: #ddd transparent #ddd #ddd; *border-right-color: #ffffff; } .tabs-right > .nav-tabs { float: right; margin-left: 19px; border-left: 1px solid #ddd; } .tabs-right > .nav-tabs > li > a { margin-left: -1px; -webkit-border-radius: 0 4px 4px 0; -moz-border-radius: 0 4px 4px 0; border-radius: 0 4px 4px 0; } .tabs-right > .nav-tabs > li > a:hover, .tabs-right > .nav-tabs > li > a:focus { border-color: #eeeeee #eeeeee #eeeeee #dddddd; } .tabs-right > .nav-tabs .active > a, .tabs-right > .nav-tabs .active > a:hover, .tabs-right > .nav-tabs .active > a:focus { border-color: #ddd #ddd #ddd transparent; *border-left-color: #ffffff; } .nav > .disabled > a { color: #999999; } .nav > .disabled > a:hover, .nav > .disabled > a:focus { text-decoration: none; cursor: default; background-color: transparent; } .navbar { *position: relative; *z-index: 2; margin-bottom: 20px; overflow: visible; } .navbar-inner { min-height: 40px; padding-right: 20px; padding-left: 20px; background-color: #fafafa; background-image: -moz-linear-gradient(top, #ffffff, #f2f2f2); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#f2f2f2)); background-image: -webkit-linear-gradient(top, #ffffff, #f2f2f2); background-image: -o-linear-gradient(top, #ffffff, #f2f2f2); background-image: linear-gradient(to bottom, #ffffff, #f2f2f2); background-repeat: repeat-x; border: 1px solid #d4d4d4; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff2f2f2', GradientType=0); *zoom: 1; -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.065); -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.065); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.065); } .navbar-inner:before, .navbar-inner:after { display: table; line-height: 0; content: ""; } .navbar-inner:after { clear: both; } .navbar .container { width: auto; } .nav-collapse.collapse { height: auto; overflow: visible; } .navbar .brand { display: block; float: left; padding: 10px 20px 10px; margin-left: -20px; font-size: 20px; font-weight: 200; color: #777777; text-shadow: 0 1px 0 #ffffff; } .navbar .brand:hover, .navbar .brand:focus { text-decoration: none; } .navbar-text { margin-bottom: 0; line-height: 40px; color: #777777; } .navbar-link { color: #777777; } .navbar-link:hover, .navbar-link:focus { color: #333333; } .navbar .divider-vertical { height: 40px; margin: 0 9px; border-right: 1px solid #ffffff; border-left: 1px solid #f2f2f2; } .navbar .btn, .navbar .btn-group { margin-top: 5px; } .navbar .btn-group .btn, .navbar .input-prepend .btn, .navbar .input-append .btn, .navbar .input-prepend .btn-group, .navbar .input-append .btn-group { margin-top: 0; } .navbar-form { margin-bottom: 0; *zoom: 1; } .navbar-form:before, .navbar-form:after { display: table; line-height: 0; content: ""; } .navbar-form:after { clear: both; } .navbar-form input, .navbar-form select, .navbar-form .radio, .navbar-form .checkbox { margin-top: 5px; } .navbar-form input, .navbar-form select, .navbar-form .btn { display: inline-block; margin-bottom: 0; } .navbar-form input[type="image"], .navbar-form input[type="checkbox"], .navbar-form input[type="radio"] { margin-top: 3px; } .navbar-form .input-append, .navbar-form .input-prepend { margin-top: 5px; white-space: nowrap; } .navbar-form .input-append input, .navbar-form .input-prepend input { margin-top: 0; } .navbar-search { position: relative; float: left; margin-top: 5px; margin-bottom: 0; } .navbar-search .search-query { padding: 4px 14px; margin-bottom: 0; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 13px; font-weight: normal; line-height: 1; -webkit-border-radius: 15px; -moz-border-radius: 15px; border-radius: 15px; } .navbar-static-top { position: static; margin-bottom: 0; } .navbar-static-top .navbar-inner { -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0; } .navbar-fixed-top, .navbar-fixed-bottom { position: fixed; right: 0; left: 0; z-index: 1030; margin-bottom: 0; } .navbar-fixed-top .navbar-inner, .navbar-static-top .navbar-inner { border-width: 0 0 1px; } .navbar-fixed-bottom .navbar-inner { border-width: 1px 0 0; } .navbar-fixed-top .navbar-inner, .navbar-fixed-bottom .navbar-inner { padding-right: 0; padding-left: 0; -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0; } .navbar-static-top .container, .navbar-fixed-top .container, .navbar-fixed-bottom .container { width: 940px; } .navbar-fixed-top { top: 0; } .navbar-fixed-top .navbar-inner, .navbar-static-top .navbar-inner { -webkit-box-shadow: 0 1px 10px rgba(0, 0, 0, 0.1); -moz-box-shadow: 0 1px 10px rgba(0, 0, 0, 0.1); box-shadow: 0 1px 10px rgba(0, 0, 0, 0.1); } .navbar-fixed-bottom { bottom: 0; } .navbar-fixed-bottom .navbar-inner { -webkit-box-shadow: 0 -1px 10px rgba(0, 0, 0, 0.1); -moz-box-shadow: 0 -1px 10px rgba(0, 0, 0, 0.1); box-shadow: 0 -1px 10px rgba(0, 0, 0, 0.1); } .navbar .nav { position: relative; left: 0; display: block; float: left; margin: 0 10px 0 0; } .navbar .nav.pull-right { float: right; margin-right: 0; } .navbar .nav > li { float: left; } .navbar .nav > li > a { float: none; padding: 10px 15px 10px; color: #777777; text-decoration: none; text-shadow: 0 1px 0 #ffffff; } .navbar .nav .dropdown-toggle .caret { margin-top: 8px; } .navbar .nav > li > a:focus, .navbar .nav > li > a:hover { color: #333333; text-decoration: none; background-color: transparent; } .navbar .nav > .active > a, .navbar .nav > .active > a:hover, .navbar .nav > .active > a:focus { color: #555555; text-decoration: none; background-color: #e5e5e5; -webkit-box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.125); -moz-box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.125); box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.125); } .navbar .btn-navbar { display: none; float: right; padding: 7px 10px; margin-right: 5px; margin-left: 5px; color: #ffffff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); background-color: #ededed; *background-color: #e5e5e5; background-image: -moz-linear-gradient(top, #f2f2f2, #e5e5e5); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f2f2f2), to(#e5e5e5)); background-image: -webkit-linear-gradient(top, #f2f2f2, #e5e5e5); background-image: -o-linear-gradient(top, #f2f2f2, #e5e5e5); background-image: linear-gradient(to bottom, #f2f2f2, #e5e5e5); background-repeat: repeat-x; border-color: #e5e5e5 #e5e5e5 #bfbfbf; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2f2f2', endColorstr='#ffe5e5e5', GradientType=0); filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.075); -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.075); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.075); } .navbar .btn-navbar:hover, .navbar .btn-navbar:focus, .navbar .btn-navbar:active, .navbar .btn-navbar.active, .navbar .btn-navbar.disabled, .navbar .btn-navbar[disabled] { color: #ffffff; background-color: #e5e5e5; *background-color: #d9d9d9; } .navbar .btn-navbar:active, .navbar .btn-navbar.active { background-color: #cccccc \9; } .navbar .btn-navbar .icon-bar { display: block; width: 18px; height: 2px; background-color: #f5f5f5; -webkit-border-radius: 1px; -moz-border-radius: 1px; border-radius: 1px; -webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); -moz-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); } .btn-navbar .icon-bar + .icon-bar { margin-top: 3px; } .navbar .nav > li > .dropdown-menu:before { position: absolute; top: -7px; left: 9px; display: inline-block; border-right: 7px solid transparent; border-bottom: 7px solid #ccc; border-left: 7px solid transparent; border-bottom-color: rgba(0, 0, 0, 0.2); content: ''; } .navbar .nav > li > .dropdown-menu:after { position: absolute; top: -6px; left: 10px; display: inline-block; border-right: 6px solid transparent; border-bottom: 6px solid #ffffff; border-left: 6px solid transparent; content: ''; } .navbar-fixed-bottom .nav > li > .dropdown-menu:before { top: auto; bottom: -7px; border-top: 7px solid #ccc; border-bottom: 0; border-top-color: rgba(0, 0, 0, 0.2); } .navbar-fixed-bottom .nav > li > .dropdown-menu:after { top: auto; bottom: -6px; border-top: 6px solid #ffffff; border-bottom: 0; } .navbar .nav li.dropdown > a:hover .caret, .navbar .nav li.dropdown > a:focus .caret { border-top-color: #333333; border-bottom-color: #333333; } .navbar .nav li.dropdown.open > .dropdown-toggle, .navbar .nav li.dropdown.active > .dropdown-toggle, .navbar .nav li.dropdown.open.active > .dropdown-toggle { color: #555555; background-color: #e5e5e5; } .navbar .nav li.dropdown > .dropdown-toggle .caret { border-top-color: #777777; border-bottom-color: #777777; } .navbar .nav li.dropdown.open > .dropdown-toggle .caret, .navbar .nav li.dropdown.active > .dropdown-toggle .caret, .navbar .nav li.dropdown.open.active > .dropdown-toggle .caret { border-top-color: #555555; border-bottom-color: #555555; } .navbar .pull-right > li > .dropdown-menu, .navbar .nav > li > .dropdown-menu.pull-right { right: 0; left: auto; } .navbar .pull-right > li > .dropdown-menu:before, .navbar .nav > li > .dropdown-menu.pull-right:before { right: 12px; left: auto; } .navbar .pull-right > li > .dropdown-menu:after, .navbar .nav > li > .dropdown-menu.pull-right:after { right: 13px; left: auto; } .navbar .pull-right > li > .dropdown-menu .dropdown-menu, .navbar .nav > li > .dropdown-menu.pull-right .dropdown-menu { right: 100%; left: auto; margin-right: -1px; margin-left: 0; -webkit-border-radius: 6px 0 6px 6px; -moz-border-radius: 6px 0 6px 6px; border-radius: 6px 0 6px 6px; } .navbar-inverse .navbar-inner { background-color: #1b1b1b; background-image: -moz-linear-gradient(top, #222222, #111111); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#222222), to(#111111)); background-image: -webkit-linear-gradient(top, #222222, #111111); background-image: -o-linear-gradient(top, #222222, #111111); background-image: linear-gradient(to bottom, #222222, #111111); background-repeat: repeat-x; border-color: #252525; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff222222', endColorstr='#ff111111', GradientType=0); } .navbar-inverse .brand, .navbar-inverse .nav > li > a { color: #999999; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); } .navbar-inverse .brand:hover, .navbar-inverse .nav > li > a:hover, .navbar-inverse .brand:focus, .navbar-inverse .nav > li > a:focus { color: #ffffff; } .navbar-inverse .brand { color: #999999; } .navbar-inverse .navbar-text { color: #999999; } .navbar-inverse .nav > li > a:focus, .navbar-inverse .nav > li > a:hover { color: #ffffff; background-color: transparent; } .navbar-inverse .nav .active > a, .navbar-inverse .nav .active > a:hover, .navbar-inverse .nav .active > a:focus { color: #ffffff; background-color: #111111; } .navbar-inverse .navbar-link { color: #999999; } .navbar-inverse .navbar-link:hover, .navbar-inverse .navbar-link:focus { color: #ffffff; } .navbar-inverse .divider-vertical { border-right-color: #222222; border-left-color: #111111; } .navbar-inverse .nav li.dropdown.open > .dropdown-toggle, .navbar-inverse .nav li.dropdown.active > .dropdown-toggle, .navbar-inverse .nav li.dropdown.open.active > .dropdown-toggle { color: #ffffff; background-color: #111111; } .navbar-inverse .nav li.dropdown > a:hover .caret, .navbar-inverse .nav li.dropdown > a:focus .caret { border-top-color: #ffffff; border-bottom-color: #ffffff; } .navbar-inverse .nav li.dropdown > .dropdown-toggle .caret { border-top-color: #999999; border-bottom-color: #999999; } .navbar-inverse .nav li.dropdown.open > .dropdown-toggle .caret, .navbar-inverse .nav li.dropdown.active > .dropdown-toggle .caret, .navbar-inverse .nav li.dropdown.open.active > .dropdown-toggle .caret { border-top-color: #ffffff; border-bottom-color: #ffffff; } .navbar-inverse .navbar-search .search-query { color: #ffffff; background-color: #515151; border-color: #111111; -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0 rgba(255, 255, 255, 0.15); -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0 rgba(255, 255, 255, 0.15); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0 rgba(255, 255, 255, 0.15); -webkit-transition: none; -moz-transition: none; -o-transition: none; transition: none; } .navbar-inverse .navbar-search .search-query:-moz-placeholder { color: #cccccc; } .navbar-inverse .navbar-search .search-query:-ms-input-placeholder { color: #cccccc; } .navbar-inverse .navbar-search .search-query::-webkit-input-placeholder { color: #cccccc; } .navbar-inverse .navbar-search .search-query:focus, .navbar-inverse .navbar-search .search-query.focused { padding: 5px 15px; color: #333333; text-shadow: 0 1px 0 #ffffff; background-color: #ffffff; border: 0; outline: 0; -webkit-box-shadow: 0 0 3px rgba(0, 0, 0, 0.15); -moz-box-shadow: 0 0 3px rgba(0, 0, 0, 0.15); box-shadow: 0 0 3px rgba(0, 0, 0, 0.15); } .navbar-inverse .btn-navbar { color: #ffffff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); background-color: #0e0e0e; *background-color: #040404; background-image: -moz-linear-gradient(top, #151515, #040404); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#151515), to(#040404)); background-image: -webkit-linear-gradient(top, #151515, #040404); background-image: -o-linear-gradient(top, #151515, #040404); background-image: linear-gradient(to bottom, #151515, #040404); background-repeat: repeat-x; border-color: #040404 #040404 #000000; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff151515', endColorstr='#ff040404', GradientType=0); filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); } .navbar-inverse .btn-navbar:hover, .navbar-inverse .btn-navbar:focus, .navbar-inverse .btn-navbar:active, .navbar-inverse .btn-navbar.active, .navbar-inverse .btn-navbar.disabled, .navbar-inverse .btn-navbar[disabled] { color: #ffffff; background-color: #040404; *background-color: #000000; } .navbar-inverse .btn-navbar:active, .navbar-inverse .btn-navbar.active { background-color: #000000 \9; } .breadcrumb { padding: 8px 15px; margin: 0 0 20px; list-style: none; background-color: #f5f5f5; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } .breadcrumb > li { display: inline-block; *display: inline; text-shadow: 0 1px 0 #ffffff; *zoom: 1; } .breadcrumb > li > .divider { padding: 0 5px; color: #ccc; } .breadcrumb > .active { color: #999999; } .pagination { margin: 20px 0; } .pagination ul { display: inline-block; *display: inline; margin-bottom: 0; margin-left: 0; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; *zoom: 1; -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); } .pagination ul > li { display: inline; } .pagination ul > li > a, .pagination ul > li > span { float: left; padding: 4px 12px; line-height: 20px; text-decoration: none; background-color: #ffffff; border: 1px solid #dddddd; border-left-width: 0; } .pagination ul > li > a:hover, .pagination ul > li > a:focus, .pagination ul > .active > a, .pagination ul > .active > span { background-color: #f5f5f5; } .pagination ul > .active > a, .pagination ul > .active > span { color: #999999; cursor: default; } .pagination ul > .disabled > span, .pagination ul > .disabled > a, .pagination ul > .disabled > a:hover, .pagination ul > .disabled > a:focus { color: #999999; cursor: default; background-color: transparent; } .pagination ul > li:first-child > a, .pagination ul > li:first-child > span { border-left-width: 1px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-topleft: 4px; } .pagination ul > li:last-child > a, .pagination ul > li:last-child > span { -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; -moz-border-radius-topright: 4px; -moz-border-radius-bottomright: 4px; } .pagination-centered { text-align: center; } .pagination-right { text-align: right; } .pagination-large ul > li > a, .pagination-large ul > li > span { padding: 11px 19px; font-size: 17.5px; } .pagination-large ul > li:first-child > a, .pagination-large ul > li:first-child > span { -webkit-border-bottom-left-radius: 6px; border-bottom-left-radius: 6px; -webkit-border-top-left-radius: 6px; border-top-left-radius: 6px; -moz-border-radius-bottomleft: 6px; -moz-border-radius-topleft: 6px; } .pagination-large ul > li:last-child > a, .pagination-large ul > li:last-child > span { -webkit-border-top-right-radius: 6px; border-top-right-radius: 6px; -webkit-border-bottom-right-radius: 6px; border-bottom-right-radius: 6px; -moz-border-radius-topright: 6px; -moz-border-radius-bottomright: 6px; } .pagination-mini ul > li:first-child > a, .pagination-small ul > li:first-child > a, .pagination-mini ul > li:first-child > span, .pagination-small ul > li:first-child > span { -webkit-border-bottom-left-radius: 3px; border-bottom-left-radius: 3px; -webkit-border-top-left-radius: 3px; border-top-left-radius: 3px; -moz-border-radius-bottomleft: 3px; -moz-border-radius-topleft: 3px; } .pagination-mini ul > li:last-child > a, .pagination-small ul > li:last-child > a, .pagination-mini ul > li:last-child > span, .pagination-small ul > li:last-child > span { -webkit-border-top-right-radius: 3px; border-top-right-radius: 3px; -webkit-border-bottom-right-radius: 3px; border-bottom-right-radius: 3px; -moz-border-radius-topright: 3px; -moz-border-radius-bottomright: 3px; } .pagination-small ul > li > a, .pagination-small ul > li > span { padding: 2px 10px; font-size: 11.9px; } .pagination-mini ul > li > a, .pagination-mini ul > li > span { padding: 0 6px; font-size: 10.5px; } .pager { margin: 20px 0; text-align: center; list-style: none; *zoom: 1; } .pager:before, .pager:after { display: table; line-height: 0; content: ""; } .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; -webkit-border-radius: 15px; -moz-border-radius: 15px; border-radius: 15px; } .pager li > a:hover, .pager li > a:focus { text-decoration: none; background-color: #f5f5f5; } .pager .next > a, .pager .next > span { float: right; } .pager .previous > a, .pager .previous > span { float: left; } .pager .disabled > a, .pager .disabled > a:hover, .pager .disabled > a:focus, .pager .disabled > span { color: #999999; cursor: default; background-color: #fff; } .modal-backdrop { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 1040; background-color: #000000; } .modal-backdrop.fade { opacity: 0; } .modal-backdrop, .modal-backdrop.fade.in { opacity: 0.8; filter: alpha(opacity=80); } .modal { position: fixed; top: 10%; left: 50%; z-index: 1050; width: 560px; margin-left: -280px; background-color: #ffffff; border: 1px solid #999; border: 1px solid rgba(0, 0, 0, 0.3); *border: 1px solid #999; -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; outline: none; -webkit-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); -moz-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); -webkit-background-clip: padding-box; -moz-background-clip: padding-box; background-clip: padding-box; } .modal.fade { top: -25%; -webkit-transition: opacity 0.3s linear, top 0.3s ease-out; -moz-transition: opacity 0.3s linear, top 0.3s ease-out; -o-transition: opacity 0.3s linear, top 0.3s ease-out; transition: opacity 0.3s linear, top 0.3s ease-out; } .modal.fade.in { top: 10%; } .modal-header { padding: 9px 15px; border-bottom: 1px solid #eee; } .modal-header .close { margin-top: 2px; } .modal-header h3 { margin: 0; line-height: 30px; } .modal-body { position: relative; max-height: 400px; padding: 15px; overflow-y: auto; } .modal-form { margin-bottom: 0; } .modal-footer { padding: 14px 15px 15px; margin-bottom: 0; text-align: right; background-color: #f5f5f5; border-top: 1px solid #ddd; -webkit-border-radius: 0 0 6px 6px; -moz-border-radius: 0 0 6px 6px; border-radius: 0 0 6px 6px; *zoom: 1; -webkit-box-shadow: inset 0 1px 0 #ffffff; -moz-box-shadow: inset 0 1px 0 #ffffff; box-shadow: inset 0 1px 0 #ffffff; } .modal-footer:before, .modal-footer:after { display: table; line-height: 0; content: ""; } .modal-footer:after { clear: both; } .modal-footer .btn + .btn { margin-bottom: 0; margin-left: 5px; } .modal-footer .btn-group .btn + .btn { margin-left: -1px; } .modal-footer .btn-block + .btn-block { margin-left: 0; } .tooltip { position: absolute; z-index: 1030; display: block; font-size: 11px; line-height: 1.4; opacity: 0; filter: alpha(opacity=0); visibility: visible; } .tooltip.in { opacity: 0.8; filter: alpha(opacity=80); } .tooltip.top { padding: 5px 0; margin-top: -3px; } .tooltip.right { padding: 0 5px; margin-left: 3px; } .tooltip.bottom { padding: 5px 0; margin-top: 3px; } .tooltip.left { padding: 0 5px; margin-left: -3px; } .tooltip-inner { max-width: 200px; padding: 8px; color: #ffffff; text-align: center; text-decoration: none; background-color: #000000; -webkit-border-radius: 4px; -moz-border-radius: 4px; 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-top-color: #000000; border-width: 5px 5px 0; } .tooltip.right .tooltip-arrow { top: 50%; left: 0; margin-top: -5px; border-right-color: #000000; border-width: 5px 5px 5px 0; } .tooltip.left .tooltip-arrow { top: 50%; right: 0; margin-top: -5px; border-left-color: #000000; border-width: 5px 0 5px 5px; } .tooltip.bottom .tooltip-arrow { top: 0; left: 50%; margin-left: -5px; border-bottom-color: #000000; border-width: 0 5px 5px; } .popover { position: absolute; top: 0; left: 0; z-index: 1010; display: none; max-width: 276px; padding: 1px; text-align: left; white-space: normal; background-color: #ffffff; border: 1px solid #ccc; border: 1px solid rgba(0, 0, 0, 0.2); -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); -moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); -webkit-background-clip: padding-box; -moz-background-clip: padding; background-clip: padding-box; } .popover.top { margin-top: -10px; } .popover.right { margin-left: 10px; } .popover.bottom { margin-top: 10px; } .popover.left { margin-left: -10px; } .popover-title { padding: 8px 14px; margin: 0; font-size: 14px; font-weight: normal; line-height: 18px; background-color: #f7f7f7; border-bottom: 1px solid #ebebeb; -webkit-border-radius: 5px 5px 0 0; -moz-border-radius: 5px 5px 0 0; border-radius: 5px 5px 0 0; } .popover-title:empty { display: none; } .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 { bottom: -11px; left: 50%; margin-left: -11px; border-top-color: #999; border-top-color: rgba(0, 0, 0, 0.25); border-bottom-width: 0; } .popover.top .arrow:after { bottom: 1px; margin-left: -10px; border-top-color: #ffffff; border-bottom-width: 0; } .popover.right .arrow { top: 50%; left: -11px; margin-top: -11px; border-right-color: #999; border-right-color: rgba(0, 0, 0, 0.25); border-left-width: 0; } .popover.right .arrow:after { bottom: -10px; left: 1px; border-right-color: #ffffff; border-left-width: 0; } .popover.bottom .arrow { top: -11px; left: 50%; margin-left: -11px; border-bottom-color: #999; border-bottom-color: rgba(0, 0, 0, 0.25); border-top-width: 0; } .popover.bottom .arrow:after { top: 1px; margin-left: -10px; border-bottom-color: #ffffff; border-top-width: 0; } .popover.left .arrow { top: 50%; right: -11px; margin-top: -11px; border-left-color: #999; border-left-color: rgba(0, 0, 0, 0.25); border-right-width: 0; } .popover.left .arrow:after { right: 1px; bottom: -10px; border-left-color: #ffffff; border-right-width: 0; } .thumbnails { margin-left: -20px; list-style: none; *zoom: 1; } .thumbnails:before, .thumbnails:after { display: table; line-height: 0; content: ""; } .thumbnails:after { clear: both; } .row-fluid .thumbnails { margin-left: 0; } .thumbnails > li { float: left; margin-bottom: 20px; margin-left: 20px; } .thumbnail { display: block; padding: 4px; line-height: 20px; border: 1px solid #ddd; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055); -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055); -webkit-transition: all 0.2s ease-in-out; -moz-transition: all 0.2s ease-in-out; -o-transition: all 0.2s ease-in-out; transition: all 0.2s ease-in-out; } a.thumbnail:hover, a.thumbnail:focus { border-color: #0088cc; -webkit-box-shadow: 0 1px 4px rgba(0, 105, 214, 0.25); -moz-box-shadow: 0 1px 4px rgba(0, 105, 214, 0.25); box-shadow: 0 1px 4px rgba(0, 105, 214, 0.25); } .thumbnail > img { display: block; max-width: 100%; margin-right: auto; margin-left: auto; } .thumbnail .caption { padding: 9px; color: #555555; } .media, .media-body { overflow: hidden; *overflow: visible; zoom: 1; } .media, .media .media { margin-top: 15px; } .media:first-child { margin-top: 0; } .media-object { display: block; } .media-heading { margin: 0 0 5px; } .media > .pull-left { margin-right: 10px; } .media > .pull-right { margin-left: 10px; } .media-list { margin-left: 0; list-style: none; } .label, .badge { display: inline-block; padding: 2px 4px; font-size: 11.844px; font-weight: bold; line-height: 14px; color: #ffffff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); white-space: nowrap; vertical-align: baseline; background-color: #999999; } .label { -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; } .badge { padding-right: 9px; padding-left: 9px; -webkit-border-radius: 9px; -moz-border-radius: 9px; border-radius: 9px; } .label:empty, .badge:empty { display: none; } a.label:hover, a.label:focus, a.badge:hover, a.badge:focus { color: #ffffff; text-decoration: none; cursor: pointer; } .label-important, .badge-important { background-color: #b94a48; } .label-important[href], .badge-important[href] { background-color: #953b39; } .label-warning, .badge-warning { background-color: #f89406; } .label-warning[href], .badge-warning[href] { background-color: #c67605; } .label-success, .badge-success { background-color: #468847; } .label-success[href], .badge-success[href] { background-color: #356635; } .label-info, .badge-info { background-color: #3a87ad; } .label-info[href], .badge-info[href] { background-color: #2d6987; } .label-inverse, .badge-inverse { background-color: #333333; } .label-inverse[href], .badge-inverse[href] { background-color: #1a1a1a; } .btn .label, .btn .badge { position: relative; top: -1px; } .btn-mini .label, .btn-mini .badge { top: 0; } @-webkit-keyframes progress-bar-stripes { from { background-position: 40px 0; } to { background-position: 0 0; } } @-moz-keyframes progress-bar-stripes { from { background-position: 40px 0; } to { background-position: 0 0; } } @-ms-keyframes progress-bar-stripes { from { background-position: 40px 0; } to { background-position: 0 0; } } @-o-keyframes progress-bar-stripes { from { background-position: 0 0; } to { background-position: 40px 0; } } @keyframes progress-bar-stripes { from { background-position: 40px 0; } to { background-position: 0 0; } } .progress { height: 20px; margin-bottom: 20px; overflow: hidden; background-color: #f7f7f7; background-image: -moz-linear-gradient(top, #f5f5f5, #f9f9f9); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f5f5f5), to(#f9f9f9)); background-image: -webkit-linear-gradient(top, #f5f5f5, #f9f9f9); background-image: -o-linear-gradient(top, #f5f5f5, #f9f9f9); background-image: linear-gradient(to bottom, #f5f5f5, #f9f9f9); background-repeat: repeat-x; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#fff9f9f9', GradientType=0); -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); } .progress .bar { float: left; width: 0; height: 100%; font-size: 12px; color: #ffffff; text-align: center; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); background-color: #0e90d2; background-image: -moz-linear-gradient(top, #149bdf, #0480be); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#149bdf), to(#0480be)); background-image: -webkit-linear-gradient(top, #149bdf, #0480be); background-image: -o-linear-gradient(top, #149bdf, #0480be); background-image: linear-gradient(to bottom, #149bdf, #0480be); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff149bdf', endColorstr='#ff0480be', GradientType=0); -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); -moz-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; -webkit-transition: width 0.6s ease; -moz-transition: width 0.6s ease; -o-transition: width 0.6s ease; transition: width 0.6s ease; } .progress .bar + .bar { -webkit-box-shadow: inset 1px 0 0 rgba(0, 0, 0, 0.15), inset 0 -1px 0 rgba(0, 0, 0, 0.15); -moz-box-shadow: inset 1px 0 0 rgba(0, 0, 0, 0.15), inset 0 -1px 0 rgba(0, 0, 0, 0.15); box-shadow: inset 1px 0 0 rgba(0, 0, 0, 0.15), inset 0 -1px 0 rgba(0, 0, 0, 0.15); } .progress-striped .bar { background-color: #149bdf; background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent)); background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); -webkit-background-size: 40px 40px; -moz-background-size: 40px 40px; -o-background-size: 40px 40px; background-size: 40px 40px; } .progress.active .bar { -webkit-animation: progress-bar-stripes 2s linear infinite; -moz-animation: progress-bar-stripes 2s linear infinite; -ms-animation: progress-bar-stripes 2s linear infinite; -o-animation: progress-bar-stripes 2s linear infinite; animation: progress-bar-stripes 2s linear infinite; } .progress-danger .bar, .progress .bar-danger { background-color: #dd514c; background-image: -moz-linear-gradient(top, #ee5f5b, #c43c35); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ee5f5b), to(#c43c35)); background-image: -webkit-linear-gradient(top, #ee5f5b, #c43c35); background-image: -o-linear-gradient(top, #ee5f5b, #c43c35); background-image: linear-gradient(to bottom, #ee5f5b, #c43c35); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffee5f5b', endColorstr='#ffc43c35', GradientType=0); } .progress-danger.progress-striped .bar, .progress-striped .bar-danger { background-color: #ee5f5b; background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent)); background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); } .progress-success .bar, .progress .bar-success { background-color: #5eb95e; background-image: -moz-linear-gradient(top, #62c462, #57a957); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#62c462), to(#57a957)); background-image: -webkit-linear-gradient(top, #62c462, #57a957); background-image: -o-linear-gradient(top, #62c462, #57a957); background-image: linear-gradient(to bottom, #62c462, #57a957); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff62c462', endColorstr='#ff57a957', GradientType=0); } .progress-success.progress-striped .bar, .progress-striped .bar-success { background-color: #62c462; background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent)); background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); } .progress-info .bar, .progress .bar-info { background-color: #4bb1cf; background-image: -moz-linear-gradient(top, #5bc0de, #339bb9); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#5bc0de), to(#339bb9)); background-image: -webkit-linear-gradient(top, #5bc0de, #339bb9); background-image: -o-linear-gradient(top, #5bc0de, #339bb9); background-image: linear-gradient(to bottom, #5bc0de, #339bb9); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff339bb9', GradientType=0); } .progress-info.progress-striped .bar, .progress-striped .bar-info { background-color: #5bc0de; background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent)); background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); } .progress-warning .bar, .progress .bar-warning { background-color: #faa732; background-image: -moz-linear-gradient(top, #fbb450, #f89406); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fbb450), to(#f89406)); background-image: -webkit-linear-gradient(top, #fbb450, #f89406); background-image: -o-linear-gradient(top, #fbb450, #f89406); background-image: linear-gradient(to bottom, #fbb450, #f89406); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffbb450', endColorstr='#fff89406', GradientType=0); } .progress-warning.progress-striped .bar, .progress-striped .bar-warning { background-color: #fbb450; background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent)); background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); } .accordion { margin-bottom: 20px; } .accordion-group { margin-bottom: 2px; border: 1px solid #e5e5e5; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } .accordion-heading { border-bottom: 0; } .accordion-heading .accordion-toggle { display: block; padding: 8px 15px; } .accordion-toggle { cursor: pointer; } .accordion-inner { padding: 9px 15px; border-top: 1px solid #e5e5e5; } .carousel { position: relative; margin-bottom: 20px; line-height: 1; } .carousel-inner { position: relative; width: 100%; overflow: hidden; } .carousel-inner > .item { position: relative; display: none; -webkit-transition: 0.6s ease-in-out left; -moz-transition: 0.6s ease-in-out left; -o-transition: 0.6s ease-in-out left; transition: 0.6s ease-in-out left; } .carousel-inner > .item > img, .carousel-inner > .item > a > img { display: block; line-height: 1; } .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: 40%; left: 15px; width: 40px; height: 40px; margin-top: -20px; font-size: 60px; font-weight: 100; line-height: 30px; color: #ffffff; text-align: center; background: #222222; border: 3px solid #ffffff; -webkit-border-radius: 23px; -moz-border-radius: 23px; border-radius: 23px; opacity: 0.5; filter: alpha(opacity=50); } .carousel-control.right { right: 15px; left: auto; } .carousel-control:hover, .carousel-control:focus { color: #ffffff; text-decoration: none; opacity: 0.9; filter: alpha(opacity=90); } .carousel-indicators { position: absolute; top: 15px; right: 15px; z-index: 5; margin: 0; list-style: none; } .carousel-indicators li { display: block; float: left; width: 10px; height: 10px; margin-left: 5px; text-indent: -999px; background-color: #ccc; background-color: rgba(255, 255, 255, 0.25); border-radius: 5px; } .carousel-indicators .active { background-color: #fff; } .carousel-caption { position: absolute; right: 0; bottom: 0; left: 0; padding: 15px; background: #333333; background: rgba(0, 0, 0, 0.75); } .carousel-caption h4, .carousel-caption p { line-height: 20px; color: #ffffff; } .carousel-caption h4 { margin: 0 0 5px; } .carousel-caption p { margin-bottom: 0; } .hero-unit { padding: 60px; margin-bottom: 30px; font-size: 18px; font-weight: 200; line-height: 30px; color: inherit; background-color: #eeeeee; -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; } .hero-unit h1 { margin-bottom: 0; font-size: 60px; line-height: 1; letter-spacing: -1px; color: inherit; } .hero-unit li { line-height: 30px; } .pull-right { float: right; } .pull-left { float: left; } .hide { display: none; } .show { display: block; } .invisible { visibility: hidden; } .affix { position: fixed; }
bsd-2-clause
shintadono/Free.Controls.TreeView
Tree/TreeModel.cs
2834
using System; using System.Collections.Generic; using System.Collections.ObjectModel; namespace Free.Controls.TreeView.Tree { /// <summary> /// Provides a simple ready to use implementation of <see cref="ITreeModel"/>. Warning: this class is not optimized /// to work with big amount of data. In this case create you own implementation of <c>ITreeModel</c>, and pay attention /// on GetChildren and IsLeaf methods. /// </summary> public class TreeModel : ITreeModel { private Node _root; public Node Root { get { return _root; } } public Collection<Node> Nodes { get { return _root.Nodes; } } public TreeModel() { _root=new Node(); _root.Model=this; } public TreePath GetPath(Node node) { if(node==_root) return TreePath.Empty; else { Stack<object> stack=new Stack<object>(); while(node!=_root) { stack.Push(node); node=node.Parent; } return new TreePath(stack.ToArray()); } } public Node FindNode(TreePath path) { if(path.IsEmpty()) return _root; else return FindNode(_root, path, 0); } private Node FindNode(Node root, TreePath path, int level) { foreach(Node node in root.Nodes) if(node==path.FullPath[level]) { if(level==path.FullPath.Length-1) return node; else return FindNode(node, path, level+1); } return null; } #region ITreeModel Members public System.Collections.IEnumerable GetChildren(TreePath treePath) { Node node=FindNode(treePath); if(node!=null) foreach(Node n in node.Nodes) yield return n; else yield break; } public bool IsLeaf(TreePath treePath) { Node node=FindNode(treePath); if(node!=null) return node.IsLeaf; else throw new ArgumentException("treePath"); } public event EventHandler<TreeModelEventArgs> NodesChanged; internal void OnNodesChanged(TreeModelEventArgs args) { if(NodesChanged!=null) NodesChanged(this, args); } public event EventHandler<TreePathEventArgs> StructureChanged; public void OnStructureChanged(TreePathEventArgs args) { if(StructureChanged!=null) StructureChanged(this, args); } public event EventHandler<TreeModelEventArgs> NodesInserted; internal void OnNodeInserted(Node parent, int index, Node node) { if(NodesInserted!=null) { TreeModelEventArgs args=new TreeModelEventArgs(GetPath(parent), new int[] { index }, new object[] { node }); NodesInserted(this, args); } } public event EventHandler<TreeModelEventArgs> NodesRemoved; internal void OnNodeRemoved(Node parent, int index, Node node) { if(NodesRemoved!=null) { TreeModelEventArgs args=new TreeModelEventArgs(GetPath(parent), new int[] { index }, new object[] { node }); NodesRemoved(this, args); } } #endregion } }
bsd-2-clause
jinterval/jinterval
jinterval-field/src/main/java/net/java/jinterval/field/RationalField.java
2936
/* * Copyright (c) 2012, JInterval Project. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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. */ package net.java.jinterval.field; import java.math.RoundingMode; import net.java.jinterval.rational.BinaryValueSet; import net.java.jinterval.rational.ExtendedRational; import net.java.jinterval.rational.ExtendedRationalContexts; import net.java.jinterval.rational.ExtendedRationalContext; import org.apache.commons.math3.Field; /** * */ public class RationalField implements Field<RationalFieldElement> { private ExtendedRationalContext context; private final RationalFieldElement zero; private final RationalFieldElement one; public RationalField(RoundingMode rm) { this(BinaryValueSet.BINARY64, rm); } public RationalField(BinaryValueSet valueSet, RoundingMode rm) { this(ExtendedRationalContexts.valueOf(valueSet, rm)); } public RationalField(ExtendedRationalContext context) { this.context = context; zero = get(ExtendedRational.zero()); one = get(ExtendedRational.one()); } public RationalFieldElement getZero() { return zero; } public RationalFieldElement getOne() { return one; } public RationalFieldElement get(Number value) { return new RationalFieldElement(this, context.rnd(value)); } public RationalFieldElement get(ExtendedRational value) { return new RationalFieldElement(this, context.rnd(value)); } public Class<RationalFieldElement> getRuntimeClass() { return RationalFieldElement.class; } ExtendedRationalContext getContext() { return context; } }
bsd-2-clause
nanddev/court-bankruptcy
scripts/clean.sql
203
delete from citation where Fine_Amount = 0; delete from timepay where Fine_Amount = 0; delete from citation_cart_temp where ct_date < CURDATE(); delete from timepay_cart_temp where ct_date < CURDATE();
bsd-2-clause
Polytechnique-org/django-authgroupex
django_authgroupex/auth.py
8966
# -*- coding: utf-8 -*- # This code is distributed under the two-clause BSD license. # Copyright (c) 2012-2013 Raphaël Barrois from __future__ import absolute_import, unicode_literals import logging from django.core import exceptions from django.db import models from . import conf PERM_USER = 'user' PERM_GROUP_MEMBER = 'grpmember' PERM_GROUP_ADMIN = 'grpadmin' PERM_ADMIN = 'admin' PERM_LEVELS = ( PERM_USER, PERM_GROUP_MEMBER, PERM_GROUP_ADMIN, PERM_ADMIN, ) logger = logging.getLogger(__name__) def get_model(model_name): """Retrieve a django model. This handles: - Explicit models.Model subclass - Absolute dotted path to import the model """ if isinstance(model_name, type) and issubclass(models.Model, model_name): return model_name # Not a Model or a Model instance, must be a class path if '.' not in model_name: raise ValueError("Invalid model name %s: should include module name." % model_name) app, cls = model_name.rsplit('.', 1) return models.get_model(app, cls) class AuthResult(object): """Result of an authentication query.""" def __init__(self, data): self.data = data or {} self.perms = self._setup_perms(self.data) def __repr__(self): return '<AuthResult: [%s / %s]>' % (self.data, self.perms) def _setup_perms(self, data): perms = set() perms.add(PERM_USER) if 'perms' in data: perms.add(data['perms']) if 'grpauth' in data: if data['grpauth'] == 'admin': perms.add(PERM_GROUP_ADMIN) perms.add(PERM_GROUP_MEMBER) elif data['grpauth'] == 'membre': perms.add(PERM_GROUP_MEMBER) return perms @property def username(self): return self.data.get('username', '') @property def firstname(self): return self.data.get('firstname', '') @property def lastname(self): return self.data.get('lastname', '') @property def promo(self): return self.data.get('promo', '') @property def email(self): return self.data.get('email', '') @property def is_dead(self): return bool(self.data.get('deathdate', '')) @property def is_admin(self): return PERM_ADMIN in self.perms def has_perm(self, perm): return perm in self.perms class AuthGroupeXMixin(object): def __init__(self, config=None, *args, **kwargs): super(AuthGroupeXMixin, self).__init__(*args, **kwargs) self.config = config or conf.AuthGroupeXConf() # Public API # ========== def authenticate(self, **kwargs): """Create a user if the authgroupex data has been passed. This data should be present in the 'authgroupex' keyword argument. """ if 'authgroupex' in kwargs: auth_data = kwargs['authgroupex'] else: logger.info('Trying to authenticate, no authgroupex in data.') return None if not auth_data.username: logger.error('Received a AuthResult object without a username.') return None try: user = self._fetch_user(auth_data.username) except exceptions.ObjectDoesNotExist: try: user = self._create_user_from_auth_data(auth_data) except ValueError: logger.warning('Received authgroupex with invalid name %s', auth_data.username) return None self._update_user(user, auth_data) return user # Required extension points # ========================= def get_user(self, user_id): raise NotImplementedError() def _fetch_user(self, username): raise NotImplementedError() def _create_user(self, username): raise NotImplementedError() # Optional extension points # ========================= def _set_staff(self, user, is_staff): if hasattr(user, 'is_staff'): user.is_staff = is_staff def _set_superuser(self, user, is_superuser): if hasattr(user, 'is_superuser'): user.is_superuser = is_superuser def _set_active(self, user, is_active): if hasattr(user, 'is_active'): user.is_active = is_active def _update_profile(self, user, auth_data): """Update fields of the profile according to auth-groupe-x data.""" pass def _update_groups(self, user, auth_data): pass # Internals # ========= def _update_perms(self, user, auth_data): # Handle staff status if self.config.STAFF_PERMS: self._set_staff(user, any( auth_data.has_perm(perm) for perm in self.config.STAFF_PERMS)) # Handle superadmins if self.config.SUPERADMIN_PERMS: is_superuser = any( auth_data.has_perm(perm) for perm in self.config.SUPERADMIN_PERMS) self._set_superuser(user, is_superuser) if is_superuser: self._set_staff(user, True) # Handle active status if auth_data.is_dead and self.config.DISABLE_DEADS: self._set_active(user, False) def _update_user(self, user, auth_data): """Update various fields of the user according to auth-groupe-x data.""" self._update_profile(user, auth_data) self._update_perms(user, auth_data) self._update_groups(user, auth_data) # Refresh DB user user.save() logger.info('Updated user %s', user.get_username()) def _create_user_from_auth_data(self, auth_data): """Create a new Django user from AuthGroupeX data. This only sets the basic username field; groups and other data are handled by the update_user method. """ username = auth_data.username user = self._create_user(username) user.set_unusable_password() logger.info('Created a new user with username %s', username) return user class AuthGroupeXBackend(AuthGroupeXMixin): """Authentication backend for auth-groupe-x""" supports_anonymous_user = False supports_object_permissions = False def __init__(self, config=None, *args, **kwargs): super(AuthGroupeXBackend, self).__init__(config=config, *args, **kwargs) self.user_model = get_model(self.config.USER_MODEL) def get_user(self, user_id): """Retrieve a user by ID. Args: user_id: int, the ID of the user Returns: Either an instance of self.config.USER_MODEL or None """ try: return self.user_model.objects.get(pk=user_id) except self.user_model.DoesNotExist: return None def _fetch_user(self, username): return self.user_model.objects.get(username=username) def _create_user(self, username): return self.user_model.objects.create(username=username, is_active=True) def _update_profile(self, user, auth_data): """Update fields of the profile according to auth-groupe-x data.""" # Update basic profile data if auth_data.firstname: user.first_name = auth_data.firstname if auth_data.lastname: user.last_name = auth_data.lastname if auth_data.email: user.email = auth_data.email if getattr(self.config, 'PROFILE_CLASS', ''): profile_model = get_model(self.config.PROFILE_CLASS) try: profile = user.get_profile() except profile_model.DoesNotExist: profile = profile_model.objects.create(user=user) if auth_data.promo: profile.promo = auth_data.promo profile.save() def _update_groups(self, user, auth_data): """Update django groups of the user according to auth-groupe-x data""" if not self.config.MAP_GROUPS: return # Gather names of django groups by mapping perms using MAP_GROUPS new_group_names = set() old_group_names = set() for perm in PERM_LEVELS: if auth_data.has_perm(perm): new_group_names |= set(self.config.MAP_GROUPS.get(perm, [])) else: old_group_names |= set(self.config.MAP_GROUPS.get(perm, [])) # Find django group objects group_model = get_model(self.config.GROUP_MODEL) new_groups = list(group_model.objects.filter(name__in=new_group_names)) old_groups = list(group_model.objects.filter(name__in=old_group_names)) if old_groups: logger.info(u"Removing user %s from groups %s", user, new_groups) user.groups.remove(*list(old_groups)) if new_groups: logger.info(u"Adding user %s to groups %s", user, new_groups) user.groups.add(*list(new_groups))
bsd-2-clause
sebastienros/jint
Jint.Tests.Test262/test/language/literals/bigint/octal-invalid-digit.js
578
// Copyright (C) 2017 Robin Templeton. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- description: Octal BigInt literal containing an invalid digit esid: prod-NumericLiteral info: | NumericLiteral :: NumericLiteralBase NumericLiteralSuffix NumericLiteralBase :: DecimalLiteral BinaryIntegerLiteral OctalIntegerLiteral HexIntegerLiteral NumericLiteralSuffix :: n negative: phase: parse type: SyntaxError features: [BigInt] ---*/ throw "Test262: This statement should not be evaluated."; 0o9n;
bsd-2-clause
syscrusher/homebrew-cask
Casks/onedrive.rb
2181
cask 'onedrive' do version '17.3.6945.0724' sha256 '5285b60a8f81f820ff7e7ad1e9177520e0b1394901f301e7da3a3258962537be' # oneclient.sfx.ms/Mac/Direct was verified as official when first introduced to the cask url "https://oneclient.sfx.ms/Mac/Direct/#{version}/OneDrive.pkg" name 'OneDrive' homepage 'https://onedrive.live.com/' pkg 'OneDrive.pkg' uninstall delete: '/Applications/OneDrive.app', launchctl: 'com.microsoft.OneDriveUpdaterDaemon', pkgutil: 'com.microsoft.OneDrive', quit: [ 'com.microsoft.OneDrive', 'com.microsoft.OneDriveUpdater', 'com.microsoft.OneDrive.FinderSync', ] zap delete: [ '~/Library/Application Support/OneDrive', '~/Library/Application Support/com.microsoft.OneDrive', '~/Library/Application Support/com.microsoft.OneDriveUpdater', '~/Library/Application Support/OneDriveUpdater', '~/Library/Application Scripts/com.microsoft.OneDrive.FinderSync', '~/Library/Application Scripts/com.microsoft.OneDriveLauncher', '~/Library/Caches/com.microsoft.OneDrive', '~/Library/Caches/com.microsoft.OneDriveUpdater', '~/Library/Caches/com.plausiblelabs.crashreporter.data/com.microsoft.OneDrive', '~/Library/Caches/com.plausiblelabs.crashreporter.data/com.microsoft.OneDriveUpdater', '~/Library/Containers/com.microsoft.OneDriveLauncher', '~/Library/Containers/com.microsoft.OneDrive.FinderSync', '~/Library/Cookies/com.microsoft.OneDrive.binarycookies', '~/Library/Cookies/com.microsoft.OneDriveUpdater.binarycookies', '~/Library/Group Containers/*.OneDriveStandaloneSuite', '~/Library/Logs/OneDrive', '~/Library/Preferences/com.microsoft.OneDrive.plist', '~/Library/Preferences/com.microsoft.OneDriveUpdater.plist', '~/Library/Preferences/*.OneDriveStandaloneSuite.plist', ] end
bsd-2-clause
mtholder/taxalotl
taxalotl/sem_graph/graph.py
13901
#!/usr/bin/env python from __future__ import print_function import json import logging from .taxon_concept_node import TaxonConceptSemNode from .verbatim_name import VerbatimSemNode from .names_for_ranks import (GenusGroupSemNode, HigherGroupSemNode, SpecimenCodeSemNode, SpeciesGroupSemNode, TypeSpecimen ) from .name import CombinationSemNode from .graph_node import AuthoritySemNode _LOG = logging.getLogger(__name__) class SemGraph(object): att_list = ['_authorities', '_combinations', '_genus_group_names', '_higher_group_names', '_references', '_species_group_epithets', '_specimen_codes', '_specimens', '_taxon_concepts', '_type_specimens', '_verbatim_name', ] att_set = frozenset(att_list) def register_obj(self, id_minting_context, obj): return _register_new_node(self, id_minting_context, obj) def __init__(self, taxolotl_config, res): self.config = taxolotl_config self.res = res self._by_id = {} self._authorities = None self._specimens = None self._specimen_codes = None self._species_group_epithets = None self._genus_group_names = None self._combinations = None self._higher_group_names = None self._verbatim_name = None self._taxon_concepts = None self._references = None self._type_specimens = None def impute_type_specimens(self): for tc in self.taxon_concept_list: if not tc.is_specimen_based: continue if tc.hybrid or tc.undescribed or not tc.rank: continue if tc.rank == 'species': epithet = tc.most_terminal_name try: if not epithet.type_materials: self._add_type_specimen(None, epithet, tc.is_synonym_of) except: _LOG.exception("problem adding type materials") for tc in self.taxon_concept_list: if tc.hybrid or tc.undescribed or not tc.rank: continue if tc.is_specimen_based and tc.rank != 'species': infra_epithet = tc.most_terminal_name if infra_epithet is tc.has_name.sp_epithet: continue if not infra_epithet.type_materials: self._add_type_specimen(None, infra_epithet, tc.is_synonym_of) def denormalize_homonyms(self): # for species ranK: # multiple authority entries # same valid epithet in multiple valid genera dup_auth_to_mint = {} for tc in self.taxon_concept_list: if tc.rank and tc.rank == 'species': epithet = tc.most_terminal_name if epithet is None: if not (tc.hybrid or tc.undescribed): _LOG.warning('NO Epithet for = {}'.format(tc.__dict__)) continue if isinstance(epithet._authority, list): dup_auth_to_mint.setdefault(epithet, []).append(tc) for name, tc_list in dup_auth_to_mint.items(): verb_name = tc_list[0].has_name other_name_tc_pairs = [] same_name_tc = [] for tc in tc_list[1:]: if tc.has_name is verb_name: same_name_tc.append(tc) else: other_name_tc_pairs.append(tc) for other in other_name_tc_pairs: self._split_tc_with_shared_sp_epithet(tc_list[0], other) for other in same_name_tc: self._split_tc_with_shared_name(tc_list[0], other) if self.res.id.startswith('cof'): import sys # sys.exit(1) def _split_tc_with_shared_sp_epithet(self, fixed, other): assert fixed is not other fix_name, oth_name = fixed.has_name, other.has_name _LOG.debug('splitting "{}" from ["{}"]'.format(fix_name.name, oth_name.name)) fix_genus, oth_genus = fix_name.genus_name, oth_name.genus_name fix_sp_epi, oth_sp_epi = fix_name.sp_epithet, oth_name.sp_epithet assert fix_sp_epi is oth_sp_epi if fix_sp_epi in oth_genus.contained: oth_genus.contained.remove(fix_sp_epi) new_epi = self._add_sp_epithet(other, fix_sp_epi._name, oth_genus, avoid_dup=False) oth_genus.contained.append(new_epi) oth_name.sp_epithet = new_epi vtc = other if vtc._is_synonym_of: vtc = vtc._is_synonym_of for a in fix_sp_epi._authority: if other in a.taxon_concept_set or vtc in a.taxon_concept_set: new_epi.claim_authority(a) break assert new_epi._authority fix_sp_epi._authority.remove(new_epi._authority) if len(fix_sp_epi._authority) == 1: fix_sp_epi._authority = fix_sp_epi._authority[0] def _split_tc_with_shared_name(self, fixed, other): fix_vname = fixed.has_name assert fix_vname is other.has_name new_vname = self._add_verbatim_name(other, fix_vname.name, avoid_dup=False) assert not fix_vname.specimen_codes for attr in VerbatimSemNode.extra_pred: v = getattr(fix_vname, attr, None) if v: setattr(new_vname, attr, v) other.has_name = new_vname self._split_tc_with_shared_sp_epithet(fixed, other) def postorder_taxon_concepts(self): yielded = set() tcl = self.taxon_concept_list todo = [] for tc in tcl: if not tc.child_set: yielded.add(tc) yield tc else: todo.append(tc) prev_todo_len = 1 + len(todo) while todo: assert prev_todo_len > len(todo) prev_todo_len = len(todo) ntd = [] for tc in todo: if tc.child_set.issubset(yielded): yielded.add(tc) yield tc else: ntd.append(tc) todo = ntd @property def taxon_concept_list(self): return self._taxon_concepts if self._taxon_concepts else [] def _all_specimen_based_tax_con_dict(self): r = {} for tcobj in self.taxon_concept_list: if tcobj.is_specimen_based: r[tcobj.canonical_id] = tcobj return r def _all_higher_tax_con_dict(self): r = {} for tcobj in self.taxon_concept_list: if not tcobj.is_specimen_based: r[tcobj.canonical_id] = tcobj return r def find_valid_genus(self, genus_name): r = [] for tc in self._all_higher_tax_con_dict().values(): if tc.rank and tc.rank == 'genus': if tc.is_valid_for_name(genus_name): r.append(tc) return r def specimen_based_synonym_taxa(self): d = self._all_specimen_based_tax_con_dict() r = {} for tcid, tcobj in d.items(): syn_list = tcobj.synonyms if tcobj.synonyms else [] for syn_id in syn_list: r[syn_id] = d[syn_id] return r @property def valid_specimen_based_taxa(self): d = self._all_specimen_based_tax_con_dict() r = {} for tcid, tcobj in d.items(): if not tcobj.is_synonym_of: r[tcid] = tcobj return r @property def valid_taxa_dict(self): raw = self._taxon_concepts if self._taxon_concepts else [] r = {} for tcobj in raw: if not tcobj.is_synonym_of: r[tcobj.canonical_id] = tcobj return r @property def canonical_name_str_to_taxon_concept_map(self): return {i.canonical_name.name: i for i in self._taxon_concepts} @property def valid_name_to_taxon_concept_map(self): return {i.valid_name.name: i for i in self.valid_taxa_dict.values()} def get_by_id(self, can_id, default=None): return self._by_id.get(can_id, default) def _add_name(self, container, node_type, parent_sem_node, name, extra_container=None, avoid_dup=True): search_cont = container if extra_container is None else extra_container.contained x = None if (not avoid_dup) else _find_by_name(search_cont, name) if x is None: d = {'parent_id': parent_sem_node.canonical_id} if extra_container is not None: d['class_tag'] = 'epi' # need to figure out if this is the best choice for any extra container obj x = node_type(self, d, name) search_cont.append(x) if search_cont is not container: container.append(x) return x def add_authority(self, tax_con_sem_node, name_sem, authors, year): auth_list = self.authorities x = None for a in auth_list: if a.authors == authors and a.year == year: x = a break if x is None: d = {'parent_id': name_sem.canonical_id} x = AuthoritySemNode(self, d, authors, year, tax_con_sem_node) else: x.taxon_concept_set.add(tax_con_sem_node) auth_list.append(x) name_sem.claim_authority(x) return x def _add_normalized(self, par_sem_node, name_str): return self._add_name(self.combinations, CombinationSemNode, par_sem_node, name_str) def _add_combination(self, par_sem_node, name_str): return self._add_name(self.combinations, CombinationSemNode, par_sem_node, name_str) def _add_verbatim_name(self, tax_con_sem_node, name_str, avoid_dup=True): return self._add_name(self.verbatim_name, VerbatimSemNode, tax_con_sem_node, name_str, avoid_dup=avoid_dup) def _add_genus(self, par_sem_node, name_str): return self._add_name(self.genus_group_names, GenusGroupSemNode, par_sem_node, name_str) _add_subgenus = _add_genus def _add_higher_group_name(self, par_sem_node, name_str): return self._add_name(self.higher_group_names, HigherGroupSemNode, par_sem_node, name_str) def _add_sp_epithet(self, par_sem_node, name_str, prev_word_sn, avoid_dup=True): return self._add_name(self.species_group_epithets, SpeciesGroupSemNode, par_sem_node, name_str, prev_word_sn, avoid_dup=avoid_dup) _add_infra_epithet = _add_sp_epithet def _add_specimen_code(self, par_sem_node, name_str): return self._add_name(self.specimen_codes, SpecimenCodeSemNode, par_sem_node, name_str) def add_taxon_concept(self, foreign_id): x = TaxonConceptSemNode(self, foreign_id) self.taxon_concepts.append(x) return x def remove_taxon_concept(self, tc): if tc in self._taxon_concepts: self._taxon_concepts.remove(tc) if tc.canonical_id in self._by_id: del self._by_id[tc.canonical_id] def _add_type_specimen(self, spec_code, epithet_syn_name, valid_taxon): d = {'parent_id': epithet_syn_name.canonical_id} x = TypeSpecimen(self, d, spec_code, epithet_syn_name, valid_taxon) self.type_specimens.append(x) epithet_syn_name.claim_type_material(x) return x def __getattr__(self, item): hidden = '_{}'.format(item) if hidden not in SemGraph.att_set: return self.__getattribute__(item) v = getattr(self, hidden) if v is None: v = [] setattr(self, hidden, v) return v def as_dict(self): d = {} for hidden in SemGraph.att_list: v = getattr(self, hidden) if v is not None: d[hidden[1:]] = {i.canonical_id: i.as_dict() for i in v} return d def _find_by_name(container, name): if container: for el in container: if el._name == name: return el return None _NODE_CLASS_NAME_TO_CT = {AuthoritySemNode: 'auth', SpecimenCodeSemNode: 'spec_code', HigherGroupSemNode: 'clade', SpeciesGroupSemNode: 'sp', GenusGroupSemNode: 'gen', VerbatimSemNode: 'verbatim', CombinationSemNode: 'combin', } def _register_new_node(graph, id_minting_context, obj): """Returns a canonical_id for a new obj. The goal is to generate unique IDs that are somewhat human readable to make it easier to browse the graph. `id_minting_context`: has * "parent_id" or "context_id" * "class_tag" or func will use the class of `obj` to tag classes """ assert isinstance(id_minting_context, dict) pref_str, context_id = id_minting_context.get('parent_id'), '' if pref_str is None: pref_str = graph.res.base_resource.id context_id = id_minting_context['context_id'] ct = id_minting_context.get('class_tag') if ct is None: ct = _NODE_CLASS_NAME_TO_CT[obj.__class__] can_id = _canonicalize(pref_str, ct, context_id) rci, n = can_id, 1 while True: wtid = graph._by_id.get(can_id) if wtid is None: graph._by_id[can_id] = obj return can_id if wtid == obj: return can_id n += 1 can_id = '{}:v{}'.format(rci, n) def _canonicalize(res_id, pred_id, entity_id): ne = [str(i) for i in (res_id, pred_id, entity_id) if i] return ':'.join(ne)
bsd-2-clause
arachnidlabs/cyflash
cyflash/protocol.py
15768
import codecs import six from builtins import super from builtins import range import struct import time class InvalidPacketError(Exception): pass class BootloaderError(Exception): pass class BootloaderTimeoutError(BootloaderError): pass # TODO: Implement Security key functionality class BootloaderKeyError(BootloaderError): STATUS = 0x01 def __init__(self): super().__init__("The provided security key was incorrect") class VerificationError(BootloaderError): STATUS = 0x02 def __init__(self): super().__init__("The flash verification failed.") class IncorrectLength(BootloaderError): STATUS = 0x03 def __init__(self): super().__init__("The amount of data available is outside the expected range") class InvalidData(BootloaderError): STATUS = 0x04 def __init__(self): super().__init__("The data is not of the proper form") class InvalidCommand(BootloaderError): STATUS = 0x05 def __init__(self): super().__init__("Command unsupported on target device") class UnexpectedDevice(BootloaderError): STATUS = 0x06 class UnsupportedBootloaderVersion(BootloaderError): STATUS = 0x07 class InvalidChecksum(BootloaderError): STATUS = 0x08 class InvalidArray(BootloaderError): STATUS = 0x09 class InvalidFlashRow(BootloaderError): STATUS = 0x0A class ProtectedFlash(BootloaderError): STATUS = 0x0B class InvalidApp(BootloaderError): STATUS = 0x0C class TargetApplicationIsActive(BootloaderError): STATUS = 0x0D def __init__(self): super().__init__("The application is currently marked as active or golden image") class CallbackResponseInvalid(BootloaderError): STATUS = 0x0E class UnknownError(BootloaderError): STATUS = 0x0F class BootloaderResponse(object): FORMAT = "" ARGS = () ERRORS = {klass.STATUS: klass for klass in [ BootloaderKeyError, VerificationError, IncorrectLength, InvalidData, InvalidCommand, InvalidChecksum, UnexpectedDevice, UnsupportedBootloaderVersion, InvalidArray, InvalidFlashRow, ProtectedFlash, InvalidApp, TargetApplicationIsActive, CallbackResponseInvalid, UnknownError ]} def __init__(self, data): try: unpacked = struct.unpack(self.FORMAT, data) except struct.error as e: raise InvalidPacketError("Cannot unpack packet data '{}': {}".format(data, e)) for arg, value in zip(self.ARGS, unpacked): if arg: setattr(self, arg, value) @classmethod def decode(cls, data, checksum_func): start, status, length = struct.unpack("<BBH", data[:4]) if start != 0x01: raise InvalidPacketError("Expected Start Of Packet signature 0x01, found 0x{0:01X}".format(start)) expected_dlen = len(data) - 7 if length != expected_dlen: raise InvalidPacketError("Expected packet data length {} actual {}".format(length, expected_dlen)) checksum, end = struct.unpack("<HB", data[-3:]) data = data[:length + 4] if end != 0x17: raise InvalidPacketError("Invalid end of packet code 0x{0:02X}, expected 0x17".format(end)) calculated_checksum = checksum_func(data) if checksum != calculated_checksum: raise InvalidPacketError( "Invalid packet checksum 0x{0:02X}, expected 0x{1:02X}".format(checksum, calculated_checksum)) # TODO Handle status 0x0D: The application is currently marked as active if (status != 0x00): response_class = cls.ERRORS.get(status) if response_class: raise response_class() else: raise InvalidPacketError("Unknown status code 0x{0:02X}".format(status)) data = data[4:] return cls(data) class BootloaderCommand(object): COMMAND = None FORMAT = "" ARGS = () RESPONSE = None def __init__(self, **kwargs): for arg in kwargs: if arg not in self.ARGS: raise TypeError("Argument {} not in command arguments".format(arg)) self.args = [kwargs[arg] for arg in self.ARGS] @property def data(self): return struct.pack(self.FORMAT, *self.args) class BooleanResponse(BootloaderResponse): FORMAT = "B" ARGS = ("status",) class EmptyResponse(BootloaderResponse): pass class VerifyChecksumCommand(BootloaderCommand): COMMAND = 0x31 RESPONSE = BooleanResponse class GetFlashSizeResponse(BootloaderResponse): FORMAT = "<HH" ARGS = ("first_row", "last_row") class GetFlashSizeCommand(BootloaderCommand): COMMAND = 0x32 FORMAT = "B" ARGS = ("array_id",) RESPONSE = GetFlashSizeResponse class GetAppStatusResponse(BootloaderResponse): FORMAT = "<BB" ARGS = ("app_valid", "app_active") class GetAppStatusCommand(BootloaderCommand): COMMAND = 0x33 FORMAT = "B" ARGS = ("application_id",) RESPONSE = GetAppStatusResponse class EraseRowCommand(BootloaderCommand): COMMAND = 0x34 FORMAT = "<BH" ARGS = ("array_id", "row_id") RESPONSE = EmptyResponse class SyncBootloaderCommand(BootloaderCommand): COMMAND = 0x35 RESPONSE = EmptyResponse class SetAppActive(BootloaderCommand): COMMAND = 0x36 FORMAT = "B" ARGS = ("application_id",) RESPONSE = EmptyResponse class SendDataCommand(BootloaderCommand): COMMAND = 0x37 RESPONSE = EmptyResponse def __init__(self, data): self._data = data super(SendDataCommand, self).__init__() @property def data(self): return self._data class EnterBootloaderResponse(BootloaderResponse): FORMAT = "<IBHB" ARGS = ("silicon_id", "silicon_rev", "bl_version", "bl_version_2") class EnterBootloaderCommand(BootloaderCommand): COMMAND = 0x38 RESPONSE = EnterBootloaderResponse def __init__(self, key): self._key = key super(EnterBootloaderCommand, self).__init__() @property def data(self): if self._key is None: return super(EnterBootloaderCommand, self).data return super(EnterBootloaderCommand, self).data + struct.pack("<BBBBBB", *self._key) class ProgramRowCommand(BootloaderCommand): COMMAND = 0x39 FORMAT = "<BH" ARGS = ("array_id", "row_id") RESPONSE = EmptyResponse def __init__(self, data, **kwargs): self._data = data super(ProgramRowCommand, self).__init__(**kwargs) @property def data(self): return super(ProgramRowCommand, self).data + self._data class ChecksumResponse(BootloaderResponse): FORMAT = "<B" ARGS = ("checksum",) class VerifyRowCommand(BootloaderCommand): COMMAND = 0x3A FORMAT = "<BH" ARGS = ("array_id", "row_id") RESPONSE = ChecksumResponse class ExitBootloaderCommand(BootloaderCommand): COMMAND = 0x3B RESPONSE = EmptyResponse class GetMetadataResponse(BootloaderResponse): # TODO: metadata format differs in PSOC3 and 4/5 FORMAT = "<BIII7xBBHHH28x" ARGS = ( "checksum", "bootloadable_addr", "bootloader_last_row", "bootloadable_len", "active", "verified", "app_version", "app_id", "custom_id", ) def __str__(self): sb = [] for key in self.__dict__: sb.append("{key}='{value}'".format(key=key, value=self.__dict__[key])) return ', '.join(sb) def __repr__(self): return self.__str__() class GetPSOC5MetadataResponse(BootloaderResponse): # TODO: metadata format differs in PSOC3 and 4/5 FORMAT = "<BIHxxIxxxBBHHHI28x" ARGS = ( "checksum", "bootloadable_addr", "bootloader_last_row", "bootloadable_len", "active", "verified", "bootloader_version", "app_id", "app_version", "app_custom_id", ) def __str__(self): sb = [] for key in self.__dict__: sb.append("{key}='{value}'".format(key=key, value=self.__dict__[key])) return ', '.join(sb) def __repr__(self): return self.__str__() class GetMetadataCommand(BootloaderCommand): COMMAND = 0x3C FORMAT = "<B" ARGS = ("application_id",) RESPONSE = GetMetadataResponse class GetPSOC5MetadataCommand(BootloaderCommand): COMMAND = 0x3C FORMAT = "<B" ARGS = ("application_id",) RESPONSE = GetPSOC5MetadataResponse class BootloaderSession(object): def __init__(self, transport, checksum_func): self.transport = transport self.checksum_func = checksum_func def send(self, command, read=True): data = command.data packet = b"\x01" + struct.pack("<BH", command.COMMAND, len(data)) + data packet = packet + struct.pack('<H', self.checksum_func(packet)) + b"\x17" self.transport.send(packet) if read: response = self.transport.recv() return command.RESPONSE.decode(response, self.checksum_func) else: return None def enter_bootloader(self, key): response = self.send(EnterBootloaderCommand(key)) return response.silicon_id, response.silicon_rev, response.bl_version | (response.bl_version_2 << 16) def application_status(self, application_id): response = self.send(GetAppStatusCommand(application_id=application_id)) return response.app_valid, response.app_active def exit_bootloader(self): self.send(ExitBootloaderCommand(), read=False) def get_flash_size(self, array_id): response = self.send(GetFlashSizeCommand(array_id=array_id)) return response.first_row, response.last_row def verify_checksum(self): return bool(self.send(VerifyChecksumCommand()).status) def get_metadata(self, application_id=0): return self.send(GetMetadataCommand(application_id=application_id)) def get_psoc5_metadata(self, application_id=0): return self.send(GetPSOC5MetadataCommand(application_id=application_id)) def program_row(self, array_id, row_id, rowdata, chunk_size): chunked = [rowdata[i:i + chunk_size] for i in range(0, len(rowdata), chunk_size)] for chunk in chunked[0:-1]: self.send(SendDataCommand(chunk)) self.send(ProgramRowCommand(chunked[-1], array_id=array_id, row_id=row_id)) def get_row_checksum(self, array_id, row_id): return self.send(VerifyRowCommand(array_id=array_id, row_id=row_id)).checksum def set_application_active(self, application_id): self.send(SetAppActive(application_id=application_id)) class SerialTransport(object): def __init__(self, f, verbose): self.f = f self._verbose = verbose def send(self, data): if self._verbose: for part in bytearray(data): print("s: 0x{:02x}".format(part)) self.f.write(data) def recv(self): data = self.f.read(4) if len(data) < 4: raise BootloaderTimeoutError("Timed out waiting for Bootloader response.") size = struct.unpack("<H", data[-2:])[0] data += self.f.read(size + 3) if self._verbose: for part in bytearray(data): print("r: 0x{:02x}".format(part)) if len(data) < size + 7: raise BootloaderTimeoutError("Timed out waiting for Bootloader response.") return data class CANbusTransport(object): MESSAGE_CLASS = None def __init__(self, transport, frame_id, timeout, echo_frames, wait_send_ms): self.transport = transport self.frame_id = frame_id self.timeout = timeout self.echo_frames = echo_frames self.wait_send_s = wait_send_ms / 1000.0 self._last_sent_frame = None def send(self, data): start = 0 maxlen = len(data) while (start < maxlen): remaining = maxlen - start if (remaining > 8): msg = self.MESSAGE_CLASS( extended_id=False, arbitration_id=self.frame_id, data=data[start:start + 8] ) else: msg = self.MESSAGE_CLASS( extended_id=False, arbitration_id=self.frame_id, data=data[start:] ) # Flush input mailbox(es) while (self.transport.recv(timeout=0)): pass self.transport.send(msg) self._last_sent_frame = msg if (self.echo_frames): # Read back the echo message while (True): frame = self.transport.recv(self.timeout) if (not frame): raise BootloaderTimeoutError("Did not receive echo frame within {} timeout".format(self.timeout)) # Don't check the frame arbitration ID, it may be used for varying purposes if (frame.data[:frame.dlc] != msg.data[:msg.dlc]): continue # Ok, got a good frame break elif (self.wait_send_s > 0.0): time.sleep(self.wait_send_s) start += 8 def recv(self): # Response packets read from the Bootloader have the following structure: # Start of Packet (0x01): 1 byte # Status Code: 1 byte # Data Length: 2 bytes # Data: N bytes of data # Checksum: 2 bytes # End of Packet (0x17): 1 byte data = bytearray() # Read first frame, contains data length while True: frame = self.transport.recv(self.timeout) if (not frame): raise BootloaderTimeoutError("Timed out waiting for Bootloader 1st response frame") if frame.arbitration_id != self.frame_id: continue # Don't check the frame arbitration ID, it may be used for varying purposes if len(frame.data) < 4: raise BootloaderTimeoutError("Unexpected response data: length {}, minimum is 4".format(len(frame.data))) if (frame.data[0] != 0x01): raise BootloaderTimeoutError("Unexpected start of frame data: 0x{0:02X}, expected 0x01".format(frame.data[0])) break data += frame.data[:frame.dlc] # 4 initial bytes, reported size, 3 tail total_size = 4 + (struct.unpack("<H", data[2:4])[0]) + 3 while (len(data) < total_size): frame = self.transport.recv(self.timeout) if (not frame): raise BootloaderTimeoutError("Timed out waiting for Bootloader response frame") if (self.echo_frames) and (frame.arbitration_id != self.frame_id): # Got a frame from another device, ignore continue data += frame.data[:frame.dlc] return data def crc16_checksum(data): crc = 0xffff for b in data: if not isinstance(b, int): b = ord(b) for i in range(8): if (crc & 1) ^ (b & 1): crc = (crc >> 1) ^ 0x8408 else: crc >>= 1 b >>= 1 crc = (crc << 8) | (crc >> 8) return ~crc & 0xffff def sum_2complement_checksum(data): if (type(data) is str): return (1 + ~sum([ord(c) for c in data])) & 0xFFFF elif (type(data) in (bytearray, bytes)): return (1 + ~sum(data)) & 0xFFFF
bsd-2-clause
yuriks/SCV
SCV/src/Group.cpp
3173
#include "stdafx.h" #include "Group.h" #include "GapSpring.h" #include "ComponentSpring.h" namespace scv { Group *Group::addGroup(Group *group) { return addSpring(group); } Group *Group::addComponent(Component *component) { return addComponent(component, Spring::DEFAULT_SIZE, Spring::DEFAULT_SIZE, Spring::DEFAULT_SIZE); } Group *Group::addComponent(Component *component, int size) { return addComponent(component, size, size, size); } Group *Group::addComponent(Component *component, int min, int pref, int max) { return addSpring(new ComponentSpring(component, min, pref, max)); } void Group::removeComponent(scv::Component * object) { SpringsList::iterator iter = _springs.begin(); while (iter != _springs.end()) { ComponentSpring* spring; Group* group; if ((spring = dynamic_cast<ComponentSpring *>(*iter)) && spring->getComponent() == object) { iter = _springs.erase(iter); } else if (group = dynamic_cast<Group *>(*iter)) { group->removeComponent(object); ++iter; } else { ++iter; } } } Group *Group::addGap(int size) { return addGap(size, size, size); } Group * Group::addGap(int min, int pref, int max) { return addSpring(new GapSpring(min, pref, max)); } Group * Group::addSpring(Spring *spring) { _springs.push_back(spring); return this; } int Group::calculateMinimumSize(Axis axis) { return calculateSize(axis, MIN_SIZE); } int Group::calculatePreferredSize(Axis axis) { return calculateSize(axis, PREF_SIZE); } int Group::calculateMaximumSize(Axis axis) { return calculateSize(axis, MAX_SIZE); } int Group::calculateSize(Spring::Axis axis, SizeType type) { int count = _springs.size(); if (count == 0) { return 0; } if (count == 1) { return getSpringSize(getSpring(0), axis, type); } int size = constrain(combined(getSpringSize(getSpring(0), axis, type), getSpringSize(getSpring(1), axis, type))); for (int i = 2; i < count; ++i) { size = constrain(combined(size, getSpringSize(getSpring(i), axis, type))); } return size; } int Group::getSpringSize(Spring *spring, Spring::Axis axis, SizeType type) { switch (type) { case MIN_SIZE: return spring->getMinimumSize(axis); break; case PREF_SIZE: return spring->getPreferredSize(axis); break; case MAX_SIZE: return spring->getMaximumSize(axis); break; default: return 0; break; } } void Group::setSize(Spring::Axis axis, int origin, int size) { Spring::setSize(axis, origin, size); if (size == Spring::UNSET) { for (int counter = _springs.size() - 1; counter >= 0; --counter) { getSpring(counter)->setSize(axis, origin, size); } } else { setValidSize(axis, origin, size); } } /* Group *Group::enableAutoCreateContainerGaps(void) { _autoCreateContainerPadding = true; } bool Group::getAutoCreateContainerGaps(void) const { return _autoCreateContainerPadding; }*/ } //namespace scv
bsd-2-clause
Multifarious/shiro-jdbi-realm
src/test/java/io/ifar/security/realm/TestJdbiShiroRealm2.java
840
package io.ifar.security.realm; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.Arrays; /** * Project: security * DefaultUserImpl: ezra * Date: 4/3/13 */ public class TestJdbiShiroRealm2 extends TestJdbiShiroRealm { private static final Logger LOG = LoggerFactory.getLogger(TestJdbiShiroRealm2.class); protected Logger log() { return LOG; } protected String getUsername() { return "ShiroTest_id_uname"; } // We expect secondary principal values are optional and not used for authZ functionality that is under test. // This class tests that. protected void configureRealm(JdbiShiroRealm realm) { realm.setPrincipalValueFields(Arrays.asList(JdbiShiroRealm.PrincipalValueField.USER_ID, JdbiShiroRealm.PrincipalValueField.USERNAME)); } }
bsd-2-clause
sebastienros/jint
Jint.Tests.Test262/test/language/expressions/object/dstr-gen-meth-obj-init-null.js
1850
// This file was procedurally generated from the following sources: // - src/dstr-binding/obj-init-null.case // - src/dstr-binding/error/gen-meth.template /*--- description: Value specifed for object binding pattern must be object coercible (null) (generator method) esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation es6id: 14.4.13 features: [generators, destructuring-binding] flags: [generated] info: | GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody } 1. Let propKey be the result of evaluating PropertyName. 2. ReturnIfAbrupt(propKey). 3. If the function code for this GeneratorMethod is strict mode code, let strict be true. Otherwise let strict be false. 4. Let scope be the running execution context's LexicalEnvironment. 5. Let closure be GeneratorFunctionCreate(Method, StrictFormalParameters, GeneratorBody, scope, strict). [...] 9.2.1 [[Call]] ( thisArgument, argumentsList) [...] 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). [...] 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). [...] 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) [...] 23. Let iteratorRecord be Record {[[iterator]]: CreateListIterator(argumentsList), [[done]]: false}. 24. If hasDuplicates is true, then [...] 25. Else, b. Let formalStatus be IteratorBindingInitialization for formals with iteratorRecord and env as arguments. [...] Runtime Semantics: BindingInitialization ObjectBindingPattern : { } 1. Return NormalCompletion(empty). ---*/ var obj = { *method({}) {} }; assert.throws(TypeError, function() { obj.method(null); });
bsd-2-clause
windygu/webkitdotnet
WebKitBrowser/PrintManager.cs
2909
using System; using System.Collections.Generic; using System.Text; using System.Drawing.Printing; using System.ComponentModel; using WebKit.Interop; using System.Drawing; using System.Windows.Forms; namespace WebKit { internal class PrintManager { private PrintDocument _document; private IWebFramePrivate _webFramePrivate; private WebKitBrowser _owner; private Graphics _printGfx; private uint _nPages; private uint _page; private int _hDC; private bool _printing = false; public PrintManager(PrintDocument Document, WebKitBrowser Owner) { this._document = Document; this._owner = Owner; this._webFramePrivate = (IWebFramePrivate)((IWebView)_owner.GetWebView()).mainFrame(); } public void Print() { // potential concurrency issues with shared state variable if (_printing) return; _printing = true; BackgroundWorker worker = new BackgroundWorker(); worker.DoWork += new DoWorkEventHandler(worker_DoWork); worker.RunWorkerAsync(); } private void worker_DoWork(object sender, DoWorkEventArgs e) { _document.PrintPage += new PrintPageEventHandler(_document_PrintPage); _document.Print(); _printing = false; } private delegate uint GetPrintedPageCountDelegate(); private void _document_PrintPage(object sender, PrintPageEventArgs e) { // running on a seperate thread, so we invoke _webFramePrivate // methods on the owners ui thread if (_printGfx == null) { // initialise printing _printGfx = e.Graphics; _hDC = _printGfx.GetHdc().ToInt32(); _owner.Invoke(new MethodInvoker(delegate() { _webFramePrivate.setInPrintingMode(1, _hDC); })); _nPages = (uint)_owner.Invoke( new GetPrintedPageCountDelegate(delegate() { return _webFramePrivate.getPrintedPageCount(_hDC); })); _page = 1; } _owner.Invoke(new MethodInvoker(delegate() { _webFramePrivate.spoolPages(_hDC, _page, _page, 0); })); ++_page; if (_page <= _nPages) { e.HasMorePages = true; } else { _owner.Invoke(new MethodInvoker(delegate() { _webFramePrivate.setInPrintingMode(0, _hDC); })); e.HasMorePages = false; } } } }
bsd-2-clause
smcpeak/earthshape
src/util/swing/TestProgressDialog.java
7571
// TestProgressDialog.java // See copyright.txt for license and terms of use. package util.swing; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.concurrent.ExecutionException; import javax.swing.Box; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JLabel; import javax.swing.JTextField; import javax.swing.SwingUtilities; import static util.swing.SwingUtil.log; /** Little program to test ProgressDialog. */ public class TestProgressDialog extends MyJFrame { /** AWT boilerplate. */ private static final long serialVersionUID = 1770692424967304611L; /** Text field where user can specify how many milliseconds each * worker tick should require. */ private JTextField msPerTickTextField; /** Let user request that worker throw an exception. */ private JCheckBox throwExceptionCB; /** Let user request that worker be slow to cancel. */ private JCheckBox slowCancelCB; /** Text field for saying how slow to cancel. */ private JTextField msCancelDelayTextField; public TestProgressDialog() { super("Test Progress Dialog"); log("in TestProgressDialog ctor"); HBox outerHB = new HBox(); outerHB.strut(); { VBox vb = new VBox(); vb.add(Box.createHorizontalStrut(400)); this.msPerTickTextField = this.addTextField(vb, "Milliseconds per tick: ", "20"); this.throwExceptionCB = this.addCheckBox(vb, "Throw an exception inside worker", false); this.slowCancelCB = this.addCheckBox(vb, "Worker will respond slowly to cancellation", false); this.msCancelDelayTextField = this.addTextField(vb, "Milliseconds to delay on cancel: ", "1000"); this.addButton(vb, "Start", new ActionListener() { public void actionPerformed(ActionEvent ev) { TestProgressDialog.this.startTask(); } }); this.addButton(vb, "Quit", new ActionListener() { public void actionPerformed(ActionEvent ev) { log("closing due to Quit button press"); TestProgressDialog.this.dispose(); } }); vb.strut(); outerHB.add(vb); } outerHB.strut(); this.add(outerHB); this.pack(); this.setLocationByPlatform(true); } private JCheckBox addCheckBox(VBox vb, String label, boolean initValue) { vb.strut(); HBox hb = new HBox(); JCheckBox ret = new JCheckBox(label, initValue); hb.add(ret); hb.glue(); vb.add(hb); return ret; } private JTextField addTextField(VBox vb, String label, String initValue) { vb.strut(); HBox hb = new HBox(); hb.add(new JLabel(label)); hb.strut(); JTextField ret = new JTextField(initValue); hb.add(ret); hb.glue(); vb.add(hb); return ret; } private JButton addButton(VBox vb, String label, ActionListener listener) { vb.strut(); HBox hb = new HBox(); JButton button = new JButton(label); hb.add(button); button.addActionListener(listener); hb.glue(); vb.add(hb); return button; } private static class TestTask extends MySwingWorker<Integer, Void> { private int msPerTick; private boolean throwException; private boolean slowCancel; private int msCancelDelay; /** This is not set to true until this thread stops executing * any task-related code. */ public boolean stoppedRunning = false; public TestTask( int msPerTick_, boolean throwException_, boolean slowCancel_, int msCancelDelay_) { this.msPerTick = msPerTick_; this.throwException = throwException_; this.slowCancel = slowCancel_; this.msCancelDelay = msCancelDelay_; } protected Integer doTask() throws Exception { log("TestTask: starting"); this.setProgress(0); for (int i=0; i < 100 && !this.isCancelled(); i++) { Thread.sleep(this.msPerTick); if (i == 50 && this.throwException) { log("TestTask: throwing exception"); this.stoppedRunning = true; throw new RuntimeException("Exception thrown from worker"); } if (i % 10 == 0) { log("TestTask: progress is "+i); if (i != 0) { this.setStatus("Passed "+i+"%"); } } this.setProgress(i); } if (this.isCancelled()) { if (this.slowCancel) { log("TestTask: waiting 1 second before actually exiting"); Thread.sleep(this.msCancelDelay); log("TestTask: done with slow cancel delay"); } log("TestTask: canceled externally, shutting down"); this.stoppedRunning = true; return null; } else { log("TestTask: finished with complete task"); this.stoppedRunning = true; return 5; } } } private void startTask() { int msPerTick; int msCancelDelay; try { msPerTick = Integer.valueOf(this.msPerTickTextField.getText()); msCancelDelay = Integer.valueOf(this.msCancelDelayTextField.getText()); } catch (NumberFormatException e) { ModalDialog.errorBox(this, "Invalid integer: "+e.getMessage()); return; } boolean throwException = this.throwExceptionCB.isSelected(); boolean slowCancel = this.slowCancelCB.isSelected(); log("startTask: starting new task"); TestTask task = new TestTask(msPerTick, throwException, slowCancel, msCancelDelay); ProgressDialog<Integer, Void> pd = new ProgressDialog<Integer, Void>(this, "Test Progress", task); boolean res = pd.exec(); if (!task.stoppedRunning) { // This would be bad because the task might be modifying // state that is shared with the client code. log("startTask: **** BUG: exec returned before task stopped completely!"); } if (res) { log("startTask: task finished normally"); try { Integer i = task.get(); log("startTask: computation returned: "+i); } catch (ExecutionException e) { log("startTask: computation threw exception: "+e.getMessage()); } catch (InterruptedException e) { log("startTask: computation was interrupted: "+e.getMessage()); } } else { log("startTask: task was canceled"); } } public static void main(String[] args) { log("start of main"); SwingUtilities.invokeLater(new Runnable() { public void run() { log("start of main.run"); (new TestProgressDialog()).setVisible(true); } }); } }
bsd-2-clause
flubu-core/flubu.core
src/FlubuCore/Tasks/Docker/Swarm/DockerSwarmCaTask.cs
2948
//----------------------------------------------------------------------- // <auto-generated /> //----------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Text; using FlubuCore.Context; using FlubuCore.Tasks; using FlubuCore.Tasks.Attributes; using FlubuCore.Tasks.Process; namespace FlubuCore.Tasks.Docker.Swarm { public partial class DockerSwarmCaTask : ExternalProcessTaskBase<int, DockerSwarmCaTask> { public DockerSwarmCaTask() { ExecutablePath = "docker"; WithArguments("swarm ca"); } protected override string Description { get; set; } /// <summary> /// Path to the PEM-formatted root CA certificate to use for the new cluster /// </summary> [ArgKey("--ca-cert")] public DockerSwarmCaTask CaCert(string caCert) { WithArgumentsKeyFromAttribute(caCert.ToString()); return this; } /// <summary> /// Path to the PEM-formatted root CA key to use for the new cluster /// </summary> [ArgKey("--ca-key")] public DockerSwarmCaTask CaKey(string caKey) { WithArgumentsKeyFromAttribute(caKey.ToString()); return this; } /// <summary> /// Validity period for node certificates (ns|us|ms|s|m|h) /// </summary> [ArgKey("--cert-expiry")] public DockerSwarmCaTask CertExpiry(string certExpiry) { WithArgumentsKeyFromAttribute(certExpiry.ToString()); return this; } /// <summary> /// Exit immediately instead of waiting for the root rotation to converge /// </summary> [ArgKey("--detach")] public DockerSwarmCaTask Detach() { WithArgumentsKeyFromAttribute(); return this; } /// <summary> /// Specifications of one or more certificate signing endpoints /// </summary> [ArgKey("--external-ca")] public DockerSwarmCaTask ExternalCa(string externalCa) { WithArgumentsKeyFromAttribute(externalCa.ToString()); return this; } /// <summary> /// Suppress progress output /// </summary> [ArgKey("--quiet")] public DockerSwarmCaTask Quiet() { WithArgumentsKeyFromAttribute(); return this; } /// <summary> /// Rotate the swarm CA - if no certificate or key are provided, new ones will be generated /// </summary> [ArgKey("--rotate")] public DockerSwarmCaTask Rotate() { WithArgumentsKeyFromAttribute(); return this; } protected override int DoExecute(ITaskContextInternal context) { return base.DoExecute(context); } } }
bsd-2-clause
Nightfall/SRails
src/main/scala/moe/nightfall/srails/common/block/property/PropertyRotatable.scala
196
package moe.nightfall.srails.common.block.property import net.minecraft.block.properties.PropertyDirection object PropertyRotatable { final val ROTATION = PropertyDirection.create("facing") }
bsd-2-clause
Solidstatewater/Anubis-Engine
Scene/Source/Representations/DynamicRepresentation.cpp
3047
//==================================================================================== //DynamicRepresentation.cpp // //This code is part of Anubis Engine. // //Anubis Engine is a free game engine created as a fan project to be //awesome platform for developing games! // //All sources can be found here: // https://github.com/Dgek/Anubis-Engine // //Demos based on Anubis Engine can be found here: // https://github.com/Dgek/Demos // //Copyright (c) 2013, Muralev Evgeny //All rights reserved. // //Redistribution and use in source and binary forms, with //or without modification, are permitted provided that the //following conditions are met: // //Redistributions of source code must retain the above copyright notice, //this list of conditions and the following disclaimer. // //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. // //Neither the name of the Minotower Games 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 MURALEV EVGENY "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 MURALEV EVGENY BE LIABLE //FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES //(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON //ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT //(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // //==================================================================================== #include "Scene_pch.h" #include "DynamicRepresentation.h" #include "../../../Math/Source/Interpolation.h" using namespace Anubis; AVOID DynamicRepresentation::SetCurrentTransform(Mat4x4 & mat, AREAL64 r64CurrentTime) { m_prevWorldMatrix = m_currentWorldMatrix; m_currentWorldMatrix = mat; m_r64LastUpdate = r64CurrentTime; } AVOID DynamicRepresentation::SetBothTransforms(Mat4x4 & mat, AREAL64 r64CurrentTime) { m_prevWorldMatrix = mat; m_currentWorldMatrix = mat; m_r64LastUpdate = r64CurrentTime; } //pre-rendering modifications AVOID DynamicRepresentation::VPushParameters(Scene *pScene, AREAL64 r64CurrentTime) { Mat4x4 transform; //new update cycle - current transform has changed if (m_prevWorldMatrix != m_currentWorldMatrix) { transform = LERP(m_prevWorldMatrix, m_currentWorldMatrix, min((r64CurrentTime - m_r64LastUpdate) / pScene->GetFixedTimeStep(), 1)); } else { //we are not updating anything, so use current transform transform = m_currentWorldMatrix; } pScene->PushTransform(transform); }
bsd-2-clause
d3matt/d3matt.com
src/d3matt/d3matt/settings.py
2826
""" Django settings for d3matt project. For more information on this file, see https://docs.djangoproject.com/en/1.6/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.6/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) import os BASE_DIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) ENV_ROOT = os.path.dirname(os.path.dirname(BASE_DIR)) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'xz@e41f!kjulkntr!e8f2sahhguv)eqy_04qd5st-g8vvlkx**' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True TEMPLATE_DEBUG = True ALLOWED_HOSTS = ['*'] # Application definition INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'crispy_forms', 'blog', ) MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ) ROOT_URLCONF = 'd3matt.urls' WSGI_APPLICATION = 'd3matt.wsgi.application' # Database # https://docs.djangoproject.com/en/1.6/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(ENV_ROOT, 'd3matt.db'), } } # Internationalization # https://docs.djangoproject.com/en/1.6/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'America/Chicago' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.6/howto/static-files/ STATIC_URL = '/static/' STATICFILES_DIRS = ( os.path.join(ENV_ROOT, 'static'), ) STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', # 'django.contrib.staticfiles.finders.DefaultStorageFinder', ) TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', ) TEMPLATE_DIRS = ( # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. os.path.join(ENV_ROOT, 'templates'), ) CRISPY_TEMPLATE_PACK = 'bootstrap3' LOGIN_REDIRECT_URL = '/d3matt/'
bsd-2-clause
hudge/proffer
README.md
2404
Proffer [![Build Status](https://secure.travis-ci.org/hudge/proffer.png?branch=master)](http://travis-ci.org/hudge/proffer) ======= A module to stop Action Controller from copying every instance variable available to an action to the view by default. Instead, Proffer provides a way to explicitly expose values as local variables within views. Rationale --------- By default, Action Controller will make any instance variables present during an action available to its views (including partials). This effectively makes them global variables and can obscure their origin when maintaining views. Partials that exploit this behaviour can be particularly difficult to maintain as they may inherit state from their caller implicitly. We want to see if removing this default behaviour changes the way views are written. By forcing explicit declaration of dependencies, will better, more encapsulated design result? Usage ----- Add the following to your `Gemfile`: ```ruby gem 'proffer' ``` Include the `Proffer` module into any controllers you wish (include into `ApplicationController` to enforce this behaviour throughout your application): ```ruby class PostsController < ApplicationController include Proffer # This will make a new Post object available as post in the view but # @heading will be nil. def new @heading = "New Post" proffer :post => Post.new end end ``` Any proffered values will then be available to your views by their key: ```erb <%= form_for(post) do |f| %> ... <% end %> ``` You can test your use of Proffer by inspecting the `proffered` method on your controllers instead of using `assigns` like so: ```ruby describe FooController do describe "GET index" do it "only proffers the title" do get :index controller.proffered.should == { :title => "Title" } end end end ``` Note that if you set `@title` in a Proffer-enabled action, `assigns(:title)` will be `nil`. Compatibility ------------- As we rely on `ActionController#view_assigns`, this will only work with versions of Rails 3.0 or later. It is currently tested against Rails 3.2. Disclaimer ---------- We have not yet tried this in production so proceed with caution. This gem overrides `ActionController#view_assigns` and extends `ActionController#render`, so it may be incompatible with other gems that override these methods. License ------- See LICENSE.txt
bsd-2-clause
wied03/ansible-ruby
lib/ansible/ruby/modules/generated/storage/netapp/na_elementsw_access_group.rb
1981
# frozen_string_literal: true # See LICENSE.txt at root of repository # GENERATED FILE - DO NOT EDIT!! require 'ansible/ruby/modules/base' module Ansible module Ruby module Modules # Create, destroy, or update access groups on Element Software Cluster. class Na_elementsw_access_group < Base # @return [:present, :absent] Whether the specified access group should exist or not. attribute :state validates :state, presence: true, expression_inclusion: {:in=>[:present, :absent], :message=>"%{value} needs to be :present, :absent"} # @return [String, Integer, nil] ID or Name of the access group to modify or delete.,Required for delete and modify operations. attribute :src_access_group_id validates :src_access_group_id, type: MultipleTypes.new(String, Integer) # @return [String, nil] New name for the access group for create and modify operation.,Required for create operation. attribute :new_name validates :new_name, type: String # @return [Object, nil] List of initiators to include in the access group. If unspecified, the access group will start out without configured initiators. attribute :initiators # @return [Array<Integer>, Integer, nil] List of volumes to initially include in the volume access group. If unspecified, the access group will start without any volumes. attribute :volumes validates :volumes, type: TypeGeneric.new(Integer) # @return [Object, nil] The ID of the Element SW Software Cluster Virtual Network ID to associate the access group with. attribute :virtual_network_id # @return [Object, nil] The ID of the VLAN Virtual Network Tag to associate the access group with. attribute :virtual_network_tags # @return [Hash, nil] List of Name/Value pairs in JSON object format. attribute :attributes validates :attributes, type: Hash end end end end
bsd-2-clause
aviewdevs/aview
iview-api/src/main/java/com/github/aview/api/mobile/MobileSeries.java
4784
package com.github.aview.api.mobile; /* * #%L * iview-api * %% * Copyright (C) 2013 The aview authors * %% * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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. * #L% */ import java.util.Arrays; import java.util.Date; import com.github.aview.api.Series; import com.google.gson.annotations.SerializedName; /** * * @author aview * */ public class MobileSeries implements Series { private static final long serialVersionUID = -4714586420569623473L; @SerializedName("episodes") private MobileEpisode[] episodes; @SerializedName("keywords") private String keywords; @SerializedName("seriesDescription") private String seriesDescription; @SerializedName("seriesExpireDate") private Date seriesExpireDate; @SerializedName("seriesId") private int seriesId; @SerializedName("seriesNumber") private Integer seriesNumber; @SerializedName("seriesPubDate") private Date seriesPubDate; @SerializedName("seriesTitle") private String seriesTitle; @SerializedName("thumbnail") private String thumbnail; /* * @see com.github.aview.Series#getPrograms() */ @Override public MobileEpisode[] getEpisodes() { return episodes; } /* * @see com.github.aview.Series#getKeywords() */ @Override public String getKeywords() { return keywords; } /* * @see com.github.aview.Series#getDescription() */ @Override public String getDescription() { return seriesDescription; } public Date getSeriesExpireDate() { return seriesExpireDate; } /* * @see com.github.aview.Series#getId() */ @Override public Integer getId() { return seriesId; } public Integer getSeriesNumber() { return seriesNumber; } public Date getSeriesPubDate() { return seriesPubDate; } /* * @see com.github.aview.Series#getName() */ @Override public String getName() { return seriesTitle; } /* * @see com.github.aview.Series#getThumbnailUrl() */ @Override public String getThumbnailUrl() { return thumbnail; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + seriesId; return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; MobileSeries other = (MobileSeries) obj; if (seriesId != other.seriesId) return false; return true; } /* * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("MobileSeries [episodes=").append(Arrays.toString(episodes)).append(", keywords=") .append(keywords).append(", seriesDescription=").append(seriesDescription) .append(", seriesExpireDate=").append(seriesExpireDate).append(", seriesId=").append(seriesId) .append(", seriesNumber=").append(seriesNumber).append(", seriesPubDate=").append(seriesPubDate) .append(", seriesTitle=").append(seriesTitle).append(", thumbnail=").append(thumbnail).append("]"); return builder.toString(); } }
bsd-2-clause
dcrosta/wideload
cli.h
542
#ifndef WIDELOAD_CLI_H #define WIDELOAD_CLI_H #include <stdio.h> typedef struct { /* required arguments */ const char* url_filename; /* optional arguments */ unsigned long concurrency; unsigned long run_seconds; unsigned long run_requests; unsigned long fail_after; unsigned long fail_status; unsigned char randomize; } options; /** * Parse the command line options and return a struct options * after performing validation. */ options command_line_options(int argc, char* argv[]); #endif
bsd-2-clause
FloodProject/flood
src/Engine/Input/InputManager.cpp
1203
/************************************************************************ * * Flood Project © (2008-201x) * Licensed under the simplified BSD license. All rights reserved. * ************************************************************************/ #include "Engine/API.h" #include "Engine/Input/InputManager.h" #include "Engine/Input/Device.h" #include "Engine/Input/Keyboard.h" #include "Engine/Input/Mouse.h" #include "Engine/Input/Joystick.h" #include "Engine/Window/Window.h" NAMESPACE_ENGINE_BEGIN //-----------------------------------// static Allocator* gs_InputAllocator = nullptr; static InputManager* gs_InputManager = nullptr; InputManager* GetInputManager() { return gs_InputManager; } void InputInitialize() { gs_InputAllocator = AllocatorCreateHeap( AllocatorGetHeap() ); AllocatorSetGroup(gs_InputAllocator, "Input"); } void InputDeinitialize() { AllocatorDestroy(gs_InputAllocator); } //-----------------------------------// InputManager::InputManager() { gs_InputManager = this; } //-----------------------------------// InputManager::~InputManager() { } //-----------------------------------// NAMESPACE_ENGINE_END
bsd-2-clause
brewbit/brewbit-dashboard
db/migrate/20140104214015_create_api_keys.rb
258
class CreateApiKeys < ActiveRecord::Migration def change create_table :api_keys do |t| t.string :access_token t.references :user t.timestamps end add_index :api_keys, :user_id add_index :api_keys, :access_token end end
bsd-2-clause
robohack/homebrew-core
Formula/links.rb
2014
class Links < Formula desc "Lynx-like WWW browser that supports tables, menus, etc." homepage "http://links.twibright.com/" url "http://links.twibright.com/download/links-2.14.tar.bz2" sha256 "f70d0678ef1c5550953bdc27b12e72d5de86e53b05dd59b0fc7f07c507f244b8" revision 1 bottle do cellar :any sha256 "c5548c20d4e677218f870fb19c2275f51b3a737da1fd78532b88cf90af4e4dd5" => :high_sierra sha256 "5a8045be375cb674122da0342e04f47ff14c3360e1f7eebe9f827284aba318ed" => :sierra sha256 "3a74e6b5c260ee7ac380cf0e15e0c718fb6c06c113ac2311a0dae9b1be755fe3" => :el_capitan end depends_on "pkg-config" => :build depends_on "xz" depends_on "openssl" depends_on :x11 => :optional # rest only really needed if --with-x11: XXX but impossible to use: if build.with? "x11" depends_on "libtiff" => :recommended depends_on "jpeg" => :recommended depends_on "libpng" => :recommended # note: librsvg pulls in lots of really big stuff, but is quite useful, e.g. for Wikipedia depends_on "librsvg" => :recommended def install args = %W[ --disable-debug --disable-dependency-tracking --prefix=#{prefix} --mandir=#{man} --with-ssl=#{Formula["openssl"].opt_prefix} --without-lzma ] if build.with? "x11" args << "--enable-graphics" args << "--with-x" if build.without? "libpng" args << "--disable-png-pkgconfig" end if build.without? "libtiff" args << "--without-libtiff" else args << "--with-libtiff" end if build.without? "jpeg" args << "--without-libjpeg" else args << "--with-libjpeg" end if build.without? "librsvg" args << "--without-librsvg" args << "--disable-svg-pkgconfig" else args << "--with-librsvg" end end system "./configure", *args system "make", "install" doc.install Dir["doc/*"] end test do system bin/"links", "-dump", "https://duckduckgo.com" end end
bsd-2-clause
swax/DeOps
UI/Services/Profile/ProfileView.Designer.cs
3654
namespace DeOps.Services.Profile { partial class ProfileView { /// <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 Component 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.components = new System.ComponentModel.Container(); this.Browser = new DeOps.Interface.Views.WebBrowserEx(); this.RightClickMenu = new System.Windows.Forms.ContextMenuStrip(this.components); this.EditMenu = new System.Windows.Forms.ToolStripMenuItem(); this.RightClickMenu.SuspendLayout(); this.SuspendLayout(); // // Browser // this.Browser.AllowWebBrowserDrop = false; this.Browser.ContextMenuStrip = this.RightClickMenu; this.Browser.Dock = System.Windows.Forms.DockStyle.Fill; this.Browser.IsWebBrowserContextMenuEnabled = false; this.Browser.Location = new System.Drawing.Point(0, 0); this.Browser.MinimumSize = new System.Drawing.Size(20, 20); this.Browser.Name = "Browser"; this.Browser.ScriptErrorsSuppressed = true; this.Browser.Size = new System.Drawing.Size(216, 200); this.Browser.TabIndex = 0; this.Browser.WebBrowserShortcutsEnabled = false; this.Browser.Navigating += new System.Windows.Forms.WebBrowserNavigatingEventHandler(this.Browser_Navigating); // // RightClickMenu // this.RightClickMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.EditMenu}); this.RightClickMenu.Name = "RightClickMenu"; this.RightClickMenu.RenderMode = System.Windows.Forms.ToolStripRenderMode.System; this.RightClickMenu.Size = new System.Drawing.Size(116, 26); this.RightClickMenu.Opening += new System.ComponentModel.CancelEventHandler(this.RightClickMenu_Opening); // // EditMenu // this.EditMenu.Name = "EditMenu"; this.EditMenu.Size = new System.Drawing.Size(115, 22); this.EditMenu.Text = "Edit..."; this.EditMenu.Click += new System.EventHandler(this.EditMenu_Click); // // ProfileView // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.Browser); this.Name = "ProfileView"; this.Size = new System.Drawing.Size(216, 200); this.RightClickMenu.ResumeLayout(false); this.ResumeLayout(false); } #endregion private DeOps.Interface.Views.WebBrowserEx Browser; private System.Windows.Forms.ContextMenuStrip RightClickMenu; private System.Windows.Forms.ToolStripMenuItem EditMenu; } }
bsd-2-clause
elvman/ouzel
ouzel/graphics/direct3d11/D3D11RenderTarget.hpp
1409
// Copyright 2015-2019 Elviss Strazdins. All rights reserved. #ifndef OUZEL_GRAPHICS_D3D11RENDERTARGET_HPP #define OUZEL_GRAPHICS_D3D11RENDERTARGET_HPP #include "core/Setup.h" #if OUZEL_COMPILE_DIRECT3D11 #include <d3d11.h> #include <set> #include <vector> #include "graphics/direct3d11/D3D11RenderResource.hpp" #include "math/Color.hpp" namespace ouzel { namespace graphics { class D3D11RenderDevice; class D3D11Texture; class D3D11RenderTarget final: public D3D11RenderResource { public: D3D11RenderTarget(D3D11RenderDevice& renderDeviceD3D11, const std::set<D3D11Texture*>& initColorTextures, D3D11Texture* initDepthTexture); ~D3D11RenderTarget(); void resolve(); inline const std::vector<ID3D11RenderTargetView*>& getRenderTargetViews() const { return renderTargetViews; } inline ID3D11DepthStencilView* getDepthStencilView() const { return depthStencilView; } private: std::set<D3D11Texture*> colorTextures; D3D11Texture* depthTexture = nullptr; std::vector<ID3D11RenderTargetView*> renderTargetViews; ID3D11DepthStencilView* depthStencilView = nullptr; }; } // namespace graphics } // namespace ouzel #endif #endif // OUZEL_GRAPHICS_D3D11RENDERTARGET_HPP
bsd-2-clause
brunolauze/MonoNative
MonoNative/mscorlib/System/mscorlib_System_Type.h
37925
#ifndef __MONO_NATIVE_MSCORLIB_SYSTEM_TYPE_H #define __MONO_NATIVE_MSCORLIB_SYSTEM_TYPE_H #include <mscorlib/System/Reflection/mscorlib_System_Reflection_MemberInfo.h> #include <mscorlib/System/Reflection/mscorlib_System_Reflection_ICustomAttributeProvider.h> #include <mscorlib/System/Runtime/InteropServices/mscorlib_System_Runtime_InteropServices__Type.h> #include <mscorlib/System/Runtime/InteropServices/mscorlib_System_Runtime_InteropServices__MemberInfo.h> #include <mscorlib/System/Reflection/mscorlib_System_Reflection_IReflect.h> #include <mscorlib/System/Reflection/mscorlib_System_Reflection_TypeAttributes.h> #include <mscorlib/System/Reflection/mscorlib_System_Reflection_MemberTypes.h> #include <mscorlib/System/mscorlib_System_Object.h> #include <mscorlib/System/Reflection/mscorlib_System_Reflection_BindingFlags.h> #include <mscorlib/System/Reflection/mscorlib_System_Reflection_CallingConventions.h> #include <mscorlib/System/Reflection/mscorlib_System_Reflection_GenericParameterAttributes.h> #include <mscorlib/System/Collections/Generic/mscorlib_System_Collections_Generic_IList_1.h> #include <mscorlib/System/Collections/Generic/mscorlib_System_Collections_Generic_IEnumerable_1.h> #include <mscorlib/System/mscorlib_System_TypeCode.h> namespace mscorlib { namespace System { namespace Reflection { class Assembly; class Module; class ConstructorInfo; class InterfaceMapping; class EventInfo; class FieldInfo; class MethodInfo; class ParameterModifier; class Binder; class PropertyInfo; class MethodBase; class CustomAttributeData; class AssemblyName; } } } namespace mscorlib { namespace System { class String; class Guid; class RuntimeTypeHandle; class Array; } } namespace mscorlib { namespace System { namespace Globalization { class CultureInfo; } } } namespace mscorlib { namespace System { namespace Runtime { namespace InteropServices { class StructLayoutAttribute; } } } } namespace mscorlib { namespace System { class Type : public mscorlib::System::Reflection::MemberInfo , public virtual mscorlib::System::Reflection::ICustomAttributeProvider , public virtual mscorlib::System::Runtime::InteropServices::_Type , public virtual mscorlib::System::Runtime::InteropServices::_MemberInfo , public virtual mscorlib::System::Reflection::IReflect { public: Type(mscorlib::NativeTypeInfo *nativeTypeInfo) : mscorlib::System::Reflection::MemberInfo(nativeTypeInfo) , mscorlib::System::Reflection::ICustomAttributeProvider(NULL) , mscorlib::System::Runtime::InteropServices::_Type(NULL) , mscorlib::System::Runtime::InteropServices::_MemberInfo(NULL) , mscorlib::System::Reflection::IReflect(NULL) { }; Type(MonoObject *nativeObject) : mscorlib::System::Reflection::MemberInfo(nativeObject) , mscorlib::System::Reflection::ICustomAttributeProvider(nativeObject) , mscorlib::System::Runtime::InteropServices::_Type(nativeObject) , mscorlib::System::Runtime::InteropServices::_MemberInfo(nativeObject) , mscorlib::System::Reflection::IReflect(nativeObject) { }; ~Type() { }; Type & operator=(Type &value) { __native_object__ = value.GetNativeObject(); return value; }; bool operator==(Type &value) { return mscorlib::System::Object::Equals(value); }; operator MonoObject*() { return __native_object__; }; MonoObject* operator=(MonoObject* value) { return __native_object__ = value; }; virtual mscorlib::System::Boolean Equals(mscorlib::System::Object o) override; virtual mscorlib::System::Boolean Equals(mscorlib::System::Type o); virtual mscorlib::System::Type GetEnumUnderlyingType(); virtual std::vector<mscorlib::System::String*> GetEnumNames(); virtual mscorlib::System::Array GetEnumValues(); virtual mscorlib::System::String GetEnumName(mscorlib::System::Object value); virtual mscorlib::System::Boolean IsEnumDefined(mscorlib::System::Object value); static mscorlib::System::Type GetType(mscorlib::System::String typeName, mscorlib::Callback<mscorlib::System::Reflection::Assembly (mscorlib::System::Reflection::AssemblyName )> assemblyResolver, mscorlib::Callback<mscorlib::System::Type (mscorlib::System::Reflection::Assembly , mscorlib::System::String , mscorlib::System::Boolean )> typeResolver); static mscorlib::System::Type GetType(const char *typeName, mscorlib::Callback<mscorlib::System::Reflection::Assembly (mscorlib::System::Reflection::AssemblyName )> assemblyResolver, mscorlib::Callback<mscorlib::System::Type (mscorlib::System::Reflection::Assembly , const char *, mscorlib::System::Boolean )> typeResolver); static mscorlib::System::Type GetType(mscorlib::System::String typeName, mscorlib::Callback<mscorlib::System::Reflection::Assembly (mscorlib::System::Reflection::AssemblyName )> assemblyResolver, mscorlib::Callback<mscorlib::System::Type (mscorlib::System::Reflection::Assembly , mscorlib::System::String , mscorlib::System::Boolean )> typeResolver, mscorlib::System::Boolean throwOnError); static mscorlib::System::Type GetType(const char *typeName, mscorlib::Callback<mscorlib::System::Reflection::Assembly (mscorlib::System::Reflection::AssemblyName )> assemblyResolver, mscorlib::Callback<mscorlib::System::Type (mscorlib::System::Reflection::Assembly , const char *, mscorlib::System::Boolean )> typeResolver, mscorlib::System::Boolean throwOnError); static mscorlib::System::Type GetType(mscorlib::System::String typeName, mscorlib::Callback<mscorlib::System::Reflection::Assembly (mscorlib::System::Reflection::AssemblyName )> assemblyResolver, mscorlib::Callback<mscorlib::System::Type (mscorlib::System::Reflection::Assembly , mscorlib::System::String , mscorlib::System::Boolean )> typeResolver, mscorlib::System::Boolean throwOnError, mscorlib::System::Boolean ignoreCase); static mscorlib::System::Type GetType(const char *typeName, mscorlib::Callback<mscorlib::System::Reflection::Assembly (mscorlib::System::Reflection::AssemblyName )> assemblyResolver, mscorlib::Callback<mscorlib::System::Type (mscorlib::System::Reflection::Assembly , const char *, mscorlib::System::Boolean )> typeResolver, mscorlib::System::Boolean throwOnError, mscorlib::System::Boolean ignoreCase); static mscorlib::System::Type GetType(mscorlib::System::String typeName); static mscorlib::System::Type GetType(const char *typeName); static mscorlib::System::Type GetType(mscorlib::System::String typeName, mscorlib::System::Boolean throwOnError); static mscorlib::System::Type GetType(const char *typeName, mscorlib::System::Boolean throwOnError); static mscorlib::System::Type GetType(mscorlib::System::String typeName, mscorlib::System::Boolean throwOnError, mscorlib::System::Boolean ignoreCase); static mscorlib::System::Type GetType(const char *typeName, mscorlib::System::Boolean throwOnError, mscorlib::System::Boolean ignoreCase); static std::vector<mscorlib::System::Type*> GetTypeArray(std::vector<mscorlib::System::Object*> args); static mscorlib::System::TypeCode::__ENUM__ GetTypeCode(mscorlib::System::Type type); static mscorlib::System::Type GetTypeFromCLSID(mscorlib::System::Guid clsid); static mscorlib::System::Type GetTypeFromCLSID(mscorlib::System::Guid clsid, mscorlib::System::Boolean throwOnError); static mscorlib::System::Type GetTypeFromCLSID(mscorlib::System::Guid clsid, mscorlib::System::String server); static mscorlib::System::Type GetTypeFromCLSID(mscorlib::System::Guid clsid, const char *server); static mscorlib::System::Type GetTypeFromCLSID(mscorlib::System::Guid clsid, mscorlib::System::String server, mscorlib::System::Boolean throwOnError); static mscorlib::System::Type GetTypeFromCLSID(mscorlib::System::Guid clsid, const char *server, mscorlib::System::Boolean throwOnError); static mscorlib::System::Type GetTypeFromHandle(mscorlib::System::RuntimeTypeHandle handle); static mscorlib::System::Type GetTypeFromProgID(mscorlib::System::String progID); static mscorlib::System::Type GetTypeFromProgID(const char *progID); static mscorlib::System::Type GetTypeFromProgID(mscorlib::System::String progID, mscorlib::System::Boolean throwOnError); static mscorlib::System::Type GetTypeFromProgID(const char *progID, mscorlib::System::Boolean throwOnError); static mscorlib::System::Type GetTypeFromProgID(mscorlib::System::String progID, mscorlib::System::String server); static mscorlib::System::Type GetTypeFromProgID(const char *progID, const char *server); static mscorlib::System::Type GetTypeFromProgID(mscorlib::System::String progID, mscorlib::System::String server, mscorlib::System::Boolean throwOnError); static mscorlib::System::Type GetTypeFromProgID(const char *progID, const char *server, mscorlib::System::Boolean throwOnError); static mscorlib::System::RuntimeTypeHandle GetTypeHandle(mscorlib::System::Object o); virtual mscorlib::System::Type GetType(); virtual mscorlib::System::Boolean IsSubclassOf(mscorlib::System::Type c); virtual std::vector<mscorlib::System::Type*> FindInterfaces(mscorlib::Callback<mscorlib::System::Boolean (mscorlib::System::Type , mscorlib::System::Object )> filter, mscorlib::System::Object filterCriteria); virtual mscorlib::System::Type GetInterface(mscorlib::System::String name); virtual mscorlib::System::Type GetInterface(const char *name); virtual mscorlib::System::Type GetInterface(mscorlib::System::String name, mscorlib::System::Boolean ignoreCase); virtual mscorlib::System::Type GetInterface(const char *name, mscorlib::System::Boolean ignoreCase); virtual mscorlib::System::Reflection::InterfaceMapping GetInterfaceMap(mscorlib::System::Type interfaceType); virtual std::vector<mscorlib::System::Type*> GetInterfaces(); virtual mscorlib::System::Boolean IsAssignableFrom(mscorlib::System::Type c); virtual mscorlib::System::Boolean IsInstanceOfType(mscorlib::System::Object o); virtual mscorlib::System::Int32 GetArrayRank(); virtual mscorlib::System::Type GetElementType(); virtual mscorlib::System::Reflection::EventInfo GetEvent(mscorlib::System::String name); virtual mscorlib::System::Reflection::EventInfo GetEvent(const char *name); virtual mscorlib::System::Reflection::EventInfo GetEvent(mscorlib::System::String name, mscorlib::System::Reflection::BindingFlags::__ENUM__ bindingAttr); virtual mscorlib::System::Reflection::EventInfo GetEvent(const char *name, mscorlib::System::Reflection::BindingFlags::__ENUM__ bindingAttr); virtual std::vector<mscorlib::System::Reflection::EventInfo*> GetEvents(); virtual std::vector<mscorlib::System::Reflection::EventInfo*> GetEvents(mscorlib::System::Reflection::BindingFlags::__ENUM__ bindingAttr); virtual mscorlib::System::Reflection::FieldInfo GetField(mscorlib::System::String name); virtual mscorlib::System::Reflection::FieldInfo GetField(const char *name); virtual mscorlib::System::Reflection::FieldInfo GetField(mscorlib::System::String name, mscorlib::System::Reflection::BindingFlags::__ENUM__ bindingAttr); virtual mscorlib::System::Reflection::FieldInfo GetField(const char *name, mscorlib::System::Reflection::BindingFlags::__ENUM__ bindingAttr); virtual std::vector<mscorlib::System::Reflection::FieldInfo*> GetFields(); virtual std::vector<mscorlib::System::Reflection::FieldInfo*> GetFields(mscorlib::System::Reflection::BindingFlags::__ENUM__ bindingAttr); virtual mscorlib::System::Int32 GetHashCode() override; virtual std::vector<mscorlib::System::Reflection::MemberInfo*> GetMember(mscorlib::System::String name); virtual std::vector<mscorlib::System::Reflection::MemberInfo*> GetMember(const char *name); virtual std::vector<mscorlib::System::Reflection::MemberInfo*> GetMember(mscorlib::System::String name, mscorlib::System::Reflection::BindingFlags::__ENUM__ bindingAttr); virtual std::vector<mscorlib::System::Reflection::MemberInfo*> GetMember(const char *name, mscorlib::System::Reflection::BindingFlags::__ENUM__ bindingAttr); virtual std::vector<mscorlib::System::Reflection::MemberInfo*> GetMember(mscorlib::System::String name, mscorlib::System::Reflection::MemberTypes::__ENUM__ type, mscorlib::System::Reflection::BindingFlags::__ENUM__ bindingAttr); virtual std::vector<mscorlib::System::Reflection::MemberInfo*> GetMember(const char *name, mscorlib::System::Reflection::MemberTypes::__ENUM__ type, mscorlib::System::Reflection::BindingFlags::__ENUM__ bindingAttr); virtual std::vector<mscorlib::System::Reflection::MemberInfo*> GetMembers(); virtual std::vector<mscorlib::System::Reflection::MemberInfo*> GetMembers(mscorlib::System::Reflection::BindingFlags::__ENUM__ bindingAttr); virtual mscorlib::System::Reflection::MethodInfo GetMethod(mscorlib::System::String name); virtual mscorlib::System::Reflection::MethodInfo GetMethod(const char *name); virtual mscorlib::System::Reflection::MethodInfo GetMethod(mscorlib::System::String name, mscorlib::System::Reflection::BindingFlags::__ENUM__ bindingAttr); virtual mscorlib::System::Reflection::MethodInfo GetMethod(const char *name, mscorlib::System::Reflection::BindingFlags::__ENUM__ bindingAttr); virtual mscorlib::System::Reflection::MethodInfo GetMethod(mscorlib::System::String name, std::vector<mscorlib::System::Type*> types); virtual mscorlib::System::Reflection::MethodInfo GetMethod(const char *name, std::vector<mscorlib::System::Type*> types); virtual mscorlib::System::Reflection::MethodInfo GetMethod(mscorlib::System::String name, std::vector<mscorlib::System::Type*> types, std::vector<mscorlib::System::Reflection::ParameterModifier*> modifiers); virtual mscorlib::System::Reflection::MethodInfo GetMethod(const char *name, std::vector<mscorlib::System::Type*> types, std::vector<mscorlib::System::Reflection::ParameterModifier*> modifiers); virtual mscorlib::System::Reflection::MethodInfo GetMethod(mscorlib::System::String name, mscorlib::System::Reflection::BindingFlags::__ENUM__ bindingAttr, mscorlib::System::Reflection::Binder binder, std::vector<mscorlib::System::Type*> types, std::vector<mscorlib::System::Reflection::ParameterModifier*> modifiers); virtual mscorlib::System::Reflection::MethodInfo GetMethod(const char *name, mscorlib::System::Reflection::BindingFlags::__ENUM__ bindingAttr, mscorlib::System::Reflection::Binder binder, std::vector<mscorlib::System::Type*> types, std::vector<mscorlib::System::Reflection::ParameterModifier*> modifiers); virtual mscorlib::System::Reflection::MethodInfo GetMethod(mscorlib::System::String name, mscorlib::System::Reflection::BindingFlags::__ENUM__ bindingAttr, mscorlib::System::Reflection::Binder binder, mscorlib::System::Reflection::CallingConventions::__ENUM__ callConvention, std::vector<mscorlib::System::Type*> types, std::vector<mscorlib::System::Reflection::ParameterModifier*> modifiers); virtual mscorlib::System::Reflection::MethodInfo GetMethod(const char *name, mscorlib::System::Reflection::BindingFlags::__ENUM__ bindingAttr, mscorlib::System::Reflection::Binder binder, mscorlib::System::Reflection::CallingConventions::__ENUM__ callConvention, std::vector<mscorlib::System::Type*> types, std::vector<mscorlib::System::Reflection::ParameterModifier*> modifiers); virtual std::vector<mscorlib::System::Reflection::MethodInfo*> GetMethods(); virtual std::vector<mscorlib::System::Reflection::MethodInfo*> GetMethods(mscorlib::System::Reflection::BindingFlags::__ENUM__ bindingAttr); virtual mscorlib::System::Type GetNestedType(mscorlib::System::String name); virtual mscorlib::System::Type GetNestedType(const char *name); virtual mscorlib::System::Type GetNestedType(mscorlib::System::String name, mscorlib::System::Reflection::BindingFlags::__ENUM__ bindingAttr); virtual mscorlib::System::Type GetNestedType(const char *name, mscorlib::System::Reflection::BindingFlags::__ENUM__ bindingAttr); virtual std::vector<mscorlib::System::Type*> GetNestedTypes(); virtual std::vector<mscorlib::System::Type*> GetNestedTypes(mscorlib::System::Reflection::BindingFlags::__ENUM__ bindingAttr); virtual std::vector<mscorlib::System::Reflection::PropertyInfo*> GetProperties(); virtual std::vector<mscorlib::System::Reflection::PropertyInfo*> GetProperties(mscorlib::System::Reflection::BindingFlags::__ENUM__ bindingAttr); virtual mscorlib::System::Reflection::PropertyInfo GetProperty(mscorlib::System::String name); virtual mscorlib::System::Reflection::PropertyInfo GetProperty(const char *name); virtual mscorlib::System::Reflection::PropertyInfo GetProperty(mscorlib::System::String name, mscorlib::System::Reflection::BindingFlags::__ENUM__ bindingAttr); virtual mscorlib::System::Reflection::PropertyInfo GetProperty(const char *name, mscorlib::System::Reflection::BindingFlags::__ENUM__ bindingAttr); virtual mscorlib::System::Reflection::PropertyInfo GetProperty(mscorlib::System::String name, mscorlib::System::Type returnType); virtual mscorlib::System::Reflection::PropertyInfo GetProperty(const char *name, mscorlib::System::Type returnType); virtual mscorlib::System::Reflection::PropertyInfo GetProperty(mscorlib::System::String name, std::vector<mscorlib::System::Type*> types); virtual mscorlib::System::Reflection::PropertyInfo GetProperty(const char *name, std::vector<mscorlib::System::Type*> types); virtual mscorlib::System::Reflection::PropertyInfo GetProperty(mscorlib::System::String name, mscorlib::System::Type returnType, std::vector<mscorlib::System::Type*> types); virtual mscorlib::System::Reflection::PropertyInfo GetProperty(const char *name, mscorlib::System::Type returnType, std::vector<mscorlib::System::Type*> types); virtual mscorlib::System::Reflection::PropertyInfo GetProperty(mscorlib::System::String name, mscorlib::System::Type returnType, std::vector<mscorlib::System::Type*> types, std::vector<mscorlib::System::Reflection::ParameterModifier*> modifiers); virtual mscorlib::System::Reflection::PropertyInfo GetProperty(const char *name, mscorlib::System::Type returnType, std::vector<mscorlib::System::Type*> types, std::vector<mscorlib::System::Reflection::ParameterModifier*> modifiers); virtual mscorlib::System::Reflection::PropertyInfo GetProperty(mscorlib::System::String name, mscorlib::System::Reflection::BindingFlags::__ENUM__ bindingAttr, mscorlib::System::Reflection::Binder binder, mscorlib::System::Type returnType, std::vector<mscorlib::System::Type*> types, std::vector<mscorlib::System::Reflection::ParameterModifier*> modifiers); virtual mscorlib::System::Reflection::PropertyInfo GetProperty(const char *name, mscorlib::System::Reflection::BindingFlags::__ENUM__ bindingAttr, mscorlib::System::Reflection::Binder binder, mscorlib::System::Type returnType, std::vector<mscorlib::System::Type*> types, std::vector<mscorlib::System::Reflection::ParameterModifier*> modifiers); virtual mscorlib::System::Reflection::ConstructorInfo GetConstructor(std::vector<mscorlib::System::Type*> types); virtual mscorlib::System::Reflection::ConstructorInfo GetConstructor(mscorlib::System::Reflection::BindingFlags::__ENUM__ bindingAttr, mscorlib::System::Reflection::Binder binder, std::vector<mscorlib::System::Type*> types, std::vector<mscorlib::System::Reflection::ParameterModifier*> modifiers); virtual mscorlib::System::Reflection::ConstructorInfo GetConstructor(mscorlib::System::Reflection::BindingFlags::__ENUM__ bindingAttr, mscorlib::System::Reflection::Binder binder, mscorlib::System::Reflection::CallingConventions::__ENUM__ callConvention, std::vector<mscorlib::System::Type*> types, std::vector<mscorlib::System::Reflection::ParameterModifier*> modifiers); virtual std::vector<mscorlib::System::Reflection::ConstructorInfo*> GetConstructors(); virtual std::vector<mscorlib::System::Reflection::ConstructorInfo*> GetConstructors(mscorlib::System::Reflection::BindingFlags::__ENUM__ bindingAttr); virtual std::vector<mscorlib::System::Reflection::MemberInfo*> GetDefaultMembers(); virtual std::vector<mscorlib::System::Reflection::MemberInfo*> FindMembers(mscorlib::System::Reflection::MemberTypes::__ENUM__ memberType, mscorlib::System::Reflection::BindingFlags::__ENUM__ bindingAttr, mscorlib::Callback<mscorlib::System::Boolean (mscorlib::System::Reflection::MemberInfo , mscorlib::System::Object )> filter, mscorlib::System::Object filterCriteria); virtual mscorlib::System::Object InvokeMember(mscorlib::System::String name, mscorlib::System::Reflection::BindingFlags::__ENUM__ invokeAttr, mscorlib::System::Reflection::Binder binder, mscorlib::System::Object target, std::vector<mscorlib::System::Object*> args); virtual mscorlib::System::Object InvokeMember(const char *name, mscorlib::System::Reflection::BindingFlags::__ENUM__ invokeAttr, mscorlib::System::Reflection::Binder binder, mscorlib::System::Object target, std::vector<mscorlib::System::Object*> args); virtual mscorlib::System::Object InvokeMember(mscorlib::System::String name, mscorlib::System::Reflection::BindingFlags::__ENUM__ invokeAttr, mscorlib::System::Reflection::Binder binder, mscorlib::System::Object target, std::vector<mscorlib::System::Object*> args, mscorlib::System::Globalization::CultureInfo culture); virtual mscorlib::System::Object InvokeMember(const char *name, mscorlib::System::Reflection::BindingFlags::__ENUM__ invokeAttr, mscorlib::System::Reflection::Binder binder, mscorlib::System::Object target, std::vector<mscorlib::System::Object*> args, mscorlib::System::Globalization::CultureInfo culture); virtual mscorlib::System::Object InvokeMember(mscorlib::System::String name, mscorlib::System::Reflection::BindingFlags::__ENUM__ invokeAttr, mscorlib::System::Reflection::Binder binder, mscorlib::System::Object target, std::vector<mscorlib::System::Object*> args, std::vector<mscorlib::System::Reflection::ParameterModifier*> modifiers, mscorlib::System::Globalization::CultureInfo culture, std::vector<mscorlib::System::String*> namedParameters); virtual mscorlib::System::Object InvokeMember(const char *name, mscorlib::System::Reflection::BindingFlags::__ENUM__ invokeAttr, mscorlib::System::Reflection::Binder binder, mscorlib::System::Object target, std::vector<mscorlib::System::Object*> args, std::vector<mscorlib::System::Reflection::ParameterModifier*> modifiers, mscorlib::System::Globalization::CultureInfo culture, std::vector<mscorlib::System::String*> namedParameters); virtual mscorlib::System::String ToString() override; virtual std::vector<mscorlib::System::Type*> GetGenericArguments(); virtual mscorlib::System::Type GetGenericTypeDefinition(); virtual mscorlib::System::Type MakeGenericType(std::vector<mscorlib::System::Type*> typeArguments); virtual std::vector<mscorlib::System::Type*> GetGenericParameterConstraints(); virtual mscorlib::System::Type MakeArrayType(); virtual mscorlib::System::Type MakeArrayType(mscorlib::System::Int32 rank); virtual mscorlib::System::Type MakeByRefType(); virtual mscorlib::System::Type MakePointerType(); static mscorlib::System::Type ReflectionOnlyGetType(mscorlib::System::String typeName, mscorlib::System::Boolean throwIfNotFound, mscorlib::System::Boolean ignoreCase); static mscorlib::System::Type ReflectionOnlyGetType(const char *typeName, mscorlib::System::Boolean throwIfNotFound, mscorlib::System::Boolean ignoreCase); virtual mscorlib::System::Boolean IsEquivalentTo(mscorlib::System::Type other); virtual MonoObject* GetNativeObject() override { return __native_object__; }; //Public Properties __declspec(property(get=get_Assembly)) mscorlib::System::Reflection::Assembly Assembly; __declspec(property(get=get_AssemblyQualifiedName)) mscorlib::System::String AssemblyQualifiedName; __declspec(property(get=get_Attributes)) mscorlib::System::Reflection::TypeAttributes::__ENUM__ Attributes; __declspec(property(get=get_BaseType)) mscorlib::System::Type BaseType; __declspec(property(get=get_DeclaringType)) mscorlib::System::Type DeclaringType; __declspec(property(get=get_FullName)) mscorlib::System::String FullName; __declspec(property(get=get_GUID)) mscorlib::System::Guid GUID; __declspec(property(get=get_HasElementType)) mscorlib::System::Boolean HasElementType; __declspec(property(get=get_IsAbstract)) mscorlib::System::Boolean IsAbstract; __declspec(property(get=get_IsAnsiClass)) mscorlib::System::Boolean IsAnsiClass; __declspec(property(get=get_IsArray)) mscorlib::System::Boolean IsArray; __declspec(property(get=get_IsAutoClass)) mscorlib::System::Boolean IsAutoClass; __declspec(property(get=get_IsAutoLayout)) mscorlib::System::Boolean IsAutoLayout; __declspec(property(get=get_IsByRef)) mscorlib::System::Boolean IsByRef; __declspec(property(get=get_IsClass)) mscorlib::System::Boolean IsClass; __declspec(property(get=get_IsCOMObject)) mscorlib::System::Boolean IsCOMObject; __declspec(property(get=get_IsConstructedGenericType)) mscorlib::System::Boolean IsConstructedGenericType; __declspec(property(get=get_IsContextful)) mscorlib::System::Boolean IsContextful; __declspec(property(get=get_IsEnum)) mscorlib::System::Boolean IsEnum; __declspec(property(get=get_IsExplicitLayout)) mscorlib::System::Boolean IsExplicitLayout; __declspec(property(get=get_IsImport)) mscorlib::System::Boolean IsImport; __declspec(property(get=get_IsInterface)) mscorlib::System::Boolean IsInterface; __declspec(property(get=get_IsLayoutSequential)) mscorlib::System::Boolean IsLayoutSequential; __declspec(property(get=get_IsMarshalByRef)) mscorlib::System::Boolean IsMarshalByRef; __declspec(property(get=get_IsNestedAssembly)) mscorlib::System::Boolean IsNestedAssembly; __declspec(property(get=get_IsNestedFamANDAssem)) mscorlib::System::Boolean IsNestedFamANDAssem; __declspec(property(get=get_IsNestedFamily)) mscorlib::System::Boolean IsNestedFamily; __declspec(property(get=get_IsNestedFamORAssem)) mscorlib::System::Boolean IsNestedFamORAssem; __declspec(property(get=get_IsNestedPrivate)) mscorlib::System::Boolean IsNestedPrivate; __declspec(property(get=get_IsNestedPublic)) mscorlib::System::Boolean IsNestedPublic; __declspec(property(get=get_IsNotPublic)) mscorlib::System::Boolean IsNotPublic; __declspec(property(get=get_IsPointer)) mscorlib::System::Boolean IsPointer; __declspec(property(get=get_IsPrimitive)) mscorlib::System::Boolean IsPrimitive; __declspec(property(get=get_IsPublic)) mscorlib::System::Boolean IsPublic; __declspec(property(get=get_IsSealed)) mscorlib::System::Boolean IsSealed; __declspec(property(get=get_IsSerializable)) mscorlib::System::Boolean IsSerializable; __declspec(property(get=get_IsSpecialName)) mscorlib::System::Boolean IsSpecialName; __declspec(property(get=get_IsUnicodeClass)) mscorlib::System::Boolean IsUnicodeClass; __declspec(property(get=get_IsValueType)) mscorlib::System::Boolean IsValueType; __declspec(property(get=get_MemberType)) mscorlib::System::Reflection::MemberTypes::__ENUM__ MemberType; __declspec(property(get=get_Module)) mscorlib::System::Reflection::Module Module; __declspec(property(get=get_Namespace)) mscorlib::System::String Namespace; __declspec(property(get=get_ReflectedType)) mscorlib::System::Type ReflectedType; __declspec(property(get=get_TypeHandle)) mscorlib::System::RuntimeTypeHandle TypeHandle; __declspec(property(get=get_TypeInitializer)) mscorlib::System::Reflection::ConstructorInfo TypeInitializer; __declspec(property(get=get_UnderlyingSystemType)) mscorlib::System::Type UnderlyingSystemType; __declspec(property(get=get_IsSecurityTransparent)) mscorlib::System::Boolean IsSecurityTransparent; __declspec(property(get=get_IsSecurityCritical)) mscorlib::System::Boolean IsSecurityCritical; __declspec(property(get=get_IsSecuritySafeCritical)) mscorlib::System::Boolean IsSecuritySafeCritical; __declspec(property(get=get_GenericTypeArguments)) std::vector<mscorlib::System::Type*> GenericTypeArguments; __declspec(property(get=get_ContainsGenericParameters)) mscorlib::System::Boolean ContainsGenericParameters; __declspec(property(get=get_IsGenericTypeDefinition)) mscorlib::System::Boolean IsGenericTypeDefinition; __declspec(property(get=get_IsGenericType)) mscorlib::System::Boolean IsGenericType; __declspec(property(get=get_IsGenericParameter)) mscorlib::System::Boolean IsGenericParameter; __declspec(property(get=get_IsNested)) mscorlib::System::Boolean IsNested; __declspec(property(get=get_IsVisible)) mscorlib::System::Boolean IsVisible; __declspec(property(get=get_GenericParameterPosition)) mscorlib::System::Int32 GenericParameterPosition; __declspec(property(get=get_GenericParameterAttributes)) mscorlib::System::Reflection::GenericParameterAttributes::__ENUM__ GenericParameterAttributes; __declspec(property(get=get_DeclaringMethod)) mscorlib::System::Reflection::MethodBase DeclaringMethod; __declspec(property(get=get_StructLayoutAttribute)) mscorlib::System::Runtime::InteropServices::StructLayoutAttribute StructLayoutAttribute; __declspec(property(get=get_Name)) mscorlib::System::String Name; __declspec(property(get=get_MetadataToken)) mscorlib::System::Int32 MetadataToken; __declspec(property(get=get_CustomAttributes)) mscorlib::System::Collections::Generic::IEnumerable<mscorlib::System::Reflection::CustomAttributeData> CustomAttributes; //Public Static Properties static Property<mscorlib::System::Reflection::Binder , mscorlib::System::Type> DefaultBinder; //Public Static Fields static Property<mscorlib::System::Char , mscorlib::System::Type> Delimiter; static Property<std::vector<mscorlib::System::Type*> , mscorlib::System::Type> EmptyTypes; static Property<mscorlib::Callback<mscorlib::System::Boolean (mscorlib::System::Reflection::MemberInfo , mscorlib::System::Object )> , mscorlib::System::Type> FilterAttribute; static Property<mscorlib::Callback<mscorlib::System::Boolean (mscorlib::System::Reflection::MemberInfo , mscorlib::System::Object )> , mscorlib::System::Type> FilterName; static Property<mscorlib::Callback<mscorlib::System::Boolean (mscorlib::System::Reflection::MemberInfo , mscorlib::System::Object )> , mscorlib::System::Type> FilterNameIgnoreCase; static Property<mscorlib::System::Object , mscorlib::System::Type> Missing; //Get Set Properties Methods // Get:Assembly mscorlib::System::Reflection::Assembly get_Assembly() const; // Get:AssemblyQualifiedName mscorlib::System::String get_AssemblyQualifiedName() const; // Get:Attributes mscorlib::System::Reflection::TypeAttributes::__ENUM__ get_Attributes() const; // Get:BaseType mscorlib::System::Type get_BaseType() const; // Get:DeclaringType mscorlib::System::Type get_DeclaringType() const; // Get:FullName mscorlib::System::String get_FullName() const; // Get:GUID mscorlib::System::Guid get_GUID() const; // Get:HasElementType mscorlib::System::Boolean get_HasElementType() const; // Get:IsAbstract mscorlib::System::Boolean get_IsAbstract() const; // Get:IsAnsiClass mscorlib::System::Boolean get_IsAnsiClass() const; // Get:IsArray mscorlib::System::Boolean get_IsArray() const; // Get:IsAutoClass mscorlib::System::Boolean get_IsAutoClass() const; // Get:IsAutoLayout mscorlib::System::Boolean get_IsAutoLayout() const; // Get:IsByRef mscorlib::System::Boolean get_IsByRef() const; // Get:IsClass mscorlib::System::Boolean get_IsClass() const; // Get:IsCOMObject mscorlib::System::Boolean get_IsCOMObject() const; // Get:IsConstructedGenericType mscorlib::System::Boolean get_IsConstructedGenericType() const; // Get:IsContextful mscorlib::System::Boolean get_IsContextful() const; // Get:IsEnum mscorlib::System::Boolean get_IsEnum() const; // Get:IsExplicitLayout mscorlib::System::Boolean get_IsExplicitLayout() const; // Get:IsImport mscorlib::System::Boolean get_IsImport() const; // Get:IsInterface mscorlib::System::Boolean get_IsInterface() const; // Get:IsLayoutSequential mscorlib::System::Boolean get_IsLayoutSequential() const; // Get:IsMarshalByRef mscorlib::System::Boolean get_IsMarshalByRef() const; // Get:IsNestedAssembly mscorlib::System::Boolean get_IsNestedAssembly() const; // Get:IsNestedFamANDAssem mscorlib::System::Boolean get_IsNestedFamANDAssem() const; // Get:IsNestedFamily mscorlib::System::Boolean get_IsNestedFamily() const; // Get:IsNestedFamORAssem mscorlib::System::Boolean get_IsNestedFamORAssem() const; // Get:IsNestedPrivate mscorlib::System::Boolean get_IsNestedPrivate() const; // Get:IsNestedPublic mscorlib::System::Boolean get_IsNestedPublic() const; // Get:IsNotPublic mscorlib::System::Boolean get_IsNotPublic() const; // Get:IsPointer mscorlib::System::Boolean get_IsPointer() const; // Get:IsPrimitive mscorlib::System::Boolean get_IsPrimitive() const; // Get:IsPublic mscorlib::System::Boolean get_IsPublic() const; // Get:IsSealed mscorlib::System::Boolean get_IsSealed() const; // Get:IsSerializable mscorlib::System::Boolean get_IsSerializable() const; // Get:IsSpecialName mscorlib::System::Boolean get_IsSpecialName() const; // Get:IsUnicodeClass mscorlib::System::Boolean get_IsUnicodeClass() const; // Get:IsValueType mscorlib::System::Boolean get_IsValueType() const; // Get:MemberType mscorlib::System::Reflection::MemberTypes::__ENUM__ get_MemberType() const; // Get:Module mscorlib::System::Reflection::Module get_Module() const; // Get:Namespace mscorlib::System::String get_Namespace() const; // Get:ReflectedType mscorlib::System::Type get_ReflectedType() const; // Get:TypeHandle mscorlib::System::RuntimeTypeHandle get_TypeHandle() const; // Get:TypeInitializer mscorlib::System::Reflection::ConstructorInfo get_TypeInitializer() const; // Get:UnderlyingSystemType mscorlib::System::Type get_UnderlyingSystemType() const; // Get:IsSecurityTransparent mscorlib::System::Boolean get_IsSecurityTransparent() const; // Get:IsSecurityCritical mscorlib::System::Boolean get_IsSecurityCritical() const; // Get:IsSecuritySafeCritical mscorlib::System::Boolean get_IsSecuritySafeCritical() const; // Get:GenericTypeArguments std::vector<mscorlib::System::Type*> get_GenericTypeArguments() const; // Get:ContainsGenericParameters mscorlib::System::Boolean get_ContainsGenericParameters() const; // Get:IsGenericTypeDefinition mscorlib::System::Boolean get_IsGenericTypeDefinition() const; // Get:IsGenericType mscorlib::System::Boolean get_IsGenericType() const; // Get:IsGenericParameter mscorlib::System::Boolean get_IsGenericParameter() const; // Get:IsNested mscorlib::System::Boolean get_IsNested() const; // Get:IsVisible mscorlib::System::Boolean get_IsVisible() const; // Get:GenericParameterPosition mscorlib::System::Int32 get_GenericParameterPosition() const; // Get:GenericParameterAttributes mscorlib::System::Reflection::GenericParameterAttributes::__ENUM__ get_GenericParameterAttributes() const; // Get:DeclaringMethod mscorlib::System::Reflection::MethodBase get_DeclaringMethod() const; // Get:StructLayoutAttribute mscorlib::System::Runtime::InteropServices::StructLayoutAttribute get_StructLayoutAttribute() const; // Get:Name mscorlib::System::String get_Name() const; // Get:MetadataToken mscorlib::System::Int32 get_MetadataToken() const; // Get:CustomAttributes mscorlib::System::Collections::Generic::IEnumerable<mscorlib::System::Reflection::CustomAttributeData> get_CustomAttributes() const; //Get Set Static Properties Methods // Get:DefaultBinder static mscorlib::System::Reflection::Binder get_DefaultBinder(); static void set_DefaultBinder(mscorlib::System::Reflection::Binder value); // Get/Set:Delimiter static mscorlib::System::Char get_Delimiter(); static void set_Delimiter(mscorlib::System::Char value); // Get/Set:EmptyTypes static std::vector<mscorlib::System::Type*> get_EmptyTypes(); static void set_EmptyTypes(std::vector<mscorlib::System::Type*> value); // Get/Set:FilterAttribute static mscorlib::Callback<mscorlib::System::Boolean (mscorlib::System::Reflection::MemberInfo , mscorlib::System::Object )> get_FilterAttribute(); static void set_FilterAttribute(mscorlib::Callback<mscorlib::System::Boolean (mscorlib::System::Reflection::MemberInfo , mscorlib::System::Object )> value); // Get/Set:FilterName static mscorlib::Callback<mscorlib::System::Boolean (mscorlib::System::Reflection::MemberInfo , mscorlib::System::Object )> get_FilterName(); static void set_FilterName(mscorlib::Callback<mscorlib::System::Boolean (mscorlib::System::Reflection::MemberInfo , mscorlib::System::Object )> value); // Get/Set:FilterNameIgnoreCase static mscorlib::Callback<mscorlib::System::Boolean (mscorlib::System::Reflection::MemberInfo , mscorlib::System::Object )> get_FilterNameIgnoreCase(); static void set_FilterNameIgnoreCase(mscorlib::Callback<mscorlib::System::Boolean (mscorlib::System::Reflection::MemberInfo , mscorlib::System::Object )> value); // Get/Set:Missing static mscorlib::System::Object get_Missing(); static void set_Missing(mscorlib::System::Object value); protected: private: }; } } #endif
bsd-2-clause
nashidau/Evas-Next
src/modules/engines/gl_common/evas_gl_rectangle.c
1940
#include "evas_gl_private.h" void evas_gl_common_rect_draw(Evas_GL_Context *gc, int x, int y, int w, int h) { Cutout_Rects *rects; Cutout_Rect *r; int c, cx, cy, cw, ch, cr, cg, cb, ca, i; if ((w <= 0) || (h <= 0)) return; if (!(RECTS_INTERSECT(x, y, w, h, 0, 0, gc->w, gc->h))) return; /* save out clip info */ c = gc->dc->clip.use; cx = gc->dc->clip.x; cy = gc->dc->clip.y; cw = gc->dc->clip.w; ch = gc->dc->clip.h; ca = (gc->dc->col.col >> 24) & 0xff; if ((gc->dc->render_op != EVAS_RENDER_COPY) && (ca <= 0)) return; cr = (gc->dc->col.col >> 16) & 0xff; cg = (gc->dc->col.col >> 8 ) & 0xff; cb = (gc->dc->col.col ) & 0xff; evas_common_draw_context_clip_clip(gc->dc, 0, 0, gc->w, gc->h); /* no cutouts - cut right to the chase */ if ((gc->dc) && (gc->dc->clip.use)) { RECTS_CLIP_TO_RECT(x, y, w, h, gc->dc->clip.x, gc->dc->clip.y, gc->dc->clip.w, gc->dc->clip.h); } if (!gc->dc->cutout.rects) { evas_gl_common_context_rectangle_push(gc, x, y, w, h, cr, cg, cb, ca); } else { evas_common_draw_context_clip_clip(gc->dc, x, y, w, h); /* our clip is 0 size.. abort */ if ((gc->dc->clip.w > 0) && (gc->dc->clip.h > 0)) { rects = evas_common_draw_context_apply_cutouts(gc->dc); for (i = 0; i < rects->active; ++i) { r = rects->rects + i; if ((r->w > 0) && (r->h > 0)) { evas_gl_common_context_rectangle_push(gc, r->x, r->y, r->w, r->h, cr, cg, cb, ca); } } evas_common_draw_context_apply_clear_cutouts(rects); } } /* restore clip info */ gc->dc->clip.use = c; gc->dc->clip.x = cx; gc->dc->clip.y = cy; gc->dc->clip.w = cw; gc->dc->clip.h = ch; }
bsd-2-clause
rwhogg/homebrew-core
Formula/libxml++3.rb
2170
class Libxmlxx3 < Formula desc "C++ wrapper for libxml" homepage "https://libxmlplusplus.sourceforge.io/" url "https://download.gnome.org/sources/libxml++/3.2/libxml++-3.2.0.tar.xz" sha256 "b786fae7fd7820d356698069a787d107995c3efcbef50d8f4efd3766ab768e4f" license "LGPL-2.1" bottle do cellar :any sha256 "583c5345ed243a5cea2bbf82e71a130e85554110ebe3927183171c66225a7c26" => :catalina sha256 "054180f67aa9d297a26c40fc9e6dcc27bf68e78f09db895b3821c68751eabae2" => :mojave sha256 "2da0d0f6e732f910e75e5b20c19a01056854d00feab6e1c2490b7722bbc1af29" => :high_sierra sha256 "96fb527eebcdfdb6dbc000c006d9b8fda423468ed199c1caff5f2abb88b0d9b3" => :x86_64_linux end depends_on "pkg-config" => :build depends_on "glibmm" uses_from_macos "libxml2" def install ENV.cxx11 system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}" system "make", "install" end test do (testpath/"test.cpp").write <<~EOS #include <libxml++/libxml++.h> int main(int argc, char *argv[]) { xmlpp::Document document; document.set_internal_subset("homebrew", "", "https://www.brew.sh/xml/test.dtd"); xmlpp::Element *rootnode = document.create_root_node("homebrew"); return 0; } EOS ENV.libxml2 gettext = Formula["gettext"] glib = Formula["glib"] glibmm = Formula["glibmm"] libsigcxx = Formula["libsigc++@2"] flags = %W[ -I#{gettext.opt_include} -I#{glib.opt_include}/glib-2.0 -I#{glib.opt_lib}/glib-2.0/include -I#{glibmm.opt_include}/glibmm-2.4 -I#{glibmm.opt_lib}/glibmm-2.4/include -I#{include}/libxml++-3.0 -I#{libsigcxx.opt_include}/sigc++-2.0 -I#{libsigcxx.opt_lib}/sigc++-2.0/include -I#{lib}/libxml++-3.0/include -L#{gettext.opt_lib} -L#{glib.opt_lib} -L#{glibmm.opt_lib} -L#{libsigcxx.opt_lib} -L#{lib} -lglib-2.0 -lglibmm-2.4 -lgobject-2.0 -lsigc-2.0 -lxml++-3.0 -lxml2 ] flags << "-lintl" if OS.mac? system ENV.cxx, "-std=c++11", "test.cpp", "-o", "test", *flags system "./test" end end
bsd-2-clause
rubyworks/vclog
work/deprecated/history.rb
3524
module VCLog require 'vclog/core_ext' require 'vclog/changelog' require 'vclog/tag' require 'vclog/release' require 'erb' # A Release History is very similar to a ChangeLog. # It differs in that it is divided into releases with # version, release date and release note. # # The release version, date and release note can be # descerened from the underlying SCM by identifying # the hard tag commits. # # TODO: Extract output formating from delta parser. Later---Huh? # class History # Location of this file in the file system. DIR = File.dirname(__FILE__) # attr :repo ## Alternate title. #attr_accessor :title ## Current working version. #attr_accessor :version ## Exclude commit details. #attr_accessor :summary # def initialize(repo) @repo = repo #opts = OpenStruct.new(opts) if Hash === opts #@title = opts.title || "RELEASE HISTORY" #@extra = opts.extra #@version = opts.version #@level = opts.level || 0 end # Tag list from version control system. def tags @tags ||= repo.tags end # Changelog object #def changelog # @changlog ||= repo.changelog #ChangeLog.new(changes) #end # Change list from version control system filter for level setting. def changes @changes ||= ( if @repo.point repo.change_points else repo.changes end ) end # def releases @releases ||= ( rel = [] tags = self.tags #ver = repo.bump(version) user = repo.user time = ::Time.now + (3600 * 24) # one day ahead tags << Tag.new(:name=>'HEAD', :id=>'HEAD', :date=>time, :who=>user, :msg=>"Current Development") # TODO: Do we need to add a Time.now tag? # add current verion to release list (if given) #previous_version = tags[0].name #if current_version < previous_version # TODO: need to use natural comparision # raise ArgumentError, "Release version is less than previous version (#{previous_version})." #end #rels << [current_version, current_release || Time.now] #rels = rels.uniq # only uniq releases # sort by release date tags = tags.sort{ |a,b| a.date <=> b.date } # organize into deltas delta = [] last = nil tags.each do |tag| delta << [tag, [last, tag.commit_date]] last = tag.commit_date end # gather changes for each delta delta.each do |tag, (started, ended)| if started set = changes.select{ |c| c.date >= started && c.date < ended } #gt_vers, gt_date = gt.name, gt.date #lt_vers, lt_date = lt.name, lt.date #gt_date = Time.parse(gt_date) unless Time===gt_date #lt_date = Time.parse(lt_date) unless Time===lt_date #log = changelog.after(gt).before(lt) else #lt_vers, lt_date = lt.name, lt.date #lt_date = Time.parse(lt_date) unless Time===lt_date #log = changelog.before(lt_date) set = changes.select{ |c| c.date < ended } end rel << Release.new(tag, set) end rel ) end # Group +changes+ by tag type. def groups(changes) @groups ||= changes.group_by{ |e| e.label } #type end # def to_h releases.map{ |rel| rel.to_h } end end end
bsd-2-clause
unixpickle/muniverse
games/injections/BirdyRush-v0.js
1488
(function() { var LOAD_TIMEOUT = 60000; var PLAY_BUTTON = [0, 173, 0]; var PAUSE_BUTTON = [0, 172, 1]; // Code taken from BurninRubber-v0.js. function childAtPath(path) { var child = ((window.game || {}).stage) || {}; path.forEach((x) => child = ((child || {}).children || [])[x]); return child || null; } function clickButton(button) { if (!button || !button.events || !button.events.onInputDown) { throw 'cannot click null button'; } button.events.onInputDown.dispatch(); } var gameOver = false; window.muniverse = { init: function() { return pollAndWait(LOAD_TIMEOUT, function() { return window.game && window.game.isBooted && window.game.isRunning && window.game.state && window.game.state.getCurrentState().key === 'GameState' && childAtPath(PLAY_BUTTON) && window.game.tweens.getAll().length === 0; }).then(function() { window.faketime.pause(); GameState.prototype.onGameOver = () => gameOver = true; clickButton(childAtPath(PLAY_BUTTON)); childAtPath(PAUSE_BUTTON).events.onInputDown.removeAll(); window.faketime.advance(100); }); }, step: function(millis) { window.faketime.advance(millis); return Promise.resolve(gameOver); }, score: function() { // The score is -5 before the game starts. return Promise.resolve(Math.max(score, 0)); } }; })();
bsd-2-clause
liljencrantz/anna
include/anna/lib/lang/buffer.h
672
#ifndef ANNA_BUFFER_H #define ANNA_BUFFER_H struct anna_stack_template; anna_object_t *anna_buffer_create(void); void anna_buffer_set(struct anna_object *this, ssize_t offset, unsigned char value); unsigned char anna_buffer_get(anna_object_t *this, ssize_t offset); size_t anna_buffer_get_count(anna_object_t *this); void anna_buffer_set_count(anna_object_t *this, size_t sz); size_t anna_buffer_get_capacity(anna_object_t *this); void anna_buffer_set_capacity(anna_object_t *this, size_t sz); int anna_buffer_ensure_capacity(anna_object_t *this, size_t sz); unsigned char *anna_buffer_get_payload(anna_object_t *this); void anna_buffer_type_create(void); #endif
bsd-2-clause
oblivion14/SO
so-servicemodel/src/test/java/com/pineone/icbms/so/servicemodel/ServiceModelExecuteTest.java
1696
//package com.pineone.icbms.so.servicemodel; // //import com.pineone.icbms.so.domain.entity.Domain; //import com.pineone.icbms.so.service.ref.DeviceObject; //import com.pineone.icbms.so.service.ref.Status; //import com.pineone.icbms.so.service.ref.VirtualObject; //import com.pineone.icbms.so.servicemodel.logic.ServiceModelLogic; //import com.pineone.icbms.so.servicemodel.logic.ServiceModelLogicImpl; //import com.pineone.icbms.so.servicemodel.pr.ServiceModelPresentation; //import org.junit.Test; //import org.junit.runner.RunWith; //import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.test.context.ContextConfiguration; //import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; //import org.springframework.test.context.web.WebAppConfiguration; // ///** // * Created by melvin on 2016. 8. 16.. // NOTE: 실제 서비스 구동 과정 테스트 // */ // //@RunWith(SpringJUnit4ClassRunner.class) //@WebAppConfiguration //@ContextConfiguration(classes = ServiceModelApplication.class) //public class ServiceModelExecuteTest { // // @Autowired // ServiceModelPresentation serviceModelPresentation; // // @Test // public void executeTest() throws Exception { // //// ServiceModelLogic serviceModelLogic = ServiceModelLogicImpl.newServiceModelLogic(); // // Domain domain = new Domain("DO-1", "강의실" , "http://xxx.xxx.xx"); // DeviceObject deviceObject = VirtualObject.SonamooHeater; // Status status = Status.Active; // //// ServiceMessage serviceMessage = new ServiceMessage(domain, deviceObject, status); //// serviceModelLogic.executeServiceModel(serviceMessage); // } //}
bsd-2-clause
edgehosting/jira-dvcs-connector
jira-dvcs-connector-plugin/src/main/java/com/atlassian/jira/plugins/dvcs/listener/DvcsAddUserListener.java
10226
package com.atlassian.jira.plugins.dvcs.listener; import com.atlassian.crowd.embedded.api.CrowdService; import com.atlassian.crowd.embedded.api.UserWithAttributes; import com.atlassian.crowd.event.user.UserAttributeStoredEvent; import com.atlassian.crowd.exception.OperationNotPermittedException; import com.atlassian.crowd.exception.runtime.OperationFailedException; import com.atlassian.crowd.exception.runtime.UserNotFoundException; import com.atlassian.event.api.EventListener; import com.atlassian.event.api.EventPublisher; import com.atlassian.jira.event.web.action.admin.UserAddedEvent; import com.atlassian.jira.plugins.dvcs.analytics.DvcsAddUserAnalyticsEvent; import com.atlassian.jira.plugins.dvcs.service.OrganizationService; import com.atlassian.jira.plugins.dvcs.service.remote.DvcsCommunicatorProvider; import com.atlassian.jira.security.groups.GroupManager; import com.atlassian.jira.user.ApplicationUser; import com.atlassian.jira.user.ApplicationUsers; import com.atlassian.jira.user.util.UserManager; import com.google.common.base.Joiner; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.math.NumberUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.Collections; import java.util.Iterator; import java.util.Set; /** * Listens to user events (just for <code>CREATED</code> type). * * Handler methods run asynchronously and are safe to fail. That means that it * does not corrupt process of adding the user because of some unexpected error * at this place. * * @see #onUserAddViaInterface(UserAddedEvent) * @see #onUserAttributeStore(UserAttributeStoredEvent) */ public class DvcsAddUserListener { /** The Constant log. */ private static final Logger log = LoggerFactory.getLogger(DvcsAddUserListener.class); private static final String UI_USER_INVITATIONS_PARAM_NAME = "com.atlassian.jira.dvcs.invite.groups"; /** BBC-957: Attribute key to recognise Service Desk Customers during user creation */ private static final String SERVICE_DESK_CUSTOMERS_ATTRIBUTE_KEY = "synch.servicedesk.requestor"; /** The event publisher. */ private final EventPublisher eventPublisher; /** The organization service. */ private final OrganizationService organizationService; /** The communicator provider. */ private final DvcsCommunicatorProvider communicatorProvider; private final UserManager userManager; private final GroupManager groupManager; private final CrowdService crowd; /** * The Constructor. * * @param eventPublisher * the event publisher * @param organizationService * the organization service * @param communicatorProvider * the communicator provider */ public DvcsAddUserListener(EventPublisher eventPublisher, OrganizationService organizationService, DvcsCommunicatorProvider communicatorProvider, UserManager userManager, GroupManager groupManager, CrowdService crowd) { this.eventPublisher = eventPublisher; this.organizationService = organizationService; this.communicatorProvider = communicatorProvider; this.userManager = userManager; this.groupManager = groupManager; this.crowd = crowd; } //--------------------------------------------------------------------------------------- // Handler methods //--------------------------------------------------------------------------------------- @EventListener public void onUserAddViaInterface(final UserAddedEvent event) { if (event == null) { return; } try { log.debug("Running onUserAddViaInterface ..."); String username = event.getRequestParameters().get("username")[0]; String[] organizationIdsAndGroupSlugs = event.getRequestParameters().get( UserAddedViaInterfaceEventProcessor.ORGANIZATION_SELECTOR_REQUEST_PARAM); ApplicationUser user = userManager.getUserByName(username); String userInvitations; if (organizationIdsAndGroupSlugs != null) { userInvitations = Joiner.on( UserAddedViaInterfaceEventProcessor.ORGANIZATION_SELECTOR_REQUEST_PARAM_JOINER).join( organizationIdsAndGroupSlugs); eventPublisher.publish(new DvcsAddUserAnalyticsEvent()); } else { // setting blank String to be sure that the crowd will not return null // https://sdog.jira.com/browse/BBC-432 userInvitations = " "; } crowd.setUserAttribute( ApplicationUsers.toDirectoryUser(user), UI_USER_INVITATIONS_PARAM_NAME, Collections.singleton(userInvitations) ); } catch (UserNotFoundException e) { log.warn("UserNotFoundException : " + e.getMessage()); } catch (OperationFailedException e) { log.warn("OperationFailedException : " + e.getMessage()); } catch (OperationNotPermittedException e) { log.warn("OperationNotPermittedException : " + e.getMessage()); } catch (Exception e) { log.warn("Unexpected exception " + e.getClass() + " : " + e.getMessage()); } } /** * This way we are handling the google user from studio which has not been activated yet. * They will get Bitbucket invitation after the first successful login. * * @param event the event */ @SuppressWarnings("rawtypes") @EventListener public void onUserAttributeStore(final UserAttributeStoredEvent event) { if (event.getUser() == null) { return; } safeExecute(new Runnable() { @Override public void run() { Set attributeNames = event.getAttributeNames(); String loginCountAttName = "login.count"; if (attributeNames != null && attributeNames.contains(loginCountAttName) && attributeNames.size() == 1) { Set<String> count = event.getAttributeValues(loginCountAttName); log.debug("Got {} as the 'login.count' values.", count); Iterator<String> countValueIterator = count.iterator(); if (!countValueIterator.hasNext()) { return; } int loginCount = NumberUtils.toInt(countValueIterator.next()); // do the invitation for the first time login if (loginCount == 1) { firstTimeLogin(event); } } } }, "Failed to properly handle event " + event + " for user " + event.getUser().getName()); } private void firstTimeLogin(final UserAttributeStoredEvent event) { String user = event.getUser().getName(); UserWithAttributes attributes = crowd.getUserWithAttributes(user); String uiChoice = attributes.getValue(UI_USER_INVITATIONS_PARAM_NAME); log.debug("UI choice for user " + event.getUser().getName() + " : " + uiChoice); // BBC-957: ignore Service Desk Customers when processing the event. boolean isServiceDeskRequestor = Boolean.toString(true).equals(attributes.getValue(SERVICE_DESK_CUSTOMERS_ATTRIBUTE_KEY)); if(!isServiceDeskRequestor) { if (uiChoice == null) { // created by NON UI mechanism, e.g. google user new UserAddedExternallyEventProcessor(user, organizationService, communicatorProvider, userManager, groupManager).run(); } else /* something has been chosen from UI */if (StringUtils.isNotBlank(uiChoice)) { new UserAddedViaInterfaceEventProcessor(uiChoice, ApplicationUsers.from(event.getUser()), organizationService, communicatorProvider, userManager, groupManager).run(); } } } //--------------------------------------------------------------------------------------- // Handler methods end //--------------------------------------------------------------------------------------- /** * Wraps executorService.submit(task) method invocation with * <code>try-catch</code> block to ensure that no exception is propagated * up. * * @param task * the task * @param onFailMessage * the on fail message */ private void safeExecute(Runnable task, String onFailMessage) { try { if (task != null) { task.run(); } } catch (Throwable t) { log.warn(onFailMessage, t); } } private void unregisterSelf() { try { eventPublisher.unregister(this); log.info("Listener unregistered ..."); } catch (Exception e) { log.warn("Failed to unregister " + this + ", cause message is " + e.getMessage(), e); } } public void unregister() throws Exception { log.info("Attempting to unregister listener ... "); unregisterSelf(); } public void register() throws Exception { log.info("Attempting to register listener ... "); eventPublisher.register(this); } }
bsd-2-clause
KronosDesign/runelite
runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordAreaType.java
1506
/* * Copyright (c) 2018, PandahRS <https://github.com/PandahRS> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package net.runelite.client.plugins.discord; enum DiscordAreaType { BOSSES, CITIES, DUNGEONS, MINIGAMES; }
bsd-2-clause
sebastienros/jint
Jint.Tests.Test262/test/language/expressions/async-function/named-dflt-params-arg-val-undefined.js
1404
// This file was procedurally generated from the following sources: // - src/function-forms/dflt-params-arg-val-undefined.case // - src/function-forms/default/async-func-expr-named.template /*--- description: Use of initializer when argument value is `undefined` (async function named expression) esid: sec-async-function-definitions features: [default-parameters] flags: [generated, async] info: | 14.6 Async Function Definitions AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } 14.1.19 Runtime Semantics: IteratorBindingInitialization FormalsList : FormalsList , FormalParameter [...] 23. Let iteratorRecord be Record {[[Iterator]]: CreateListIterator(argumentsList), [[Done]]: false}. 24. If hasDuplicates is true, then [...] 25. Else, a. Perform ? IteratorBindingInitialization for formals with iteratorRecord and env as arguments. [...] ---*/ var callCount = 0; // Stores a reference `ref` for case evaluation var ref; ref = async function ref(fromLiteral = 23, fromExpr = 45, fromHole = 99) { assert.sameValue(fromLiteral, 23); assert.sameValue(fromExpr, 45); assert.sameValue(fromHole, 99); callCount = callCount + 1; }; ref(undefined, void 0).then(() => { assert.sameValue(callCount, 1, 'function invoked exactly once'); }).then($DONE, $DONE);
bsd-2-clause
dgg/NMoneys.Web
src/Web/Content/Site.css
3516
@import url('//fonts.googleapis.com/css?family=Noto+Sans&subset=latin,latin-ext'); header, footer, nav, section { display: block; } /* Styles for basic forms -----------------------------------------------------------*/ textarea { min-height: 75px; } /* Flat UI overrides -----------------------------------------------------------*/ /* fonts live in a different folder */ @font-face { font-family: 'Flat-UI-Icons'; src: url('fonts/Flat-UI-Icons.eot'); src: url('fonts/Flat-UI-Icons.eot?#iefix') format('embedded-opentype'), url('fonts/Flat-UI-Icons.woff') format('woff'), url('fonts/Flat-UI-Icons.ttf') format('truetype'), url('fonts/Flat-UI-Icons.svg#Flat-UI-Icons') format('svg'); } /* first nav item should not be rounded as we have a brand element*/ .navbar .nav > li:first-child > a { border-radius: 0; } /* give space at the bottom of call-out */ .login-form { margin-bottom: 30px; margin-top: 30px; min-height: 50px; text-align: center; } .tile { margin-bottom: 10px; } .form-search { font-size: 24px; } .form-horizontal .control-label { padding-top: 10px; } legend { color: inherit; font-size: 18px; } body { font-family: 'Noto Sans', "Helvetica Neue", Helvetica, sans-serif; line-height: initial; } nav { line-height: 1.231; } textarea, input[type="text"], input[type="password"], input[type="datetime"], input[type="datetime-local"], input[type="date"], input[type="month"], input[type="time"], input[type="week"], input[type="number"], input[type="email"], input[type="url"], input[type="search"], input[type="tel"], input[type="color"], .uneditable-input { font-family: 'Noto Sans',"Helvetica Neue",Helvetica,sans-serif } .navbar-new { font-family: 'Noto Sans',"Helvetica Neue",Helvetica,sans-serif } .tagsinput input { font-family: 'Noto Sans',"Helvetica Neue",Helvetica,sans-serif } .navbar-inverse .nav > li.active > a, .navbar-inverse .nav > li.active > a:hover { background-color: #95a5a6; border-bottom-color: #7f8c8d; } .navbar .nav > li > a:hover, .navbar .nav > li > a:focus { color: #95a5a6; } .navbar .brand:hover { color: #95a5a6; } a { color: #34495e; } a:hover, a:focus { color: #95a5a6; } body { background-color: #fafafa } /* Custom styles -----------------------------------------------------------*/ nav { margin-top: 10px; margin-left: 6px; margin-right: 6px; } iframe{ border-width: 0;} .tabulated { display: table; } .cell { display: table-cell; vertical-align: middle; } .snapshot { text-align: left; height: 115px; } .snapshot.obsolete a:not(:hover) { color: #7f8c8d; } .snapshot .alphabetic-code { margin-right: 5px; } .snapshot .symbol { padding-left: 12px; text-align: left; } .snapshot .numeric-code { padding-left: 12px; text-align: left; } .snapshot .english-name { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; padding: 0; } .snapshot .native-name { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; padding: 0; } .highlight { background-color: #f1c40f; } .nav-tabs em { font-size: smaller;} .confirmation-errors { padding-bottom: 0;} .api-steps ul { list-style: none; } .show-info { cursor: help } .quantities td:nth-child(even), th:nth-child(even) { color: #e74c3c; } .quantities td:nth-child(odd), th:nth-child(odd) { color:#1abc9c; } .quantities th { text-align: center; background: #ecf0f1} .modal-header > .obsolete { color: #7f8c8d; font-weight: bolder; }
bsd-2-clause
endplay/omniplay
test/parseklib.c
46204
#include "parseklib.h" #include <sys/socket.h> #include <sys/time.h> #include <sys/times.h> #include <sys/types.h> #include <sys/sysinfo.h> #include <sys/timex.h> #include <sys/quota.h> #define __USE_LARGEFILE64 #include <sys/stat.h> #include <signal.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include <errno.h> #include <ustat.h> #include <time.h> #include <mqueue.h> #include <linux/net.h> #include <linux/utsname.h> #include <linux/ipc.h> #include <sched.h> #include <sys/epoll.h> #include <sys/statfs.h> #include <linux/capability.h> #include <asm/ldt.h> #define __USE_LARGEFILE64 #include <fcntl.h> #include <sys/resource.h> #include <assert.h> #define REPLAY_MAX_THREADS 16 #define USE_ARGSALLOC #define USE_DISK_CKPT //#define DEBUG_PRINT #ifdef DEBUG_PRINT #define debugf(...) printf(__VA_ARGS__) #else #define debugf(...) #endif static __attribute__((const)) char *syscall_name(int nr); static void default_printfcn(FILE *out, struct klog_result *res) { char idx[10]; char spacing[10]; int len; int i; sprintf(idx, "%lld", res->index); len = strlen(idx); for (i = 0; i < 5-len; i++) { spacing[i] = ' '; } spacing[i] = '\0'; fprintf(out, "%s:%ssyscall %-12s (%3d) flags %2x retval %11ld (%08lx) begin %lu end %lu\n", idx, spacing, syscall_name(res->psr.sysnum), res->psr.sysnum, res->psr.flags, res->retval, res->retval, res->start_clock, res->stop_clock); /* if (res->retparams_size > 0) { fprintf(out, " %d bytes of return parameters included\n", res->retparams_size); } */ } static void default_signal_printfcn(FILE *out, struct klog_result *res) { struct repsignal *sig; sig = &res->signal->sig; while (sig) { fprintf(out, " !!-- Has signal %d --!!\n", sig->signr); sig = sig->next; } } static void free_active_psrs(struct klogfile *log) { int i; for (i = 0; i < log->active_num_psrs; i++) { struct klog_result *apsr = &log->active_psrs[i]; struct klog_signal *sig = apsr->signal; if (apsr->retparams) { free(apsr->retparams); } while (sig) { struct klog_signal *n; n = sig->next; free(sig); sig = n; } } free(log->active_psrs); log->active_psrs = NULL; } static u_long getretparamsize(struct klogfile *log, struct klog_result *res) { u_long ret = 0; struct syscall_result *psr = &res->psr; if (res->psr.flags & SR_HAS_RETPARAMS) { assert(log->parse_rules[psr->sysnum]); if (log->parse_rules[psr->sysnum]->get_retparamsize) { ret = log->parse_rules[psr->sysnum]->get_retparamsize(log, res); } else { ret = log->parse_rules[psr->sysnum]->retparamsize; } assert(ret >= 0); } return ret; } static int read_psr_chunk(struct klogfile *log) { int ret = -1; int count; u_long data_size; int i; long rc, bytes_read; struct syscall_result *psrs; /* Read header */ debugf("Reading count\n"); /* Now get how many records there are here */ rc = read(log->fd, &count, sizeof(count)); if (rc == 0) { // should have reached the end of the log(s) here /* We're at the end, return success, we just didn't read anything */ return 0; } if (rc != sizeof(count)) { fprintf(stderr, "read returns %ld, expected %d, errno = %d\n", rc, sizeof(count), errno); goto out; } /* Read the records... eventually */ psrs = malloc(sizeof(struct syscall_result) * count); if (!psrs) { fprintf(stderr, "Cound not malloc %d bytes\n", sizeof(struct syscall_result)*count); goto out; } if (log->active_psrs) { free_active_psrs(log); } log->active_psrs = malloc(sizeof(struct klog_result) * count); if (!log->active_psrs) { fprintf(stderr, "Could not malloc %d bytes\n", sizeof(struct klog_result) * count); goto out_free; } rc = read(log->fd, psrs, sizeof(struct syscall_result) * count); if (rc != sizeof(struct syscall_result) * count) { fprintf(stderr, "Could not read psrs from log\n"); goto out_free; } rc = read(log->fd, &data_size, sizeof(data_size)); if (rc != sizeof(data_size)) { fprintf(stderr, "Could not read data_size from log\n"); goto out_free; } debugf("Read %d active psrs\n", count); for (i = 0; i < count; i++) { /* printf("Copying: sysnum %3d flags %x\n", psrs[i].sysnum, psrs[i].flags); */ memcpy(&log->active_psrs[i].psr, &psrs[i], sizeof(struct syscall_result)); } log->active_start_idx += log->active_num_psrs; log->active_num_psrs = count; /* Now handle each psr */ for (i = 0; i < count; i++) { struct klog_result *apsr = &log->active_psrs[i]; apsr->retparams = NULL; } for (i = 0; i < count; i++) { struct klog_result *apsr = &log->active_psrs[i]; apsr->log = log; apsr->index = log->active_start_idx + i; if (log->printfcns[apsr->psr.sysnum]) { apsr->printfcn = log->printfcns[apsr->psr.sysnum]; } else { apsr->printfcn = log->default_printfcn; } debugf("Parsing psr %d with flags 0x%x\n", i, apsr->psr.flags); apsr->start_clock = log->expected_clock; if ((apsr->psr.flags & SR_HAS_START_CLOCK_SKIP) != 0) { u_long clock; rc = read (log->fd, &clock, sizeof(u_long)); if (rc != sizeof(u_long)) { fprintf(stderr, "cannot read start clock value\n"); return rc; } apsr->start_clock += clock; } log->expected_clock = apsr->start_clock + 1; if ((apsr->psr.flags & SR_HAS_NONZERO_RETVAL) == 0) { apsr->retval = 0; } else { debugf("Reading retval\n"); rc = read(log->fd, &apsr->retval, sizeof(long)); if (rc != sizeof(long)) { fprintf(stderr, "cannot read return value\n"); return -1; } } apsr->stop_clock = log->expected_clock; if ((apsr->psr.flags & SR_HAS_STOP_CLOCK_SKIP) != 0) { u_long clock; rc = read (log->fd, &clock, sizeof(u_long)); if (rc != sizeof(u_long)) { fprintf(stderr, "cannot read start clock value\n"); return rc; } apsr->stop_clock += clock; } log->expected_clock = apsr->stop_clock + 1; apsr->retparams_size = getretparamsize(log, apsr); assert(apsr->retparams_size >= 0); debugf("Got retparams_size %d\n", apsr->retparams_size); if (apsr->retparams_size > 0) { long rc; apsr->retparams = malloc(apsr->retparams_size); /* FIXME: should fail nicely... */ assert(apsr->retparams); rc = lseek(log->fd, 0, SEEK_CUR); debugf("Reading retparams (%d) from %ld\n", apsr->retparams_size, rc); bytes_read = 0; do { rc = read(log->fd, apsr->retparams+bytes_read, apsr->retparams_size-bytes_read); if (rc != apsr->retparams_size) { fprintf(stderr, "could not read apsr->retparams (rc=%ld, size=%d)!\n", rc, apsr->retparams_size); if (rc <= 0) { apsr->retparams_size = 0; klog_print(stderr, apsr); free_active_psrs(log); goto out_free; } } bytes_read += rc; } while (bytes_read != apsr->retparams_size); } if (apsr->psr.flags & SR_HAS_SIGNAL) { struct klog_signal *n; do { n = apsr->signal; apsr->signal = malloc(sizeof(struct klog_signal)); /* FIXME: exit cleanly */ assert(apsr->signal); if (n == NULL) { apsr->signal->sig.next = NULL; } else { apsr->signal->sig.next = &n->sig; } apsr->signal->next = n; debugf("Reading signal\n"); rc = read(log->fd, &apsr->signal->raw, 172); if (rc != 172) { fprintf (stderr, "read of signal returns %ld, errno = %d\n", rc, errno); goto out_free; } apsr->signal->sig.signr = *(int *)apsr->signal->raw; } while (*(char **)(apsr->signal->raw+168)); } else { apsr->signal = NULL; } } ret = 0; out_free: free(psrs); out: return ret; } static void add_default_parse_rule_exceptions(struct klogfile *log); struct klogfile *parseklog_open(const char *filename) { struct klogfile *ret = NULL; ret = malloc(sizeof(*ret)); if (ret == NULL) { goto out; } /* Set up the parse rules */ memset(ret->parse_rules, 0, sizeof(ret->parse_rules)); add_default_parse_rule_exceptions(ret); /* Set up the print functions */ memset(ret->printfcns, 0, sizeof(ret->printfcns)); ret->default_printfcn = default_printfcn; ret->signal_print = default_signal_printfcn; /* Open the file and initialize the fd */ ret->fd = open(filename, O_RDONLY); if (ret->fd < 0) { perror("open: "); goto out_free; } ret->active_psrs = NULL; ret->active_start_idx = 0; ret->active_num_psrs = 0; ret->num_psrs = 0; ret->cur_idx = 0; ret->expected_clock = 0; out: return ret; out_free: free(ret); ret = NULL; goto out; } void parseklog_close(struct klogfile *log) { close(log->fd); free(log); } struct klog_result *parseklog_get_next_psr(struct klogfile *log) { struct klog_result *ret = NULL; loff_t prev_idx; prev_idx = log->active_start_idx; if (log->cur_idx == log->active_num_psrs) { debugf("Reading psr chunk\n"); if (read_psr_chunk(log)) { fprintf(stderr, "Error populating psrs, aborting\n"); return NULL; } if (prev_idx != log->active_start_idx) { log->cur_idx = 0; } } if (log->cur_idx != log->active_num_psrs) { ret = &log->active_psrs[log->cur_idx]; log->cur_idx++; } return ret; } struct klog_result *parseklog_get_psr(struct klogfile *log, loff_t idx) { assert(0 && "Unimplemented"); return NULL; } int parseklog_read_next_chunk(struct klogfile *log) { return read_psr_chunk(log); } int parseklog_cur_chunk_size(struct klogfile *log) { return log->active_num_psrs; } int parseklog_do_write_chunk(int count, struct klog_result *psrs, int destfd) { int i; int rc; u_long data_size; /* Write the count */ rc = write(destfd, &count, sizeof(int)); if (rc != sizeof(int)) { fprintf(stderr, "Couldn't record count\n"); return -1; } data_size = 0; /* Write the psrs */ /* Calculate the data size... */ for (i = 0; i < count; i++) { struct syscall_result *apsr = &psrs[i].psr; rc = write(destfd, apsr, sizeof(struct syscall_result)); if (rc != sizeof(struct syscall_result)) { fprintf(stderr, "Couldn't syscall_result\n"); return -1; } if (apsr->flags & SR_HAS_START_CLOCK_SKIP) { data_size += sizeof(u_long); } if (apsr->flags & SR_HAS_NONZERO_RETVAL) { data_size += sizeof(long); } if (apsr->flags & SR_HAS_STOP_CLOCK_SKIP) { data_size += sizeof(u_long); } if (apsr->flags & SR_HAS_SIGNAL) { struct klog_signal *n = psrs[i].signal; do { data_size += 172; } while (n->next); } data_size += psrs[i].retparams_size; } rc = write(destfd, &data_size, sizeof(data_size)); if (rc != sizeof(data_size)) { fprintf(stderr, "Couldn't record data_size\n"); return -1; } /* For each psr */ for (i = 0; i < count; i++) { u_long prev_start_clock; u_long prev_stop_clock; struct syscall_result *apsr = &psrs[i].psr; struct klog_result *res = &psrs[i]; /* If (has clock) write clock */ if (apsr->flags & SR_HAS_START_CLOCK_SKIP) { /* The 2 is magic... */ u_long record_clock = res->start_clock-prev_start_clock-2; rc = write(destfd, &record_clock, sizeof(u_long)); if (rc != sizeof(u_long)) { fprintf(stderr, "Couldn't record start_clock\n"); return -1; } } /* If (has retval) write retval */ if (apsr->flags & SR_HAS_NONZERO_RETVAL) { rc = write(destfd, &res->retval, sizeof(long)); if (rc != sizeof(long)) { fprintf(stderr, "Couldn't record retval\n"); return -1; } } if (apsr->flags & SR_HAS_STOP_CLOCK_SKIP) { /* The 2 is magic... */ u_long record_clock = res->stop_clock-prev_stop_clock-2; rc = write(destfd, &record_clock, sizeof(u_long)); if (rc != sizeof(u_long)) { fprintf(stderr, "Couldn't record start_clock\n"); return -1; } } /* If (has retparams) write retparams */ if (res->retparams_size) { rc = write(destfd, res->retparams, res->retparams_size); if (rc != res->retparams_size) { fprintf(stderr, "Couldn't record retparams_size\n"); return -1; } } if (apsr->flags & SR_HAS_SIGNAL) { struct klog_signal *n = res->signal; do { write(destfd, n->raw, 172); if (rc != sizeof(long)) { fprintf(stderr, "Couldn't record raw signal\n"); return -1; } } while (n->next); } prev_stop_clock = res->stop_clock; prev_start_clock = res->start_clock; } return 0; } int parseklog_write_chunk(struct klogfile *log, int destfd) { long rc; /* Write the header */ rc = parseklog_do_write_chunk(log->active_num_psrs, log->active_psrs, destfd); return rc; } void parseklog_set_signalprint(struct klogfile *log, void (*printfcn)(FILE *, struct klog_result *)) { log->signal_print = printfcn; } void parseklog_set_default_printfcn(struct klogfile *log, void (*printfcn)(FILE *, struct klog_result *)) { log->default_printfcn = printfcn; } void parseklog_set_printfcn(struct klogfile *log, void (*printfcn)(FILE *, struct klog_result *), int sysnum) { log->printfcns[sysnum] = printfcn; } int klog_print(FILE *out, struct klog_result *result) { result->printfcn(out, result); if (result->signal && result->log->signal_print) { result->log->signal_print(out, result); } return 0; } static u_long varsize(struct klogfile *klog, struct klog_result *res) { u_long val; long orig_pos; orig_pos = lseek(klog->fd, 0, SEEK_CUR); if (read (klog->fd, &val, sizeof(u_long)) != sizeof(u_long)) { fprintf (stderr, "cannot read variable length field\n"); return -1; } debugf("\t4 bytes of variable length field header included\n"); /* if (stats) { bytes[psr->sysnum] += sizeof(u_long); } */ debugf("\t%lu variable bytes\n", val); lseek(klog->fd, orig_pos, SEEK_SET); return val + sizeof(u_long); } static u_long getretparams_retval(struct klogfile *klog, struct klog_result *res) { return res->retval; } /* Exceptions */ /*{{{*/ static u_long getretparams_read(struct klogfile *log, struct klog_result *res) { long rc; u_long size = 0; int extra_bytes = 0; long return_pos; u_int is_cache_read; return_pos = lseek(log->fd, 0, SEEK_CUR); rc = read(log->fd, &is_cache_read, sizeof(u_int)); if (rc != sizeof(u_int)) { fprintf (stderr, "cannot read is_cache value\n"); return -1; } size += sizeof(u_int); debugf("\tis_cache_file: %d\n", is_cache_read); if (is_cache_read & CACHE_MASK) { size += sizeof(loff_t); #ifdef TRACE_READ_WRITE do { off_t orig_pos; struct replayfs_filemap_entry entry; loff_t bleh; orig_pos = lseek(log->fd, 0, SEEK_CUR); rc = read(log->fd, &bleh, sizeof(loff_t)); rc = read(log->fd, &entry, sizeof(struct replayfs_filemap_entry)); lseek(log->fd, orig_pos, SEEK_SET); if (rc != sizeof(struct replayfs_filemap_entry)) { fprintf(stderr, "cannot read entry\n"); return -1; } extra_bytes += sizeof(struct replayfs_filemap_entry) + entry.num_elms * sizeof(struct replayfs_filemap_value); size += sizeof(struct replayfs_filemap_entry) + entry.num_elms * sizeof(struct replayfs_filemap_value); } while (0); #endif #ifdef TRACE_PIPE_READ_WRITE } else if (is_cache_read & IS_PIPE) { if (is_cache_read & IS_PIPE_WITH_DATA) { off_t orig_pos; struct replayfs_filemap_entry entry; orig_pos = lseek(log->fd, 0, SEEK_CUR); rc = read(log->fd, &entry, sizeof(struct replayfs_filemap_entry)); lseek(log->fd, orig_pos, SEEK_SET); if (rc != sizeof(struct replayfs_filemap_entry)) { fprintf(stderr, "cannot read entry\n"); return -1; } size += sizeof(struct replayfs_filemap_entry) + entry.num_elms * sizeof(struct replayfs_filemap_value); } else { size += sizeof(uint64_t) + sizeof(int); } size += res->retval; #endif } else { size += res->retval; } lseek(log->fd, return_pos, SEEK_SET); return size; } static u_long getretparams_write(struct klogfile *klog, struct klog_result *res) { long return_pos; long rc; u_long size = 0; int is_shared; return_pos = lseek(klog->fd, 0, SEEK_CUR); size += sizeof(int); rc = read(klog->fd, &is_shared, sizeof(int)); if (rc != sizeof(int)) { fprintf(stderr, "cannot read \"write\" value\n"); return -1; } switch (is_shared) { case NORMAL_FILE: size += sizeof(int64_t); break; default: size += sizeof(int);; } if (lseek(klog->fd, return_pos, SEEK_SET) == (off_t)-1) { fprintf(stderr, "lseek failed to go to return_pos in write\n"); return -1; } return size; } static u_long getretparams_getgroups(struct klogfile *klog, struct klog_result *res) { return sizeof(u_short) * res->retval; } static u_long getretparams_getgroups32(struct klogfile *klog, struct klog_result *res) { return sizeof(gid_t) * res->retval; } static u_long getretparams_io_getevents(struct klogfile *klog, struct klog_result *res) { return res->retval * 32; } static u_long getretparams_epoll_wait(struct klogfile *klog, struct klog_result *res) { return res->retval * sizeof(struct epoll_event); } static u_long getretparams_socketcall(struct klogfile *log, struct klog_result *res) { int call; long rc; u_long size = 0; long return_pos; return_pos = lseek(log->fd, 0, SEEK_CUR); rc = read(log->fd, &call, sizeof(int)); if (rc != sizeof(int)) { fprintf(stderr, "cannot read call value\n"); return -1; } size += sizeof(int); debugf("\tsocketcall %d\n", call); assert(call > 0 && call <= 20); // socketcall retvals specific switch (call) { #ifdef TRACE_SOCKET_READ_WRITE case SYS_SEND: case SYS_SENDTO: { if (res->retval >= 0) { u_int shared; shared = 0; rc = read(log->fd, &shared, sizeof(u_int)); if (rc != sizeof(shared)) { fprintf(stderr, "%d: read %ld\n", __LINE__, rc); return -1; } size += sizeof(u_int); debugf("\tRead shared variable of %d\n", shared); if (shared & IS_PIPE_WITH_DATA) { } else if (shared & IS_PIPE) { int pipe_id; rc = read(log->fd, &pipe_id, sizeof(int)); if (rc != sizeof(int)) { fprintf(stderr, "%d: read: %ld\n", __LINE__, rc); return -1; } size += sizeof(int); /* if (!pipe_write_only) { printf("\tWrite is part of pipe: %d\n", pipe_id); } else { always_print("%d, %ld, %lu, %d\n", pipe_id, retval, start_clock, ndx); } */ } } break; } #endif case SYS_ACCEPT: case SYS_ACCEPT4: case SYS_GETSOCKNAME: case SYS_GETPEERNAME: { struct accept_retvals avr; rc = read(log->fd, ((char *) &avr) + sizeof(int), sizeof(struct accept_retvals) - sizeof(int)); if (rc != sizeof(struct accept_retvals) - sizeof(int)) { fprintf(stderr, "cannot read accept value\n"); return -1; } size += sizeof(struct accept_retvals) - sizeof(int); size += avr.addrlen; break; } case SYS_RECV: size += sizeof(struct recvfrom_retvals) - sizeof(int) + res->retval; #ifdef TRACE_SOCKET_READ_WRITE if (res->retval >= 0) { u_int is_cached; off_t orig_pos; orig_pos = lseek(log->fd, 0, SEEK_CUR); rc = lseek(log->fd, sizeof(struct recvfrom_retvals) - sizeof(int) + res->retval, SEEK_CUR); if (rc == (off_t)-1) { fprintf(stderr, "%d: lseek: %ld\n", __LINE__, rc); return -1; } rc = read(log->fd, &is_cached, sizeof(u_int)); if (rc != sizeof(is_cached)) { fprintf(stderr, "%d: Couldn't read is_cached\n", __LINE__); return -1; } debugf("\tSocket is_cached is %d\n", is_cached); if (is_cached & IS_PIPE_WITH_DATA) { off_t orig_pos2; int entry_size; struct replayfs_filemap_entry entry; struct replayfs_filemap_entry *real_entry; orig_pos2 = lseek(log->fd, 0, SEEK_CUR); rc = read(log->fd, &entry, sizeof(struct replayfs_filemap_entry)); if (rc != sizeof(struct replayfs_filemap_entry)) { fprintf(stderr, "cannot read entry\n"); return -1; } lseek(log->fd, orig_pos2, SEEK_SET); entry_size = sizeof(struct replayfs_filemap_entry) + entry.num_elms * sizeof(struct replayfs_filemap_value); size += entry_size; real_entry = malloc(entry_size); if (real_entry == NULL) { fprintf(stderr, "Cannot alloc real_entry\n"); return -1; } rc = read(log->fd, real_entry, entry_size); } else if (is_cached & IS_PIPE) { /* Just a simple one-to-one data entry */ uint64_t writer; int pipe_id; rc = read(log->fd, &writer, sizeof(uint64_t)); if (rc != sizeof(writer)) { fprintf(stderr, "%d: read: %ld\n", __LINE__, rc); return -1; } rc = read(log->fd, &pipe_id, sizeof(int)); if (rc != sizeof(pipe_id)) { fprintf(stderr, "%d: read: %ld\n", __LINE__, rc); return -1; } size += sizeof(is_cached) + sizeof(writer) + sizeof(pipe_id); } else { size += sizeof(is_cached); } lseek(log->fd, orig_pos, SEEK_SET); } #endif break; case SYS_RECVFROM: size += sizeof(struct recvfrom_retvals) - sizeof(int) + res->retval-1; #ifdef TRACE_SOCKET_READ_WRITE if (res->retval >= 0) { u_int is_cached; off_t orig_pos; orig_pos = lseek(log->fd, 0, SEEK_CUR); rc = lseek(log->fd, sizeof(struct recvfrom_retvals)-sizeof(int)+res->retval-1, SEEK_CUR); if (rc == (off_t)-1) { fprintf(stderr, "%d: lseek: %ld\n", __LINE__, rc); return -1; } rc = read(log->fd, &is_cached, sizeof(u_int)); if (rc != sizeof(is_cached)) { fprintf(stderr, "%d: Couldn't read is_cached\n", __LINE__); return -1; } debugf("\tSocket is_cached is %d\n", is_cached); if (is_cached & IS_PIPE_WITH_DATA) { off_t orig_pos2; int entry_size; struct replayfs_filemap_entry entry; struct replayfs_filemap_entry *real_entry; orig_pos2 = lseek(log->fd, 0, SEEK_CUR); rc = read(log->fd, &entry, sizeof(struct replayfs_filemap_entry)); if (rc != sizeof(struct replayfs_filemap_entry)) { fprintf(stderr, "cannot read entry\n"); return -1; } lseek(log->fd, orig_pos2, SEEK_SET); entry_size = sizeof(struct replayfs_filemap_entry) + entry.num_elms * sizeof(struct replayfs_filemap_value); size += entry_size; real_entry = malloc(entry_size); if (real_entry == NULL) { fprintf(stderr, "Cannot alloc real_entry\n"); return -1; } rc = read(log->fd, real_entry, entry_size); } else if (is_cached & IS_PIPE) { /* Just a simple one-to-one data entry */ uint64_t writer; int pipe_id; rc = read(log->fd, &writer, sizeof(uint64_t)); if (rc != sizeof(writer)) { fprintf(stderr, "%d: read: %ld\n", __LINE__, rc); return -1; } rc = read(log->fd, &pipe_id, sizeof(int)); if (rc != sizeof(pipe_id)) { fprintf(stderr, "%d: read: %ld\n", __LINE__, rc); return -1; } size += sizeof(is_cached) + sizeof(writer) + sizeof(pipe_id); } else { size += sizeof(is_cached); } lseek(log->fd, orig_pos, SEEK_SET); } #endif break; case SYS_RECVMSG: { struct recvmsg_retvals msg; rc = read(log->fd, ((char *)&msg) + sizeof(int), sizeof(struct recvmsg_retvals) - sizeof(int)); if (rc != sizeof(struct recvmsg_retvals) - sizeof(int)) { fprintf(stderr, "cannot read recvfrom values\n"); return -1; } size += sizeof(struct recvmsg_retvals) - sizeof(int); debugf("\trecvmsg: msgnamelen %d msg_controllen %ld msg_flags %x\n", msg.msg_namelen, msg.msg_controllen, msg.msg_flags); /* if (stats) { bytes[psr.sysnum] += sizeof(struct recvfrom_retvals) - sizeof(int); } */ size += msg.msg_namelen + msg.msg_controllen + res->retval; break; } case SYS_RECVMMSG: { if (res->retval > 0) { long len; rc = read(log->fd, ((char *)&len), sizeof(long)); if (rc != sizeof(long)) { fprintf(stderr, "cannot read recvmmsg value\n"); return -1; } size += sizeof(long); size += len; } else { size += 0; } break; } case SYS_SOCKETPAIR: size += sizeof(struct socketpair_retvals) - sizeof(int); break; case SYS_GETSOCKOPT: { struct getsockopt_retvals sor; rc = read (log->fd, ((char *) &sor) + sizeof(int), sizeof(struct getsockopt_retvals) - sizeof(int)); if (rc != sizeof(struct getsockopt_retvals)-sizeof(int)) { fprintf(stderr, "cannot read getsockopt value\n"); return -1; } size += sizeof(struct getsockopt_retvals) - sizeof(int); /* if (stats) { bytes[psr.sysnum] += sizeof(struct getsockopt_retvals) - sizeof(int); } */ size += sor.optlen; break; } default: size += 0; } lseek(log->fd, return_pos, SEEK_SET); return size; } static u_long getretparams_pread64 (struct klogfile *log, struct klog_result *res) { long rc; u_long size = 0; int extra_bytes = 0; long return_pos; u_int is_cache_read; return_pos = lseek(log->fd, 0, SEEK_CUR); rc = read(log->fd, &is_cache_read, sizeof(u_int)); if (rc != sizeof(u_int)) { fprintf (stderr, "cannot read is_cache value\n"); return -1; } size += sizeof(u_int); debugf(stderr, "\tis_cache_file: %d\n", is_cache_read); if (is_cache_read & CACHE_MASK) { size += sizeof(loff_t); #ifdef TRACE_READ_WRITE do { off_t orig_pos; struct replayfs_filemap_entry entry; loff_t bleh; orig_pos = lseek(log->fd, 0, SEEK_CUR); rc = read(log->fd, &bleh, sizeof(loff_t)); rc = read(log->fd, &entry, sizeof(struct replayfs_filemap_entry)); lseek(log->fd, orig_pos, SEEK_SET); if (rc != sizeof(struct replayfs_filemap_entry)) { fprintf(stderr, "cannot read entry\n"); return -1; } extra_bytes += sizeof(struct replayfs_filemap_entry) + entry.num_elms * sizeof(struct replayfs_filemap_value); size += sizeof(struct replayfs_filemap_entry) + entry.num_elms * sizeof(struct replayfs_filemap_value); } while (0); #endif } else { size += res->retval; } lseek(log->fd, return_pos, SEEK_SET); return size; } /*}}}*/ /* Rules for klog parsing */ /*{{{*/ #define _DEFRULE(sysnr, default, fcn) \ static struct parse_rules exception_##sysnr = { \ .get_retparamsize = (fcn), \ .retparamsize = (default) \ } #define DEFRULE(sysnr, size) _DEFRULE(sysnr, size, NULL) #define DEFRULE_FCN(sysnr, fcn) _DEFRULE(sysnr, 0, fcn) #define ADDRULE(sysnr, log) log->parse_rules[sysnr]=&exception_##sysnr DEFRULE_FCN(3, getretparams_read); DEFRULE_FCN(4, getretparams_write); DEFRULE(5, sizeof(struct open_retvals)); DEFRULE(7, sizeof(int)); DEFRULE(11, sizeof(struct execve_retvals)); DEFRULE(13, sizeof(time_t)); DEFRULE(18, sizeof(struct __old_kernel_stat)); DEFRULE(28, sizeof(struct __old_kernel_stat)); DEFRULE(42, 2*sizeof(int)); DEFRULE(43, sizeof(struct tms)); DEFRULE_FCN(54, varsize); DEFRULE_FCN(55, varsize); DEFRULE(59, sizeof(struct oldold_utsname)); DEFRULE(62, sizeof(struct sigaction)); DEFRULE(67, sizeof(struct sigaction)); DEFRULE(73, sizeof(sigset_t)); DEFRULE(76, sizeof(struct rlimit)); DEFRULE(77, sizeof(struct rusage)); DEFRULE(78, sizeof(struct gettimeofday_retvals)); DEFRULE_FCN(80, getretparams_getgroups); DEFRULE(84, sizeof(struct __old_kernel_stat)); DEFRULE_FCN(85, getretparams_retval); DEFRULE(86, sizeof(struct mmap_pgoff_retvals)); DEFRULE(89, 266); /* sizeof old_linux_dirent??? */ DEFRULE(99, sizeof(struct statfs)); DEFRULE(100, sizeof(struct statfs)); DEFRULE_FCN(102, getretparams_socketcall); DEFRULE_FCN(103, getretparams_retval); DEFRULE(104, sizeof(struct itimerval)); DEFRULE(105, sizeof(struct itimerval)); DEFRULE(106, sizeof(struct stat)); DEFRULE(107, sizeof(struct stat)); DEFRULE(108, sizeof(struct stat)); DEFRULE(109, sizeof(struct old_utsname)); DEFRULE(114, sizeof(struct wait4_retvals)); DEFRULE(116, sizeof(struct sysinfo)); DEFRULE_FCN(117, varsize); DEFRULE(122, sizeof(struct new_utsname)); DEFRULE(124, sizeof(struct timex)); DEFRULE(126, sizeof(unsigned long)); // old_sigset_t - def in asm/signal.h but cannot include DEFRULE_FCN(131, varsize); DEFRULE(134, sizeof(long)); DEFRULE_FCN(135, varsize); DEFRULE(140, sizeof(loff_t)); DEFRULE_FCN(141, getretparams_retval); DEFRULE_FCN(142, varsize); DEFRULE_FCN(145, getretparams_retval); DEFRULE_FCN(149, varsize); DEFRULE(155, sizeof(struct sched_param)); DEFRULE(161, sizeof(struct timespec)); DEFRULE(162, sizeof(struct timespec)); DEFRULE(165, sizeof(u_short)*3); DEFRULE_FCN(168, varsize); DEFRULE(171, sizeof(u_short)*3); DEFRULE_FCN(172, varsize); DEFRULE(174, 20); /* sizeof(struct sigaction)*/ DEFRULE_FCN(175, varsize); DEFRULE_FCN(176, varsize); DEFRULE(177, sizeof(siginfo_t)); DEFRULE_FCN(180, getretparams_pread64); DEFRULE_FCN(183, getretparams_retval); DEFRULE_FCN(184, varsize); DEFRULE(185, sizeof(struct __user_cap_header_struct)); DEFRULE(187, sizeof(off_t)); DEFRULE(191, sizeof(struct rlimit)); DEFRULE(192, sizeof(struct mmap_pgoff_retvals)); DEFRULE(195, sizeof(struct stat64)); DEFRULE(196, sizeof(struct stat64)); DEFRULE(197, sizeof(struct stat64)); DEFRULE_FCN(205, getretparams_getgroups32); DEFRULE(209, sizeof(uid_t)*3); DEFRULE(211, sizeof(gid_t)*3); DEFRULE_FCN(218, varsize); DEFRULE_FCN(220, getretparams_retval); DEFRULE_FCN(221, varsize); DEFRULE_FCN(229, getretparams_retval); DEFRULE_FCN(230, getretparams_retval); DEFRULE_FCN(231, getretparams_retval); DEFRULE_FCN(232, getretparams_retval); DEFRULE_FCN(233, getretparams_retval); DEFRULE_FCN(234, getretparams_retval); DEFRULE(239, sizeof(struct sendfile64_retvals)); DEFRULE_FCN(242, varsize); DEFRULE(245, sizeof(u_long)); DEFRULE_FCN(247, getretparams_io_getevents); DEFRULE(249, 32);/* struct ioevent */ DEFRULE_FCN(253, getretparams_retval); DEFRULE_FCN(256, getretparams_epoll_wait); DEFRULE(259, sizeof(timer_t)); DEFRULE(260, sizeof(struct itimerspec)); DEFRULE(261, sizeof(struct itimerspec)); DEFRULE(265, sizeof(struct timespec)); DEFRULE(266, sizeof(struct timespec)); DEFRULE(267, sizeof(struct timespec)); DEFRULE(268, 84); /* statfs 64 */ DEFRULE(269, 84); /* statfs 64 */ DEFRULE_FCN(275, varsize); DEFRULE_FCN(280, getretparams_retval); DEFRULE(282, sizeof(struct mq_attr)); DEFRULE(284, sizeof(struct waitid_retvals)); DEFRULE_FCN(288, varsize); DEFRULE(300, sizeof(struct stat64)); DEFRULE_FCN(305, getretparams_retval); DEFRULE(308, sizeof(struct pselect6_retvals)); DEFRULE_FCN(309, varsize); DEFRULE(312, sizeof(struct get_robust_list_retvals)); DEFRULE(313, sizeof(struct splice_retvals)); DEFRULE_FCN(317, varsize); DEFRULE(318, sizeof(unsigned)*2); DEFRULE_FCN(319, getretparams_epoll_wait); DEFRULE(325, sizeof(struct itimerspec)); DEFRULE(326, sizeof(struct itimerspec)); DEFRULE(331, 2*sizeof(int)); DEFRULE_FCN(333, getretparams_retval); DEFRULE_FCN(337, varsize); DEFRULE(340, sizeof(struct rlimit64)); DEFRULE(341, sizeof(struct name_to_handle_at_retvals)); DEFRULE(343, sizeof(struct timex)); /*}}}*/ /* Adding rules to the excepiton list */ /*{{{*/ static void add_default_parse_rule_exceptions(struct klogfile *log) { ADDRULE(3, log); ADDRULE(4, log); ADDRULE(5, log); ADDRULE(7, log); ADDRULE(11, log); ADDRULE(13, log); ADDRULE(18, log); ADDRULE(28, log); ADDRULE(42, log); ADDRULE(43, log); ADDRULE(54, log); ADDRULE(55, log); ADDRULE(59, log); ADDRULE(62, log); ADDRULE(67, log); ADDRULE(73, log); ADDRULE(76, log); ADDRULE(77, log); ADDRULE(78, log); ADDRULE(80, log); ADDRULE(84, log); ADDRULE(85, log); ADDRULE(86, log); ADDRULE(89, log); ADDRULE(99, log); ADDRULE(100, log); ADDRULE(102, log); ADDRULE(103, log); ADDRULE(104, log); ADDRULE(105, log); ADDRULE(106, log); ADDRULE(107, log); ADDRULE(108, log); ADDRULE(109, log); ADDRULE(114, log); ADDRULE(116, log); ADDRULE(117, log); ADDRULE(122, log); ADDRULE(124, log); ADDRULE(126, log); ADDRULE(131, log); ADDRULE(134, log); ADDRULE(135, log); ADDRULE(140, log); ADDRULE(141, log); ADDRULE(142, log); ADDRULE(145, log); ADDRULE(149, log); ADDRULE(155, log); ADDRULE(161, log); ADDRULE(162, log); ADDRULE(165, log); ADDRULE(168, log); ADDRULE(171, log); ADDRULE(172, log); ADDRULE(174, log); ADDRULE(175, log); ADDRULE(176, log); ADDRULE(177, log); ADDRULE(180, log); ADDRULE(183, log); ADDRULE(184, log); ADDRULE(185, log); ADDRULE(187, log); ADDRULE(191, log); ADDRULE(192, log); ADDRULE(195, log); ADDRULE(196, log); ADDRULE(197, log); ADDRULE(205, log); ADDRULE(209, log); ADDRULE(211, log); ADDRULE(218, log); ADDRULE(220, log); ADDRULE(221, log); ADDRULE(229, log); ADDRULE(230, log); ADDRULE(231, log); ADDRULE(232, log); ADDRULE(233, log); ADDRULE(234, log); ADDRULE(239, log); ADDRULE(242, log); ADDRULE(245, log); ADDRULE(247, log); ADDRULE(249, log); ADDRULE(253, log); ADDRULE(256, log); ADDRULE(259, log); ADDRULE(260, log); ADDRULE(261, log); ADDRULE(265, log); ADDRULE(266, log); ADDRULE(267, log); ADDRULE(268, log); ADDRULE(269, log); ADDRULE(275, log); ADDRULE(280, log); ADDRULE(282, log); ADDRULE(284, log); ADDRULE(288, log); ADDRULE(300, log); ADDRULE(305, log); ADDRULE(308, log); ADDRULE(309, log); ADDRULE(312, log); ADDRULE(313, log); ADDRULE(317, log); ADDRULE(318, log); ADDRULE(319, log); ADDRULE(325, log); ADDRULE(326, log); ADDRULE(331, log); ADDRULE(333, log); ADDRULE(337, log); ADDRULE(340, log); ADDRULE(341, log); ADDRULE(343, log); } /*}}}*/ /* Parsing syscall number to syscall name */ /*{{{*/ static __attribute__((const)) char *syscall_name(int nr) { char *ret; switch(nr) { case 0: ret = "restart_syscall"; break; case 1: ret = "exit"; break; case 2: ret = "fork"; break; case 3: ret = "read"; break; case 4: ret = "write"; break; case 5: ret = "open"; break; case 6: ret = "close"; break; case 7: ret = "waitpid"; break; case 8: ret = "creat"; break; case 9: ret = "link"; break; case 10: ret = "unlink"; break; case 11: ret = "execve"; break; case 12: ret = "chdir"; break; case 13: ret = "time"; break; case 14: ret = "mknod"; break; case 15: ret = "chmod"; break; case 16: ret = "lchown"; break; case 17: ret = "break"; break; case 18: ret = "oldstat"; break; case 19: ret = "lseek"; break; case 20: ret = "getpid"; break; case 21: ret = "mount"; break; case 22: ret = "umount"; break; case 23: ret = "setuid"; break; case 24: ret = "getuid"; break; case 25: ret = "stime"; break; case 26: ret = "ptrace"; break; case 27: ret = "alarm"; break; case 28: ret = "oldfstat"; break; case 29: ret = "pause"; break; case 30: ret = "utime"; break; case 31: ret = "stty"; break; case 32: ret = "gtty"; break; case 33: ret = "access"; break; case 34: ret = "nice"; break; case 35: ret = "ftime"; break; case 36: ret = "sync"; break; case 37: ret = "kill"; break; case 38: ret = "rename"; break; case 39: ret = "mkdir"; break; case 40: ret = "rmdir"; break; case 41: ret = "dup"; break; case 42: ret = "pipe"; break; case 43: ret = "times"; break; case 44: ret = "prof"; break; case 45: ret = "brk"; break; case 46: ret = "setgid"; break; case 47: ret = "getgid"; break; case 48: ret = "signal"; break; case 49: ret = "geteuid"; break; case 50: ret = "getegid"; break; case 51: ret = "acct"; break; case 52: ret = "umount2"; break; case 53: ret = "lock"; break; case 54: ret = "ioctl"; break; case 55: ret = "fcntl"; break; case 56: ret = "mpx"; break; case 57: ret = "setpgid"; break; case 58: ret = "ulimit"; break; case 59: ret = "oldolduname"; break; case 60: ret = "umask"; break; case 61: ret = "chroot"; break; case 62: ret = "ustat"; break; case 63: ret = "dup2"; break; case 64: ret = "getppid"; break; case 65: ret = "getpgrp"; break; case 66: ret = "setsid"; break; case 67: ret = "sigaction"; break; case 68: ret = "sgetmask"; break; case 69: ret = "ssetmask"; break; case 70: ret = "setreuid"; break; case 71: ret = "setregid"; break; case 72: ret = "sigsuspend"; break; case 73: ret = "sigpending"; break; case 74: ret = "sethostname"; break; case 75: ret = "setrlimit"; break; case 76: ret = "getrlimit"; break; case 77: ret = "getrusage"; break; case 78: ret = "gettimeofday"; break; case 79: ret = "settimeofday"; break; case 80: ret = "getgroups"; break; case 81: ret = "setgroups"; break; case 82: ret = "select"; break; case 83: ret = "symlink"; break; case 84: ret = "oldlstat"; break; case 85: ret = "readlink"; break; case 86: ret = "uselib"; break; case 87: ret = "swapon"; break; case 88: ret = "reboot"; break; case 89: ret = "readdir"; break; case 90: ret = "mmap"; break; case 91: ret = "munmap"; break; case 92: ret = "truncate"; break; case 93: ret = "ftruncate"; break; case 94: ret = "fchmod"; break; case 95: ret = "fchown"; break; case 96: ret = "getpriority"; break; case 97: ret = "setpriority"; break; case 98: ret = "profil"; break; case 99: ret = "statfs"; break; case 100: ret = "fstatfs"; break; case 101: ret = "ioperm"; break; case 102: ret = "socketcall"; break; case 103: ret = "syslog"; break; case 104: ret = "setitimer"; break; case 105: ret = "getitimer"; break; case 106: ret = "stat"; break; case 107: ret = "lstat"; break; case 108: ret = "fstat"; break; case 109: ret = "olduname"; break; case 110: ret = "iopl"; break; case 111: ret = "vhangup"; break; case 112: ret = "idle"; break; case 113: ret = "vm86old"; break; case 114: ret = "wait4"; break; case 115: ret = "swapoff"; break; case 116: ret = "sysinfo"; break; case 117: ret = "ipc"; break; case 118: ret = "fsync"; break; case 119: ret = "sigreturn"; break; case 120: ret = "clone"; break; case 121: ret = "setdomainname"; break; case 122: ret = "uname"; break; case 123: ret = "modify_ldt"; break; case 124: ret = "adjtimex"; break; case 125: ret = "mprotect"; break; case 126: ret = "sigprocmask"; break; case 127: ret = "create_module"; break; case 128: ret = "init_module"; break; case 129: ret = "delete_module"; break; case 130: ret = "get_kernel_syms"; break; case 131: ret = "quotactl"; break; case 132: ret = "getpgid"; break; case 133: ret = "fchdir"; break; case 134: ret = "bdflush"; break; case 135: ret = "sysfs"; break; case 136: ret = "personality"; break; case 137: ret = "afs_syscall"; break; case 138: ret = "setfsuid"; break; case 139: ret = "setfsgid"; break; case 140: ret = "_llseek"; break; case 141: ret = "getdents"; break; case 142: ret = "_newselect"; break; case 143: ret = "flock"; break; case 144: ret = "msync"; break; case 145: ret = "readv"; break; case 146: ret = "writev"; break; case 147: ret = "getsid"; break; case 148: ret = "fdatasync"; break; case 149: ret = "_sysctl"; break; case 150: ret = "mlock"; break; case 151: ret = "munlock"; break; case 152: ret = "mlockall"; break; case 153: ret = "munlockall"; break; case 154: ret = "sched_setparam"; break; case 155: ret = "sched_getparam"; break; case 156: ret = "sched_setscheduler"; break; case 157: ret = "sched_getscheduler"; break; case 158: ret = "sched_yield"; break; case 159: ret = "sched_get_priority_max"; break; case 160: ret = "sched_get_priority_min"; break; case 161: ret = "sched_rr_get_interval"; break; case 162: ret = "nanosleep"; break; case 163: ret = "mremap"; break; case 164: ret = "setresuid"; break; case 165: ret = "getresuid"; break; case 166: ret = "vm86"; break; case 167: ret = "query_module"; break; case 168: ret = "poll"; break; case 169: ret = "nfsservctl"; break; case 170: ret = "setresgid"; break; case 171: ret = "getresgid"; break; case 172: ret = "prctl"; break; case 173: ret = "rt_sigreturn"; break; case 174: ret = "rt_sigaction"; break; case 175: ret = "rt_sigprocmask"; break; case 176: ret = "rt_sigpending"; break; case 177: ret = "rt_sigtimedwait"; break; case 178: ret = "rt_sigqueueinfo"; break; case 179: ret = "rt_sigsuspend"; break; case 180: ret = "pread64"; break; case 181: ret = "pwrite64"; break; case 182: ret = "chown"; break; case 183: ret = "getcwd"; break; case 184: ret = "capget"; break; case 185: ret = "capset"; break; case 186: ret = "sigaltstack"; break; case 187: ret = "sendfile"; break; case 188: ret = "getpmsg"; break; case 189: ret = "putpmsg"; break; case 190: ret = "vfork"; break; case 191: ret = "ugetrlimit"; break; case 192: ret = "mmap2"; break; case 193: ret = "truncate64"; break; case 194: ret = "ftruncate64"; break; case 195: ret = "stat64"; break; case 196: ret = "lstat64"; break; case 197: ret = "fstat64"; break; case 198: ret = "lchown32"; break; case 199: ret = "getuid32"; break; case 200: ret = "getgid32"; break; case 201: ret = "geteuid32"; break; case 202: ret = "getegid32"; break; case 203: ret = "setreuid32"; break; case 204: ret = "setregid32"; break; case 205: ret = "getgroups32"; break; case 206: ret = "setgroups32"; break; case 207: ret = "fchown32"; break; case 208: ret = "setresuid32"; break; case 209: ret = "getresuid32"; break; case 210: ret = "setresgid32"; break; case 211: ret = "getresgid32"; break; case 212: ret = "chown32"; break; case 213: ret = "setuid32"; break; case 214: ret = "setgid32"; break; case 215: ret = "setfsuid32"; break; case 216: ret = "setfsgid32"; break; case 217: ret = "pivot_root"; break; case 218: ret = "mincore"; break; case 219: ret = "madvise"; break; //case 219: ret = "madvise1"; break; case 220: ret = "getdents64"; break; case 221: ret = "fcntl64"; break; /* 223 is unused */ case 224: ret = "gettid"; break; case 225: ret = "readahead"; break; case 226: ret = "setxattr"; break; case 227: ret = "lsetxattr"; break; case 228: ret = "fsetxattr"; break; case 229: ret = "getxattr"; break; case 230: ret = "lgetxattr"; break; case 231: ret = "fgetxattr"; break; case 232: ret = "listxattr"; break; case 233: ret = "llistxattr"; break; case 234: ret = "flistxattr"; break; case 235: ret = "removexattr"; break; case 236: ret = "lremovexattr"; break; case 237: ret = "fremovexattr"; break; case 238: ret = "tkill"; break; case 239: ret = "sendfile64"; break; case 240: ret = "futex"; break; case 241: ret = "sched_setaffinity"; break; case 242: ret = "sched_getaffinity"; break; case 243: ret = "set_thread_area"; break; case 244: ret = "get_thread_area"; break; case 245: ret = "io_setup"; break; case 246: ret = "io_destroy"; break; case 247: ret = "io_getevents"; break; case 248: ret = "io_submit"; break; case 249: ret = "io_cancel"; break; case 250: ret = "fadvise64"; break; /* 251 is available for reuse (was briefly sys_set_zone_reclaim) */ case 252: ret = "exit_group"; break; case 253: ret = "lookup_dcookie"; break; case 254: ret = "epoll_create"; break; case 255: ret = "epoll_ctl"; break; case 256: ret = "epoll_wait"; break; case 257: ret = "remap_file_pages"; break; case 258: ret = "set_tid_address"; break; case 259: ret = "timer_create"; break; case 260: ret = "timer_settime"; break; case 261: ret = "timer_gettime"; break; case 262: ret = "timer_getoverrun"; break; case 263: ret = "timer_delete"; break; case 264: ret = "clock_settime"; break; case 265: ret = "clock_gettime"; break; case 266: ret = "clock_getres"; break; case 267: ret = "clock_nanosleep"; break; case 268: ret = "statfs64"; break; case 269: ret = "fstatfs64"; break; case 270: ret = "tgkill"; break; case 271: ret = "utimes"; break; case 272: ret = "fadvise64_64"; break; case 273: ret = "vserver"; break; case 274: ret = "mbind"; break; case 275: ret = "get_mempolicy"; break; case 276: ret = "set_mempolicy"; break; case 277: ret = "mq_open"; break; case 278: ret = "mq_unlink"; break; case 279: ret = "mq_timedsend"; break; case 280: ret = "mq_timedreceive"; break; case 281: ret = "mq_notify"; break; case 282: ret = "mq_getsetattr"; break; case 283: ret = "kexec_load"; break; case 284: ret = "waitid"; break; /* #define __NR_sys_setaltroot 285 */ case 286: ret = "add_key"; break; case 287: ret = "request_key"; break; case 288: ret = "keyctl"; break; case 289: ret = "ioprio_set"; break; case 290: ret = "ioprio_get"; break; case 291: ret = "inotify_init"; break; case 292: ret = "inotify_add_watch"; break; case 293: ret = "inotify_rm_watch"; break; case 294: ret = "migrate_pages"; break; case 295: ret = "openat"; break; case 296: ret = "mkdirat"; break; case 297: ret = "mknodat"; break; case 298: ret = "fchownat"; break; case 299: ret = "futimesat"; break; case 300: ret = "fstatat64"; break; case 301: ret = "unlinkat"; break; case 302: ret = "renameat"; break; case 303: ret = "linkat"; break; case 304: ret = "symlinkat"; break; case 305: ret = "readlinkat"; break; case 306: ret = "fchmodat"; break; case 307: ret = "faccessat"; break; case 308: ret = "pselect6"; break; case 309: ret = "ppoll"; break; case 310: ret = "unshare"; break; case 311: ret = "set_robust_list"; break; case 312: ret = "get_robust_list"; break; case 313: ret = "splice"; break; case 314: ret = "sync_file_range"; break; case 315: ret = "tee"; break; case 316: ret = "vmsplice"; break; case 317: ret = "move_pages"; break; case 318: ret = "getcpu"; break; case 319: ret = "epoll_pwait"; break; case 320: ret = "utimensat"; break; case 321: ret = "signalfd"; break; case 322: ret = "timerfd_create"; break; case 323: ret = "eventfd"; break; case 324: ret = "fallocate"; break; case 325: ret = "timerfd_settime"; break; case 326: ret = "timerfd_gettime"; break; case 327: ret = "signalfd4"; break; case 328: ret = "eventfd2"; break; case 329: ret = "epoll_create1"; break; case 330: ret = "dup3"; break; case 331: ret = "pipe2"; break; case 332: ret = "inotify_init1"; break; case 333: ret = "preadv"; break; case 334: ret = "pwritev"; break; case 335: ret = "rt_tgsigqueueinfo"; break; case 336: ret = "perf_event_open"; break; case 337: ret = "recvmmsg"; break; case 338: ret = "fanotify_init"; break; case 339: ret = "fanotify_mark"; break; case 340: ret = "prlimit64"; break; case 341: ret = "name_to_handle_at"; break; case 342: ret = "open_by_handle_at"; break; case 343: ret = "clock_adjtime"; break; case 344: ret = "syncfs"; break; case 345: ret = "sendmmsg"; break; case 346: ret = "setns"; break; case 347: ret = "process_vm_readv"; break; case 348: ret = "process_vm_writev"; break; default: ret = "unknown"; } return ret; } /*}}}*/
bsd-2-clause
shanselman/TinyOS
Sample Programs/testLocks.bat
52
TinyOSCore.exe 1568 scott8.txt scott8.txt scott8.txt
bsd-2-clause
wilseypa/llamaOS
src/apps/NPB3.2-MPI/LU/rhs.f
18628
c--------------------------------------------------------------------- c--------------------------------------------------------------------- subroutine rhs c--------------------------------------------------------------------- c--------------------------------------------------------------------- c--------------------------------------------------------------------- c compute the right hand sides c--------------------------------------------------------------------- implicit none include 'applu.incl' c--------------------------------------------------------------------- c local variables c--------------------------------------------------------------------- integer i, j, k, m integer iex integer L1, L2 integer ist1, iend1 integer jst1, jend1 double precision q double precision u21, u31, u41 double precision tmp double precision u21i, u31i, u41i, u51i double precision u21j, u31j, u41j, u51j double precision u21k, u31k, u41k, u51k double precision u21im1, u31im1, u41im1, u51im1 double precision u21jm1, u31jm1, u41jm1, u51jm1 double precision u21km1, u31km1, u41km1, u51km1 do k = 1, nz do j = 1, ny do i = 1, nx do m = 1, 5 rsd(m,i,j,k) = - frct(m,i,j,k) end do end do end do end do c--------------------------------------------------------------------- c xi-direction flux differences c--------------------------------------------------------------------- c--------------------------------------------------------------------- c iex = flag : iex = 0 north/south communication c : iex = 1 east/west communication c--------------------------------------------------------------------- iex = 0 c--------------------------------------------------------------------- c communicate and receive/send two rows of data c--------------------------------------------------------------------- call exchange_3(u,iex) L1 = 0 if (north.eq.-1) L1 = 1 L2 = nx + 1 if (south.eq.-1) L2 = nx do k = 2, nz - 1 do j = jst, jend do i = L1, L2 flux(1,i,j,k) = u(2,i,j,k) u21 = u(2,i,j,k) / u(1,i,j,k) q = 0.50d+00 * ( u(2,i,j,k) * u(2,i,j,k) > + u(3,i,j,k) * u(3,i,j,k) > + u(4,i,j,k) * u(4,i,j,k) ) > / u(1,i,j,k) flux(2,i,j,k) = u(2,i,j,k) * u21 + c2 * > ( u(5,i,j,k) - q ) flux(3,i,j,k) = u(3,i,j,k) * u21 flux(4,i,j,k) = u(4,i,j,k) * u21 flux(5,i,j,k) = ( c1 * u(5,i,j,k) - c2 * q ) * u21 end do end do end do do k = 2, nz - 1 do j = jst, jend do i = ist, iend do m = 1, 5 rsd(m,i,j,k) = rsd(m,i,j,k) > - tx2 * ( flux(m,i+1,j,k) - flux(m,i-1,j,k) ) end do end do L2 = nx + 1 if (south.eq.-1) L2 = nx do i = ist, L2 tmp = 1.0d+00 / u(1,i,j,k) u21i = tmp * u(2,i,j,k) u31i = tmp * u(3,i,j,k) u41i = tmp * u(4,i,j,k) u51i = tmp * u(5,i,j,k) tmp = 1.0d+00 / u(1,i-1,j,k) u21im1 = tmp * u(2,i-1,j,k) u31im1 = tmp * u(3,i-1,j,k) u41im1 = tmp * u(4,i-1,j,k) u51im1 = tmp * u(5,i-1,j,k) flux(2,i,j,k) = (4.0d+00/3.0d+00) * tx3 * (u21i-u21im1) flux(3,i,j,k) = tx3 * ( u31i - u31im1 ) flux(4,i,j,k) = tx3 * ( u41i - u41im1 ) flux(5,i,j,k) = 0.50d+00 * ( 1.0d+00 - c1*c5 ) > * tx3 * ( ( u21i **2 + u31i **2 + u41i **2 ) > - ( u21im1**2 + u31im1**2 + u41im1**2 ) ) > + (1.0d+00/6.0d+00) > * tx3 * ( u21i**2 - u21im1**2 ) > + c1 * c5 * tx3 * ( u51i - u51im1 ) end do do i = ist, iend rsd(1,i,j,k) = rsd(1,i,j,k) > + dx1 * tx1 * ( u(1,i-1,j,k) > - 2.0d+00 * u(1,i,j,k) > + u(1,i+1,j,k) ) rsd(2,i,j,k) = rsd(2,i,j,k) > + tx3 * c3 * c4 * ( flux(2,i+1,j,k) - flux(2,i,j,k) ) > + dx2 * tx1 * ( u(2,i-1,j,k) > - 2.0d+00 * u(2,i,j,k) > + u(2,i+1,j,k) ) rsd(3,i,j,k) = rsd(3,i,j,k) > + tx3 * c3 * c4 * ( flux(3,i+1,j,k) - flux(3,i,j,k) ) > + dx3 * tx1 * ( u(3,i-1,j,k) > - 2.0d+00 * u(3,i,j,k) > + u(3,i+1,j,k) ) rsd(4,i,j,k) = rsd(4,i,j,k) > + tx3 * c3 * c4 * ( flux(4,i+1,j,k) - flux(4,i,j,k) ) > + dx4 * tx1 * ( u(4,i-1,j,k) > - 2.0d+00 * u(4,i,j,k) > + u(4,i+1,j,k) ) rsd(5,i,j,k) = rsd(5,i,j,k) > + tx3 * c3 * c4 * ( flux(5,i+1,j,k) - flux(5,i,j,k) ) > + dx5 * tx1 * ( u(5,i-1,j,k) > - 2.0d+00 * u(5,i,j,k) > + u(5,i+1,j,k) ) end do c--------------------------------------------------------------------- c Fourth-order dissipation c--------------------------------------------------------------------- IF (north.eq.-1) then do m = 1, 5 rsd(m,2,j,k) = rsd(m,2,j,k) > - dssp * ( + 5.0d+00 * u(m,2,j,k) > - 4.0d+00 * u(m,3,j,k) > + u(m,4,j,k) ) rsd(m,3,j,k) = rsd(m,3,j,k) > - dssp * ( - 4.0d+00 * u(m,2,j,k) > + 6.0d+00 * u(m,3,j,k) > - 4.0d+00 * u(m,4,j,k) > + u(m,5,j,k) ) end do END IF ist1 = 1 iend1 = nx if (north.eq.-1) ist1 = 4 if (south.eq.-1) iend1 = nx - 3 do i = ist1,iend1 do m = 1, 5 rsd(m,i,j,k) = rsd(m,i,j,k) > - dssp * ( u(m,i-2,j,k) > - 4.0d+00 * u(m,i-1,j,k) > + 6.0d+00 * u(m,i,j,k) > - 4.0d+00 * u(m,i+1,j,k) > + u(m,i+2,j,k) ) end do end do IF (south.eq.-1) then do m = 1, 5 rsd(m,nx-2,j,k) = rsd(m,nx-2,j,k) > - dssp * ( u(m,nx-4,j,k) > - 4.0d+00 * u(m,nx-3,j,k) > + 6.0d+00 * u(m,nx-2,j,k) > - 4.0d+00 * u(m,nx-1,j,k) ) rsd(m,nx-1,j,k) = rsd(m,nx-1,j,k) > - dssp * ( u(m,nx-3,j,k) > - 4.0d+00 * u(m,nx-2,j,k) > + 5.0d+00 * u(m,nx-1,j,k) ) end do END IF end do end do c--------------------------------------------------------------------- c eta-direction flux differences c--------------------------------------------------------------------- c--------------------------------------------------------------------- c iex = flag : iex = 0 north/south communication c--------------------------------------------------------------------- iex = 1 c--------------------------------------------------------------------- c communicate and receive/send two rows of data c--------------------------------------------------------------------- call exchange_3(u,iex) L1 = 0 if (west.eq.-1) L1 = 1 L2 = ny + 1 if (east.eq.-1) L2 = ny do k = 2, nz - 1 do i = ist, iend do j = L1, L2 flux(1,i,j,k) = u(3,i,j,k) u31 = u(3,i,j,k) / u(1,i,j,k) q = 0.50d+00 * ( u(2,i,j,k) * u(2,i,j,k) > + u(3,i,j,k) * u(3,i,j,k) > + u(4,i,j,k) * u(4,i,j,k) ) > / u(1,i,j,k) flux(2,i,j,k) = u(2,i,j,k) * u31 flux(3,i,j,k) = u(3,i,j,k) * u31 + c2 * (u(5,i,j,k)-q) flux(4,i,j,k) = u(4,i,j,k) * u31 flux(5,i,j,k) = ( c1 * u(5,i,j,k) - c2 * q ) * u31 end do end do end do do k = 2, nz - 1 do i = ist, iend do j = jst, jend do m = 1, 5 rsd(m,i,j,k) = rsd(m,i,j,k) > - ty2 * ( flux(m,i,j+1,k) - flux(m,i,j-1,k) ) end do end do L2 = ny + 1 if (east.eq.-1) L2 = ny do j = jst, L2 tmp = 1.0d+00 / u(1,i,j,k) u21j = tmp * u(2,i,j,k) u31j = tmp * u(3,i,j,k) u41j = tmp * u(4,i,j,k) u51j = tmp * u(5,i,j,k) tmp = 1.0d+00 / u(1,i,j-1,k) u21jm1 = tmp * u(2,i,j-1,k) u31jm1 = tmp * u(3,i,j-1,k) u41jm1 = tmp * u(4,i,j-1,k) u51jm1 = tmp * u(5,i,j-1,k) flux(2,i,j,k) = ty3 * ( u21j - u21jm1 ) flux(3,i,j,k) = (4.0d+00/3.0d+00) * ty3 * (u31j-u31jm1) flux(4,i,j,k) = ty3 * ( u41j - u41jm1 ) flux(5,i,j,k) = 0.50d+00 * ( 1.0d+00 - c1*c5 ) > * ty3 * ( ( u21j **2 + u31j **2 + u41j **2 ) > - ( u21jm1**2 + u31jm1**2 + u41jm1**2 ) ) > + (1.0d+00/6.0d+00) > * ty3 * ( u31j**2 - u31jm1**2 ) > + c1 * c5 * ty3 * ( u51j - u51jm1 ) end do do j = jst, jend rsd(1,i,j,k) = rsd(1,i,j,k) > + dy1 * ty1 * ( u(1,i,j-1,k) > - 2.0d+00 * u(1,i,j,k) > + u(1,i,j+1,k) ) rsd(2,i,j,k) = rsd(2,i,j,k) > + ty3 * c3 * c4 * ( flux(2,i,j+1,k) - flux(2,i,j,k) ) > + dy2 * ty1 * ( u(2,i,j-1,k) > - 2.0d+00 * u(2,i,j,k) > + u(2,i,j+1,k) ) rsd(3,i,j,k) = rsd(3,i,j,k) > + ty3 * c3 * c4 * ( flux(3,i,j+1,k) - flux(3,i,j,k) ) > + dy3 * ty1 * ( u(3,i,j-1,k) > - 2.0d+00 * u(3,i,j,k) > + u(3,i,j+1,k) ) rsd(4,i,j,k) = rsd(4,i,j,k) > + ty3 * c3 * c4 * ( flux(4,i,j+1,k) - flux(4,i,j,k) ) > + dy4 * ty1 * ( u(4,i,j-1,k) > - 2.0d+00 * u(4,i,j,k) > + u(4,i,j+1,k) ) rsd(5,i,j,k) = rsd(5,i,j,k) > + ty3 * c3 * c4 * ( flux(5,i,j+1,k) - flux(5,i,j,k) ) > + dy5 * ty1 * ( u(5,i,j-1,k) > - 2.0d+00 * u(5,i,j,k) > + u(5,i,j+1,k) ) end do c--------------------------------------------------------------------- c fourth-order dissipation c--------------------------------------------------------------------- IF (west.eq.-1) then do m = 1, 5 rsd(m,i,2,k) = rsd(m,i,2,k) > - dssp * ( + 5.0d+00 * u(m,i,2,k) > - 4.0d+00 * u(m,i,3,k) > + u(m,i,4,k) ) rsd(m,i,3,k) = rsd(m,i,3,k) > - dssp * ( - 4.0d+00 * u(m,i,2,k) > + 6.0d+00 * u(m,i,3,k) > - 4.0d+00 * u(m,i,4,k) > + u(m,i,5,k) ) end do END IF jst1 = 1 jend1 = ny if (west.eq.-1) jst1 = 4 if (east.eq.-1) jend1 = ny - 3 do j = jst1, jend1 do m = 1, 5 rsd(m,i,j,k) = rsd(m,i,j,k) > - dssp * ( u(m,i,j-2,k) > - 4.0d+00 * u(m,i,j-1,k) > + 6.0d+00 * u(m,i,j,k) > - 4.0d+00 * u(m,i,j+1,k) > + u(m,i,j+2,k) ) end do end do IF (east.eq.-1) then do m = 1, 5 rsd(m,i,ny-2,k) = rsd(m,i,ny-2,k) > - dssp * ( u(m,i,ny-4,k) > - 4.0d+00 * u(m,i,ny-3,k) > + 6.0d+00 * u(m,i,ny-2,k) > - 4.0d+00 * u(m,i,ny-1,k) ) rsd(m,i,ny-1,k) = rsd(m,i,ny-1,k) > - dssp * ( u(m,i,ny-3,k) > - 4.0d+00 * u(m,i,ny-2,k) > + 5.0d+00 * u(m,i,ny-1,k) ) end do END IF end do end do c--------------------------------------------------------------------- c zeta-direction flux differences c--------------------------------------------------------------------- do j = jst, jend do i = ist, iend do k = 1, nz flux(1,i,j,k) = u(4,i,j,k) u41 = u(4,i,j,k) / u(1,i,j,k) q = 0.50d+00 * ( u(2,i,j,k) * u(2,i,j,k) > + u(3,i,j,k) * u(3,i,j,k) > + u(4,i,j,k) * u(4,i,j,k) ) > / u(1,i,j,k) flux(2,i,j,k) = u(2,i,j,k) * u41 flux(3,i,j,k) = u(3,i,j,k) * u41 flux(4,i,j,k) = u(4,i,j,k) * u41 + c2 * (u(5,i,j,k)-q) flux(5,i,j,k) = ( c1 * u(5,i,j,k) - c2 * q ) * u41 end do do k = 2, nz - 1 do m = 1, 5 rsd(m,i,j,k) = rsd(m,i,j,k) > - tz2 * ( flux(m,i,j,k+1) - flux(m,i,j,k-1) ) end do end do do k = 2, nz tmp = 1.0d+00 / u(1,i,j,k) u21k = tmp * u(2,i,j,k) u31k = tmp * u(3,i,j,k) u41k = tmp * u(4,i,j,k) u51k = tmp * u(5,i,j,k) tmp = 1.0d+00 / u(1,i,j,k-1) u21km1 = tmp * u(2,i,j,k-1) u31km1 = tmp * u(3,i,j,k-1) u41km1 = tmp * u(4,i,j,k-1) u51km1 = tmp * u(5,i,j,k-1) flux(2,i,j,k) = tz3 * ( u21k - u21km1 ) flux(3,i,j,k) = tz3 * ( u31k - u31km1 ) flux(4,i,j,k) = (4.0d+00/3.0d+00) * tz3 * (u41k-u41km1) flux(5,i,j,k) = 0.50d+00 * ( 1.0d+00 - c1*c5 ) > * tz3 * ( ( u21k **2 + u31k **2 + u41k **2 ) > - ( u21km1**2 + u31km1**2 + u41km1**2 ) ) > + (1.0d+00/6.0d+00) > * tz3 * ( u41k**2 - u41km1**2 ) > + c1 * c5 * tz3 * ( u51k - u51km1 ) end do do k = 2, nz - 1 rsd(1,i,j,k) = rsd(1,i,j,k) > + dz1 * tz1 * ( u(1,i,j,k-1) > - 2.0d+00 * u(1,i,j,k) > + u(1,i,j,k+1) ) rsd(2,i,j,k) = rsd(2,i,j,k) > + tz3 * c3 * c4 * ( flux(2,i,j,k+1) - flux(2,i,j,k) ) > + dz2 * tz1 * ( u(2,i,j,k-1) > - 2.0d+00 * u(2,i,j,k) > + u(2,i,j,k+1) ) rsd(3,i,j,k) = rsd(3,i,j,k) > + tz3 * c3 * c4 * ( flux(3,i,j,k+1) - flux(3,i,j,k) ) > + dz3 * tz1 * ( u(3,i,j,k-1) > - 2.0d+00 * u(3,i,j,k) > + u(3,i,j,k+1) ) rsd(4,i,j,k) = rsd(4,i,j,k) > + tz3 * c3 * c4 * ( flux(4,i,j,k+1) - flux(4,i,j,k) ) > + dz4 * tz1 * ( u(4,i,j,k-1) > - 2.0d+00 * u(4,i,j,k) > + u(4,i,j,k+1) ) rsd(5,i,j,k) = rsd(5,i,j,k) > + tz3 * c3 * c4 * ( flux(5,i,j,k+1) - flux(5,i,j,k) ) > + dz5 * tz1 * ( u(5,i,j,k-1) > - 2.0d+00 * u(5,i,j,k) > + u(5,i,j,k+1) ) end do c--------------------------------------------------------------------- c fourth-order dissipation c--------------------------------------------------------------------- do m = 1, 5 rsd(m,i,j,2) = rsd(m,i,j,2) > - dssp * ( + 5.0d+00 * u(m,i,j,2) > - 4.0d+00 * u(m,i,j,3) > + u(m,i,j,4) ) rsd(m,i,j,3) = rsd(m,i,j,3) > - dssp * ( - 4.0d+00 * u(m,i,j,2) > + 6.0d+00 * u(m,i,j,3) > - 4.0d+00 * u(m,i,j,4) > + u(m,i,j,5) ) end do do k = 4, nz - 3 do m = 1, 5 rsd(m,i,j,k) = rsd(m,i,j,k) > - dssp * ( u(m,i,j,k-2) > - 4.0d+00 * u(m,i,j,k-1) > + 6.0d+00 * u(m,i,j,k) > - 4.0d+00 * u(m,i,j,k+1) > + u(m,i,j,k+2) ) end do end do do m = 1, 5 rsd(m,i,j,nz-2) = rsd(m,i,j,nz-2) > - dssp * ( u(m,i,j,nz-4) > - 4.0d+00 * u(m,i,j,nz-3) > + 6.0d+00 * u(m,i,j,nz-2) > - 4.0d+00 * u(m,i,j,nz-1) ) rsd(m,i,j,nz-1) = rsd(m,i,j,nz-1) > - dssp * ( u(m,i,j,nz-3) > - 4.0d+00 * u(m,i,j,nz-2) > + 5.0d+00 * u(m,i,j,nz-1) ) end do end do end do return end
bsd-2-clause
kbwatts/polymer-survey
uq-survey/transitions.html
9425
<!-- @license Copyright (c) 2014 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt --> <!doctype html> <html> <head> <title>UQ Library</title> <script src="https://www.polymer-project.org/components/webcomponentsjs/webcomponents.js"></script> <link href="https://www.polymer-project.org/components/core-animated-pages/core-animated-pages.html" rel="import"> <link href="https://www.polymer-project.org/components/core-animated-pages/transitions/slide-from-right.html" rel="import"> <link href="https://www.polymer-project.org/components/core-animated-pages/transitions/cross-fade.html" rel="import"> <link href="https://www.polymer-project.org/components/core-icons/core-icons.html" rel="import"> <link href="https://www.polymer-project.org/components/paper-fab/paper-fab.html" rel="import"> <link rel="import" href="https://www.polymer-project.org/components/paper-progress/paper-progress.html"> <link href="https://www.polymer-project.org/components/paper-shadow/paper-shadow.html" rel="import"> <link rel="icon" type="image/png" href="../images/uqlib.png"> <style> body { font-family: Roboto, 'Helvetica Neue', Helvetica, Arial, sans-serif; margin: 0; } core-animated-pages { position: absolute; top: 0; right: 0; bottom: 0px; left: 0; font-size: 72px; overflow: hidden; } .controls { position: absolute; width: 100%; bottom: 16px; } section > div { height: 100%; color: #212121; } paper-fab { color: #fff; margin-right:2em; margin-left:2em; } paper-fab.blue { background: #5677fc; } paper-fab.green { background: #259b24; } paper-fab.grey { background: #9E9E9E; } paper-fab.light-grey { background: #BDBDBD; } paper-progress { display: block; width: 100%; padding: 25px 0; } .card { font-color: #424242; font-size: 18px; display: inline-block; background: #333; box-sizing: border-box; width: 80%; height: 80%; /*margin: 16px;*/ /*padding: 1px;*/ border-radius: 3px; } .title { color: #eee; } .text { font-size: 18px; } </style> </head> <body unresolved> <core-animated-pages onclick="next();" transitions="cross-fade-all"> <section> <div layout vertical left center-justified style="background:#7B1FA2;"> <div horizontal layout> <div flex></div> <div flex twelve class="title">Web Accessibility @ UQ Library</div> </div> </div> </section> <section> <iframe src="http://www.google.com/design/spec/usability/accessibility.html" seamless="" style="border:none;width:100%;height:100%;"></iframe> </section> <section> <div layout vertical left center-justified style="background:#43A047;"> <div horizontal layout> <div flex></div> <div flex twelve class="title">Development Tools</div> </div> </div> </section> <section> <iframe src="http://squizlabs.github.io/HTML_CodeSniffer" seamless="" style="border:none;width:100%;height:100%;"></iframe> </section> <section> <div layout vertical center center-justified> <img src="../images/github-accessibility1.png" style="border:none;height:100%;"> </div> </section> <section> <iframe src="http://en.wikipedia.org/wiki/Flesch%E2%80%93Kincaid_readability_tests" seamless="" style="border:none;width:100%;height:100%;"></iframe> </section> <section> <div layout vertical center center-justified> <img src="../images/fk-gh.png" style="border:none;height:100%;"> </div> </section> <section> <div layout vertical center center-justified> <img src="../images/sotu.png" style="border:none;height:100%;"></a> </div> </section> <section> <div layout vertical center center-justified> <img src="../images/sotu-amended.png" style="border:none;height:100%;"></a> </div> </section> <section> <div layout vertical left center-justified style="background:#3949AB;"> <div horizontal layout> <div flex></div> <div flex twelve class="title">UQ Library Website</div> </div> </div> </section> <section> <iframe src="http://www.uq.edu.au/omc/web-accessibility" seamless="" style="border:none;width:100%;height:100%;"></iframe> </section> <section> <div layout vertical center center-justified style="background:#eee;"> <paper-shadow class="card" z="2"> <video height="100%" width="100%" style="border-radius:3px;" controls> <source src="../video/2-lib.mp4" type="video/mp4"> Your browser does not support HTML5 video. </video> </paper-shadow> </div> </section> <section> <div layout vertical center center-justified style="background:#eee;"> <paper-shadow class="card" z="2"> <video height="100%" width="100%" style="border-radius:3px;" controls> <source src="../video/3-summon.mp4" type="video/mp4"> Your browser does not support HTML5 video. </video> </paper-shadow> </div> </section> <section> <div layout vertical center center-justified style="background:#eee;"> <paper-shadow class="card" z="2"> <video height="100%" width="100%" style="border-radius:3px;" controls> <source src="../video/4-improved.mp4" type="video/mp4"> Your browser does not support HTML5 video. </video> </paper-shadow> </div> </section> <section> <iframe src="https://www.library.uq.edu.au/" seamless="" style="border:none;width:100%;height:100%;"></iframe> </section> <section> <iframe src="https://app.library.uq.edu.au/v1/home/" seamless="" style="border:none;width:100%;height:100%;"></iframe> </section> </core-animated-pages> <div horizontal layout center-justified class="controls"> <div><paper-fab mini icon="arrow-back" class="light-grey" title="arrow-back" onclick="back()"></paper-fab></div> <div flex><!-- <paper-progress></paper-progress> --></div> <div><paper-fab mini icon="arrow-forward" class="light-grey" title="arrow-forward" onclick="next()"></paper-fab></div> </div> <script> var up = true; var max = (document.getElementsByTagName('section').length - 1); var currentPage = document.querySelector('core-animated-pages'); function next() { if ((currentPage.selected) < max) { currentPage.selected++; // startNextProgress(); } } function back() { if ((currentPage.selected) > 0) { currentPage.selected--; // startPreviousProgress(); } } document.onkeydown = checkKey; function checkKey(e) { e = e || window.event; if (((e.keyCode == '37') || (e.keyCode == '46')) && currentPage.selected > 0) { back(); } else if (((e.keyCode == '13') || (e.keyCode == '32') || (e.keyCode == '39')) && currentPage.selected <= max) { next(); } } var progress = document.querySelector('paper-progress'); var repeat, maxRepeat = 1, animating = false; function nextProgress() { console.log("currentPage.selected = " + currentPage.selected); // console.log("progress.value = " + progress.value); animating = true; if (progress.value < (currentPage.selected+1)*10) { progress.value += (progress.step || 1); } else { if (++repeat >= maxRepeat) { animating = false; return; } progress.value = progress.min; } progress.async(nextProgress); } function startNextProgress() { repeat = 0; progress.value = ((currentPage.selected)*10); if (!animating) { nextProgress(); } } function previousProgress() { console.log("currentPage.selected = " + currentPage.selected); // console.log("progress.value = " + progress.value); animating = true; if (progress.value > (currentPage.selected-1)*10) { progress.value -= (progress.step || 1); } else { if (++repeat >= maxRepeat) { animating = false; return; } progress.value = progress.min; } progress.async(previousProgress); } function startPreviousProgress() { repeat = 0; progress.value = ((currentPage.selected)*10); if (!animating) { previousProgress(); } } addEventListener('polymer-ready', function() { startNextProgress(); }); </script> </body> </html>
bsd-2-clause
Linuxbrew/homebrew-core
Formula/hapi-fhir-cli.rb
1080
class HapiFhirCli < Formula desc "Command-line interface for the HAPI FHIR library" homepage "https://hapifhir.io/" url "https://github.com/hapifhir/hapi-fhir/releases/download/v5.4.0/hapi-fhir-5.4.0-cli.zip" sha256 "142022d1d5b1d849e9a894bac0a8269bfccf3be4b1364b3eaeb685c588966995" license "Apache-2.0" livecheck do url :stable strategy :github_latest end depends_on "openjdk" resource "test_resource" do url "https://github.com/hapifhir/hapi-fhir/raw/v5.4.0/hapi-fhir-structures-dstu3/src/test/resources/specimen-example.json" sha256 "4eacf47eccec800ffd2ca23b704c70d71bc840aeb755912ffb8596562a0a0f5e" end def install inreplace "hapi-fhir-cli", /SCRIPTDIR=(.*)/, "SCRIPTDIR=#{libexec}" libexec.install "hapi-fhir-cli.jar" bin.install "hapi-fhir-cli" bin.env_script_all_files libexec/"bin", JAVA_HOME: Formula["openjdk"].opt_prefix end test do testpath.install resource("test_resource") system bin/"hapi-fhir-cli", "validate", "--file", "specimen-example.json", "--fhir-version", "dstu3" end end
bsd-2-clause
CSSIP-AIR/PatentsProcessor
start.py
7205
""" Copyright (c) 2013 The Regents of the University of California, AMERICAN INSTITUTES FOR RESEARCH All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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. """ """ @author Gabe Fierro [email protected] github.com/gtfierro """ import re import os import sys import parse import time import itertools import datetime import logging import requests import zipfile import cStringIO as StringIO from bs4 import BeautifulSoup as bs import lib.alchemy as alchemy sys.path.append('lib') from config_parser import get_config_options logfile = "./" + 'xml-parsing.log' logging.basicConfig(filename=logfile, level=logging.DEBUG) def get_year_list(yearstring): """ Given a [yearstring] of forms year1 year1-year2 year1,year2,year3 year1-year2,year3-year4 Expands into a list of year integers, and returns """ years = [] for subset in yearstring.split(','): if subset == 'latest': years.append('latest') continue sublist = subset.split('-') start = int(sublist[0]) end = int(sublist[1])+1 if len(sublist) > 1 else start+1 years.extend(range(start,end)) return years def generate_download_list(years, doctype='grant'): """ Given the year string from the configuration file, return a list of urls to be downloaded """ if not years: return [] urls = [] link = 'https://www.google.com/googlebooks/uspto-patents-grants-text.html' if doctype == 'application': link = 'https://www.google.com/googlebooks/uspto-patents-applications-text.html' url = requests.get(link) soup = bs(url.content) years = get_year_list(years) # latest file link if 'latest' in years: a = soup.h3.findNext('h3').findPrevious('a') urls.append(a['href']) years.remove('latest') # get year links for year in years: header = soup.find('h3', {'id': str(year)}) a = header.findNext() while a.name != 'h3': urls.append(a['href']) a = a.findNext() return urls def download_files(urls): """ [downloaddir]: string representing base download directory. Will download files to this directory in folders named for each year Returns: False if files were not downloaded or if there was some error, True otherwise """ import os import requests import zipfile import cStringIO as StringIO if not (downloaddir and urls): return False complete = True print 'downloading to',downloaddir for url in urls: filename = url.split('/')[-1].replace('zip','xml') if filename in os.listdir(downloaddir): print 'already have',filename continue print 'downloading',url try: r = requests.get(url) z = zipfile.ZipFile(StringIO.StringIO(r.content)) print 'unzipping',filename z.extractall(downloaddir) except: print 'ERROR: downloading or unzipping',filename complete = False continue return complete def run_parse(files, doctype='grant'): import parse import time import sys import itertools import lib.alchemy as alchemy import logging logfile = "./" + 'xml-parsing.log' logging.basicConfig(filename=logfile, level=logging.DEBUG) parse.parse_files(files, doctype) def run_clean(process_config): if not process_config['clean']: return doctype = process_config['doctype'] command = 'run_clean.bat' os.system(command) def run_consolidate(process_config): if not process_config['consolidate']: return doctype = process_config['doctype'] # TODO: optionally include previous disambiguation command = 'run_consolidation.bat' os.system(command) if __name__=='__main__': s = datetime.datetime.now() # accepts path to configuration file as command line option if len(sys.argv) < 2: print('Please specify a configuration file as the first argument') exit() process_config, parse_config = get_config_options(sys.argv[1]) doctype = process_config['doctype'] # download the files to be parsed urls = [] should_process_grants = doctype in ['all', 'grant'] should_process_applications = doctype in ['all', 'application'] if should_process_grants: urls += generate_download_list(parse_config['years'], 'grant') if should_process_applications: urls += generate_download_list(parse_config['years'], 'application') downloaddir = parse_config['downloaddir'] if downloaddir and not os.path.exists(downloaddir): os.makedirs(downloaddir) print 'Downloading files at {0}'.format(str(datetime.datetime.today())) download_files(urls) print 'Downloaded files:',parse_config['years'] f = datetime.datetime.now() print 'Finished downloading in {0}'.format(str(f-s)) # find files print "Starting parse on {0} on directory {1}".format(str(datetime.datetime.today()),parse_config['datadir']) if should_process_grants: files = parse.list_files(parse_config['datadir'],parse_config['grantregex']) print 'Running grant parse...' run_parse(files, 'grant') f = datetime.datetime.now() print "Found {2} files matching {0} in directory {1}"\ .format(parse_config['grantregex'], parse_config['datadir'], len(files)) if should_process_applications: files = parse.list_files(parse_config['datadir'],parse_config['applicationregex']) print 'Running application parse...' run_parse(files, 'application') f = datetime.datetime.now() print "Found {2} files matching {0} in directory {1}"\ .format(parse_config['applicationregex'], parse_config['datadir'], len(files)) print 'Finished parsing in {0}'.format(str(f-s)) # run extra phases if needed run_clean(process_config) run_consolidate(process_config)
bsd-2-clause
Zethes/CGUL
src/CGUL/Network/SocketTCP.hpp
2209
// C++ General Utility Library (mailto:[email protected]) // Copyright (C) 2012-2014, Joshua Brookover and Amber Thrall // All rights reserved. /** @file SocketTCP.hpp */ #pragma once // Configuration #include <CGUL/Config.hpp> // CGUL Includes #include "../Network/IPAddress.hpp" #include "../Utility/String.hpp" // Defines #include "../External/Defines.hpp" namespace CGUL { namespace Network { /** @class SocketTCP SocketTCP.hpp <CGUL/Network/SocketTCP.hpp> * @brief A class to connect to or listen on a TCP network. */ class SocketTCP { # if defined(MSVC) unsigned int __w64 sock; # elif defined(CGUL_WINDOWS) unsigned int sock; # else int sock; # endif # ifdef OpenSSL_FOUND bool connectionSecure; _CGUL_SSL sslHandle; _CGUL_SSL_CTX sslContext; # endif bool MakeNonBlocking(); bool MakeNoDelay(); public: SocketTCP(); ~SocketTCP(); void Connect(const IPAddress& ip, unsigned short port); void Listen(unsigned short port, bool ipv4 = true, int backlog = 10); bool Accept(SocketTCP* socket); void Close(); # ifdef OpenSSL_FOUND void ConnectSSL(const IPAddress& ip, unsigned short port); void ListenSSL(unsigned short port, bool ipv4 = true, int backlog = 10); # endif bool IsConnected(); IPAddress GetIP(); int Send(const void* data, unsigned int size); int Receive(void* data, unsigned int size); int Peek(void* data, unsigned int size); template <typename T> int Send(const T& data); # ifdef CPP_HAS_DOUBLE_REFERENCE template <typename T> int Send(const T&& data); # endif template <typename T> int Receive(T* data); template <typename T> int Peek(T* data); }; } } // Undefines #include "../External/Undefines.hpp" // Implementation #include "SocketTCP_Implement.hpp"
bsd-2-clause
tyskink/STM32_Project
STM32L0_Start/Start1/Src/stm32l0xx_hal_msp.c
8121
/** ****************************************************************************** * File Name : stm32l0xx_hal_msp.c * Description : This file provides code for the MSP Initialization * and de-Initialization codes. ****************************************************************************** ** This notice applies to any and all portions of this file * that are not between comment pairs USER CODE BEGIN and * USER CODE END. Other portions of this file, whether * inserted by the user or by software development tools * are owned by their respective copyright owners. * * COPYRIGHT(c) 2017 STMicroelectronics * * 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 of STMicroelectronics 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 HOLDER 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. * ****************************************************************************** */ /* Includes ------------------------------------------------------------------*/ #include "stm32l0xx_hal.h" extern void _Error_Handler(char *, int); /* USER CODE BEGIN 0 */ /* USER CODE END 0 */ /** * Initializes the Global MSP. */ void HAL_MspInit(void) { /* USER CODE BEGIN MspInit 0 */ /* USER CODE END MspInit 0 */ __HAL_RCC_SYSCFG_CLK_ENABLE(); __HAL_RCC_PWR_CLK_ENABLE(); /* System interrupt init*/ /* SVC_IRQn interrupt configuration */ HAL_NVIC_SetPriority(SVC_IRQn, 0, 0); /* PendSV_IRQn interrupt configuration */ HAL_NVIC_SetPriority(PendSV_IRQn, 0, 0); /* SysTick_IRQn interrupt configuration */ HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0); /* USER CODE BEGIN MspInit 1 */ /* USER CODE END MspInit 1 */ } void HAL_SPI_MspInit(SPI_HandleTypeDef* hspi) { GPIO_InitTypeDef GPIO_InitStruct; if(hspi->Instance==SPI1) { /* USER CODE BEGIN SPI1_MspInit 0 */ /* USER CODE END SPI1_MspInit 0 */ /* Peripheral clock enable */ __HAL_RCC_SPI1_CLK_ENABLE(); /**SPI1 GPIO Configuration PA6 ------> SPI1_MISO PA7 ------> SPI1_MOSI PB3 ------> SPI1_SCK */ GPIO_InitStruct.Pin = GPIO_PIN_6|GPIO_PIN_7; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStruct.Alternate = GPIO_AF0_SPI1; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); GPIO_InitStruct.Pin = GPIO_PIN_3; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStruct.Alternate = GPIO_AF0_SPI1; HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); /* USER CODE BEGIN SPI1_MspInit 1 */ /* USER CODE END SPI1_MspInit 1 */ } else if(hspi->Instance==SPI2) { /* USER CODE BEGIN SPI2_MspInit 0 */ /* USER CODE END SPI2_MspInit 0 */ /* Peripheral clock enable */ __HAL_RCC_SPI2_CLK_ENABLE(); /**SPI2 GPIO Configuration PC2 ------> SPI2_MISO PC3 ------> SPI2_MOSI PB10 ------> SPI2_SCK */ GPIO_InitStruct.Pin = GPIO_PIN_2|GPIO_PIN_3; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStruct.Alternate = GPIO_AF2_SPI2; HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); GPIO_InitStruct.Pin = GPIO_PIN_10; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStruct.Alternate = GPIO_AF5_SPI2; HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); /* USER CODE BEGIN SPI2_MspInit 1 */ /* USER CODE END SPI2_MspInit 1 */ } } void HAL_SPI_MspDeInit(SPI_HandleTypeDef* hspi) { if(hspi->Instance==SPI1) { /* USER CODE BEGIN SPI1_MspDeInit 0 */ /* USER CODE END SPI1_MspDeInit 0 */ /* Peripheral clock disable */ __HAL_RCC_SPI1_CLK_DISABLE(); /**SPI1 GPIO Configuration PA6 ------> SPI1_MISO PA7 ------> SPI1_MOSI PB3 ------> SPI1_SCK */ HAL_GPIO_DeInit(GPIOA, GPIO_PIN_6|GPIO_PIN_7); HAL_GPIO_DeInit(GPIOB, GPIO_PIN_3); /* USER CODE BEGIN SPI1_MspDeInit 1 */ /* USER CODE END SPI1_MspDeInit 1 */ } else if(hspi->Instance==SPI2) { /* USER CODE BEGIN SPI2_MspDeInit 0 */ /* USER CODE END SPI2_MspDeInit 0 */ /* Peripheral clock disable */ __HAL_RCC_SPI2_CLK_DISABLE(); /**SPI2 GPIO Configuration PC2 ------> SPI2_MISO PC3 ------> SPI2_MOSI PB10 ------> SPI2_SCK */ HAL_GPIO_DeInit(GPIOC, GPIO_PIN_2|GPIO_PIN_3); HAL_GPIO_DeInit(GPIOB, GPIO_PIN_10); /* USER CODE BEGIN SPI2_MspDeInit 1 */ /* USER CODE END SPI2_MspDeInit 1 */ } } void HAL_UART_MspInit(UART_HandleTypeDef* huart) { GPIO_InitTypeDef GPIO_InitStruct; if(huart->Instance==USART2) { /* USER CODE BEGIN USART2_MspInit 0 */ /* USER CODE END USART2_MspInit 0 */ /* Peripheral clock enable */ __HAL_RCC_USART2_CLK_ENABLE(); /**USART2 GPIO Configuration PA2 ------> USART2_TX PA3 ------> USART2_RX */ GPIO_InitStruct.Pin = USART_TX_Pin|USART_RX_Pin; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStruct.Alternate = GPIO_AF4_USART2; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); /* USER CODE BEGIN USART2_MspInit 1 */ /* USER CODE END USART2_MspInit 1 */ } } void HAL_UART_MspDeInit(UART_HandleTypeDef* huart) { if(huart->Instance==USART2) { /* USER CODE BEGIN USART2_MspDeInit 0 */ /* USER CODE END USART2_MspDeInit 0 */ /* Peripheral clock disable */ __HAL_RCC_USART2_CLK_DISABLE(); /**USART2 GPIO Configuration PA2 ------> USART2_TX PA3 ------> USART2_RX */ HAL_GPIO_DeInit(GPIOA, USART_TX_Pin|USART_RX_Pin); /* USER CODE BEGIN USART2_MspDeInit 1 */ /* USER CODE END USART2_MspDeInit 1 */ } } void HAL_PCD_MspInit(PCD_HandleTypeDef* hpcd) { if(hpcd->Instance==USB) { /* USER CODE BEGIN USB_MspInit 0 */ /* USER CODE END USB_MspInit 0 */ /* Peripheral clock enable */ __HAL_RCC_USB_CLK_ENABLE(); /* USER CODE BEGIN USB_MspInit 1 */ /* USER CODE END USB_MspInit 1 */ } } void HAL_PCD_MspDeInit(PCD_HandleTypeDef* hpcd) { if(hpcd->Instance==USB) { /* USER CODE BEGIN USB_MspDeInit 0 */ /* USER CODE END USB_MspDeInit 0 */ /* Peripheral clock disable */ __HAL_RCC_USB_CLK_DISABLE(); /* USER CODE BEGIN USB_MspDeInit 1 */ /* USER CODE END USB_MspDeInit 1 */ } } /* USER CODE BEGIN 1 */ /* USER CODE END 1 */ /** * @} */ /** * @} */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
bsd-2-clause
bgyori/pykqml
kqml/cl_json.py
6768
import json import re from kqml import KQMLString from .kqml_list import KQMLList from .kqml_token import KQMLToken from .kqml_exceptions import KQMLException class CLJsonConverter(object): def __init__(self, token_bools=False): self.token_bools = token_bools def cl_from_json(self, json_obj): """Read a json into a KQMLList, recursively using the CLJson paradigm. Note: both false an None are mapped to NIL. This means parsing back will not have exactly the same result as the original json dict/list, in some cases. """ if isinstance(json_obj, str): json_obj = json.loads(json_obj) elif isinstance(json_obj, bytes): json_obj = json.loads(json_obj.decode('utf-8')) elif not isinstance(json_obj, list) and not isinstance(json_obj, dict): raise ValueError("Input must be list, dict, or string/bytes " "json, got %s." % type(json_obj)) return self._cl_from_json(json_obj) def _cl_from_json(self, json_obj): if isinstance(json_obj, list): ret = KQMLList() for elem in json_obj: ret.append(self._cl_from_json(elem)) elif isinstance(json_obj, dict): ret = KQMLList() for key, val in json_obj.items(): ret.set(_key_from_string(key), self._cl_from_json(val)) elif isinstance(json_obj, str): ret = KQMLString(json_obj) elif isinstance(json_obj, bool): if json_obj: if self.token_bools: ret = KQMLToken('TRUE') else: ret = KQMLToken('T') else: if self.token_bools: ret = KQMLToken('FALSE') else: ret = KQMLToken('NIL') elif isinstance(json_obj, int) or isinstance(json_obj, float): ret = str(json_obj) elif json_obj is None: return KQMLToken('NIL') else: raise KQMLException("Unexpected value %s of type %s." % (json_obj, type(json_obj))) return ret def cl_to_json(self, kqml_list): """Recursively convert a KQMLList into a json-style dict/list. Note: Because NIL is used as both None and False in lisp, all NIL is returned as None, even if the value was intended, or originally, False. """ if not isinstance(kqml_list, KQMLList): raise ValueError("Only a KQMLList might be converted into json, " "got %s." % type(kqml_list)) return self._cl_to_json(kqml_list) def _cl_to_json(self, kqml_thing): if isinstance(kqml_thing, KQMLList): # Find all possible keys (things that start with ":") possible_keys = re.findall(':([^\s]+)', kqml_thing.to_string()) # Determine the true keys by checking we can actually get something # from them. true_key_values = {} for k in possible_keys: val = kqml_thing.get(k) if val is not None: true_key_values[k] = val # Extract the return value. if len(true_key_values) == len(kqml_thing)/2: # It's a dict! ret = {} for key, val in true_key_values.items(): ret[_string_from_key(key)] = self._cl_to_json(val) elif not len(true_key_values): # It's a list! ret = [] for item in kqml_thing: ret.append(self._cl_to_json(item)) else: # It's not valid for json. raise KQMLException("Cannot convert %s into json, neither " "list nor dict." % kqml_thing.to_string()) elif isinstance(kqml_thing, KQMLToken): s = kqml_thing.to_string() if s == 'NIL': # This could be either false or None. Because None will almost # always have the same meaning as False in pep-8 compliant # python, but not vice-versa, we choose None. To avoid this, # you can set `token_bools` to True on your converter class, # and True will be mapped to the token TRUE and False to FALSE. ret = None elif (not self.token_bools and s == 'T') \ or (self.token_bools and s == 'TRUE'): ret = True elif self.token_bools and s == 'FALSE': ret = False elif s.isdigit(): ret = int(s) elif s.count('.') == 1 and all(seg.isdigit() for seg in s.split('.')): ret = float(s) else: ret = s elif isinstance(kqml_thing, KQMLString): ret = kqml_thing.string_value() else: raise KQMLException("Unexpected value %s of type %s." % (kqml_thing, type(kqml_thing))) return ret JSON_TO_CL_PATTS = [ # Add a * before upper case at the beginning of lines or after an # underscore. ([re.compile('^([A-Z][a-z])'), re.compile('_([A-Z][a-z])')], lambda m: m.group(0).replace(m.group(1), '') + '*' + m.group(1).lower()), # Replace Upper case not at the beginning or after an underscore. ([re.compile('([A-Z][a-z])')], lambda m: '-' + m.group(1).lower()), # Replace groups of upper case words with surrounding pluses. ([re.compile('([A-Z0-9]+[A-Z0-9_]*[A-Z0-9]*)')], lambda m: '+%s+' % m.group(1).lower().replace('_', '-')), # Convert some other special underscores to -- ([re.compile('([a-z])_([a-z0-9\+*])')], '\\1--\\2'), ] def _key_from_string(key): for patts, repl in JSON_TO_CL_PATTS: for patt in patts: try: new_key = patt.sub(repl, key) except Exception: print("Exeption in key_from_string:", patt.pattern, repl, key) raise key = new_key return key.upper() CL_TO_JSON_PATTS = [ # Replacy -- with _ (re.compile('(--)'), '_'), # Replace *a with A (re.compile('\*([a-z])'), lambda m: m.group(1).upper()), # Replace +abc-d+ with ABC_D (re.compile('\+([a-z0-9-]+)\+'), lambda m: m.group(1).upper().replace('-', '_')), # Replace foo-bar with fooBar (re.compile('-([a-z])'), lambda m: m.group(1).upper()) ] def _string_from_key(s): s = s.lower() for patt, repl in CL_TO_JSON_PATTS: new_s = patt.sub(repl, s) s = new_s return s
bsd-2-clause
twpayne/go-geom
transform/transform.go
740
package transform import "github.com/twpayne/go-geom" // UniqueCoords creates a new coordinate array (with the same layout as the inputs) that // contains each unique coordinate in the coordData. The ordering of the coords are the // same as the input. func UniqueCoords(layout geom.Layout, compare Compare, coordData []float64) []float64 { set := NewTreeSet(layout, compare) stride := layout.Stride() uniqueCoords := make([]float64, 0, len(coordData)) numCoordsAdded := 0 for i := 0; i < len(coordData); i += stride { coord := coordData[i : i+stride] added := set.Insert(geom.Coord(coord)) if added { uniqueCoords = append(uniqueCoords, coord...) numCoordsAdded++ } } return uniqueCoords[:numCoordsAdded*stride] }
bsd-2-clause
jblupus/PyLoyaltyProject
old/project/integration/to_files2.py
7009
import csv import os from json import loads from os.path import exists from old.project import CassandraInsert from old.project import CassandraUtils cassandra = CassandraUtils() QTD_STS_KEY = 'quotedStatus' RTD_STS_KEY = 'retweetedStatus' MT_STS_KEY = 'userMentionEntities' def check_mention_entities(tweet): return RTD_STS_KEY not in tweet and MT_STS_KEY in tweet and len(tweet[MT_STS_KEY]) > 0 def remove_retweets(tts_rows): tts = map(lambda tt_row: loads(tt_row.tweet), tts_rows) return filter(lambda tt: QTD_STS_KEY not in tt and RTD_STS_KEY not in tt, tts) def find_retweets(tts_rows): tts = map(lambda tt_row: loads(tt_row.tweet), tts_rows) rts = [] rts.extend(map(lambda tt: tt[RTD_STS_KEY], filter(lambda tt: RTD_STS_KEY in tt, tts))) rts.extend(map(lambda tt: tt[QTD_STS_KEY], filter(lambda tt: QTD_STS_KEY in tt, tts))) return rts def find_mentions(tts_rows): tts = map(lambda tt_row: loads(tt_row.tweet), tts_rows) return filter(lambda tt: check_mention_entities(tt), tts) def mount_path(dirfile, user_id): return '/home/joao/Dev/Data/Twitter/' + dirfile + str(user_id) + '.csv' def check_file(path): return exists(path) def save_friends(user_id, friends_rows): path = mount_path('friends/', user_id) with open(path, 'w') as writer: friends_ids = map(lambda friend: friend.friend_id, friends_rows) for friend_id in friends_ids: writer.write(str(friend_id) + '\n') writer.flush() writer.close() def delete_file(path): if os.stat(path).st_size == 0: os.remove(path) def friends2file(): print "Saving Friends..." seeds = cassandra.find_seeds() c = 0 for seeds_row in seeds: user_id = seeds_row.user_id friends_rows = cassandra.find_friends(user_id=user_id) ci = CassandraInsert() for friend_row in friends_rows: ci.insert_friendship({'user_id': user_id, 'friend_id': friend_row.friend_id}) c = c + 1 print 'Users: ', c print "Friends Saved..." def save_likes(user_id, likes_rows): lks_tts = map(lambda row: loads(row.tweet), likes_rows) with open(mount_path('likes/', user_id), 'w') as csvfile: fieldnames = ['alter_id', 'tweet_id'] writer = csv.DictWriter(csvfile, fieldnames=fieldnames) writer.writeheader() for tt in lks_tts: writer.writerow({ 'alter_id': tt['user']['id'], 'tweet_id': tt['id'] }) def likes2file(): print "Saving likes..." seeds = cassandra.find_seeds() c = 0 for seeds_row in seeds: user_id = seeds_row.user_id ci = CassandraInsert() likes = map(lambda lk: loads(lk.tweet), cassandra.find_likes(user_id=user_id)) for like in likes: lk = { 'user_id': user_id, 'tweet_id': like['id'], 'alter_id': like['user']['id']} ci.insert_lk_interaction(lk) tt = { 'tweet_id': like['id'], 'date': like['createdAt'], 'lang': like['lang'], 'text': like['text'], 'user_id': like['user']['id']} ci.insert_tweet(tt) usr = { 'id': like['user']['id'], 'flw_count': like['user']['followersCount'], 'frd_count': like['user']['friendsCount'], 'is_protected': like['user']['isProtected'], 'is_verified': like['user']['isVerified'], 'lk_count': like['user']['favouritesCount'], 'lang': like['user']['lang'], 'tt_count': like['user']['statusesCount']} ci.insert_user(usr) c = c + 1 print 'Users: ', c print "Likes saved" def save_retweets(ci, user_id, tweets_rows): retweets = find_retweets(tweets_rows) for tt in retweets: rt = { 'user_id': user_id, 'tweet_id': tt['id'], 'alter_id': tt['user']['id']} ci.insert_rt_interaction(rt) _tt = { 'tweet_id': tt['id'], 'date': tt['createdAt'], 'lang': tt['lang'], 'text': tt['text'], 'user_id': tt['user']['id']} ci.insert_tweet(_tt) usr = { 'id': tt['user']['id'], 'flw_count': tt['user']['followersCount'], 'frd_count': tt['user']['friendsCount'], 'is_protected': tt['user']['isProtected'], 'is_verified': tt['user']['isVerified'], 'lk_count': tt['user']['favouritesCount'], 'lang': tt['user']['lang'], 'tt_count': tt['user']['statusesCount']} ci.insert_user(usr) def save_mentions(ci, user_id, tweets_rows): tweets = find_mentions(tweets_rows) for tt in tweets: for me in tt[MT_STS_KEY]: me = { 'user_id': user_id, 'tweet_id': tt['id'], 'alter_id': me['id']} ci.insert_mt_interaction(me) _tt = { 'tweet_id': tt['id'], 'date': tt['createdAt'], 'lang': tt['lang'], 'text': tt['text'], 'user_id': tt['user']['id']} ci.insert_tweet(_tt) usr = { 'id': tt['user']['id'], 'flw_count': tt['user']['followersCount'], 'frd_count': tt['user']['friendsCount'], 'is_protected': tt['user']['isProtected'], 'is_verified': tt['user']['isVerified'], 'lk_count': tt['user']['favouritesCount'], 'lang': tt['user']['lang'], 'tt_count': tt['user']['statusesCount']} ci.insert_user(usr) def save_tweets(ci, user_id, tweets_rows): save_retweets(ci, user_id, tweets_rows) save_mentions(ci, user_id, tweets_rows) tweets = remove_retweets(tweets_rows) for tt in tweets: _tt = { 'tweet_id': tt['id'], 'date': tt['createdAt'], 'lang': tt['lang'], 'text': tt['text'], 'user_id': tt['user']['id']} ci.insert_tweet(_tt) usr = { 'id': tt['user']['id'], 'flw_count': tt['user']['followersCount'], 'frd_count': tt['user']['friendsCount'], 'is_protected': tt['user']['isProtected'], 'is_verified': tt['user']['isVerified'], 'lk_count': tt['user']['favouritesCount'], 'lang': tt['user']['lang'], 'tt_count': tt['user']['statusesCount']} ci.insert_user(usr) def tweets2file(): print "Saving Tweets..." seeds = cassandra.find_seeds() ci = CassandraInsert() c = 0 for seeds_row in seeds: user_id = seeds_row.user_id tweets_rows = cassandra.find_tweets(user_id=user_id) save_tweets(ci=ci, user_id=user_id, tweets_rows=tweets_rows) c = c + 1 print 'Users: ', c print "Tweets saved"
bsd-2-clause
DomT4/brew
docs/Taps.md
3684
# Taps (third-party repositories) `brew tap` adds more repositories to the list of formulae that `brew` tracks, updates, and installs from. By default, `tap` assumes that the repositories come from GitHub, but the command isn't limited to any one location. ## The command (`brew tap`) * `brew tap` without arguments lists the currently tapped repositories. For example: ```sh $ brew tap homebrew/core mistydemeo/tigerbrew dunn/emacs ``` * `brew tap <user/repo>` makes a shallow clone of the repository at https://github.com/user/repo. After that, `brew` will be able to work on those formulae as if they were in Homebrew's canonical repository. You can install and uninstall them with `brew [un]install`, and the formulae are automatically updated when you run `brew update`. (See below for details about how `brew tap` handles the names of repositories.) * `brew tap <user/repo> <URL>` makes a shallow clone of the repository at URL. Unlike the one-argument version, URL is not assumed to be GitHub, and it doesn't have to be HTTP. Any location and any protocol that Git can handle is fine. * Add `--full` to either the one- or two-argument invocations above, and Git will make a complete clone rather than a shallow one. Full is the default for Homebrew developers. * `brew tap --repair` migrates tapped formulae from a symlink-based to directory-based structure. (This should only need to be run once.) * `brew untap user/repo [user/repo user/repo ...]` removes the given taps. The repositories are deleted and `brew` will no longer be aware of their formulae. `brew untap` can handle multiple removals at once. ## Repository naming conventions and assumptions * On GitHub, your repository must be named `homebrew-something` in order to use the one-argument form of `brew tap`. The prefix 'homebrew-' is not optional. (The two-argument form doesn't have this limitation, but it forces you to give the full URL explicitly.) * When you use `brew tap` on the command line, however, you can leave out the 'homebrew-' prefix in commands. That is, `brew tap username/foobar` can be used as a shortcut for the long version: `brew tap username/homebrew-foobar`. `brew` will automatically add back the 'homebrew-' prefix whenever it's necessary. ## Formula duplicate names If your tap contains a formula that is also present in [`homebrew/core`](https://github.com/Homebrew/homebrew-core), that's fine, but it means that you must install it explicitly by default. If you would like to prioritise a tap over `homebrew/core`, you can use `brew tap-pin username/repo` to pin the tap, and use `brew tap-unpin username/repo` to revert the pin. Whenever a `brew install foo` command is issued, `brew` will find which formula to use by searching in the following order: * pinned taps * core formulae * other taps If you need a formula to be installed from a particular tap, you can use fully qualified names to refer to them. For example, you can create a tap for an alternative `vim` formula. Without pinning it, the behaviour will be ```sh brew install vim # installs from homebrew/core brew install username/repo/vim # installs from your custom repo ``` However if you pin the tap with `brew tap-pin username/repo`, you will need to use `homebrew/core` to refer to the core formula. ```sh brew install vim # installs from your custom repo brew install homebrew/core/vim # installs from homebrew/core ``` Do note that pinned taps are prioritized only when the formula name is directly given by you, i.e. it will not influence formulae automatically installed as dependencies.
bsd-2-clause