answer
stringlengths
15
1.25M
#ifndef _KEY_VALUE_H_ #define _KEY_VALUE_H_ typedef struct key_value { struct key_value *next; void *key; void *value; } key_value_t; key_value_t *key_value_alloc(void); key_value_t *key_value_add(key_value_t *kv, void *key, void *value); void key_value_free(key_value_t *kv); void key_value_free_full(key_value_t *kv); int <API key>(key_value_t *kv); void key_value_dump(key_value_t *nl_msg); char **key_value_to_env(key_value_t *kv); int key_value_set(key_value_t *kv, char *key, char *value); int key_value_cpy(key_value_t *kv, char *key, char *value); int key_value_flag_set(key_value_t *kv, char *key, int bits, int flag); void key_value_free_all(key_value_t *kv); #endif /* _KEY_VALUE_H_ */
package zoedb.exception; public class <API key> extends Exception { public <API key>() { super("The type has not been registered with the factory"); } public <API key>(String type, Class thrower) { super(String.format("The type '%s' has not bneen registered with '%s'", type, thrower.getCanonicalName())); } }
package org.dbhaskaran.javadb; import java.sql.*; import java.util.Scanner; public class JDBCSimpleSearch { private static Connection connection = null; private static PreparedStatement statement = null; private static ResultSet resultSet = null; private static Scanner in = null; public static void main(String[] args) throws SQLException { try { in = new Scanner(System.in); System.out.println("Please enter a order item:"); String orderitem = in.nextLine(); String query = "SELECT * FROM Orders WHERE Item = ?"; connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/restaurant?" + "autoReconnect=true&useSSL=false&user=root&password=tiger"); statement = connection.prepareStatement(query); statement.setString(1, orderitem); resultSet = statement.executeQuery(); if (!resultSet.next()) { System.out.printf("No customer ordered %s", orderitem); } while (resultSet.next()) { String fname = resultSet.getString("FirstName"); String lname = resultSet.getString("LastName"); String item = resultSet.getString("Item"); System.out.println("Customer Name: " + fname + " " + lname); System.out.println("Customer Order: " + item); } } catch (SQLException sqe) { sqe.printStackTrace(); } finally { try { in.close(); resultSet.close(); statement.close(); connection.close(); } catch (Exception e) { } } } }
package com.sen.john.mythemovies.adapters.tabs; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.<API key>; import android.support.v4.app.ListFragment; import java.util.ArrayList; import java.util.List; public class TabsAdapter extends <API key> { private List<Fragment> tabs; public TabsAdapter(FragmentManager fm) { super(fm); setTabs(); } private void setTabs() { tabs = new ArrayList<>(); ListFragment uno = new ListFragment(); ListFragment myMovies = new ListFragment(); ListFragment theMoviesDbMovies = new ListFragment(); tabs.add(uno); tabs.add(myMovies); tabs.add(theMoviesDbMovies); } @Override public Fragment getItem(int position) { return tabs.get(position); } @Override public int getCount() { return tabs.size(); } }
#include <assert.h> #include <stdint.h> #include <stdatomic.h> #include <pthread.h> atomic_int vars[3]; atomic_int atom_1_r1_2; atomic_int atom_1_r4_0; atomic_int atom_1_r7_1; atomic_int atom_1_r9_0; void *t0(void *arg){ label_1:; <API key>(&vars[0], 2, <API key>); return NULL; } void *t1(void *arg){ label_2:; int v2_r1 = <API key>(&vars[0], <API key>); int v3_r3 = v2_r1 ^ v2_r1; int v6_r4 = <API key>(&vars[1+v3_r3], <API key>); <API key>(&vars[1], 1, <API key>); int v8_r7 = <API key>(&vars[1], <API key>); int v9_r8 = v8_r7 ^ v8_r7; int v12_r9 = <API key>(&vars[2+v9_r8], <API key>); int v23 = (v2_r1 == 2); <API key>(&atom_1_r1_2, v23, <API key>); int v24 = (v6_r4 == 0); <API key>(&atom_1_r4_0, v24, <API key>); int v25 = (v8_r7 == 1); <API key>(&atom_1_r7_1, v25, <API key>); int v26 = (v12_r9 == 0); <API key>(&atom_1_r9_0, v26, <API key>); return NULL; } void *t2(void *arg){ label_3:; <API key>(&vars[2], 1, <API key>); <API key>(&vars[0], 1, <API key>); return NULL; } int main(int argc, char *argv[]){ pthread_t thr0; pthread_t thr1; pthread_t thr2; atomic_init(&vars[2], 0); atomic_init(&vars[0], 0); atomic_init(&vars[1], 0); atomic_init(&atom_1_r1_2, 0); atomic_init(&atom_1_r4_0, 0); atomic_init(&atom_1_r7_1, 0); atomic_init(&atom_1_r9_0, 0); pthread_create(&thr0, NULL, t0, NULL); pthread_create(&thr1, NULL, t1, NULL); pthread_create(&thr2, NULL, t2, NULL); pthread_join(thr0, NULL); pthread_join(thr1, NULL); pthread_join(thr2, NULL); int v13 = <API key>(&vars[0], <API key>); int v14 = (v13 == 2); int v15 = <API key>(&atom_1_r1_2, <API key>); int v16 = <API key>(&atom_1_r4_0, <API key>); int v17 = <API key>(&atom_1_r7_1, <API key>); int v18 = <API key>(&atom_1_r9_0, <API key>); int v19_conj = v17 & v18; int v20_conj = v16 & v19_conj; int v21_conj = v15 & v20_conj; int v22_conj = v14 & v21_conj; if (v22_conj == 1) assert(0); return 0; }
#include "stdafx.h" #include "ahumantarget.h" // // class EffectorNeck : public MindEffector { private: bool continueRunFlag; public: EffectorNeck( EffectorArea *area ); virtual ~EffectorNeck(); virtual const char *getClass() { return( "EffectorNeck" ); }; public: // effector lifecycle virtual void createEffector( <API key> *createInfo ); virtual void configureEffector( Xml config ); virtual void startEffector() {}; virtual void stopEffector() {}; virtual void <API key>( NeuroLink *link , NeuroSignal *signal ) {}; private: void <API key>( <API key> *createInfo , <API key> *connector ); void <API key>( <API key> *createInfo , <API key> *connector ); NeuroSignal *sourceHandler( NeuroLink *link , NeuroLinkSource *point ); NeuroSignalSet *targetHandler( NeuroLink *link , NeuroLinkTarget *point , NeuroSignal *srcData ); private: Xml config; }; MindEffector *AHumanTarget::createNeck( EffectorArea *area ) { return( new EffectorNeck( area ) ); } // // EffectorNeck::EffectorNeck( EffectorArea *p_area ) : MindEffector( p_area ) { attachLogger(); continueRunFlag = false; } EffectorNeck::~EffectorNeck() { } void EffectorNeck::configureEffector( Xml p_config ) { config = p_config; } void EffectorNeck::createEffector( <API key> *createInfo ) { // set connectors TargetRegionDef *info = MindEffector::getEffectorInfo(); MindRegionTypeDef *type = info -> getType(); ClassList<<API key>>& connectors = type -> getConnectors(); for( int k = 0; k < connectors.count(); k++ ) { <API key> *connector = connectors.get( k ); if( connector -> isTarget() ) <API key>( createInfo , connector ); else <API key>( createInfo , connector ); } } void EffectorNeck::<API key>( <API key> *createInfo , <API key> *connector ) { NeuroLinkSource *source = new NeuroLinkSource(); source -> create( this , connector -> getId() ); source -> setHandler( ( MindRegion::<API key> )&EffectorNeck::sourceHandler ); } void EffectorNeck::<API key>( <API key> *createInfo , <API key> *connector ) { NeuroLinkTarget *target = new NeuroLinkTarget(); target -> create( this , connector -> getId() ); target -> setHandler( ( MindRegion::<API key> )&EffectorNeck::targetHandler ); } NeuroSignal *EffectorNeck::sourceHandler( NeuroLink *link , NeuroLinkSource *point ) { return( NULL ); } NeuroSignalSet *EffectorNeck::targetHandler( NeuroLink *link , NeuroLinkTarget *point , NeuroSignal *srcData ) { return( NULL ); }
# GenCumulativeSkyMtx # Ladybug: A Plugin for Environmental Analysis (GPL) started by Mostapha Sadeghipour Roudsari # This file is part of Ladybug. # Ladybug is free software; you can redistribute it and/or modify # or (at your option) any later version. # Ladybug is distributed in the hope that it will be useful, # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ghenv.Component.Name = "<API key>" ghenv.Component.NickName = 'genCumulativeSkyMtx' ghenv.Component.Message = 'VER 0.0.61\nNOV_05_2015' ghenv.Component.Category = "Ladybug" ghenv.Component.SubCategory = "2 | <API key>" #compatibleLBVersion = VER 0.0.59\nFEB_01_2015 try: ghenv.Component.<API key> = "2" except: pass import os import scriptcontext as sc from clr import AddReference AddReference('Grasshopper') import Grasshopper.Kernel as gh from itertools import izip import shutil def date2Hour(month, day, hour): # fix the end day numOfDays = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334] # dd = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] JD = numOfDays[int(month)-1] + int(day) return (JD - 1) * 24 + hour def hour2Date(hour): monthList = ['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'] numOfDays = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365] numOfHours = [24 * numOfDay for numOfDay in numOfDays] for h in range(len(numOfHours)-1): if hour <= numOfHours[h+1]: month = h + 1; break if hour == 0: day = 1 elif (hour)%24 == 0: day = int((hour - numOfHours[h]) / 24) else: day = int((hour - numOfHours[h]) / 24) + 1 time = hour%24 + 0.5 return str(day), str(month), str(time) def getRadiationValues(epw_file, analysisPeriod, weaFile): # start hour and end hour stHour = 0 endHour = 8760 epwfile = open(epw_file,"r") for lineCount, line in enumerate(epwfile): hour = lineCount - 8 if int(stHour) <= hour <= int(endHour): dirRad = (line.split(',')[14]) difRad = (line.split(',')[15]) day, month, time = hour2Date(hour) weaFile.write(month + " " + day + " " + time + " " + dirRad + " " + difRad + "\n") epwfile.close() return weaFile def weaHeader(epwFileAddress, lb_preparation): locName, lat, long, timeZone, elev, dataStr = lb_preparation.epwLocation(epwFileAddress) #print locName, lat, long, timeZone, elev return "place " + locName + "\n" + \ "latitude " + lat + "\n" + \ "longitude " + `-float(long)` + "\n" + \ "time_zone " + `-float(timeZone) * 15` + "\n" + \ "site_elevation " + elev + "\n" + \ "<API key> 1\n" def epw2wea(weatherFile, analysisPeriod, lb_preparation): outputFile = weatherFile.replace(".epw", ".wea") header = weaHeader(weatherFile, lb_preparation) weaFile = open(outputFile, 'w') weaFile.write(header) weaFile = getRadiationValues(weatherFile, analysisPeriod, weaFile) weaFile.close() return outputFile def main(epwFile, skyType, workingDir, useOldRes): # import the classes if sc.sticky.has_key('ladybug_release'): try: if not sc.sticky['ladybug_release'].isCompatible(ghenv.Component): return -1 except: warning = "You need a newer version of Ladybug to use this compoent." + \ "Use updateLadybug component to update userObjects.\n" + \ "If you have already updated userObjects drag Ladybug_Ladybug component " + \ "into canvas and try again." w = gh.<API key>.Warning ghenv.Component.AddRuntimeMessage(w, warning) return -1 lb_preparation = sc.sticky["ladybug_Preparation"]() # make working directory if workingDir: workingDir = lb_preparation.removeBlankLight(workingDir) workingDir = lb_preparation.makeWorkingDir(workingDir) # make sure the directory has been created if workingDir == -1: return -2 workingDrive = workingDir[0:1] # GenCumulativeSky gendaymtxFile = os.path.join(workingDir, 'gendaymtx.exe') if not os.path.isfile(gendaymtxFile): # let's see if we can grab it from radiance folder if os.path.isfile("c:/radiance/bin/gendaymtx.exe"): # just copy this file shutil.copyfile("c:/radiance/bin/gendaymtx.exe", gendaymtxFile) else: # download the file lb_preparation.downloadGendaymtx(workingDir) #check if the file is there if not os.path.isfile(gendaymtxFile) or os.path.getsize(gendaymtxFile)< 15000 : return -3 ## check for epw file to be connected if epwFile != None and epwFile[-3:] == 'epw': if not os.path.isfile(epwFile): print "Can't find epw file at " + epwFile w = gh.<API key>.Warning ghenv.Component.AddRuntimeMessage(w, "Can't find epw file at " + epwFile) return -1 # import data from epw file locName, lat, lngt, timeZone, elev, locationStr = lb_preparation.epwLocation(epwFile) newLocName = lb_preparation.removeBlank(locName) # make new folder for each city subWorkingDir = lb_preparation.makeWorkingDir(workingDir + "\\" + newLocName) print 'Current working directory is set to: ', subWorkingDir # copy .epw file to sub-directory weatherFileAddress = lb_preparation.copyFile(epwFile, subWorkingDir + "\\" + newLocName + '.epw') # create weaFile weaFile = epw2wea(weatherFileAddress, [], lb_preparation) outputFile = weaFile.replace(".wea", ".mtx") outputFileDif = weaFile.replace(".wea", "_dif_" + `skyType` + ".mtx") outputFileDir = weaFile.replace(".wea", "_dir_" + `skyType` + ".mtx") # check if the study is already ran for this weather file if useOldRes and os.path.isfile(outputFileDif) and os.path.isfile(outputFileDir): # ask the user if he wants to re-run the study print "Sky matrix files for this epw file are already existed on your system.\n" + \ "The component won't recalculate the sky and imports the available result.\n" + \ "In case you don't want to use these files, set useOldRes input to False and re-run the study.\n" + \ "If you found the lines above confusing just ignore it! It's all fine. =)\n" else: batchFile = weaFile.replace(".wea", ".bat") command = "@echo off \necho.\n echo HELLO " + os.getenv("USERNAME").upper()+ "! " + \ "DO NOT CLOSE THIS WINDOW. \necho.\necho IT WILL BE CLOSED AUTOMATICALLY WHEN THE CALCULATION IS OVER!\n" + \ "echo.\necho AND MAY TAKE FEW MINUTES...\n" + \ "echo.\n" + \ "echo CALCULATING DIFFUSE COMPONENT OF THE SKY...\n" + \ workingDir + "\\gendaymtx -m " + str(n) + " -s -O1 " + weaFile + "> " + outputFileDif + "\n" + \ "echo.\necho CALCULATING DIRECT COMPONENT OF THE SKY...\n" + \ workingDir + "\\gendaymtx -m " + str(n) + " -d -O1 " + weaFile + "> " + outputFileDir file = open(batchFile, 'w') file.write(command) file.close() os.system(batchFile) return outputFileDif, outputFileDir, newLocName, lat, lngt, timeZone else: print "epwWeatherFile address is not a valid .epw file" w = gh.<API key>.Warning ghenv.Component.AddRuntimeMessage(w, "epwWeatherFile address is not a valid .epw file") return -1 else: print "You should first let the Ladybug fly..." w = gh.<API key>.Warning ghenv.Component.AddRuntimeMessage(w, "You should first let the Ladybug fly...") return -1 def readMTXFile(daylightMtxDif, daylightMtxDir, n, newLocName, lat, lngt, timeZone): # All the patches on top high get the same values so maybe # I should re-create the geometry 577 instead of 580 # and keep in mind that first patch is ground! # I create the dictionary only for sky patches and don't collect the data # for the first patch # this line could have saved me 5 hours skyPatchesDict = {1 : 145, 2 : 580 - 3} <API key> = {1: [30, 30, 24, 24, 18, 12, 6, 1], 2: [60, 60, 60, 60, 48, 48, 48, 48, 36, 36, 24, 24, 12, 12, 1]} # first row is horizon and last row is the one strConv = {1 : [0.0435449227, 0.0416418006, 0.0473984151, 0.0406730411, 0.0428934136, 0.0445221864, 0.0455168385, 0.0344199465], 2: [0.0113221971, 0.0111894547, 0.0109255262, 0.0105335058, 0.0125224872, 0.0117312774, 0.0108025291, 0.00974713106, 0.011436609, 0.00974295956, 0.0119026242, 0.00905126163, 0.0121875626, 0.00612971396, 0.00921483254]} numOfSkyPatches = skyPatchesDict[n] # create an empty dictionary radValuesDict = {} for skyPatch in range(numOfSkyPatches): radValuesDict[skyPatch] = {} resFileDif = open(daylightMtxDif, "r") resFileDir = open(daylightMtxDir, "r") def getValue(line, rowNumber): R, G, B = line.split(' ') value = (.265074126 * float(R) + .670114631 * float(G) + .064811243 * float(B)) * strConv[n][rowNumber] return value lineCount = 0 extraHeadingLines = 0 # no heading warnOff = False failedHours = {} for difLine, dirLine in izip(resFileDif, resFileDir): # each line is the data for each hour for a single patch # new version of gendaymtx genrates a header # this is a check to make sure the component will work for both versions if lineCount == 0 and difLine.startswith("#?RADIANCE"): # the file has a header extraHeadingLines = -8 if lineCount + extraHeadingLines < 0: # pass heading line lineCount += 1 continue # these lines is an empty line to separate patches do let's pass them hour = (lineCount + 1 + extraHeadingLines)% 8761 #print lineCount, hour if hour != 0: patchNumber = int((lineCount + 1 + extraHeadingLines) /8761) # first patch is ground! if patchNumber != 0: #and patchNumber < numOfSkyPatches: for rowCount, patchCountInRow in enumerate(<API key>[n]): if patchNumber - 1 < sum(<API key>[n][:rowCount+1]): rowNumber = rowCount # print rowNumber break try: difValue = getValue(difLine, rowNumber) dirValue = getValue(dirLine, rowNumber) except Exception, e: value = 0 if not warnOff: print "genDayMtx returns null Values for few hours. The study will run anyways." + \ "\nMake sure that you are using an standard epw file." + \ "\nThe failed hours are listed below in [Month/Day @Hour] format." warnOff = True day, month, time = hour2Date(hour - 1) if hour-1 not in failedHours.keys(): failedHours[hour-1] = [day, month, time] print "Failed to read the results > " + month + "/" + day + " @" + time try: radValuesDict[patchNumber-1][hour] = [difValue, dirValue] except:print patchNumber-1, hour, value lineCount += 1 resFileDif.close() resFileDir.close() class <API key>(object): def __init__(self, valuesDict, locationName, lat, lngt, timeZone): self.d = valuesDict self.location = locationName self.lat = lat self.lngt = lngt self.timeZone = timeZone return <API key>(radValuesDict, newLocName, lat, lngt, timeZone) if _runIt and _epwFile!=None: if _skyDensity_ == None: n = 1 #Tregenza Sky else: n = _skyDensity_%2 + 1 result = main(_epwFile, n, workingDir_, useOldRes_) w = gh.<API key>.Warning if result== -3: warning = 'Download failed!!! You need GenDayMtx.exe to use this component.' + \ '\nPlease check your internet connection, and try again!' print warning ghenv.Component.AddRuntimeMessage(w, warning) elif result == -2: warning = 'Working directory cannot be created! Please set workingDir to a new path' print warning ghenv.Component.AddRuntimeMessage(w, warning) elif result == -1: pass else: <API key>, <API key>, newLocName, lat, lngt, timeZone = result cumulativeSkyMtx = readMTXFile(<API key>, <API key>, n, newLocName, lat, lngt, timeZone) else: warn = "Set runIt to True and connect a valid epw file address" print warn #ghenv.Component.AddRuntimeMessage(gh.<API key>.Warning, warn)
# -*- mode: cmake; tab-width: 2; indent-tabs-mode: t; truncate-lines: t; compile-command: "cmake -Wdev" -*- # vim: set filetype=cmake autoindent tabstop=2 shiftwidth=2 noexpandtab softtabstop=2 nowrap: # defines that must be present in config.h for our headers set (ewoms_CONFIG_VAR HAVE_QUAD HAVE_VALGRIND ) # dependencies set (ewoms_DEPS # compile with C++0x/11 support if available "CXX11Features REQUIRED" # DUNE prerequisites "dune-common REQUIRED" "dune-localfunctions REQUIRED" "dune-geometry REQUIRED" "dune-grid REQUIRED" "dune-istl REQUIRED" "opm-material REQUIRED" # valgrind client requests "Valgrind" # quadruple precision floating point calculations "Quadmath" )
c c\BeginDoc c c\Name: dgetv0 c c\Description: c Generate a random initial residual vector for the Arnoldi process. c Force the residual vector to be in the range of the operator OP. c c\Usage: c call dgetv0 c ( IDO, BMAT, ITRY, INITV, N, J, V, LDV, RESID, RNORM, c IPNTR, WORKD, IERR ) c c\Arguments c IDO Integer. (INPUT/OUTPUT) c Reverse communication flag. IDO must be zero on the first c call to dgetv0. c c IDO = 0: first call to the reverse communication interface c IDO = -1: compute Y = OP * X where c IPNTR(1) is the pointer into WORKD for X, c IPNTR(2) is the pointer into WORKD for Y. c This is for the initialization phase to force the c starting vector into the range of OP. c IDO = 2: compute Y = B * X where c IPNTR(1) is the pointer into WORKD for X, c IPNTR(2) is the pointer into WORKD for Y. c IDO = 99: done c c c BMAT Character*1. (INPUT) c BMAT specifies the type of the matrix B in the (generalized) c eigenvalue problem A*x = lambda*B*x. c B = 'I' -> standard eigenvalue problem A*x = lambda*x c B = 'G' -> generalized eigenvalue problem A*x = lambda*B*x c c ITRY Integer. (INPUT) c ITRY counts the number of times that dgetv0 is called. c It should be set to 1 on the initial call to dgetv0. c c INITV Logical variable. (INPUT) c .TRUE. => the initial residual vector is given in RESID. c .FALSE. => generate a random initial residual vector. c c N Integer. (INPUT) c Dimension of the problem. c c J Integer. (INPUT) c Index of the residual vector to be generated, with respect to c the Arnoldi process. J > 1 in case of a "restart". c c V Double precision N by J array. (INPUT) c The first J-1 columns of V contain the current Arnoldi basis c if this is a "restart". c c LDV Integer. (INPUT) c Leading dimension of V exactly as declared in the calling c program. c c RESID Double precision array of length N. (INPUT/OUTPUT) c Initial residual vector to be generated. If RESID is c provided, force RESID into the range of the operator OP. c c RNORM Double precision scalar. (OUTPUT) c B-norm of the generated residual. c c IPNTR Integer array of length 3. (OUTPUT) c c WORKD Double precision work array of length 2*N. (REVERSE COMMUNICATION). c On exit, WORK(1:N) = B*RESID to be used in SSAITR. c c IERR Integer. (OUTPUT) c = 0: Normal exit. c = -1: Cannot generate a nontrivial restarted residual vector c in the range of the operator OP. c c\EndDoc c c c c\BeginLib c c\Local variables: c xxxxxx real c c\References: c 1. D.C. Sorensen, "Implicit Application of Polynomial Filters in c a k-Step Arnoldi Method", SIAM J. Matr. Anal. Apps., 13 (1992), c pp 357-385. c 2. R.B. Lehoucq, "Analysis and Implementation of an Implicitly c Restarted Arnoldi Iteration", Rice University Technical Report c TR95-13, Department of Computational and Applied Mathematics. c c\Routines called: c second ARPACK utility routine for timing. c dvout ARPACK utility routine for vector output. c dlarnv LAPACK routine for generating a random vector. c dgemv Level 2 BLAS routine for matrix vector multiplication. c dcopy Level 1 BLAS that copies one vector to another. c ddot Level 1 BLAS that computes the scalar product of two vectors. c dnrm2 Level 1 BLAS that computes the norm of a vector. c c\Author c Danny Sorensen Phuong Vu c Richard Lehoucq CRPC / Rice University c Dept. of Computational & Houston, Texas c Applied Mathematics c Rice University c Houston, Texas c c\SCCS Information: @( c FILE: getv0.F SID: 2.7 DATE OF SID: 04/07/99 RELEASE: 2 c c\EndLib c c c subroutine dgetv0 & ( ido, bmat, itry, initv, n, j, v, ldv, resid, rnorm, & ipntr, workd, ierr ) c c % c | Include files for debugging and timing information | c % c include 'debug.fi' include 'stat.fi' c c % c | Scalar Arguments | c % c character bmat*1 logical initv integer ido, ierr, itry, j, ldv, n Double precision & rnorm c c % c | Array Arguments | c % c integer ipntr(3) Double precision & resid(n), v(ldv,j), workd(2*n) c c % c | Parameters | c % c Double precision & one, zero parameter (one = 1.0D+0, zero = 0.0D+0) c c % c | Local Scalars & Arrays | c % c logical first, inits, orth integer idist, iseed(4), iter, msglvl, jj Double precision & rnorm0 save first, iseed, inits, iter, msglvl, orth, rnorm0 c c % c | External Subroutines | c % c external dlarnv, dvout, dcopy, dgemv, second c c % c | External Functions | c % c Double precision & ddot, dnrm2 external ddot, dnrm2 c c % c | Intrinsic Functions | c % c intrinsic abs, sqrt c c % c | Data Statements | c % c data inits /.true./ c c % c | Executable Statements | c % c c c % c | Initialize the seed of the LAPACK | c | random number generator | c % c if (inits) then iseed(1) = 1 iseed(2) = 3 iseed(3) = 5 iseed(4) = 7 inits = .false. end if c if (ido .eq. 0) then c c % c | Initialize timing statistics | c | & message level for debugging | c % c call second (t0) msglvl = mgetv0 c ierr = 0 iter = 0 first = .FALSE. orth = .FALSE. c c % c | Possibly generate a random starting vector in RESID | c | Use a LAPACK random number generator used by the | c | matrix generation routines. | c | idist = 1: uniform (0,1) distribution; | c | idist = 2: uniform (-1,1) distribution; | c | idist = 3: normal (0,1) distribution; | c % c if (.not.initv) then idist = 2 call dlarnv (idist, iseed, n, resid) end if c c % c | Force the starting vector into the range of OP to handle | c | the generalized problem when B is possibly (singular). | c % c call second (t2) if (bmat .eq. 'G') then nopx = nopx + 1 ipntr(1) = 1 ipntr(2) = n + 1 call dcopy (n, resid, 1, workd, 1) ido = -1 go to 9000 end if end if c c % c | Back from computing OP*(initial-vector) | c % c if (first) go to 20 c c % c | Back from computing B*(<API key>) | c % c if (orth) go to 40 c if (bmat .eq. 'G') then call second (t3) tmvopx = tmvopx + (t3 - t2) end if c c % c | Starting vector is now in the range of OP; r = OP*r; | c | Compute B-norm of starting vector. | c % c call second (t2) first = .TRUE. if (bmat .eq. 'G') then nbx = nbx + 1 call dcopy (n, workd(n+1), 1, resid, 1) ipntr(1) = n + 1 ipntr(2) = 1 ido = 2 go to 9000 else if (bmat .eq. 'I') then call dcopy (n, resid, 1, workd, 1) end if c 20 continue c if (bmat .eq. 'G') then call second (t3) tmvbx = tmvbx + (t3 - t2) end if c first = .FALSE. if (bmat .eq. 'G') then rnorm0 = ddot (n, resid, 1, workd, 1) rnorm0 = sqrt(abs(rnorm0)) else if (bmat .eq. 'I') then rnorm0 = dnrm2(n, resid, 1) end if rnorm = rnorm0 c c % c | Exit if this is the very first Arnoldi step | c % c if (j .eq. 1) go to 50 c c % c | Otherwise need to B-orthogonalize the starting vector against | c | the current Arnoldi basis using Gram-Schmidt with iter. ref. | c | This is the case where an invariant subspace is encountered | c | in the middle of the Arnoldi factorization. | c | | c | s = V^{T}*B*r; r = r - V*s; | c | | c | Stopping criteria used for iter. ref. is discussed in | c | Parlett's book, page 107 and in Gragg & Reichel TOMS paper. | c % c orth = .TRUE. 30 continue c call dgemv ('T', n, j-1, one, v, ldv, workd, 1, & zero, workd(n+1), 1) call dgemv ('N', n, j-1, -one, v, ldv, workd(n+1), 1, & one, resid, 1) c c % c | Compute the B-norm of the orthogonalized starting vector | c % c call second (t2) if (bmat .eq. 'G') then nbx = nbx + 1 call dcopy (n, resid, 1, workd(n+1), 1) ipntr(1) = n + 1 ipntr(2) = 1 ido = 2 go to 9000 else if (bmat .eq. 'I') then call dcopy (n, resid, 1, workd, 1) end if c 40 continue c if (bmat .eq. 'G') then call second (t3) tmvbx = tmvbx + (t3 - t2) end if c if (bmat .eq. 'G') then rnorm = ddot (n, resid, 1, workd, 1) rnorm = sqrt(abs(rnorm)) else if (bmat .eq. 'I') then rnorm = dnrm2(n, resid, 1) end if c c % c | Check for further orthogonalization. | c % c if (msglvl .gt. 2) then call dvout (logfil, 1, rnorm0, ndigit, & '_getv0: re-orthonalization ; rnorm0 is') call dvout (logfil, 1, rnorm, ndigit, & '_getv0: re-orthonalization ; rnorm is') end if c if (rnorm .gt. 0.717*rnorm0) go to 50 c iter = iter + 1 if (iter .le. 5) then c c % c | Perform iterative refinement step | c % c rnorm0 = rnorm go to 30 else c c % c | Iterative refinement step "failed" | c % c do 45 jj = 1, n resid(jj) = zero 45 continue rnorm = zero ierr = -1 end if c 50 continue c if (msglvl .gt. 0) then call dvout (logfil, 1, rnorm, ndigit, & '_getv0: B-norm of initial / restarted starting vector') end if if (msglvl .gt. 3) then call dvout (logfil, n, resid, ndigit, & '_getv0: initial / restarted starting vector') end if ido = 99 c call second (t1) tgetv0 = tgetv0 + (t1 - t0) c 9000 continue return c c % c | End of dgetv0 | c % c end
#include "config.h" static uint16_t LAST_PAIR = 100; static Cache CACHE; static void new_cached(CachedColor *color, Color fore, Color back) { memset(color, 0, sizeof(CachedColor)); color->id = LAST_PAIR; color->fore = fore; color->back = back; } ColorPair color_add(Color fore, Color back) { init_pair(LAST_PAIR, fore, back); CachedColor color; new_cached(&color, fore, back); cache_add(&CACHE, &color); return COLOR_PAIR(LAST_PAIR++); } static void load_color(CachedColor *color) { init_pair(color->id, color->fore, color->back); LAST_PAIR = max(LAST_PAIR, color->id); } void color_init(void) { cache_open_colors(&CACHE); if (cache_is_empty(CACHE_COLORS)) { cache_foreach(&CACHE, (Reader) load_color); } init_pair(COLOR_RED_F, COLOR_RED, -1); init_pair(COLOR_GREEN_F, COLOR_GREEN, -1); init_pair(COLOR_GREEN_B, -1, COLOR_GREEN); init_pair(COLOR_BLUE_F, COLOR_BLUE, -1); init_pair(COLOR_YELLOW_F, COLOR_YELLOW, -1); init_pair(COLOR_GRAY_F, 8, -1); init_pair(COLOR_DARK_GRAY_F, 235, -1); init_pair(COLOR_BROWN_F, 94, -1); init_pair(COLOR_DARK_GREEN_F, 22, -1); init_pair(COLOR_CLARET_F, 52, -1); init_pair(COLOR_NONE, -1, -1); init_pair(COLOR_DARK_GREEN_B, -1, 22); init_pair(COLOR_BROWN_B, -1, 94); init_pair(COLOR_ORANGE_B, -1, 202); init_pair(COLOR_YELLOW_B, -1, COLOR_YELLOW); init_pair(COLOR_RED_F_B, COLOR_RED, COLOR_RED); init_pair(COLOR_WHITE_B, -1, 15); init_pair(COLOR_GRAY_B, -1, 8); init_pair(COLOR_DARK_GRAY_B, -1, 235); init_pair(COLOR_DARK_BROWN_B, -1, 58); init_pair(COLOR_DARK_BROWN_F, 58, -1); init_pair(COLOR_ORANGE_F, 202, -1); init_pair(COLOR_WHITE_F, -1, 15); } uint16_t color_last(void) { return LAST_PAIR; } void color_cleanup(void) { cache_close(&CACHE); }
#!/usr/bin/python #coding:utf-8 import socket HOST,PORT = '',8888 listen_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) listen_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) listen_socket.bind((HOST, PORT)) listen_socket.listen(1) print 'Serving HTTP on port %s ...'% PORT while True: client_connection, client_address = listen_socket.accept() request = client_connection.recv(1024) print request http_response = ''' HTTP/1.1 200 OK Hello , World! ''' client_connection.sendall(http_response) client_connection.close()
// Decompiled with JetBrains decompiler // Type: System.Net.NetworkInformation.IpAdapterAddresses // Assembly: System, Version=4.0.0.0, Culture=neutral, PublicKey<API key> // MVID: <API key> // Assembly location: C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.dll using System; using System.Runtime.InteropServices; namespace System.Net.NetworkInformation { [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] internal struct IpAdapterAddresses { internal const int <API key> = 8; internal uint length; internal uint index; internal IntPtr next; [MarshalAs(UnmanagedType.LPStr)] internal string AdapterName; internal IntPtr firstUnicastAddress; internal IntPtr firstAnycastAddress; internal IntPtr <API key>; internal IntPtr <API key>; internal string dnsSuffix; internal string description; internal string friendlyName; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] internal byte[] address; internal uint addressLength; internal AdapterFlags flags; internal uint mtu; internal <API key> type; internal OperationalStatus operStatus; internal uint ipv6Index; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] internal uint[] zoneIndices; internal IntPtr firstPrefix; internal ulong transmitLinkSpeed; internal ulong receiveLinkSpeed; internal IntPtr <API key>; internal IntPtr firstGatewayAddress; internal uint ipv4Metric; internal uint ipv6Metric; internal ulong luid; internal IpSocketAddress dhcpv4Server; internal uint compartmentId; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] internal byte[] networkGuid; internal <API key> connectionType; internal InterfaceTunnelType tunnelType; internal IpSocketAddress dhcpv6Server; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 130)] internal byte[] dhcpv6ClientDuid; internal uint <API key>; internal uint dhcpV6Iaid; } }
<!DOCTYPE html> <html> <head> <title>Summary of card tags</title> <meta charset="utf-8"> <link rel="stylesheet" type="text/css" href="../multifile/style.css" /> <style> .unfinished { color: red; } </style> <script src="../multifile/cards.js" type="text/javascript"></script> <script type="text/javascript"> function display_tags() { var all_tags = new Set(); var definitions = { "virtual_coin": "(often) provides virtual coin.", "gainer": "Enables to gain a card outside of Buy phase.", "mass_trasher": "Allows to trash more than one card.", "silver_generator": "Adds Silver cards to deck.", "needs_attacks": "Rather pointless in kingdoms without Attacks.", "sifter": "Allows to draw some cards then discard some, clearing hand or top of deck of unwanted cards.", "junk_attack": "An attack that distributes Curse or other bad cards.", "draw_to_x": "Allows to draw cards up to certain number. Its usefulness diminishes as your hand grows.", "early_trasher": "Trashes cards, but mostly the early ones.", "trasher": "An ordinary trashing card, usually one card at a time.", "trash_for_benefit": "Lets you trash some card for a benefit, result often depends on quality of the card. Typically not some good against curses and coppers.", "handsize_attack": "An attack which makes players discard up to certain number of cards.", "deck_inspector": "Lets you to see the top of your deck and do something about it, but without drawing those cards.", "copper_strategy": "Is designed to make the most out of Copper.", "action_fetishist": "Wants you to have as many actions as possible.", "likes_diversity": "Rewards having many different card in your deck or hand.", "counters_handsize": "Becomes more effective when you're hit by a handsize/discard attack.", "spam_filter": "Lets you outright prevent gaining undesirable cards.", "likes_being_trashed": "Gives some kind of bonus when it's trashed.", "treasure_eater": "Burns through *your own* treasure for extra benefit.", "early_trasher": "A trasher card whose effectiveness rapidly decreases with time.", "<API key>": "Gives some kind of bonus when discarded.", "overpowered": "(Unimplemented) the idea was to have them paired with counters similar to attack. Those are the cards that tend to wrap the game around them when they show up.", "counters_attacks": "Counters ALL kinds of attacks.", "treasure_trasher": "Trashes treasure of OTHER people.", "steals_treasure": "Takes treasure from other players and gives it to you.", "counters_junk": "A workaround for having junk in your deck.", "<API key>": "Introduces some kind of indirect interaction other than Attack.", "VP_generator": "Generates Victory Point tokens.", "toilet_paper": "Trashes *itself* for some benefit.", "complicated": "Completely arbitrary - this card is likely to confuse newbies. It has either complex rules or is tricky to play right.", } for (var card of EXISTING_CARDS) { for (var tag of card.tags) { all_tags.add(tag); } } var tag_list = document.createElement('ul'); for (var tag of all_tags) { var li = document.createElement('li'); var li_span = document.createElement('span'); var span_text = document.createTextNode(tag); li_span.setAttribute('alt', definitions[tag]); li_span.appendChild(span_text); li.appendChild(li_span); if (li_span.getAttribute('alt') == 'undefined') { li_span.classList.add('unfinished'); } var cards = document.createElement('p'); for (card of EXISTING_CARDS) { if (card.tags.indexOf(tag) != -1) { var card_span = document.createElement('span'); card_span.appendChild(document.createTextNode(card.name + ', ')); card_span.setAttribute('alt', card.text); cards.appendChild(card_span); } } li.appendChild(cards); tag_list.appendChild(li); } document.body.appendChild(tag_list); } </script> </head> <body onload="display_tags()"> <p>Summary of tag descriptions. Hover over tag names to see their definitions. For counter system to work tags need to be applied consistently. Tags without descriptions are marked <span class="unfinished">red</span>.</p> <p><em>This page is dynamically generated with Javascript. If it's broken and and you can't see a list, it means either it can't find the source files in "multifile" directory, or .json data is messed up. Likely a comma where it doesn't belong. Check the Javascript console.</em></p> </body> </html>
{% extends 'base.html' %} {% block head %} {% load staticfiles %} <script src="{% static 'approval_polls/embed_instructions.js' %}"></script> {% endblock %} {% block content %} <div class='row-fluid top-buffer'> <div class='col-md-12'> <h4>Put this code in your site</h4> <div class = 'form-group'> <textarea id='textAreaCode' class = 'form-control' readonly></textarea> </div> <button id= "copyText" class="btn btn-primary btn-xs">Copy to Clipboard</button> <h4>Preview</h4> <iframe id="iframePreview" src='{{ link }}' width='400px'>Sorry, your browser doesn't support iframes.</iframe> </div> </div> {% endblock %}
#include "Game/pilot.hpp" const float MAX_TARGET_SPEED = 1.0f; const float MIN_TARGET_SPEED = -0.1f; const float <API key> = 0.1f; Pilot::Pilot(Game* g, String name) : Player(g, name) { // Data mStepDistance = 5; mHorizAngle = Degree(0); mVertAngle = Degree(0); mStepAngle = Degree(10); mControlDirection = false; <API key> = false; mTargetSpeed = 0; mInverted = false; // Ship mesh mShip = new Ship(g, "Ship", "Sovereign"); mShip->attachActor(this); mShip->setLocation(Vector3(0, 0, 300)); mShip->saveToFile(); mDistance = mShip->getViewDistance(); // Camera setup setCameraSpheric(mDistance, Degree(0), Degree (0)); } void Pilot::preTick(const Ogre::FrameEvent& evt) { if(mInverted) { Ogre::Ray ray = mCamera-><API key>(1.0 - mMouseState.X.abs / (float)mCamera->getViewport()->getActualWidth() , 1.0 - mMouseState.Y.abs / (float)mCamera->getViewport()->getActualHeight()); mShip->setAimDirection(-ray.getDirection()); } else { Ogre::Ray ray = mCamera-><API key>(mMouseState.X.abs / (float)mCamera->getViewport()->getActualWidth() ,mMouseState.Y.abs / (float)mCamera->getViewport()->getActualHeight()); mShip->setAimDirection(ray.getDirection()); } } bool Pilot::mousePressed(const OIS::MouseEvent &e, OIS::MouseButtonID id) { <API key> = true; updateDirection(); return true; } bool Pilot::mouseReleased(const OIS::MouseEvent &e, OIS::MouseButtonID id) { <API key> = false; updateDirection(); return true; } bool Pilot::mouseMoved(const OIS::MouseEvent &e) { if(e.state.Z.rel > 0) { mTargetSpeed += <API key>; updateSpeed(); } if(e.state.Z.rel < 0) { mTargetSpeed -= <API key>; updateSpeed(); } mMouseState = e.state; updateDirection(); return true; } String Pilot::debugText() { return StringConverter::toString(mShip->getAngularSpeed()); } void Pilot::updateDirection() { if(mControlDirection || <API key>) { float resX = (float)mCamera->getViewport()->getActualWidth(); float resY = (float)mCamera->getViewport()->getActualHeight(); float max = 0.9f * resY; float x = Math::Clamp((float)mMouseState.X.abs - (resX / 2), -max, max) / max; float y = Math::Clamp((float)mMouseState.Y.abs - (resY / 2), -max, max) / max; mShip->setSteer(x, -y); } else { mShip->setSteer(0, 0); } } void Pilot::updateSpeed() { if(mTargetSpeed > MAX_TARGET_SPEED) { mTargetSpeed = MAX_TARGET_SPEED; } else if(mTargetSpeed < MIN_TARGET_SPEED) { mTargetSpeed = MIN_TARGET_SPEED; } mShip->setSpeed(mTargetSpeed); } bool Pilot::keyPressed(const OIS::KeyEvent &e) { switch (e.key) { case OIS::KC_A: break; case OIS::KC_D: break; case OIS::KC_W: break; case OIS::KC_S: break; case OIS::KC_SPACE: mControlDirection = !mControlDirection; updateDirection(); break; case OIS::KC_BACK: mTargetSpeed = 0.0; updateSpeed(); break; case OIS::KC_Q: mShip->setRoll(1.0f); break; case OIS::KC_E: mShip->setRoll(-1.0f); break; case OIS::KC_I: mInverted = !mInverted; break; case OIS::KC_NUMPAD5: mHorizAngle = 0; mVertAngle = 0; break; case OIS::KC_NUMPAD4: mHorizAngle -= mStepAngle; break; case OIS::KC_NUMPAD6: mHorizAngle += mStepAngle; break; case OIS::KC_NUMPAD2: mVertAngle += mStepAngle; break; case OIS::KC_NUMPAD8: mVertAngle -= mStepAngle; break; case OIS::KC_ADD: mDistance -= mStepDistance; break; case OIS::KC_SUBTRACT: mDistance += mStepDistance; break; case OIS::KC_LCONTROL: mShip->setFireOrder(true); mShip->setFireOrder(true); break; default: break; } setCameraSpheric(mDistance, Degree(mHorizAngle), Degree (mVertAngle)); return Player::keyPressed(e); } bool Pilot::keyReleased(const OIS::KeyEvent &e) { switch (e.key) { case OIS::KC_Q: case OIS::KC_E: mShip->setRoll(0.0f); break; case OIS::KC_LCONTROL: mShip->setFireOrder(false); mShip->setFireOrder(false); break; case OIS::KC_TAB: //mTargetSpeed = MAX_TARGET_SPEED; //updateSpeed(); break; default: break; } return Player::keyReleased(e); }
#define G_LOG_DOMAIN "<API key>" #include "config.h" #include <dazzle.h> #include <glib/gi18n.h> #include <stdlib.h> #include "<API key>.h" #include "<API key>.h" struct <API key> { IdeObject parent_instance; PeasEngine *engine; gchar *key; gchar *value; GHashTable *extensions; GPtrArray *settings; GType interface_type; guint reload_handler; }; G_DEFINE_FINAL_TYPE (<API key>, <API key>, IDE_TYPE_OBJECT) enum { EXTENSIONS_LOADED, EXTENSION_ADDED, EXTENSION_REMOVED, LAST_SIGNAL }; enum { PROP_0, PROP_ENGINE, PROP_INTERFACE_TYPE, PROP_KEY, PROP_VALUE, LAST_PROP }; static GParamSpec *properties [LAST_PROP]; static guint signals [LAST_SIGNAL]; static void <API key> (<API key> *); static gchar * <API key> (IdeObject *object) { <API key> *self = (<API key> *)object; g_assert (<API key> (self)); return g_strdup_printf ("%s interface=\"%s\" key=\"%s\" value=\"%s\"", G_OBJECT_TYPE_NAME (self), g_type_name (self->interface_type), self->key ?: "", self->value ?: ""); } static void add_extension (<API key> *self, PeasPluginInfo *plugin_info, PeasExtension *exten) { g_assert (IDE_IS_MAIN_THREAD ()); g_assert (<API key> (self)); g_assert (plugin_info != NULL); g_assert (exten != NULL); g_assert (g_type_is_a (G_OBJECT_TYPE (exten), self->interface_type)); g_hash_table_insert (self->extensions, plugin_info, exten); /* Ensure that we take the reference in case it's a floating ref */ if (<API key> (exten) && <API key> (exten)) g_object_ref_sink (exten); /* * If the plugin object turned out to have IdeObject as a * base, make it a child of ourselves, because we're an * IdeObject too and that gives it access to the context. */ if (IDE_IS_OBJECT (exten)) ide_object_append (IDE_OBJECT (self), IDE_OBJECT (exten)); g_signal_emit (self, signals [EXTENSION_ADDED], 0, plugin_info, exten); } static void remove_extension (<API key> *self, PeasPluginInfo *plugin_info, PeasExtension *exten) { g_autoptr(GObject) hold = NULL; g_assert (IDE_IS_MAIN_THREAD ()); g_assert (<API key> (self)); g_assert (plugin_info != NULL); g_assert (exten != NULL); g_assert (self->interface_type == G_TYPE_INVALID || g_type_is_a (G_OBJECT_TYPE (exten), self->interface_type)); hold = g_object_ref (exten); g_hash_table_remove (self->extensions, plugin_info); g_signal_emit (self, signals [EXTENSION_REMOVED], 0, plugin_info, hold); if (IDE_IS_OBJECT (hold)) ide_object_destroy (IDE_OBJECT (hold)); } static void <API key> (<API key> *self, const gchar *key, GSettings *settings) { g_assert (IDE_IS_MAIN_THREAD ()); g_assert (<API key> (self)); g_assert (key != NULL); g_assert (G_IS_SETTINGS (settings)); <API key> (self); } static void watch_extension (<API key> *self, PeasPluginInfo *plugin_info, GType interface_type) { g_autoptr(GSettings) settings = NULL; g_autofree char *path = NULL; g_assert (IDE_IS_MAIN_THREAD ()); g_assert (<API key> (self)); g_assert (plugin_info != NULL); g_assert (G_TYPE_IS_INTERFACE (interface_type) || G_TYPE_IS_OBJECT (interface_type)); path = g_strdup_printf ("/org/gnome/builder/extension-types/%s/%s/", <API key> (plugin_info), g_type_name (interface_type)); settings = <API key> ("org.gnome.builder.extension-type", path); g_ptr_array_add (self->settings, g_object_ref (settings)); /* We have to fetch the key once to get changed events */ <API key> (settings, "enabled"); <API key> (settings, "changed::enabled", G_CALLBACK (<API key>), self, G_CONNECT_SWAPPED); } static void <API key> (<API key> *self) { const GList *plugins; g_assert (IDE_IS_MAIN_THREAD ()); g_assert (<API key> (self)); g_assert (self->interface_type != G_TYPE_INVALID); while (self->settings->len > 0) { GSettings *settings; settings = g_ptr_array_index (self->settings, self->settings->len - 1); <API key> (settings, <API key>, self); <API key> (self->settings, self->settings->len - 1); } plugins = <API key> (self->engine); for (; plugins; plugins = plugins->next) { PeasPluginInfo *plugin_info = plugins->data; gint priority; if (!<API key> (plugin_info)) continue; if (!<API key> (self->engine, plugin_info, self->interface_type)) continue; watch_extension (self, plugin_info, self->interface_type); if (<API key> (self->engine, plugin_info, self->interface_type, self->key, self->value, &priority)) { if (!<API key> (self->extensions, plugin_info)) { PeasExtension *exten; exten = ide_extension_new (self->engine, plugin_info, self->interface_type, NULL); add_extension (self, plugin_info, exten); } } else { PeasExtension *exten; if ((exten = g_hash_table_lookup (self->extensions, plugin_info))) remove_extension (self, plugin_info, exten); } } g_signal_emit (self, signals [EXTENSIONS_LOADED], 0); } static gboolean <API key> (gpointer data) { <API key> *self = data; g_assert (IDE_IS_MAIN_THREAD ()); g_assert (<API key> (self)); self->reload_handler = 0; if (self->interface_type != G_TYPE_INVALID) <API key> (self); return G_SOURCE_REMOVE; } static void <API key> (<API key> *self) { g_assert (IDE_IS_MAIN_THREAD ()); g_assert (<API key> (self)); g_clear_handle_id (&self->reload_handler, g_source_remove); self->reload_handler = g_idle_add_full (G_PRIORITY_HIGH, <API key>, self, NULL); } static void <API key> (<API key> *self, PeasPluginInfo *plugin_info, PeasEngine *engine) { g_assert (<API key> (self)); g_assert (plugin_info != NULL); g_assert (PEAS_IS_ENGINE (engine)); <API key> (self); } static void <API key> (<API key> *self, PeasPluginInfo *plugin_info, PeasEngine *engine) { PeasExtension *exten; g_assert (<API key> (self)); g_assert (plugin_info != NULL); g_assert (PEAS_IS_ENGINE (engine)); if ((exten = g_hash_table_lookup (self->extensions, plugin_info))) { remove_extension (self, plugin_info, exten); g_hash_table_remove (self->extensions, plugin_info); } } static void <API key> (<API key> *self, PeasEngine *engine) { g_assert (IDE_IS_MAIN_THREAD ()); g_assert (<API key> (self)); g_assert (!engine || PEAS_IS_ENGINE (engine)); if (engine == NULL) engine = <API key> (); if (g_set_object (&self->engine, engine)) { <API key> (self->engine, "load-plugin", G_CALLBACK (<API key>), self, G_CONNECT_AFTER | G_CONNECT_SWAPPED); <API key> (self->engine, "unload-plugin", G_CALLBACK (<API key>), self, G_CONNECT_SWAPPED); <API key> (G_OBJECT (self), properties [PROP_ENGINE]); <API key> (self); } } static void <API key> (<API key> *self, GType interface_type) { g_assert (IDE_IS_MAIN_THREAD ()); g_assert (<API key> (self)); g_assert (G_TYPE_IS_INTERFACE (interface_type) || G_TYPE_IS_OBJECT (interface_type)); if (interface_type != self->interface_type) { self->interface_type = interface_type; <API key> (G_OBJECT (self), properties [PROP_INTERFACE_TYPE]); <API key> (self); } } static void <API key> (IdeObject *object) { <API key> *self = (<API key> *)object; g_autoptr(GHashTable) extensions = NULL; GHashTableIter iter; gpointer key; gpointer value; g_assert (IDE_IS_MAIN_THREAD ()); g_assert (<API key> (self)); self->interface_type = G_TYPE_INVALID; g_clear_handle_id (&self->reload_handler, g_source_remove); /* * Steal the extensions so we can be re-entrant safe and not break * any assumptions about extensions being a real pointer. */ extensions = g_steal_pointer (&self->extensions); self->extensions = <API key> (NULL, NULL, NULL, g_object_unref); <API key> (&iter, extensions); while (<API key> (&iter, &key, &value)) { PeasPluginInfo *plugin_info = key; PeasExtension *exten = value; remove_extension (self, plugin_info, exten); <API key> (&iter); } IDE_OBJECT_CLASS (<API key>)->destroy (object); } static void <API key> (GObject *object) { <API key> *self = (<API key> *)object; while (self->settings->len > 0) { guint i = self->settings->len - 1; GSettings *settings = g_ptr_array_index (self->settings, i); <API key> (settings, <API key>, self); <API key> (self->settings, i); } g_clear_object (&self->engine); g_clear_pointer (&self->key, g_free); g_clear_pointer (&self->value, g_free); g_clear_pointer (&self->extensions, g_hash_table_unref); g_clear_pointer (&self->settings, g_ptr_array_unref); G_OBJECT_CLASS (<API key>)->finalize (object); } static void <API key> (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { <API key> *self = <API key> (object); switch (prop_id) { case PROP_ENGINE: g_value_set_object (value, <API key> (self)); break; case PROP_INTERFACE_TYPE: g_value_set_gtype (value, <API key> (self)); break; case PROP_KEY: g_value_set_string (value, <API key> (self)); break; case PROP_VALUE: g_value_set_string (value, <API key> (self)); break; default: <API key> (object, prop_id, pspec); } } static void <API key> (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { <API key> *self = <API key> (object); switch (prop_id) { case PROP_ENGINE: <API key> (self, g_value_get_object (value)); break; case PROP_INTERFACE_TYPE: <API key> (self, g_value_get_gtype (value)); break; case PROP_KEY: <API key> (self, g_value_get_string (value)); break; case PROP_VALUE: <API key> (self, g_value_get_string (value)); break; default: <API key> (object, prop_id, pspec); } } static void <API key> (<API key> *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); IdeObjectClass *i_object_class = IDE_OBJECT_CLASS (klass); object_class->finalize = <API key>; object_class->get_property = <API key>; object_class->set_property = <API key>; i_object_class->destroy = <API key>; i_object_class->repr = <API key>; properties [PROP_ENGINE] = g_param_spec_object ("engine", "Engine", "Engine", PEAS_TYPE_ENGINE, (G_PARAM_READWRITE | <API key> | <API key>)); properties [PROP_INTERFACE_TYPE] = g_param_spec_gtype ("interface-type", "Interface Type", "Interface Type", G_TYPE_OBJECT, (G_PARAM_READWRITE | <API key> | <API key>)); properties [PROP_KEY] = g_param_spec_string ("key", "Key", "Key", NULL, (G_PARAM_READWRITE | <API key>)); properties [PROP_VALUE] = g_param_spec_string ("value", "Value", "Value", NULL, (G_PARAM_READWRITE | <API key>)); <API key> (object_class, LAST_PROP, properties); signals [EXTENSION_ADDED] = g_signal_new ("extension-added", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, G_TYPE_NONE, 2, <API key>, PEAS_TYPE_EXTENSION); signals [EXTENSION_REMOVED] = g_signal_new ("extension-removed", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, G_TYPE_NONE, 2, <API key>, PEAS_TYPE_EXTENSION); signals [EXTENSIONS_LOADED] = g_signal_new ("extensions-loaded", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, G_TYPE_NONE, 0); } static void <API key> (<API key> *self) { self->settings = <API key> (g_object_unref); self->extensions = <API key> (NULL, NULL, NULL, g_object_unref); } /** * <API key>: * * Gets the #<API key>:engine property. * * Returns: (transfer none): a #PeasEngine. * * Since: 3.32 */ PeasEngine * <API key> (<API key> *self) { <API key> (<API key> (self), NULL); return self->engine; } GType <API key> (<API key> *self) { <API key> (<API key> (self), G_TYPE_INVALID); return self->interface_type; } const gchar * <API key> (<API key> *self) { <API key> (<API key> (self), NULL); return self->key; } void <API key> (<API key> *self, const gchar *key) { g_return_if_fail (IDE_IS_MAIN_THREAD ()); g_return_if_fail (<API key> (self)); if (!ide_str_equal0 (self->key, key)) { g_free (self->key); self->key = g_strdup (key); <API key> (G_OBJECT (self), properties [PROP_KEY]); <API key> (self); } } const gchar * <API key> (<API key> *self) { <API key> (IDE_IS_MAIN_THREAD (), NULL); <API key> (<API key> (self), NULL); return self->value; } void <API key> (<API key> *self, const gchar *value) { g_return_if_fail (IDE_IS_MAIN_THREAD ()); g_return_if_fail (<API key> (self)); IDE_TRACE_MSG ("Setting extension adapter %s value to \"%s\"", g_type_name (self->interface_type), value ?: ""); if (!ide_str_equal0 (self->value, value)) { g_free (self->value); self->value = g_strdup (value); <API key> (G_OBJECT (self), properties [PROP_VALUE]); <API key> (self); } } /** * <API key>: * @self: an #<API key> * @foreach_func: (scope call): A callback * @user_data: user data for @foreach_func * * Calls @foreach_func for every extension loaded by the extension set. * * Since: 3.32 */ void <API key> (<API key> *self, <API key> foreach_func, gpointer user_data) { const GList *list; g_return_if_fail (<API key> (self)); g_return_if_fail (foreach_func != NULL); /* * Use the ordered list of plugins as it is sorted including any * dependencies of plugins. */ list = <API key> (self->engine); for (const GList *iter = list; iter; iter = iter->next) { PeasPluginInfo *plugin_info = iter->data; PeasExtension *exten = g_hash_table_lookup (self->extensions, plugin_info); if (exten != NULL) foreach_func (self, plugin_info, exten, user_data); } } typedef struct { PeasPluginInfo *plugin_info; PeasExtension *exten; gint priority; } SortedInfo; static gint sort_by_priority (gconstpointer a, gconstpointer b) { const SortedInfo *sa = a; const SortedInfo *sb = b; /* Greater values are higher priority */ if (sa->priority < sb->priority) return -1; else if (sa->priority > sb->priority) return 1; else return 0; } /** * <API key>: * @self: an #<API key> * @foreach_func: (scope call): A callback * @user_data: user data for @foreach_func * * Calls @foreach_func for every extension loaded by the extension set. * * Since: 3.32 */ void <API key> (<API key> *self, <API key> foreach_func, gpointer user_data) { g_autoptr(GArray) sorted = NULL; g_autofree gchar *prio_key = NULL; GHashTableIter iter; gpointer key; gpointer value; g_return_if_fail (IDE_IS_MAIN_THREAD ()); g_return_if_fail (<API key> (self)); g_return_if_fail (foreach_func != NULL); if (self->key == NULL) { <API key> (self, foreach_func, user_data); return; } prio_key = g_strdup_printf ("%s-Priority", self->key); sorted = g_array_new (FALSE, FALSE, sizeof (SortedInfo)); <API key> (&iter, self->extensions); while (<API key> (&iter, &key, &value)) { PeasPluginInfo *plugin_info = key; PeasExtension *exten = value; const gchar *priostr = <API key> (plugin_info, prio_key); gint prio = priostr ? atoi (priostr) : 0; SortedInfo info = { plugin_info, exten, prio }; g_array_append_val (sorted, info); } g_array_sort (sorted, sort_by_priority); for (guint i = 0; i < sorted->len; i++) { const SortedInfo *info = &g_array_index (sorted, SortedInfo, i); foreach_func (self, info->plugin_info, info->exten, user_data); } } guint <API key> (<API key> *self) { <API key> (<API key> (self), 0); if (self->extensions != NULL) return g_hash_table_size (self->extensions); return 0; } <API key> * <API key> (IdeObject *parent, PeasEngine *engine, GType interface_type, const gchar *key, const gchar *value) { <API key> *ret; <API key> (IDE_IS_MAIN_THREAD (), NULL); <API key> (!parent || IDE_IS_OBJECT (parent), NULL); <API key> (!engine || PEAS_IS_ENGINE (engine), NULL); <API key> (G_TYPE_IS_INTERFACE (interface_type) || G_TYPE_IS_OBJECT (interface_type), NULL); ret = g_object_new (<API key>, "engine", engine, "interface-type", interface_type, "key", key, "value", value, NULL); if (parent != NULL) ide_object_append (parent, IDE_OBJECT (ret)); /* If we have a reload queued, just process it immediately so that * there is some determinism in plugin loading. */ if (ret->reload_handler != 0) { g_clear_handle_id (&ret->reload_handler, g_source_remove); <API key> (ret); } return ret; } /** * <API key>: * @self: a #<API key> * @plugin_info: a #PeasPluginInfo * * Locates the extension owned by @plugin_info if such extension exists. * * Returns: (transfer none) (nullable): a #PeasExtension or %NULL * * Since: 3.32 */ PeasExtension * <API key> (<API key> *self, PeasPluginInfo *plugin_info) { <API key> (IDE_IS_MAIN_THREAD (), NULL); <API key> (<API key> (self), NULL); <API key> (plugin_info != NULL, NULL); return g_hash_table_lookup (self->extensions, plugin_info); }
// This file is part of OpenTSDB. // This program is free software: you can redistribute it and/or modify it // option) any later version. This program is distributed in the hope that it // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser package net.opentsdb.tsd; import java.util.HashMap; import java.util.concurrent.atomic.AtomicLong; import com.stumbleupon.async.Callback; import com.stumbleupon.async.Deferred; import org.jboss.netty.channel.Channel; import net.opentsdb.core.TSDB; import net.opentsdb.core.Tags; import net.opentsdb.stats.StatsCollector; import net.opentsdb.uid.NoSuchUniqueName; /** Implements the "put" telnet-style command. */ final class PutDataPointRpc implements TelnetRpc { private static final AtomicLong requests = new AtomicLong(); private static final AtomicLong hbase_errors = new AtomicLong(); private static final AtomicLong invalid_values = new AtomicLong(); private static final AtomicLong illegal_arguments = new AtomicLong(); private static final AtomicLong unknown_metrics = new AtomicLong(); public Deferred<Object> execute(final TSDB tsdb, final Channel chan, final String[] cmd) { requests.incrementAndGet(); String errmsg = null; try { final class PutErrback implements Callback<Exception, Exception> { public Exception call(final Exception arg) { if (chan.isConnected()) { chan.write("put: HBase error: " + arg.getMessage() + '\n'); } hbase_errors.incrementAndGet(); return arg; } public String toString() { return "report error to channel"; } } return importDataPoint(tsdb, cmd).addErrback(new PutErrback()); } catch (<API key> x) { errmsg = "put: invalid value: " + x.getMessage() + '\n'; invalid_values.incrementAndGet(); } catch (<API key> x) { errmsg = "put: illegal argument: " + x.getMessage() + '\n'; illegal_arguments.incrementAndGet(); } catch (NoSuchUniqueName x) { errmsg = "put: unknown metric: " + x.getMessage() + '\n'; unknown_metrics.incrementAndGet(); } if (errmsg != null && chan.isConnected()) { chan.write(errmsg); } return Deferred.fromResult(null); } /** * Collects the stats and metrics tracked by this instance. * @param collector The collector to use. */ public static void collectStats(final StatsCollector collector) { collector.record("rpc.received", requests, "type=put"); collector.record("rpc.errors", hbase_errors, "type=hbase_errors"); collector.record("rpc.errors", invalid_values, "type=invalid_values"); collector.record("rpc.errors", illegal_arguments, "type=illegal_arguments"); collector.record("rpc.errors", unknown_metrics, "type=unknown_metrics"); } /** * Imports a single data point. * @param tsdb The TSDB to import the data point into. * @param words The words describing the data point to import, in * the following format: {@code [metric, timestamp, value, ..tags..]} * @return A deferred object that indicates the completion of the request. * @throws <API key> if the timestamp or value is invalid. * @throws <API key> if any other argument is invalid. * @throws NoSuchUniqueName if the metric isn't registered. */ private Deferred<Object> importDataPoint(final TSDB tsdb, final String[] words) { words[0] = null; // Ditch the "put". if (words.length < 5) { // Need at least: metric timestamp value tag // ^ 5 and not 4 because words[0] is "put". throw new <API key>("not enough arguments" + " (need least 4, got " + (words.length - 1) + ')'); } String metric = words[1]; try { metric = java.net.URLDecoder.decode(metric, "UTF-8"); } catch (java.io.<API key> e) { throw new <API key>("Unable to decode metric: " + metric + ", error: " + e.getMessage()); } if (metric.length() <= 0) { throw new <API key>("empty metric name"); } final long timestamp = Tags.parseLong(words[2]); if (timestamp <= 0) { throw new <API key>("invalid timestamp: " + timestamp); } final String value = words[3]; if (value.length() <= 0) { throw new <API key>("empty value"); } final HashMap<String, String> tags = new HashMap<String, String>(); for (int i = 4; i < words.length; i++) { if (!words[i].isEmpty()) { Tags.parse(tags, words[i]); } } if (value.indexOf('.') < 0) { // integer value return tsdb.addPoint(metric, timestamp, Tags.parseLong(value), tags); } else { // floating point value return tsdb.addPoint(metric, timestamp, Float.parseFloat(value), tags); } } }
package nc.noumea.mairie.pdc.entity; import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; @Entity @DiscriminatorValue("4") public class Demandeur extends Tiers { private static final long serialVersionUID = 1L; }
# -*- coding: utf-8 -*- # Generated by Django 1.9.2 on 2016-04-21 07:08 from __future__ import unicode_literals import django.contrib.gis.db.models.fields from django.db import migrations, models import django.db.models.deletion import django.utils.timezone class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='AWSReport', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('created', models.DateTimeField(default=django.utils.timezone.now, verbose_name='Created')), ('updated', models.DateTimeField(auto_now=True, verbose_name='Updated')), ('temperature', models.<API key>(default=0, verbose_name='Temperature')), ('humidity', models.<API key>(default=0, verbose_name='Humidity')), ('pressure', models.<API key>(default=0, verbose_name='Pressure')), ('wind_speed', models.<API key>(default=0, verbose_name='Wind Speed')), ('wind_direction', models.<API key>(default=0, verbose_name='Wind Direction')), ('day_rain', models.<API key>(default=0, verbose_name='Day Rain')), ('rain_rate', models.<API key>(default=0, verbose_name='Rain Rate')), ('uv_index', models.<API key>(default=0, verbose_name='UV Index')), ('solar_radiation', models.<API key>(default=0, verbose_name='Solar Radiation')), ], options={ 'ordering': ['-updated', '-created'], 'get_latest_by': 'updated', }, ), migrations.CreateModel( name='AWSStation', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=100, verbose_name='Name')), ('point', django.contrib.gis.db.models.fields.PointField(blank=True, null=True, srid=4326, verbose_name='Point')), ('note', models.TextField(blank=True, verbose_name='Note')), ], options={ 'abstract': False, }, ), migrations.AddField( model_name='awsreport', name='awsstation', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='<API key>.AWSStation', verbose_name='AWS Station'), ), ]
from .action_types import GeneratorActionType, ActionStateType from .data_types_tree import Ensemble, Struct, Float, DTT import copy from .code_formater import Formater class VariableGenerator(GeneratorActionType): name = "VariableGenerator" """Display name of action""" description = "Generator for creating static DTT variable" """Display description of action""" def __init__(self, **kwargs): """ :param DTT Variable: Dictionary that describe struc parameters """ super(VariableGenerator, self).__init__(**kwargs) def _inicialize(self): """inicialize action run variables""" if self._get_state().value > ActionStateType.created.value: return self._output = self._get_valid_output() self._set_state(ActionStateType.initialized) self._hash.update(bytes(self.__class__.__name__, "utf-8")) if "Variable" in self._variables and \ isinstance(self._variables["Variable"], DTT) and \ self._variables["Variable"]._is_set(): self._hash.update(bytes(self._variables['Variable']._get_unique_text(True), "utf-8")) def _get_valid_output(self): """Construct output from set items""" if "Variable" in self._variables and isinstance(self._variables["Variable"], DTT): return self._variables["Variable"] def <API key>(self): """return array of variables python scripts""" var = super(VariableGenerator, self).<API key>() variable=Formater.format_variable( "Variable", self._variables["Variable"].<API key>(), 0) if len(variable)>0 and len(variable[-1])>0: variable[-1] = variable[-1][:-1] var.append(variable) return var def _check_params(self): """check if all require params is set""" err = super(VariableGenerator, self)._check_params() if "Variable" not in self._variables: self._add_error(err, "Variable parameter is required") elif not isinstance(self._variables["Variable"], DTT): self._add_error(err, "Parameter 'Variable' is not valid DTT variable") else: if not self._variables["Variable"]._is_set(): self._add_error(err, "Variable in variable generator must be set") if self._output is None: self._add_error(err, "Can't determine valid output") return err def validate(self): """validate variables, input and output""" err = super(VariableGenerator, self).validate() return err class RangeGenerator(GeneratorActionType): name = "RangeGenerator" """Display name of action""" description = "Generator for generation parallel list" """Display description of action""" def __init__(self, **kwargs): """ :param Dictionary Items: Dictionary that describe generated way how generate result. Values have this attributes:: - :name(string):require variabvar.append(["AllCases=True"])le name - :value(float): require variable middle value - :step(float): default 1, step for generation - :n_plus(integer): default 1, amount of plus steps - :n_minus(integer): default 1, amount of minus steps - :exponential(bool): default False, if true value is processed exponencially :param AllCases bool: Cartesian product, default value False: """ super(RangeGenerator, self).__init__(**kwargs) def _inicialize(self): """inicialize action run variables""" if self._get_state().value > ActionStateType.created.value: return self._output = self.<API key>() template = copy.deepcopy(self._output.subtype) # first is middle self._output.add_item(template) for item in self._variables['Items']: if not isinstance(item, dict): continue if 'name' in item and item['name'] in template: if 'name' in item: setattr(template, item['name'], item['value']) # Output computation is made in inicialize time, count of cycles # is known for statistics (easier get_statiscics function) for item in self._variables['Items']: if 'AllCases' in self._variables and self._variables['AllCases']: ready = copy.deepcopy(self._output) for template_i in ready: self._generate_step(template_i, item) else: self._generate_step(template, item) self._set_state(ActionStateType.initialized) self._hash.update(bytes(self.__class__.__name__, "utf-8")) self._hash.update(bytes(self._output._get_unique_text(True), "utf-8")) def <API key>(self): """Construct output from set items""" params = {} if 'Items' in self._variables: if isinstance(self._variables['Items'], list): for item in self._variables['Items']: if isinstance(item, dict): if 'name' in item: try: params[item['name']] = Float() except: pass if len(params)>1: return Ensemble(Struct(params)) return None def <API key>(self): """return array of variables python scripts""" var = super(RangeGenerator, self).<API key>() i=1 items=['Items = ['] for item in self._variables['Items']: if not 'name' in item or not 'value' in item: continue items.append(" {0}'name':'{1}'".format('{', item['name'])) if 'value' in item: items[i] += (", 'value':{0}".format(str(item['value']))) if 'step' in item: items[i] += (", 'step':{0}".format(str(item['step']))) if 'n_plus' in item: items[i] += (", 'n_plus':{0}".format(str(item['n_plus']))) if 'n_minus' in item: items[i] += (", 'n_minus':{0}".format(str(item['n_minus']))) if 'exponential' in item and item['exponential']: items[i] += (", 'exponential':True") items[i] += "}," i += 1 if i>1: items[i-1]=items[i-1][:-1] items.append(']') var.append(items) if 'AllCases' in self._variables and self._variables["AllCases"]: var.append(["AllCases=True"]) return var def _generate_step(self, template, item): """generate plus and minus variants for one item""" plus = 1 if 'n_plus' in item: plus = item['n_plus'] minus = 1 if 'n_minus' in item: minus = item['n_minus'] step = 1 if 'step' in item: step = item['step'] for i in range(0, plus): template2 =copy.deepcopy(template) rstep = (i+1)*step if 'exponential' in item and item['exponential']: rstep = 2**i*step setattr(template2, item['name'], getattr(template2, item['name']).value+rstep) self._output.add_item(template2) for i in range(0, minus): template2 =copy.deepcopy(template) rstep = (i+1)*step if 'exponential' in item and item['exponential']: rstep = 2**i*step setattr(template2, item['name'], getattr(template2, item['name']).value-rstep) self._output.add_item(template2) def _check_params(self): """check if all require params is set""" err = super(RangeGenerator, self)._check_params() if self._output is None: self._add_error(err, "Can't determine output from items parameter") else: if not isinstance(self._output, Ensemble): self._add_error(err, "Output type must be Ensemble type") if 'Items' not in self._variables: self._add_error(err, "Items parameter is required") else: if not isinstance(self._variables['Items'], list): self._add_error(err, "Items parameter must be List") else: if len(self._variables['Items'])<1: self._add_error(err, "Parameter 'Items' must have at least one item") else: i=0 for item in self._variables['Items']: if not isinstance(item, dict): self._add_error(err, "Item[{0}] in Items list is not Dictionary".format(str(i))) else: if not 'name' in item: self._add_error(err, "Parameter 'name' in item[{0}] is required".format(str(i))) else: if not self._check_var_name(item['name']): self._add_error(err, "Parameter 'name' in item[{0}] is not valid attribute name".format(str(i))) if not 'value' in item: self._add_error(err, "Parameter 'value' in item[{0}] is required".format(str(i))) else: if not self._check_float(item['value']): self._add_error(err, "Parameter 'value' in item[{0}] is not valid float".format(str(i))) if 'step' in item: if not self._check_float(item['step']): self._add_error(err, "Parameter 'step' in item[{0}] is not valid float".format(str(i))) if 'n_plus' in item: if not self._check_int(item['n_plus']): self._add_error(err, "Parameter 'n_plus' in item[{0}] is not valid integer".format(str(i))) if 'n_minus' in item: if not self._check_int(item['n_minus']): self._add_error(err, "Parameter 'n_minus' in item[{0}] is not valid integer".format(str(i))) if 'exponential' in item: if not self._check_bool(item['exponential']): self._add_error(err, "Parameter 'exponential' in item[{0}] is not valid boolean".format(str(i))) i += 1 return err def validate(self): """validate variables, input and output""" err = super(RangeGenerator, self).validate() return err
#!/bin/bash # Name: PW_change.sh # Description: Change Password # This program is free software: you can redistribute it and/or modify # (at your option) any later version. # This program is distributed in the hope that it will be useful, # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #apt-get install -y python-minimal Saltsalt=$(pwgen -s 8 1) #User_name=chris User_name=$1 #New_Passwd=$2 New_Passwd='P@ssw0rd' shadow_passwd=$(python -c "import crypt, getpass, pwd; \ print crypt.crypt('$New_Passwd', '\$6\$$Saltsalt\$')") sed -ri "s|$User_name:[^:].*(:.*:.*:.*:.*:::)|$User_name:$shadow_passwd\1|" /etc/shadow
#include "encoding.h" #include "constants.h" #include <plist/plist.h> #include <io/path.h> #include <text/utf8.h> #include <cf/cf.h> #include <oak/oak.h> #include <oak/debug.h> OAK_DEBUG_VAR(File_Charset); std::string const kCharsetNoEncoding = NULL_STR; std::string const kCharsetASCII = "ASCII"; std::string const kCharsetUTF8 = "UTF-8"; std::string const kCharsetUTF16BE = "UTF-16BE"; std::string const kCharsetUTF16LE = "UTF-16LE"; std::string const kCharsetUTF32BE = "UTF-32BE"; std::string const kCharsetUTF32LE = "UTF-32LE"; std::string const kCharsetUnknown = "UNKNOWN"; namespace encoding { bool type::<API key> (std::string const& charset) { static std::set<std::string> const Encodings = { kCharsetUTF8, kCharsetUTF16BE, kCharsetUTF16LE, kCharsetUTF32BE, kCharsetUTF32LE }; return Encodings.find(charset) != Encodings.end(); } io::bytes_ptr convert (io::bytes_ptr content, std::string const& from, std::string const& to) { io::bytes_ptr res; if(from == to) return to == kCharsetUTF8 && !utf8::is_valid(content->begin(), content->end()) ? res : content; iconv_t cd = iconv_open(to.c_str(), from.c_str()); if(cd == (iconv_t)(-1)) return res; std::string buffer(1024, ' '); size_t buffer_contains = 0; char const* first = content->begin(); char const* last = content->end(); while(first != last) { if(buffer.size() - buffer_contains < 256) buffer.resize(buffer.size() * 2); char* dst = &buffer[buffer_contains]; size_t dstSize = buffer.size() - buffer_contains; size_t srcSize = last - first; size_t rc = iconv(cd, (char**)&first, &srcSize, &dst, &dstSize); if(rc == (size_t)(-1) && errno != E2BIG && (errno != EINVAL || buffer.size() - buffer_contains - dstSize == 0)) break; D(DBF_File_Charset, bug("did decode %zu bytes\n", buffer.size() - buffer_contains - dstSize);); buffer_contains += buffer.size() - buffer_contains - dstSize; } iconv_close(cd); if(first == last) { ASSERT(to != kCharsetUTF8 || utf8::is_valid(buffer.begin(), buffer.end())); buffer.resize(buffer_contains); res.reset(new io::bytes_t(buffer)); } return res; } } /* encoding */
using System; namespace Starliners { static class <API key> { public const string DEBUG_NOTIFY = "debug_notify"; public const string BATTLE_REPORT = "battle_report"; public const string CONQUEST_REPORT = "conquest_report"; public const string FACTION_ELIMINATED = "faction_eliminated"; } }
<!DOCTYPE html> <html lang="en" class="no-js"> <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Unity - Scripting API: Vector2.Max</title> <meta name="description" content="Develop once, publish everywhere! Unity is the ultimate tool for video game development, architectural visualizations, and interactive media installations - publish to the web, Windows, OS X, Wii, Xbox 360, and iPhone with many more platforms to come." /> <meta name="author" content="Unity Technologies" /> <link rel="shortcut icon" href="../StaticFiles/images/favicons/favicon.ico" /> <link rel="icon" type="image/png" href="../StaticFiles/images/favicons/favicon.png" /> <link rel="<API key>" sizes="152x152" href="../StaticFiles/images/favicons/<API key>.png" /> <link rel="<API key>" sizes="144x144" href="../StaticFiles/images/favicons/<API key>.png" /> <link rel="<API key>" sizes="120x120" href="../StaticFiles/images/favicons/<API key>.png" /> <link rel="<API key>" sizes="114x114" href="../StaticFiles/images/favicons/<API key>.png" /> <link rel="<API key>" sizes="72x72" href="../StaticFiles/images/favicons/<API key>.png" /> <link rel="<API key>" href="../StaticFiles/images/favicons/apple-touch-icon.png" /> <meta name="<API key>" content="#222c37" /> <meta name="<API key>" content="../StaticFiles/images/favicons/tileicon-144x144.png" /> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-2854981-1']); _gaq.push(['_setDomainName', 'unity3d.com']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https: var s = document.<API key>('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> <script type="text/javascript" src="../StaticFiles/js/jquery.js"> </script> <script type="text/javascript" src="docdata/toc.js">//toc</script> <!--local TOC <script type="text/javascript" src="docdata/global_toc.js">//toc</script> <!--global TOC, including other platforms <script type="text/javascript" src="../StaticFiles/js/core.js"> </script> <link href="http://fonts.googleapis.com/css?family=Open+Sans:400,700,400italic" rel="stylesheet" type="text/css" /> <link rel="stylesheet" type="text/css" href="../StaticFiles/css/core.css" /> </head> <body> <div class="header-wrapper"> <div id="header" class="header"> <div class="content"> <div class="spacer"> <div class="menu"> <div class="logo"> <a href="http://docs.unity3d.com"> </a> </div> <div class="search-form"> <form action="30_search.html" method="get" class="apisearch"> <input type="text" name="q" placeholder="Search scripting..." autosave="Unity Reference" results="5" class="sbox field" id="q"> </input> <input type="submit" class="submit"> </input> </form> </div> <ul> <li> <a href="http://docs.unity3d.com">Overview</a> </li> <li> <a href="../Manual/index.html">Manual</a> </li> <li> <a href="../ScriptReference/index.html" class="selected">Scripting API</a> </li> </ul> </div> </div> <div class="more"> <div class="filler"> </div> <ul> <li> <a href="http://unity3d.com/">unity3d.com</a> </li> </ul> </div> </div> </div> <div class="toolbar"> <div class="content clear"> <div class="lang-switcher hide"> <div class="current toggle" data-target=".lang-list"> <div class="lbl">Language: <span class="b">English</span></div> <div class="arrow"> </div> </div> <div class="lang-list" style="display:none;"> <ul> <li> <a href="">English</a> </li> </ul> </div> </div> <div class="script-lang"> <ul> <li class="selected" data-lang="CS">C <li data-lang="JS">JS</li> </ul> <div id="script-lang-dialog" class="dialog hide"> <div class="dialog-content clear"> <h2>Script language</h2> <div class="close"> </div> <p class="clear">Select your preferred scripting language. All code snippets will be displayed in this language.</p> </div> </div> </div> </div> </div> </div> <div id="master-wrapper" class="master-wrapper clear"> <div id="sidebar" class="sidebar"> <div class="sidebar-wrap"> <div class="content"> <div class="sidebar-menu"> <div class="toc"> <h2>Scripting API</h2> </div> </div> <p> <a href="40_history.html" class="cw">History</a> </p> </div> </div> </div> <div id="content-wrap" class="content-wrap"> <div class="content-block"> <div class="content"> <div class="section"> <div class="mb20 clear"> <h1 class="heading inherit"> <a href="Vector2.html">Vector2</a>.Max</h1> <div class="clear"> </div> <div class="clear"> </div> <div class="suggest"> <a class="blue-btn sbtn">Suggest a change</a> <div class="suggest-wrap rel hide"> <div class="loading hide"> <div> </div> <div> </div> <div> </div> </div> <div class="suggest-success hide"> <h2>Success!</h2> <p>Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.</p> <a class="gray-btn sbtn close">Close</a> </div> <div class="suggest-failed hide"> <h2>Sumbission failed</h2> <p>For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.</p> <a class="gray-btn sbtn close">Close</a> </div> <div class="suggest-form clear"> <label for="suggest_name">Your name</label> <input id="suggest_name" type="text"> </input> <label for="suggest_email">Your email</label> <input id="suggest_email" type="email"> </input> <label for="suggest_body" class="clear">Suggestion <span class="r">*</span></label> <textarea id="suggest_body" class="req"> </textarea> <button id="suggest_submit" class="blue-btn mr10">Submit suggestion</button> <p class="mb0"> <a class="cancel left lh42 cn">Cancel</a> </p> </div> </div> </div> <a href="" class="switch-link gray-btn sbtn left hide">Switch to Manual</a> <div class="clear"> </div> </div> <div class="subsection"> <div class="signature"> <div class="signature-JS sig-block">public static function <span class="sig-kw">Max</span>(<span class="sig-kw">lhs</span>: <a href="Vector2.html">Vector2</a>, <span class="sig-kw">rhs</span>: <a href="Vector2.html">Vector2</a>): <a href="Vector2.html">Vector2</a>; </div> <div class="signature-CS sig-block">public static <a href="Vector2.html">Vector2 </a><span class="sig-kw">Max</span>(<a href="Vector2.html">Vector2 </a><span class="sig-kw">lhs</span>, <a href="Vector2.html">Vector2 </a><span class="sig-kw">rhs</span>); </div> </div> </div> <div class="subsection"> <h2>Parameters</h2> <table class="list"> </table> </div> <div class="subsection"> <h2>Description</h2> <p>Returns a vector that is made from the largest components of two vectors.</p> </div> <div class="subsection"> <p>See Also: <a href="Vector2.Min.html">Min</a> function.</p> </div> <div class="subsection"> <pre class="codeExampleJS"> var a : <a href="Vector2.html">Vector2</a> = <a href="Vector2.html">Vector2</a> (1, 3); var b : <a href="Vector2.html">Vector2</a> = <a href="Vector2.html">Vector2</a> (4, 2); print (<a href="Vector2.Max.html">Vector2.Max</a>(a,b)); // prints (4.0,3.0)</pre> <pre class="codeExampleCS">using UnityEngine; using System.Collections;<br /><br />public class ExampleClass : <a href="MonoBehaviour.html">MonoBehaviour</a> { public <a href="Vector2.html">Vector2</a> a = new <a href="Vector2.html">Vector2</a>(1, 3); public <a href="Vector2.html">Vector2</a> b = new <a href="Vector2.html">Vector2</a>(4, 2); void Example() { print(<a href="Vector2.Max.html">Vector2.Max</a>(a, b)); } } </pre> </div> </div> <div class="footer-wrapper"> <div class="footer clear"> <div class="copy">Copyright © 2014 Unity Technologies</div> <div class="menu"> <a href="http://unity3d.com/learn">Learn</a> <a href="http://unity3d.com/community">Community</a> <a href="http://unity3d.com/asset-store">Asset Store</a> <a href="https://store.unity3d.com">Buy</a> <a href="http://unity3d.com/unity/download">Download</a> </div> </div> </div> </div> </div> </div> </div> </body> </html>
<!DOCTYPE HTML> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (15) on Wed Sep 08 10:37:05 UTC 2021 --> <title>Uses of Class rekit.logic.gui.TimeDecorator (ReKiT 1.2.4-SNAPSHOT API)</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="dc.created" content="2021-09-08"> <meta name="description" content="use: package: rekit.logic.gui, class: TimeDecorator"> <meta name="generator" content="javadoc/ClassUseWriter"> <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="class-use-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"> <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><a href="../TimeDecorator.html" title="class in rekit.logic.gui">Class</a></li> <li class="nav-bar-cell1-rev">Use</li> <li><a href="../package-tree.html">Tree</a></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> <span class="skip-nav" id="skip.navbar.top"> </span></nav> </header> <div class="flex-content"> <main role="main"> <div class="header"> <h1 title="Uses of Class rekit.logic.gui.TimeDecorator" class="title">Uses of Class<br>rekit.logic.gui.TimeDecorator</h1> </div> No usage of rekit.logic.gui.TimeDecorator</main> <footer role="contentinfo"> <nav role="navigation"> <div class="bottom-nav" id="navbar.bottom"> <div class="skip-nav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <ul id="navbar.bottom.firstrow" class="nav-list" title="Navigation"> <li><a href="../../../../index.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../TimeDecorator.html" title="class in rekit.logic.gui">Class</a></li> <li class="nav-bar-cell1-rev">Use</li> <li><a href="../package-tree.html">Tree</a></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> <span class="skip-nav" id="skip.navbar.bottom"> </span></nav> <p class="legal-copy"><small>Copyright & </footer> </div> </div> </body> </html>
#ifdef HAVE_CONFIG_H #include "config.h" #endif #include <<API key>.h> #include <gr_io_signature.h> #include <cstdio> #include <errno.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <stdexcept> #include <string.h> // public constructor that returns a shared_ptr <API key> <API key>(gr_pdu_vector_type t) { return gnuradio::get_initial_sptr(new <API key>(t)); } <API key>::<API key> (gr_pdu_vector_type t) : gr_sync_block("<API key>", <API key>(1, 1, gr_pdu_itemsize(t)), <API key>(0, 0, 0)), d_vectortype(t), d_itemsize(gr_pdu_itemsize(t)), d_inpdu(false), d_pdu_meta(pmt::PMT_NIL), d_pdu_vector(pmt::PMT_NIL) { <API key>(PDU_PORT_ID); } <API key>::~<API key>() { printf("destructor running\n"); } int <API key>::work(int noutput_items, <API key> &input_items, gr_vector_void_star &output_items) { const uint8_t *in = (const uint8_t*) input_items[0]; uint64_t abs_N = nitems_read(0); // if we are not in a pdu already, start a new one if(!d_inpdu){ get_tags_in_range(d_tags, 0, abs_N, abs_N+1); bool found_length_tag(false); for(d_tags_itr = d_tags.begin(); (d_tags_itr != d_tags.end()) && (!found_length_tag); d_tags_itr++){ if( pmt::pmt_equal( (*d_tags_itr).key, PDU_LENGTH_TAG ) ){ if( (*d_tags_itr).offset != abs_N ){ throw std::runtime_error("expected next pdu length tag on a different item..."); } found_length_tag = true; d_pdu_length = pmt::pmt_to_long( (*d_tags_itr).value ); d_pdu_remain = d_pdu_length; d_pdu_meta = pmt::pmt_make_dict(); break; } // if have length tag } // iter over tags if(!found_length_tag){ throw std::runtime_error("tagged stream does not contain a pdu_length tag!"); } } size_t ncopy = std::min((size_t)noutput_items, d_pdu_remain); // copy any tags in this range into our meta object get_tags_in_range(d_tags, 0, abs_N, abs_N+ncopy); for(d_tags_itr = d_tags.begin(); d_tags_itr != d_tags.end(); d_tags_itr++){ if( ! pmt_equal( (*d_tags_itr).key, PDU_LENGTH_TAG ) ){ d_pdu_meta = pmt_dict_add(d_pdu_meta, (*d_tags_itr).key, (*d_tags_itr).value); } } // copy samples for this vector into either a pmt or our save buffer if(ncopy == d_pdu_remain){ // we will send this pdu if(d_save.size() == 0){ d_pdu_vector = gr_pdu_make_vector(d_vectortype, in, ncopy); send_message(); } else { size_t oldsize = d_save.size(); d_save.resize((oldsize + ncopy)*d_itemsize, 0); memcpy( &d_save[oldsize*d_itemsize], in, ncopy*d_itemsize ); d_pdu_vector = gr_pdu_make_vector(d_vectortype, &d_save[0], d_pdu_length); send_message(); d_save.clear(); } } else { d_inpdu = true; size_t oldsize = d_save.size(); d_save.resize( (oldsize+ncopy)*d_itemsize ); memcpy( &d_save[oldsize*d_itemsize], in, ncopy*d_itemsize ); d_pdu_remain -= ncopy; } return ncopy; } void <API key>::send_message(){ if(pmt::pmt_length(d_pdu_vector) != d_pdu_length){ throw std::runtime_error("msg length not correct"); } pmt::pmt_t msg = pmt::pmt_cons( d_pdu_meta, d_pdu_vector ); message_port_pub( PDU_PORT_ID, msg ); d_pdu_meta = pmt::PMT_NIL; d_pdu_vector = pmt::PMT_NIL; d_pdu_length = 0; d_pdu_remain = 0; d_inpdu = false; }
var <API key> = [ [ "check", "de/dc5/<API key>.html#<API key>", null ], [ "checkParameter", "de/dc5/<API key>.html#<API key>", null ], [ "convert", "de/dc5/<API key>.html#<API key>", null ], [ "convert", "de/dc5/<API key>.html#<API key>", null ], [ "isAbbreviation", "de/dc5/<API key>.html#<API key>", null ], [ "parse", "de/dc5/<API key>.html#<API key>", null ], [ "<API key>", "de/dc5/<API key>.html#<API key>", null ] ];
// This file is part of libhpc. // libhpc is free software: you can redistribute it and/or modify // (at your option) any later version. // libhpc is distributed in the hope that it will be useful, // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #include <cxxtest/TestSuite.h> #include "libhpc/containers/num.hh" #include "libhpc/numerics/interp.hh" using namespace hpc; class interp_suite : public CxxTest::TestSuite { public: void test_interpolate() { vector<double> abs( 4 ), vals( 4 ); abs[0] = -1.0; vals[0] = 0.5; abs[1] = 0.0; vals[1] = 0.0; abs[2] = 3.0; vals[2] = 3.0; abs[3] = 5.0; vals[3] = 2.0; numerics::interp<double> interp; interp.set_abscissa( abs ); interp.set_values( vals ); TS_ASSERT( abs.empty() ); TS_ASSERT( vals.empty() ); // Test specific values. TS_ASSERT_DELTA( interp[-1.0], 0.5, 1e-5 ); TS_ASSERT_DELTA( interp[0.0], 0.0, 1e-5 ); TS_ASSERT_DELTA( interp[3.0], 3.0, 1e-5 ); TS_ASSERT_DELTA( interp[5.0], 2.0, 1e-5 ); // Test interpolation. TS_ASSERT_DELTA( interp[-0.5], 0.25, 1e-5 ); TS_ASSERT_DELTA( interp[1.5], 1.5, 1e-5 ); TS_ASSERT_DELTA( interp[4.0], 2.5, 1e-5 ); } };
FILE_LICENCE ( <API key> ); #include <stdint.h> #include <stdio.h> #include <byteswap.h> #include <ipxe/uuid.h> /** @file * * Universally unique IDs * */ /** * Convert UUID to printable string * * @v uuid UUID * @ret string UUID in canonical form */ char * uuid_ntoa ( const union uuid *uuid ) { static char buf[37]; /* "<API key>" */ sprintf ( buf, "%08x-%04x-%04x-%04x-%02x%02x%02x%02x%02x%02x", be32_to_cpu ( uuid->canonical.a ), be16_to_cpu ( uuid->canonical.b ), be16_to_cpu ( uuid->canonical.c ), be16_to_cpu ( uuid->canonical.d ), uuid->canonical.e[0], uuid->canonical.e[1], uuid->canonical.e[2], uuid->canonical.e[3], uuid->canonical.e[4], uuid->canonical.e[5] ); return buf; }
package stream; import decoder.Squitter; import java.util.ArrayList; public class RTLInputStream extends InputStream { private int deviceID; public RTLInputStream(int deviceID) { } public ArrayList<Squitter> getSquitter() { return new ArrayList<Squitter>(); } public String getInputStreamName() { return "RTL" + this.deviceID; } public void close() {} }
"""Functions for the backend of LetterBoy""" def lb_standardcase(): """Capitalise the first letter of each sentence, and set all others to lowercase.""" pass def lb_uppercase(): """Capitalise each letter.""" pass def lb_lowercase(): """Set all letters to lowercase.""" pass def lb_camelcase(): """Capitalise the first letter of each word, and set all others to lowercase.""" pass def lb_staggercase(): """Alternate each character between upper- and lower-case.""" pass def lb_jumbles_nontrobo(): """Jumble up text between the first and last letters in each word.""" pass def lb_zcorrupt(): """Add glitch text to the plaintext.""" pass def lb_zstrip(): """Remove glitch text.""" pass
title: "IPL नीलामी: नीलामी में शामिल होंगे 332 खिलाड़ी" layout: item category: ["sports"] date: 2019-12-13T09:03:15.127Z image: <API key>.jpg <p>नई दिल्ली: इंडियन प्रीमियर लीग (आईपीएल) ने 332 खिलाड़ियों की लिस्ट जारी कर दी है, जिनपर कोलकाता में होने वाली नीलामी में बोली लगेगी। आईपीएल के 13वें सीजन के लिए होने वाली नीलामी में 73 खिलाड़ी खरीदे जाएंगे, जिसमें 29 विदेशी खिलाड़ी शामिल होंगे। खिलाड़ियों की नीलामी 19 दिसंबर को दोपहर 3.30 बजे से होगी।</p> <p>इससे पहले 971 खिलाड़ियों (713 भारतीय और 258 विदेशी खिलाड़ियों) ने कोलकाता में होने वाली नीलामी के लिए रजिस्टर्ड कराया था। हालांकि अब नीलामी के लिए 332 खिलाड़ियों को ही शॉर्टलिस्ट किया गया है। जिनमें कुल 186 भारतीय खिलाड़ी, 143 विदेशी खिलाड़ी और एसोसिएट नेशंस के 3 खिलाड़ी शामिल हैं।</p> <p>नीलामी के लिए जारी लिस्ट में 7 खिलाड़ियों की बेस प्राइस 2 करोड़ रुपये, जो सभी विदेशी है। पैट कमिंस, जोश हेजलवुड, क्रिस लिन, मिशेल मार्श, ग्लेन मैक्सवेल, डेल स्टेन और एंजेलो मैथ्यूज ने खुद को सबसे ज्यादा बेस प्राइस वाले स्लैब में रखा है। लिस्ट देखने के लिए यहां <a href="http: <p>भारतीय खिलाड़ियों में रोबिन उथप्पा का बेस प्राइस सबसे अधिक डेढ़ करोड़ रुपये है, वहीं पिछले दो सीजन में सबसे अधिक नीलामी रकम हासिल करने वाले जयदेव उनादकट ने अपना बेस प्राइस एक करोड़ रुपये रखा है। इसके अलावा पीयूष चावला और यूसुफ पठान का बेस प्राइस भी 1 करोड़ रुपये है।</p> <p>332 खिलाड़ियों की लिस्ट में सबसे चौंकाने वाली बात है कि टीम इंडिया के पूर्व ऑलराउंडर युवराज सिंह का नाम इसमें नहीं है। युवराज सिंह को पिछले साल आईपीएल नीलामी में मुंबई इंडियंस ने 1 करोड़ रुपये के बेस प्राइस पर खरीदा था, लेकिन खराब प्रदर्शन के बाद टीम ने उन्हें रिलीज कर दिया।</p>
<!DOCTYPE HTML PUBLIC "- <!--NewPage <HTML> <HEAD> <!-- Generated by javadoc (build 1.5.0_22) on Fri Apr 19 18:20:47 CEST 2013 --> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <TITLE> Uses of Class org.apache.http.impl.conn.<API key> (HttpComponents Client 4.2.5 API) </TITLE> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { parent.document.title="Uses of Class org.apache.http.impl.conn.<API key> (HttpComponents Client 4.2.5 API)"; } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <A NAME="navbar_top"></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../org/apache/http/impl/conn/<API key>.html" title="class in org.apache.http.impl.conn"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../../index.html?org/apache/http/impl/conn/class-use/<API key>.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="<API key>.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <! if(window==top) { document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } </SCRIPT> <NOSCRIPT> <A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <HR> <CENTER> <H2> <B>Uses of Class<br>org.apache.http.impl.conn.<API key></B></H2> </CENTER> No usage of org.apache.http.impl.conn.<API key> <P> <HR> <A NAME="navbar_bottom"></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="<API key>"></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="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../org/apache/http/impl/conn/<API key>.html" title="class in org.apache.http.impl.conn"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../../index.html?org/apache/http/impl/conn/class-use/<API key>.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="<API key>.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <! if(window==top) { document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } </SCRIPT> <NOSCRIPT> <A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <HR> Copyright & </BODY> </HTML>
<?php $NAME='<API key> malware_signature- ID 2501'; $TAGCLEAR='<!--#execs+cmd=[\'"]{0,1}$HTTP_ACCEPT[\'"]{0,1}-->'; $TAGBASE64='<API key>='; $TAGHEX='3c212d2d2365786563732b636d643d5b5c27225d7b302c317d24485454505f4143434550545b5c27225d7b302c317d2d2d3e'; $TAGHEXPHP=''; $TAGURI='%3C%21--%23execs%2Bcmd%3D%5B%5C%27%22%5D%7B0%2C1%7D%24HTTP_ACCEPT%5B%5C%27%22%5D%7B0%2C1%7D--%3E'; $TAGCLEAR2=''; $TAGBASE642=''; $TAGHEX2=''; $TAGHEXPHP2=''; $TAGURI2=''; $DATEADD='10/09/2019'; $LINK='Webexploitscan.org ;<API key> malware_signature- ID 2501 '; $ACTIVED='1'; $VSTATR='malware_signature';
{% extends "completo.html"%} {% block content %} <script> function menu(){ document.getElementById('cuenta').style.backgroundColor='#FFF'; } window.onload=menu(); </script> <div id="wrapper"> <div id="secWrapper"> <div id="container" class="clearfix"> <br /> <br /> <br /> <div style="width:940px; background-color:#E6E6E6; border:1px solid #CCC; height:22px; text-align:left;"> <span style="text-align:left; margin-left:15px;"> Tus Mensajes </span> </div> <br /> <!-- Columna Principal --> <div id="mainCol" class="clearfix"> <div class="titulo"><span style="font-style:italic;"></span></div> <div style="text-align:justify; font-size:13px;"><b></b></div> {{ redactarform }} <div class="form-row destino"> <div> <label for="id_destino">Destinatarios:</label> <input type="text" id="lookup_destino" value="" size="40" search_fields="documentoidentidad,nombre,apellido,id" app_label="actores" model_name="directorios" autocomplete_mode="ManyToMany" class="ac_input" autocomplete="off"> <div style="float:left; padding-left:105px; width:300px;"> <font style="color:#999999;font-size:10px !important;"></font> <div id="box_destino" style="padding-left:20px;cursor:pointer;"> </div></div> <a href="../../../actores/directorios/add/" class="add-another" id="add_id_destino" onclick="return <API key>(this);"> <img src="/static/admin/img/admin/icon_addlink.gif" width="10" height="10" alt="Añadir otro"></a> </div> </div> <script type="text/javascript"> (function($) { var field = null; })(django.jQuery); </script> <script type="text/javascript"> (function($) { $(document).ready(function($) { // alert('iniciando'); }); })(django.jQuery); </script> </div> <!-- Fin Columna Principal --> <div id="secCol"> <div id="noticias" style="border:1px solid #CCC; width:218px; background-color:#FFF;"> &nbsp;&nbsp;&nbsp;Hola, <span style="font-style:italic;">{{ persona.nombre }}</span> (<a href="/salir.php">Salir</a>) </div> <div id="secCol-punta"> </div> </div> <div id="secCol"> <div id="noticias" style="border:1px solid #CCC; width:218px; background-color:#FFF;"> <table width="90%" style="margin-left:10px;"> <tr> <td style="background-color:#D6D6D6;" align="center"> &nbsp;&nbsp;&nbsp;<a style="text-decoration:none; cursor:pointer;color:#000;font-size:12px; font-family:'Trebuchet MS', Arial, Helvetica, sans-serif;" href="/perfil">Responder</a> </td> </tr> <tr> <td style="background-color:#D6D6D6;" align="center"> &nbsp;&nbsp;&nbsp;<a style="text-decoration:none; cursor:pointer;color:#000;font-size:12px; font-family:'Trebuchet MS', Arial, Helvetica, sans-serif;" href="/perfil">Borrar</a> </td> </tr> <tr> <td style="background-color:#D6D6D6;" align="center"> &nbsp;&nbsp;&nbsp;<a style="text-decoration:none; cursor:pointer;color:#000;font-size:12px; font-family:'Trebuchet MS', Arial, Helvetica, sans-serif;" href="/perfil">Reportar</a> </td> </tr> </table> </div> <div id="secCol-punta"> </div> </div> <div id="secCol"> <div id="noticias" style="border:1px solid #CCC; width:218px; background-color:#FFF;"> <table width="90%" style="margin-left:10px;"> <tr> <td style="background-color:#D6D6D6;" align="center"> &nbsp;&nbsp;&nbsp;<a style="text-decoration:none; cursor:pointer;color:#000;font-size:12px; font-family:'Trebuchet MS', Arial, Helvetica, sans-serif;" href="/perfil">Redactar</a> </td> </tr> <tr> <td style="background-color:#D6D6D6;" align="center"> &nbsp;&nbsp;&nbsp;<a style="text-decoration:none; cursor:pointer;color:#000;font-size:12px; font-family:'Trebuchet MS', Arial, Helvetica, sans-serif;" href="/perfil">Ver Enviados</a> </td> </tr> <tr> <td style="background-color:#D6D6D6;" align="center"> &nbsp;&nbsp;&nbsp;<a style="text-decoration:none; cursor:pointer;color:#000;font-size:12px; font-family:'Trebuchet MS', Arial, Helvetica, sans-serif;" href="/perfil">Ver Borradores</a> </td> </tr> </table> </div> <div id="secCol-punta"> </div> </div> </div> </div> </div> {% endblock %}
using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace RinconArtesano.Models { public class <API key> { public int ProductCategoryId { get; set; } public string ProductCategoryName { get; set; } public string <API key> { get; set; } public string FilePath { get; set; } } }
<?php require_once("includes/setup.php"); require_once("includes/sidebar.php"); require_once("includes/classes/Member.php"); checkLogin(); $progId = <API key>($_GET['id']); // Get Performance Program Details $progDets = $GLOBALS['db']->getRow("SELECT * FROM <API key> WHERE id = '$progId';"); db_checkerrors($progDets); htmlHeaders("Performance Program Setup - Swimming Management System"); sidebarMenu(); echo "<div id=\"main\">\n"; echo "<h1>Performance Programs</h1>\n"; echo "<h2>Performance Program Qualifying Times</h2>\n"; echo "<p>\n"; echo "<label>Program Name: </label>" . $progDets[2] . "<br />\n"; echo "<label>Program Start Date: </label>" . $progDets[4] . "<br />\n"; echo "<label>Program End Date: </label>" . $progDets[5] . "<br />\n"; echo "<label>Qualifying Times Required: </label>" . $progDets[7] . "<br />\n"; echo "</p>\n"; echo "<table class=\"list\">\n"; echo "<thead class=\"list\">\n"; echo "<tr class=\"list\">\n"; echo "<th>Meet Name:</th>\n"; echo "<th>Member Name:</th>\n"; echo "<th>Event: </th>\n"; echo "<th>Age Group:</th>\n"; echo "<th>Level:</th>\n"; echo "<th>Qualifying Time:</th>\n"; echo "</tr>\n"; echo "</thead>\n"; echo "<tbody class=\"list\">\n"; $qualList = $GLOBALS['db']->getAll("SELECT * FROM <API key> WHERE perf_prog_id = '$progId' ORDER BY member_id, level;"); db_checkerrors($qualList); foreach ($qualList as $q) { $meetName = $q[9]; $memberDet = new Member(); $memberDet->loadId($q[4]); $memberName = $memberDet->getFullname(); $memberMSA = $memberDet->getMSANumber(); $eventId = $q[2]; $eventDetails = $GLOBALS['db']->getRow("SELECT event_disciplines.discipline, event_distances.distance FROM event_disciplines, event_distances WHERE event_distances.id = (SELECT distance FROM <API key> WHERE id = '$eventId') AND event_disciplines.id = (SELECT discipline FROM <API key> WHERE id = '$eventId');"); db_checkerrors($eventDetails); $eventDetailInfo = $eventDetails[0] . ' ' . $eventDetails[1]; $ageGroupId = $q[5]; $groupName = $GLOBALS['db']->getOne("SELECT groupname FROM age_groups WHERE id = '$ageGroupId';"); db_checkerrors($groupName); $resultTime = sw_formatSecs($q[8]); $levelId = $q[6]; $levelName = $GLOBALS['db']->getOne("SELECT levelname FROM <API key> WHERE perf_prog_id = '$progId' AND id = '$levelId';"); db_checkerrors($levelName); echo "<tr class=\"list\">\n"; echo "<td>\n"; echo $meetName; echo "</td>\n"; echo "<td>\n"; echo "$memberName($memberMSA)"; echo "</td>\n"; echo "<td>\n"; echo $eventDetailInfo; echo "</td>\n"; echo "<td>\n"; echo $groupName; echo "</td>\n"; echo "<td>\n"; echo $levelName; echo "</td>\n"; echo "<td>\n"; echo $resultTime; echo "</td>\n"; echo "</tr>\n"; } echo "</tbody>\n"; echo "</table>\n"; echo "</div>\n"; htmlFooters(); ?>
timer.Simple(0.1, function() if not luadev then return end local easylua = requirex("easylua") _G.easylua = easylua -- for luadev local function add(cmd,callback) aowl.AddCommand(cmd,function(ply, script, param_a, ...) if not script or script == "" then return false, "invalid script" end local a,b easylua.End() -- nesting not supported local ret,why = callback(ply,script,param_a,...) if not ret then if why==false then a,b = false,why or aowl.TargetNotFound(param_a or "notarget") or "H" elseif isstring(why) then ply:ChatPrint("FAILED: "..tostring(why)) a,b= false,tostring(why) end end easylua.Start(ply) return a,b end,cmd=="lm" and "players" or "developers") end local function X(ply,i) return luadev.GetPlayerIdentifier(ply,'cmd:'..i) end add("l", function(ply, line, target) if luadev.ValidScript then local valid,err = luadev.ValidScript(line,"l") if not valid then return false,err end end return luadev.RunOnServer(line, X(ply,"l"), {ply=ply}) end) add("ls", function(ply, line, target) if luadev.ValidScript then local valid,err = luadev.ValidScript(line,"ls") if not valid then return false,err end end return luadev.RunOnShared(line, X(ply,"ls"), {ply=ply}) end) add("lc", function(ply, line, target) if luadev.ValidScript then local valid,err = luadev.ValidScript(line,"lc") if not valid then return false,err end end return luadev.RunOnClients(line, X(ply,"lc"), {ply=ply}) end) add("lsc", function(ply, line, target) local ent = easylua.FindEntity(target) if ent:IsPlayer() then local script = string.sub(line, string.find(line, target, 1, true)+#target+1) if luadev.ValidScript then local valid,err = luadev.ValidScript(script,'lsc') if not valid then return false,err end end return luadev.RunOnClient(script, ent, X(ply,"lsc"), {ply=ply}) else return false end end) do local sv_allowcslua = GetConVar("sv_allowcslua") add("lm", function(ply, line, target) if not ply:IsAdmin() and not sv_allowcslua:GetBool() then return false, "sv_allowcslua is 0" end luadev.RunOnClient(line, ply,X(ply,"lm"), {ply=ply}) end) end add("lb", function(ply, line, target) if luadev.ValidScript then local valid,err = luadev.ValidScript(line,'lb') if not valid then return false,err end end luadev.RunOnClient(line, ply, X(ply,"lb"), {ply=ply}) return luadev.RunOnServer(line, X(ply,"lb"), {ply=ply}) end) add("print", function(ply, line, target) if luadev.ValidScript then local valid,err = luadev.ValidScript('x('..line..')','print') if not valid then return false,err end end return luadev.RunOnServer("print(" .. line .. ")", X(ply,"print"), {ply=ply}) end) add("table", function(ply, line, target) if luadev.ValidScript then local valid,err = luadev.ValidScript('x('..line..')','table') if not valid then return false,err end end return luadev.RunOnServer("PrintTable(" .. line .. ")", X(ply,"table"), {ply=ply}) end) add("keys", function(ply, line, target) if luadev.ValidScript then local valid,err = luadev.ValidScript('x('..line..')','keys') if not valid then return false,err end end return luadev.RunOnServer("for k, v in pairs(" .. line .. ") do print(k) end", X(ply,"keys"), {ply=ply}) end) add("printc", function(ply, line, target) line = "easylua.PrintOnServer(" .. line .. ")" if luadev.ValidScript then local valid,err = luadev.ValidScript(line,'printc') if not valid then return false,err end end return luadev.RunOnClients(line, X(ply,"printc"), {ply=ply}) end) add("printm", function(ply, line, target) line = "easylua.PrintOnServer(" .. line .. ")" if luadev.ValidScript then local valid,err = luadev.ValidScript(line,'printm') if not valid then return false,err end end luadev.RunOnClient(line, ply, X(ply,"printm"), {ply=ply}) end) add("printb", function(ply, line, target) if luadev.ValidScript then local valid,err = luadev.ValidScript('x('..line..')','printb') if not valid then return false,err end end luadev.RunOnClient("easylua.PrintOnServer(" .. line .. ")", ply, X(ply,"printb"), {ply=ply}) return luadev.RunOnServer("print(" .. line .. ")", X(ply,"printb"), {ply=ply}) end) end)
using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Text.RegularExpressions; using GitCommands.Git; using GitCommands.Utils; using JetBrains.Annotations; namespace GitCommands { <summary>Specifies whether to check untracked files/directories (e.g. via 'git status')</summary> public enum UntrackedFilesMode { <summary>Default is <see cref="All"/>; when <see cref="UntrackedFilesMode"/> is NOT used, 'git status' uses <see cref="Normal"/>.</summary> Default = 1, <summary>Show no untracked files.</summary> No = 2, <summary>Shows untracked files and directories.</summary> Normal = 3, <summary>Shows untracked files and directories, and individual files in untracked directories.</summary> All = 4 } <summary>Specifies whether to ignore changes to submodules when looking for changes (e.g. via 'git status').</summary> public enum <API key> { <summary>Default is <see cref="All"/> (hides all changes to submodules).</summary> Default = 1, <summary>Consider a submodule modified when it either: contains untracked or modified files, or its HEAD differs from the commit recorded in the superproject.</summary> None = 2, <summary>Submodules NOT considered dirty when they only contain <i>untracked</i> content (but they are still scanned for modified content).</summary> Untracked = 3, <summary>Ignores all changes to the work tree of submodules, only changes to the <i>commits</i> stored in the superproject are shown.</summary> Dirty = 4, <summary>Hides all changes to submodules (and suppresses the output of submodule summaries when the config option status.submodulesummary is set).</summary> All = 5 } public static class GitCommandHelpers { public static void <API key>(bool reload = false) { string path = Environment.<API key>("PATH", <API key>.Process); if (!string.IsNullOrEmpty(AppSettings.GitBinDir) && !path.Contains(AppSettings.GitBinDir)) Environment.<API key>("PATH", string.Concat(path, ";", AppSettings.GitBinDir), <API key>.Process); if (!string.IsNullOrEmpty(AppSettings.CustomHomeDir)) { Environment.<API key>( "HOME", AppSettings.CustomHomeDir); return; } if (AppSettings.UserProfileHomeDir) { Environment.<API key>( "HOME", Environment.<API key>("USERPROFILE")); return; } if (reload) { Environment.<API key>( "HOME", UserHomeDir); } //Default! Environment.<API key>("HOME", GetDefaultHomeDir()); //to prevent from leaking processes see issue #1092 for details Environment.<API key>("TERM", "msys"); string sshAskPass = Path.Combine(AppSettings.GetInstallDir(), @"GitExtSshAskPass.exe"); if (EnvUtils.RunningOnWindows()) { if (File.Exists(sshAskPass)) Environment.<API key>("SSH_ASKPASS", sshAskPass); } else if (string.IsNullOrEmpty(Environment.<API key>("SSH_ASKPASS"))) Environment.<API key>("SSH_ASKPASS", "ssh-askpass"); } public static string GetHomeDir() { return Environment.<API key>("HOME") ?? ""; } public static string GetDefaultHomeDir() { if (!string.IsNullOrEmpty(UserHomeDir)) return UserHomeDir; if (EnvUtils.RunningOnWindows()) { return <API key>; } return Environment.GetFolderPath(Environment.SpecialFolder.Personal); } private static string <API key> { get { if (!string.IsNullOrEmpty(Environment.<API key>("HOMEDRIVE"))) { string homePath = Environment.<API key>("HOMEDRIVE"); homePath += Environment.<API key>("HOMEPATH"); return homePath; } return Environment.<API key>("USERPROFILE"); } } public static ProcessStartInfo <API key>(string fileName, string arguments, string workingDirectory, Encoding outputEncoding) { return new ProcessStartInfo { UseShellExecute = false, ErrorDialog = false, CreateNoWindow = true, <API key> = true, <API key> = true, <API key> = true, <API key> = outputEncoding, <API key> = outputEncoding, FileName = fileName, Arguments = arguments, WorkingDirectory = workingDirectory }; } internal static Process StartProcess(string fileName, string arguments, string workingDirectory, Encoding outputEncoding) { <API key>(); string quotedCmd = fileName; if (quotedCmd.IndexOf(' ') != -1) quotedCmd = quotedCmd.Quote(); var <API key> = DateTime.Now; var startInfo = <API key>(fileName, arguments, workingDirectory, outputEncoding); var startProcess = Process.Start(startInfo); startProcess.Exited += (sender, args) => { var <API key> = DateTime.Now; AppSettings.GitLog.Log(quotedCmd + " " + arguments, <API key>, <API key>); }; return startProcess; } public static bool UseSsh(string arguments) { var x = !Plink() && <API key>(arguments); return x || arguments.Contains("plink"); } private static bool <API key>(string arguments) { return (arguments.Contains("@") && arguments.Contains(": (arguments.Contains("@") && arguments.Contains(":")) || (arguments.Contains("ssh: (arguments.Contains("http: (arguments.Contains("git: (arguments.Contains("push")) || (arguments.Contains("remote")) || (arguments.Contains("fetch")) || (arguments.Contains("pull")); } <summary> Transforms the given input Url to make it compatible with Plink, if necessary </summary> public static string <API key>(string inputUrl) { // But ssh:// urls can cause problems if (!inputUrl.StartsWith("ssh") || !Uri.<API key>(inputUrl, UriKind.Absolute)) return "\"" + inputUrl + "\""; // Turn ssh://user@host/path into user@host:path, which works better Uri uri = new Uri(inputUrl, UriKind.Absolute); string fixedUrl = ""; if (!uri.IsDefaultPort) fixedUrl += "-P " + uri.Port + " "; fixedUrl += "\""; if (!String.IsNullOrEmpty(uri.UserInfo)) fixedUrl += uri.UserInfo + "@"; fixedUrl += uri.Host; fixedUrl += ":" + uri.LocalPath.Substring(1) + "\""; return fixedUrl; } private static IEnumerable<string> <API key>(string arguments, string cmd, string workDir, string stdInput) { if (string.IsNullOrEmpty(cmd)) yield break; //process used to execute external commands using (var process = StartProcess(cmd, arguments, workDir, GitModule.SystemEncoding)) { if (!string.IsNullOrEmpty(stdInput)) { process.StandardInput.Write(stdInput); process.StandardInput.Close(); } string line; do { line = process.StandardOutput.ReadLine(); if (line != null) yield return line; } while (line != null); do { line = process.StandardError.ReadLine(); if (line != null) yield return line; } while (line != null); process.WaitForExit(); } } <summary> Run command, console window is hidden, wait for exit, redirect output </summary> public static IEnumerable<string> ReadCmdOutputLines(string cmd, string arguments, string workDir, string stdInput) { <API key>(); arguments = arguments.Replace("$QUOTE$", "\\\""); return <API key>(arguments, cmd, workDir, stdInput); } private static Process <API key>(string arguments, string cmd, string workDir, out string stdOutput, out string stdError, string stdInput) { if (string.IsNullOrEmpty(cmd)) { stdOutput = stdError = ""; return null; } //process used to execute external commands var process = StartProcess(cmd, arguments, workDir, GitModule.SystemEncoding); if (!string.IsNullOrEmpty(stdInput)) { process.StandardInput.Write(stdInput); process.StandardInput.Close(); } <API key>.Read(process, out stdOutput, out stdError); return process; } <summary> Run command, console window is hidden, wait for exit, redirect output </summary> public static string RunCmd(string cmd, string arguments) { try { <API key>(); arguments = arguments.Replace("$QUOTE$", "\\\""); string output, error; using (var process = <API key>(arguments, cmd, "", out output, out error, null)) { process.WaitForExit(); } if (!string.IsNullOrEmpty(error)) { output += Environment.NewLine + error; } return output; } catch (Win32Exception) { return string.Empty; } } private static Process <API key>(string arguments, string cmd, string workDir, out byte[] stdOutput, out byte[] stdError, byte[] stdInput) { if (string.IsNullOrEmpty(cmd)) { stdOutput = stdError = null; return null; } //process used to execute external commands var process = StartProcess(cmd, arguments, workDir, Encoding.Default); if (stdInput != null && stdInput.Length > 0) { process.StandardInput.BaseStream.Write(stdInput, 0, stdInput.Length); process.StandardInput.Close(); } <API key>.ReadBytes(process, out stdOutput, out stdError); return process; } <summary> Run command, console window is hidden, wait for exit, redirect output </summary> public static int RunCmdByte(string cmd, string arguments, string workingdir, byte[] stdInput, out byte[] output, out byte[] error) { try { arguments = arguments.Replace("$QUOTE$", "\\\""); using (var process = <API key>(arguments, cmd, workingdir, out output, out error, stdInput)) { process.WaitForExit(); return process.ExitCode; } } catch (Win32Exception) { output = error = null; return 1; } } private static GitVersion _versionInUse; private static readonly string UserHomeDir = Environment.<API key>("HOME", <API key>.User) ?? Environment.<API key>("HOME", <API key>.Machine); public static GitVersion VersionInUse { get { if (_versionInUse == null || _versionInUse.IsUnknown) { var result = RunCmd(AppSettings.GitCommand, "--version"); _versionInUse = new GitVersion(result); } return _versionInUse; } } public static string CherryPickCmd(string cherry, bool commit, string arguments) { string cherryPickCmd = commit ? "cherry-pick" : "cherry-pick --no-commit"; return cherryPickCmd + " " + arguments + " \"" + cherry + "\""; } <summary> Check if a string represents a commit hash </summary> private static bool IsCommitHash(string value) { return GitRevision.Sha1HashRegex.IsMatch(value); } public static string GetFullBranchName(string branch) { if (branch == null) return null; branch = branch.Trim(); if (string.IsNullOrEmpty(branch) || branch.StartsWith("refs/")) return branch; // If the branch represents a commit hash, return it as-is without appending refs/heads/ (fix issue #2240) // NOTE: We can use `String.IsNullOrEmpty(Module.RevParse(srcRev))` instead if (IsCommitHash(branch)) { return branch; } return "refs/heads/" + branch; } public static string DeleteBranchCmd(string branchName, bool force, bool remoteBranch) { StringBuilder cmd = new StringBuilder("branch"); cmd.Append(force ? " -D" : " -d"); if (remoteBranch) cmd.Append(" -r"); cmd.Append(" \""); cmd.Append(branchName); cmd.Append("\""); return cmd.ToString(); } public static string DeleteTagCmd(string tagName) { return "tag -d \"" + tagName + "\""; } public static string SubmoduleUpdateCmd(string name) { if (string.IsNullOrEmpty(name)) return "submodule update --init --recursive"; return "submodule update --init --recursive \"" + name.Trim() + "\""; } public static string SubmoduleSyncCmd(string name) { if (string.IsNullOrEmpty(name)) return "submodule sync"; return "submodule sync \"" + name.Trim() + "\""; } public static string AddSubmoduleCmd(string remotePath, string localPath, string branch, bool force) { remotePath = remotePath.ToPosixPath(); localPath = localPath.ToPosixPath(); if (!string.IsNullOrEmpty(branch)) branch = " -b \"" + branch.Trim() + "\""; var forceCmd = force ? " -f" : string.Empty; return "submodule add" + forceCmd + branch + " \"" + remotePath.Trim() + "\" \"" + localPath.Trim() + "\""; } public static string RevertCmd(string commit, bool autoCommit, int parentIndex) { var cmd = new StringBuilder("revert "); if (!autoCommit) { cmd.Append("--no-commit "); } if (parentIndex > 0) { cmd.AppendFormat("-m {0} ", parentIndex); } cmd.Append(commit); return cmd.ToString(); } public static string ResetSoftCmd(string commit) { return "reset --soft \"" + commit + "\""; } public static string ResetMixedCmd(string commit) { return "reset --mixed \"" + commit + "\""; } public static string ResetHardCmd(string commit) { return "reset --hard \"" + commit + "\""; } public static string CloneCmd(string fromPath, string toPath) { return CloneCmd(fromPath, toPath, false, false, string.Empty, null); } public static string CloneCmd(string fromPath, string toPath, bool central, bool initSubmodules, string branch, int? depth) { var from = PathUtil.IsLocalFile(fromPath) ? fromPath.ToPosixPath() : fromPath; var to = toPath.ToPosixPath(); var options = new List<string> { "-v" }; if (central) options.Add("--bare"); if (initSubmodules) options.Add("--recurse-submodules"); if (depth.HasValue) options.Add("--depth " + depth); options.Add("--progress"); if (!string.IsNullOrEmpty(branch)) options.Add("--branch " + branch); options.Add(string.Format("\"{0}\"", from.Trim())); options.Add(string.Format("\"{0}\"", to.Trim())); return "clone " + string.Join(" ", options.ToArray()); } public static string CheckoutCmd(string <API key>, LocalChangesAction changesAction) { string args = ""; switch (changesAction) { case LocalChangesAction.Merge: args = " --merge"; break; case LocalChangesAction.Reset: args = " --force"; break; } return string.Format("checkout{0} \"{1}\"", args, <API key>); } <summary>Create a new orphan branch from <paramref name="startPoint"/> and switch to it.</summary> public static string CreateOrphanCmd(string newBranchName, string startPoint = null) { return string.Format("checkout --orphan {0} {1}", newBranchName, startPoint); } <summary>Remove files from the working tree and from the index. <remarks>git rm</remarks></summary> <param name="force">Override the up-to-date check.</param> <param name="isRecursive">Allow recursive removal when a leading directory name is given.</param> <param name="files">Files to remove. Fileglobs can be given to remove matching files.</param> public static string RemoveCmd(bool force = true, bool isRecursive = true, params string[] files) { string file = "."; if (files.Any()) file = string.Join(" ", files); return string.Format("rm {0} {1} {2}", force ? "--force" : string.Empty, isRecursive ? "-r" : string.Empty, file ); } public static string BranchCmd(string branchName, string revision, bool checkout) { if (checkout) return string.Format("checkout -b \"{0}\" \"{1}\"", branchName.Trim(), revision); return string.Format("branch \"{0}\" \"{1}\"", branchName.Trim(), revision); } public static string MergedBranches() { return "branch --merged"; } <summary>Un-sets the git SSH command path.</summary> public static void UnsetSsh() { Environment.<API key>("GIT_SSH", "", <API key>.Process); } <summary>Sets the git SSH command path.</summary> public static void SetSsh(string path) { if (!string.IsNullOrEmpty(path)) Environment.<API key>("GIT_SSH", path, <API key>.Process); } public static bool Plink() { var sshString = GetSsh(); return sshString.EndsWith("plink.exe", StringComparison.<API key>); } <summary>Gets the git SSH command; or "" if the environment variable is NOT set.</summary> public static string GetSsh() { var ssh = Environment.<API key>("GIT_SSH", <API key>.Process); return ssh ?? ""; } <summary>Pushes multiple sets of local branches to remote branches.</summary> public static string PushMultipleCmd(string remote, IEnumerable<GitPushAction> pushActions) { remote = remote.ToPosixPath(); return new GitPush(remote, pushActions) { ReportProgress = VersionInUse.<API key> }.ToString(); } public static string PushTagCmd(string path, string tag, bool all, bool force = false) { path = path.ToPosixPath(); tag = tag.Replace(" ", ""); var sforce = ""; if (force) sforce = "-f "; var sprogressOption = ""; if (VersionInUse.<API key>) sprogressOption = "--progress "; var options = String.Concat(sforce, sprogressOption); if (all) return "push " + options + "\"" + path.Trim() + "\" --tags"; if (!string.IsNullOrEmpty(tag)) return "push " + options + "\"" + path.Trim() + "\" tag " + tag; return ""; } public static string StashSaveCmd(bool untracked, bool keepIndex, string message) { var cmd = "stash save"; if (untracked && VersionInUse.<API key>) cmd += " -u"; if (keepIndex) cmd += " --keep-index"; cmd = cmd.Combine(" ", message.QuoteNE()); return cmd; } public static string ContinueRebaseCmd() { return "rebase --continue"; } public static string SkipRebaseCmd() { return "rebase --skip"; } public static string StartBisectCmd() { return "bisect start"; } public static string ContinueBisectCmd(GitBisectOption bisectOption, params string[] revisions) { var bisectCommand = GetBisectCommand(bisectOption); if (revisions.Length == 0) return bisectCommand; return string.Format("{0} {1}", bisectCommand, string.Join(" ", revisions)); } private static string GetBisectCommand(GitBisectOption bisectOption) { switch (bisectOption) { case GitBisectOption.Good: return "bisect good"; case GitBisectOption.Bad: return "bisect bad"; case GitBisectOption.Skip: return "bisect skip"; default: throw new <API key>(string.Format("Bisect option {0} is not supported", bisectOption)); } } public static string StopBisectCmd() { return "bisect reset"; } public static string RebaseCmd(string branch, bool interactive, bool preserveMerges, bool autosquash, bool autostash) { StringBuilder sb = new StringBuilder("rebase "); if (interactive) { sb.Append(" -i "); sb.Append(autosquash ? "--autosquash " : "--no-autosquash "); } if (preserveMerges) { sb.Append("--preserve-merges "); } if (autostash) { sb.Append("--autostash "); } sb.Append('"'); sb.Append(branch); sb.Append('"'); return sb.ToString(); } public static string RebaseRangeCmd(string from, string branch, string onto, bool interactive, bool preserveMerges, bool autosquash, bool autostash) { StringBuilder sb = new StringBuilder("rebase "); if (interactive) { sb.Append(" -i "); sb.Append(autosquash ? "--autosquash " : "--no-autosquash "); } if (preserveMerges) { sb.Append("--preserve-merges "); } if (autostash) { sb.Append("--autostash "); } sb.Append('"') .Append(from) .Append("\" "); sb.Append('"') .Append(branch) .Append("\""); sb.Append(" --onto ") .Append(onto); return sb.ToString(); } public static string AbortRebaseCmd() { return "rebase --abort"; } public static string ResolvedCmd() { return "am --3way --resolved"; } public static string SkipCmd() { return "am --3way --skip"; } public static string AbortCmd() { return "am --3way --abort"; } public static string PatchCmd(string patchFile) { if (IsDiffFile(patchFile)) return "apply \"" + patchFile.ToPosixPath() + "\""; else return "am --3way --signoff \"" + patchFile.ToPosixPath() + "\""; } public static string <API key>(string patchFile) { if (IsDiffFile(patchFile)) return "apply --ignore-whitespace \"" + patchFile.ToPosixPath() + "\""; else return "am --3way --signoff --ignore-whitespace \"" + patchFile.ToPosixPath() + "\""; } public static string PatchDirCmd() { return "am --3way --signoff"; } public static string <API key>() { return PatchDirCmd() + " --ignore-whitespace"; } public static string CleanUpCmd(bool dryrun, bool directories, bool nonignored, bool ignored, string paths = null) { string command = "clean"; if (directories) command += " -d"; if (!nonignored && !ignored) command += " -x"; if (ignored) command += " -X"; if (dryrun) command += " --dry-run"; if (!dryrun) command += " -f"; if (!paths.IsNullOrWhiteSpace()) command += " " + paths; return command; } public static string <API key>(bool excludeIgnoredFiles, UntrackedFilesMode untrackedFiles, <API key> ignoreSubmodules = 0) { StringBuilder stringBuilder = new StringBuilder("status --porcelain -z"); switch (untrackedFiles) { case UntrackedFilesMode.Default: stringBuilder.Append(" --untracked-files"); break; case UntrackedFilesMode.No: stringBuilder.Append(" --untracked-files=no"); break; case UntrackedFilesMode.Normal: stringBuilder.Append(" --untracked-files=normal"); break; case UntrackedFilesMode.All: stringBuilder.Append(" --untracked-files=all"); break; } switch (ignoreSubmodules) { case <API key>.Default: stringBuilder.Append(" --ignore-submodules"); break; case <API key>.None: stringBuilder.Append(" --ignore-submodules=none"); break; case <API key>.Untracked: stringBuilder.Append(" --ignore-submodules=untracked"); break; case <API key>.Dirty: stringBuilder.Append(" --ignore-submodules=dirty"); break; case <API key>.All: stringBuilder.Append(" --ignore-submodules=all"); break; } if (!excludeIgnoredFiles) stringBuilder.Append(" --ignored"); return stringBuilder.ToString(); } [CanBeNull] public static GitSubmoduleStatus <API key>(GitModule module, string fileName, string oldFileName, bool staged) { PatchApply.Patch patch = module.GetCurrentChanges(fileName, oldFileName, staged, "", module.FilesEncoding); string text = patch != null ? patch.Text : ""; return GetSubmoduleStatus(text, module, fileName); } [CanBeNull] public static GitSubmoduleStatus <API key>(GitModule module, string submodule) { return <API key>(module, submodule, submodule, false); } public static GitSubmoduleStatus GetSubmoduleStatus(string text, GitModule module, string fileName) { if (string.IsNullOrEmpty(text)) return null; var status = new GitSubmoduleStatus(); using (StringReader reader = new StringReader(text)) { string line = reader.ReadLine(); if (line != null) { var match = Regex.Match(line, @"diff --git a/(\S+) b/(\S+)"); if (match.Groups.Count > 1) { status.Name = match.Groups[1].Value; status.OldName = match.Groups[2].Value; } else { match = Regex.Match(line, @"diff --cc (\S+)"); if (match.Groups.Count > 1) { status.Name = match.Groups[1].Value; status.OldName = match.Groups[1].Value; } } } while ((line = reader.ReadLine()) != null) { if (!line.Contains("Subproject")) continue; char c = line[0]; const string commit = "commit "; string hash = ""; int pos = line.IndexOf(commit); if (pos >= 0) hash = line.Substring(pos + commit.Length); bool bdirty = hash.EndsWith("-dirty"); hash = hash.Replace("-dirty", ""); if (c == '-') { status.OldCommit = hash; } else if (c == '+') { status.Commit = hash; status.IsDirty = bdirty; } // TODO: Support combined merge } } if (status.OldCommit != null && status.Commit != null) { var submodule = module.GetSubmodule(fileName); status.AddedCommits = submodule.GetCommitCount(status.Commit, status.OldCommit); status.RemovedCommits = submodule.GetCommitCount(status.OldCommit, status.Commit); } return status; } /* source: C:\Program Files\msysgit\doc\git\html\git-status.html */ public static List<GitItemStatus> <API key>(GitModule module, string statusString, bool fromDiff = false) { var diffFiles = new List<GitItemStatus>(); if (string.IsNullOrEmpty(statusString)) return diffFiles; /*The status string can show warnings. This is a text block at the start or at the beginning of the file status. Strip it. Example: warning: LF will be replaced by CRLF in CustomDictionary.xml. The file will have its original line endings in your working directory. warning: LF will be replaced by CRLF in FxCop.targets. The file will have its original line endings in your working directory.*/ var nl = new[] { '\n', '\r' }; string trimmedStatus = statusString.Trim(nl); int lastNewLinePos = trimmedStatus.LastIndexOfAny(nl); if (lastNewLinePos > 0) { int ind = trimmedStatus.LastIndexOf('\0'); if (ind < lastNewLinePos) //Warning at end { lastNewLinePos = trimmedStatus.IndexOfAny(nl, ind >= 0 ? ind : 0); trimmedStatus = trimmedStatus.Substring(0, lastNewLinePos).Trim(nl); } else //Warning at beginning trimmedStatus = trimmedStatus.Substring(lastNewLinePos).Trim(nl); } // Doesn't work with removed submodules IList<string> Submodules = module.<API key>(); //Split all files on '\0' (WE NEED ALL COMMANDS TO BE RUN WITH -z! THIS IS ALSO IMPORTANT FOR ENCODING ISSUES!) var files = trimmedStatus.Split(new char[] { '\0' }, StringSplitOptions.RemoveEmptyEntries); for (int n = 0; n < files.Length; n++) { if (string.IsNullOrEmpty(files[n])) continue; int splitIndex = files[n].IndexOfAny(new char[] { '\0', '\t', ' ' }, 1); string status = string.Empty; string fileName = string.Empty; if (splitIndex < 0) { status = files[n]; fileName = files[n + 1]; n++; } else { status = files[n].Substring(0, splitIndex); fileName = files[n].Substring(splitIndex); } char x = status[0]; char y = status.Length > 1 ? status[1] : ' '; if (x != '?' && x != '!' && x != ' ') { GitItemStatus gitItemStatusX = null; if (x == 'R' || x == 'C') // Find renamed files... { string nextfile = n + 1 < files.Length ? files[n + 1] : ""; gitItemStatusX = <API key>(fromDiff, nextfile, fileName, x, status); n++; } else gitItemStatusX = <API key>(fileName, x); gitItemStatusX.IsStaged = true; if (Submodules.Contains(gitItemStatusX.Name)) gitItemStatusX.IsSubmodule = true; diffFiles.Add(gitItemStatusX); } if (fromDiff || y == ' ') continue; GitItemStatus gitItemStatusY; if (y == 'R' || y == 'C') // Find renamed files... { string nextfile = n + 1 < files.Length ? files[n + 1] : ""; gitItemStatusY = <API key>(false, nextfile, fileName, y, status); n++; } else gitItemStatusY = <API key>(fileName, y); gitItemStatusY.IsStaged = false; if (Submodules.Contains(gitItemStatusY.Name)) gitItemStatusY.IsSubmodule = true; diffFiles.Add(gitItemStatusY); } return diffFiles; } public static List<GitItemStatus> <API key>(GitModule module, string lsString) { List<GitItemStatus> result = new List<GitItemStatus>(); string[] lines = lsString.SplitLines(); foreach (string line in lines) { char statusCharacter = line[0]; if (char.IsUpper(statusCharacter)) continue; string fileName = line.Substring(line.IndexOf(' ') + 1); GitItemStatus gitItemStatus = <API key>(fileName, statusCharacter); gitItemStatus.IsStaged = false; gitItemStatus.IsAssumeUnchanged = true; result.Add(gitItemStatus); } return result; } private static GitItemStatus <API key>(bool fromDiff, string nextfile, string fileName, char x, string status) { var gitItemStatus = new GitItemStatus(); //Find renamed files... if (fromDiff) { gitItemStatus.OldName = fileName.Trim(); gitItemStatus.Name = nextfile.Trim(); } else { gitItemStatus.Name = fileName.Trim(); gitItemStatus.OldName = nextfile.Trim(); } gitItemStatus.IsNew = false; gitItemStatus.IsChanged = false; gitItemStatus.IsDeleted = false; if (x == 'R') gitItemStatus.IsRenamed = true; else gitItemStatus.IsCopied = true; gitItemStatus.IsTracked = true; if (status.Length > 2) gitItemStatus.<API key> = status.Substring(1); return gitItemStatus; } private static GitItemStatus <API key>(string fileName, char x) { var gitItemStatus = new GitItemStatus(); gitItemStatus.Name = fileName.Trim(); gitItemStatus.IsNew = x == 'A' || x == '?' || x == '!'; gitItemStatus.IsChanged = x == 'M'; gitItemStatus.IsDeleted = x == 'D'; gitItemStatus.IsRenamed = false; gitItemStatus.IsTracked = x != '?' && x != '!' && x != ' ' || !gitItemStatus.IsNew; gitItemStatus.IsConflict = x == 'U'; return gitItemStatus; } public static string GetRemoteName(string completeName, IEnumerable<string> remotes) { string trimmedName = completeName.StartsWith("refs/remotes/") ? completeName.Substring(13) : completeName; foreach (string remote in remotes) { if (trimmedName.StartsWith(string.Concat(remote, "/"))) return remote; } return string.Empty; } public static string MergeBranchCmd(string branch, bool allowFastForward, bool squash, bool noCommit, string strategy) { StringBuilder command = new StringBuilder("merge"); if (!allowFastForward) command.Append(" --no-ff"); if (!string.IsNullOrEmpty(strategy)) { command.Append(" --strategy="); command.Append(strategy); } if (squash) command.Append(" --squash"); if (noCommit) command.Append(" --no-commit"); command.Append(" "); command.Append(branch); return command.ToString(); } public static string GetFileExtension(string fileName) { if (fileName.Contains(".") && fileName.LastIndexOf(".") < fileName.Length) return fileName.Substring(fileName.LastIndexOf('.') + 1); return null; } // look into patch file and try to figure out if it's a raw diff (i.e from git diff -p) // only looks at start, as all we want is to tell from automail format // returns false on any problem, never throws private static bool IsDiffFile(string path) { try { using (StreamReader sr = new StreamReader(path)) { string line = sr.ReadLine(); return line.StartsWith("diff ") || line.StartsWith("Index: "); } } catch (Exception) { return false; } } // returns " --find-renames=..." according to app settings public static string FindRenamesOpt() { string result = " --find-renames"; if (AppSettings.<API key>) { result += "=\"100%\""; } return result; } // returns " --find-renames=... --find-copies=..." according to app settings public static string <API key>() { string findCopies = " --find-copies"; if (AppSettings.<API key>) { findCopies += "=\"100%\""; } return FindRenamesOpt() + findCopies; } #if !__MonoCS__ static class NativeMethods { [DllImport("kernel32.dll")] public static extern bool <API key>(IntPtr HandlerRoutine, bool Add); [DllImport("kernel32.dll", SetLastError = true)] public static extern bool AttachConsole(int dwProcessId); [DllImport("kernel32.dll", SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool <API key>(uint dwCtrlEvent, int dwProcessGroupId); } #endif public static void TerminateTree(this Process process) { #if !__MonoCS__ if (EnvUtils.RunningOnWindows()) { // Send Ctrl+C NativeMethods.AttachConsole(process.Id); NativeMethods.<API key>(IntPtr.Zero, true); NativeMethods.<API key>(0, 0); if (!process.HasExited) System.Threading.Thread.Sleep(500); } #endif if (!process.HasExited) process.Kill(); } } }
import random import sys class adaptableClass: chance = 0 def __init__(self): self.chance = random.randint(1, 10)/10 def increase(self): if self.chance != 1.0: self.chance = (self.chance * 10 + 1) / 10 def decrease(self): if self.chance != 0.1: self.chance = (self.chance * 10 - 1) / 10 def initgen(popsize): pop = [] for person in range(popsize): pop.append(adaptableClass()) return pop def whogoes(pop): golist = [] nolist = [] for p in range(len(pop)): rand = random.randint(0, 10)/10 if pop[p].chance >= rand: golist.append(p) else: nolist.append(p) return golist, nolist def dicter(go, no, pop): godict = {} nodict = {} for goer in go: current = str(pop[goer].chance) if current in godict: godict[current] += 1 else: godict[current] = 1 for noer in no: current = str(pop[noer].chance) if current in nodict: nodict[current] += 1 else: nodict[current] = 1 return godict, nodict def humanreadable(godict, nodict, popsize, iterations, go, point): if len(go) < point: status = "Going to the El Farol" else: status = "Staying at home" sort = sorted(set(list(godict.keys()) + list(nodict.keys()))) print("Iteration ", iterations, ":", sep = "") print(status, "was the better choice.") print("Chance", " ", "Go", " ", "No go", " ", "Total", sep = "") for s in sort: gofreq = float(godict.get(s, 0))/popsize * 100 nofreq = float(nodict.get(s, 0))/popsize * 100 allfreq = (float(godict.get (s, 0)) + float(nodict.get (s, 0)))/popsize * 100 print(s, sep = "", end = " ") print("%.2f" % gofreq, "%", sep = "", end = " ") print("%.2f" % nofreq, "%", sep = "", end = " ") print("%.2f" % allfreq, "%", sep = "", end = " ") print(int(allfreq)* "*", sep = "") print() def evaler(go, pop, popsize, point): if len(go) < point: success = 1 for g in go: pop[g].increase() else: success = 0 for g in go: pop[g].decrease() return success def main(): goal = int(sys.argv[1]) popsize = int(sys.argv[2]) pop = initgen(popsize) success = 0 for i in range(goal): point = popsize * 0.6 go, no = whogoes(pop) godict, nodict = dicter(go, no, pop) humanreadable(godict, nodict, popsize, i, go, point) success += evaler(go, pop, popsize, point) print("El Farol was the better choice in ", success / goal *100, "% of the cases",sep = "") if __name__ == '__main__': main()
#ifndef <API key> #define <API key> #include <vector> #include "gurobi_c++.h" using namespace std; template<typename T> using vec2 = vector<vector<T>>; template<typename T> using vec3 = vector<vector<vector<T>>>; class <API key> : public GRBModel { public: <API key>(GRBEnv *env, GRBVar *xs, vec2<int>& vehicle_to_paths); ~<API key>(); void solve(vector<int>& assignments); private: GRBVar *xs; vec2<int>& v_to_ps; }; <API key> create_model( GRBEnv *env, vec2<double>& times, vec2<double>& rates, vec2<int>& max_vecs, vec3<int>& paths_in_region, vec2<int>& vehicle_to_paths, int num_paths); #endif
# display Game information to create a game on a server import tkinter as TK import client from cmds import warpWarCmds class gamePane(TK.Frame): # PURPOSE: # RETURNS: def __init__(self, master, owner, **kwargs): TK.LabelFrame.__init__(self, master, text="Game Options", **kwargs) self.hCon = None self.plid = None self.owner = owner self.newGameName = "newGame" print("gamePane --init"); self.initGui() self.useConnection(None) # PURPOSE: Do all the fun UI things # RETURNS: nothing def initGui(self): self.gameName = TK.Entry(self) self.gameName.insert(0, self.newGameName) self.gameName.pack() # Here we need all the options for a game... Size and start bases .... # But I don't want to mess with that. I just want the default game created self.createBtn = TK.Button(self, text = "CreateGame", command = lambda :self.create()) self.createBtn.pack() # PURPOSE: Create a game on the server # RETURNS: nothing def create(self): print("gameCreate") if (self.hCon): sendJson = warpWarCmds().newGame(self.plid, "dummy", self.gameName.get()) self.hCon.sendCmd(sendJson) self.gameName.config(state="disabled") self.config(text="Playing") self.owner.change() # PURPOSE: Use the given connection to client to end "join" # update enable/disable nature of widgets # RETURNS: def useConnection(self, hCon): print("gamepane: useConnection ", hCon) if (hCon): self.hCon = hCon self.createBtn.config(state="normal") if (self.createBtn.cget("text") == "Join"): self.gameName.config(state="normal") else: self.gameName.config(state="disabled") else: self.createBtn.config(state="disabled") self.gameName.config(state="disabled")
#ifndef <API key> #define <API key> /* These are the public details of the configuration. */ #include "wbxml_config.h" /* Define to 1 if you have the <dlfcn.h> header file. */ #cmakedefine HAVE_DLFCN_H /* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ #cmakedefine HAVE_DOPRNT /* Define to 1 if you have the <expat.h> header file. */ /* Define to 1 if you have the `expat' library (-lexpat). */ #cmakedefine HAVE_EXPAT /* Define to 1 if you have the `iconv' library (sometimes in libc). */ #cmakedefine HAVE_ICONV /* Define to 1 if you have the <inttypes.h> header file. */ #cmakedefine HAVE_INTTYPES_H /* Define to 1 if you have the `nsl' library (-lnsl). */ #cmakedefine HAVE_LIBNSL /* Define to 1 if you have the `popt' library (-lpopt). */ #cmakedefine HAVE_LIBPOPT /* Define to 1 if you have the `z' library (-lz). */ #cmakedefine HAVE_LIBZ /* Define to 1 if you have the <limits.h> header file. */ #cmakedefine HAVE_LIMITS_H /* Define to 1 if you have the <memory.h> header file. */ #cmakedefine HAVE_MEMORY_H /* Define to 1 if you have the <stdint.h> header file. */ #cmakedefine HAVE_STDINT_H /* Define to 1 if you have the <stdlib.h> header file. */ #cmakedefine HAVE_STDLIB_H /* Define to 1 if you have the <strings.h> header file. */ #cmakedefine HAVE_STRINGS_H /* Define to 1 if you have the <string.h> header file. */ #cmakedefine HAVE_STRING_H /* Define to 1 if you have the <sys/stat.h> header file. */ #cmakedefine HAVE_SYS_STAT_H /* Define to 1 if you have the <sys/types.h> header file. */ #cmakedefine HAVE_SYS_TYPES_H /* Define to 1 if you have the <unistd.h> header file. */ #cmakedefine HAVE_UNISTD_H /* Define to 1 if you have the `vprintf' function. */ #cmakedefine HAVE_VPRINTF /* Name of package */ #cmakedefine PACKAGE "${PACKAGE}" /* Define to the address where bug reports for this package should be sent. */ #cmakedefine PACKAGE_BUGREPORT "${PACKAGE_BUGREPORT}" /* Define to the full name of this package. */ #cmakedefine PACKAGE_NAME "${PACKAGE_NAME}" /* Define to the full name and version of this package. */ #cmakedefine PACKAGE_STRING "${PACKAGE_STRING}" /* Define to the one symbol short name of this package. */ #cmakedefine PACKAGE_TARNAME "${PACKAGE_TARNAME}" /* Define to the version of this package. */ #cmakedefine PACKAGE_VERSION "${PACKAGE_VERSION}" /* Define to 1 if you have the ANSI C header files. */ #cmakedefine STDC_HEADERS 1 /* Version number of package */ #cmakedefine VERSION "${VERSION}" /* Define to empty if `const' does not conform to ANSI C. */ #cmakedefine const /* Define to `unsigned int' if <sys/types.h> does not define. */ #cmakedefine size_t /* Includes */ #if defined( HAVE_EXPAT) #include <expat.h> #endif /* HAVE_EXPAT */ #if defined( HAVE_ICONV ) #include <iconv.h> #endif /* HAVE_ICONV */ #endif /* <API key> */
#ifndef Alg_h #define Alg_h #include <iostream> #include "Vec.h" #include "SolverTypes.h" #include "Watched.h" #ifdef _MSC_VER #include <msvc/stdint.h> #else #include <stdint.h> #endif //_MSC_VER // Useful functions on vectors template<class T> static inline void printClause(T& ps) { for (uint32_t i = 0; i < ps.size(); i++) { if (ps[i].sign()) printf("-"); printf("%d ", ps[i].var() + 1); } printf("0\n"); } template<class T> static inline void printXorClause(T& ps, const bool xorEqualFalse) { std::cout << "x"; if (xorEqualFalse) std::cout << "-"; for (uint32_t i = 0; i < ps.size(); i++) { std::cout << ps[i].var() + 1 << " "; } std::cout << "0" << std::endl; } template<class V, class T> static inline void remove(V& ts, const T& t) { uint32_t j = 0; for (; j < ts.size() && ts[j] != t; j++); assert(j < ts.size()); for (; j < ts.size()-1; j++) ts[j] = ts[j+1]; ts.pop(); } template<class V, class T> static inline void removeW(V& ts, const T& t) { uint32_t j = 0; for (; j < ts.size() && ts[j].clause != t; j++); assert(j < ts.size()); for (; j < ts.size()-1; j++) ts[j] = ts[j+1]; ts.pop(); } template<class V, class T> static inline bool find(V& ts, const T& t) { uint32_t j = 0; for (; j < ts.size() && ts[j] != t; j++); return j < ts.size(); } template<class V, class T> static inline bool findW(V& ts, const T& t) { uint32_t j = 0; for (; j < ts.size() && ts[j].clause != t; j++); return j < ts.size(); } //Normal clause static bool findWCl(const vec<Watched>& ws, const ClauseOffset c); static void removeWCl(vec<Watched> &ws, const ClauseOffset c); //Binary clause static bool findWBin(const vec<Watched>& ws, const Lit impliedLit); static void removeWBin(vec<Watched> &ws, const Lit impliedLit); static void removeWTri(vec<Watched> &ws, const Lit lit1, Lit lit2); static void removeWBinAll(vec<Watched> &ws, const Lit impliedLit); //Xor Clause static bool findWXCl(const vec<Watched>& ws, const ClauseOffset c); static void removeWXCl(vec<Watched> &ws, const ClauseOffset c); // NORMAL Clause static inline bool findWCl(const vec<Watched>& ws, const ClauseOffset c) { uint32_t j = 0; for (; j < ws.size() && (!ws[j].isClause() || ws[j].getOffset() != c); j++); return j < ws.size(); } static inline void removeWCl(vec<Watched> &ws, const ClauseOffset c) { uint32_t j = 0; for (; j < ws.size() && (!ws[j].isClause() || ws[j].getOffset() != c); j++); assert(j < ws.size()); for (; j < ws.size()-1; j++) ws[j] = ws[j+1]; ws.pop(); } // XOR Clause static inline bool findWXCl(const vec<Watched>& ws, const ClauseOffset c) { uint32_t j = 0; for (; j < ws.size() && (!ws[j].isXorClause() || ws[j].getOffset() != c); j++); return j < ws.size(); } static inline void removeWXCl(vec<Watched> &ws, const ClauseOffset c) { uint32_t j = 0; for (; j < ws.size() && (!ws[j].isXorClause() || ws[j].getOffset() != c); j++); assert(j < ws.size()); for (; j < ws.size()-1; j++) ws[j] = ws[j+1]; ws.pop(); } // BINARY Clause static inline bool findWBin(const vec<Watched>& ws, const Lit impliedLit) { uint32_t j = 0; for (; j < ws.size() && (!ws[j].isBinary() || ws[j].getOtherLit() != impliedLit); j++); return j < ws.size(); } static inline void removeWBin(vec<Watched> &ws, const Lit impliedLit) { uint32_t j = 0; for (; j < ws.size() && (!ws[j].isBinary() || ws[j].getOtherLit() != impliedLit); j++); assert(j < ws.size()); for (; j < ws.size()-1; j++) ws[j] = ws[j+1]; ws.pop(); } static inline void removeWTri(vec<Watched> &ws, const Lit lit1, const Lit lit2) { uint32_t j = 0; for (; j < ws.size() && (!ws[j].isTriClause() || ws[j].getOtherLit() != lit1 || ws[j].getOtherLit2() != lit2); j++); assert(j < ws.size()); for (; j < ws.size()-1; j++) ws[j] = ws[j+1]; ws.pop(); } static inline void removeWBinAll(vec<Watched> &ws, const Lit impliedLit) { Watched *i = ws.getData(); Watched *j = i; for (Watched* end = ws.getDataEnd(); i != end; i++) { if (!i->isBinary() || i->getOtherLit() != impliedLit) *j++ = *i; } ws.shrink(i-j); } #endif
package com.duy.android.compiler.project; import android.support.test.runner.AndroidJUnit4; import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) public class <API key> { }
<?php /** * @deprecated This file is deprecated from Q2A 1.7; use the below file instead. */ require_once QA_INCLUDE_DIR.'pages/problem.php';
#include "<API key>.h" #include <QtCore/QByteArray> #include <QtCore/QList> #include <QtCore/QMap> #include <QtCore/QMetaMethod> #include <QtCore/QString> #include <QtCore/QStringList> #include <QtCore/QVariant> #include <QtCore/QDebug> #include "qdbusutil_p.h" // for the DBUS_* constants #ifndef QT_NO_DBUS QT_BEGIN_NAMESPACE /* * Implementation of interface class <API key> */ /*! \class <API key> \inmodule QtDBus \since 4.2 \brief The <API key> class provides access to the D-Bus bus daemon service. The D-Bus bus server daemon provides one special interface \c org.freedesktop.DBus that allows clients to access certain properties of the bus, such as the current list of clients connected. The <API key> class provides access to that interface. The most common uses of this class are to register and unregister service names on the bus using the registerService() and unregisterService() functions, query about existing names using the isServiceRegistered(), <API key>() and serviceOwner() functions, and to receive notification that a client has registered or de-registered through the serviceRegistered(), serviceUnregistered() and serviceOwnerChanged() signals. */ /*! \enum <API key>::ServiceQueueOptions Flags for determining how a service registration should behave, in case the service name is already registered. \value DontQueueService If an application requests a name that is already owned, no queueing will be performed. The registeredService() call will simply fail. This is the default. \value QueueService Attempts to register the requested service, but do not try to replace it if another application already has it registered. Instead, simply put this application in queue, until it is given up. The serviceRegistered() signal will be emitted when that happens. \value <API key> If another application already has the service name registered, attempt to replace it. \sa <API key> */ /*! \enum <API key>::<API key> Flags for determining if the D-Bus server should allow another application to replace a name that this application has registered with the <API key> option. The possible values are: \value <API key> Do not allow another application to replace us. The service must be explicitly unregistered with unregisterService() for another application to acquire it. This is the default. \value AllowReplacement Allow other applications to replace us with the <API key> option to registerService() without intervention. If that happens, the serviceUnregistered() signal will be emitted. \sa ServiceQueueOptions */ /*! \enum <API key>::<API key> The possible return values from registerService(): \value <API key> The call failed and the service name was not registered. \value ServiceRegistered The caller is now the owner of the service name. \value ServiceQueued The caller specified the QueueService flag and the service was already registered, so we are in queue. The serviceRegistered() signal will be emitted when the service is acquired by this application. */ /*! \internal */ const char *<API key>::staticInterfaceName() { return "org.freedesktop.DBus"; } /*! \internal */ <API key>::<API key>(const QDBusConnection &connection, QObject *parent) : <API key>(QDBusUtil::dbusService(), QDBusUtil::dbusPath(), DBUS_INTERFACE_DBUS, connection, parent) { connect(this, &<API key>::NameAcquired, this, emit &<API key>::serviceRegistered); connect(this, &<API key>::NameLost, this, emit &<API key>::serviceUnregistered); connect(this, &<API key>::NameOwnerChanged, this, emit &<API key>::serviceOwnerChanged); } /*! \internal */ <API key>::~<API key>() { } /*! Returns the unique connection name of the primary owner of the name \a name. If the requested name doesn't have an owner, returns a \c org.freedesktop.DBus.Error.NameHasNoOwner error. */ QDBusReply<QString> <API key>::serviceOwner(const QString &name) const { return internalConstCall(QDBus::AutoDetect, QLatin1String("GetNameOwner"), QList<QVariant>() << name); } /*! \property <API key>::<API key> \brief holds the registered service names Lists all names currently registered on the bus. */ QDBusReply<QStringList> <API key>::<API key>() const { return internalConstCall(QDBus::AutoDetect, QLatin1String("ListNames")); } /*! Returns \c true if the service name \a serviceName has is currently registered. */ QDBusReply<bool> <API key>::isServiceRegistered(const QString &serviceName) const { return internalConstCall(QDBus::AutoDetect, QLatin1String("NameHasOwner"), QList<QVariant>() << serviceName); } /*! Returns the Unix Process ID (PID) for the process currently holding the bus service \a serviceName. */ QDBusReply<uint> <API key>::servicePid(const QString &serviceName) const { return internalConstCall(QDBus::AutoDetect, QLatin1String("<API key>"), QList<QVariant>() << serviceName); } /*! Returns the Unix User ID (UID) for the process currently holding the bus service \a serviceName. */ QDBusReply<uint> <API key>::serviceUid(const QString &serviceName) const { return internalConstCall(QDBus::AutoDetect, QLatin1String("<API key>"), QList<QVariant>() << serviceName); } /*! Requests that the bus start the service given by the name \a name. */ QDBusReply<void> <API key>::startService(const QString &name) { return call(QLatin1String("StartServiceByName"), name, uint(0)); } /*! Requests to register the service name \a serviceName on the bus. The \a qoption flag specifies how the D-Bus server should behave if \a serviceName is already registered. The \a roption flag specifies if the server should allow another application to replace our registered name. If the service registration succeeds, the serviceRegistered() signal will be emitted. If we are placed in queue, the signal will be emitted when we obtain the name. If \a roption is AllowReplacement, the serviceUnregistered() signal will be emitted if another application replaces this one. \sa unregisterService() */ QDBusReply<<API key>::<API key>> <API key>::registerService(const QString &serviceName, ServiceQueueOptions qoption, <API key> roption) { // reconstruct the low-level flags uint flags = 0; switch (qoption) { case DontQueueService: flags = <API key>; break; case QueueService: flags = 0; break; case <API key>: flags = <API key> | <API key>; break; } switch (roption) { case <API key>: break; case AllowReplacement: flags |= <API key>; break; } QDBusMessage reply = call(QLatin1String("RequestName"), serviceName, flags); // qDebug() << "<API key>::registerService" << serviceName << "Reply:" << reply; // convert the low-level flags to something that we can use if (reply.type() == QDBusMessage::ReplyMessage) { uint code = 0; switch (reply.arguments().at(0).toUInt()) { case <API key>: case <API key>: code = uint(ServiceRegistered); break; case <API key>: code = uint(<API key>); break; case <API key>: code = uint(ServiceQueued); break; } reply.setArguments(QVariantList() << code); } return reply; } /*! Releases the claim on the bus service name \a serviceName, that had been previously registered with registerService(). If this application had ownership of the name, it will be released for other applications to claim. If it only had the name queued, it gives up its position in the queue. */ QDBusReply<bool> <API key>::unregisterService(const QString &serviceName) { QDBusMessage reply = call(QLatin1String("ReleaseName"), serviceName); if (reply.type() == QDBusMessage::ReplyMessage) { bool success = reply.arguments().at(0).toUInt() == <API key>; reply.setArguments(QVariantList() << success); } return reply; } /*! \internal */ void <API key>::connectNotify(const QMetaMethod &signal) { // translate the signal names to what we really want // this avoids setting hooks for signals that don't exist on the bus static const QMetaMethod <API key> = QMetaMethod::fromSignal(&<API key>::serviceRegistered); static const QMetaMethod <API key> = QMetaMethod::fromSignal(&<API key>::serviceUnregistered); static const QMetaMethod <API key> = QMetaMethod::fromSignal(&<API key>::serviceOwnerChanged); static const QMetaMethod NameAcquiredSignal = QMetaMethod::fromSignal(&<API key>::NameAcquired); static const QMetaMethod NameLostSignal = QMetaMethod::fromSignal(&<API key>::NameLost); static const QMetaMethod <API key> = QMetaMethod::fromSignal(&<API key>::NameOwnerChanged); if (signal == <API key>) <API key>::connectNotify(NameAcquiredSignal); else if (signal == <API key>) <API key>::connectNotify(NameLostSignal); else if (signal == <API key>) { static bool warningPrinted = false; if (!warningPrinted) { qWarning("Connecting to deprecated signal <API key>::serviceOwnerChanged(QString,QString,QString)"); warningPrinted = true; } <API key>::connectNotify(<API key>); } } /*! \internal */ void <API key>::disconnectNotify(const QMetaMethod &signal) { // translate the signal names to what we really want // this avoids setting hooks for signals that don't exist on the bus static const QMetaMethod <API key> = QMetaMethod::fromSignal(&<API key>::serviceRegistered); static const QMetaMethod <API key> = QMetaMethod::fromSignal(&<API key>::serviceUnregistered); static const QMetaMethod <API key> = QMetaMethod::fromSignal(&<API key>::serviceOwnerChanged); static const QMetaMethod NameAcquiredSignal = QMetaMethod::fromSignal(&<API key>::NameAcquired); static const QMetaMethod NameLostSignal = QMetaMethod::fromSignal(&<API key>::NameLost); static const QMetaMethod <API key> = QMetaMethod::fromSignal(&<API key>::NameOwnerChanged); if (signal == <API key>) <API key>::disconnectNotify(NameAcquiredSignal); else if (signal == <API key>) <API key>::disconnectNotify(NameLostSignal); else if (signal == <API key>) <API key>::disconnectNotify(<API key>); } // signals /*! \fn <API key>::serviceRegistered(const QString &serviceName) This signal is emitted by the D-Bus server when the bus service name (unique connection name or well-known service name) given by \a serviceName is acquired by this application. Acquisition happens after this application has requested a name using registerService(). */ /*! \fn <API key>::serviceUnregistered(const QString &serviceName) This signal is emitted by the D-Bus server when this application loses ownership of the bus service name given by \a serviceName. */ /*! \fn <API key>::serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner) \deprecated Use QDBusServiceWatcher instead. This signal is emitted by the D-Bus server whenever a service ownership change happens in the bus, including apparition and disparition of names. This signal means the application \a oldOwner lost ownership of bus name \a name to application \a newOwner. If \a oldOwner is an empty string, it means the name \a name has just been created; if \a newOwner is empty, the name \a name has no current owner and is no longer available. \note connecting to this signal will make the application listen for and receive every single service ownership change on the bus. Depending on how many services are running, this make the application be activated to receive more signals than it needs. To avoid this problem, use the QDBusServiceWatcher class, which can listen for specific changes. */ /*! \fn void <API key>::<API key>(const QDBusError &error, const QDBusMessage &call) This signal is emitted when there is an error during a QDBusConnection::callWithCallback(). \a error specifies the error. \a call is the message that couldn't be delivered. \sa QDBusConnection::callWithCallback() */ QT_END_NAMESPACE #endif // QT_NO_DBUS
<!DOCTYPE html PUBLIC "- <html><head><title></title> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <link rel="stylesheet" type="text/css" href="search.css"/> <script type="text/javascript" src="search.js"></script> </head> <body class="SRPage"> <div id="SRIndex"> <div class="SRStatus" id="Loading">Loading...</div> <div class="SRResult" id="SR_rating"> <div class="SREntry"> <a id="Item0" onkeydown="return searchResults.Nav(event,0)" onkeypress="return searchResults.Nav(event,0)" onkeyup="return searchResults.Nav(event,0)" class="SRSymbol" href="javascript:searchResults.Toggle('SR_rating')">Rating</a> <div class="SRChildren"> <a id="Item0_c0" onkeydown="return searchResults.NavChild(event,0,0)" onkeypress="return searchResults.NavChild(event,0,0)" onkeyup="return searchResults.NavChild(event,0,0)" class="SRScope" href="../class_rating.html" target="_parent">Rating</a> <a id="Item0_c1" onkeydown="return searchResults.NavChild(event,0,1)" onkeypress="return searchResults.NavChild(event,0,1)" onkeyup="return searchResults.NavChild(event,0,1)" class="SRScope" href="../class_rating.html#<API key>" target="_parent">Rating::Rating()</a> </div> </div> </div> <div class="SRResult" id="SR_rating_2ecpp"> <div class="SREntry"> <a id="Item1" onkeydown="return searchResults.Nav(event,1)" onkeypress="return searchResults.Nav(event,1)" onkeyup="return searchResults.Nav(event,1)" class="SRSymbol" href="../_rating_8cpp.html" target="_parent">Rating.cpp</a> </div> </div> <div class="SRResult" id="SR_rating_2eh"> <div class="SREntry"> <a id="Item2" onkeydown="return searchResults.Nav(event,2)" onkeypress="return searchResults.Nav(event,2)" onkeyup="return searchResults.Nav(event,2)" class="SRSymbol" href="../_rating_8h.html" target="_parent">Rating.h</a> </div> </div> <div class="SRResult" id="<API key>"> <div class="SREntry"> <a id="Item3" onkeydown="return searchResults.Nav(event,3)" onkeypress="return searchResults.Nav(event,3)" onkeyup="return searchResults.Nav(event,3)" class="SRSymbol" href="javascript:searchResults.Toggle('<API key>')">RatingMovingAverage</a> <div class="SRChildren"> <a id="Item3_c0" onkeydown="return searchResults.NavChild(event,3,0)" onkeypress="return searchResults.NavChild(event,3,0)" onkeyup="return searchResults.NavChild(event,3,0)" class="SRScope" href="../<API key>.html" target="_parent">RatingMovingAverage</a> <a id="Item3_c1" onkeydown="return searchResults.NavChild(event,3,1)" onkeypress="return searchResults.NavChild(event,3,1)" onkeyup="return searchResults.NavChild(event,3,1)" class="SRScope" href="../<API key>.html#<API key>" target="_parent">RatingMovingAverage::RatingMovingAverage()</a> </div> </div> </div> <div class="SRResult" id="<API key>"> <div class="SREntry"> <a id="Item4" onkeydown="return searchResults.Nav(event,4)" onkeypress="return searchResults.Nav(event,4)" onkeyup="return searchResults.Nav(event,4)" class="SRSymbol" href="../<API key>.html" target="_parent">RatingMovingAverage.cpp</a> </div> </div> <div class="SRResult" id="<API key>"> <div class="SREntry"> <a id="Item5" onkeydown="return searchResults.Nav(event,5)" onkeypress="return searchResults.Nav(event,5)" onkeyup="return searchResults.Nav(event,5)" class="SRSymbol" href="../<API key>.html" target="_parent">RatingMovingAverage.h</a> </div> </div> <div class="SRResult" id="SR_ratingprecedes"> <div class="SREntry"> <a id="Item6" onkeydown="return searchResults.Nav(event,6)" onkeypress="return searchResults.Nav(event,6)" onkeyup="return searchResults.Nav(event,6)" class="SRSymbol" href="../<API key>.html" target="_parent">RatingPrecedes</a> </div> </div> <div class="SRResult" id="SR_readfile"> <div class="SREntry"> <a id="Item7" onkeydown="return searchResults.Nav(event,7)" onkeypress="return searchResults.Nav(event,7)" onkeyup="return searchResults.Nav(event,7)" class="SRSymbol" href="../<API key>.html#<API key>" target="_parent">readFile</a> <span class="SRScope"><API key></span> </div> </div> <div class="SRStatus" id="Searching">Searching...</div> <div class="SRStatus" id="NoMatches">No Matches</div> <script type="text/javascript"><! document.getElementById("Loading").style.display="none"; document.getElementById("NoMatches").style.display="none"; var searchResults = new SearchResults("searchResults"); searchResults.Search(); --></script> </div> </body> </html>
/* This header for CSE1320 homework 2 was written by William Lyons on 10/5/2015 */ #ifndef STUDENT_CONSTANTS_H #define STUDENT_CONSTANTS_H #define NUM_STUDENTS 7 #define NUM_ATTRIBUTES 2 #endif
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace InterfaceLibrary { <summary> Interface for managing operating system functions like restarting. </summary> interface IOSManagement { <summary> Restarts the host's operating system. </summary> void Restart(); } }
#include <linux/init.h> #include <linux/kernel.h> #include <linux/io.h> #include <linux/clkdev.h> #include <asm/clock.h> /* SH7264 registers */ #define FRQCR 0xfffe0010 #define STBCR3 0xfffe0408 #define STBCR4 0xfffe040c #define STBCR5 0xfffe0410 #define STBCR6 0xfffe0414 #define STBCR7 0xfffe0418 #define STBCR8 0xfffe041c static const unsigned int pll1rate[] = {8, 12}; static unsigned int pll1_div; /* Fixed 32 KHz root clock for RTC */ static struct clk r_clk = { .rate = 32768, }; /* * Default rate for the root input clock, reset this with clk_set_rate() * from the platform code. */ static struct clk extal_clk = { .rate = 18000000, }; static unsigned long pll_recalc(struct clk *clk) { unsigned long rate = clk->parent->rate / pll1_div; return rate * pll1rate[(__raw_readw(FRQCR) >> 8) & 1]; } static struct sh_clk_ops pll_clk_ops = { .recalc = pll_recalc, }; static struct clk pll_clk = { .ops = &pll_clk_ops, .parent = &extal_clk, .flags = CLK_ENABLE_ON_INIT, }; struct clk *main_clks[] = { &r_clk, &extal_clk, &pll_clk, }; static int div2[] = { 1, 2, 3, 4, 6, 8, 12 }; static struct clk_div_mult_table div4_div_mult_table = { .divisors = div2, .nr_divisors = ARRAY_SIZE(div2), }; static struct clk_div4_table div4_table = { .div_mult_table = &div4_div_mult_table, }; enum { DIV4_I, DIV4_P, DIV4_NR }; #define DIV4(_reg, _bit, _mask, _flags) \ SH_CLK_DIV4(&pll_clk, _reg, _bit, _mask, _flags) /* The mask field specifies the div2 entries that are valid */ struct clk div4_clks[DIV4_NR] = { [DIV4_I] = DIV4(FRQCR, 4, 0x7, <API key> | CLK_ENABLE_ON_INIT), [DIV4_P] = DIV4(FRQCR, 0, 0x78, <API key>), }; enum { MSTP77, MSTP74, MSTP72, MSTP60, MSTP35, MSTP34, MSTP33, MSTP32, MSTP30, MSTP_NR }; static struct clk mstp_clks[MSTP_NR] = { [MSTP77] = SH_CLK_MSTP8(&div4_clks[DIV4_P], STBCR7, 7, 0), /* SCIF */ [MSTP74] = SH_CLK_MSTP8(&div4_clks[DIV4_P], STBCR7, 4, 0), /* VDC */ [MSTP72] = SH_CLK_MSTP8(&div4_clks[DIV4_P], STBCR7, 2, 0), /* CMT */ [MSTP60] = SH_CLK_MSTP8(&div4_clks[DIV4_P], STBCR6, 0, 0), /* USB */ [MSTP35] = SH_CLK_MSTP8(&div4_clks[DIV4_P], STBCR3, 6, 0), /* MTU2 */ [MSTP34] = SH_CLK_MSTP8(&div4_clks[DIV4_P], STBCR3, 4, 0), /* SDHI0 */ [MSTP33] = SH_CLK_MSTP8(&div4_clks[DIV4_P], STBCR3, 3, 0), /* SDHI1 */ [MSTP32] = SH_CLK_MSTP8(&div4_clks[DIV4_P], STBCR3, 2, 0), /* ADC */ [MSTP30] = SH_CLK_MSTP8(&r_clk, STBCR3, 0, 0), /* RTC */ }; static struct clk_lookup lookups[] = { /* main clocks */ CLKDEV_CON_ID("rclk", &r_clk), CLKDEV_CON_ID("extal", &extal_clk), CLKDEV_CON_ID("pll_clk", &pll_clk), /* DIV4 clocks */ CLKDEV_CON_ID("cpu_clk", &div4_clks[DIV4_I]), CLKDEV_CON_ID("peripheral_clk", &div4_clks[DIV4_P]), /* MSTP clocks */ CLKDEV_ICK_ID("fck", "sh-sci.0", &mstp_clks[MSTP77]), CLKDEV_ICK_ID("fck", "sh-sci.1", &mstp_clks[MSTP77]), CLKDEV_ICK_ID("fck", "sh-sci.2", &mstp_clks[MSTP77]), CLKDEV_ICK_ID("fck", "sh-sci.3", &mstp_clks[MSTP77]), CLKDEV_ICK_ID("fck", "sh-sci.4", &mstp_clks[MSTP77]), CLKDEV_ICK_ID("fck", "sh-sci.5", &mstp_clks[MSTP77]), CLKDEV_ICK_ID("fck", "sh-sci.6", &mstp_clks[MSTP77]), CLKDEV_ICK_ID("fck", "sh-sci.7", &mstp_clks[MSTP77]), CLKDEV_CON_ID("vdc3", &mstp_clks[MSTP74]), CLKDEV_ICK_ID("fck", "sh-cmt-16.0", &mstp_clks[MSTP72]), CLKDEV_CON_ID("usb0", &mstp_clks[MSTP60]), CLKDEV_ICK_ID("fck", "sh-mtu2", &mstp_clks[MSTP35]), CLKDEV_CON_ID("sdhi0", &mstp_clks[MSTP34]), CLKDEV_CON_ID("sdhi1", &mstp_clks[MSTP33]), CLKDEV_CON_ID("adc0", &mstp_clks[MSTP32]), CLKDEV_CON_ID("rtc0", &mstp_clks[MSTP30]), }; int __init arch_clk_init(void) { int k, ret = 0; if (test_mode_pin(MODE_PIN0)) { if (test_mode_pin(MODE_PIN1)) { pll1_div = 3; } else { pll1_div = 4; } } else { pll1_div = 1; } for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++) { ret = clk_register(main_clks[k]); } clkdev_add_table(lookups, ARRAY_SIZE(lookups)); if (!ret) { ret = <API key>(div4_clks, DIV4_NR, &div4_table); } if (!ret) { ret = <API key>(mstp_clks, MSTP_NR); } return ret; }
namespace SpontaneousControls.UI.Outputs.Discrete { partial class <API key> { <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.outputOneTypeCombo = new System.Windows.Forms.ComboBox(); this.eventOneNameLabel = new System.Windows.Forms.Label(); this.<API key> = new System.Windows.Forms.Panel(); this.outputTwoTypeCombo = new System.Windows.Forms.ComboBox(); this.eventTwoNameLabel = new System.Windows.Forms.Label(); this.<API key> = new System.Windows.Forms.Panel(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.SuspendLayout(); // outputOneTypeCombo this.outputOneTypeCombo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.outputOneTypeCombo.FormattingEnabled = true; this.outputOneTypeCombo.Location = new System.Drawing.Point(3, 25); this.outputOneTypeCombo.Name = "outputOneTypeCombo"; this.outputOneTypeCombo.Size = new System.Drawing.Size(166, 21); this.outputOneTypeCombo.TabIndex = 6; this.outputOneTypeCombo.<API key> += new System.EventHandler(this.<API key>); // eventOneNameLabel this.eventOneNameLabel.AutoSize = true; this.eventOneNameLabel.Location = new System.Drawing.Point(0, 9); this.eventOneNameLabel.Name = "eventOneNameLabel"; this.eventOneNameLabel.Size = new System.Drawing.Size(72, 13); this.eventOneNameLabel.TabIndex = 8; this.eventOneNameLabel.Text = "dummy_value"; // <API key> this.<API key>.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.<API key>.Location = new System.Drawing.Point(3, 52); this.<API key>.Name = "<API key>"; this.<API key>.Size = new System.Drawing.Size(166, 299); this.<API key>.TabIndex = 7; // outputTwoTypeCombo this.outputTwoTypeCombo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.outputTwoTypeCombo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.outputTwoTypeCombo.FormattingEnabled = true; this.outputTwoTypeCombo.Location = new System.Drawing.Point(183, 25); this.outputTwoTypeCombo.Name = "outputTwoTypeCombo"; this.outputTwoTypeCombo.Size = new System.Drawing.Size(180, 21); this.outputTwoTypeCombo.TabIndex = 9; this.outputTwoTypeCombo.<API key> += new System.EventHandler(this.<API key>); // eventTwoNameLabel this.eventTwoNameLabel.AutoSize = true; this.eventTwoNameLabel.Location = new System.Drawing.Point(180, 9); this.eventTwoNameLabel.Name = "eventTwoNameLabel"; this.eventTwoNameLabel.Size = new System.Drawing.Size(72, 13); this.eventTwoNameLabel.TabIndex = 11; this.eventTwoNameLabel.Text = "dummy_value"; // <API key> this.<API key>.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.<API key>.Location = new System.Drawing.Point(183, 52); this.<API key>.Name = "<API key>"; this.<API key>.Size = new System.Drawing.Size(180, 299); this.<API key>.TabIndex = 10; // groupBox1 this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.groupBox1.BackColor = System.Drawing.SystemColors.Control; this.groupBox1.ForeColor = System.Drawing.SystemColors.ControlLightLight; this.groupBox1.Location = new System.Drawing.Point(175, 3); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(2, 351); this.groupBox1.TabIndex = 12; this.groupBox1.TabStop = false; // <API key> this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.Transparent; this.Controls.Add(this.groupBox1); this.Controls.Add(this.outputTwoTypeCombo); this.Controls.Add(this.eventTwoNameLabel); this.Controls.Add(this.<API key>); this.Controls.Add(this.outputOneTypeCombo); this.Controls.Add(this.eventOneNameLabel); this.Controls.Add(this.<API key>); this.Name = "<API key>"; this.Size = new System.Drawing.Size(366, 354); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.ComboBox outputOneTypeCombo; private System.Windows.Forms.Label eventOneNameLabel; private System.Windows.Forms.Panel <API key>; private System.Windows.Forms.ComboBox outputTwoTypeCombo; private System.Windows.Forms.Label eventTwoNameLabel; private System.Windows.Forms.Panel <API key>; private System.Windows.Forms.GroupBox groupBox1; } }
using CP77.CR2W.Reflection; using FastMember; using static CP77.CR2W.Types.Enums; namespace CP77.CR2W.Types { [REDMeta] public class <API key> : <API key> { [Ordinal(2)] [RED("value")] public CFloat Value { get; set; } public <API key>(CR2WFile cr2w, CVariable parent, string name) : base(cr2w, parent, name) { } } }
# This file is part of Pollit. # Pollit is free software: you can redistribute it and/or modify # (at your option) any later version. # Pollit is distributed in the hope that it will be useful, # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # Examples: # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel', city: cities.first)
package com.bioxx.tfc.Items; import com.bioxx.tfc.Core.TFCTabs; import com.bioxx.tfc.Core.TFC_Core; import com.bioxx.tfc.TerraFirmaCraft; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.IIcon; import net.minecraft.world.World; public class ItemCustomNameTag extends ItemTerra { public ItemCustomNameTag() { super(); setMaxDamage(0); setHasSubtypes(true); setUnlocalizedName("Nametag"); setCreativeTab(TFCTabs.TFC_TOOLS); setFolder("tools/"); } @Override public boolean getShareTag() { return true; } @Override public IIcon getIcon(ItemStack stack, int pass) { return Items.name_tag.getIcon(stack, pass); } @Override public IIcon getIconFromDamage(int damage) { return Items.name_tag.getIconFromDamage(damage); } @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { if (stack.stackTagCompound == null) { stack.stackTagCompound = new NBTTagCompound(); } if (!stack.stackTagCompound.hasKey("ItemName")) { player.openGui(TerraFirmaCraft.instance, 48, player.worldObj, (int) player.posX, (int) player.posY, (int) player.posZ); } return stack; } @Override public void registerIcons(IIconRegister registerer) { //Don't } @Override public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) { return false; } @Override public String <API key>(ItemStack is) { if (is.hasTagCompound() && is.stackTagCompound.hasKey("ItemName")) return is.stackTagCompound.getString("ItemName"); else return TFC_Core.translate("gui.Nametag"); } }
#!/bin/bash if [ $(id -u) == 0 ]; then echo "You need to run this script as standard user, not root (pid may be 501). Type id -u in terminal to check this" exit fi diskutil verifyVolume /dev/disk0 echo "Finished"
package fr.duminy.jbackup.core.matchers; import fr.duminy.jbackup.core.archive.ArchiveParameters; import org.mockito.ArgumentMatcher; import java.nio.file.Path; import java.util.Collection; import java.util.Iterator; class <API key> implements ArgumentMatcher<ArchiveParameters> { private final ArchiveParameters parameters; private final Path expectedArchive; <API key>(ArchiveParameters parameters, Path expectedArchive) { this.parameters = parameters; this.expectedArchive = expectedArchive; } @Override public boolean matches(Object o) { ArchiveParameters params = (ArchiveParameters) o; final boolean b = parameters.isRelativeEntries() == params.isRelativeEntries(); final boolean b1 = expectedArchive.equals(params.getArchive()); final boolean b2 = sameSources(parameters.getSources(), params.getSources()); return b && b1 && b2; } private boolean sameSources(Collection<ArchiveParameters.Source> sources1, Collection<ArchiveParameters.Source> sources2) { if (sources1.size() != sources2.size()) { return false; } Iterator<ArchiveParameters.Source> iterator2 = sources2.iterator(); for (ArchiveParameters.Source source1 : sources1) { ArchiveParameters.Source source2 = iterator2.next(); if (!source1.getDirFilter().equals(source2.getDirFilter())) { return false; } if (!source1.getFileFilter().equals(source2.getFileFilter())) { return false; } if (!source1.getPath().equals(source2.getPath())) { return false; } } return true; } }
#include <stdio.h> #include <math.h> int main() { float num; for (num = 2; num > 0; num -= 1/pow(10.0f, 10.0f)) if (pow(num, num) == 2.0f) printf("%.2f\n", pow(sqrt(2.0f), sqrt(2.0f))); return 0; }
<?php namespace App\Http\Controllers\registro; use Illuminate\Http\Request; use Carbon\Carbon; use App\Helpers\NoOrphanRegisters; use App\Http\Requests; use App\Http\Controllers\Controller; use Maatwebsite\Excel\Facades\Excel; use Barryvdh\DomPDF\Facade; use Barryvdh\DomPDF\PDF; use Log; use Illuminate\Support\Collection as Collection; //Carga de modelos use App\User; use App\modelos\Alumnos; use App\modelos\Asistencia; use App\modelos\Empleados; use App\modelos\Materias; use App\modelos\MateriasHasNiveles; use App\modelos\Niveles; use App\modelos\NivelesHasPeriodos; use App\modelos\Periodos; use App\modelos\Notas; use App\modelos\TipoNota; use App\modelos\Indicadores; use App\modelos\PagoMatricula; use App\modelos\PagoPension; use App\modelos\PagoOtros; use App\modelos\PagoSalario; use App\modelos\PrecioMatricula; use App\modelos\PrecioPension; use App\modelos\TipoUsuario; use App\modelos\Users; use App\modelos\Meses; use App\modelos\Newasistencia; use App\modelos\Authdevice; use App\modelos\Generales; use App\modelos\Asiserved; use App\modelos\Tarjetas; //Para validacion use Validator; class AsistenciaCtrl extends Controller { public function getDeviceAsistencia($serial,$tarjeta){ $servidor=Generales::where('nombre','Servidor principal')->first(); if($servidor->valor==""){ $alumno=Users::where('tarjeta',$tarjeta) ->with(['alumnos'=>function($query){ $query->with('niveles','users')->first(); }]) ->first(); if (!isset($alumno->alumnos[0]->niveles->nombre_nivel)) { return response('NoAlumno',404); } $periodos=Periodos::all(); $hoy=Carbon::now(); $device=Authdevice::where('serial',$serial) ->first(); $ind=0; $index=0; foreach ($periodos as $per) { $ini=Carbon::createFromFormat('Y-m-d',$per->fecha_ini); $fin=Carbon::createFromFormat('Y-m-d',$per->fecha_fin); if ($hoy->gte($ini) && $hoy->lte($fin)) { $index=$ind; } $ind++; } //dd($alumno); $asistencia=new Newasistencia; $asistencia->authdevice_id=$device->id; $asistencia->alumnos_id=$alumno->alumnos[0]->id; $asistencia->name=$alumno->alumnos[0]->users->name; $asistencia->lastname=$alumno->alumnos[0]->users->lastname; $asistencia->periodos_id=$periodos[$index]->id; $asistencia->save(); }else{ /* Esta parte guarda en otra tabla la lista de asistencias parcialmente. */ $card=Tarjetas::where('tarjeta',$tarjeta)->first(); //dd($card); if (!isset($card->id)) { return response('NoAlumno',404); } $asistencia=new Asiserved; $asistencia->tarjeta=$tarjeta; $asistencia->lectora=$serial; $asistencia->save(); } return response('Asistio',200); } public function postAsistencia($serial,$tarjeta,Request $request){ // En espera de cualquier modificacion. } public function getAsistencias($inicio=0){ $mostrados=50; $asis=Newasistencia::where('id','!=',0) ->with('alumnos.niveles') ->orderBy('created_at','desc') ->skip($inicio) ->take($mostrados+$inicio) ->get(); $registros=Newasistencia::all(); return $asis->toJson(); } public function getInfoAsis(){ $asis=Newasistencia::all(); $col=collect(['registros'=>$asis->count(),'mostrados'=>50]); return $col->toJson(); } public function getTarjetas($inicio=0){ $tarj=Users::where('tarjeta','!=','')->skip($inicio)->take(50+$inicio)->get(); return $tarj->toJson(); } public function getOnlyTarjetas(){ $tarj=Users::where('tarjeta','!=','')->select('tarjeta')->get(); return $tarj->toJson(); } }
<?php /** * Interface implemented by token parser brokers. * * Token parser brokers allows to implement custom logic in the process of resolving a token parser for a given tag name. * * @package twig * @author Arnaud Le Blanc <arnaud.lb@gmail.com> */ interface Twig_<API key> { /** * Gets a TokenParser suitable for a tag. * * @param string $tag A tag name * * @return null|<API key> A <API key> or null if no suitable TokenParser was found */ function getTokenParser($tag); /** * Calls <API key>::setParser on all parsers the implementation knows of. * * @param <API key> $parser A <API key> interface */ function setParser(<API key> $parser); /** * Gets the <API key>. * * @return null|<API key> A <API key> instance or null */ function getParser(); }
#!/bin/bash ls lsb_release -a # check if gcc exists gcc --version # install java 8 apt-get -y install default-jdk java -version echo "java installed inside chroot" # exit from chroot exit
# -*- coding: utf-8 -*- # HORTON: Helpful Open-source Research TOol for N-fermion systems. # This file is part of HORTON. # HORTON is free software; you can redistribute it and/or # as published by the Free Software Foundation; either version 3 # HORTON is distributed in the hope that it will be useful, # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #pylint: skip-file import numpy as np from horton import * def test_atom_si_uks(): fn_out = context.get_fn('test/atom_si.cp2k.out') mol = IOData.from_file(fn_out) assert (mol.numbers == [14]).all() assert (mol.pseudo_numbers == [4]).all() assert (mol.exp_alpha.occupations == [1, 1, 1, 0]).all() assert (mol.exp_beta.occupations == [1, 0, 0, 0]).all() assert abs(mol.exp_alpha.energies - [-0.398761, -0.154896, -0.154896, -0.154896]).max() < 1e-4 assert abs(mol.exp_beta.energies - [-0.334567, -0.092237, -0.092237, -0.092237]).max() < 1e-4 assert abs(mol.energy - -3.761587698067) < 1e-10 assert (mol.obasis.shell_types == [0, 0, 1, 1, -2]).all() olp = mol.obasis.compute_overlap(mol.lf) ca = mol.exp_alpha.coeffs cb = mol.exp_beta.coeffs assert abs(np.diag(olp._array[:2,:2]) - np.array([0.42921199338707744, 0.32067871530183140])).max() < 1e-5 assert abs(np.dot(ca.T, np.dot(olp._array, ca)) - np.identity(4)).max() < 1e-5 assert abs(np.dot(cb.T, np.dot(olp._array, cb)) - np.identity(4)).max() < 1e-5 def test_atom_o_rks(): fn_out = context.get_fn('test/atom_om2.cp2k.out') mol = IOData.from_file(fn_out) assert (mol.numbers == [8]).all() assert (mol.pseudo_numbers == [6]).all() assert (mol.exp_alpha.occupations == [1, 1, 1, 1]).all() assert abs(mol.exp_alpha.energies - [0.102709, 0.606458, 0.606458, 0.606458]).max() < 1e-4 assert abs(mol.energy - -15.464982778766) < 1e-10 assert (mol.obasis.shell_types == [0, 0, 1, 1, -2]).all() olp = mol.obasis.compute_overlap(mol.lf) ca = mol.exp_alpha.coeffs assert abs(np.dot(ca.T, np.dot(olp._array, ca)) - np.identity(4)).max() < 1e-5
using System; using System.Collections.Generic; using System.Drawing; using System.IO; using System.Windows.Forms; namespace MsCrmTools.WebResourcesManager.Forms { public partial class <API key> : Form { public <API key>(bool isLoadFromDisk, bool <API key> = true) { InitializeComponent(); if (!isLoadFromDisk) { <API key>.Visible = false; Size = new Size(500, 200); lblTitle.Text = "Save folder"; Text = "Save web resources"; Invalidate(); } else if (!<API key>) { <API key>.Visible = false; lblTitle.Text = "Folder"; Invalidate(); } } public List<string> ExtensionsToLoad { get; private set; } public string FolderPath { get; set; } private void btnBrowse_Click(object sender, EventArgs e) { var fbd = new FolderBrowserDialog { Description = "Select the folder where the files are located", ShowNewFolderButton = true }; if (fbd.ShowDialog(this) == DialogResult.OK) { txtFolderPath.Text = fbd.SelectedPath; FolderPath = fbd.SelectedPath; } } private void btnCancel_Click(object sender, EventArgs e) { DialogResult = DialogResult.Cancel; Close(); } private void btnOk_Click(object sender, EventArgs e) { if (!Directory.Exists(txtFolderPath.Text)) { MessageBox.Show(this, "Invalid folder specified!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } FolderPath = txtFolderPath.Text; ExtensionsToLoad = <API key>.CheckedExtensions; DialogResult = DialogResult.OK; Close(); } private void <API key>(object sender, EventArgs e) { txtFolderPath.Text = FolderPath; } } }
#!/usr/bin/env python import dbus import dbus.service import dbus.mainloop.glib import sys class ThermalService(dbus.service.Object): def __init__(self, connection): dbus.service.Object.__init__(self, connection, "/moveii/thm") @dbus.service.signal(dbus_interface='moveii.thm', signature='s') def thmStateChange(self, state): print state if __name__ == "__main__": dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) session_bus = dbus.SessionBus() name = dbus.service.BusName('moveii.thm', session_bus) thermal = ThermalService(session_bus) thermal.thmStateChange(sys.argv[1])
package org.sammelbox.albumitems; import junit.framework.Assert; import org.junit.*; import org.sammelbox.TestRunner; import org.sammelbox.model.album.*; import org.sammelbox.model.database.exceptions.<API key>; import org.sammelbox.model.database.operations.DatabaseOperations; import java.sql.Date; import java.util.*; import static org.junit.Assert.fail; public class <API key> { final String albumName = "Books"; @BeforeClass public static void setUpBeforeClass() throws Exception { } @AfterClass public static void tearDownAfterClass() throws Exception { } @Before public void setUp() throws Exception { TestRunner.resetTestHome(); createBooksAlbum(); fillBooksAlbum(); } @After public void tearDown() throws Exception { TestRunner.resetTestHome(); } @Test public void <API key>() { try { AlbumItem originalAlbumItem = DatabaseOperations.getAlbumItem("Books", 1); originalAlbumItem.getField("Book Title").setValue("updated book title"); DatabaseOperations.updateAlbumItem(originalAlbumItem); AlbumItem updatedAlbumItem = DatabaseOperations.getAlbumItem("Books", 1); if (updatedAlbumItem == null) { fail("The updatedAlbumItem is unexpectatly null"); } Assert.assertTrue(originalAlbumItem.getAlbumName().equals(updatedAlbumItem.getAlbumName())); Assert.assertTrue(originalAlbumItem.getFields().containsAll(updatedAlbumItem.getFields())); } catch (<API key> e) { fail("<API key> failed"); } } @Test public void <API key>() { try { AlbumItem originalAlbumItem = DatabaseOperations.getAlbumItem("Books", 1); originalAlbumItem.getField("Price").setValue(42.42d); DatabaseOperations.updateAlbumItem(originalAlbumItem); AlbumItem updatedAlbumItem = DatabaseOperations.getAlbumItem("Books", 1); if (updatedAlbumItem == null) { fail("The updatedAlbumItem is unexpectatly null"); } Assert.assertTrue(originalAlbumItem.getAlbumName().equals(updatedAlbumItem.getAlbumName())); Assert.assertTrue(originalAlbumItem.getFields().containsAll(updatedAlbumItem.getFields())); } catch (<API key> e) { fail("<API key> failed"); } } @Test public void <API key>() { try { AlbumItem originalAlbumItem = DatabaseOperations.getAlbumItem("Books", 1); Date currentDate = new Date(System.currentTimeMillis()); originalAlbumItem.getField("Purchased").setValue(currentDate); DatabaseOperations.updateAlbumItem(originalAlbumItem); AlbumItem updatedAlbumItem = DatabaseOperations.getAlbumItem("Books", 1); if (updatedAlbumItem == null) { fail("The updatedAlbumItem is unexpectatly null"); } Calendar cal = Calendar.getInstance(); cal.setTime(currentDate); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); long timeAsMillis = cal.getTimeInMillis(); Date truncatedDate = new Date(timeAsMillis); originalAlbumItem.getField("Purchased").setValue(truncatedDate); Assert.assertTrue(originalAlbumItem.getAlbumName().equals(updatedAlbumItem.getAlbumName())); Assert.assertTrue(originalAlbumItem.getFields().containsAll(updatedAlbumItem.getFields())); } catch (<API key> e) { fail("<API key> failed"); } } @Test public void <API key>() { try { AlbumItem originalAlbumItem = DatabaseOperations.getAlbumItem("Books", 1); originalAlbumItem.getField("Lent out").setValue(OptionType.NO); DatabaseOperations.updateAlbumItem(originalAlbumItem); AlbumItem updatedAlbumItem = DatabaseOperations.getAlbumItem("Books", 1); if (updatedAlbumItem == null) { fail("The updatedAlbumItem is unexpectatly null"); } Assert.assertTrue(originalAlbumItem.getAlbumName().equals(updatedAlbumItem.getAlbumName())); Assert.assertTrue(originalAlbumItem.getFields().containsAll(updatedAlbumItem.getFields())); } catch (<API key> e) { fail("Update of Option field failed"); } } @Test public void <API key>() { try { AlbumItem originalAlbumItem = DatabaseOperations.getAlbumItem("Books", 1); List<AlbumItemPicture> pictureList = originalAlbumItem.getPictures(); pictureList.add(new AlbumItemPicture(TestRunner.<API key>, TestRunner.<API key>, "Books", 1)); originalAlbumItem.setPictures(pictureList); DatabaseOperations.updateAlbumItem(originalAlbumItem); AlbumItem updatedAlbumItem = DatabaseOperations.getAlbumItem("Books", 1); if (updatedAlbumItem == null) { fail("The updatedAlbumItem is unexpectatly null"); } } catch (<API key> e) { fail("update of picture field failed"); } } private void createBooksAlbum() { MetaItemField titleField = new MetaItemField("Book Title", FieldType.TEXT, true); MetaItemField authorField = new MetaItemField("Author", FieldType.TEXT, true); MetaItemField purchaseField = new MetaItemField("Purchased", FieldType.DATE, false); MetaItemField priceField = new MetaItemField("Price", FieldType.DECIMAL, false); MetaItemField lenttoField = new MetaItemField("Lent out", FieldType.OPTION, true); List<MetaItemField> columns = new ArrayList<MetaItemField>(); columns.add(titleField); columns.add(authorField); columns.add(purchaseField); columns.add(priceField); columns.add(lenttoField); try { DatabaseOperations.createNewAlbum(albumName, columns, true); } catch (<API key> e) { fail("Creation of album"+ albumName + "failed"); } } private void fillBooksAlbum() { final String albumName = "Books"; AlbumItem referenceAlbumItem = <API key>(albumName); try { DatabaseOperations.addAlbumItem(referenceAlbumItem, false); } catch (<API key> e) { fail("fillBooksAlbum failed"); } } private AlbumItem <API key>(String albumName) { AlbumItem item = new AlbumItem(albumName); List<ItemField> fields = new ArrayList<ItemField>(); fields.add(new ItemField("Book Title", FieldType.TEXT, "book title")); fields.add(new ItemField("Author", FieldType.TEXT, "the author")); fields.add(new ItemField("Purchased", FieldType.DATE, new Date(System.currentTimeMillis()))); fields.add(new ItemField("Price", FieldType.DECIMAL, 4.2d)); fields.add(new ItemField("Lent out", FieldType.OPTION, OptionType.YES)); List<AlbumItemPicture> albumItemPictures = new ArrayList<AlbumItemPicture>(); albumItemPictures.add(new AlbumItemPicture(TestRunner.<API key>, TestRunner.<API key>, albumName, AlbumItemPicture.<API key>)); albumItemPictures.add(new AlbumItemPicture(TestRunner.<API key>, TestRunner.<API key>, albumName, AlbumItemPicture.<API key>)); albumItemPictures.add(new AlbumItemPicture(TestRunner.<API key>, TestRunner.<API key>, albumName, AlbumItemPicture.<API key>)); item.setFields(fields); item.setContentVersion(UUID.randomUUID()); return item; } }
#include "ScriptPCH.h" #include "ruins_of_ahnqiraj.h" enum Texts { EMOTE_AGGRO = -1509000, EMOTE_MANA_FULL = -1509001 }; enum Spells { SPELL_TRAMPLE = 15550, SPELL_DRAIN_MANA = 25671, <API key> = 25672, <API key> = 25681, // <API key> <API key> = 25682, // <API key> <API key> = 25683, // <API key> SPELL_ENERGIZE = 25685 }; enum Events { EVENT_TRAMPLE = 1, EVENT_DRAIN_MANA = 2, EVENT_STONE_PHASE = 3, <API key> = 4, EVENT_WIDE_SLASH = 5, }; enum Actions { <API key> = 1, <API key> = 2, }; class boss_moam : public CreatureScript { public: boss_moam() : CreatureScript("boss_moam") { } struct boss_moamAI : public BossAI { boss_moamAI(Creature* creature) : BossAI(creature, BOSS_MOAM) { } void Reset() { _Reset(); me->SetPower(POWER_MANA, 0); _isStonePhase = false; events.ScheduleEvent(EVENT_STONE_PHASE, 90000); //events.ScheduleEvent(EVENT_WIDE_SLASH, 11000); } void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/) { if (!_isStonePhase && HealthBelowPct(45)) { _isStonePhase = true; DoAction(<API key>); } } void DoAction(int32 const action) { switch (action) { case <API key>: { me-><API key>(SPELL_ENERGIZE); events.ScheduleEvent(EVENT_STONE_PHASE, 90000); _isStonePhase = false; break; } case <API key>: { DoCast(me, <API key>); DoCast(me, <API key>); DoCast(me, <API key>); DoCast(me, SPELL_ENERGIZE); events.ScheduleEvent(<API key>, 90000); break; } default: break; } } void UpdateAI(uint32 const diff) { if (!UpdateVictim()) return; events.Update(diff); if (me->GetPower(POWER_MANA) == me->GetMaxPower(POWER_MANA)) { if (_isStonePhase) DoAction(<API key>); DoCastAOE(<API key>); me->SetPower(POWER_MANA, 0); } if (_isStonePhase) { if (events.ExecuteEvent() == <API key>) DoAction(<API key>); return; } // Messing up mana-drain channel //if (me->HasUnitState(UNIT_STATE_CASTING)) // return; while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_STONE_PHASE: DoAction(<API key>); break; case EVENT_DRAIN_MANA: { std::list<Unit*> targetList; { const std::list<HostileReference*>& threatlist = me->getThreatManager().getThreatList(); for (std::list<HostileReference*>::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) if ((*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER && (*itr)->getTarget()->getPowerType() == POWER_MANA) targetList.push_back((*itr)->getTarget()); } Darkcore::RandomResizeList(targetList, 5); for (std::list<Unit*>::iterator itr = targetList.begin(); itr != targetList.end(); ++itr) DoCast(*itr, SPELL_DRAIN_MANA); events.ScheduleEvent(EVENT_DRAIN_MANA, urand(5000, 15000)); break; }/* case EVENT_WIDE_SLASH: DoCast(me, SPELL_WIDE_SLASH); events.ScheduleEvent(EVENT_WIDE_SLASH, 11000); break; case EVENT_TRASH: DoCast(me, SPELL_TRASH); events.ScheduleEvent(EVENT_WIDE_SLASH, 16000); break;*/ default: break; } } <API key>(); } private: bool _isStonePhase; }; CreatureAI* GetAI(Creature* creature) const { return new boss_moamAI(creature); } }; void AddSC_boss_moam() { new boss_moam(); }
<!DOCTYPE html PUBLIC "- <html xmlns="http: <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.9.1"/> <title>libcrosswind: cw::implementation::graphical::opengl::shader_program Class Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.js"></script> <script type="text/javascript"> $(document).ready(function() { init_search(); }); </script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">libcrosswind </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.9.1 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li> <div id="MSearchBox" class="MSearchBoxInactive"> <span class="left"> <img id="MSearchSelect" src="search/mag_sel.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/> <input type="text" id="MSearchField" value="Search" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> </span><span class="right"> <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> </span> </div> </li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="annotated.html"><span>Class&#160;List</span></a></li> <li><a href="classes.html"><span>Class&#160;Index</span></a></li> <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li> <li><a href="functions.html"><span>Class&#160;Members</span></a></li> </ul> </div> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="<API key>"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="namespacecw.html">cw</a></li><li class="navelem"><a class="el" href="<API key>.html">implementation</a></li><li class="navelem"><a class="el" href="<API key>.html">graphical</a></li><li class="navelem"><a class="el" href="<API key>.html">opengl</a></li><li class="navelem"><a class="el" href="<API key>.html">shader_program</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="summary"> <a href="#pub-methods">Public Member Functions</a> &#124; <a href="<API key>.html">List of all members</a> </div> <div class="headertitle"> <div class="title">cw::implementation::graphical::opengl::shader_program Class Reference</div> </div> </div><!--header <div class="contents"> <p><code>#include &lt;<a class="el" href="<API key>.html">shader_program.hpp</a>&gt;</code></p> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a> Public Member Functions</h2></td></tr> <tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">shader_program</a> ()</td></tr> <tr class="separator:<API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">~shader_program</a> ()</td></tr> <tr class="separator:<API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">compile</a> (const std::string &amp;<API key>, const std::string &amp;<API key>)</td></tr> <tr class="separator:<API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">link</a> ()</td></tr> <tr class="separator:<API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">add_attribute</a> (const std::string &amp;attribute_name)</td></tr> <tr class="separator:<API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>"><API key></a> (const std::string &amp;uniform_name)</td></tr> <tr class="separator:<API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">use</a> ()</td></tr> <tr class="separator:<API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">unuse</a> ()</td></tr> <tr class="separator:<API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> </table> <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> <div class="textblock"> <p>Definition at line <a class="el" href="<API key>.html#l00023">23</a> of file <a class="el" href="<API key>.html">implementation/graphical/opengl/shader_program.hpp</a>.</p> </div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2> <a class="anchor" id="<API key>"></a> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">cw::implementation::graphical::opengl::shader_program::shader_program </td> <td>(</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">inline</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Definition at line <a class="el" href="<API key>.html#l00025">25</a> of file <a class="el" href="<API key>.html">implementation/graphical/opengl/shader_program.hpp</a>.</p> </div> </div> <a class="anchor" id="<API key>"></a> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">virtual cw::implementation::graphical::opengl::shader_program::~shader_program </td> <td>(</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">virtual</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Definition at line <a class="el" href="<API key>.html#l00033">33</a> of file <a class="el" href="<API key>.html">implementation/graphical/opengl/shader_program.hpp</a>.</p> </div> </div> <h2 class="groupheader">Member Function Documentation</h2> <a class="anchor" id="<API key>"></a> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">void cw::implementation::graphical::opengl::shader_program::add_attribute </td> <td>(</td> <td class="paramtype">const std::string &amp;&#160;</td> <td class="paramname"><em>attribute_name</em></td><td>)</td> <td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">inline</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Definition at line <a class="el" href="<API key>.html#l00085">85</a> of file <a class="el" href="<API key>.html">implementation/graphical/opengl/shader_program.hpp</a>.</p> </div> </div> <a class="anchor" id="<API key>"></a> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">void cw::implementation::graphical::opengl::shader_program::compile </td> <td>(</td> <td class="paramtype">const std::string &amp;&#160;</td> <td class="paramname"><em><API key></em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const std::string &amp;&#160;</td> <td class="paramname"><em><API key></em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">inline</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Definition at line <a class="el" href="<API key>.html#l00037">37</a> of file <a class="el" href="<API key>.html">implementation/graphical/opengl/shader_program.hpp</a>.</p> </div> </div> <a class="anchor" id="<API key>"></a> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">int32_t cw::implementation::graphical::opengl::shader_program::<API key> </td> <td>(</td> <td class="paramtype">const std::string &amp;&#160;</td> <td class="paramname"><em>uniform_name</em></td><td>)</td> <td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">inline</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Definition at line <a class="el" href="<API key>.html#l00089">89</a> of file <a class="el" href="<API key>.html">implementation/graphical/opengl/shader_program.hpp</a>.</p> </div> </div> <a class="anchor" id="<API key>"></a> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">void cw::implementation::graphical::opengl::shader_program::link </td> <td>(</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">inline</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Definition at line <a class="el" href="<API key>.html#l00053">53</a> of file <a class="el" href="<API key>.html">implementation/graphical/opengl/shader_program.hpp</a>.</p> </div> </div> <a class="anchor" id="<API key>"></a> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">void cw::implementation::graphical::opengl::shader_program::unuse </td> <td>(</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">inline</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Definition at line <a class="el" href="<API key>.html#l00105">105</a> of file <a class="el" href="<API key>.html">implementation/graphical/opengl/shader_program.hpp</a>.</p> </div> </div> <a class="anchor" id="<API key>"></a> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">void cw::implementation::graphical::opengl::shader_program::use </td> <td>(</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">inline</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Definition at line <a class="el" href="<API key>.html#l00097">97</a> of file <a class="el" href="<API key>.html">implementation/graphical/opengl/shader_program.hpp</a>.</p> </div> </div> <hr/>The documentation for this class was generated from the following file:<ul> <li><a class="el" href="<API key>.html">implementation/graphical/opengl/shader_program.hpp</a></li> </ul> </div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated on Tue Mar 31 2015 05:08:30 for libcrosswind by & <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.9.1 </small></address> </body> </html>
#include "commandhistoryview.h" #include "console.h" #include <QHeaderView> using namespace JuliaPlugin; <API key>::<API key>(QObject *parent) : QStyledItemDelegate(parent) { } CommandHistoryView::CommandHistoryView(QWeakPointer<Console> console_handle, QWidget *parent) : QWidget(parent), console(console_handle) { setWindowTitle( "Command History" ); grid_layout = new QGridLayout(this); grid_layout->setObjectName( QString::fromUtf8("grid_layout") ); grid_layout->setSpacing(0); grid_layout->setContentsMargins(0, 0, 0, 0); list_view = new QTreeView(this); list_view->setObjectName( QString::fromUtf8("list_view") ); list_view->setModel( console.data()->GetHistoryModel() ); list_view->setItemDelegate( delegate = new <API key>(this) ); list_view->setIndentation(0); list_view->setFrameStyle(QFrame::NoFrame); list_view-><API key>(true); list_view->setAttribute(Qt::WA_MacShowFocusRect, false); list_view->setTextElideMode(Qt::ElideMiddle); list_view->setSelectionMode(QAbstractItemView::SingleSelection); list_view-><API key>(QAbstractItemView::SelectRows); list_view-><API key>(Qt::CustomContextMenu); list_view->installEventFilter(this); list_view->header()->hide(); list_view->header()-><API key>(false); list_view->header()->setResizeMode(0, QHeaderView::Stretch); list_view->viewport()->setAttribute(Qt::WA_Hover); list_view->viewport()->installEventFilter(this); connect( console.data(), SIGNAL(<API key>(QModelIndex)), list_view, SLOT(setCurrentIndex(QModelIndex)) ); connect( console.data(), SIGNAL(NewCommand(const ProjectExplorer::EvaluatorMessage&)), list_view, SLOT(clearSelection()) ); connect( list_view, SIGNAL(clicked(QModelIndex)), console.data(), SLOT(SetCurrCommand(QModelIndex)) ); grid_layout->addWidget(list_view, 0, 0, 1, 1); } CommandHistoryView::~CommandHistoryView() { // everything is parented so we should be good... } <API key>::<API key>(QWeakPointer<Console> console) : console_handle(console) {} Core::NavigationView <API key>::createWidget() { Core::NavigationView view; view.widget = new CommandHistoryView( console_handle ); return view; }
#ifndef DATASTREAMV8_H #define DATASTREAMV8_H #include <v8.h> #include <assert.h> #include <fcntl.h> #include <string.h> #include <stdio.h> #include <stdlib.h> #include <sstream> #include <iostream> #include <vector> #include "utils.h" //#include "mdb.h" using namespace v8; struct Pair { Pair() { } Pair(time_t t, double v) : time(t), value(v) { } Pair(const Pair& p) : time(p.time), value(p.value) { } time_t time; double value; }; class Datastream { public: Datastream(int id = 0) : mId(id), current(0x0) { } int mId; ~Datastream() { clear(); } void clear() { for (std::vector<Datarow*>::iterator it = datarows.begin(); it != datarows.end(); ++it) { delete (*it); }; datarows.clear(); current = 0x0; } void beginDatarow() { current = new Datarow; } void append(int date, double value) { if (!current) { beginDatarow(); } Pair p(date, value); current->push_back(p); } void endDatarow() { if (current) { datarows.push_back(current); current = 0; } } void print() { }; Handle<Array> toV8Array(Isolate * i); typedef std::vector<Pair> Datarow; std::vector<Datarow*> datarows; Datarow * current; struct JS { static void Initialize(Handle<ObjectTemplate> global, Isolate* i) { fprintf(stdout, "Datastream Initialize\n"); global->Set(String::NewFromUtf8(i, "Datastream"), FunctionTemplate::New(i, Constructor)); } static void Constructor(const <API key><Value>& info); static void GetDatapoints(Local<String> property, const <API key><Value> &info); static void GetX(Local<String> property, const <API key><Value> &info); static void Select(const <API key><Value>& info ) { v8::Isolate* i = v8::Isolate::GetCurrent(); Local<String> property; int sum = 0; // Get the X property and cast this value to an INT then add it by the argument property = String::NewFromUtf8(i, "x"); sum = info.This()->Get(property)->Int32Value() + info[0]->Int32Value(); info.This()->Set(property, Number::New(i, sum)); property = String::NewFromUtf8(i, "y"); sum = info.This()->Get(property)->Int32Value() + info[1]->Int32Value(); info.This()->Set(property, Number::New(i, sum)); // TODO // Connection to opensensordatabase // Get array data from JSON array } }; }; #endif // DATASTREAMV8_H
# Installation Add package service provider php 'providers' => [ Leemo\Filebrowser\ServiceProvider::class, ], in your `config/app.php`. Then publish vendor data $ php artisan vendor:publish --provider="Leemo\Filebrowser\ServiceProvider" --force
/** * @requires OpenLayers/Control.js */ /** * Class: OpenLayers.Control.Graticule * The Graticule displays a grid of latitude/longitude lines reprojected on * the map. * * Inherits from: * - <OpenLayers.Control> * */ OpenLayers.Control.Graticule = OpenLayers.Class(OpenLayers.Control, { /** * APIProperty: autoActivate * {Boolean} Activate the control when it is added to a map. Default is * true. */ autoActivate: true, /** * APIProperty: intervals * {Array(Float)} A list of possible graticule widths in degrees. */ intervals: [ 45, 30, 20, 10, 5, 2, 1, 0.5, 0.2, 0.1, 0.05, 0.01, 0.005, 0.002, 0.001 ], /** * APIProperty: <API key> * {Boolean} Allows the Graticule control to be switched on and off by * LayerSwitcher control. Defaults is true. */ <API key>: true, /** * APIProperty: visible * {Boolean} should the graticule be initially visible (default=true) */ visible: true, /** * APIProperty: numPoints * {Integer} The number of points to use in each graticule line. Higher * numbers result in a smoother curve for projected maps */ numPoints: 50, /** * APIProperty: targetSize * {Integer} The maximum size of the grid in pixels on the map */ targetSize: 200, /** * APIProperty: layerName * {String} The name to be displayed in the layer switcher, default is set * by {<OpenLayers.Lang>}. */ layerName: null, /** * APIProperty: labelled * {Boolean} Should the graticule lines be labelled?. default=true */ labelled: true, /** * APIProperty: labelFormat * {String} the format of the labels, default = 'dm'. See * <OpenLayers.Util.getFormattedLonLat> for other options. */ labelFormat: 'dm', /** * APIProperty: lineSymbolizer * {symbolizer} the symbolizer used to render lines */ lineSymbolizer: { strokeColor: "#333", strokeWidth: 1, strokeOpacity: 0.5 }, /** * APIProperty: labelSymbolizer * {symbolizer} the symbolizer used to render labels */ labelSymbolizer: {}, /** * Property: gratLayer * {OpenLayers.Layer.Vector} vector layer used to draw the graticule on */ gratLayer: null, /** * Constructor: OpenLayers.Control.Graticule * Create a new graticule control to display a grid of latitude longitude * lines. * * Parameters: * options - {Object} An optional object whose properties will be used * to extend the control. */ initialize: function(options) { options = options || {}; options.layerName = options.layerName || OpenLayers.i18n("graticule"); OpenLayers.Control.prototype.initialize.apply(this, [options]); this.labelSymbolizer.stroke = false; this.labelSymbolizer.fill = false; this.labelSymbolizer.label = "${label}"; this.labelSymbolizer.labelAlign = "${labelAlign}"; this.labelSymbolizer.labelXOffset = "${xOffset}"; this.labelSymbolizer.labelYOffset = "${yOffset}"; }, /** * APIMethod: destroy */ destroy: function() { this.deactivate(); OpenLayers.Control.prototype.destroy.apply(this, arguments); if (this.gratLayer) { this.gratLayer.destroy(); this.gratLayer = null; } }, /** * Method: draw * * initializes the graticule layer and does the initial update * * Returns: * {DOMElement} */ draw: function() { OpenLayers.Control.prototype.draw.apply(this, arguments); if (!this.gratLayer) { var gratStyle = new OpenLayers.Style({},{ rules: [new OpenLayers.Rule({'symbolizer': {"Point":this.labelSymbolizer, "Line":this.lineSymbolizer} })] }); this.gratLayer = new OpenLayers.Layer.Vector(this.layerName, { styleMap: new OpenLayers.StyleMap({'default':gratStyle}), visibility: this.visible, <API key>: this.<API key> }); } return this.div; }, /** * APIMethod: activate */ activate: function() { if (OpenLayers.Control.prototype.activate.apply(this, arguments)) { this.map.addLayer(this.gratLayer); this.map.events.register('moveend', this, this.update); this.update(); return true; } else { return false; } }, /** * APIMethod: deactivate */ deactivate: function() { if (OpenLayers.Control.prototype.deactivate.apply(this, arguments)) { this.map.events.unregister('moveend', this, this.update); this.map.removeLayer(this.gratLayer); return true; } else { return false; } }, /** * Method: update * * calculates the grid to be displayed and actually draws it * * Returns: * {DOMElement} */ update: function() { //wait for the map to be initialized before proceeding var mapBounds = this.map.getExtent(); if (!mapBounds) { return; } //clear out the old grid this.gratLayer.destroyFeatures(); //get the projection objects required var llProj = new OpenLayers.Projection("EPSG:4326"); var mapProj = this.map.getProjectionObject(); var mapRes = this.map.getResolution(); //if the map is in lon/lat, then the lines are straight and only one //point is required if (mapProj.proj && mapProj.proj.projName == "longlat") { this.numPoints = 1; } //get the map center in EPSG:4326 var mapCenter = this.map.getCenter(); //lon and lat here are really map x and y var mapCenterLL = new OpenLayers.Pixel(mapCenter.lon, mapCenter.lat); OpenLayers.Projection.transform(mapCenterLL, mapProj, llProj); /* This block of code determines the lon/lat interval to use for the * grid by calculating the diagonal size of one grid cell at the map * center. Iterates through the intervals array until the diagonal * length is less than the targetSize option. */ //find lat/lon interval that results in a grid of less than the target size var testSq = this.targetSize*mapRes; testSq *= testSq; //compare squares rather than doing a square root to save time var llInterval; for (var i=0; i<this.intervals.length; ++i) { llInterval = this.intervals[i]; //could do this for both x and y?? var delta = llInterval/2; var p1 = mapCenterLL.offset(new OpenLayers.Pixel(-delta, -delta)); //test coords in EPSG:4326 space var p2 = mapCenterLL.offset(new OpenLayers.Pixel( delta, delta)); OpenLayers.Projection.transform(p1, llProj, mapProj); // convert them back to map projection OpenLayers.Projection.transform(p2, llProj, mapProj); var distSq = (p1.x-p2.x)*(p1.x-p2.x) + (p1.y-p2.y)*(p1.y-p2.y); if (distSq <= testSq) { break; } } //alert(llInterval); //round the LL center to an even number based on the interval mapCenterLL.x = Math.floor(mapCenterLL.x/llInterval)*llInterval; mapCenterLL.y = Math.floor(mapCenterLL.y/llInterval)*llInterval; //TODO adjust for minutses/seconds? /* The following 2 blocks calculate the nodes of the grid along a * line of constant longitude (then latitiude) running through the * center of the map until it reaches the map edge. The calculation * goes from the center in both directions to the edge. */ //get the central longitude line, increment the latitude var iter = 0; var centerLonPoints = [mapCenterLL.clone()]; var newPoint = mapCenterLL.clone(); var mapXY; do { newPoint = newPoint.offset(new OpenLayers.Pixel(0,llInterval)); mapXY = OpenLayers.Projection.transform(newPoint.clone(), llProj, mapProj); centerLonPoints.unshift(newPoint); } while (mapBounds.containsPixel(mapXY) && ++iter<1000); newPoint = mapCenterLL.clone(); do { newPoint = newPoint.offset(new OpenLayers.Pixel(0,-llInterval)); mapXY = OpenLayers.Projection.transform(newPoint.clone(), llProj, mapProj); centerLonPoints.push(newPoint); } while (mapBounds.containsPixel(mapXY) && ++iter<1000); //get the central latitude line, increment the longitude iter = 0; var centerLatPoints = [mapCenterLL.clone()]; newPoint = mapCenterLL.clone(); do { newPoint = newPoint.offset(new OpenLayers.Pixel(-llInterval, 0)); mapXY = OpenLayers.Projection.transform(newPoint.clone(), llProj, mapProj); centerLatPoints.unshift(newPoint); } while (mapBounds.containsPixel(mapXY) && ++iter<1000); newPoint = mapCenterLL.clone(); do { newPoint = newPoint.offset(new OpenLayers.Pixel(llInterval, 0)); mapXY = OpenLayers.Projection.transform(newPoint.clone(), llProj, mapProj); centerLatPoints.push(newPoint); } while (mapBounds.containsPixel(mapXY) && ++iter<1000); //now generate a line for each node in the central lat and lon lines //first loop over constant longitude var lines = []; for(var i=0; i < centerLatPoints.length; ++i) { var lon = centerLatPoints[i].x; var pointList = []; var labelPoint = null; var latEnd = Math.min(centerLonPoints[0].y, 90); var latStart = Math.max(centerLonPoints[centerLonPoints.length - 1].y, -90); var latDelta = (latEnd - latStart)/this.numPoints; var lat = latStart; for(var j=0; j<= this.numPoints; ++j) { var gridPoint = new OpenLayers.Geometry.Point(lon,lat); gridPoint.transform(llProj, mapProj); pointList.push(gridPoint); lat += latDelta; if (gridPoint.y >= mapBounds.bottom && !labelPoint) { labelPoint = gridPoint; } } if (this.labelled) { //keep track of when this grid line crosses the map bounds to set //the label position //labels along the bottom, add 10 pixel offset up into the map //TODO add option for labels on top var labelPos = new OpenLayers.Geometry.Point(labelPoint.x,mapBounds.bottom); var labelAttrs = { value: lon, label: this.labelled?OpenLayers.Util.getFormattedLonLat(lon, "lon", this.labelFormat):"", labelAlign: "cb", xOffset: 0, yOffset: 2 }; this.gratLayer.addFeatures(new OpenLayers.Feature.Vector(labelPos,labelAttrs)); } var geom = new OpenLayers.Geometry.LineString(pointList); lines.push(new OpenLayers.Feature.Vector(geom)); } //now draw the lines of constant latitude for (var j=0; j < centerLonPoints.length; ++j) { lat = centerLonPoints[j].y; if (lat<-90 || lat>90) { //latitudes only valid between -90 and 90 continue; } var pointList = []; var lonStart = centerLatPoints[0].x; var lonEnd = centerLatPoints[centerLatPoints.length - 1].x; var lonDelta = (lonEnd - lonStart)/this.numPoints; var lon = lonStart; var labelPoint = null; for(var i=0; i <= this.numPoints ; ++i) { var gridPoint = new OpenLayers.Geometry.Point(lon,lat); gridPoint.transform(llProj, mapProj); pointList.push(gridPoint); lon += lonDelta; if (gridPoint.x < mapBounds.right) { labelPoint = gridPoint; } } if (this.labelled) { //keep track of when this grid line crosses the map bounds to set //the label position //labels along the right, 30 pixel offset left into the map //TODO add option for labels on left var labelPos = new OpenLayers.Geometry.Point(mapBounds.right, labelPoint.y); var labelAttrs = { value: lat, label: this.labelled?OpenLayers.Util.getFormattedLonLat(lat, "lat", this.labelFormat):"", labelAlign: "rb", xOffset: -2, yOffset: 2 }; this.gratLayer.addFeatures(new OpenLayers.Feature.Vector(labelPos,labelAttrs)); } var geom = new OpenLayers.Geometry.LineString(pointList); lines.push(new OpenLayers.Feature.Vector(geom)); } this.gratLayer.addFeatures(lines); }, CLASS_NAME: "OpenLayers.Control.Graticule" });
<!-- This comment will put IE 6, 7 and 8 in quirks mode --> <!DOCTYPE html PUBLIC "- <html xmlns="http: <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title><API key> Struct Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javaScript" src="search/search.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body onload='searchBox.OnSelectItem(0);'> <!-- Generated by Doxygen 1.6.1 --> <script type="text/javascript"><! var searchBox = new SearchBox("searchBox", "search",false,'Search'); --></script> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main&nbsp;Page</span></a></li> <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li> <div id="MSearchBox" class="MSearchBoxInactive"> <img id="MSearchSelect" src="search/search.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/> <input type="text" id="MSearchField" value="Search" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> </div> </li> </ul> </div> <div class="tabs"> <ul> <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li> <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li> </ul> </div> </div> <div class="contents"> <h1><API key> Struct Reference</h1><!-- doxytag: class="<API key>" --> <p><code>#include &lt;<a class="el" href="quote_8h_source.html">quote.h</a>&gt;</code></p> <p><a href="<API key>.html">List of all members.</a></p> <table border="0" cellpadding="0" cellspacing="0"> <tr><td colspan="2"><h2>Public Attributes</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="<API key>"></a><!-- doxytag: member="<API key>::__ptr" ref="<API key>" args="" --> struct <br class="typebreak"/> <a class="el" href="<API key>.html"><API key></a> **&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">__ptr</a></td></tr> <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Pointer to array of struct <API key>*. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="<API key>"></a><!-- doxytag: member="<API key>::__size" ref="<API key>" args="" --> int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">__size</a></td></tr> <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Size of the dynamic array. <br/></td></tr> </table> <hr/><a name="_details"></a><h2>Detailed Description</h2> <p>"http: <hr/>The documentation for this struct was generated from the following files:<ul> <li><a class="el" href="quote_8h_source.html">quote.h</a></li> <li><a class="el" href="sugar_8h_source.html">sugar.h</a></li> </ul> </div> <!--- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> <a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&nbsp;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&nbsp;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&nbsp;</span>Variables</a></div> <!-- iframe showing the search results (closed by default) --> <div id="<API key>"> <iframe src="" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <hr size="1"/><address style="text-align: right;"><small>Generated on Thu Jan 21 09:27:25 2010 by&nbsp; <a href="http: <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address> </body> </html>
HTML page; How to build the AEON GUI wallet from source, on Ubuntu.
#include <iostream> #include <gstreamermm.h> #include <gtkmm.h> #include <glibmm/i18n.h> #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "common/utils.h" #include "debug-ui.h" using namespace Gste; Glib::ustring <API key>(GstDebugLevel debug_level) { //FIXME: how to disable the warning here? Glib::ustring debug_name = <API key>(debug_level); if(!debug_name.empty()) return debug_name; if(debug_level == 0) return "NONE"; return " } DebugUI::DebugUI() : Gtk::Bin() { std::string ui_path = Gste::get_data_file("editor.glade"); Glib::RefPtr<Gtk::Builder> builder; try { builder = Gtk::Builder::create_from_file(ui_path, "debug_palette"); } catch (const Glib::FileError & ex) { std::cerr << ex.what() << std::endl; return; } Gtk::Widget * box = 0; Gtk::Button *add_button = 0, *remove_button = 0, *refresh_button = 0; builder->get_widget("debug_palette", box); builder->get_widget("<API key>", m_view); builder->get_widget("<API key>", m_default_hscale); builder->get_widget("default-level-label", m_default_label); builder->get_widget("custom-level-hscale", m_custom_hscale); builder->get_widget("custom-level-label", m_custom_label); builder->get_widget("custom-box", m_custom_box); builder->get_widget("add-button", add_button); builder->get_widget("remove-button", remove_button); builder->get_widget("refresh-button", refresh_button); //bail out if a widget was not constructed if (! (box && add_button && remove_button && refresh_button && m_view && m_default_hscale && m_default_label && m_custom_hscale && m_custom_label && m_custom_box) ) return; m_store = Gtk::ListStore::create(m_columns); m_add_store = Gtk::ListStore::create(m_columns); m_view->set_model(m_store); <API key> = m_default_hscale->get_adjustment(); <API key>-><API key>().connect(sigc::mem_fun(*this, &DebugUI::set_default_level)); <API key>->clamp_page(0, GST_LEVEL_COUNT-1); <API key>->set_step_increment(1); <API key>->set_lower(0); <API key>->set_upper(GST_LEVEL_COUNT-1); //TODO: wrap gst debug? <API key>->set_value(<API key>()); m_custom_adjustment = m_custom_hscale->get_adjustment(); m_custom_adjustment-><API key>().connect(sigc::mem_fun(*this, &DebugUI::set_custom_level)); m_custom_adjustment->set_step_increment(1); m_custom_adjustment->set_lower(0); m_custom_adjustment->set_upper(GST_LEVEL_COUNT-1); m_view->append_column(_("Level"), m_columns.level); m_view->append_column(_("Name"), m_columns.name); m_view->append_column(_("Description"), m_columns.description); this->set_default_level(); this->init_custom_levels(); Glib::RefPtr<Gtk::TreeSelection> selection = m_view->get_selection(); selection->set_mode(Gtk::SELECTION_MULTIPLE); selection->signal_changed().connect(sigc::mem_fun(*this, &DebugUI::tree_select)); add_button->signal_clicked().connect(sigc::mem_fun(*this, &DebugUI::show_add_window)); remove_button->signal_clicked().connect(sigc::mem_fun(*this, &DebugUI::remove_custom_cats)); refresh_button->signal_clicked().connect(sigc::mem_fun(*this, &DebugUI::refresh_categories)); this->add(*box); } void DebugUI::set_default_level() { GstDebugLevel debug_level = static_cast<GstDebugLevel>(<API key>->get_value()); <API key>(debug_level); m_default_label->set_text(<API key>(debug_level)); this->refresh_categories(); } void DebugUI::set_custom_level() { GstDebugLevel debug_level = static_cast<GstDebugLevel>(m_custom_adjustment->get_value()); m_custom_label->set_text(<API key>(debug_level)); /* Walk through selected items in the list and set the debug category */ Glib::RefPtr<Gtk::TreeView::Selection> selection = this->m_view->get_selection(); std::vector<Gtk::TreeModel::Path> selected_rows = selection->get_selected_rows(); for(std::vector<Gtk::TreeModel::Path>::iterator it=selected_rows.begin(); it != selected_rows.end(); ++it) { Gtk::TreeModel::Row row = *(m_store->get_iter(*it)); GstDebugCategory* cat = row[m_columns.category]; //<API key> (cat); <API key> (cat, debug_level); } this->refresh_categories(); } /* Add any starting debug levels to the tree */ void DebugUI::init_custom_levels () { /* * Get the current default threshold. Add all categories set to a different level to the custom list * and refresh the tree */ //FIXME: Gst Debug is not wrapped in Gstreamermm at all. GstDebugLevel default_thresh = <API key> (); GSList *slist = <API key> (); while (slist) { GstDebugCategory *cat = (GstDebugCategory *) slist->data; GstDebugLevel thresh = <API key> (cat); if (thresh != default_thresh) { //FIXME: how to disable the warning here? Glib::ustring level = <API key> (<API key> (cat)); Gtk::TreeModel::Row row = *(m_store->append()); row[m_columns.level] = level; row[m_columns.name] = <API key> (cat); row[m_columns.description] = <API key> (cat); row[m_columns.category] = cat; } slist = slist->next; } // /* I don't really grok the sorting stuff atm, and I have to do other work // * now */ // <API key> (GTK_TREE_VIEW (debug_ui->treeview), // <API key> (GTK_TREE_MODEL (lstore))); } /* * Walk the tree model of categories and update the 'level' column * to reflect the current threshold */ void DebugUI::refresh_categories() { for (Gtk::TreeIter iter = m_store->children().begin(); iter != m_store->children().end(); ++iter) { Gtk::TreeModel::Row row = *iter; GstDebugCategory* cat = row[m_columns.category]; row[m_columns.level] = <API key> (<API key> (cat)); } <API key>(); } void DebugUI::<API key>() { if(!m_add_window) return; m_add_store->clear(); //FIXME: Gst Debug is not wrapped in Gstreamermm at all. GSList *slist = <API key> (); for (; slist != NULL; slist = g_slist_next (slist)) { GstDebugCategory *cat = (GstDebugCategory *) slist->data; /* Don't add the category if it is already in the custom cats list */ if (<API key>(cat)) continue; Gtk::TreeModel::Row row = *(m_add_store->append()); row[m_columns.name] = <API key> (cat); row[m_columns.description] = <API key> (cat); row[m_columns.category] = cat; } } bool DebugUI::<API key>(GstDebugCategory * cat) { for (Gtk::TreeIter iter = m_store->children().begin(); iter != m_store->children().end(); ++iter) { Gtk::TreeModel::Row row = *iter; GstDebugCategory* cur_cat = row[m_columns.category]; if(cur_cat == cat){ return true; } } return false; } void DebugUI::tree_select () { /* Walk through selected items in the list and set the debug category */ Glib::RefPtr<Gtk::TreeView::Selection> selection = this->m_view->get_selection(); if(selection->count_selected_rows() == 0){ m_custom_box->set_sensitive(false); return; } m_custom_box->set_sensitive(true); std::vector<Gtk::TreeModel::Path> selected_rows = selection->get_selected_rows(); for(std::vector<Gtk::TreeModel::Path>::iterator it=selected_rows.begin(); it != selected_rows.end(); ++it) { Gtk::TreeModel::Row row = *(m_add_store->get_iter(*it)); GstDebugCategory* cat = row[m_columns.category]; m_custom_hscale->get_adjustment()->set_value(<API key> (cat)); } } void DebugUI::show_add_window() { if (!m_add_window) { std::string ui_path = Gste::get_data_file("editor.glade"); Glib::RefPtr<Gtk::Builder> builder; try { builder = Gtk::Builder::create_from_file(ui_path, "add-debug-win"); } catch (const Glib::FileError & ex) { std::cerr << ex.what() << std::endl; return; } builder->get_widget("add-debug-win", m_add_window); m_add_window->set_transient_for(*dynamic_cast<Gtk::Window*>(this->get_toplevel())); /* Connect the callbacks and populate the list of debug categories */ builder->get_widget("categories-tree", m_add_cats_treeview); Gtk::Button *add_button, *cancel_button; builder->get_widget("add-cat-button", add_button); builder->get_widget("cancel-cat-button", cancel_button); add_button->signal_clicked().connect(sigc::mem_fun(*this, &DebugUI::add_custom_cats)); cancel_button->signal_clicked().connect(sigc::mem_fun(*m_add_window, &Gtk::Window::hide)); /* Set up the tree view columns */ m_add_cats_treeview->set_model(m_add_store); m_add_cats_treeview->append_column(_("Name"), m_columns.name); m_add_cats_treeview->append_column(_("Description"), m_columns.description); Glib::RefPtr<Gtk::TreeSelection> selection = m_add_cats_treeview->get_selection(); selection->set_mode(Gtk::SELECTION_MULTIPLE); } m_add_window->show_all(); <API key>(); } /* * Handle a click on the 'add' button inside the add categories window * Grab the selected categories from the list and add them to the main window */ void DebugUI::add_custom_cats() { if (!m_add_window) return; m_add_window->hide(); /* Walk through selected items in the list and set the debug category */ Glib::RefPtr<Gtk::TreeView::Selection> selection = this->m_add_cats_treeview->get_selection(); std::vector<Gtk::TreeModel::Path> selected_rows = selection->get_selected_rows(); for(std::vector<Gtk::TreeModel::Path>::iterator it=selected_rows.begin(); it != selected_rows.end(); ++it) { Gtk::TreeModel::Row srow = *(m_add_store->get_iter(*it)); GstDebugCategory* cat = srow[m_columns.category]; if (!cat) continue; /* Add the category to the list of custom entries */ Gtk::TreeModel::Row row = *(m_store->append()); row[m_columns.level] = <API key> (<API key> (cat)); row[m_columns.name] = <API key> (cat); row[m_columns.description] = <API key> (cat); row[m_columns.category] = cat; } } void DebugUI::remove_custom_cats() { /* Walk through selected items in the list and set the debug category */ Glib::RefPtr<Gtk::TreeView::Selection> selection = this->m_view->get_selection(); std::vector<Gtk::TreeModel::Path> selected_rows = selection->get_selected_rows(); std::vector<Gtk::TreeRowReference> row_references; for(std::vector<Gtk::TreeModel::Path>::iterator it=selected_rows.begin(); it != selected_rows.end(); ++it) { row_references.push_back(Gtk::TreeRowReference(m_store, *it)); } for(std::vector<Gtk::TreeRowReference>::iterator it=row_references.begin(); it != row_references.end(); ++it) { Gtk::TreeModel::iterator iter = (m_store->get_iter(it->get_path())); Gtk::TreeModel::Row srow = *iter; GstDebugCategory* cat = srow[m_columns.category]; <API key> (cat); m_store->erase(iter); } <API key>(); }
#ifndef FOXGUI_HISTORY_H #define FOXGUI_HISTORY_H #include "agg_array.h" #include "strpp.h" class history { public: history(): m_index(0) {} ~history() { for (unsigned j = 0; j < m_lines.size(); j++) delete m_lines[j]; } void add(const char* line) { str* s = new str(line); m_lines.add(s); m_index = 0; } void remove_last() { m_lines.remove_last(); } bool is_first() const { return m_index == 0; } const char* previous() { if (m_index < (int) m_lines.size()) m_index++; const char* ln = line(m_index); return ln; } const char* next() { if (m_index > 0) m_index const char* ln = line(m_index); return ln; } const char* line(int j) { int sz = m_lines.size(); int index = sz - j; if (index >= 0 && index < sz) { str* s = m_lines[unsigned(index)]; return s->cstr(); } return 0; } private: agg::pod_bvector<str*> m_lines; int m_index; }; #endif
#include "StdInc.h" #define <API key> "CGUI/StaticImage" <API key>::<API key> ( CGUI_Impl* pGUI, CGUIElement* pParent ) { // Initialize m_pImagesetManager = pGUI->GetImageSetManager (); m_pImageset = NULL; m_pImage = NULL; m_pGUI = pGUI; m_pManager = pGUI; m_pTexture = NULL; m_bCreatedTexture = false; // Get an unique identifier for CEGUI char szUnique [CGUI_CHAR_SIZE]; pGUI->GetUniqueName ( szUnique ); // Create the control and set default properties m_pWindow = pGUI->GetWindowManager ()->createWindow ( <API key>, szUnique ); m_pWindow-><API key> ( false ); m_pWindow->setRect ( CEGUI::Relative, CEGUI::Rect ( 0.0f, 0.0f, 1.0f, 1.0f ) ); reinterpret_cast < CEGUI::StaticImage* > ( m_pWindow ) -> <API key> ( false ); // Store the pointer to this CGUI element in the CEGUI element m_pWindow->setUserData ( reinterpret_cast < void* > ( this ) ); AddEvents (); // If a parent is specified, add it to it's children list, if not, add it as a child to the pManager if ( pParent ) { SetParent ( pParent ); } else { pGUI->AddChild ( this ); SetParent ( NULL ); } } <API key>::~<API key> ( void ) { // Clear the image Clear (); DestroyElement (); } bool <API key>::LoadFromFile ( const char* szFilename, const char* szDirectory ) { std::string strPath = szDirectory ? szDirectory : m_pGUI->GetWorkingDirectory (); strPath += szFilename; // Load texture if ( !m_pTexture ) { m_pTexture = new CGUITexture_Impl ( m_pGUI ); m_bCreatedTexture = true; } if ( !m_pTexture->LoadFromFile ( strPath.c_str () ) ) return false; // Load image return LoadFromTexture ( m_pTexture ); } bool <API key>::LoadFromTexture ( CGUITexture* pTexture ) { if ( m_pImageset || m_pImage ) return false; if ( m_pTexture && pTexture != m_pTexture ) { delete m_pTexture; m_bCreatedTexture = false; } m_pTexture = (CGUITexture_Impl *)pTexture; // Get CEGUI texture CEGUI::Texture* pCEGUITexture = m_pTexture->GetTexture (); // Get an unique identifier for CEGUI for the imageset char szUnique [CGUI_CHAR_SIZE]; m_pGUI->GetUniqueName ( szUnique ); // Create an imageset m_pImageset = m_pImagesetManager->createImageset ( szUnique, pCEGUITexture ); // Get an unique identifier for CEGUI for the image m_pGUI->GetUniqueName ( szUnique ); // Define an image and get its pointer m_pImageset->defineImage ( szUnique, CEGUI::Point ( 0, 0 ), CEGUI::Size ( pCEGUITexture->getWidth (), pCEGUITexture->getHeight () ), CEGUI::Point ( 0, 0 ) ); m_pImage = &m_pImageset->getImage ( szUnique ); // Set the image just loaded as the image to be drawn for the widget reinterpret_cast < CEGUI::StaticImage* > ( m_pWindow )->setImage ( m_pImage ); // Success return true; } void <API key>::Clear ( void ) { // Stop the control from using it reinterpret_cast < CEGUI::StaticImage* > ( m_pWindow )->setImage ( NULL ); // Kill the images if ( m_pImageset ) { m_pImageset->undefineAllImages (); m_pImagesetManager->destroyImageset ( m_pImageset ); if ( m_bCreatedTexture ) { delete m_pTexture; m_pTexture = NULL; } m_pImage = NULL; m_pImageset = NULL; } } void <API key>::SetFrameEnabled ( bool bFrameEnabled ) { reinterpret_cast < CEGUI::StaticImage* > ( m_pWindow ) -> setFrameEnabled ( bFrameEnabled ); } bool <API key>::IsFrameEnabled ( void ) { return reinterpret_cast < CEGUI::StaticImage* > ( m_pWindow ) -> isFrameEnabled (); } CEGUI::Image* <API key>::GetDirectImage ( void ) { return const_cast < CEGUI::Image* > ( reinterpret_cast < CEGUI::StaticImage* > ( m_pWindow ) ->getImage () ); } void <API key>::Render ( void ) { return reinterpret_cast < CEGUI::StaticImage* > ( m_pWindow ) -> render (); }
const fs = require('fs'); const uglify = require('uglify-js'); const script = (script) => fs.readFileSync(`${__dirname}/client/${script}.js`); const code = `(function(window, document){ ${script('jquery')}; ${script('init')}; ${script('element')}; ${script('elementManager')}; ${script('document')}; ${script('location')}; })(window, document);`; exports.clientJs = code; //uglify.minify(code).code;
# !/usr/bin/env python # Hornet - SSH Honeypot # This program is free software: you can redistribute it and/or modify # (at your option) any later version. # This program is distributed in the hope that it will be useful, # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the import gevent.monkey gevent.monkey.patch_all() import paramiko import re import os import hornet from hornet.main import Hornet from hornet.tests.commands.base import BaseTestClass LS_L_REGEX = r"[-d][rwx-]{9}(.*)" class HornetTests(BaseTestClass): def test_basic_ls(self): """ Test basic 'ls' """ honeypot = Hornet(self.working_dir) honeypot.start() self.create_filesystem(honeypot) while honeypot.server.server_port == 0: # wait until the server is ready gevent.sleep(0) port = honeypot.server.server_port client = paramiko.SSHClient() client.<API key>(paramiko.AutoAddPolicy()) # If we log in properly, this should raise no errors client.connect('127.0.0.1', port=port, username='testuser', password='testpassword') channel = client.invoke_shell() while not channel.recv_ready(): gevent.sleep(0) welcome = '' while channel.recv_ready(): welcome += channel.recv(1) lines = welcome.split('\r\n') prompt = lines[-1] self.assertTrue(prompt.endswith('$ ')) # Now send the ls command ls_command = 'ls' channel.send(ls_command + '\r\n') while not channel.recv_ready(): gevent.sleep(0) output = '' while not output.endswith('$ '): output += channel.recv(1) lines = output.split('\r\n') command = lines[0] command_output = '\r\n'.join(lines[1:-1]) next_prompt = lines[-1] self.assertEquals(command, ls_command) self.assertTrue('etc' in command_output) self.assertTrue('var' in command_output) self.assertTrue('bin' in command_output) self.assertTrue('initrd.img' in command_output) self.assertTrue(next_prompt.endswith('$ ')) honeypot.stop() def <API key>(self): """ Test basic 'ls --version' """ honeypot = Hornet(self.working_dir) honeypot.start() self.create_filesystem(honeypot) while honeypot.server.server_port == 0: # wait until the server is ready gevent.sleep(0) port = honeypot.server.server_port client = paramiko.SSHClient() client.<API key>(paramiko.AutoAddPolicy()) # If we log in properly, this should raise no errors client.connect('127.0.0.1', port=port, username='testuser', password='testpassword') channel = client.invoke_shell() while not channel.recv_ready(): gevent.sleep(0) welcome = '' while channel.recv_ready(): welcome += channel.recv(1) lines = welcome.split('\r\n') prompt = lines[-1] self.assertTrue(prompt.endswith('$ ')) # Now send the ls command ls_command = 'ls --version' channel.send(ls_command + '\r\n') while not channel.recv_ready(): gevent.sleep(0) output = '' while not output.endswith('$ '): output += channel.recv(1) lines = output.split('\r\n') command = lines[0] command_output = '\r\n'.join(lines[1:-1]) next_prompt = lines[-1] expected_output = [] version_file_path = os.path.join(os.path.dirname(hornet.__file__), 'data', 'commands', 'ls', 'version') with open(version_file_path) as version_file: for line in version_file: line = line.strip() expected_output.append(line) self.assertEquals(command, ls_command) self.assertEquals(command_output, '\r\n'.join(expected_output)) self.assertTrue(next_prompt.endswith('$ ')) honeypot.stop() def test_ls_help_string(self): """ Test basic 'ls --help' """ honeypot = Hornet(self.working_dir) honeypot.start() self.create_filesystem(honeypot) while honeypot.server.server_port == 0: # wait until the server is ready gevent.sleep(0) port = honeypot.server.server_port client = paramiko.SSHClient() client.<API key>(paramiko.AutoAddPolicy()) # If we log in properly, this should raise no errors client.connect('127.0.0.1', port=port, username='testuser', password='testpassword') channel = client.invoke_shell() while not channel.recv_ready(): gevent.sleep(0) welcome = '' while channel.recv_ready(): welcome += channel.recv(1) lines = welcome.split('\r\n') prompt = lines[-1] self.assertTrue(prompt.endswith('$ ')) # Now send the ls command ls_command = 'ls --help' channel.send(ls_command + '\r\n') while not channel.recv_ready(): gevent.sleep(0) output = '' while not output.endswith('$ '): output += channel.recv(1) lines = output.split('\r\n') command = lines[0] command_output = '\r\n'.join(lines[1:-1]) next_prompt = lines[-1] expected_output = [] help_file_path = os.path.join(os.path.dirname(hornet.__file__), 'data', 'commands', 'ls', 'help') with open(help_file_path) as help_file: for line in help_file: line = line.strip() expected_output.append(line) self.assertEquals(command, ls_command) self.assertEquals(command_output, '\r\n'.join(expected_output)) self.assertTrue(next_prompt.endswith('$ ')) honeypot.stop() def test_ls_long(self): """ Test basic 'ls -l' """ honeypot = Hornet(self.working_dir) honeypot.start() self.create_filesystem(honeypot) while honeypot.server.server_port == 0: # wait until the server is ready gevent.sleep(0) port = honeypot.server.server_port client = paramiko.SSHClient() client.<API key>(paramiko.AutoAddPolicy()) # If we log in properly, this should raise no errors client.connect('127.0.0.1', port=port, username='testuser', password='testpassword') channel = client.invoke_shell() while not channel.recv_ready(): gevent.sleep(0) welcome = '' while channel.recv_ready(): welcome += channel.recv(1) lines = welcome.split('\r\n') prompt = lines[-1] self.assertTrue(prompt.endswith('$ ')) # Now send the ls command ls_command = 'ls -l' channel.send(ls_command + '\r\n') while not channel.recv_ready(): gevent.sleep(0) output = '' while not output.endswith('$ '): output += channel.recv(1) lines = output.split('\r\n') command = lines[0] command_output = '\r\n'.join(lines[1:-1]) next_prompt = lines[-1] self.assertEquals(command, ls_command) actual_list = command_output.split('\r\n')[1:] # Ignore the first "total" entry expected_list = ['initrd.img', 'var', 'etc', 'bin'] self.verify_long_list(actual_list, expected_list) self.assertTrue(next_prompt.endswith('$ ')) honeypot.stop() def <API key>(self): """ Test basic 'ls etc var' """ honeypot = Hornet(self.working_dir) honeypot.start() self.create_filesystem(honeypot) while honeypot.server.server_port == 0: # wait until the server is ready gevent.sleep(0) port = honeypot.server.server_port client = paramiko.SSHClient() client.<API key>(paramiko.AutoAddPolicy()) # If we log in properly, this should raise no errors client.connect('127.0.0.1', port=port, username='testuser', password='testpassword') channel = client.invoke_shell() while not channel.recv_ready(): gevent.sleep(0) welcome = '' while channel.recv_ready(): welcome += channel.recv(1) lines = welcome.split('\r\n') prompt = lines[-1] self.assertTrue(prompt.endswith('$ ')) # Now send the ls command ls_command = 'ls etc var' channel.send(ls_command + '\r\n') while not channel.recv_ready(): gevent.sleep(0) output = '' while not output.endswith('$ '): output += channel.recv(1) lines = output.split('\r\n') command = lines[0] command_output = '\r\n'.join(lines[1:-1]) next_prompt = lines[-1] self.assertEquals(command, ls_command) dir_outputs = sorted(command_output.split('\r\n\r\n')) self.assertTrue('etc:\r\n' in dir_outputs[0]) self.assertTrue('passwd' in dir_outputs[0]) self.assertTrue('init.d' in dir_outputs[0]) self.assertTrue('sysctl.conf' in dir_outputs[0]) self.assertTrue("var:" in dir_outputs[1]) self.assertTrue(next_prompt.endswith('$ ')) honeypot.stop() def <API key>(self): """ Test basic 'ls -l etc var' with multiple directory arguments """ honeypot = Hornet(self.working_dir) honeypot.start() self.create_filesystem(honeypot) while honeypot.server.server_port == 0: # wait until the server is ready gevent.sleep(0) port = honeypot.server.server_port client = paramiko.SSHClient() client.<API key>(paramiko.AutoAddPolicy()) # If we log in properly, this should raise no errors client.connect('127.0.0.1', port=port, username='testuser', password='testpassword') channel = client.invoke_shell() while not channel.recv_ready(): gevent.sleep(0) welcome = '' while channel.recv_ready(): welcome += channel.recv(1) lines = welcome.split('\r\n') prompt = lines[-1] self.assertTrue(prompt.endswith('$ ')) # Now send the ls command ls_command = 'ls -l etc var' channel.send(ls_command + '\r\n') while not channel.recv_ready(): gevent.sleep(0) output = '' while not output.endswith('$ '): output += channel.recv(1) lines = output.split('\r\n') command = lines[0] command_output = '\r\n'.join(lines[1:-1]) next_prompt = lines[-1] self.assertEquals(command, ls_command) dir_outputs = sorted(command_output.split('\r\n\r\n')) self.assertTrue(dir_outputs[0].startswith('etc:')) self.assertTrue('total ' in dir_outputs[0]) self.assertTrue('passwd' in dir_outputs[0]) self.assertTrue('sysctl.conf' in dir_outputs[0]) # No carriage return here, because it was split before self.assertTrue('init.d' in dir_outputs[0]) # No carriage return here, because it was split before self.assertEquals(len(dir_outputs[0].split('\r\n')), 5) self.assertTrue(dir_outputs[1].startswith('var:')) self.assertTrue('total 0' in dir_outputs[1]) self.assertTrue(len(dir_outputs[1].split('\r\n')) == 2) self.assertTrue(next_prompt.endswith('$ ')) honeypot.stop() def <API key>(self): """ Test basic 'ls -l etc/passwd etc/sysctl.conf' with multiple file arguments """ honeypot = Hornet(self.working_dir) honeypot.start() self.create_filesystem(honeypot) while honeypot.server.server_port == 0: # wait until the server is ready gevent.sleep(0) port = honeypot.server.server_port client = paramiko.SSHClient() client.<API key>(paramiko.AutoAddPolicy()) # If we log in properly, this should raise no errors client.connect('127.0.0.1', port=port, username='testuser', password='testpassword') channel = client.invoke_shell() while not channel.recv_ready(): gevent.sleep(0) welcome = '' while channel.recv_ready(): welcome += channel.recv(1) lines = welcome.split('\r\n') prompt = lines[-1] self.assertTrue(prompt.endswith('$ ')) # Now send the ls command ls_command = 'ls -l etc/passwd etc/sysctl.conf' channel.send(ls_command + '\r\n') while not channel.recv_ready(): gevent.sleep(0) output = '' while not output.endswith('$ '): output += channel.recv(1) lines = output.split('\r\n') command = lines[0] command_output = '\r\n'.join(lines[1:-1]) next_prompt = lines[-1] self.assertEquals(command, ls_command) actual_list = command_output.split('\r\n') expected_list = ['passwd', 'sysctl.conf'] self.verify_long_list(actual_list, expected_list) self.assertTrue(next_prompt.endswith('$ ')) honeypot.stop() def <API key>(self): """ Test basic 'ls -d bin' with single directory argument """ honeypot = Hornet(self.working_dir) honeypot.start() self.create_filesystem(honeypot) while honeypot.server.server_port == 0: # wait until the server is ready gevent.sleep(0) port = honeypot.server.server_port client = paramiko.SSHClient() client.<API key>(paramiko.AutoAddPolicy()) # If we log in properly, this should raise no errors client.connect('127.0.0.1', port=port, username='testuser', password='testpassword') channel = client.invoke_shell() while not channel.recv_ready(): gevent.sleep(0) welcome = '' while channel.recv_ready(): welcome += channel.recv(1) lines = welcome.split('\r\n') prompt = lines[-1] self.assertTrue(prompt.endswith('$ ')) # Now send the ls command ls_command = 'ls -d bin' channel.send(ls_command + '\r\n') while not channel.recv_ready(): gevent.sleep(0) output = '' while not output.endswith('$ '): output += channel.recv(1) lines = output.split('\r\n') command = lines[0] command_output = '\r\n'.join(lines[1:-1]) next_prompt = lines[-1] self.assertEquals(command, ls_command) self.assertEquals(command_output, 'bin') self.assertTrue(next_prompt.endswith('$ ')) honeypot.stop() def <API key>(self): """ Test basic 'ls -d bin var' with multiple directory arguments """ honeypot = Hornet(self.working_dir) honeypot.start() self.create_filesystem(honeypot) while honeypot.server.server_port == 0: # wait until the server is ready gevent.sleep(0) port = honeypot.server.server_port client = paramiko.SSHClient() client.<API key>(paramiko.AutoAddPolicy()) # If we log in properly, this should raise no errors client.connect('127.0.0.1', port=port, username='testuser', password='testpassword') channel = client.invoke_shell() while not channel.recv_ready(): gevent.sleep(0) welcome = '' while channel.recv_ready(): welcome += channel.recv(1) lines = welcome.split('\r\n') prompt = lines[-1] self.assertTrue(prompt.endswith('$ ')) # Now send the ls command ls_command = 'ls -d bin var' channel.send(ls_command + '\r\n') while not channel.recv_ready(): gevent.sleep(0) output = '' while not output.endswith('$ '): output += channel.recv(1) lines = output.split('\r\n') command = lines[0] command_output = '\r\n'.join(lines[1:-1]) next_prompt = lines[-1] self.assertEquals(command, ls_command) self.assertTrue('bin' in command_output) self.assertTrue('var' in command_output) self.assertTrue(next_prompt.endswith('$ ')) honeypot.stop() def <API key>(self): """ Test basic 'ls -d nonexistantpath' with non-existant path argument """ honeypot = Hornet(self.working_dir) honeypot.start() self.create_filesystem(honeypot) while honeypot.server.server_port == 0: # wait until the server is ready gevent.sleep(0) port = honeypot.server.server_port client = paramiko.SSHClient() client.<API key>(paramiko.AutoAddPolicy()) # If we log in properly, this should raise no errors client.connect('127.0.0.1', port=port, username='testuser', password='testpassword') channel = client.invoke_shell() while not channel.recv_ready(): gevent.sleep(0) welcome = '' while channel.recv_ready(): welcome += channel.recv(1) lines = welcome.split('\r\n') prompt = lines[-1] self.assertTrue(prompt.endswith('$ ')) # Now send the ls command ls_command = 'ls -d nonexistantpath' channel.send(ls_command + '\r\n') while not channel.recv_ready(): gevent.sleep(0) output = '' while not output.endswith('$ '): output += channel.recv(1) lines = output.split('\r\n') command = lines[0] command_output = '\r\n'.join(lines[1:-1]) next_prompt = lines[-1] self.assertEquals(command, ls_command) self.assertEquals(command_output, 'ls: cannot access nonexistantpath: No such file or directory') self.assertTrue(next_prompt.endswith('$ ')) honeypot.stop() def <API key>(self): """ Test basic 'ls -l nonexistantpath' with non-existant path argument """ honeypot = Hornet(self.working_dir) honeypot.start() self.create_filesystem(honeypot) while honeypot.server.server_port == 0: # wait until the server is ready gevent.sleep(0) port = honeypot.server.server_port client = paramiko.SSHClient() client.<API key>(paramiko.AutoAddPolicy()) # If we log in properly, this should raise no errors client.connect('127.0.0.1', port=port, username='testuser', password='testpassword') channel = client.invoke_shell() while not channel.recv_ready(): gevent.sleep(0) welcome = '' while channel.recv_ready(): welcome += channel.recv(1) lines = welcome.split('\r\n') prompt = lines[-1] self.assertTrue(prompt.endswith('$ ')) # Now send the ls command ls_command = 'ls -l nonexistantpath' channel.send(ls_command + '\r\n') while not channel.recv_ready(): gevent.sleep(0) output = '' while not output.endswith('$ '): output += channel.recv(1) lines = output.split('\r\n') command = lines[0] command_output = '\r\n'.join(lines[1:-1]) next_prompt = lines[-1] self.assertEquals(command, ls_command) self.assertEquals(command_output, 'ls: cannot access nonexistantpath: No such file or directory') self.assertTrue(next_prompt.endswith('$ ')) honeypot.stop() def test_ls_ld(self): """ Test basic 'ls -ld var bin etc/passwd initrd.img' with files as well as directories """ honeypot = Hornet(self.working_dir) honeypot.start() self.create_filesystem(honeypot) while honeypot.server.server_port == 0: # wait until the server is ready gevent.sleep(0) port = honeypot.server.server_port client = paramiko.SSHClient() client.<API key>(paramiko.AutoAddPolicy()) # If we log in properly, this should raise no errors client.connect('127.0.0.1', port=port, username='testuser', password='testpassword') channel = client.invoke_shell() while not channel.recv_ready(): gevent.sleep(0) welcome = '' while channel.recv_ready(): welcome += channel.recv(1) lines = welcome.split('\r\n') prompt = lines[-1] self.assertTrue(prompt.endswith('$ ')) # Now send the ls command ls_command = 'ls -ld var bin etc/passwd initrd.img' channel.send(ls_command + '\r\n') while not channel.recv_ready(): gevent.sleep(0) output = '' while not output.endswith('$ '): output += channel.recv(1) lines = output.split('\r\n') command = lines[0] command_output = '\r\n'.join(lines[1:-1]) next_prompt = lines[-1] self.assertEquals(command, ls_command) actual_list = command_output.split('\r\n') expected_list = ['initrd.img', 'var', 'passwd', 'bin'] self.verify_long_list(actual_list, expected_list) self.assertTrue('total' not in command_output) self.assertTrue(next_prompt.endswith('$ ')) honeypot.stop() def <API key>(self): """ Test basic 'ls etc/..' """ honeypot = Hornet(self.working_dir) honeypot.start() self.create_filesystem(honeypot) while honeypot.server.server_port == 0: # wait until the server is ready gevent.sleep(0) port = honeypot.server.server_port client = paramiko.SSHClient() client.<API key>(paramiko.AutoAddPolicy()) # If we log in properly, this should raise no errors client.connect('127.0.0.1', port=port, username='testuser', password='testpassword') channel = client.invoke_shell() while not channel.recv_ready(): gevent.sleep(0) welcome = '' while channel.recv_ready(): welcome += channel.recv(1) lines = welcome.split('\r\n') prompt = lines[-1] self.assertTrue(prompt.endswith('$ ')) # Now send the ls command ls_command = 'ls etc/..' channel.send(ls_command + '\r\n') while not channel.recv_ready(): gevent.sleep(0) output = '' while not output.endswith('$ '): output += channel.recv(1) lines = output.split('\r\n') command = lines[0] command_output = '\r\n'.join(lines[1:-1]) next_prompt = lines[-1] self.assertEquals(command, ls_command) self.assertTrue('etc' in command_output) self.assertTrue('var' in command_output) self.assertTrue('bin' in command_output) self.assertTrue('initrd.img' in command_output) self.assertTrue(next_prompt.endswith('$ ')) honeypot.stop() def <API key>(self): """ Test basic 'ls -l .. var' with multiple directory arguments """ honeypot = Hornet(self.working_dir) honeypot.start() self.create_filesystem(honeypot) while honeypot.server.server_port == 0: # wait until the server is ready gevent.sleep(0) port = honeypot.server.server_port client = paramiko.SSHClient() client.<API key>(paramiko.AutoAddPolicy()) # If we log in properly, this should raise no errors client.connect('127.0.0.1', port=port, username='testuser', password='testpassword') channel = client.invoke_shell() while not channel.recv_ready(): gevent.sleep(0) welcome = '' while channel.recv_ready(): welcome += channel.recv(1) lines = welcome.split('\r\n') prompt = lines[-1] self.assertTrue(prompt.endswith('$ ')) # Now send the ls command ls_command = 'ls -l .. var' channel.send(ls_command + '\r\n') while not channel.recv_ready(): gevent.sleep(0) output = '' while not output.endswith('$ '): output += channel.recv(1) lines = output.split('\r\n') command = lines[0] command_output = '\r\n'.join(lines[1:-1]) next_prompt = lines[-1] self.assertEquals(command, ls_command) dir_outputs = sorted(command_output.split('\r\n\r\n')) self.assertTrue(dir_outputs[0].startswith('..:')) self.assertTrue('total ' in dir_outputs[0]) self.assertTrue('var' in dir_outputs[0]) self.assertTrue('bin' in dir_outputs[0]) self.assertTrue('initrd.img' in dir_outputs[0]) self.assertTrue('etc' in dir_outputs[0]) self.assertEquals(len(dir_outputs[0].split('\r\n')), 6) self.assertTrue(dir_outputs[1].startswith('var:')) self.assertTrue('total 0' in dir_outputs[1]) self.assertEquals(len(dir_outputs[1].split('\r\n')), 2) self.assertTrue(next_prompt.endswith('$ ')) honeypot.stop() def <API key>(self): """ Test basic 'ls ../../..' """ honeypot = Hornet(self.working_dir) honeypot.start() self.create_filesystem(honeypot) while honeypot.server.server_port == 0: # wait until the server is ready gevent.sleep(0) port = honeypot.server.server_port client = paramiko.SSHClient() client.<API key>(paramiko.AutoAddPolicy()) # If we log in properly, this should raise no errors client.connect('127.0.0.1', port=port, username='testuser', password='testpassword') channel = client.invoke_shell() while not channel.recv_ready(): gevent.sleep(0) welcome = '' while channel.recv_ready(): welcome += channel.recv(1) lines = welcome.split('\r\n') prompt = lines[-1] self.assertTrue(prompt.endswith('$ ')) # Now send the ls command ls_command = 'ls' channel.send(ls_command + '\r\n') while not channel.recv_ready(): gevent.sleep(0) output = '' while not output.endswith('$ '): output += channel.recv(1) lines = output.split('\r\n') command = lines[0] command_output = '\r\n'.join(lines[1:-1]) next_prompt = lines[-1] self.assertEquals(command, ls_command) self.assertTrue('etc' in command_output) self.assertTrue('var' in command_output) self.assertTrue('bin' in command_output) self.assertTrue('initrd.img' in command_output) self.assertTrue(next_prompt.endswith('$ ')) honeypot.stop() def test_basic_ls_all(self): """ Test basic 'ls -a' """ honeypot = Hornet(self.working_dir) honeypot.start() self.create_filesystem(honeypot) while honeypot.server.server_port == 0: # wait until the server is ready gevent.sleep(0) port = honeypot.server.server_port client = paramiko.SSHClient() client.<API key>(paramiko.AutoAddPolicy()) # If we log in properly, this should raise no errors client.connect('127.0.0.1', port=port, username='testuser', password='testpassword') channel = client.invoke_shell() while not channel.recv_ready(): gevent.sleep(0) welcome = '' while channel.recv_ready(): welcome += channel.recv(1) lines = welcome.split('\r\n') prompt = lines[-1] self.assertTrue(prompt.endswith('$ ')) # Now send the ls command ls_command = 'ls -a' channel.send(ls_command + '\r\n') while not channel.recv_ready(): gevent.sleep(0) output = '' while not output.endswith('$ '): output += channel.recv(1) lines = output.split('\r\n') command = lines[0] command_output = '\r\n'.join(lines[1:-1]) next_prompt = lines[-1] self.assertEquals(command, ls_command) self.assertTrue('etc' in command_output) self.assertTrue('var' in command_output) self.assertTrue('bin' in command_output) self.assertTrue('initrd.img' in command_output) self.assertTrue('. ' in command_output) self.assertTrue('..' in command_output) self.assertTrue(next_prompt.endswith('$ ')) honeypot.stop() def <API key>(self): """ Test basic 'cd var; ls -al ../etc' """ honeypot = Hornet(self.working_dir) honeypot.start() self.create_filesystem(honeypot) while honeypot.server.server_port == 0: # wait until the server is ready gevent.sleep(0) port = honeypot.server.server_port client = paramiko.SSHClient() client.<API key>(paramiko.AutoAddPolicy()) # If we log in properly, this should raise no errors client.connect('127.0.0.1', port=port, username='testuser', password='testpassword') channel = client.invoke_shell() while not channel.recv_ready(): gevent.sleep(0) welcome = '' while channel.recv_ready(): welcome += channel.recv(1) lines = welcome.split('\r\n') prompt = lines[-1] self.assertTrue(prompt.endswith('$ ')) cd_command = 'cd var' channel.send(cd_command + '\r\n') while not channel.recv_ready(): gevent.sleep(0) output = '' while not output.endswith('$ '): output += channel.recv(1) lines = output.split('\r\n') command = lines[0] next_prompt = lines[-1] self.assertEquals(command, cd_command) self.assertTrue(next_prompt.endswith('$ ')) # Now send the ls command ls_command = 'ls -la ../etc' channel.send(ls_command + '\r\n') while not channel.recv_ready(): gevent.sleep(0) output = '' while not output.endswith('$ '): output += channel.recv(1) lines = output.split('\r\n') command = lines[0] command_output = '\r\n'.join(lines[1:-1]) next_prompt = lines[-1] actual_list = command_output.split('\r\n')[1:] # Ignore the first "total" entry expected_list = ['init.d', 'passwd', 'sysctl.conf', '..', '.'] self.assertEquals(command, ls_command) self.verify_long_list(actual_list, expected_list) self.assertTrue(next_prompt.endswith('$ ')) honeypot.stop() def <API key>(self): """ Test basic 'cd var; ls -ld ../etc' """ honeypot = Hornet(self.working_dir) honeypot.start() self.create_filesystem(honeypot) while honeypot.server.server_port == 0: # wait until the server is ready gevent.sleep(0) port = honeypot.server.server_port client = paramiko.SSHClient() client.<API key>(paramiko.AutoAddPolicy()) # If we log in properly, this should raise no errors client.connect('127.0.0.1', port=port, username='testuser', password='testpassword') channel = client.invoke_shell() while not channel.recv_ready(): gevent.sleep(0) welcome = '' while channel.recv_ready(): welcome += channel.recv(1) lines = welcome.split('\r\n') prompt = lines[-1] self.assertTrue(prompt.endswith('$ ')) cd_command = 'cd var' channel.send(cd_command + '\r\n') while not channel.recv_ready(): gevent.sleep(0) output = '' while not output.endswith('$ '): output += channel.recv(1) lines = output.split('\r\n') command = lines[0] next_prompt = lines[-1] self.assertEquals(command, cd_command) self.assertTrue(next_prompt.endswith('$ ')) # Now send the ls command ls_command = 'ls -ld ../etc' channel.send(ls_command + '\r\n') while not channel.recv_ready(): gevent.sleep(0) output = '' while not output.endswith('$ '): output += channel.recv(1) lines = output.split('\r\n') command = lines[0] command_output = '\r\n'.join(lines[1:-1]) next_prompt = lines[-1] self.assertEquals(command, ls_command) self.assertTrue(command_output.endswith('etc')) self.assertTrue(next_prompt.endswith('$ ')) honeypot.stop() def <API key>(self): """ Test basic 'ls -la etc initrd.img' """ honeypot = Hornet(self.working_dir) honeypot.start() self.create_filesystem(honeypot) while honeypot.server.server_port == 0: # wait until the server is ready gevent.sleep(0) port = honeypot.server.server_port client = paramiko.SSHClient() client.<API key>(paramiko.AutoAddPolicy()) # If we log in properly, this should raise no errors client.connect('127.0.0.1', port=port, username='testuser', password='testpassword') channel = client.invoke_shell() while not channel.recv_ready(): gevent.sleep(0) welcome = '' while channel.recv_ready(): welcome += channel.recv(1) lines = welcome.split('\r\n') prompt = lines[-1] self.assertTrue(prompt.endswith('$ ')) # Now send the ls command ls_command = 'ls -la etc initrd.img' channel.send(ls_command + '\r\n') while not channel.recv_ready(): gevent.sleep(0) output = '' while not output.endswith('$ '): output += channel.recv(1) lines = output.split('\r\n') command = lines[0] command_output = '\r\n'.join(lines[1:-1]) next_prompt = lines[-1] dir_outputs = sorted(command_output.split('\r\n\r\n')) self.assertEquals(command, ls_command) actual_list = dir_outputs[1].split('\r\n')[1:] # Ignore the first "total" entry expected_list = ['.config', 'init.d', 'passwd', 'sysctl.conf', '..', '.'] self.assertTrue(dir_outputs[0].endswith('initrd.img')) self.verify_long_list(actual_list, expected_list) self.assertTrue(next_prompt.endswith('$ ')) honeypot.stop() def <API key>(self): """ Test basic 'ls -lda' """ honeypot = Hornet(self.working_dir) honeypot.start() self.create_filesystem(honeypot) while honeypot.server.server_port == 0: # wait until the server is ready gevent.sleep(0) port = honeypot.server.server_port client = paramiko.SSHClient() client.<API key>(paramiko.AutoAddPolicy()) # If we log in properly, this should raise no errors client.connect('127.0.0.1', port=port, username='testuser', password='testpassword') channel = client.invoke_shell() while not channel.recv_ready(): gevent.sleep(0) welcome = '' while channel.recv_ready(): welcome += channel.recv(1) lines = welcome.split('\r\n') prompt = lines[-1] self.assertTrue(prompt.endswith('$ ')) # Now send the ls command ls_command = 'ls -lda' channel.send(ls_command + '\r\n') while not channel.recv_ready(): gevent.sleep(0) output = '' while not output.endswith('$ '): output += channel.recv(1) lines = output.split('\r\n') command = lines[0] command_output = '\r\n'.join(lines[1:-1]) next_prompt = lines[-1] self.assertEquals(command, ls_command) self.assertTrue(command_output.endswith('.')) self.assertTrue(next_prompt.endswith('$ ')) honeypot.stop() def <API key>(self): """ Test basic 'ls -a etc var' """ honeypot = Hornet(self.working_dir) honeypot.start() self.create_filesystem(honeypot) while honeypot.server.server_port == 0: # wait until the server is ready gevent.sleep(0) port = honeypot.server.server_port client = paramiko.SSHClient() client.<API key>(paramiko.AutoAddPolicy()) # If we log in properly, this should raise no errors client.connect('127.0.0.1', port=port, username='testuser', password='testpassword') channel = client.invoke_shell() while not channel.recv_ready(): gevent.sleep(0) welcome = '' while channel.recv_ready(): welcome += channel.recv(1) lines = welcome.split('\r\n') prompt = lines[-1] self.assertTrue(prompt.endswith('$ ')) # Now send the ls command ls_command = 'ls -a etc var' channel.send(ls_command + '\r\n') while not channel.recv_ready(): gevent.sleep(0) output = '' while not output.endswith('$ '): output += channel.recv(1) lines = output.split('\r\n') command = lines[0] command_output = '\r\n'.join(lines[1:-1]) next_prompt = lines[-1] dir_outputs = sorted(command_output.split('\r\n\r\n')) self.assertEquals(command, ls_command) self.assertTrue('passwd' in dir_outputs[0]) self.assertTrue('.config' in dir_outputs[0]) self.assertTrue('. ' in dir_outputs[0]) self.assertTrue('..' in dir_outputs[0]) self.assertTrue('init.d' in dir_outputs[0]) self.assertTrue('sysctl.conf' in dir_outputs[0]) self.assertTrue("var:" in dir_outputs[1]) self.assertTrue(next_prompt.endswith('$ ')) honeypot.stop() def <API key>(self): """ Test basic 'ls -a etc' """ honeypot = Hornet(self.working_dir) honeypot.start() self.create_filesystem(honeypot) while honeypot.server.server_port == 0: # wait until the server is ready gevent.sleep(0) port = honeypot.server.server_port client = paramiko.SSHClient() client.<API key>(paramiko.AutoAddPolicy()) # If we log in properly, this should raise no errors client.connect('127.0.0.1', port=port, username='testuser', password='testpassword') channel = client.invoke_shell() while not channel.recv_ready(): gevent.sleep(0) welcome = '' while channel.recv_ready(): welcome += channel.recv(1) lines = welcome.split('\r\n') prompt = lines[-1] self.assertTrue(prompt.endswith('$ ')) # Now send the ls command ls_command = 'ls -ad etc' channel.send(ls_command + '\r\n') while not channel.recv_ready(): gevent.sleep(0) output = '' while not output.endswith('$ '): output += channel.recv(1) lines = output.split('\r\n') command = lines[0] command_output = '\r\n'.join(lines[1:-1]) next_prompt = lines[-1] self.assertEquals(command, ls_command) self.assertTrue('etc' in command_output) self.assertFalse('var' in command_output) self.assertTrue(next_prompt.endswith('$ ')) honeypot.stop() def <API key>(self): """ Test basic 'ls -a .hidden' """ honeypot = Hornet(self.working_dir) honeypot.start() self.create_filesystem(honeypot) while honeypot.server.server_port == 0: # wait until the server is ready gevent.sleep(0) port = honeypot.server.server_port client = paramiko.SSHClient() client.<API key>(paramiko.AutoAddPolicy()) # If we log in properly, this should raise no errors client.connect('127.0.0.1', port=port, username='testuser', password='testpassword') channel = client.invoke_shell() while not channel.recv_ready(): gevent.sleep(0) welcome = '' while channel.recv_ready(): welcome += channel.recv(1) lines = welcome.split('\r\n') prompt = lines[-1] self.assertTrue(prompt.endswith('$ ')) # Now send the ls command ls_command = 'ls -a .hidden' channel.send(ls_command + '\r\n') while not channel.recv_ready(): gevent.sleep(0) output = '' while not output.endswith('$ '): output += channel.recv(1) lines = output.split('\r\n') command = lines[0] command_output = '\r\n'.join(lines[1:-1]) next_prompt = lines[-1] self.assertEquals(command, ls_command) self.assertTrue('. ' in command_output) self.assertTrue('..' in command_output) self.assertTrue('.rcconf' in command_output) self.assertTrue(next_prompt.endswith('$ ')) honeypot.stop() def <API key>(self): """ Test basic 'ls -da .hidden' """ honeypot = Hornet(self.working_dir) honeypot.start() self.create_filesystem(honeypot) while honeypot.server.server_port == 0: # wait until the server is ready gevent.sleep(0) port = honeypot.server.server_port client = paramiko.SSHClient() client.<API key>(paramiko.AutoAddPolicy()) # If we log in properly, this should raise no errors client.connect('127.0.0.1', port=port, username='testuser', password='testpassword') channel = client.invoke_shell() while not channel.recv_ready(): gevent.sleep(0) welcome = '' while channel.recv_ready(): welcome += channel.recv(1) lines = welcome.split('\r\n') prompt = lines[-1] self.assertTrue(prompt.endswith('$ ')) # Now send the ls command ls_command = 'ls -ad .hidden' channel.send(ls_command + '\r\n') while not channel.recv_ready(): gevent.sleep(0) output = '' while not output.endswith('$ '): output += channel.recv(1) lines = output.split('\r\n') command = lines[0] command_output = '\r\n'.join(lines[1:-1]) next_prompt = lines[-1] self.assertEquals(command, ls_command) self.assertTrue('.hidden' in command_output) self.assertTrue(next_prompt.endswith('$ ')) honeypot.stop() def <API key>(self): """ Test basic 'ls -a .hidden/.rcconf' """ honeypot = Hornet(self.working_dir) honeypot.start() self.create_filesystem(honeypot) while honeypot.server.server_port == 0: # wait until the server is ready gevent.sleep(0) port = honeypot.server.server_port client = paramiko.SSHClient() client.<API key>(paramiko.AutoAddPolicy()) # If we log in properly, this should raise no errors client.connect('127.0.0.1', port=port, username='testuser', password='testpassword') channel = client.invoke_shell() while not channel.recv_ready(): gevent.sleep(0) welcome = '' while channel.recv_ready(): welcome += channel.recv(1) lines = welcome.split('\r\n') prompt = lines[-1] self.assertTrue(prompt.endswith('$ ')) # Now send the ls command ls_command = 'ls -a .hidden/.rcconf' channel.send(ls_command + '\r\n') while not channel.recv_ready(): gevent.sleep(0) output = '' while not output.endswith('$ '): output += channel.recv(1) lines = output.split('\r\n') command = lines[0] command_output = '\r\n'.join(lines[1:-1]) next_prompt = lines[-1] self.assertEquals(command, ls_command) self.assertTrue('.rcconf' in command_output) self.assertFalse('. ' in command_output) self.assertFalse('..' in command_output) self.assertTrue(next_prompt.endswith('$ ')) honeypot.stop() def verify_long_list(self, actual_list, expected_list): for exp in expected_list: found = False regex = LS_L_REGEX + r'{}'.format(exp) for act in actual_list: if re.match(regex, act): found = True break self.assertTrue(found)
require 'proxy/puppet' module Proxy::Puppet class CustomRun < Runner def run cmd = SETTINGS.customrun_cmd unless File.exists?( cmd ) logger.warn "#{cmd} not found." return false end shell_command( [ escape_for_shell(cmd), SETTINGS.customrun_args, shell_escaped_nodes ] ) end end end
<?php if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); // cn: was breaking JSON calls if(!class_exists('SugarBean')) { } // Do not actually declare, use the functions statically class UserPreference extends SugarBean { var $db; var $field_name_map; // Stored fields var $id; var $date_entered; var $date_modified; var $assigned_user_id; var $assigned_user_name; var $name; var $category; var $contents; var $deleted; var $object_name = 'UserPreference'; var $table_name = 'user_preferences'; var $<API key> = true; var $module_dir = 'UserPreferences'; var $field_defs = array(); var $field_defs_map = array(); var $new_schema = true; // Do not actually declare, use the functions statically function UserPreference() { parent::SugarBean(); } /** * Get preference by name and category. Lazy loads preferences from the database per category * * @global user will use current_user if no user specificed in $user param * @param string $name name of the preference to retreive * @param string $category name of the category to retreive, defaults to global scope * @param user $user User object to retrieve, otherwise user current_user * @return mixed the value of the preference (string, array, int etc) */ function getPreference($name, $category = 'global', $user = null) { global $sugar_config; if(!isset($user)) $user = $GLOBALS['current_user']; // if the unique key in session doesn't match the app or prefereces are empty if(!isset($_SESSION[$user->user_name.'_PREFERENCES'][$category]) || (!empty($_SESSION['unique_key']) && $_SESSION['unique_key'] != $sugar_config['unique_key'])) { UserPreference::loadPreferences($category, $user); } if(isset($_SESSION[$user->user_name.'_PREFERENCES'][$category][$name])) { return $_SESSION[$user->user_name.'_PREFERENCES'][$category][$name]; } return null; } /** * Set preference by name and category. Saving will be done in utils.php -> sugar_cleanup * * @global user will use current_user if no user specificed in $user param * @param string $name name of the preference to retreive * @param mixed $value value of the preference to set * @param int @nosession no longer supported * @param string $category name of the category to retreive, defaults to global scope * @param user $user User object to retrieve, otherwise user current_user * */ function setPreference($name, $value, $nosession = 0, $category = 'global', $user = null) { if(!isset($user)) $user = $GLOBALS['current_user']; if(!isset($_SESSION[$user->user_name.'_PREFERENCES'][$category])) { if(!$user->loadPreferences($category, $user)) $_SESSION[$user->user_name.'_PREFERENCES'][$category] = array(); } // preferences changed or a new preference, save it to DB if(!isset($_SESSION[$user->user_name.'_PREFERENCES'][$category][$name]) || (isset($_SESSION[$user->user_name.'_PREFERENCES'][$category][$name]) && $_SESSION[$user->user_name.'_PREFERENCES'][$category][$name] != $value)) { $GLOBALS['savePreferencesToDB'] = true; if(!isset($GLOBALS['<API key>'])) $GLOBALS['<API key>'] = array(); $GLOBALS['<API key>'][$category] = true; } $_SESSION[$user->user_name.'_PREFERENCES'][$category][$name] = $value; } /** * Loads preference by category from database. Saving will be done in utils.php -> sugar_cleanup * * @global user will use current_user if no user specificed in $user param * @param string $category name of the category to retreive, defaults to global scope * @param user $user User object to retrieve, otherwise user current_user * @return bool successful? * */ function loadPreferences($category = 'global', $user = null) { global $sugar_config; if(!isset($user)) $user = $GLOBALS['current_user']; if($user->object_name != 'User') return; if(!empty($user->id) && (!isset($_SESSION[$user->user_name . '_PREFERENCES'][$category]) || (!empty($_SESSION['unique_key']) && $_SESSION['unique_key'] != $sugar_config['unique_key']))) { // cn: moving this to only log when valid - throwing errors on install $GLOBALS['log']->debug('Loading Preferences DB ' . $user->user_name); if(!isset($_SESSION[$user->user_name . '_PREFERENCES'])) $_SESSION[$user->user_name . '_PREFERENCES'] = array(); if(!isset($user->user_preferences) || !is_array($user->user_preferences)) $user->user_preferences = array(); $result = $GLOBALS['db']->query("SELECT contents FROM user_preferences WHERE assigned_user_id='$user->id' AND category = '" . $category . "' AND deleted = 0", false, 'Failed to load user preferences'); $row = $GLOBALS['db']->fetchByAssoc($result); if ($row) { $_SESSION[$user->user_name . '_PREFERENCES'][$category] = unserialize(base64_decode($row['contents'])); $user->user_preferences[$category] = unserialize(base64_decode($row['contents'])); return true; } } return false; } /** * Loads users timedate preferences * * @global user will use current_user if no user specificed in $user param * @param string $category name of the category to retreive, defaults to global scope * @param user $user User object to retrieve, otherwise user current_user * @return array 'date' - date format for user ; 'time' - time format for user * */ function <API key>($user = null) { global $sugar_config, $db, $timezones, $timedate, $current_user; if(!isset($user)) $user = $GLOBALS['current_user']; $prefDate = array(); if(!empty($user) && UserPreference::loadPreferences('global', $user)) { // forced to set this to a variable to compare b/c empty() wasn't working $timeZone = $user->getPreference("timezone"); $timeFormat = $user->getPreference("timef"); $dateFormat = $user->getPreference("datef"); // cn: bug xxxx cron.php fails because of missing preference when admin hasn't logged in yet $timeZone = empty($timeZone) ? 'America/Los_Angeles' : $timeZone; if(empty($timeZone)) $timeZone = ''; if(empty($timeFormat)) $timeFormat = $sugar_config['default_time_format']; if(empty($dateFormat)) $dateFormat = $sugar_config['default_date_format']; $equinox = date('I'); $serverHourGmt = date('Z') / 60 / 60; $<API key> = $user->getPreference("timez"); $userHourGmt = $serverHourGmt + $<API key>; $prefDate['date'] = $dateFormat; $prefDate['time'] = $timeFormat; $prefDate['userGmt'] = "(GMT".($timezones[$timeZone]['gmtOffset'] / 60).")"; $prefDate['userGmtOffset'] = $timezones[$timeZone]['gmtOffset'] / 60; return $prefDate; } else { $prefDate['date'] = $timedate->get_date_format(); $prefDate['time'] = $timedate->get_time_format(); if(!empty($user) && $user->object_name == 'User') { $timeZone = $user->getPreference("timezone"); // cn: bug 9171 - if user has no time zone, cron.php fails for InboundEmail if(!empty($timeZone)) { $prefDate['userGmt'] = "(GMT".($timezones[$timeZone]['gmtOffset'] / 60).")"; $prefDate['userGmtOffset'] = $timezones[$timeZone]['gmtOffset'] / 60; } } else { $timeZone = $current_user->getPreference("timezone"); if(!empty($timeZone)) { $prefDate['userGmt'] = "(GMT".($timezones[$timeZone]['gmtOffset'] / 60).")"; $prefDate['userGmtOffset'] = $timezones[$timeZone]['gmtOffset'] / 60; } } return $prefDate; } } /** * Saves all preferences into the database that are in the session. Expensive, this is called by default in * sugar_cleanup if a setPreference has been called during one round trip. * * @global user will use current_user if no user specificed in $user param * @param user $user User object to retrieve, otherwise user current_user * @param bool $all save all of the preferences? (Dangerous) * */ function savePreferencesToDB($user = null, $all = false) { global $sugar_config; $GLOBALS['savePreferencesToDB'] = false; global $db; if(!isset($user)) { if(!empty($GLOBALS['current_user'])) { $user = $GLOBALS['current_user']; } else { $GLOBALS['log']->fatal('No User Defined: UserPreferences::savePreferencesToDB'); return; // no user defined, sad panda } } // these are not the preferences you are looking for [ hand waving ] if(!empty($_SESSION['unique_key']) && $_SESSION['unique_key'] != $sugar_config['unique_key']) return; $GLOBALS['log']->debug('Saving Preferences to DB ' . $user->user_name); if(isset($_SESSION[$user->user_name. '_PREFERENCES']) && is_array($_SESSION[$user->user_name. '_PREFERENCES'])) { $GLOBALS['log']->debug("Saving Preferences to DB: {$user->user_name}"); // only save the categories that have been modified or all? if(!$all && isset($GLOBALS['<API key>']) && is_array($GLOBALS['<API key>'])) { $catsToSave = array(); foreach($GLOBALS['<API key>'] as $category => $value) { if ( isset($_SESSION[$user->user_name. '_PREFERENCES'][$category]) ) $catsToSave[$category] = $_SESSION[$user->user_name. '_PREFERENCES'][$category]; } } else { $catsToSave = $_SESSION[$user->user_name. '_PREFERENCES']; } $focus = new UserPreference(); foreach($catsToSave as $category => $contents) { unset($focus->id); $query = "SELECT id, contents FROM user_preferences WHERE deleted = 0 AND assigned_user_id = '" . $user->id . "' AND category = '" . $category . "'"; $result = $db->query($query); $row = $db->fetchByAssoc($result); if(!empty($row['id'])) { // update $focus->assigned_user_id = $user->id; // MFH Bug #13862 $focus->retrieve($row['id'], true, false); $focus->deleted = 0; $focus->contents = base64_encode(serialize($contents)); } else { // insert new $focus->assigned_user_id = $user->id; $focus->contents = base64_encode(serialize($contents)); $focus->category = $category; } $focus->save(); } } } /** * Resets preferences for a particular user. If $category is null all user preferences will be reset * * @global user will use current_user if no user specificed in $user param * @param string $category category to reset * @param user $user User object to retrieve, otherwise user current_user * */ function resetPreferences($category = null, $user = null) { global $db; if(!isset($user)) $user = $GLOBALS['current_user']; $GLOBALS['log']->debug('Reseting Preferences for user ' . $user->user_name); $remove_tabs = $this->getPreference('remove_tabs'); $favorite_reports = $this->getPreference('favorites', 'Reports'); $home_pages = $this->getPreference('pages', 'home'); $home_dashlets = $this->getPreference('dashlets', 'home'); $query = "UPDATE user_preferences SET deleted = 1 WHERE assigned_user_id = '" . $user->id . "'"; if($category) $query .= " AND category = '" . $category . "'"; $db->query($query); if($user->id == $GLOBALS['current_user']->id) { if($category) { unset($_SESSION[$this->user_name."_PREFERENCES"][$category]); } else { unset($_SESSION[$this->user_name."_PREFERENCES"]); session_destroy(); $this->setPreference('remove_tabs', $remove_tabs, 1); $this->setPreference('favorites', $favorite_reports, 0, 'Reports'); $this->setPreference('pages', $home_pages, 0, 'home'); $this->setPreference('dashlets', $home_dashlets, 0, 'home'); header('Location: index.php'); } } } } ?>
package org.digitalcampus.oppia.model; import java.io.Serializable; import java.util.ArrayList; import java.util.Iterator; import org.digitalcampus.mobile.learningGF.R; import org.digitalcampus.oppia.utils.ImageUtils; import org.joda.time.DateTime; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.content.res.Resources; import android.graphics.drawable.BitmapDrawable; public class Activity implements Serializable{ private static final long serialVersionUID = -<API key>; public static final String TAG = Activity.class.getSimpleName(); private long modId; private int sectionId; private int actId; private String actType; private ArrayList<Lang> titles = new ArrayList<Lang>(); private ArrayList<Lang> locations = new ArrayList<Lang>(); private ArrayList<Lang> contents = new ArrayList<Lang>(); private String digest; private String imageFile; private ArrayList<Media> media = new ArrayList<Media>(); private boolean completed = false; private boolean attempted = false; private boolean customImage = false; private DateTime startDate; private DateTime endDate; private String mimeType; private ArrayList<Lang> descriptions = new ArrayList<Lang>(); public Activity(){ } public boolean hasCustomImage(){ return this.customImage; } public BitmapDrawable getImageFile(String prefix, Resources res) { int defaultImage = R.drawable.<API key>; if(actType.equals("quiz")){ defaultImage = R.drawable.default_icon_quiz; } else if (actType.equals("page") && this.hasMedia()){ defaultImage = R.drawable.default_icon_video; } if(!prefix.endsWith("/")){ prefix += "/"; } return ImageUtils.LoadBMPsdcard(prefix + this.imageFile, res, defaultImage); } public void setImageFile(String imageFile) { this.imageFile = imageFile; this.customImage = true; } public ArrayList<Media> getMedia() { return media; } public void setMedia(ArrayList<Media> media) { this.media = media; } public String getDigest() { return digest; } public void setDigest(String digest) { this.digest = digest; } public long getModId() { return modId; } public void setModId(long modId) { this.modId = modId; } public int getSectionId() { return sectionId; } public void setSectionId(int sectionId) { this.sectionId = sectionId; } public int getActId() { return actId; } public void setActId(int actId) { this.actId = actId; } public String getActType() { return actType; } public void setActType(String actType) { this.actType = actType; } public String getTitleJSONString(){ JSONArray array = new JSONArray(); for(Lang l: titles){ JSONObject obj = new JSONObject(); try { obj.put(l.getLang(), l.getContent()); } catch (JSONException e) { e.printStackTrace(); } array.put(obj); } return array.toString(); } public String getTitle(String lang) { for(Lang l: titles){ if(l.getLang().equals(lang)){ return l.getContent(); } } if(titles.size() > 0){ return titles.get(0).getContent(); } return "No title set"; } public void <API key>(String json){ try { JSONArray titlesArray = new JSONArray(json); for(int i=0; i<titlesArray.length(); i++){ JSONObject titleObj = titlesArray.getJSONObject(i); @SuppressWarnings("unchecked") Iterator<String> iter = (Iterator<String>) titleObj.keys(); while(iter.hasNext()){ String key = iter.next().toString(); String title = titleObj.getString(key); Lang l = new Lang(key,title); this.titles.add(l); } } } catch (JSONException e) { e.printStackTrace(); } } public void setTitles(ArrayList<Lang> titles) { this.titles = titles; } public String getLocation(String lang) { for(Lang l: locations){ if(l.getLang().equals(lang)){ return l.getContent(); } } if(locations.size() > 0){ return locations.get(0).getContent(); } return "No location set"; } public void setLocations(ArrayList<Lang> locations) { this.locations = locations; } public String getContents(String lang) { for(Lang l: contents){ if(l.getLang().equals(lang)){ return l.getContent(); } } if(contents.size() > 0){ return contents.get(0).getContent(); } return "No content set"; } public void setContents(ArrayList<Lang> contents) { this.contents = contents; } public boolean hasMedia(){ if(media.size() == 0){ return false; } else { return true; } } public void setCompleted(boolean completed){ this.completed = completed; } public boolean getCompleted(){ return this.completed; } public DateTime getStartDate() { return startDate; } public void setStartDate(DateTime startDate) { this.startDate = startDate; } public DateTime getEndDate() { return endDate; } public void setEndDate(DateTime endDate) { this.endDate = endDate; } public String getMimeType() { return mimeType; } public void setMimeType(String mimeType) { this.mimeType = mimeType; } public String getDescription(String lang) { for(Lang l: descriptions){ if(l.getLang().equals(lang)){ return l.getContent(); } } if(descriptions.size() > 0){ return descriptions.get(0).getContent(); } return "No description set"; } public void setDescriptions(ArrayList<Lang> descriptions) { this.descriptions = descriptions; } public boolean isAttempted() { return attempted; } public void setAttempted(boolean attempted) { this.attempted = attempted; } }
#!/usr/bin/env python # -*- coding: utf-8 -*- # from __future__ import unicode_literals # This file is only used if you use `make publish` or # explicitly specify it as your config file. import os import sys sys.path.append(os.curdir) from pelicanconf import * SITEURL = 'http://thbs600.neill.id.au' RELATIVE_URLS = False FEED_ALL_ATOM = 'feeds/all.atom.xml' CATEGORY_FEED_ATOM = 'feeds/%s.atom.xml' <API key> = True # Following items are often useful when publishing #DISQUS_SITENAME = "" #GOOGLE_ANALYTICS = ""
<!DOCTYPE HTML PUBLIC "- <!--NewPage <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_14) on Mon Aug 03 23:26:22 CEST 2009 --> <TITLE> Uses of Class net.sourceforge.jiu.gui.awt.dialogs.InfoDialog (JIU API documentation) </TITLE> <META NAME="date" CONTENT="2009-08-03"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class net.sourceforge.jiu.gui.awt.dialogs.InfoDialog (JIU API documentation)"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <A NAME="navbar_top"></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../net/sourceforge/jiu/gui/awt/dialogs/InfoDialog.html" title="class in net.sourceforge.jiu.gui.awt.dialogs"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../index-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> <a target="_top" href="http://jiu.sourceforce.net/">JIU 0.14.3</a></EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../../../index.html?net/sourceforge/jiu/gui/awt/dialogs/\class-useInfoDialog.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="InfoDialog.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <! if(window==top) { document.writeln('<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } </SCRIPT> <NOSCRIPT> <A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <HR> <CENTER> <H2> <B>Uses of Class<br>net.sourceforge.jiu.gui.awt.dialogs.InfoDialog</B></H2> </CENTER> No usage of net.sourceforge.jiu.gui.awt.dialogs.InfoDialog <P> <HR> <A NAME="navbar_bottom"></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="<API key>"></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="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../net/sourceforge/jiu/gui/awt/dialogs/InfoDialog.html" title="class in net.sourceforge.jiu.gui.awt.dialogs"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../index-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> <a target="_top" href="http://jiu.sourceforce.net/">JIU 0.14.3</a></EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../../../index.html?net/sourceforge/jiu/gui/awt/dialogs/\class-useInfoDialog.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="InfoDialog.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <! if(window==top) { document.writeln('<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } </SCRIPT> <NOSCRIPT> <A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <HR> Copyright &copy; 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Marco Schmidt </BODY> </HTML>
#include <config.h> #include "memcasecmp.h" #include <string.h> #include "zerosize-ptr.h" #include "macros.h" int main (void) { /* Test equal / not equal distinction. */ ASSERT (memcasecmp (zerosize_ptr (), zerosize_ptr (), 0) == 0); ASSERT (memcasecmp ("foo", "foobar", 2) == 0); ASSERT (memcasecmp ("foo", "foobar", 3) == 0); ASSERT (memcasecmp ("foo", "foobar", 4) != 0); ASSERT (memcasecmp ("foo", "bar", 1) != 0); ASSERT (memcasecmp ("foo", "bar", 3) != 0); /* Test less / equal / greater distinction. */ ASSERT (memcasecmp ("foo", "moo", 4) < 0); ASSERT (memcasecmp ("moo", "foo", 4) > 0); ASSERT (memcasecmp ("oomph", "oops", 3) < 0); ASSERT (memcasecmp ("oops", "oomph", 3) > 0); ASSERT (memcasecmp ("foo", "foobar", 4) < 0); ASSERT (memcasecmp ("foobar", "foo", 4) > 0); /* Test embedded NULs. */ ASSERT (memcasecmp ("1\0", "2\0", 2) < 0); ASSERT (memcasecmp ("2\0", "1\0", 2) > 0); ASSERT (memcasecmp ("x\0""1", "x\0""2", 3) < 0); ASSERT (memcasecmp ("x\0""2", "x\0""1", 3) > 0); /* The Next x86 OpenStep bug shows up only when comparing 16 bytes or more and with at least one buffer not starting on a 4-byte boundary. William Lewis provided this test program. */ { char foo[21]; char bar[21]; int i; for (i = 0; i < 4; i++) { char *a = foo + i; char *b = bar + i; strcpy (a, " strcpy (b, " ASSERT (memcasecmp (a, b, 16) < 0); } } return 0; }
#pragma once /** * Configuration_adv.h * * Advanced settings. * Only change these if you know exactly what you're doing. * Some of these settings can damage your printer if improperly set! * * Basic settings can be found in Configuration.h * */ #define <API key> 020000 // @section temperature // Custom Thermistor 1000 parameters #if TEMP_SENSOR_0 == 1000 #define <API key> 4700 // Pullup resistor #define <API key> 100000 // Resistance at 25C #define HOTEND0_BETA 3950 // Beta value #endif #if TEMP_SENSOR_1 == 1000 #define <API key> 4700 // Pullup resistor #define <API key> 100000 // Resistance at 25C #define HOTEND1_BETA 3950 // Beta value #endif #if TEMP_SENSOR_2 == 1000 #define <API key> 4700 // Pullup resistor #define <API key> 100000 // Resistance at 25C #define HOTEND2_BETA 3950 // Beta value #endif #if TEMP_SENSOR_3 == 1000 #define <API key> 4700 // Pullup resistor #define <API key> 100000 // Resistance at 25C #define HOTEND3_BETA 3950 // Beta value #endif #if TEMP_SENSOR_4 == 1000 #define <API key> 4700 // Pullup resistor #define <API key> 100000 // Resistance at 25C #define HOTEND4_BETA 3950 // Beta value #endif #if TEMP_SENSOR_5 == 1000 #define <API key> 4700 // Pullup resistor #define <API key> 100000 // Resistance at 25C #define HOTEND5_BETA 3950 // Beta value #endif #if TEMP_SENSOR_BED == 1000 #define <API key> 4700 // Pullup resistor #define <API key> 100000 // Resistance at 25C #define BED_BETA 3950 // Beta value #endif #if TEMP_SENSOR_CHAMBER == 1000 #define <API key> 4700 // Pullup resistor #define <API key> 100000 // Resistance at 25C #define CHAMBER_BETA 3950 // Beta value #endif // Hephestos 2 24V heated bed upgrade kit. //#define <API key> #if ENABLED(<API key>) #undef TEMP_SENSOR_BED #define TEMP_SENSOR_BED 70 #define <API key> true #endif /** * Heated Chamber settings */ #if TEMP_SENSOR_CHAMBER #define CHAMBER_MINTEMP 5 #define CHAMBER_MAXTEMP 60 #define <API key> 1 //#define <API key> //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin //#define <API key> false #endif #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) #define BED_HYSTERESIS 2 // Only disable heating if T>target+BED_HYSTERESIS and enable heating if T><API key> #endif #endif /** * Thermal Protection provides additional protection to your printer from damage * and fire. Marlin always includes safe min and max temperature ranges which * protect against a broken or disconnected thermistor wire. * * The issue: If a thermistor falls out, it will report the much lower * temperature of the air in the room, and the the firmware will keep * the heater on. * * The solution: Once the temperature reaches the target, start observing. * If the temperature stays too far below the target (hysteresis) for too * long (period), the firmware will halt the machine as a safety precaution. * * If you get false positives for "Thermal Runaway", increase * <API key> and/or <API key> */ #if ENABLED(<API key>) #define <API key> 40 // Seconds #define <API key> 4 // Degrees Celsius //#define <API key> // Slow part cooling fan if temperature drops #if BOTH(<API key>, PIDTEMP) //#define <API key> // Don't slow fan speed during M303 #endif /** * Whenever an M104, M109, or M303 increases the target temperature, the * firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature * hasn't increased by WATCH_TEMP_INCREASE degrees, the machine is halted and * requires a hard reset. This test restarts with any M104/M109/M303, but only * if the current temperature is far enough below the target for a reliable * test. * * If you get false positives for "Heating failed", increase WATCH_TEMP_PERIOD * and/or decrease WATCH_TEMP_INCREASE. WATCH_TEMP_INCREASE should not be set * below 2. */ #define WATCH_TEMP_PERIOD 20 // Seconds #define WATCH_TEMP_INCREASE 2 // Degrees Celsius #endif /** * Thermal Protection parameters for the bed are just as above for hotends. */ #if ENABLED(<API key>) #define <API key> 20 // Seconds #define <API key> 2 // Degrees Celsius /** * As described above, except for the bed (M140/M190/M303). */ #define <API key> 60 // Seconds #define <API key> 2 // Degrees Celsius #endif /** * Thermal Protection parameters for the heated chamber. */ #if ENABLED(<API key>) #define <API key> 20 // Seconds #define <API key> 2 // Degrees Celsius /** * Heated chamber watch settings (M141/M191). */ #define <API key> 60 // Seconds #define <API key> 2 // Degrees Celsius #endif #if ENABLED(PIDTEMP) // Add an experimental additional term to the heater power, proportional to the extrusion speed. // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define <API key> #if ENABLED(<API key>) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) #define LPQ_MAX_LEN 50 #endif #endif /** * Automatic Temperature: * The hotend target temperature is calculated by all the buffered lines of gcode. * The maximum buffered steps/sec of the extruder motor is called "se". * Start autotemp mode with M109 S<mintemp> B<maxtemp> F<factor> * The target temperature is set to mintemp+factor*se[steps/sec] and is limited by * mintemp and maxtemp. Turn this off by executing M109 without F* * Also, if the temperature is set to a value below mintemp, it will not be changed by autotemp. * On an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode */ #define AUTOTEMP #if ENABLED(AUTOTEMP) #define AUTOTEMP_OLDWEIGHT 0.98 #endif // Show extra position information in M114 #define M114_DETAIL // Show Temperature ADC value // Enable for M105 to include ADC values read from temperature sensors. //#define <API key> /** * High Temperature Thermistor Support * * Thermistors able to support high temperature tend to have a hard time getting * good readings at room and lower temperatures. This means <API key> * will probably be caught when the heating element first turns on during the * preheating process, which will trigger a min_temp_error as a safety measure * and force stop everything. * To circumvent this limitation, we allow for a preheat time (during which, * min_temp_error won't be triggered) and add a min_temp buffer to handle * aberrant readings. * * If you want to enable this feature for your hotend thermistor(s) * uncomment and set values > 0 in the constants below */ // The number of consecutive low temperature errors that can occur // before a min_temp_error is triggered. (Shouldn't be more than 10.) //#define <API key> 0 // The number of milliseconds a hotend will preheat before starting to check // the temperature. This value should NOT be set to the time it takes the // hot end to reach the target temperature, but the time it takes to reach // the minimum temperature your thermistor can read. The lower the better/safer. // This shouldn't need to be more than 30 seconds (30000) //#define <API key> 0 // @section extruder // Extruder runout prevention. // If the machine is idle and the temperature over MINTEMP // then extrude some filament every couple of SECONDS. //#define <API key> #if ENABLED(<API key>) #define <API key> 190 #define <API key> 30 #define <API key> 1500 // (mm/m) #define <API key> 5 #endif // @section temperature // Calibration for AD595 / AD8495 sensor to adjust temperature measurements. // The final temperature is calculated as (measuredTemp * GAIN) + OFFSET. #define <API key> 0.0 #define <API key> 1.0 #define <API key> 0.0 #define <API key> 1.0 /** * Controller Fan * To cool down the stepper drivers and MOSFETs. * * The fan will turn on automatically whenever any stepper is enabled * and turn off after a set period after all steppers are turned off. */ //#define USE_CONTROLLER_FAN #if ENABLED(USE_CONTROLLER_FAN) //#define CONTROLLER_FAN_PIN -1 // Set a custom pin for the controller fan #define CONTROLLERFAN_SECS 60 // Duration in seconds for the fan to run after all motors are disabled #define CONTROLLERFAN_SPEED 255 // 255 == full speed #endif // When first starting the main fan, run it at full speed for the // given number of milliseconds. This gets the fan spinning reliably // before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu) //#define FAN_KICKSTART_TIME 100 /** * PWM Fan Scaling * * Define the min/max speeds for PWM fans (as set with M106). * * With these options the M106 0-255 value range is scaled to a subset * to ensure that the fan has enough power to spin, or to run lower * current fans with higher current. (e.g., 5V/12V fans with 12V/24V) * Value 0 always turns off the fan. * * Define one or both of these to override the default 0-255 range. */ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 /** * FAST PWM FAN Settings * * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a * frequency as close as possible to the desired frequency. * * <API key> [undefined by default] * Set this to your desired frequency. * If left undefined this defaults to F = F_CPU/(2*255*1) * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behavior. * * USE_OCR2A_AS_TOP [undefined by default] * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. */ #if ENABLED(FAST_PWM_FAN) //#define <API key> 31400 //#define USE_OCR2A_AS_TOP #endif // @section extruder /** * Extruder cooling fans * * Extruder auto fans automatically turn on when their extruders' * temperatures go above <API key>. * * Your board's pins file specifies the recommended pins. Override those here * or set to -1 to disable completely. * * Multiple extruders can be assigned to the same pin in which case * the fan will turn on when any selected extruder is above the threshold. */ #define E0_AUTO_FAN_PIN -1 #define E1_AUTO_FAN_PIN -1 #define E2_AUTO_FAN_PIN -1 #define E3_AUTO_FAN_PIN -1 #define E4_AUTO_FAN_PIN -1 #define E5_AUTO_FAN_PIN -1 #define <API key> -1 #define <API key> 50 #define <API key> 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer * * This feature allows you to digitally multiplex the fan output. * The multiplexer is automatically switched at tool-change. * Set FANMUX[012]_PINs below for up to 2, 4, or 8 multiplexed fans. */ #define FANMUX0_PIN -1 #define FANMUX1_PIN -1 #define FANMUX2_PIN -1 /** * M355 Case Light on-off / brightness */ //#define CASE_LIGHT_ENABLE #if ENABLED(CASE_LIGHT_ENABLE) //#define CASE_LIGHT_PIN 4 // Override the default pin if needed #define INVERT_CASE_LIGHT false // Set true if Case Light is ON when pin is LOW #define <API key> true // Set default power-up state on #define <API key> 105 // Set default power-up brightness (0-255, requires PWM pin) //#define <API key> // Add a Case Light option to the LCD main menu //#define <API key> // Use Neopixel LED as case light, requires NEOPIXEL_LED. #if ENABLED(<API key>) #define <API key> { 255, 255, 255, 255 } // { Red, Green, Blue, White } #endif #endif // @section homing // If you want endstops to stay on (by default) even when not homing // enable this option. Override at any time with M120, M121. //#define <API key> // @section extras //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats. // Employ an external closed loop controller. Override pins here if needed. //#define <API key> #if ENABLED(<API key>) //#define <API key> -1 //#define <API key> -1 #endif /** * Dual Steppers / Dual Endstops * * This section will allow you to use extra E drivers to drive a second motor for X, Y, or Z axes. * * For example, set <API key> setting to use a second motor. If the motors need to * spin in opposite directions set INVERT_X2_VS_X_DIR. If the second motor needs its own endstop * set X_DUAL_ENDSTOPS. This can adjust for "racking." Use X2_USE_ENDSTOP to set the endstop plug * that should be used for the second endstop. Extra endstops will appear in the output of 'M119'. * * Use <API key> to adjust for mechanical imperfection. After homing both motors * this offset is applied to the X2 motor. To find the offset home the X axis, and measure the error * in X2. Dual endstop offsets can be set at runtime with 'M666 X<offset> Y<offset> Z<offset>'. */ //#define <API key> #if ENABLED(<API key>) #define INVERT_X2_VS_X_DIR true // Set 'true' if X motors should rotate in opposite directions //#define X_DUAL_ENDSTOPS #if ENABLED(X_DUAL_ENDSTOPS) #define X2_USE_ENDSTOP _XMAX_ #define <API key> 0 #endif #endif //#define <API key> #if ENABLED(<API key>) #define INVERT_Y2_VS_Y_DIR true // Set 'true' if Y motors should rotate in opposite directions //#define Y_DUAL_ENDSTOPS #if ENABLED(Y_DUAL_ENDSTOPS) #define Y2_USE_ENDSTOP _YMAX_ #define <API key> 0 #endif #endif //#define <API key> #if ENABLED(<API key>) //#define Z_DUAL_ENDSTOPS #if ENABLED(Z_DUAL_ENDSTOPS) #define Z2_USE_ENDSTOP _XMAX_ #define <API key> 0 #endif #endif //#define <API key> #if ENABLED(<API key>) //#define Z_TRIPLE_ENDSTOPS #if ENABLED(Z_TRIPLE_ENDSTOPS) #define Z2_USE_ENDSTOP _XMAX_ #define Z3_USE_ENDSTOP _YMAX_ #define <API key> 0 #define <API key> 0 #endif #endif /** * Dual X Carriage * * This setup has two X carriages that can move independently, each with its own hotend. * The carriages can be used to print an object with two colors or materials, or in * "duplication mode" it can print two identical or X-mirrored objects simultaneously. * The inactive carriage is parked automatically to prevent oozing. * X1 is the left carriage, X2 the right. They park and home at opposite ends of the X axis. * By default the X2 stepper is assigned to the first unused E plug on the board. * * The following Dual X Carriage modes can be selected with M605 S<mode>: * * 0 : (FULL_CONTROL) The slicer has full control over both X-carriages and can achieve optimal travel * results as long as it supports dual X-carriages. (M605 S0) * * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so * that additional slicer support is not required. (M605 S1) * * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with * the first X-carriage and extruder, to print 2 copies of the same object at the same time. * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and * follow with M605 S2 to initiate duplicated movement. * * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates * the movement of the first except the second extruder is reversed in the X axis. * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and * follow with M605 S3 to initiate mirrored movement. */ //#define DUAL_X_CARRIAGE #if ENABLED(DUAL_X_CARRIAGE) #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. // However: In this mode the HOTEND_OFFSET_X value for the second extruder provides a software // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops // without modifying the firmware (through the "M218 T1 X???" command). // Remember: you should set the second extruder x-offset to 0 in your slicer. // This is the default power-up mode which can be later using M605. #define <API key> DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define <API key> 100 #endif // DUAL_X_CARRIAGE // Activate a solenoid on the active extruder with M380. Disable all with M381. // Define SOL0_PIN, SOL1_PIN, etc., for each extruder that has a solenoid. //#define EXT_SOLENOID // @section homing // Homing hits each endstop, retracts by these distances, then does a slower bump. #define X_HOME_BUMP_MM 5 #define Y_HOME_BUMP_MM 5 #define Z_HOME_BUMP_MM 2 #define HOMING_BUMP_DIVISOR { 2, 2, 4 } // Re-Bump Speed Divisor (Divides the Homing Feedrate) #define QUICK_HOME // If homing includes X and Y, do a diagonal move initially //#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X // Enable this if X or Y can't home without homing the other axis first. //#define <API key> /** * Z Steppers Auto-Alignment * Add the G34 command to align multiple Z steppers using a bed probe. */ //#define <API key> #if ENABLED(<API key>) // Define probe X and Y positions for Z1, Z2 [, Z3] #define Z_STEPPER_ALIGN_X { 10, 150, 290 } #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } // Set number of iterations to align #define <API key> 3 // Enable to restore leveling setup after operation #define <API key> // Use the amplification factor to de-/increase correction step. // In case the stepper (spindle) position is further out than the test point // Use a value > 1. NOTE: This may cause instability #define Z_STEPPER_ALIGN_AMP 1.0 // Stop criterion. If the accuracy is better than this stop iterating early #define Z_STEPPER_ALIGN_ACC 0.02 #endif // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} // Add a Duplicate option for well-separated conjoined nozzles //#define <API key> // By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step. #define INVERT_X_STEP_PIN false #define INVERT_Y_STEP_PIN false #define INVERT_Z_STEP_PIN false #define INVERT_E_STEP_PIN false // Default stepper release if idle. Set to 0 to deactivate. // Steppers will shut down <API key> seconds after the last move when DISABLE_INACTIVE_? is true. // Time can be set by M18 and M84. #define <API key> 120 #define DISABLE_INACTIVE_X true #define DISABLE_INACTIVE_Y true #define DISABLE_INACTIVE_Z true // set to false if the nozzle will fall down on your printed part when print has finished. #define DISABLE_INACTIVE_E true #define <API key> 0.0 // minimum feedrate #define <API key> 0.0 //#define <API key> // Require rehoming after steppers are deactivated // @section lcd #if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel #endif #if ENABLED(ULTIPANEL) #define <API key> // Show LCD extruder moves as relative rather than absolute positions #define <API key> // Comment to disable setting feedrate multiplier via encoder #endif // @section extras // minimum time in microseconds that a movement needs to take if the buffer is emptied. #define <API key> 20000 // If defined the movements slow down when the look ahead buffer is only half full #define SLOWDOWN // Frequency limit // See nophead's blog for more info // Not working O //#define XY_FREQUENCY_LIMIT 15 // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. #define <API key> 0.05 // (mm/s) // Backlash Compensation // Adds extra movement to axes on direction-changes to account for backlash. //#define <API key> #if ENABLED(<API key>) // Define values for backlash distance and correction. // If BACKLASH_GCODE is enabled these values are the defaults. #define <API key> { 0, 0, 0 } #define BACKLASH_CORRECTION 0.0 // 0.0 = no correction; 1.0 = full correction // Set <API key> to spread backlash correction over multiple segments // to reduce print artifacts. (Enabling this is costly in memory and computation!) //#define <API key> 3 // (mm) // Add runtime configuration and tuning of backlash values (M425) //#define BACKLASH_GCODE #if ENABLED(BACKLASH_GCODE) // Measure the Z backlash when probing (G29) and set with "M425 Z" #define <API key> #if ENABLED(<API key>) // When measuring, the probe will move up to <API key> // mm away from point of contact in <API key> // increments while checking for the contact to be broken. #define <API key> 0.5 #define <API key> 0.005 #define <API key> Z_PROBE_SPEED_SLOW // (mm/m) #endif #endif #endif //#define CALIBRATION_GCODE #if ENABLED(CALIBRATION_GCODE) #define <API key> 0.01 #define <API key> 60 // mm/m #define <API key> 1200 // mm/m #define <API key> 3000 // mm/m // The following parameters refer to the conical section of the nozzle tip. #define <API key> 1.0 #define <API key> 2.0 // Uncomment to enable reporting (required for "G425 V", but consumes PROGMEM). //#define <API key> // The true location and dimension the cube/bolt/washer on the bed. #define <API key> { 264.0, -22.0, -2.0} #define <API key> { 10.0, 10.0, 10.0} // Comment out any sides which are unreachable by the probe. For best // auto-calibration results, all sides must be reachable. #define <API key> #define <API key> #define <API key> #define <API key> // Probing at the exact top center only works if the center is flat. If // probing on a screwhead or hollow washer, probe near the edges. //#define <API key> // Define pin which is read during calibration #ifndef CALIBRATION_PIN #define CALIBRATION_PIN -1 // Override in pins.h or set to -1 to use your Z endstop #define <API key> false // set to true to invert the pin //#define <API key> #define <API key> #endif #endif /** * Adaptive Step Smoothing increases the resolution of multi-axis moves, particularly at step frequencies * below 1kHz (for AVR) or 10kHz (for ARM), where aliasing between axes in multi-axis moves causes audible * vibration and surface artifacts. The algorithm adapts to provide the best possible step smoothing at the * lowest stepping frequencies. */ //#define <API key> /** * Custom Microstepping * Override as-needed for your setup. Up to 3 MS pins are supported. */ //#define MICROSTEP1 LOW,LOW,LOW //#define MICROSTEP2 HIGH,LOW,LOW //#define MICROSTEP4 LOW,HIGH,LOW //#define MICROSTEP8 HIGH,HIGH,LOW //#define MICROSTEP16 LOW,LOW,HIGH //#define MICROSTEP32 HIGH,LOW,HIGH // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] /** * @section stepper motor current * * Some boards have a means of setting the stepper motor current via firmware. * * The power on motor currents are set by: * PWM_MOTOR_CURRENT - used by MINIRAMBO & ULTIMAIN_2 * known compatible chips: A4982 * <API key> - used by BQ_ZUM_MEGA_3D, RAMBO & SCOOVO_X9H * known compatible chips: AD5206 * <API key> - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 * known compatible chips: MCP4728 * <API key> - used by 5DPRINT, AZTEEG_X3_PRO, AZTEEG_X5_MINI_WIFI, MIGHTYBOARD_REVE * known compatible chips: MCP4451, MCP4018 * * Motor currents can also be set by M907 - M910 and by the LCD. * M907 - applies to all. * M908 - BQ_ZUM_MEGA_3D, RAMBO, PRINTRBOARD_REVF, RIGIDBOARD_V2 & SCOOVO_X9H * M909, M910 & LCD - only PRINTRBOARD_REVF & RIGIDBOARD_V2 */ //#define PWM_MOTOR_CURRENT { 1300, 1300, 1250 } // Values in milliamps //#define <API key> { 135,135,135,135,135 } // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A) //#define <API key> { 70, 80, 90, 80 } // Default drive percent - X, Y, Z, E axis // Use an I2C based DIGIPOT (e.g., Azteeg X3 Pro) //#define DIGIPOT_I2C #if ENABLED(DIGIPOT_I2C) && !defined(<API key>) /** * Common slave addresses: * * A (A shifted) B (B shifted) IC * Smoothie 0x2C (0x58) 0x2D (0x5A) MCP4451 * AZTEEG_X3_PRO 0x2C (0x58) 0x2E (0x5C) MCP4451 * AZTEEG_X5_MINI 0x2C (0x58) 0x2E (0x5C) MCP4451 * AZTEEG_X5_MINI_WIFI 0x58 0x5C MCP4451 * MIGHTYBOARD_REVE 0x2F (0x5E) MCP4018 */ #define <API key> 0x2C // unshifted slave address for first DIGIPOT #define <API key> 0x2D // unshifted slave address for second DIGIPOT #endif #define <API key> 8 // 5DPRINT: 4 AZTEEG_X3_PRO: 8 MKS SBASE: 5 // Actual motor currents in Amps. The number of entries must match <API key>. // These correspond to the physical drivers, so be mindful if the order is changed. #define <API key> { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 } // AZTEEG_X3_PRO // @section lcd // Change values more rapidly when the encoder is rotated faster #define <API key> #if ENABLED(<API key>) #define <API key> 30 // (steps/s) Encoder rate for 10x speed #define <API key> 80 // (steps/s) Encoder rate for 100x speed #endif // Play a beep when the feedrate is changed from the Status Screen //#define <API key> #if ENABLED(<API key>) #define <API key> 10 #define <API key> 440 #endif // Include a page of printer information in the LCD Main Menu #define LCD_INFO_MENU // Scroll a longer status message into view #define <API key> // On the Info Screen, display XY with one decimal place when possible //#define <API key> // The timeout (in ms) to return to the status screen from sub-menus //#define <API key> 15000 // Add an 'M73' G-code to set the current percentage //#define <API key> #if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define <API key> 2000 // (ms) Amount of time to show the bar #define <API key> 3000 // (ms) Amount of time to show the status message #define PROGRESS_MSG_EXPIRE 0 // (ms) Amount of time to retain the status message (0=forever) //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define <API key> // Add a menu item to test the progress bar #endif #endif /** * LED Control Menu * Enable this feature to add LED Control to the LCD menu */ //#define LED_CONTROL_MENU #if ENABLED(LED_CONTROL_MENU) #define LED_COLOR_PRESETS // Enable the Preset Color menu option #if ENABLED(LED_COLOR_PRESETS) #define LED_USER_PRESET_RED 255 // User defined RED value #define <API key> 128 // User defined GREEN value #define <API key> 0 // User defined BLUE value #define <API key> 255 // User defined WHITE value #define <API key> 255 // User defined intensity //#define <API key> // Have the printer display the user preset color on startup #endif #endif // LED_CONTROL_MENU #if ENABLED(SDSUPPORT) // Some RAMPS and other boards don't detect when an SD card is inserted. You can work // around this by connecting a push button or single throw switch to the pin defined // as SD_DETECT_PIN in your board's pins definitions. // This setting should be disabled unless you are using a push button, pulling the pin to ground. // Note: This is always disabled for ULTIPANEL (except <API key>). #define SD_DETECT_INVERTED #define <API key> true // Disable steppers when SD Print is finished #define <API key> "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. #define <API key> #define <API key> // Confirm the selected SD file before printing //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files #define EVENT_GCODE_SD_STOP "G27" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) * * Store the current state to the SD Card at the start of each layer * during SD printing. If the recovery file is found at boot time, present * an option on the LCD screen to continue the print from the last-known * point in the file. */ //#define POWER_LOSS_RECOVERY #if ENABLED(POWER_LOSS_RECOVERY) //#define POWER_LOSS_PIN 44 // Pin to detect power loss //#define POWER_LOSS_STATE HIGH // State of pin indicating power loss //#define <API key> 20 // (mm) Length of filament to purge on resume //#define <API key> 10 // (mm) Length of filament to retract on fail. Requires backup power. // Without a POWER_LOSS_PIN the following option helps reduce wear on the SD card, // especially with "vase mode" printing. Set too high and vases cannot be continued. #define <API key> 0.05 // (mm) Minimum Z change before saving power-loss data #endif /** * Sort SD file listings in alphabetical order. * * With this option enabled, items on SD cards will be sorted * by name for easier navigation. * * By default... * * - Use the slowest -but safest- method for sorting. * - Folders are sorted to the top. * - The sort key is statically allocated. * - No added G-code (M34) support. * - 40 item sorting limit. (Items after the first 40 are unsorted.) * * SD sorting uses static allocation (as set by SDSORT_LIMIT), allowing the * compiler to calculate the worst-case usage and throw an error if the SRAM * limit is exceeded. * * - SDSORT_USES_RAM provides faster sorting via a static directory buffer. * - SDSORT_USES_STACK does the same, but uses a local stack-based buffer. * - SDSORT_CACHE_NAMES will retain the sorted file listing in RAM. (Expensive!) * - SDSORT_DYNAMIC_RAM only uses RAM when the SD menu is visible. (Use with caution!) */ #define SDCARD_SORT_ALPHA // SD Card Sorting options #if ENABLED(SDCARD_SORT_ALPHA) #define SDSORT_LIMIT 40 // Maximum number of sorted items (10-256). Costs 27 bytes each. #define FOLDER_SORTING -1 // -1=above 0=none 1=below #define SDSORT_GCODE false // Allow turning sorting on/off with LCD and M34 g-code. #define SDSORT_USES_RAM true // Pre-allocate a static array for faster pre-sorting. #define SDSORT_USES_STACK true // Prefer the stack for pre-sorting to give back some SRAM. (Negated by next 2 options.) #define SDSORT_CACHE_NAMES false // Keep sorted items in RAM longer for speedy performance. Most expensive option. #define SDSORT_DYNAMIC_RAM false // Use dynamic allocation (within SD menus). Least expensive option. Set SDSORT_LIMIT before use! #define SDSORT_CACHE_VFATS 2 // Maximum number of 13-byte VFAT entries to use for sorting. // Note: Only affects <API key> with SDSORT_CACHE_NAMES but not SDSORT_DYNAMIC_RAM. #endif // This allows hosts to request long names for files and folders with M33 //#define <API key> // Enable this option to scroll long filenames in the SD card menu #define <API key> /** * This option allows you to abort SD printing when any endstop is triggered. * This feature must be enabled with "M540 S1" or from the LCD menu. * To have any effect, endstops must be enabled during SD printing. */ //#define <API key> /** * This option makes it easier to print the same SD Card file again. * On print completion the LCD Menu will open with the file selected. * You can just click to start the print, or navigate elsewhere. */ //#define <API key> /** * Auto-report SdCard status with M27 S<seconds> */ //#define <API key> /** * Support for USB thumb drives using an Arduino USB Host Shield or * equivalent MAX3421E breakout board. The USB thumb drive will appear * to Marlin as an SD card. * * The MAX3421E must be assigned the same pins as the SD card reader, with * the following pin mapping: * * SCLK, MOSI, MISO --> SCLK, MOSI, MISO * INT --> SD_DETECT_PIN * SS --> SDSS */ //#define <API key> #if ENABLED(<API key>) #define USB_CS_PIN SDSS #define USB_INTR_PIN SD_DETECT_PIN #endif //#define SD_FIRMWARE_UPDATE #if ENABLED(SD_FIRMWARE_UPDATE) #define <API key> 0x1FF #define <API key> 0xF0 #define <API key> 0xFF #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' //#define <API key> // LPC-based boards have on-board SD Card options. Override here or defaults apply. #ifdef TARGET_LPC1768 //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). #if ENABLED(LPC_SD_ONBOARD) //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. #endif #endif #endif // SDSUPPORT /** * Additional options for Graphical Displays * * Use the optimizations here to improve printing performance, * which can be adversely affected by graphical display drawing, * especially when doing several short moves, and when printing * on DELTA and SCARA machines. * * Some of these options may result in the display lagging behind * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ #if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar #define DOGM_SD_PERCENT // Enable to save many cycles by drawing a hollow frame on the Info Screen #define XYZ_HOLLOW_FRAME // Enable to save many cycles by drawing a hollow frame on Menu Screens #define MENU_HOLLOW_FRAME // A bigger font is available for edit items. Costs 3120 bytes of PROGMEM. // Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese. //#define USE_BIG_EDIT_FONT // A smaller font may be used on the Info Screen. Costs 2300 bytes of PROGMEM. // Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese. //#define USE_SMALL_INFOFONT // Enable this option and reduce the value to optimize screen updates. //#define DOGM_SPI_DELAY_US 5 // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE /** * ST7920-based LCDs can emulate a 16 x 4 character display using * the ST7920 character-generator for very fast screen updates. * Enable LIGHTWEIGHT_UI to use this special display mode. * * Since LIGHTWEIGHT_UI has limited space, the position and status * message occupy the same line. Set <API key> to the * length of time to display the status message before clearing. * * Set <API key> to zero to never clear the status. * This will prevent position updates from being displayed. */ #if ENABLED(U8GLIB_ST7920) //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define <API key> 20 #endif #endif /** * Status (Info) Screen customizations * These options may affect code size and screen render time. * Custom status screens can forcibly override these settings. */ //#define <API key> // Use combined heater images instead of separate ones //#define <API key> // Use plain hotend icons instead of numbered ones (with 2+ hotends) #define <API key> // Show solid nozzle bitmaps when heating (Requires STATUS_HOTEND_ANIM) #define STATUS_HOTEND_ANIM // Use a second bitmap to indicate hotend heating #define STATUS_BED_ANIM // Use a second bitmap to indicate bed heating #define STATUS_CHAMBER_ANIM // Use a second bitmap to indicate chamber heating //#define <API key> // Use the alternative bed bitmap //#define <API key> // Use the alternative fan bitmap //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar //#define <API key> // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) // Frivolous Game Options //#define MARLIN_BRICKOUT //#define MARLIN_INVADERS //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD // @section safety /** * The watchdog hardware timer will do a reset and disable all outputs * if the firmware gets too overloaded to read the temperature sensors. * * If you find that watchdog reboot causes your AVR board to hang forever, * enable <API key> to use a custom timer instead of WDTO. * NOTE: This method is less reliable as it can only catch hangups while * interrupts are enabled. */ #define USE_WATCHDOG #if ENABLED(USE_WATCHDOG) //#define <API key> #endif // @section lcd /** * Babystepping enables movement of the axes by tiny increments without changing * the current position values. This feature is used primarily to adjust the Z * axis in the first layer of a print in real-time. * * Warning: Does not respect endstops! */ #define BABYSTEPPING #if ENABLED(BABYSTEPPING) //#define <API key> //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way #define <API key> 5 // Babysteps are very small. Increase for faster motion. #define <API key> // Double-click on the Status Screen for Z Babystepping. #if ENABLED(<API key>) #define <API key> 1250 // Maximum interval between clicks, in milliseconds. // Note: Extra time may be added to mitigate controller latency. //#define <API key> // Allow babystepping at all times (not just during movement). //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. #if ENABLED(MOVE_Z_WHEN_IDLE) #define <API key> 1 // Multiply 1mm by this factor for the move step size. #endif #endif //#define <API key> // Display total babysteps since last G28 //#define <API key> // Combine M851 Z and Babystepping #if ENABLED(<API key>) //#define <API key> // For multiple hotends, babystep relative Z offsets //#define <API key> // Enable graphical overlay on Z-offset editor #endif #endif // @section extruder //#define LIN_ADVANCE #if ENABLED(LIN_ADVANCE) //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif // @section leveling #if EITHER(MESH_BED_LEVELING, <API key>) // Override the mesh area if the automatic (max) area is too large //#define MESH_MIN_X MESH_INSET //#define MESH_MIN_Y MESH_INSET //#define MESH_MAX_X X_BED_SIZE - (MESH_INSET) //#define MESH_MAX_Y Y_BED_SIZE - (MESH_INSET) #endif /** * Repeatedly attempt G29 leveling until it succeeds. * Stop after G29_MAX_RETRIES attempts. */ //#define <API key> #if ENABLED(<API key>) #define G29_MAX_RETRIES 3 #define G29_HALT_ON_FAILURE /** * Specify the GCODE commands that will be executed when leveling succeeds, * between attempts, and after the maximum number of retries have been tried. */ #define <API key> "M117 Bed leveling done." #define <API key> "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define <API key> "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" #endif // @section extras // G2/G3 Arc Support #define ARC_SUPPORT // Disable this feature to save ~3226 bytes #if ENABLED(ARC_SUPPORT) #define MM_PER_ARC_SEGMENT 1 // Length of each arc segment #define MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle #define N_ARC_CORRECTION 25 // Number of interpolated segments between corrections //#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles //#define <API key> // Allow G2/G3 to operate in XY, ZX, or YZ planes #endif // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes. //#define <API key> /** * G38 Probe Target * * This option adds G38.2 and G38.3 (probe towards target) * and optionally G38.4 and G38.5 (probe away from target). * Set MULTIPLE_PROBING for G38 to probe more than once. */ //#define G38_PROBE_TARGET #if ENABLED(G38_PROBE_TARGET) //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move #define <API key> 6 //#define <API key> 650 //#define <API key> 2 /** * Maximum stepping rate (in Hz) the stepper driver allows * If undefined, defaults to 1MHz / (2 * <API key>) * 500000 : Maximum for A4988 stepper driver * 400000 : Maximum for TMC2xxx stepper drivers * 250000 : Maximum for DRV8825 stepper driver * 200000 : Maximum for LV8729 stepper driver * 150000 : Maximum for TB6600 stepper driver * 15000 : Maximum for TB6560 stepper driver * * Override the default value based on the driver type set in Configuration.h. */ //#define <API key> 250000 // @section temperature // Control heater 0 and heater 1 in parallel. //#define HEATERS_PARALLEL // @section hidden // The number of linear motions that can be in the plan at any give time. // THE BLOCK_BUFFER_SIZE NEEDS TO BE A POWER OF 2 (e.g. 8, 16, 32) because shifts and ors are used to do the ring-buffering. #if ENABLED(SDSUPPORT) #define BLOCK_BUFFER_SIZE 16 // SD,LCD,Buttons take more memory, block buffer needs to be smaller #else #define BLOCK_BUFFER_SIZE 16 // maximize block buffer #endif // @section serial // The ASCII buffer for serial input #define MAX_CMD_SIZE 96 #define BUFSIZE 4 // Transmission to Host Buffer Size // To save 386 bytes of PROGMEM (and TX_BUFFER_SIZE+3 bytes of RAM) set to 0. // To buffer a simple "ok" you need 4 bytes. // For ADVANCED_OK (M105) you need 32 bytes. // For debug-echo: 128 bytes for the optimal speed. // Other output doesn't need to be that speedy. // :[0, 2, 4, 8, 16, 32, 64, 128, 256] #define TX_BUFFER_SIZE 0 // Host Receive Buffer Size // Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough. // To use flow control, set this buffer size to at least 1024 bytes. // :[0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048] //#define RX_BUFFER_SIZE 1024 #if RX_BUFFER_SIZE >= 1024 // Enable to have the controller send XON/XOFF control characters to // the host to signal the RX buffer is becoming full. //#define SERIAL_XON_XOFF #endif #if ENABLED(SDSUPPORT) // Enable this option to collect and display the maximum // RX queue usage after transferring a file to SD. //#define <API key> // Enable this option to collect and display the number // of dropped bytes after a file transfer to SD. //#define <API key> #endif // Enable an emergency-command parser to intercept certain commands as they // enter the serial receive buffer, so they cannot be blocked. // Currently handles M108, M112, M410 // Does not work on boards using AT90USB (USBCON) processors! #define EMERGENCY_PARSER // Bad Serial-connections can miss a received command by sending an 'ok' // Therefore some clients abort after 30 seconds in a timeout. // Some other clients start sending commands while receiving a 'wait'. // This "wait" is only sent when the buffer is empty. 1 second is a good value here. //#define NO_TIMEOUTS 1000 // Milliseconds // Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary. #define ADVANCED_OK // Printrun may have trouble receiving long strings all at once. // This option inserts short delays between lines of serial output. #define <API key> // @section extras /** * Extra Fan Speed * Adds a secondary fan speed for each print-cooling fan. * 'M106 P<fan> T3-255' : Set a secondary speed for <fan> * 'M106 P<fan> T2' : Use the set secondary speed * 'M106 P<fan> T1' : Restore the previous fan speed */ //#define EXTRA_FAN_SPEED /** * Firmware-based and LCD-controlled retract * * Add G10 / G11 commands for automatic firmware-based retract / recover. * Use M207 and M208 to define parameters for retract / recover. * * Use M209 to enable or disable auto-retract. * With auto-retract enabled, all G1 E moves within the set range * will be converted to firmware-based retract/recover moves. * * Be sure to turn off auto-retract during filament change. * * Note that M207 / M208 / M209 settings are saved to EEPROM. * */ //#define FWRETRACT #if ENABLED(FWRETRACT) #define <API key> // costs ~500 bytes of PROGMEM #if ENABLED(<API key>) #define MIN_AUTORETRACT 0.1 // When auto-retract is on, convert E moves of this length and over #define MAX_AUTORETRACT 10.0 // Upper limit for auto-retract conversion #endif #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define <API key> 0 // Default additional recover length (mm, added to retract length when recovering) #define <API key> 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define <API key> 8 // Default feedrate for recovering from retraction (mm/s) #define <API key> 8 // Default feedrate for recovering from swap retraction (mm/s) #if ENABLED(MIXING_EXTRUDER) //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously #endif #endif /** * Universal tool change settings. * Applies to all types of extruders except where explicitly noted. */ #if EXTRUDERS > 1 // Z raise distance for tool-change, as needed for some extruders #define TOOLCHANGE_ZRAISE 2 // Retract and prime filament on tool-change //#define <API key> #if ENABLED(<API key>) #define <API key> 12 #define <API key> 2 #define <API key> 3600 // (mm/m) #define <API key> 3600 // (mm/m) #endif /** * Position to park head during tool change. * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER */ //#define TOOLCHANGE_PARK #if ENABLED(TOOLCHANGE_PARK) #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } #define <API key> 6000 // (mm/m) #endif #endif /** * Advanced Pause * Experimental feature for filament change support and for parking the nozzle when paused. * Adds the GCode M600 for initiating filament change. * If PARK_HEAD_ON_PAUSE enabled, adds the GCode M125 to pause printing and park the nozzle. * * Requires an LCD display. * Requires NOZZLE_PARK_FEATURE. * This feature is required for the default <API key>. */ #define <API key> #if ENABLED(<API key>) #define <API key> 60 // (mm/s) Initial retract feedrate. #define <API key> 4 // (mm) Initial retract. // This short retract is done immediately, before parking the nozzle. #define <API key> 41 // (mm/s) Unload filament feedrate. This can be pretty fast. #define <API key> 25 // (mm/s^2) Lower acceleration may allow a faster feedrate. #define <API key> 430 // (mm) The length of filament for a complete unload. // For Bowden, the full length of the tube and nozzle. // For direct drive, the full length of the nozzle. // Set to 0 for manual unloading. #define <API key> 6 // (mm/s) Slow move when starting load. #define <API key> 0 // (mm) Slow length, to allow time to insert material. // 0 to disable start loading and skip to fast load only #define <API key> 41 // (mm/s) Load filament feedrate. This can be pretty fast. #define <API key> 25 // (mm/s^2) Lower acceleration may allow a faster feedrate. #define <API key> 430 // (mm) Load length of filament, from extruder gear to nozzle. // For Bowden, the full length of the tube and nozzle. // For direct drive, the full length of the nozzle. //#define <API key> // Purge continuously up to the purge length until interrupted. #define <API key> 3 // (mm/s) Extrude feedrate (after loading). Should be slower than load feedrate. #define <API key> 20 // (mm) Length to extrude after loading. // Set to 0 for manual extrusion. // Filament can be extruded repeatedly from the Filament Change menu // until extrusion is consistent, and to purge old filament. #define <API key> 0 // (mm) Extra distance to prime nozzle after returning from park. //#define <API key> // Turn off print-cooling fans while the machine is paused. // Filament Unload does a Retract, Delay, and Purge first: #define <API key> 4 // (mm) Unload initial retract length. #define <API key> 5000 // (ms) Delay for the filament to cool after retract. #define <API key> 0 // (mm) An unretract is done, then this length is purged. #define <API key> 45 // (seconds) Time limit before the nozzle is turned off for safety. #define <API key> 6 // Number of alert beeps to play when a response is needed. #define <API key> // Enable for XYZ steppers to stay powered on during filament change. #define PARK_HEAD_ON_PAUSE // Park the nozzle during pause and filament change. #define <API key> // Ensure homing has been completed prior to parking for filament change //#define <API key> // Add M701/M702 Load/Unload G-codes, plus Load/Unload in the LCD Prepare menu. //#define <API key> // Allow M702 to unload all extruders above a minimum target temp (as set by M302) #endif // @section tmc #if HAS_DRIVER(TMC26X) #if AXIS_DRIVER_TYPE_X(TMC26X) #define X_MAX_CURRENT 1000 #define X_SENSE_RESISTOR 91 // (mOhms) #define X_MICROSTEPS 16 // Number of microsteps #endif #if AXIS_DRIVER_TYPE_X2(TMC26X) #define X2_MAX_CURRENT 1000 #define X2_SENSE_RESISTOR 91 #define X2_MICROSTEPS 16 #endif #if AXIS_DRIVER_TYPE_Y(TMC26X) #define Y_MAX_CURRENT 1000 #define Y_SENSE_RESISTOR 91 #define Y_MICROSTEPS 16 #endif #if AXIS_DRIVER_TYPE_Y2(TMC26X) #define Y2_MAX_CURRENT 1000 #define Y2_SENSE_RESISTOR 91 #define Y2_MICROSTEPS 16 #endif #if AXIS_DRIVER_TYPE_Z(TMC26X) #define Z_MAX_CURRENT 1000 #define Z_SENSE_RESISTOR 91 #define Z_MICROSTEPS 16 #endif #if AXIS_DRIVER_TYPE_Z2(TMC26X) #define Z2_MAX_CURRENT 1000 #define Z2_SENSE_RESISTOR 91 #define Z2_MICROSTEPS 16 #endif #if AXIS_DRIVER_TYPE_Z3(TMC26X) #define Z3_MAX_CURRENT 1000 #define Z3_SENSE_RESISTOR 91 #define Z3_MICROSTEPS 16 #endif #if AXIS_DRIVER_TYPE_E0(TMC26X) #define E0_MAX_CURRENT 1000 #define E0_SENSE_RESISTOR 91 #define E0_MICROSTEPS 16 #endif #if AXIS_DRIVER_TYPE_E1(TMC26X) #define E1_MAX_CURRENT 1000 #define E1_SENSE_RESISTOR 91 #define E1_MICROSTEPS 16 #endif #if AXIS_DRIVER_TYPE_E2(TMC26X) #define E2_MAX_CURRENT 1000 #define E2_SENSE_RESISTOR 91 #define E2_MICROSTEPS 16 #endif #if AXIS_DRIVER_TYPE_E3(TMC26X) #define E3_MAX_CURRENT 1000 #define E3_SENSE_RESISTOR 91 #define E3_MICROSTEPS 16 #endif #if AXIS_DRIVER_TYPE_E4(TMC26X) #define E4_MAX_CURRENT 1000 #define E4_SENSE_RESISTOR 91 #define E4_MICROSTEPS 16 #endif #if AXIS_DRIVER_TYPE_E5(TMC26X) #define E5_MAX_CURRENT 1000 #define E5_SENSE_RESISTOR 91 #define E5_MICROSTEPS 16 #endif #endif // TMC26X // @section tmc_smart #if HAS_TRINAMIC #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 #if AXIS_IS_TMC(X) #define X_CURRENT 800 // (mA) RMS current. Multiply by 1.414 for peak current. #define X_MICROSTEPS 16 // 0..256 #define X_RSENSE 0.11 #endif #if AXIS_IS_TMC(X2) #define X2_CURRENT 800 #define X2_MICROSTEPS 16 #define X2_RSENSE 0.11 #endif #if AXIS_IS_TMC(Y) #define Y_CURRENT 800 #define Y_MICROSTEPS 16 #define Y_RSENSE 0.11 #endif #if AXIS_IS_TMC(Y2) #define Y2_CURRENT 800 #define Y2_MICROSTEPS 16 #define Y2_RSENSE 0.11 #endif #if AXIS_IS_TMC(Z) #define Z_CURRENT 800 #define Z_MICROSTEPS 16 #define Z_RSENSE 0.11 #endif #if AXIS_IS_TMC(Z2) #define Z2_CURRENT 800 #define Z2_MICROSTEPS 16 #define Z2_RSENSE 0.11 #endif #if AXIS_IS_TMC(Z3) #define Z3_CURRENT 800 #define Z3_MICROSTEPS 16 #define Z3_RSENSE 0.11 #endif #if AXIS_IS_TMC(E0) #define E0_CURRENT 800 #define E0_MICROSTEPS 16 #define E0_RSENSE 0.11 #endif #if AXIS_IS_TMC(E1) #define E1_CURRENT 800 #define E1_MICROSTEPS 16 #define E1_RSENSE 0.11 #endif #if AXIS_IS_TMC(E2) #define E2_CURRENT 800 #define E2_MICROSTEPS 16 #define E2_RSENSE 0.11 #endif #if AXIS_IS_TMC(E3) #define E3_CURRENT 800 #define E3_MICROSTEPS 16 #define E3_RSENSE 0.11 #endif #if AXIS_IS_TMC(E4) #define E4_CURRENT 800 #define E4_MICROSTEPS 16 #define E4_RSENSE 0.11 #endif #if AXIS_IS_TMC(E5) #define E5_CURRENT 800 #define E5_MICROSTEPS 16 #define E5_RSENSE 0.11 #endif /** * Override default SPI pins for TMC2130, TMC2160, TMC2660, TMC5130 and TMC5160 drivers here. * The default pins can be found in your board's pins file. */ //#define X_CS_PIN -1 //#define Y_CS_PIN -1 //#define Z_CS_PIN -1 //#define X2_CS_PIN -1 //#define Y2_CS_PIN -1 //#define Z2_CS_PIN -1 //#define Z3_CS_PIN -1 //#define E0_CS_PIN -1 //#define E1_CS_PIN -1 //#define E2_CS_PIN -1 //#define E3_CS_PIN -1 //#define E4_CS_PIN -1 //#define E5_CS_PIN -1 /** * Use software SPI for TMC2130. * Software option for SPI driven drivers (TMC2130, TMC2160, TMC2660, TMC5130 and TMC5160). * The default SW SPI pins are defined the respective pins files, * but you can override or define them here. */ //#define TMC_USE_SW_SPI //#define TMC_SW_MOSI -1 //#define TMC_SW_MISO -1 //#define TMC_SW_SCK -1 /** * Software enable * * Use for drivers that do not use a dedicated enable pin, but rather handle the same * function through a communication line such as SPI or UART. */ //#define <API key> /** * TMC2130, TMC2160, TMC2208, TMC5130 and TMC5160 only * Use Trinamic's ultra quiet stepping mode. * When disabled, Marlin will use spreadCycle stepping mode. */ #define STEALTHCHOP_XY #define STEALTHCHOP_Z #define STEALTHCHOP_E /** * Optimize spreadCycle chopper parameters by using predefined parameter sets * or with the help of an example included in the library. * Provided parameter sets are * CHOPPER_DEFAULT_12V * CHOPPER_DEFAULT_19V * CHOPPER_DEFAULT_24V * CHOPPER_DEFAULT_36V * <API key> // Imported parameters from the official Prusa firmware for MK3 (24V) * CHOPPER_MARLIN_119 // Old defaults from Marlin v1.1.9 * * Define you own with * { <off_time[1..15]>, <hysteresis_end[-3..12]>, hysteresis_start[1..8] } */ #define CHOPPER_TIMING CHOPPER_DEFAULT_12V /** * Monitor Trinamic drivers for error conditions, * like overtemperature and short to ground. TMC2208 requires hardware serial. * In the case of overtemperature Marlin can decrease the driver current until error condition clears. * Other detected conditions can be used to stop the current print. * Relevant g-codes: * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define <API key> #if ENABLED(<API key>) #define CURRENT_STEP_DOWN 50 #define <API key> #define STOP_ON_ERROR #endif /** * TMC2130, TMC2160, TMC2208, TMC5130 and TMC5160 only * The driver will switch to spreadCycle when stepper speed is over HYBRID_THRESHOLD. * This mode allows for faster movements at the expense of higher noise levels. * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD #define X_HYBRID_THRESHOLD 100 // [mm/s] #define X2_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 100 #define Y2_HYBRID_THRESHOLD 100 #define Z_HYBRID_THRESHOLD 3 #define Z2_HYBRID_THRESHOLD 3 #define Z3_HYBRID_THRESHOLD 3 #define E0_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30 #define E3_HYBRID_THRESHOLD 30 #define E4_HYBRID_THRESHOLD 30 #define E5_HYBRID_THRESHOLD 30 //#define SENSORLESS_HOMING // TMC2130 only /** * Use StallGuard2 to probe the bed with the nozzle. * * CAUTION: This could cause damage to machines that use a lead screw or threaded rod * to move the Z axis. Take extreme care when attempting to enable this feature. */ //#define SENSORLESS_PROBING // TMC2130 only #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 //#define SPI_ENDSTOPS //#define <API key> #endif /** * Enable M122 debugging command for TMC stepper drivers. * M122 S0/1 will enable continous reporting. */ //#define TMC_DEBUG #define TMC_ADV() { } #endif // HAS_TRINAMIC // @section L6470 #if HAS_DRIVER(L6470) //#define L6470_CHITCHAT // Display additional status info #if AXIS_DRIVER_TYPE_X(L6470) #define X_MICROSTEPS 128 // Number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128) #define X_OVERCURRENT 2000 // (mA) Current where the driver detects an over current (VALID: 375 x (1 - 16) - 6A max - rounds down) #define X_STALLCURRENT 1500 // (mA) Current where the driver detects a stall (VALID: 31.25 * (1-128) - 4A max - rounds down) #define X_MAX_VOLTAGE 127 // 0-255, Maximum effective voltage seen by stepper #define X_CHAIN_POS 0 // Position in SPI chain, 0=Not in chain, 1=Nearest MOSI #endif #if AXIS_DRIVER_TYPE_X2(L6470) #define X2_MICROSTEPS 128 #define X2_OVERCURRENT 2000 #define X2_STALLCURRENT 1500 #define X2_MAX_VOLTAGE 127 #define X2_CHAIN_POS 0 #endif #if AXIS_DRIVER_TYPE_Y(L6470) #define Y_MICROSTEPS 128 #define Y_OVERCURRENT 2000 #define Y_STALLCURRENT 1500 #define Y_MAX_VOLTAGE 127 #define Y_CHAIN_POS 0 #endif #if AXIS_DRIVER_TYPE_Y2(L6470) #define Y2_MICROSTEPS 128 #define Y2_OVERCURRENT 2000 #define Y2_STALLCURRENT 1500 #define Y2_MAX_VOLTAGE 127 #define Y2_CHAIN_POS 0 #endif #if AXIS_DRIVER_TYPE_Z(L6470) #define Z_MICROSTEPS 128 #define Z_OVERCURRENT 2000 #define Z_STALLCURRENT 1500 #define Z_MAX_VOLTAGE 127 #define Z_CHAIN_POS 0 #endif #if AXIS_DRIVER_TYPE_Z2(L6470) #define Z2_MICROSTEPS 128 #define Z2_OVERCURRENT 2000 #define Z2_STALLCURRENT 1500 #define Z2_MAX_VOLTAGE 127 #define Z2_CHAIN_POS 0 #endif #if AXIS_DRIVER_TYPE_Z3(L6470) #define Z3_MICROSTEPS 128 #define Z3_OVERCURRENT 2000 #define Z3_STALLCURRENT 1500 #define Z3_MAX_VOLTAGE 127 #define Z3_CHAIN_POS 0 #endif #if AXIS_DRIVER_TYPE_E0(L6470) #define E0_MICROSTEPS 128 #define E0_OVERCURRENT 2000 #define E0_STALLCURRENT 1500 #define E0_MAX_VOLTAGE 127 #define E0_CHAIN_POS 0 #endif #if AXIS_DRIVER_TYPE_E1(L6470) #define E1_MICROSTEPS 128 #define E1_OVERCURRENT 2000 #define E1_STALLCURRENT 1500 #define E1_MAX_VOLTAGE 127 #define E1_CHAIN_POS 0 #endif #if AXIS_DRIVER_TYPE_E2(L6470) #define E2_MICROSTEPS 128 #define E2_OVERCURRENT 2000 #define E2_STALLCURRENT 1500 #define E2_MAX_VOLTAGE 127 #define E2_CHAIN_POS 0 #endif #if AXIS_DRIVER_TYPE_E3(L6470) #define E3_MICROSTEPS 128 #define E3_OVERCURRENT 2000 #define E3_STALLCURRENT 1500 #define E3_MAX_VOLTAGE 127 #define E3_CHAIN_POS 0 #endif #if AXIS_DRIVER_TYPE_E4(L6470) #define E4_MICROSTEPS 128 #define E4_OVERCURRENT 2000 #define E4_STALLCURRENT 1500 #define E4_MAX_VOLTAGE 127 #define E4_CHAIN_POS 0 #endif #if AXIS_DRIVER_TYPE_E5(L6470) #define E5_MICROSTEPS 128 #define E5_OVERCURRENT 2000 #define E5_STALLCURRENT 1500 #define E5_MAX_VOLTAGE 127 #define E5_CHAIN_POS 0 #endif /** * Monitor L6470 drivers for error conditions like over temperature and over current. * In the case of over temperature Marlin can decrease the drive until the error condition clears. * Other detected conditions can be used to stop the current print. * Relevant g-codes: * M906 - I1/2/3/4/5 Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given. * I not present or I0 or I1 - X, Y, Z or E0 * I2 - X2, Y2, Z2 or E1 * I3 - Z3 or E3 * I4 - E4 * I5 - E5 * M916 - Increase drive level until get thermal warning * M917 - Find minimum current thresholds * M918 - Increase speed until max or error * M122 S0/1 - Report driver parameters */ //#define <API key> #if ENABLED(<API key>) #define KVAL_HOLD_STEP_DOWN 1 //#define L6470_STOP_ON_ERROR #endif #endif // L6470 /** * TWI/I2C BUS * * This feature is an EXPERIMENTAL feature so it shall not be used on production * machines. Enabling this will allow you to send and receive I2C data from slave * devices on the bus. * * ; Example #1 * ; This macro send the string "Marlin" to the slave device with address 0x63 (99) * ; It uses multiple M260 commands with one B<base 10> arg * M260 A99 ; Target slave address * M260 B77 ; M * M260 B97 ; a * M260 B114 ; r * M260 B108 ; l * M260 B105 ; i * M260 B110 ; n * M260 S1 ; Send the current buffer * * ; Example #2 * ; Request 6 bytes from slave device with address 0x63 (99) * M261 A99 B5 * * ; Example #3 * ; Example serial output of a M261 request * echo:i2c-reply: from:99 bytes:5 data:hello */ // @section i2cbus //#define EXPERIMENTAL_I2CBUS #define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave // @section extras /** * Photo G-code * Add the M240 G-code to take a photo. * The photo can be triggered by a digital pin or a physical movement. */ //#define PHOTO_GCODE #if ENABLED(PHOTO_GCODE) // A position to move to (and raise Z) before taking the photo //#define PHOTO_POSITION { X_MAX_POS - 5, Y_MAX_POS, 0 } // { xpos, ypos, zraise } (M240 X Y Z) //#define PHOTO_DELAY_MS 100 // (ms) Duration to pause before moving back (M240 P) //#define PHOTO_RETRACT_MM 6.5 // (mm) E retract/recover for the photo move (M240 R S) // Canon RC-1 or homebrew digital camera trigger //#define PHOTOGRAPH_PIN 23 // Canon Hack Development Kit //#define CHDK_PIN 4 // Optional second move with delay to trigger the camera shutter //#define <API key> { X_MAX_POS, Y_MAX_POS } // { xpos, ypos } (M240 I J) // Duration to hold the switch or keep CHDK_PIN high //#define PHOTO_SWITCH_MS 50 // (ms) (M240 D) #endif //#define <API key> #if ENABLED(<API key>) #define <API key> false // set to "true" if the on/off function is reversed #define SPINDLE_LASER_PWM true // set to true if your controller supports setting the speed/power #define <API key> true // set to "true" if the speed/power goes up when you want it to go slower #define <API key> 5000 // delay in milliseconds to allow the spindle/laser to come up to speed/power #define <API key> 5000 // delay in milliseconds to allow the spindle to stop #define SPINDLE_DIR_CHANGE true // set to true if your spindle controller supports changing spindle direction #define SPINDLE_INVERT_DIR false #define <API key> true // set to true if Marlin should stop the spindle before changing rotation direction /** * The M3 & M4 commands use the following equation to convert PWM duty cycle to speed/power * * SPEED/POWER = PWM duty cycle * SPEED_POWER_SLOPE + <API key> * where PWM duty cycle varies from 0 to 255 * * set the following for your controller (ALL MUST BE SET) */ #define SPEED_POWER_SLOPE 118.4 #define <API key> 0 #define SPEED_POWER_MIN 5000 #define SPEED_POWER_MAX 30000 // SuperPID router controller 0 - 30,000 RPM //#define SPEED_POWER_SLOPE 0.3922 //#define <API key> 0 //#define SPEED_POWER_MIN 10 //#define SPEED_POWER_MAX 100 // 0-100% #endif /** * Filament Width Sensor * * Measures the filament width in real-time and adjusts * flow rate to compensate for any irregularities. * * Also allows the measured filament diameter to set the * extrusion rate, so the slicer only has to specify the * volume. * * Only a single extruder is supported at this time. * * 34 RAMPS_14 : Analog input 5 on the AUX2 connector * 81 PRINTRBOARD : Analog input 2 on the Exp1 connector (version B,C,D,E) * 301 RAMBO : Analog input 3 * * Note: May require analog pins to be defined for other boards. */ //#define <API key> #if ENABLED(<API key>) #define <API key> 0 // Index of the extruder that has the filament sensor. :[0,1,2,3,4] #define <API key> 14 // (cm) The distance from the filament sensor to the melting chamber #define <API key> 1.0 // (mm) If a measurement differs too much from nominal width ignore it #define <API key> 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than <API key>. #define <API key> <API key> // Set measured to nominal initially // Display filament width on the LCD status line. Status messages will expire after 5 seconds. //#define <API key> #endif /** * CNC Coordinate Systems * * Enables G53 and G54-G59.3 commands to select coordinate systems * and G92.1 to reset the workspace to native machine space. */ //#define <API key> /** * Auto-report temperatures with M155 S<seconds> */ #define <API key> /** * Include capabilities in M115 output */ #define <API key> /** * Disable all Volumetric extrusion options */ //#define NO_VOLUMETRICS #if DISABLED(NO_VOLUMETRICS) /** * Volumetric extrusion default state * Activate to make volumetric extrusion the default method, * with <API key> as the default diameter. * * M200 D0 to disable, M200 Dn to set a new diameter. */ //#define <API key> #endif /** * Enable this option for a leaner build of Marlin that removes all * workspace offsets, simplifying coordinate transformations, leveling, etc. * * - M206 and M428 are disabled. * - G92 will revert to its behavior from Marlin 1.0. */ //#define <API key> /** * Set the number of proportional font spaces required to fill up a typical character space. * This can help to better align the output of commands like `G29 O` Mesh Output. * * For clients that use a fixed-width font (like OctoPrint), leave this set to 1.0. * Otherwise, adjust according to your client and font. */ #define <API key> 1.0 /** * Spend 28 bytes of SRAM to optimize the GCode parser */ #define FASTER_GCODE_PARSER /** * CNC G-code options * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. * Note that G0 feedrates should be used with care for 3D printing (if used at all). * High feedrates may cause ringing and harm print quality. */ //#define PAREN_COMMENTS // Support for <API key> comments //#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. // Enable and set a (default) feedrate for all G0 moves //#define G0_FEEDRATE 3000 // (mm/m) #ifdef G0_FEEDRATE //#define <API key> // The G0 feedrate is set by F in G0 motion mode #endif /** * G-code Macros * * Add G-codes M810-M819 to define and run G-code macros. * Macros are not saved to EEPROM. */ //#define GCODE_MACROS #if ENABLED(GCODE_MACROS) #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used #define <API key> 50 // Maximum length of a single macro #endif /** * User-defined menu items that execute custom GCode */ //#define CUSTOM_USER_MENUS #if ENABLED(CUSTOM_USER_MENUS) //#define <API key> "Custom Commands" #define USER_SCRIPT_DONE "M117 User Script Done" #define <API key> //#define USER_SCRIPT_RETURN // Return to status screen after a script #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(<API key>) #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(<API key>) #define USER_DESC_4 "Heat Bed/Home/Level" #define USER_GCODE_4 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nG28\nG29" #define USER_DESC_5 "Home & Info" #define USER_GCODE_5 "G28\nM503" #endif //#define <API key> #if ENABLED(<API key>) //#define HOST_PROMPT_SUPPORT #endif //#define <API key> #if ENABLED(<API key>) #define I2CPE_ENCODER_CNT 1 // The number of encoders installed; max of 5 // encoders supported currently. #define I2CPE_ENC_1_ADDR I2CPE_PRESET_ADDR_X // I2C address of the encoder. 30-200. #define I2CPE_ENC_1_AXIS X_AXIS // Axis the encoder module is installed on. <X|Y|Z|E>_AXIS. #define I2CPE_ENC_1_TYPE <API key> // Type of encoder: <API key> -or- // <API key>. #define <API key> 2048 // 1024 for magnetic strips with 2mm poles; 2048 for // 1mm poles. For linear encoders this is ticks / mm, // for rotary encoders this is ticks / revolution. //#define <API key> (16 * 200) // Only needed for rotary encoders; number of stepper // steps per full revolution (motor steps/rev * microstepping) //#define I2CPE_ENC_1_INVERT // Invert the direction of axis travel. #define <API key> I2CPE_ECM_MICROSTEP // Type of error error correction. #define <API key> 0.10 // Threshold size for error (in mm) above which the // printer will attempt to correct the error; errors // smaller than this are ignored to minimize effects of // measurement noise / latency (filter). #define I2CPE_ENC_2_ADDR I2CPE_PRESET_ADDR_Y // Same as above, but for encoder 2. #define I2CPE_ENC_2_AXIS Y_AXIS #define I2CPE_ENC_2_TYPE <API key> #define <API key> 2048 //#define <API key> (16 * 200) //#define I2CPE_ENC_2_INVERT #define <API key> I2CPE_ECM_MICROSTEP #define <API key> 0.10 #define I2CPE_ENC_3_ADDR I2CPE_PRESET_ADDR_Z // Encoder 3. Add additional configuration options #define I2CPE_ENC_3_AXIS Z_AXIS // as above, or use defaults below. #define I2CPE_ENC_4_ADDR I2CPE_PRESET_ADDR_E // Encoder 4. #define I2CPE_ENC_4_AXIS E_AXIS #define I2CPE_ENC_5_ADDR 34 // Encoder 5. #define I2CPE_ENC_5_AXIS E_AXIS // Default settings for encoders which are enabled, but without settings configured above. #define I2CPE_DEF_TYPE <API key> #define <API key> 2048 #define I2CPE_DEF_TICKS_REV (16 * 200) #define I2CPE_DEF_EC_METHOD I2CPE_ECM_NONE #define I2CPE_DEF_EC_THRESH 0.1 //#define <API key> 100.0 // Threshold size for error (in mm) error on any given // axis after which the printer will abort. Comment out to // disable abort behavior. #define I2CPE_TIME_TRUSTED 10000 // After an encoder fault, there must be no further fault // for this amount of time (in ms) before the encoder // is trusted again. /** * Position is checked every time a new command is executed from the buffer but during long moves, * this setting determines the minimum update time between checks. A value of 100 works well with * error rolling average when attempting to correct only for skips and not for vibration. */ #define <API key> 4 // (ms) Minimum time between encoder checks. // Use a rolling average to identify persistant errors that indicate skips, as opposed to vibration and noise. #define <API key> #endif // <API key> /** * MAX7219 Debug Matrix * * Add support for a low-cost 8x8 LED Matrix based on the Max7219 chip as a realtime status display. * Requires 3 signal wires. Some useful debug options are included to demonstrate its usage. */ //#define MAX7219_DEBUG #if ENABLED(MAX7219_DEBUG) #define MAX7219_CLK_PIN 64 #define MAX7219_DIN_PIN 57 #define MAX7219_LOAD_PIN 44 //#define MAX7219_GCODE // Add the M7219 G-code to control the LED matrix #define MAX7219_INIT_TEST 2 // Do a test pattern at initialization (Set to 2 for spiral) #define <API key> 1 // Number of Max7219 units in chain. #define MAX7219_ROTATE 0 // connector at: right=0 bottom=-90 top=90 left=180 //#define <API key> // The individual LED matrix units may be in reversed order /** * Sample debug features * If you add more debug displays, be careful to avoid conflicts! */ #define <API key> // Blink corner LED of 8x8 matrix to show that the firmware is functioning #define <API key> 3 // Show the planner queue head position on this and the next LED matrix row #define <API key> 5 // Show the planner queue tail position on this and the next LED matrix row #define <API key> 0 // Show the current planner queue depth on this and the next LED matrix row // If you experience stuttering, reboots, etc. this option can reveal how // tweaks made to the configuration are affecting the printer in real-time. #endif /** * NanoDLP Sync support * * Add support for Synchronized Z moves when using with NanoDLP. G0/G1 axis moves will output "Z_move_comp" * string to enable synchronization with DLP projector exposure. This change will allow to use * [[WaitForDoneMessage]] instead of populating your gcode with M400 commands */ //#define NANODLP_Z_SYNC #if ENABLED(NANODLP_Z_SYNC) //#define NANODLP_ALL_AXIS // Enables "Z_move_comp" output on any axis move. // Default behavior is limited to Z axis only. #endif /** * WiFi Support (Espressif ESP32 WiFi) */ //#define WIFISUPPORT #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" //#define WEBSUPPORT // Start a webserver with auto-discovery //#define OTASUPPORT // Support over-the-air firmware updates #endif /** * Prusa Multi-Material Unit v2 * Enable in Configuration.h */ #if ENABLED(PRUSA_MMU2) // Serial port used for communication with MMU2. // For AVR enable the UART port used for the MMU. (e.g., internalSerial) // For 32-bit boards check your HAL for available serial ports. (e.g., Serial2) #define <API key> 2 #define MMU2_SERIAL internalSerial // Use hardware reset for MMU if a pin is defined for it //#define MMU2_RST_PIN 23 // Enable if the MMU2 has 12V stepper motors (MMU2 Firmware 1.0.2 and up) //#define MMU2_MODE_12V // G-code to execute when MMU2 F.I.N.D.A. probe detects filament runout #define <API key> "M600" // Add an LCD menu for MMU2 //#define MMU2_MENUS #if ENABLED(MMU2_MENUS) // Settings for filament load / unload from the LCD menu. // This is for Prusa MK3-style extruders. Customize for your hardware. #define <API key> 80.0 #define <API key> \ { 7.2, 562 }, \ { 14.4, 871 }, \ { 36.0, 1393 }, \ { 14.4, 871 }, \ { 50.0, 198 } #define <API key> \ { 1.0, 1000 }, \ { 1.0, 1500 }, \ { 2.0, 2000 }, \ { 1.5, 3000 }, \ { 2.5, 4000 }, \ { -15.0, 5000 }, \ { -14.0, 1200 }, \ { -6.0, 600 }, \ { 10.0, 700 }, \ { -10.0, 400 }, \ { -50.0, 2000 } #endif //#define MMU2_DEBUG // Write debug info to serial output #endif // PRUSA_MMU2 /** * Advanced Print Counter settings */ #if ENABLED(PRINTCOUNTER) #define <API key> 3 // Activate up to 3 service interval watchdogs //#define SERVICE_NAME_1 "Service S" //#define SERVICE_INTERVAL_1 100 // print hours //#define SERVICE_NAME_2 "Service L" //#define SERVICE_INTERVAL_2 200 // print hours //#define SERVICE_NAME_3 "Service 3" //#define SERVICE_INTERVAL_3 1 // print hours #endif // @section develop /** * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins */ //#define PINS_DEBUGGING // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE
namespace Maticsoft.TaoBao.Request { using Maticsoft.TaoBao; using Maticsoft.TaoBao.Util; using System; using System.Collections.Generic; using System.Runtime.CompilerServices; public class <API key> : ITopRequest<<API key>> { private IDictionary<string, string> otherParameters; public void AddOtherParameter(string key, string value) { if (this.otherParameters == null) { this.otherParameters = new TopDictionary(); } this.otherParameters.Add(key, value); } public string GetApiName() { return "taobao.taobaoke.shops.convert"; } public IDictionary<string, string> GetParameters() { TopDictionary dictionary = new TopDictionary(); dictionary.Add("fields", this.Fields); dictionary.Add("is_mobile", this.IsMobile); dictionary.Add("nick", this.Nick); dictionary.Add("outer_code", this.OuterCode); dictionary.Add("pid", this.Pid); dictionary.Add("seller_nicks", this.SellerNicks); dictionary.Add("sids", this.Sids); dictionary.AddAll(this.otherParameters); return dictionary; } public void Validate() { RequestValidator.ValidateRequired("fields", this.Fields); RequestValidator.ValidateMaxListSize("seller_nicks", this.SellerNicks, 10); RequestValidator.ValidateMaxListSize("sids", this.Sids, 10); } public string Fields { get; set; } public bool? IsMobile { get; set; } public string Nick { get; set; } public string OuterCode { get; set; } public long? Pid { get; set; } public string SellerNicks { get; set; } public string Sids { get; set; } } }
@import scala.collection.mutable.Buffer @import controllers.gsn.auth.GSNGroup @import models.gsn.auth._ @(vs: Buffer[models.gsn.auth.DataSource], groups: Buffer[models.gsn.auth.Group], users: Buffer[models.gsn.auth.User], count:Int, page:Int, pageLength:Int) @import helper._ @<API key> = @{ FieldConstructor(<TwitterConsumerkey>.f) } @main(Messages("gsn.access.vs.title"),"vslist") { <div id="groups" class="row"> <div class="col-md-12"> <h1>@Messages("gsn.access.vs.title")</h1> </div> </div> <div id="groups" class="row"> <div class="col-xs-12 col-md-12"> <table class="table table-striped"> <thead> <tr> <th>@Messages("gsn.access.vs.title")</th> <th>@Messages("gsn.access.vs.allowed.read.users")</th> <th>@Messages("gsn.access.vs.allowed.read.groups")</th> <th>@Messages("gsn.access.vs.allowed.write.users")</th> <th>@Messages("gsn.access.vs.allowed.write.groups")</th> <th>@Messages("gsn.access.vs.allowed.all")</th> </tr> </thead> <tbody> @for(v <- vs) { <tr id="row_@v.id" @if(v.is_public){ class="success" }> <td>@v.value</td> <td> <ul class="list-unstyled hideable"> @for(u <- v.userRead) { <li>@u.user.firstName @u.user.lastName (@u.user.email) <button type="button" class="btn btn-danger btn-xs" onclick="$.post('@controllers.gsn.auth.routes.<API key>.removefromvs(page)?vs_id=' + @v.id + '&id=ur' + @u.user.id, function(data){document.location='@controllers.gsn.auth.routes.<API key>.vs(page)'});">@Messages("gsn.access.users.remove")</button> </li> } @if(v.userRead.size < users.size){ <li><select id="ur_@v.id"> @for(u <- users) { @if(null == UserDataSourceRead.findByBoth(u,v)){ <option value="ur@u.id">@u.firstName @u.lastName (@u.email)</option> } } </select> <button type="button" class="btn btn-primary btn-xs" onclick="$.post('@controllers.gsn.auth.routes.<API key>.addtovs(page)?vs_id=' + @v.id + '&id=' + $('#ur_@v.id').val(), function(data){document.location='@controllers.gsn.auth.routes.<API key>.vs(page)'});">@Messages("gsn.access.groups.add")</button> </li> } </ul> </td> <td> <ul class="list-unstyled hideable"> @for(g <- v.groupRead) { <li>[ @g.group.getName ] <button type="button" class="btn btn-danger btn-xs" onclick="$.post('@controllers.gsn.auth.routes.<API key>.removefromvs(page)?vs_id=' + @v.id + '&id=gr' + @g.group.id, function(data){document.location='@controllers.gsn.auth.routes.<API key>.vs(page)'});">@Messages("gsn.access.users.remove")</button> </li> <span class="text-muted"> <ul class="list-inline"> @for(u <- g.group.users){ <li>@u.firstName @u.lastName (@u.email)</li> } </ul> </span> </li> } @if(v.groupRead.size < groups.size){ <li><select id="gr_@v.id"> @for(g <- groups) { @if(null == GroupDataSourceRead.findByBoth(g,v)){ <option value="gr@g.id">[ @g.name ]</option> } } </select> <button type="button" class="btn btn-primary btn-xs" onclick="$.post('@controllers.gsn.auth.routes.<API key>.addtovs(page)?vs_id=' + @v.id + '&id=' + $('#gr_@v.id').val(), function(data){document.location='@controllers.gsn.auth.routes.<API key>.vs(page)'});">@Messages("gsn.access.groups.add")</button> </li> } </ul> </td> <td> <ul class="list-unstyled hideable"> @for(u <- v.userWrite) { <li>@u.user.firstName @u.user.lastName (@u.user.email) <button type="button" class="btn btn-danger btn-xs" onclick="$.post('@controllers.gsn.auth.routes.<API key>.removefromvs(page)?vs_id=' + @v.id + '&id=uw' + @u.user.id, function(data){document.location='@controllers.gsn.auth.routes.<API key>.vs(page)'});">@Messages("gsn.access.users.remove")</button> </li> } @if(v.userWrite.size < users.size){ <li><select id="uw_@v.id"> @for(u <- users) { @if(null == UserDataSourceWrite.findByBoth(u,v)){ <option value="uw@u.id">@u.firstName @u.lastName (@u.email)</option> } } </select> <button type="button" class="btn btn-primary btn-xs" onclick="$.post('@controllers.gsn.auth.routes.<API key>.addtovs(page)?vs_id=' + @v.id + '&id=' + $('#uw_@v.id').val(), function(data){document.location='@controllers.gsn.auth.routes.<API key>.vs(page)'});">@Messages("gsn.access.groups.add")</button> </li> } </ul> </td> <td> <ul class="list-unstyled hideable"> @for(g <- v.groupWrite) { <li>[ @g.group.getName ] <button type="button" class="btn btn-danger btn-xs" onclick="$.post('@controllers.gsn.auth.routes.<API key>.removefromvs(page)?vs_id=' + @v.id + '&id=gw' + @g.group.id, function(data){document.location='@controllers.gsn.auth.routes.<API key>.vs(page)'});">@Messages("gsn.access.users.remove")</button> </li> <span class="text-muted"> <ul class="list-inline"> @for(u <- g.group.users){ <li>@u.firstName @u.lastName (@u.email)</li> } </ul> </span> </li> } @if(v.groupWrite.size < groups.size){ <li><select id="gw_@v.id"> @for(g <- groups) { @if(null == <API key>.findByBoth(g,v)){ <option value="gw@g.id">[ @g.name ]</option> } } </select> <button type="button" class="btn btn-primary btn-xs" onclick="$.post('@controllers.gsn.auth.routes.<API key>.addtovs(page)?vs_id=' + @v.id + '&id=' + $('#gw_@v.id').val(), function(data){document.location='@controllers.gsn.auth.routes.<API key>.vs(page)'});">@Messages("gsn.access.groups.add")</button> </li> } </ul> </td> <td> <input type="checkbox" @if(v.is_public) { checked="checked" } data-id="@v.id" onchange="check(this);"/> </td> </tr> } </tbody> </table> @paginate(page, pageLength, count, controllers.gsn.auth.routes.<API key>.vs(_)) </div> </div> <script type="text/javascript"> function check(item){ var i = $(item); if (i[0].checked){ $.post('@controllers.gsn.auth.routes.<API key>.addtovs(page)?vs_id=' + i.data('id') + '&id=a', function(data){$('#row_'+i.data('id')).toggleClass('success',true)}) }else{ $.post('@controllers.gsn.auth.routes.<API key>.removefromvs(page)?vs_id=' + i.data('id') + '&id=a', function(data){$('#row_'+i.data('id')).toggleClass('success',false)}) } } $('select').select2(); </script> }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> <HEAD> <TITLE>AKA AFS http: <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb_2312-80"> </HEAD> <BODY bgcolor="#FFFFFF"> <p><b>&lt;<a href="AFS014.html"></a>&gt;&lt;<a href="AFS016.html"></a>&gt;</b></p> <p><img src="AFS015.gif" width="959" height="719"> </p> </BODY> </HTML>
<ons-navigator var="app.navigator"> <ons-page <API key>="app.navigator.popPage()" ng-controller="usuarioCtrl"> <ons-toolbar> <div class="left"> <ons-toolbar-button ng-click="app.slidingMenu.toggleMenu()"><ons-icon icon="bars"></ons-icon></ons-toolbar-button> </div> <div class="center"> Contactos {{getTipoContratacion()}} </div> <div class="right"> </div> </ons-toolbar> <ons-list ng-show="(getContratacion().length !== 0)"> <ons-list-item modifier="chevron" class="list-item-container" ng-repeat="contratacion in getContratacion()" ng-click="<API key>($index)" > <ons-row> <ons-col width="95px"> <img src="https://placeholdit.imgix.net/~text?txtsize=12&amp;txt=%27Sin+imagenes%27&amp;w=90&amp;h=90" alt="Sin imagenes" title="Sin imagenes" class="thumbnail" ng-show="contratacion.idPublicacion.imagenCollection.length === 0" > <img src="http: alt="" class="thumbnail" ng-show="contratacion.idPublicacion.imagenCollection.length !== 0"> </ons-col> <ons-col> <div class="name"> {{contratacion.idPublicacion.titulo}} </div> <div class="location"> <i class="fa fa-calendar"></i> {{contratacion.fecha| date:'dd/MM/yyyy'}} </div> <div class="desc"> <span class="labelito labelito-{{((contratacion.fechaCancelacion === null && contratacion.fechaConfirmacion === null)) ? 'info' : (contratacion.fechaCancelacion !== null) ? 'danger' : (contratacion.fechaConfirmacion !== null) ? 'success' : 'warning'}}"> {{((contratacion.fechaCancelacion === null && contratacion.fechaConfirmacion === null)) ? 'Pendiente' : (contratacion.fechaCancelacion !== null) ? 'Cancelado' : (contratacion.fechaConfirmacion !== null) ? 'Confirmado' : ''}}</span> </div> </ons-col> <ons-col width="40px"></ons-col> </ons-row> </ons-list-item> </ons-list> <ons-list modifier="inset" class="settings-list" style="text-align: center" ng-show="(getContratacion().length === 0)"> <ons-list-item> No hay contactos </ons-list-item> </ons-list> </ons-page> </ons-navigator>
var path = require('path') var BrowserWindow = require('electron').BrowserWindow var shell = require('electron').shell var extend = require('xtend') var webPreferences = { nodeIntegration: false, javascript: true, webSecurity: true, images: true, java: false, webgl: false, // maybe allow? webaudio: false, // maybe allow? plugins: false, <API key>: false, <API key>: false, sharedWorker: false } // retain global references, if not, window will be closed automatically when // garbage collected var _windows = {} function _createWindow (opts) { var window = new BrowserWindow(opts) _windows[window.id] = window return window } // should not need to be called directly, but just in case // window.destroy() is ever called function _unref () { delete _windows[this.id] } function create (opts) { opts = extend({ width: 1100, height: 800, preload: require('path').join(__dirname, '../ui/preload.js'), webPreferences: webPreferences }, opts) var window = _createWindow(opts) window.unref = _unref.bind(window) window.once('close', window.unref) window.webContents.on('new-window', function (e, url) { // open in the browser e.preventDefault() shell.openExternal(url) }) return window } module.exports = { create: create, windows: _windows, hasVisibleWindows: function () { Object.keys(_windows).some(function (id) { var window = _windows[id] return window.isVisible() }) } }
package com.sldeditor.filter.v2.function; import com.sldeditor.ui.detail.config.base.<API key>; import java.util.List; import org.opengis.filter.Filter; import org.opengis.filter.capability.FunctionName; import org.opengis.filter.expression.Expression; /** * The Interface FilterNameInterface. * * @author Robert Ward (SCISYS) */ public interface FilterNameInterface { /** * Gets the filter config list. * * @return the filter config list */ List<<API key>> getFilterConfigList(); /** * Creates the expression. * * @param functionName the function name * @return the expression */ Expression createExpression(FunctionName functionName); /** * Convert function parameters to ui components. * * @param panelId the panel id * @param functionName the function name * @return the list of ui components to display */ List<<API key>> convertParameters(Class<?> panelId, FunctionName functionName); /** * Gets the function type for the given function name. * * @param functionName the function name * @return the function type */ Class<?> getFunctionType(String functionName); /** * Gets the filter config. * * @param filterClassName the filter class name * @return the filter config */ <API key> getFilterConfig(String filterClassName); /** * Gets the filter config. * * @param filter the filter * @return the filter config */ <API key> getFilterConfig(Filter filter); }
#ifndef <API key> #define <API key> #include <cassert> <API key> // Implementation of the polymorph factory manufacturer interface template <class Traits> class sdn_fact_enumerator : public <API key> , public aux::sdn_fact_utils<Traits> { private: typedef mirror::aux::sdn_fact_param<Traits> param_type; typedef mirror::aux::sdn_fact_handler<Traits> handler_type; typedef mirror::aux::<API key><Traits> native_handler; struct wrapper_type { shared<meta_enum> enumeration; wrapper_type(const shared<meta_enum>& e) : enumeration(e) { assert(enumeration); } double operator()(const std::string& str) { return enumeration->has_value_name(str) ? 1.0 : 0.0; } } wrapper; std::shared_ptr<native_handler> handler; public: sdn_fact_enumerator( raw_ptr parent_data, const shared<meta_parameter>& param, const <API key>& context ): wrapper(param->type().as<meta_enum>()) , handler( new native_handler( this->deref(parent_data), param->type()->full_name(), param->base_name(), std::ref(wrapper) ) ) { } void finish(raw_ptr parent_data) { this->deref(parent_data).handler().add_subhandler(handler.get()); } int create(void) { return wrapper.enumeration->value_by_name(handler->literal()); } }; <API key> #endif //include guard
layout: default nav: maps body_id: maps <div class="col-md-12"> <div class="hero-unit"> <h1>SeaGL 2014 Directions and Maps</h1> </div> <div class="row"> <div class="col-md-12"> <h2>SCC Address</h2> <p>1701 Broadway Seattle, WA 98122 - <a target="_blank" href="https://maps.google.com/maps?q=Seattle+Central+College,+Broadway,+Seattle,+WA&hl=en&ll=47.616376,-122.321348&spn=0.002839,0.005917&sll=47.616135,-122.320806&sspn=0.001427,0.002958&oq=SCC,+&t=m&z=18">View in Google Maps</a></p> <p> <div id="map_canvas" style="width: 900px; height: 400px;"></div> </p> </div> </div> <hr> <div class="row"> <div class="col-md-12"> <h2>Driving Directions - From Interstate 5 Northbound</h2> <p>Take Olive Way/Denny Way Exit 166 (under the Washington State Convention and Trade Center) and follow Olive Way east to Denny Way and turn right. Go up the hill and turn right on Broadway. Follow Broadway south to Pine, turn right, and go one block west to the Parking Garage located at Harvard and Pine.</p> </div> </div> <div class="row"> <div class="col-md-12"> <h2>Driving Directions - From Interstate 5 Southbound</h2> <p>Follow the Madison Street/Convention Center exit (#165), making a right hand turn onto Madison. Get into the left lane and turn left at Boren. Follow Boren north until Pine Street, and turn right at Pine going east. Follow Pine Street east until Harvard Ave. Turn left onto Harvard, then make an immediate left turn into the Harvard Ave. parking garage.</p> </div> </div> <hr> <div class="row"> <div class="col-md-12"> <h2>Parking</h2> <p>There are several private parking lots located near the front entrance at 1701 Broadway Ave. or on Harvard Avenue, which parallels Broadway behind the school. There also is metered 2-hour street parking.</p> <p>Please use street parking or private parking. SCC's lots are for teachers and students.</p> <p>Here's a crude map of the parking around SCC. <a href="/img/maps/2014/Street_Parking_Map.png">Street_Parking_Map.png</a></p> </div> </div> <hr> <div class="row"> <div class="col-md-12"> <h2>Session Map - First Floor - Expo Hall</h2> <p><img src="/img/maps/2014/<API key>.png"></p> </div> </div> <div class="row"> <div class="col-md-12"> <h2>Session Map - Third Floor - Speaking Sessions</h2> <p><img src="/img/maps/2014/<API key>.png"></p> </div> </div> </div> <script type='text/javascript' src="//maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script> <script type='text/javascript'> $(function(){ var mapOptions = { zoom: 17, center: new google.maps.LatLng(47.616248,-122.321426), mapTypeId: google.maps.MapTypeId.HYBRID }; gMap = new google.maps.Map(document.getElementById('map_canvas'), mapOptions); var marker = new google.maps.Marker({ position: new google.maps.LatLng(47.616248,-122.321426), map: gMap, title: 'SeaGL @ SCC' }); var contentString = '<div id="content">'+ '<div id="siteNotice">'+ '</div>'+ '<h1 id="firstHeading" class="firstHeading">SeaGL @ SCC</h1>'+ '<div id="bodyContent">'+ '<p>1701 Broadway Seattle, WA 98122</p>'+ '</div>'+ '</div>'; var infowindow = new google.maps.InfoWindow({ content: contentString }); google.maps.event.addListener(marker, 'click', function() { infowindow.open(gMap, marker); }); }); </script>
import React, { Component } from 'react'; import Channel from './team-channel' import ChannelButton from './team-channel-button' import Host from './team-host' class Team extends Component { channelButtons = () => { var rval = [] var raids = this.props.state.raids.raids for ( var cName in raids ) { var cRaidKeys = Object.keys(raids[cName]) if ( cRaidKeys.length < 1 ) { continue } rval.push(( <ChannelButton key={cName} keys={cRaidKeys} name={cName} data={raids[cName]} state={this.props.state}/> )) } return rval } channel = () => { var myChan = this.props.state.vars.chan if ( typeof myChan === "undefined" || myChan === "" ) { return null } var myRaids = this.props.state.raids.raids[myChan] if ( typeof myRaids === "undefined" ) { return null } var cRaidKeys = Object.keys(myRaids) if ( cRaidKeys.length < 1 ) { return null } return ( <Channel key={myChan} keys={cRaidKeys} name={myChan} data={myRaids} state={this.props.state}/> ) } host = () => { return (<Host state={this.props.state}/>) } render = () => { if ( this.props.state.navHeight < 1 ) { return(<div/>) } if ( this.props.state.vars.raid === "host" ) { return this.host() } return ( <div className="team container container-fluid"> <div className="row"> <div className="col"> <div className="btn-group-vertical w-100">{this.channelButtons()}</div> </div> </div> <div className="row"> <div className="col"> {this.channel()} </div> </div> </div> ); } } export default Team
using UnityEngine; using System.Collections.Generic; namespace TMPro { //[System.Serializable] public class TMP_SpriteAsset : TMP_Asset { // The texture which contains the sprites. public Texture spriteSheet; // The material used to render these sprites. public Material material; // List which contains the SpriteInfo for the sprites contained in the sprite sheet. public List<TMP_Sprite> spriteInfoList; // List which contains the individual sprites. private List<Sprite> m_sprites; void OnEnable() { } public void AddSprites(string path) { } void OnValidate() { //Debug.Log("OnValidate called on SpriteAsset."); //if (updateSprite) //UpdateSpriteArray(); // updateSprite = false; TMPro_EventManager.<API key>(true, this); } #if UNITY_EDITOR public void LoadSprites() { if (m_sprites != null && m_sprites.Count > 0) return; Debug.Log("Loading Sprite List"); string filePath = UnityEditor.AssetDatabase.GetAssetPath(spriteSheet); Object[] objects = UnityEditor.AssetDatabase.LoadAllAssetsAtPath(filePath); m_sprites = new List<Sprite>(); foreach (Object obj in objects) { if (obj.GetType() == typeof(Sprite)) { Sprite sprite = obj as Sprite; Debug.Log("Sprite # " + m_sprites.Count + " Rect: " + sprite.rect); m_sprites.Add(sprite); } } } public List<Sprite> GetSprites() { if (m_sprites != null && m_sprites.Count > 0) return m_sprites; //Debug.Log("Loading Sprite List"); string filePath = UnityEditor.AssetDatabase.GetAssetPath(spriteSheet); Object[] objects = UnityEditor.AssetDatabase.LoadAllAssetsAtPath(filePath); m_sprites = new List<Sprite>(); foreach (Object obj in objects) { if (obj.GetType() == typeof(Sprite)) { Sprite sprite = obj as Sprite; //Debug.Log("Sprite # " + m_sprites.Count + " Rect: " + sprite.rect); m_sprites.Add(sprite); } } return m_sprites; } #endif } }
* [Jenkins](./jenkins/) * [Joomla!](./joomla/)
package edu.uminho.biosynth.core.data.integration.staging; import static org.junit.Assert.*; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import pt.uminho.sysbio.biosynthframework.biodb.helper.<API key>; import pt.uminho.sysbio.biosynthframework.biodb.kegg.<API key>; import pt.uminho.sysbio.biosynthframework.core.data.io.dao.IGenericDao; import pt.uminho.sysbio.biosynthframework.core.data.io.dao.hibernate.<API key>; import edu.uminho.biosynth.core.data.integration.etl.staging.components.<API key>; import edu.uminho.biosynth.core.data.integration.etl.staging.components.<API key>; import edu.uminho.biosynth.core.data.integration.etl.staging.components.MetaboliteStga; import edu.uminho.biosynth.core.data.integration.etl.staging.transform.<API key>; import edu.uminho.biosynth.core.data.integration.references.<API key>; public class <API key> { public static SessionFactory sessionFactory; private static IGenericDao dao; private static Transaction tx; @BeforeClass public static void setUpBeforeClass() throws Exception { sessionFactory = <API key>.<API key>("<API key>.cfg.xml"); dao = new <API key>(sessionFactory); } @AfterClass public static void tearDownAfterClass() throws Exception { } @Before public void setUp() throws Exception { tx = sessionFactory.getCurrentSession().beginTransaction(); } @After public void tearDown() throws Exception { tx.commit(); } @Test public void <API key>() { MetaboliteStga cpdStaging = new MetaboliteStga(); cpdStaging.setNumeryKey(0); cpdStaging.setTextKey("compound-0"); // <API key> formula_dim = new <API key>(); // formula_dim.getMetaboliteStgas().add(cpdStaging); // formula_dim.setFormula("H2O"); // cpdStaging.<API key>(formula_dim); dao.save(cpdStaging); } @Test public void <API key>() { MetaboliteStga cpdStaging = new MetaboliteStga(); cpdStaging.setNumeryKey(0); cpdStaging.setTextKey("C00001"); <API key> formula_h2o = new <API key>(); // formula_h2o.setId(0); formula_h2o.setFormula("H2O"); dao.save(formula_h2o); cpdStaging.setFormula("H2O"); cpdStaging.<API key>(formula_h2o); dao.save(cpdStaging); } @Test public void <API key>() { <API key> transformer = new <API key>(); <API key> keggStageLoader = new <API key>(); keggStageLoader.setTransformer(transformer); keggStageLoader.setDao(dao); <API key> cpdKegg1 = new <API key>(); cpdKegg1.setId(283L); cpdKegg1.setEntry("C98222"); cpdKegg1.setFormula("H20C90O100"); cpdKegg1.setRemark(":)"); cpdKegg1.setComment("manual"); cpdKegg1.setDescription("fake"); cpdKegg1.setName("some crazy compound; compound xpto;"); MetaboliteStga cpd_stga = keggStageLoader.etlTransform(cpdKegg1); dao.save(cpd_stga); } }
#ifndef _ImageNormalizer_H #define _ImageNormalizer_H #include <DiagramBaseItems.h> #include <DiagramItemFactory.h> #include <Nodes/Node.h> #include "datatypes.h" #include <image/image.hpp> class ImageNormalizer : public Node { Q_OBJECT protected: image::basic_image<short,3> image_data; ImageC* im; ImageC* result; protected: virtual QVariant* get_output_by_index(int out_id); virtual void set_input_by_index(int in_id, QVariant* varvalue); public: ImageNormalizer(QObject *parent = 0); ~ImageNormalizer(); virtual void setConnectedInPorts(); // set in pipeline::load virtual QString uniqueKey() const; // Selectors virtual void init(); virtual int execute(); virtual int validateDesign(); virtual int validateRun(); virtual void clearNodeData(); void set_input(int in_port_id, QVariant* varvalue); QVariant* get_output(int out_port_id); bool isAllInputsReady(); virtual ImageNormalizer* copy() const; void markDirty(); bool isSuperfluous() const; }; #endif
// xmpparse.cpp // Read an XMP packet from a file, parse it and print all (known) properties. #include <exiv2/exiv2.hpp> #include <string> #include <iostream> #include <iomanip> int main(int argc, char* const argv[]) try { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); #ifdef EXV_ENABLE_BMFF Exiv2::enableBMFF(); #endif if (argc != 2) { std::cout << "Usage: " << argv[0] << " file\n"; return 1; } Exiv2::DataBuf buf = Exiv2::readFile(argv[1]); std::string xmpPacket; xmpPacket.assign(reinterpret_cast<char*>(buf.pData_), buf.size_); Exiv2::XmpData xmpData; if (0 != Exiv2::XmpParser::decode(xmpData, xmpPacket)) { std::string error(argv[1]); error += ": Failed to parse file contents (XMP packet)"; throw Exiv2::Error(Exiv2::kerErrorMessage, error); } if (xmpData.empty()) { std::string error(argv[1]); error += ": No XMP properties found in the XMP packet"; throw Exiv2::Error(Exiv2::kerErrorMessage, error); } for (Exiv2::XmpData::const_iterator md = xmpData.begin(); md != xmpData.end(); ++md) { std::cout << std::setfill(' ') << std::left << std::setw(44) << md->key() << " " << std::setw(9) << std::setfill(' ') << std::left << md->typeName() << " " << std::dec << std::setw(3) << std::setfill(' ') << std::right << md->count() << " " << std::dec << md->toString() << std::endl; } Exiv2::XmpParser::terminate(); return 0; } catch (Exiv2::AnyError& e) { std::cout << "Caught Exiv2 exception '" << e << "'\n"; return -1; }
#include "../common.h" #ifdef _WIN32 # define WIN32_LEAN_AND_MEAN # include <windows.h> #endif #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) # include <dirent.h> # include <sys/stat.h> # include <sys/types.h> # include <unistd.h> #elif defined(_WIN32) // Windows needs this for widechar <-> utf8 conversion utils # include "../localisation/Language.h" #endif #include "FileScanner.h" #include "Memory.hpp" #include "Path.hpp" #include "String.hpp" #include <memory> #include <stack> #include <string> #include <vector> enum class <API key> { DC_DIRECTORY, DC_FILE, }; struct DirectoryChild { <API key> Type; std::string Name; // Files only uint64_t Size = 0; uint64_t LastModified = 0; }; static uint32_t GetPathChecksum(const utf8* path); static bool MatchWildcard(const utf8* fileName, const utf8* pattern); class FileScannerBase : public IFileScanner { private: struct DirectoryState { std::string Path; std::vector<DirectoryChild> Listing; int32_t Index = 0; }; // Options std::string _rootPath; std::vector<std::string> _patterns; bool _recurse; // State bool _started = false; std::stack<DirectoryState> _directoryStack; // Current FileInfo* _currentFileInfo; utf8* _currentPath; public: FileScannerBase(const std::string& pattern, bool recurse) { _rootPath = Path::GetDirectory(pattern); _recurse = recurse; _patterns = GetPatterns(Path::GetFileName(pattern)); _currentPath = Memory::Allocate<utf8>(MAX_PATH); _currentFileInfo = Memory::Allocate<FileInfo>(); Reset(); } ~FileScannerBase() override { Memory::Free(_currentPath); Memory::Free(_currentFileInfo); } const FileInfo* GetFileInfo() const override { return _currentFileInfo; } const utf8* GetPath() const override { return _currentPath; } const utf8* GetPathRelative() const override { // +1 to remove the path separator return _currentPath + _rootPath.size() + 1; } void Reset() override { _started = false; _directoryStack = std::stack<DirectoryState>(); _currentPath[0] = 0; } bool Next() override { if (!_started) { _started = true; PushState(_rootPath); } while (!_directoryStack.empty()) { DirectoryState* state = &_directoryStack.top(); state->Index++; if (state->Index >= static_cast<int32_t>(state->Listing.size())) { _directoryStack.pop(); } else { const DirectoryChild* child = &state->Listing[state->Index]; if (child->Type == <API key>::DC_DIRECTORY) { if (_recurse) { utf8 childPath[MAX_PATH]; String::Set(childPath, sizeof(childPath), state->Path.c_str()); Path::Append(childPath, sizeof(childPath), child->Name.c_str()); PushState(childPath); } } else if (PatternMatch(child->Name)) { String::Set(_currentPath, MAX_PATH, state->Path.c_str()); Path::Append(_currentPath, MAX_PATH, child->Name.c_str()); _currentFileInfo->Name = child->Name.c_str(); _currentFileInfo->Size = child->Size; _currentFileInfo->LastModified = child->LastModified; return true; } } } return false; } virtual void <API key>(std::vector<DirectoryChild>& children, const std::string& path) abstract; private: void PushState(const std::string& directory) { DirectoryState newState; newState.Path = directory; newState.Index = -1; <API key>(newState.Listing, directory); _directoryStack.push(newState); } bool PatternMatch(const std::string& fileName) { for (const auto& pattern : _patterns) { if (MatchWildcard(fileName.c_str(), pattern.c_str())) { return true; } } return false; } static std::vector<std::string> GetPatterns(const std::string& delimitedPatterns) { std::vector<std::string> patterns; const utf8* start = delimitedPatterns.c_str(); const utf8* ch = start; utf8 c; do { c = *ch; if (c == '\0' || c == ';') { size_t length = static_cast<size_t>(ch - start); if (length > 0) { std::string newPattern = std::string(start, length); patterns.push_back(newPattern); } start = ch + 1; } ch++; } while (c != '\0'); patterns.shrink_to_fit(); return patterns; } }; #ifdef _WIN32 class FileScannerWindows final : public FileScannerBase { public: FileScannerWindows(const std::string& pattern, bool recurse) : FileScannerBase(pattern, recurse) { } void <API key>(std::vector<DirectoryChild>& children, const std::string& path) override { auto pattern = path + "\\*"; auto wPattern = String::ToWideChar(pattern.c_str()); WIN32_FIND_DATAW findData; HANDLE hFile = FindFirstFileW(wPattern.c_str(), &findData); if (hFile != <API key>) { do { if (lstrcmpW(findData.cFileName, L".") != 0 && lstrcmpW(findData.cFileName, L"..") != 0) { DirectoryChild child = CreateChild(&findData); children.push_back(child); } } while (FindNextFileW(hFile, &findData)); FindClose(hFile); } } private: static DirectoryChild CreateChild(const WIN32_FIND_DATAW* child) { DirectoryChild result; result.Name = String::ToUtf8(child->cFileName); if (child->dwFileAttributes & <API key>) { result.Type = <API key>::DC_DIRECTORY; } else { result.Type = <API key>::DC_FILE; result.Size = ((uint64_t)child->nFileSizeHigh << 32ULL) | (uint64_t)child->nFileSizeLow; result.LastModified = ((uint64_t)child->ftLastWriteTime.dwHighDateTime << 32ULL) | (uint64_t)child->ftLastWriteTime.dwLowDateTime; } return result; } }; #endif // _WIN32 #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) class FileScannerUnix final : public FileScannerBase { public: FileScannerUnix(const std::string& pattern, bool recurse) : FileScannerBase(pattern, recurse) { } void <API key>(std::vector<DirectoryChild>& children, const std::string& path) override { struct dirent** namelist; int32_t count = scandir(path.c_str(), &namelist, FilterFunc, alphasort); if (count > 0) { for (int32_t i = 0; i < count; i++) { const struct dirent* node = namelist[i]; if (!String::Equals(node->d_name, ".") && !String::Equals(node->d_name, "..")) { DirectoryChild child = CreateChild(path.c_str(), node); children.push_back(child); } free(namelist[i]); } free(namelist); } } private: static int32_t FilterFunc(const struct dirent* d) { return 1; } static DirectoryChild CreateChild(const utf8* directory, const struct dirent* node) { DirectoryChild result; result.Name = std::string(node->d_name); if (node->d_type == DT_DIR) { result.Type = <API key>::DC_DIRECTORY; } else { result.Type = <API key>::DC_FILE; // Get the full path of the file size_t pathSize = String::SizeOf(directory) + 1 + String::SizeOf(node->d_name) + 1; utf8* path = Memory::Allocate<utf8>(pathSize); String::Set(path, pathSize, directory); Path::Append(path, pathSize, node->d_name); struct stat statInfo { }; int32_t statRes = stat(path, &statInfo); if (statRes != -1) { result.Size = statInfo.st_size; result.LastModified = statInfo.st_mtime; if (S_ISDIR(statInfo.st_mode)) { result.Type = <API key>::DC_DIRECTORY; } } Memory::Free(path); } return result; } }; #endif // defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) IFileScanner* Path::ScanDirectory(const std::string& pattern, bool recurse) { #ifdef _WIN32 return new FileScannerWindows(pattern, recurse); #elif defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) return new FileScannerUnix(pattern, recurse); #endif } void Path::QueryDirectory(<API key>* result, const std::string& pattern) { IFileScanner* scanner = Path::ScanDirectory(pattern, true); while (scanner->Next()) { const FileInfo* fileInfo = scanner->GetFileInfo(); const utf8* path = scanner->GetPath(); result->TotalFiles++; result->TotalFileSize += fileInfo->Size; result-><API key> ^= static_cast<uint32_t>(fileInfo->LastModified >> 32) ^ static_cast<uint32_t>(fileInfo->LastModified & 0xFFFFFFFF); result-><API key> = ror32(result-><API key>, 5); result->PathChecksum += GetPathChecksum(path); } delete scanner; } std::vector<std::string> Path::GetDirectories(const std::string& path) { auto scanner = std::unique_ptr<IFileScanner>(ScanDirectory(path, false)); auto baseScanner = static_cast<FileScannerBase*>(scanner.get()); std::vector<DirectoryChild> children; baseScanner-><API key>(children, path); std::vector<std::string> subDirectories; for (const auto& c : children) { if (c.Type == <API key>::DC_DIRECTORY) { subDirectories.push_back(c.Name); } } return subDirectories; } static uint32_t GetPathChecksum(const utf8* path) { uint32_t hash = 0xD8430DED; for (const utf8* ch = path; *ch != '\0'; ch++) { hash += (*ch); hash += (hash << 10); hash ^= (hash >> 6); } hash += (hash << 3); hash ^= (hash >> 11); hash += (hash << 15); return hash; } static bool MatchWildcard(const utf8* fileName, const utf8* pattern) { while (*fileName != '\0') { switch (*pattern) { case '?': if (*fileName == '.') { return false; } break; case '*': do { pattern++; } while (*pattern == '*'); if (*pattern == '\0') { return false; } while (*fileName != '\0') { if (MatchWildcard(fileName++, pattern)) { return true; } } return false; default: if (toupper(*fileName) != toupper(*pattern)) { return false; } break; } pattern++; fileName++; } while (*pattern == '*') { ++fileName; } return *pattern == '\0'; }